@mappedin/mappedin-js 6.3.0 → 6.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/THIRD_PARTY_LICENSES.txt +19 -96
- package/lib/esm/{GLTFExporter-ZVF3Y5DX.js → GLTFExporter-4HV63LGP.js} +1 -1
- package/lib/esm/{GLTFLoader-3QTALUTA.js → GLTFLoader-HV7RBR5X.js} +1 -1
- package/lib/esm/{chunk-66DYOCZO.js → chunk-62AZLR6O.js} +1 -1
- package/lib/esm/chunk-DXHWFRA5.js +1 -0
- package/lib/esm/chunk-GYYVZ4IB.js +1 -0
- package/lib/esm/{chunk-YB4VFXKF.js → chunk-URGM6RST.js} +1 -1
- package/lib/esm/index.d.ts +1001 -647
- package/lib/esm/index.js +1 -1
- package/lib/esm/{inspector-B32KFAD4.js → inspector-J33EC64M.js} +1 -1
- package/lib/esm/{internal-RK6SZERV.js → internal-44KLJOB5.js} +1 -1
- package/lib/esm/{text3d-DIUCQLOC.js → text3d-RWSGYTTK.js} +1 -1
- package/lib/esm/workers/collision-worker.csp.js +1 -1
- package/package.json +2 -3
- package/lib/esm/chunk-2DEFE4C2.js +0 -1
- package/lib/esm/chunk-Q56Y72HB.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as Zu}from"./chunk-YB4VFXKF.js";import{B as Lm,C as Px,Ea as Cx,Ga as Mx,Ha as Ix,Ia as Ax,M as Pn,Na as Ex,T as Dm,U as ft,V as Rm,X as Bi,Y as km,Z as Er,_ as Lr,a as m,aa as zi,b as _,da as qn,e as gx,ea as wx,f as xx,g as bx,hb as Xu,i as Ja,pa as Tx,r as _x,t as vx,va as Sx}from"./chunk-66DYOCZO.js";import{a as Ze,b as wt,f as fr,g as Oi,h as se,i as C,j as Ke,k as mr,l as At}from"./chunk-5W2UDR4H.js";var fe=fr((DN,Gx)=>{"use strict";m();Gx.exports=Oo;function Oo(t,e){this.x=t,this.y=e}Oo.prototype={clone:function(){return new Oo(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}};Oo.convert=function(t){return t instanceof Oo?t:Array.isArray(t)?new Oo(t[0],t[1]):t}});var Xx=fr((kN,Hx)=>{"use strict";m();Hx.exports=jx;function jx(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}jx.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 Dv=fr((nj,Jd)=>{m();function ik(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 Jd<"u"&&(Jd.exports=ik)});var Rv=fr((oj,Qd)=>{m();function ok(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 Qd!==void 0&&(Qd.exports=ok)});var ey=fr((sj,yp)=>{m();var kv=Dv(),ak=Rv();yp.exports=kv;yp.exports.murmur3=kv;yp.exports.murmur2=ak});var my=fr((IX,_0)=>{"use strict";m();var Yk=fe();_0.exports=ca;function ca(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(Wk,this,e)}function Wk(t,e,r){t==1?e.id=r.readVarint():t==2?$k(r,e):t==3?e.type=r.readVarint():t==4&&(e._geometry=r.pos)}function $k(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}}ca.types=["Unknown","Point","LineString","Polygon"];ca.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 Yk(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};ca.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]};ca.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=ca.types[this.type],l,u;function c(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(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=Kk(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 h={type:"Feature",geometry:{type:s,coordinates:a},properties:this.properties};return"id"in this&&(h.id=this.id),h};function Kk(t){var e=t.length;if(e<=1)return[t];for(var r=[],n,i,o=0;o<e;o++){var a=Jk(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 Jk(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 dy=fr((EX,P0)=>{"use strict";m();var Qk=my();P0.exports=v0;function v0(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(eF,this,e),this.length=this._features.length}function eF(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(tF(r))}function tF(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}v0.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 Qk(this._pbf,e,this.extent,this._keys,this._values)}});var T0=fr((DX,w0)=>{"use strict";m();var rF=dy();w0.exports=nF;function nF(t,e){this.layers=t.readFields(iF,{},e)}function iF(t,e,r){if(t===3){var n=new rF(r,r.readVarint()+r.pos);n.length&&(e[n.name]=n)}}});var Pl=fr((kX,Rp)=>{m();Rp.exports.VectorTile=T0();Rp.exports.VectorTileFeature=my();Rp.exports.VectorTileLayer=dy()});var Y0=fr(_y=>{m();_y.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,h=r?-1:1,f=t[e+p];for(p+=h,o=f&(1<<-c)-1,f>>=-c,c+=s;c>0;o=o*256+t[e+p],p+=h,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=n;c>0;a=a*256+t[e+p],p+=h,c-=8);if(o===0)o=1-u;else{if(o===l)return a?NaN:(f?-1:1)*(1/0);a=a+Math.pow(2,n),o=o-u}return(f?-1:1)*a*Math.pow(2,o-n)};_y.write=function(t,e,r,n,i,o){var a,s,l,u=o*8-i-1,c=(1<<u)-1,p=c>>1,h=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=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),a+p>=1?e+=h/l:e+=h*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+f]=s&255,f+=d,s/=256,i-=8);for(a=a<<i|s,u+=i;u>0;t[r+f]=a&255,f+=d,a/=256,u-=8);t[r+f-d]|=g*128}});var Py=fr((Cq,Q0)=>{"use strict";m();Q0.exports=je;var zp=Y0();function je(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}je.Varint=0;je.Fixed64=1;je.Bytes=2;je.Fixed32=5;var vy=65536*65536,W0=1/vy,wF=12,J0=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");je.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=Vp(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=K0(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=Vp(this.buf,this.pos)+Vp(this.buf,this.pos+4)*vy;return this.pos+=8,t},readSFixed64:function(){var t=Vp(this.buf,this.pos)+K0(this.buf,this.pos+4)*vy;return this.pos+=8,t},readFloat:function(){var t=zp.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=zp.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,TF(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>=wF&&J0?zF(this.buf,e,t):BF(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!==je.Bytes)return t.push(this.readVarint(e));var r=Rn(this);for(t=t||[];this.pos<r;)t.push(this.readVarint(e));return t},readPackedSVarint:function(t){if(this.type!==je.Bytes)return t.push(this.readSVarint());var e=Rn(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==je.Bytes)return t.push(this.readBoolean());var e=Rn(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==je.Bytes)return t.push(this.readFloat());var e=Rn(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==je.Bytes)return t.push(this.readDouble());var e=Rn(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==je.Bytes)return t.push(this.readFixed32());var e=Rn(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==je.Bytes)return t.push(this.readSFixed32());var e=Rn(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==je.Bytes)return t.push(this.readFixed64());var e=Rn(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==je.Bytes)return t.push(this.readSFixed64());var e=Rn(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=t&7;if(e===je.Varint)for(;this.buf[this.pos++]>127;);else if(e===je.Bytes)this.pos=this.readVarint()+this.pos;else if(e===je.Fixed32)this.pos+=4;else if(e===je.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),ha(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),ha(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),ha(this.buf,t&-1,this.pos),ha(this.buf,Math.floor(t*W0),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),ha(this.buf,t&-1,this.pos),ha(this.buf,Math.floor(t*W0),this.pos+4),this.pos+=8},writeVarint:function(t){if(t=+t||0,t>268435455||t<0){SF(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=VF(this.buf,t,this.pos);var r=this.pos-e;r>=128&&$0(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),zp.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),zp.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&&$0(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,r){this.writeTag(t,je.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,IF,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,AF,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,DF,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,EF,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,LF,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,RF,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,kF,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,FF,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,OF,e)},writeBytesField:function(t,e){this.writeTag(t,je.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,je.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,je.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,je.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,je.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,je.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,je.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,je.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,je.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,je.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,!!e)}};function TF(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 pa(t,i,e);throw new Error("Expected varint not more than 10 bytes")}function Rn(t){return t.type===je.Bytes?t.readVarint()+t.pos:t.pos+1}function pa(t,e,r){return r?e*4294967296+(t>>>0):(e>>>0)*4294967296+(t>>>0)}function SF(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),CF(r,n,e),MF(n,e)}function CF(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 MF(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 $0(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 IF(t,e){for(var r=0;r<t.length;r++)e.writeVarint(t[r])}function AF(t,e){for(var r=0;r<t.length;r++)e.writeSVarint(t[r])}function EF(t,e){for(var r=0;r<t.length;r++)e.writeFloat(t[r])}function LF(t,e){for(var r=0;r<t.length;r++)e.writeDouble(t[r])}function DF(t,e){for(var r=0;r<t.length;r++)e.writeBoolean(t[r])}function RF(t,e){for(var r=0;r<t.length;r++)e.writeFixed32(t[r])}function kF(t,e){for(var r=0;r<t.length;r++)e.writeSFixed32(t[r])}function FF(t,e){for(var r=0;r<t.length;r++)e.writeFixed64(t[r])}function OF(t,e){for(var r=0;r<t.length;r++)e.writeSFixed64(t[r])}function Vp(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+t[e+3]*16777216}function ha(t,e,r){t[r]=e,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function K0(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function BF(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 zF(t,e,r){return J0.decode(t.subarray(e,r))}function VF(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 qC=fr((Mu,Na)=>{m();var jz=200,IC="__lodash_hash_undefined__",Hz=800,Xz=16,AC=9007199254740991,EC="[object Arguments]",Zz="[object Array]",qz="[object AsyncFunction]",Yz="[object Boolean]",Wz="[object Date]",$z="[object Error]",LC="[object Function]",Kz="[object GeneratorFunction]",Jz="[object Map]",Qz="[object Number]",e3="[object Null]",DC="[object Object]",t3="[object Proxy]",r3="[object RegExp]",n3="[object Set]",i3="[object String]",o3="[object Undefined]",a3="[object WeakMap]",s3="[object ArrayBuffer]",l3="[object DataView]",u3="[object Float32Array]",c3="[object Float64Array]",p3="[object Int8Array]",h3="[object Int16Array]",f3="[object Int32Array]",m3="[object Uint8Array]",d3="[object Uint8ClampedArray]",y3="[object Uint16Array]",g3="[object Uint32Array]",x3=/[\\^$.*+?()[\]{}|]/g,b3=/^\[object .+?Constructor\]$/,_3=/^(?:0|[1-9]\d*)$/,tt={};tt[u3]=tt[c3]=tt[p3]=tt[h3]=tt[f3]=tt[m3]=tt[d3]=tt[y3]=tt[g3]=!0;tt[EC]=tt[Zz]=tt[s3]=tt[Yz]=tt[l3]=tt[Wz]=tt[$z]=tt[LC]=tt[Jz]=tt[Qz]=tt[DC]=tt[r3]=tt[n3]=tt[i3]=tt[a3]=!1;var RC=typeof global=="object"&&global&&global.Object===Object&&global,v3=typeof self=="object"&&self&&self.Object===Object&&self,Eu=RC||v3||Function("return this")(),kC=typeof Mu=="object"&&Mu&&!Mu.nodeType&&Mu,Iu=kC&&typeof Na=="object"&&Na&&!Na.nodeType&&Na,FC=Iu&&Iu.exports===kC,zg=FC&&RC.process,bC=function(){try{var t=Iu&&Iu.require&&Iu.require("util").types;return t||zg&&zg.binding&&zg.binding("util")}catch(e){}}(),_C=bC&&bC.isTypedArray;function P3(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}function w3(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}function T3(t){return function(e){return t(e)}}function S3(t,e){return t==null?void 0:t[e]}function C3(t,e){return function(r){return t(e(r))}}var M3=Array.prototype,I3=Function.prototype,am=Object.prototype,Vg=Eu["__core-js_shared__"],sm=I3.toString,Gn=am.hasOwnProperty,vC=function(){var t=/[^.]+$/.exec(Vg&&Vg.keys&&Vg.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),OC=am.toString,A3=sm.call(Object),E3=RegExp("^"+sm.call(Gn).replace(x3,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),im=FC?Eu.Buffer:void 0,PC=Eu.Symbol,wC=Eu.Uint8Array,TC=im?im.allocUnsafe:void 0,BC=C3(Object.getPrototypeOf,Object),SC=Object.create,L3=am.propertyIsEnumerable,D3=M3.splice,So=PC?PC.toStringTag:void 0,om=function(){try{var t=Xg(Object,"defineProperty");return t({},"",{}),t}catch(e){}}(),R3=im?im.isBuffer:void 0,CC=Math.max,k3=Date.now,zC=Xg(Eu,"Map"),Au=Xg(Object,"create"),F3=function(){function t(){}return function(e){if(!Mo(e))return{};if(SC)return SC(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}();function Co(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function O3(){this.__data__=Au?Au(null):{},this.size=0}function B3(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}function z3(t){var e=this.__data__;if(Au){var r=e[t];return r===IC?void 0:r}return Gn.call(e,t)?e[t]:void 0}function V3(t){var e=this.__data__;return Au?e[t]!==void 0:Gn.call(e,t)}function U3(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=Au&&e===void 0?IC:e,this}Co.prototype.clear=O3;Co.prototype.delete=B3;Co.prototype.get=z3;Co.prototype.has=V3;Co.prototype.set=U3;function jn(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function N3(){this.__data__=[],this.size=0}function G3(t){var e=this.__data__,r=lm(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():D3.call(e,r,1),--this.size,!0}function j3(t){var e=this.__data__,r=lm(e,t);return r<0?void 0:e[r][1]}function H3(t){return lm(this.__data__,t)>-1}function X3(t,e){var r=this.__data__,n=lm(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}jn.prototype.clear=N3;jn.prototype.delete=G3;jn.prototype.get=j3;jn.prototype.has=H3;jn.prototype.set=X3;function Ga(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function Z3(){this.size=0,this.__data__={hash:new Co,map:new(zC||jn),string:new Co}}function q3(t){var e=cm(this,t).delete(t);return this.size-=e?1:0,e}function Y3(t){return cm(this,t).get(t)}function W3(t){return cm(this,t).has(t)}function $3(t,e){var r=cm(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this}Ga.prototype.clear=Z3;Ga.prototype.delete=q3;Ga.prototype.get=Y3;Ga.prototype.has=W3;Ga.prototype.set=$3;function ja(t){var e=this.__data__=new jn(t);this.size=e.size}function K3(){this.__data__=new jn,this.size=0}function J3(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}function Q3(t){return this.__data__.get(t)}function eV(t){return this.__data__.has(t)}function tV(t,e){var r=this.__data__;if(r instanceof jn){var n=r.__data__;if(!zC||n.length<jz-1)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new Ga(n)}return r.set(t,e),this.size=r.size,this}ja.prototype.clear=K3;ja.prototype.delete=J3;ja.prototype.get=Q3;ja.prototype.has=eV;ja.prototype.set=tV;function rV(t,e){var r=jg(t),n=!r&&Gg(t),i=!r&&!n&&GC(t),o=!r&&!n&&!i&&HC(t),a=r||n||i||o,s=a?w3(t.length,String):[],l=s.length;for(var u in t)(e||Gn.call(t,u))&&!(a&&(u=="length"||i&&(u=="offset"||u=="parent")||o&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||UC(u,l)))&&s.push(u);return s}function Ug(t,e,r){(r!==void 0&&!pm(t[e],r)||r===void 0&&!(e in t))&&Hg(t,e,r)}function nV(t,e,r){var n=t[e];(!(Gn.call(t,e)&&pm(n,r))||r===void 0&&!(e in t))&&Hg(t,e,r)}function lm(t,e){for(var r=t.length;r--;)if(pm(t[r][0],e))return r;return-1}function Hg(t,e,r){e=="__proto__"&&om?om(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var iV=gV();function um(t){return t==null?t===void 0?o3:e3:So&&So in Object(t)?xV(t):TV(t)}function MC(t){return Lu(t)&&um(t)==EC}function oV(t){if(!Mo(t)||PV(t))return!1;var e=qg(t)?E3:b3;return e.test(IV(t))}function aV(t){return Lu(t)&&jC(t.length)&&!!tt[um(t)]}function sV(t){if(!Mo(t))return wV(t);var e=NC(t),r=[];for(var n in t)n=="constructor"&&(e||!Gn.call(t,n))||r.push(n);return r}function VC(t,e,r,n,i){t!==e&&iV(e,function(o,a){if(i||(i=new ja),Mo(o))lV(t,e,a,r,VC,n,i);else{var s=n?n(Ng(t,a),o,a+"",t,e,i):void 0;s===void 0&&(s=o),Ug(t,a,s)}},XC)}function lV(t,e,r,n,i,o,a){var s=Ng(t,r),l=Ng(e,r),u=a.get(l);if(u){Ug(t,r,u);return}var c=o?o(s,l,r+"",t,e,a):void 0,p=c===void 0;if(p){var h=jg(l),f=!h&&GC(l),d=!h&&!f&&HC(l);c=l,h||f||d?jg(s)?c=s:AV(s)?c=mV(s):f?(p=!1,c=pV(l,!0)):d?(p=!1,c=fV(l,!0)):c=[]:EV(l)||Gg(l)?(c=s,Gg(s)?c=LV(s):(!Mo(s)||qg(s))&&(c=bV(l))):p=!1}p&&(a.set(l,c),i(c,l,n,o,a),a.delete(l)),Ug(t,r,c)}function uV(t,e){return CV(SV(t,e,ZC),t+"")}var cV=om?function(t,e){return om(t,"toString",{configurable:!0,enumerable:!1,value:RV(e),writable:!0})}:ZC;function pV(t,e){if(e)return t.slice();var r=t.length,n=TC?TC(r):new t.constructor(r);return t.copy(n),n}function hV(t){var e=new t.constructor(t.byteLength);return new wC(e).set(new wC(t)),e}function fV(t,e){var r=e?hV(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}function mV(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}function dV(t,e,r,n){var i=!r;r||(r={});for(var o=-1,a=e.length;++o<a;){var s=e[o],l=n?n(r[s],t[s],s,r,t):void 0;l===void 0&&(l=t[s]),i?Hg(r,s,l):nV(r,s,l)}return r}function yV(t){return uV(function(e,r){var n=-1,i=r.length,o=i>1?r[i-1]:void 0,a=i>2?r[2]:void 0;for(o=t.length>3&&typeof o=="function"?(i--,o):void 0,a&&_V(r[0],r[1],a)&&(o=i<3?void 0:o,i=1),e=Object(e);++n<i;){var s=r[n];s&&t(e,s,n,o)}return e})}function gV(t){return function(e,r,n){for(var i=-1,o=Object(e),a=n(e),s=a.length;s--;){var l=a[t?s:++i];if(r(o[l],l,o)===!1)break}return e}}function cm(t,e){var r=t.__data__;return vV(e)?r[typeof e=="string"?"string":"hash"]:r.map}function Xg(t,e){var r=S3(t,e);return oV(r)?r:void 0}function xV(t){var e=Gn.call(t,So),r=t[So];try{t[So]=void 0;var n=!0}catch(o){}var i=OC.call(t);return n&&(e?t[So]=r:delete t[So]),i}function bV(t){return typeof t.constructor=="function"&&!NC(t)?F3(BC(t)):{}}function UC(t,e){var r=typeof t;return e=e==null?AC:e,!!e&&(r=="number"||r!="symbol"&&_3.test(t))&&t>-1&&t%1==0&&t<e}function _V(t,e,r){if(!Mo(r))return!1;var n=typeof e;return(n=="number"?Zg(r)&&UC(e,r.length):n=="string"&&e in r)?pm(r[e],t):!1}function vV(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function PV(t){return!!vC&&vC in t}function NC(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||am;return t===r}function wV(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}function TV(t){return OC.call(t)}function SV(t,e,r){return e=CC(e===void 0?t.length-1:e,0),function(){for(var n=arguments,i=-1,o=CC(n.length-e,0),a=Array(o);++i<o;)a[i]=n[e+i];i=-1;for(var s=Array(e+1);++i<e;)s[i]=n[i];return s[e]=r(a),P3(t,this,s)}}function Ng(t,e){if(!(e==="constructor"&&typeof t[e]=="function")&&e!="__proto__")return t[e]}var CV=MV(cV);function MV(t){var e=0,r=0;return function(){var n=k3(),i=Xz-(n-r);if(r=n,i>0){if(++e>=Hz)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}function IV(t){if(t!=null){try{return sm.call(t)}catch(e){}try{return t+""}catch(e){}}return""}function pm(t,e){return t===e||t!==t&&e!==e}var Gg=MC(function(){return arguments}())?MC:function(t){return Lu(t)&&Gn.call(t,"callee")&&!L3.call(t,"callee")},jg=Array.isArray;function Zg(t){return t!=null&&jC(t.length)&&!qg(t)}function AV(t){return Lu(t)&&Zg(t)}var GC=R3||kV;function qg(t){if(!Mo(t))return!1;var e=um(t);return e==LC||e==Kz||e==qz||e==t3}function jC(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=AC}function Mo(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}function Lu(t){return t!=null&&typeof t=="object"}function EV(t){if(!Lu(t)||um(t)!=DC)return!1;var e=BC(t);if(e===null)return!0;var r=Gn.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&sm.call(r)==A3}var HC=_C?T3(_C):aV;function LV(t){return dV(t,XC(t))}function XC(t){return Zg(t)?rV(t,!0):sV(t)}var DV=yV(function(t,e,r){VC(t,e,r)});function RV(t){return function(){return t}}function ZC(t){return t}function kV(){return!1}Na.exports=DV});var vM=fr((aPe,zu)=>{"use strict";m();var eU=!1,Ao=!1,mM=!0,dM=!1,y={},yM=!1;typeof zu<"u"&&zu.exports?(zu.exports=y,yM=!0):typeof document<"u"?window.ClipperLib=y:self.ClipperLib=y;var _m;yM?(Ct="chrome",_m="Netscape"):(Ct=navigator.userAgent.toString().toLowerCase(),_m=navigator.appName);var Ct,Me={};Ct.indexOf("chrome")!=-1&&Ct.indexOf("chromium")==-1?Me.chrome=1:Me.chrome=0;Ct.indexOf("chromium")!=-1?Me.chromium=1:Me.chromium=0;Ct.indexOf("safari")!=-1&&Ct.indexOf("chrome")==-1&&Ct.indexOf("chromium")==-1?Me.safari=1:Me.safari=0;Ct.indexOf("firefox")!=-1?Me.firefox=1:Me.firefox=0;Ct.indexOf("firefox/17")!=-1?Me.firefox17=1:Me.firefox17=0;Ct.indexOf("firefox/15")!=-1?Me.firefox15=1:Me.firefox15=0;Ct.indexOf("firefox/3")!=-1?Me.firefox3=1:Me.firefox3=0;Ct.indexOf("opera")!=-1?Me.opera=1:Me.opera=0;Ct.indexOf("msie 10")!=-1?Me.msie10=1:Me.msie10=0;Ct.indexOf("msie 9")!=-1?Me.msie9=1:Me.msie9=0;Ct.indexOf("msie 8")!=-1?Me.msie8=1:Me.msie8=0;Ct.indexOf("msie 7")!=-1?Me.msie7=1:Me.msie7=0;Ct.indexOf("msie ")!=-1?Me.msie=1:Me.msie=0;y.biginteger_used=null;var Li,tU=0xdeadbeefcafe,hM=(tU&16777215)==15715070;function j(t,e,r){y.biginteger_used=1,t!=null&&(typeof t=="number"&&typeof e>"u"?this.fromInt(t):typeof t=="number"?this.fromNumber(t,e,r):e==null&&typeof t!="string"?this.fromString(t,256):this.fromString(t,e))}function ke(){return new j(null)}function rU(t,e,r,n,i,o){for(;--o>=0;){var a=e*this[t++]+r[n]+i;i=Math.floor(a/67108864),r[n++]=a&67108863}return i}function nU(t,e,r,n,i,o){for(var a=e&32767,s=e>>15;--o>=0;){var l=this[t]&32767,u=this[t++]>>15,c=s*l+u*a;l=a*l+((c&32767)<<15)+r[n]+(i&1073741823),i=(l>>>30)+(c>>>15)+s*u+(i>>>30),r[n++]=l&1073741823}return i}function iU(t,e,r,n,i,o){for(var a=e&16383,s=e>>14;--o>=0;){var l=this[t]&16383,u=this[t++]>>14,c=s*l+u*a;l=a*l+((c&16383)<<14)+r[n]+i,i=(l>>28)+(c>>14)+s*u,r[n++]=l&268435455}return i}hM&&_m=="Microsoft Internet Explorer"?(j.prototype.am=nU,Li=30):hM&&_m!="Netscape"?(j.prototype.am=rU,Li=26):(j.prototype.am=iU,Li=28);j.prototype.DB=Li;j.prototype.DM=(1<<Li)-1;j.prototype.DV=1<<Li;var nx=52;j.prototype.FV=Math.pow(2,nx);j.prototype.F1=nx-Li;j.prototype.F2=2*Li-nx;var oU="0123456789abcdefghijklmnopqrstuvwxyz",Pm=new Array,Ya,Nr;Ya=48;for(Nr=0;Nr<=9;++Nr)Pm[Ya++]=Nr;Ya=97;for(Nr=10;Nr<36;++Nr)Pm[Ya++]=Nr;Ya=65;for(Nr=10;Nr<36;++Nr)Pm[Ya++]=Nr;function fM(t){return oU.charAt(t)}function gM(t,e){var r=Pm[t.charCodeAt(e)];return r==null?-1:r}function aU(t){for(var e=this.t-1;e>=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s}function sU(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+this.DV:this.t=0}function Ei(t){var e=ke();return e.fromInt(t),e}function lU(t,e){var r;if(e==16)r=4;else if(e==8)r=3;else if(e==256)r=8;else if(e==2)r=1;else if(e==32)r=5;else if(e==4)r=2;else{this.fromRadix(t,e);return}this.t=0,this.s=0;for(var n=t.length,i=!1,o=0;--n>=0;){var a=r==8?t[n]&255:gM(t,n);if(a<0){t.charAt(n)=="-"&&(i=!0);continue}i=!1,o==0?this[this.t++]=a:o+r>this.DB?(this[this.t-1]|=(a&(1<<this.DB-o)-1)<<o,this[this.t++]=a>>this.DB-o):this[this.t-1]|=a<<o,o+=r,o>=this.DB&&(o-=this.DB)}r==8&&(t[0]&128)!=0&&(this.s=-1,o>0&&(this[this.t-1]|=(1<<this.DB-o)-1<<o)),this.clamp(),i&&j.ZERO.subTo(this,this)}function uU(){for(var t=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t}function cU(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(t==16)e=4;else if(t==8)e=3;else if(t==2)e=1;else if(t==32)e=5;else if(t==4)e=2;else return this.toRadix(t);var r=(1<<e)-1,n,i=!1,o="",a=this.t,s=this.DB-a*this.DB%e;if(a-- >0)for(s<this.DB&&(n=this[a]>>s)>0&&(i=!0,o=fM(n));a>=0;)s<e?(n=(this[a]&(1<<s)-1)<<e-s,n|=this[--a]>>(s+=this.DB-e)):(n=this[a]>>(s-=e)&r,s<=0&&(s+=this.DB,--a)),n>0&&(i=!0),i&&(o+=fM(n));return i?o:"0"}function pU(){var t=ke();return j.ZERO.subTo(this,t),t}function hU(){return this.s<0?this.negate():this}function fU(t){var e=this.s-t.s;if(e!=0)return e;var r=this.t;if(e=r-t.t,e!=0)return this.s<0?-e:e;for(;--r>=0;)if((e=this[r]-t[r])!=0)return e;return 0}function wm(t){var e=1,r;return(r=t>>>16)!=0&&(t=r,e+=16),(r=t>>8)!=0&&(t=r,e+=8),(r=t>>4)!=0&&(t=r,e+=4),(r=t>>2)!=0&&(t=r,e+=2),(r=t>>1)!=0&&(t=r,e+=1),e}function mU(){return this.t<=0?0:this.DB*(this.t-1)+wm(this[this.t-1]^this.s&this.DM)}function dU(t,e){var r;for(r=this.t-1;r>=0;--r)e[r+t]=this[r];for(r=t-1;r>=0;--r)e[r]=0;e.t=this.t+t,e.s=this.s}function yU(t,e){for(var r=t;r<this.t;++r)e[r-t]=this[r];e.t=Math.max(this.t-t,0),e.s=this.s}function gU(t,e){var r=t%this.DB,n=this.DB-r,i=(1<<n)-1,o=Math.floor(t/this.DB),a=this.s<<r&this.DM,s;for(s=this.t-1;s>=0;--s)e[s+o+1]=this[s]>>n|a,a=(this[s]&i)<<r;for(s=o-1;s>=0;--s)e[s]=0;e[o]=a,e.t=this.t+o+1,e.s=this.s,e.clamp()}function xU(t,e){e.s=this.s;var r=Math.floor(t/this.DB);if(r>=this.t){e.t=0;return}var n=t%this.DB,i=this.DB-n,o=(1<<n)-1;e[0]=this[r]>>n;for(var a=r+1;a<this.t;++a)e[a-r-1]|=(this[a]&o)<<i,e[a-r]=this[a]>>n;n>0&&(e[this.t-r-1]|=(this.s&o)<<i),e.t=this.t-r,e.clamp()}function bU(t,e){for(var r=0,n=0,i=Math.min(t.t,this.t);r<i;)n+=this[r]-t[r],e[r++]=n&this.DM,n>>=this.DB;if(t.t<this.t){for(n-=t.s;r<this.t;)n+=this[r],e[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<t.t;)n-=t[r],e[r++]=n&this.DM,n>>=this.DB;n-=t.s}e.s=n<0?-1:0,n<-1?e[r++]=this.DV+n:n>0&&(e[r++]=n),e.t=r,e.clamp()}function _U(t,e){var r=this.abs(),n=t.abs(),i=r.t;for(e.t=i+n.t;--i>=0;)e[i]=0;for(i=0;i<n.t;++i)e[i+r.t]=r.am(0,n[i],e,i,0,r.t);e.s=0,e.clamp(),this.s!=t.s&&j.ZERO.subTo(e,e)}function vU(t){for(var e=this.abs(),r=t.t=2*e.t;--r>=0;)t[r]=0;for(r=0;r<e.t-1;++r){var n=e.am(r,e[r],t,2*r,0,1);(t[r+e.t]+=e.am(r+1,2*e[r],t,2*r+1,n,e.t-r-1))>=e.DV&&(t[r+e.t]-=e.DV,t[r+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(r,e[r],t,2*r,0,1)),t.s=0,t.clamp()}function PU(t,e,r){var n=t.abs();if(!(n.t<=0)){var i=this.abs();if(i.t<n.t){e!=null&&e.fromInt(0),r!=null&&this.copyTo(r);return}r==null&&(r=ke());var o=ke(),a=this.s,s=t.s,l=this.DB-wm(n[n.t-1]);l>0?(n.lShiftTo(l,o),i.lShiftTo(l,r)):(n.copyTo(o),i.copyTo(r));var u=o.t,c=o[u-1];if(c!=0){var p=c*(1<<this.F1)+(u>1?o[u-2]>>this.F2:0),h=this.FV/p,f=(1<<this.F1)/p,d=1<<this.F2,g=r.t,x=g-u,b=e==null?ke():e;for(o.dlShiftTo(x,b),r.compareTo(b)>=0&&(r[r.t++]=1,r.subTo(b,r)),j.ONE.dlShiftTo(u,b),b.subTo(o,o);o.t<u;)o[o.t++]=0;for(;--x>=0;){var v=r[--g]==c?this.DM:Math.floor(r[g]*h+(r[g-1]+d)*f);if((r[g]+=o.am(0,v,r,x,0,u))<v)for(o.dlShiftTo(x,b),r.subTo(b,r);r[g]<--v;)r.subTo(b,r)}e!=null&&(r.drShiftTo(u,e),a!=s&&j.ZERO.subTo(e,e)),r.t=u,r.clamp(),l>0&&r.rShiftTo(l,r),a<0&&j.ZERO.subTo(r,r)}}}function wU(t){var e=ke();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(j.ZERO)>0&&t.subTo(e,e),e}function Eo(t){this.m=t}function TU(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t}function SU(t){return t}function CU(t){t.divRemTo(this.m,null,t)}function MU(t,e,r){t.multiplyTo(e,r),this.reduce(r)}function IU(t,e){t.squareTo(e),this.reduce(e)}Eo.prototype.convert=TU;Eo.prototype.revert=SU;Eo.prototype.reduce=CU;Eo.prototype.mulTo=MU;Eo.prototype.sqrTo=IU;function AU(){if(this.t<1)return 0;var t=this[0];if((t&1)==0)return 0;var e=t&3;return e=e*(2-(t&15)*e)&15,e=e*(2-(t&255)*e)&255,e=e*(2-((t&65535)*e&65535))&65535,e=e*(2-t*e%this.DV)%this.DV,e>0?this.DV-e:-e}function Lo(t){this.m=t,this.mp=t.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}function EU(t){var e=ke();return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo(j.ZERO)>0&&this.m.subTo(e,e),e}function LU(t){var e=ke();return t.copyTo(e),this.reduce(e),e}function DU(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e<this.m.t;++e){var r=t[e]&32767,n=r*this.mpl+((r*this.mph+(t[e]>>15)*this.mpl&this.um)<<15)&t.DM;for(r=e+this.m.t,t[r]+=this.m.am(0,n,t,e,0,this.m.t);t[r]>=t.DV;)t[r]-=t.DV,t[++r]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)}function RU(t,e){t.squareTo(e),this.reduce(e)}function kU(t,e,r){t.multiplyTo(e,r),this.reduce(r)}Lo.prototype.convert=EU;Lo.prototype.revert=LU;Lo.prototype.reduce=DU;Lo.prototype.mulTo=kU;Lo.prototype.sqrTo=RU;function FU(){return(this.t>0?this[0]&1:this.s)==0}function OU(t,e){if(t>4294967295||t<1)return j.ONE;var r=ke(),n=ke(),i=e.convert(this),o=wm(t)-1;for(i.copyTo(r);--o>=0;)if(e.sqrTo(r,n),(t&1<<o)>0)e.mulTo(n,i,r);else{var a=r;r=n,n=a}return e.revert(r)}function BU(t,e){var r;return t<256||e.isEven()?r=new Eo(e):r=new Lo(e),this.exp(t,r)}j.prototype.copyTo=aU;j.prototype.fromInt=sU;j.prototype.fromString=lU;j.prototype.clamp=uU;j.prototype.dlShiftTo=dU;j.prototype.drShiftTo=yU;j.prototype.lShiftTo=gU;j.prototype.rShiftTo=xU;j.prototype.subTo=bU;j.prototype.multiplyTo=_U;j.prototype.squareTo=vU;j.prototype.divRemTo=PU;j.prototype.invDigit=AU;j.prototype.isEven=FU;j.prototype.exp=OU;j.prototype.toString=cU;j.prototype.negate=pU;j.prototype.abs=hU;j.prototype.compareTo=fU;j.prototype.bitLength=mU;j.prototype.mod=wU;j.prototype.modPowInt=BU;j.ZERO=Ei(0);j.ONE=Ei(1);function zU(){var t=ke();return this.copyTo(t),t}function VU(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this[0];if(this.t==0)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]}function UU(){return this.t==0?this.s:this[0]<<24>>24}function NU(){return this.t==0?this.s:this[0]<<16>>16}function GU(t){return Math.floor(Math.LN2*this.DB/Math.log(t))}function jU(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function HU(t){if(t==null&&(t=10),this.signum()==0||t<2||t>36)return"0";var e=this.chunkSize(t),r=Math.pow(t,e),n=Ei(r),i=ke(),o=ke(),a="";for(this.divRemTo(n,i,o);i.signum()>0;)a=(r+o.intValue()).toString(t).substr(1)+a,i.divRemTo(n,i,o);return o.intValue().toString(t)+a}function XU(t,e){this.fromInt(0),e==null&&(e=10);for(var r=this.chunkSize(e),n=Math.pow(e,r),i=!1,o=0,a=0,s=0;s<t.length;++s){var l=gM(t,s);if(l<0){t.charAt(s)=="-"&&this.signum()==0&&(i=!0);continue}a=e*a+l,++o>=r&&(this.dMultiply(n),this.dAddOffset(a,0),o=0,a=0)}o>0&&(this.dMultiply(Math.pow(e,o)),this.dAddOffset(a,0)),i&&j.ZERO.subTo(this,this)}function ZU(t,e,r){if(typeof e=="number")if(t<2)this.fromInt(1);else for(this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(j.ONE.shiftLeft(t-1),ix,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(j.ONE.shiftLeft(t-1),this);else{var n=new Array,i=t&7;n.length=(t>>3)+1,e.nextBytes(n),i>0?n[0]&=(1<<i)-1:n[0]=0,this.fromString(n,256)}}function qU(){var t=this.t,e=new Array;e[0]=this.s;var r=this.DB-t*this.DB%8,n,i=0;if(t-- >0)for(r<this.DB&&(n=this[t]>>r)!=(this.s&this.DM)>>r&&(e[i++]=n|this.s<<this.DB-r);t>=0;)r<8?(n=(this[t]&(1<<r)-1)<<8-r,n|=this[--t]>>(r+=this.DB-8)):(n=this[t]>>(r-=8)&255,r<=0&&(r+=this.DB,--t)),(n&128)!=0&&(n|=-256),i==0&&(this.s&128)!=(n&128)&&++i,(i>0||n!=this.s)&&(e[i++]=n);return e}function YU(t){return this.compareTo(t)==0}function WU(t){return this.compareTo(t)<0?this:t}function $U(t){return this.compareTo(t)>0?this:t}function KU(t,e,r){var n,i,o=Math.min(t.t,this.t);for(n=0;n<o;++n)r[n]=e(this[n],t[n]);if(t.t<this.t){for(i=t.s&this.DM,n=o;n<this.t;++n)r[n]=e(this[n],i);r.t=this.t}else{for(i=this.s&this.DM,n=o;n<t.t;++n)r[n]=e(i,t[n]);r.t=t.t}r.s=e(this.s,t.s),r.clamp()}function JU(t,e){return t&e}function QU(t){var e=ke();return this.bitwiseTo(t,JU,e),e}function ix(t,e){return t|e}function e4(t){var e=ke();return this.bitwiseTo(t,ix,e),e}function xM(t,e){return t^e}function t4(t){var e=ke();return this.bitwiseTo(t,xM,e),e}function bM(t,e){return t&~e}function r4(t){var e=ke();return this.bitwiseTo(t,bM,e),e}function n4(){for(var t=ke(),e=0;e<this.t;++e)t[e]=this.DM&~this[e];return t.t=this.t,t.s=~this.s,t}function i4(t){var e=ke();return t<0?this.rShiftTo(-t,e):this.lShiftTo(t,e),e}function o4(t){var e=ke();return t<0?this.lShiftTo(-t,e):this.rShiftTo(t,e),e}function a4(t){if(t==0)return-1;var e=0;return(t&65535)==0&&(t>>=16,e+=16),(t&255)==0&&(t>>=8,e+=8),(t&15)==0&&(t>>=4,e+=4),(t&3)==0&&(t>>=2,e+=2),(t&1)==0&&++e,e}function s4(){for(var t=0;t<this.t;++t)if(this[t]!=0)return t*this.DB+a4(this[t]);return this.s<0?this.t*this.DB:-1}function l4(t){for(var e=0;t!=0;)t&=t-1,++e;return e}function u4(){for(var t=0,e=this.s&this.DM,r=0;r<this.t;++r)t+=l4(this[r]^e);return t}function c4(t){var e=Math.floor(t/this.DB);return e>=this.t?this.s!=0:(this[e]&1<<t%this.DB)!=0}function p4(t,e){var r=j.ONE.shiftLeft(t);return this.bitwiseTo(r,e,r),r}function h4(t){return this.changeBit(t,ix)}function f4(t){return this.changeBit(t,bM)}function m4(t){return this.changeBit(t,xM)}function d4(t,e){for(var r=0,n=0,i=Math.min(t.t,this.t);r<i;)n+=this[r]+t[r],e[r++]=n&this.DM,n>>=this.DB;if(t.t<this.t){for(n+=t.s;r<this.t;)n+=this[r],e[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<t.t;)n+=t[r],e[r++]=n&this.DM,n>>=this.DB;n+=t.s}e.s=n<0?-1:0,n>0?e[r++]=n:n<-1&&(e[r++]=this.DV+n),e.t=r,e.clamp()}function y4(t){var e=ke();return this.addTo(t,e),e}function g4(t){var e=ke();return this.subTo(t,e),e}function x4(t){var e=ke();return this.multiplyTo(t,e),e}function b4(){var t=ke();return this.squareTo(t),t}function _4(t){var e=ke();return this.divRemTo(t,e,null),e}function v4(t){var e=ke();return this.divRemTo(t,null,e),e}function P4(t){var e=ke(),r=ke();return this.divRemTo(t,e,r),new Array(e,r)}function w4(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()}function T4(t,e){if(t!=0){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}}function Vu(){}function _M(t){return t}function S4(t,e,r){t.multiplyTo(e,r)}function C4(t,e){t.squareTo(e)}Vu.prototype.convert=_M;Vu.prototype.revert=_M;Vu.prototype.mulTo=S4;Vu.prototype.sqrTo=C4;function M4(t){return this.exp(t,new Vu)}function I4(t,e,r){var n=Math.min(this.t+t.t,e);for(r.s=0,r.t=n;n>0;)r[--n]=0;var i;for(i=r.t-this.t;n<i;++n)r[n+this.t]=this.am(0,t[n],r,n,0,this.t);for(i=Math.min(t.t,e);n<i;++n)this.am(0,t[n],r,n,0,e-n);r.clamp()}function A4(t,e,r){--e;var n=r.t=this.t+t.t-e;for(r.s=0;--n>=0;)r[n]=0;for(n=Math.max(e-this.t,0);n<t.t;++n)r[this.t+n-e]=this.am(e-n,t[n],r,0,0,this.t+n-e);r.clamp(),r.drShiftTo(1,r)}function Wa(t){this.r2=ke(),this.q3=ke(),j.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}function E4(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=ke();return t.copyTo(e),this.reduce(e),e}function L4(t){return t}function D4(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)}function R4(t,e){t.squareTo(e),this.reduce(e)}function k4(t,e,r){t.multiplyTo(e,r),this.reduce(r)}Wa.prototype.convert=E4;Wa.prototype.revert=L4;Wa.prototype.reduce=D4;Wa.prototype.mulTo=k4;Wa.prototype.sqrTo=R4;function F4(t,e){var r=t.bitLength(),n,i=Ei(1),o;if(r<=0)return i;r<18?n=1:r<48?n=3:r<144?n=4:r<768?n=5:n=6,r<8?o=new Eo(e):e.isEven()?o=new Wa(e):o=new Lo(e);var a=new Array,s=3,l=n-1,u=(1<<n)-1;if(a[1]=o.convert(this),n>1){var c=ke();for(o.sqrTo(a[1],c);s<=u;)a[s]=ke(),o.mulTo(c,a[s-2],a[s]),s+=2}var p=t.t-1,h,f=!0,d=ke(),g;for(r=wm(t[p])-1;p>=0;){for(r>=l?h=t[p]>>r-l&u:(h=(t[p]&(1<<r+1)-1)<<l-r,p>0&&(h|=t[p-1]>>this.DB+r-l)),s=n;(h&1)==0;)h>>=1,--s;if((r-=s)<0&&(r+=this.DB,--p),f)a[h].copyTo(i),f=!1;else{for(;s>1;)o.sqrTo(i,d),o.sqrTo(d,i),s-=2;s>0?o.sqrTo(i,d):(g=i,i=d,d=g),o.mulTo(d,a[h],i)}for(;p>=0&&(t[p]&1<<r)==0;)o.sqrTo(i,d),g=i,i=d,d=g,--r<0&&(r=this.DB-1,--p)}return o.revert(i)}function O4(t){var e=this.s<0?this.negate():this.clone(),r=t.s<0?t.negate():t.clone();if(e.compareTo(r)<0){var n=e;e=r,r=n}var i=e.getLowestSetBit(),o=r.getLowestSetBit();if(o<0)return e;for(i<o&&(o=i),o>0&&(e.rShiftTo(o,e),r.rShiftTo(o,r));e.signum()>0;)(i=e.getLowestSetBit())>0&&e.rShiftTo(i,e),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),e.compareTo(r)>=0?(e.subTo(r,e),e.rShiftTo(1,e)):(r.subTo(e,r),r.rShiftTo(1,r));return o>0&&r.lShiftTo(o,r),r}function B4(t){if(t<=0)return 0;var e=this.DV%t,r=this.s<0?t-1:0;if(this.t>0)if(e==0)r=this[0]%t;else for(var n=this.t-1;n>=0;--n)r=(e*r+this[n])%t;return r}function z4(t){var e=t.isEven();if(this.isEven()&&e||t.signum()==0)return j.ZERO;for(var r=t.clone(),n=this.clone(),i=Ei(1),o=Ei(0),a=Ei(0),s=Ei(1);r.signum()!=0;){for(;r.isEven();)r.rShiftTo(1,r),e?((!i.isEven()||!o.isEven())&&(i.addTo(this,i),o.subTo(t,o)),i.rShiftTo(1,i)):o.isEven()||o.subTo(t,o),o.rShiftTo(1,o);for(;n.isEven();)n.rShiftTo(1,n),e?((!a.isEven()||!s.isEven())&&(a.addTo(this,a),s.subTo(t,s)),a.rShiftTo(1,a)):s.isEven()||s.subTo(t,s),s.rShiftTo(1,s);r.compareTo(n)>=0?(r.subTo(n,r),e&&i.subTo(a,i),o.subTo(s,o)):(n.subTo(r,n),e&&a.subTo(i,a),s.subTo(o,s))}if(n.compareTo(j.ONE)!=0)return j.ZERO;if(s.compareTo(t)>=0)return s.subtract(t);if(s.signum()<0)s.addTo(t,s);else return s;return s.signum()<0?s.add(t):s}var Zt=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],V4=(1<<26)/Zt[Zt.length-1];function U4(t){var e,r=this.abs();if(r.t==1&&r[0]<=Zt[Zt.length-1]){for(e=0;e<Zt.length;++e)if(r[0]==Zt[e])return!0;return!1}if(r.isEven())return!1;for(e=1;e<Zt.length;){for(var n=Zt[e],i=e+1;i<Zt.length&&n<V4;)n*=Zt[i++];for(n=r.modInt(n);e<i;)if(n%Zt[e++]==0)return!1}return r.millerRabin(t)}function N4(t){var e=this.subtract(j.ONE),r=e.getLowestSetBit();if(r<=0)return!1;var n=e.shiftRight(r);t=t+1>>1,t>Zt.length&&(t=Zt.length);for(var i=ke(),o=0;o<t;++o){i.fromInt(Zt[Math.floor(Math.random()*Zt.length)]);var a=i.modPow(n,this);if(a.compareTo(j.ONE)!=0&&a.compareTo(e)!=0){for(var s=1;s++<r&&a.compareTo(e)!=0;)if(a=a.modPowInt(2,this),a.compareTo(j.ONE)==0)return!1;if(a.compareTo(e)!=0)return!1}}return!0}j.prototype.chunkSize=GU;j.prototype.toRadix=HU;j.prototype.fromRadix=XU;j.prototype.fromNumber=ZU;j.prototype.bitwiseTo=KU;j.prototype.changeBit=p4;j.prototype.addTo=d4;j.prototype.dMultiply=w4;j.prototype.dAddOffset=T4;j.prototype.multiplyLowerTo=I4;j.prototype.multiplyUpperTo=A4;j.prototype.modInt=B4;j.prototype.millerRabin=N4;j.prototype.clone=zU;j.prototype.intValue=VU;j.prototype.byteValue=UU;j.prototype.shortValue=NU;j.prototype.signum=jU;j.prototype.toByteArray=qU;j.prototype.equals=YU;j.prototype.min=WU;j.prototype.max=$U;j.prototype.and=QU;j.prototype.or=e4;j.prototype.xor=t4;j.prototype.andNot=r4;j.prototype.not=n4;j.prototype.shiftLeft=i4;j.prototype.shiftRight=o4;j.prototype.getLowestSetBit=s4;j.prototype.bitCount=u4;j.prototype.testBit=c4;j.prototype.setBit=h4;j.prototype.clearBit=f4;j.prototype.flipBit=m4;j.prototype.add=y4;j.prototype.subtract=g4;j.prototype.multiply=x4;j.prototype.divide=_4;j.prototype.remainder=v4;j.prototype.divideAndRemainder=P4;j.prototype.modPow=F4;j.prototype.modInverse=z4;j.prototype.pow=M4;j.prototype.gcd=O4;j.prototype.isProbablePrime=U4;j.prototype.square=b4;var Ce=j;Ce.prototype.IsNegative=function(){return this.compareTo(Ce.ZERO)==-1};Ce.op_Equality=function(t,e){return t.compareTo(e)==0};Ce.op_Inequality=function(t,e){return t.compareTo(e)!=0};Ce.op_GreaterThan=function(t,e){return t.compareTo(e)>0};Ce.op_LessThan=function(t,e){return t.compareTo(e)<0};Ce.op_Addition=function(t,e){return new Ce(t).add(new Ce(e))};Ce.op_Subtraction=function(t,e){return new Ce(t).subtract(new Ce(e))};Ce.Int128Mul=function(t,e){return new Ce(t).multiply(new Ce(e))};Ce.op_Division=function(t,e){return t.divide(e)};Ce.prototype.ToDouble=function(){return parseFloat(this.toString())};typeof vm>"u"&&(vm=function(t,e){var r;if(typeof Object.getOwnPropertyNames>"u"){for(r in e.prototype)(typeof t.prototype[r]>"u"||t.prototype[r]==Object.prototype[r])&&(t.prototype[r]=e.prototype[r]);for(r in e)typeof t[r]>"u"&&(t[r]=e[r]);t.$baseCtor=e}else{for(var n=Object.getOwnPropertyNames(e.prototype),i=0;i<n.length;i++)typeof Object.getOwnPropertyDescriptor(t.prototype,n[i])>"u"&&Object.defineProperty(t.prototype,n[i],Object.getOwnPropertyDescriptor(e.prototype,n[i]));for(r in e)typeof t[r]>"u"&&(t[r]=e[r]);t.$baseCtor=e}});var vm;y.Path=function(){return[]};y.Paths=function(){return[]};y.DoublePoint=function(){var t=arguments;this.X=0,this.Y=0,t.length==1?(this.X=t[0].X,this.Y=t[0].Y):t.length==2&&(this.X=t[0],this.Y=t[1])};y.DoublePoint0=function(){this.X=0,this.Y=0};y.DoublePoint1=function(t){this.X=t.X,this.Y=t.Y};y.DoublePoint2=function(t,e){this.X=t,this.Y=e};y.PolyNode=function(){this.m_Parent=null,this.m_polygon=new y.Path,this.m_Index=0,this.m_jointype=0,this.m_endtype=0,this.m_Childs=[],this.IsOpen=!1};y.PolyNode.prototype.IsHoleNode=function(){for(var t=!0,e=this.m_Parent;e!==null;)t=!t,e=e.m_Parent;return t};y.PolyNode.prototype.ChildCount=function(){return this.m_Childs.length};y.PolyNode.prototype.Contour=function(){return this.m_polygon};y.PolyNode.prototype.AddChild=function(t){var e=this.m_Childs.length;this.m_Childs.push(t),t.m_Parent=this,t.m_Index=e};y.PolyNode.prototype.GetNext=function(){return this.m_Childs.length>0?this.m_Childs[0]:this.GetNextSiblingUp()};y.PolyNode.prototype.GetNextSiblingUp=function(){return this.m_Parent===null?null:this.m_Index==this.m_Parent.m_Childs.length-1?this.m_Parent.GetNextSiblingUp():this.m_Parent.m_Childs[this.m_Index+1]};y.PolyNode.prototype.Childs=function(){return this.m_Childs};y.PolyNode.prototype.Parent=function(){return this.m_Parent};y.PolyNode.prototype.IsHole=function(){return this.IsHoleNode()};y.PolyTree=function(){this.m_AllPolys=[],y.PolyNode.call(this)};y.PolyTree.prototype.Clear=function(){for(var t=0,e=this.m_AllPolys.length;t<e;t++)this.m_AllPolys[t]=null;this.m_AllPolys.length=0,this.m_Childs.length=0};y.PolyTree.prototype.GetFirst=function(){return this.m_Childs.length>0?this.m_Childs[0]:null};y.PolyTree.prototype.Total=function(){return this.m_AllPolys.length};vm(y.PolyTree,y.PolyNode);y.Math_Abs_Int64=y.Math_Abs_Int32=y.Math_Abs_Double=function(t){return Math.abs(t)};y.Math_Max_Int32_Int32=function(t,e){return Math.max(t,e)};Me.msie||Me.opera||Me.safari?y.Cast_Int32=function(t){return t|0}:y.Cast_Int32=function(t){return~~t};Me.chrome?y.Cast_Int64=function(t){return t<-2147483648||t>2147483647?t<0?Math.ceil(t):Math.floor(t):~~t}:Me.firefox&&typeof Number.toInteger=="function"?y.Cast_Int64=function(t){return Number.toInteger(t)}:Me.msie7||Me.msie8?y.Cast_Int64=function(t){return parseInt(t,10)}:Me.msie?y.Cast_Int64=function(t){return t<-2147483648||t>2147483647?t<0?Math.ceil(t):Math.floor(t):t|0}:y.Cast_Int64=function(t){return t<0?Math.ceil(t):Math.floor(t)};y.Clear=function(t){t.length=0};y.PI=3.141592653589793;y.PI2=2*3.141592653589793;y.IntPoint=function(){var t=arguments,e=t.length;if(this.X=0,this.Y=0,Ao)if(this.Z=0,e==3)this.X=t[0],this.Y=t[1],this.Z=t[2];else if(e==2)this.X=t[0],this.Y=t[1],this.Z=0;else if(e==1)if(t[0]instanceof y.DoublePoint){var r=t[0];this.X=y.Clipper.Round(r.X),this.Y=y.Clipper.Round(r.Y),this.Z=0}else{var n=t[0];typeof n.Z>"u"&&(n.Z=0),this.X=n.X,this.Y=n.Y,this.Z=n.Z}else this.X=0,this.Y=0,this.Z=0;else if(e==2)this.X=t[0],this.Y=t[1];else if(e==1)if(t[0]instanceof y.DoublePoint){var r=t[0];this.X=y.Clipper.Round(r.X),this.Y=y.Clipper.Round(r.Y)}else{var n=t[0];this.X=n.X,this.Y=n.Y}else this.X=0,this.Y=0};y.IntPoint.op_Equality=function(t,e){return t.X==e.X&&t.Y==e.Y};y.IntPoint.op_Inequality=function(t,e){return t.X!=e.X||t.Y!=e.Y};Ao?(y.IntPoint0=function(){this.X=0,this.Y=0,this.Z=0},y.IntPoint1=function(t){this.X=t.X,this.Y=t.Y,this.Z=t.Z},y.IntPoint1dp=function(t){this.X=y.Clipper.Round(t.X),this.Y=y.Clipper.Round(t.Y),this.Z=0},y.IntPoint2=function(t,e){this.X=t,this.Y=e,this.Z=0},y.IntPoint3=function(t,e,r){this.X=t,this.Y=e,this.Z=r}):(y.IntPoint0=function(){this.X=0,this.Y=0},y.IntPoint1=function(t){this.X=t.X,this.Y=t.Y},y.IntPoint1dp=function(t){this.X=y.Clipper.Round(t.X),this.Y=y.Clipper.Round(t.Y)},y.IntPoint2=function(t,e){this.X=t,this.Y=e});y.IntRect=function(){var t=arguments,e=t.length;e==4?(this.left=t[0],this.top=t[1],this.right=t[2],this.bottom=t[3]):e==1?(this.left=ir.left,this.top=ir.top,this.right=ir.right,this.bottom=ir.bottom):(this.left=0,this.top=0,this.right=0,this.bottom=0)};y.IntRect0=function(){this.left=0,this.top=0,this.right=0,this.bottom=0};y.IntRect1=function(t){this.left=t.left,this.top=t.top,this.right=t.right,this.bottom=t.bottom};y.IntRect4=function(t,e,r,n){this.left=t,this.top=e,this.right=r,this.bottom=n};y.ClipType={ctIntersection:0,ctUnion:1,ctDifference:2,ctXor:3};y.PolyType={ptSubject:0,ptClip:1};y.PolyFillType={pftEvenOdd:0,pftNonZero:1,pftPositive:2,pftNegative:3};y.JoinType={jtSquare:0,jtRound:1,jtMiter:2};y.EndType={etOpenSquare:0,etOpenRound:1,etOpenButt:2,etClosedLine:3,etClosedPolygon:4};dM&&(y.EndType_={etSquare:0,etRound:1,etButt:2,etClosed:3});y.EdgeSide={esLeft:0,esRight:1};y.Direction={dRightToLeft:0,dLeftToRight:1};y.TEdge=function(){this.Bot=new y.IntPoint,this.Curr=new y.IntPoint,this.Top=new y.IntPoint,this.Delta=new y.IntPoint,this.Dx=0,this.PolyTyp=y.PolyType.ptSubject,this.Side=y.EdgeSide.esLeft,this.WindDelta=0,this.WindCnt=0,this.WindCnt2=0,this.OutIdx=0,this.Next=null,this.Prev=null,this.NextInLML=null,this.NextInAEL=null,this.PrevInAEL=null,this.NextInSEL=null,this.PrevInSEL=null};y.IntersectNode=function(){this.Edge1=null,this.Edge2=null,this.Pt=new y.IntPoint};y.MyIntersectNodeSort=function(){};y.MyIntersectNodeSort.Compare=function(t,e){return e.Pt.Y-t.Pt.Y};y.LocalMinima=function(){this.Y=0,this.LeftBound=null,this.RightBound=null,this.Next=null};y.Scanbeam=function(){this.Y=0,this.Next=null};y.OutRec=function(){this.Idx=0,this.IsHole=!1,this.IsOpen=!1,this.FirstLeft=null,this.Pts=null,this.BottomPt=null,this.PolyNode=null};y.OutPt=function(){this.Idx=0,this.Pt=new y.IntPoint,this.Next=null,this.Prev=null};y.Join=function(){this.OutPt1=null,this.OutPt2=null,this.OffPt=new y.IntPoint};y.ClipperBase=function(){this.m_MinimaList=null,this.m_CurrentLM=null,this.m_edges=new Array,this.m_UseFullRange=!1,this.m_HasOpenPaths=!1,this.PreserveCollinear=!1,this.m_MinimaList=null,this.m_CurrentLM=null,this.m_UseFullRange=!1,this.m_HasOpenPaths=!1};y.ClipperBase.horizontal=-9007199254740992;y.ClipperBase.Skip=-2;y.ClipperBase.Unassigned=-1;y.ClipperBase.tolerance=1e-20;eU?(y.ClipperBase.loRange=46340,y.ClipperBase.hiRange=46340):(y.ClipperBase.loRange=47453132,y.ClipperBase.hiRange=0xfffffffffffff);y.ClipperBase.near_zero=function(t){return t>-y.ClipperBase.tolerance&&t<y.ClipperBase.tolerance};y.ClipperBase.IsHorizontal=function(t){return t.Delta.Y===0};y.ClipperBase.prototype.PointIsVertex=function(t,e){var r=e;do{if(y.IntPoint.op_Equality(r.Pt,t))return!0;r=r.Next}while(r!=e);return!1};y.ClipperBase.prototype.PointOnLineSegment=function(t,e,r,n){return n?t.X==e.X&&t.Y==e.Y||t.X==r.X&&t.Y==r.Y||t.X>e.X==t.X<r.X&&t.Y>e.Y==t.Y<r.Y&&Ce.op_Equality(Ce.Int128Mul(t.X-e.X,r.Y-e.Y),Ce.Int128Mul(r.X-e.X,t.Y-e.Y)):t.X==e.X&&t.Y==e.Y||t.X==r.X&&t.Y==r.Y||t.X>e.X==t.X<r.X&&t.Y>e.Y==t.Y<r.Y&&(t.X-e.X)*(r.Y-e.Y)==(r.X-e.X)*(t.Y-e.Y)};y.ClipperBase.prototype.PointOnPolygon=function(t,e,r){for(var n=e;;){if(this.PointOnLineSegment(t,n.Pt,n.Next.Pt,r))return!0;if(n=n.Next,n==e)break}return!1};y.ClipperBase.prototype.SlopesEqual=y.ClipperBase.SlopesEqual=function(){var t=arguments,e=t.length,r,n,i,o,a,s,l;return e==3?(r=t[0],n=t[1],l=t[2],l?Ce.op_Equality(Ce.Int128Mul(r.Delta.Y,n.Delta.X),Ce.Int128Mul(r.Delta.X,n.Delta.Y)):y.Cast_Int64(r.Delta.Y*n.Delta.X)==y.Cast_Int64(r.Delta.X*n.Delta.Y)):e==4?(i=t[0],o=t[1],a=t[2],l=t[3],l?Ce.op_Equality(Ce.Int128Mul(i.Y-o.Y,o.X-a.X),Ce.Int128Mul(i.X-o.X,o.Y-a.Y)):y.Cast_Int64((i.Y-o.Y)*(o.X-a.X))-y.Cast_Int64((i.X-o.X)*(o.Y-a.Y))===0):(i=t[0],o=t[1],a=t[2],s=t[3],l=t[4],l?Ce.op_Equality(Ce.Int128Mul(i.Y-o.Y,a.X-s.X),Ce.Int128Mul(i.X-o.X,a.Y-s.Y)):y.Cast_Int64((i.Y-o.Y)*(a.X-s.X))-y.Cast_Int64((i.X-o.X)*(a.Y-s.Y))===0)};y.ClipperBase.SlopesEqual3=function(t,e,r){return r?Ce.op_Equality(Ce.Int128Mul(t.Delta.Y,e.Delta.X),Ce.Int128Mul(t.Delta.X,e.Delta.Y)):y.Cast_Int64(t.Delta.Y*e.Delta.X)==y.Cast_Int64(t.Delta.X*e.Delta.Y)};y.ClipperBase.SlopesEqual4=function(t,e,r,n){return n?Ce.op_Equality(Ce.Int128Mul(t.Y-e.Y,e.X-r.X),Ce.Int128Mul(t.X-e.X,e.Y-r.Y)):y.Cast_Int64((t.Y-e.Y)*(e.X-r.X))-y.Cast_Int64((t.X-e.X)*(e.Y-r.Y))===0};y.ClipperBase.SlopesEqual5=function(t,e,r,n,i){return i?Ce.op_Equality(Ce.Int128Mul(t.Y-e.Y,r.X-n.X),Ce.Int128Mul(t.X-e.X,r.Y-n.Y)):y.Cast_Int64((t.Y-e.Y)*(r.X-n.X))-y.Cast_Int64((t.X-e.X)*(r.Y-n.Y))===0};y.ClipperBase.prototype.Clear=function(){this.DisposeLocalMinimaList();for(var t=0,e=this.m_edges.length;t<e;++t){for(var r=0,n=this.m_edges[t].length;r<n;++r)this.m_edges[t][r]=null;y.Clear(this.m_edges[t])}y.Clear(this.m_edges),this.m_UseFullRange=!1,this.m_HasOpenPaths=!1};y.ClipperBase.prototype.DisposeLocalMinimaList=function(){for(;this.m_MinimaList!==null;){var t=this.m_MinimaList.Next;this.m_MinimaList=null,this.m_MinimaList=t}this.m_CurrentLM=null};y.ClipperBase.prototype.RangeTest=function(t,e){e.Value?(t.X>y.ClipperBase.hiRange||t.Y>y.ClipperBase.hiRange||-t.X>y.ClipperBase.hiRange||-t.Y>y.ClipperBase.hiRange)&&y.Error("Coordinate outside allowed range in RangeTest()."):(t.X>y.ClipperBase.loRange||t.Y>y.ClipperBase.loRange||-t.X>y.ClipperBase.loRange||-t.Y>y.ClipperBase.loRange)&&(e.Value=!0,this.RangeTest(t,e))};y.ClipperBase.prototype.InitEdge=function(t,e,r,n){t.Next=e,t.Prev=r,t.Curr.X=n.X,t.Curr.Y=n.Y,t.OutIdx=-1};y.ClipperBase.prototype.InitEdge2=function(t,e){t.Curr.Y>=t.Next.Curr.Y?(t.Bot.X=t.Curr.X,t.Bot.Y=t.Curr.Y,t.Top.X=t.Next.Curr.X,t.Top.Y=t.Next.Curr.Y):(t.Top.X=t.Curr.X,t.Top.Y=t.Curr.Y,t.Bot.X=t.Next.Curr.X,t.Bot.Y=t.Next.Curr.Y),this.SetDx(t),t.PolyTyp=e};y.ClipperBase.prototype.FindNextLocMin=function(t){for(var e;;){for(;y.IntPoint.op_Inequality(t.Bot,t.Prev.Bot)||y.IntPoint.op_Equality(t.Curr,t.Top);)t=t.Next;if(t.Dx!=y.ClipperBase.horizontal&&t.Prev.Dx!=y.ClipperBase.horizontal)break;for(;t.Prev.Dx==y.ClipperBase.horizontal;)t=t.Prev;for(e=t;t.Dx==y.ClipperBase.horizontal;)t=t.Next;if(t.Top.Y!=t.Prev.Bot.Y){e.Prev.Bot.X<t.Bot.X&&(t=e);break}}return t};y.ClipperBase.prototype.ProcessBound=function(t,e){var r=t,n=t,i,o;if(t.Dx==y.ClipperBase.horizontal&&(e?o=t.Prev.Bot.X:o=t.Next.Bot.X,t.Bot.X!=o&&this.ReverseHorizontal(t)),n.OutIdx!=y.ClipperBase.Skip)if(e){for(;n.Top.Y==n.Next.Bot.Y&&n.Next.OutIdx!=y.ClipperBase.Skip;)n=n.Next;if(n.Dx==y.ClipperBase.horizontal&&n.Next.OutIdx!=y.ClipperBase.Skip){for(i=n;i.Prev.Dx==y.ClipperBase.horizontal;)i=i.Prev;i.Prev.Top.X==n.Next.Top.X?e||(n=i.Prev):i.Prev.Top.X>n.Next.Top.X&&(n=i.Prev)}for(;t!=n;)t.NextInLML=t.Next,t.Dx==y.ClipperBase.horizontal&&t!=r&&t.Bot.X!=t.Prev.Top.X&&this.ReverseHorizontal(t),t=t.Next;t.Dx==y.ClipperBase.horizontal&&t!=r&&t.Bot.X!=t.Prev.Top.X&&this.ReverseHorizontal(t),n=n.Next}else{for(;n.Top.Y==n.Prev.Bot.Y&&n.Prev.OutIdx!=y.ClipperBase.Skip;)n=n.Prev;if(n.Dx==y.ClipperBase.horizontal&&n.Prev.OutIdx!=y.ClipperBase.Skip){for(i=n;i.Next.Dx==y.ClipperBase.horizontal;)i=i.Next;i.Next.Top.X==n.Prev.Top.X?e||(n=i.Next):i.Next.Top.X>n.Prev.Top.X&&(n=i.Next)}for(;t!=n;)t.NextInLML=t.Prev,t.Dx==y.ClipperBase.horizontal&&t!=r&&t.Bot.X!=t.Next.Top.X&&this.ReverseHorizontal(t),t=t.Prev;t.Dx==y.ClipperBase.horizontal&&t!=r&&t.Bot.X!=t.Next.Top.X&&this.ReverseHorizontal(t),n=n.Prev}if(n.OutIdx==y.ClipperBase.Skip){if(t=n,e){for(;t.Top.Y==t.Next.Bot.Y;)t=t.Next;for(;t!=n&&t.Dx==y.ClipperBase.horizontal;)t=t.Prev}else{for(;t.Top.Y==t.Prev.Bot.Y;)t=t.Prev;for(;t!=n&&t.Dx==y.ClipperBase.horizontal;)t=t.Next}if(t==n)e?n=t.Next:n=t.Prev;else{e?t=n.Next:t=n.Prev;var a=new y.LocalMinima;a.Next=null,a.Y=t.Bot.Y,a.LeftBound=null,a.RightBound=t,a.RightBound.WindDelta=0,n=this.ProcessBound(a.RightBound,e),this.InsertLocalMinima(a)}}return n};y.ClipperBase.prototype.AddPath=function(t,e,r){mM?!r&&e==y.PolyType.ptClip&&y.Error("AddPath: Open paths must be subject."):r||y.Error("AddPath: Open paths have been disabled.");var n=t.length-1;if(r)for(;n>0&&y.IntPoint.op_Equality(t[n],t[0]);)--n;for(;n>0&&y.IntPoint.op_Equality(t[n],t[n-1]);)--n;if(r&&n<2||!r&&n<1)return!1;for(var i=new Array,o=0;o<=n;o++)i.push(new y.TEdge);var a=!0;i[1].Curr.X=t[1].X,i[1].Curr.Y=t[1].Y;var s={Value:this.m_UseFullRange};this.RangeTest(t[0],s),this.m_UseFullRange=s.Value,s.Value=this.m_UseFullRange,this.RangeTest(t[n],s),this.m_UseFullRange=s.Value,this.InitEdge(i[0],i[1],i[n],t[0]),this.InitEdge(i[n],i[0],i[n-1],t[n]);for(var o=n-1;o>=1;--o)s.Value=this.m_UseFullRange,this.RangeTest(t[o],s),this.m_UseFullRange=s.Value,this.InitEdge(i[o],i[o+1],i[o-1],t[o]);for(var l=i[0],u=l,c=l;;){if(y.IntPoint.op_Equality(u.Curr,u.Next.Curr)){if(u==u.Next)break;u==l&&(l=u.Next),u=this.RemoveEdge(u),c=u;continue}if(u.Prev==u.Next)break;if(r&&y.ClipperBase.SlopesEqual(u.Prev.Curr,u.Curr,u.Next.Curr,this.m_UseFullRange)&&(!this.PreserveCollinear||!this.Pt2IsBetweenPt1AndPt3(u.Prev.Curr,u.Curr,u.Next.Curr))){u==l&&(l=u.Next),u=this.RemoveEdge(u),u=u.Prev,c=u;continue}if(u=u.Next,u==c)break}if(!r&&u==u.Next||r&&u.Prev==u.Next)return!1;r||(this.m_HasOpenPaths=!0,l.Prev.OutIdx=y.ClipperBase.Skip);var p=l;u=l;do this.InitEdge2(u,e),u=u.Next,a&&u.Curr.Y!=l.Curr.Y&&(a=!1);while(u!=l);if(a){if(r)return!1;u.Prev.OutIdx=y.ClipperBase.Skip,u.Prev.Bot.X<u.Prev.Top.X&&this.ReverseHorizontal(u.Prev);var h=new y.LocalMinima;for(h.Next=null,h.Y=u.Bot.Y,h.LeftBound=null,h.RightBound=u,h.RightBound.Side=y.EdgeSide.esRight,h.RightBound.WindDelta=0;u.Next.OutIdx!=y.ClipperBase.Skip;)u.NextInLML=u.Next,u.Bot.X!=u.Prev.Top.X&&this.ReverseHorizontal(u),u=u.Next;return this.InsertLocalMinima(h),this.m_edges.push(i),!0}this.m_edges.push(i);for(var f,d=null;u=this.FindNextLocMin(u),u!=d;){d==null&&(d=u);var h=new y.LocalMinima;h.Next=null,h.Y=u.Bot.Y,u.Dx<u.Prev.Dx?(h.LeftBound=u.Prev,h.RightBound=u,f=!1):(h.LeftBound=u,h.RightBound=u.Prev,f=!0),h.LeftBound.Side=y.EdgeSide.esLeft,h.RightBound.Side=y.EdgeSide.esRight,r?h.LeftBound.Next==h.RightBound?h.LeftBound.WindDelta=-1:h.LeftBound.WindDelta=1:h.LeftBound.WindDelta=0,h.RightBound.WindDelta=-h.LeftBound.WindDelta,u=this.ProcessBound(h.LeftBound,f);var g=this.ProcessBound(h.RightBound,!f);h.LeftBound.OutIdx==y.ClipperBase.Skip?h.LeftBound=null:h.RightBound.OutIdx==y.ClipperBase.Skip&&(h.RightBound=null),this.InsertLocalMinima(h),f||(u=g)}return!0};y.ClipperBase.prototype.AddPaths=function(t,e,r){for(var n=!1,i=0,o=t.length;i<o;++i)this.AddPath(t[i],e,r)&&(n=!0);return n};y.ClipperBase.prototype.Pt2IsBetweenPt1AndPt3=function(t,e,r){return y.IntPoint.op_Equality(t,r)||y.IntPoint.op_Equality(t,e)||y.IntPoint.op_Equality(r,e)?!1:t.X!=r.X?e.X>t.X==e.X<r.X:e.Y>t.Y==e.Y<r.Y};y.ClipperBase.prototype.RemoveEdge=function(t){t.Prev.Next=t.Next,t.Next.Prev=t.Prev;var e=t.Next;return t.Prev=null,e};y.ClipperBase.prototype.SetDx=function(t){t.Delta.X=t.Top.X-t.Bot.X,t.Delta.Y=t.Top.Y-t.Bot.Y,t.Delta.Y===0?t.Dx=y.ClipperBase.horizontal:t.Dx=t.Delta.X/t.Delta.Y};y.ClipperBase.prototype.InsertLocalMinima=function(t){if(this.m_MinimaList===null)this.m_MinimaList=t;else if(t.Y>=this.m_MinimaList.Y)t.Next=this.m_MinimaList,this.m_MinimaList=t;else{for(var e=this.m_MinimaList;e.Next!==null&&t.Y<e.Next.Y;)e=e.Next;t.Next=e.Next,e.Next=t}};y.ClipperBase.prototype.PopLocalMinima=function(){this.m_CurrentLM!==null&&(this.m_CurrentLM=this.m_CurrentLM.Next)};y.ClipperBase.prototype.ReverseHorizontal=function(t){var e=t.Top.X;t.Top.X=t.Bot.X,t.Bot.X=e,Ao&&(e=t.Top.Z,t.Top.Z=t.Bot.Z,t.Bot.Z=e)};y.ClipperBase.prototype.Reset=function(){if(this.m_CurrentLM=this.m_MinimaList,this.m_CurrentLM!=null)for(var t=this.m_MinimaList;t!=null;){var e=t.LeftBound;e!=null&&(e.Curr.X=e.Bot.X,e.Curr.Y=e.Bot.Y,e.Side=y.EdgeSide.esLeft,e.OutIdx=y.ClipperBase.Unassigned),e=t.RightBound,e!=null&&(e.Curr.X=e.Bot.X,e.Curr.Y=e.Bot.Y,e.Side=y.EdgeSide.esRight,e.OutIdx=y.ClipperBase.Unassigned),t=t.Next}};y.Clipper=function(t){typeof t>"u"&&(t=0),this.m_PolyOuts=null,this.m_ClipType=y.ClipType.ctIntersection,this.m_Scanbeam=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=null,this.m_IntersectNodeComparer=null,this.m_ExecuteLocked=!1,this.m_ClipFillType=y.PolyFillType.pftEvenOdd,this.m_SubjFillType=y.PolyFillType.pftEvenOdd,this.m_Joins=null,this.m_GhostJoins=null,this.m_UsingPolyTree=!1,this.ReverseSolution=!1,this.StrictlySimple=!1,y.ClipperBase.call(this),this.m_Scanbeam=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=new Array,this.m_IntersectNodeComparer=y.MyIntersectNodeSort.Compare,this.m_ExecuteLocked=!1,this.m_UsingPolyTree=!1,this.m_PolyOuts=new Array,this.m_Joins=new Array,this.m_GhostJoins=new Array,this.ReverseSolution=(1&t)!==0,this.StrictlySimple=(2&t)!==0,this.PreserveCollinear=(4&t)!==0,Ao&&(this.ZFillFunction=null)};y.Clipper.ioReverseSolution=1;y.Clipper.ioStrictlySimple=2;y.Clipper.ioPreserveCollinear=4;y.Clipper.prototype.Clear=function(){this.m_edges.length!==0&&(this.DisposeAllPolyPts(),y.ClipperBase.prototype.Clear.call(this))};y.Clipper.prototype.DisposeScanbeamList=function(){for(;this.m_Scanbeam!==null;){var t=this.m_Scanbeam.Next;this.m_Scanbeam=null,this.m_Scanbeam=t}};y.Clipper.prototype.Reset=function(){y.ClipperBase.prototype.Reset.call(this),this.m_Scanbeam=null,this.m_ActiveEdges=null,this.m_SortedEdges=null;for(var t=this.m_MinimaList;t!==null;)this.InsertScanbeam(t.Y),t=t.Next};y.Clipper.prototype.InsertScanbeam=function(t){if(this.m_Scanbeam===null)this.m_Scanbeam=new y.Scanbeam,this.m_Scanbeam.Next=null,this.m_Scanbeam.Y=t;else if(t>this.m_Scanbeam.Y){var e=new y.Scanbeam;e.Y=t,e.Next=this.m_Scanbeam,this.m_Scanbeam=e}else{for(var r=this.m_Scanbeam;r.Next!==null&&t<=r.Next.Y;)r=r.Next;if(t==r.Y)return;var e=new y.Scanbeam;e.Y=t,e.Next=r.Next,r.Next=e}};y.Clipper.prototype.Execute=function(){var t=arguments,e=t.length,r=t[1]instanceof y.PolyTree;if(e==4&&!r){var n=t[0],i=t[1],o=t[2],a=t[3];if(this.m_ExecuteLocked)return!1;this.m_HasOpenPaths&&y.Error("Error: PolyTree struct is need for open path clipping."),this.m_ExecuteLocked=!0,y.Clear(i),this.m_SubjFillType=o,this.m_ClipFillType=a,this.m_ClipType=n,this.m_UsingPolyTree=!1;try{var s=this.ExecuteInternal();s&&this.BuildResult(i)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return s}else if(e==4&&r){var n=t[0],l=t[1],o=t[2],a=t[3];if(this.m_ExecuteLocked)return!1;this.m_ExecuteLocked=!0,this.m_SubjFillType=o,this.m_ClipFillType=a,this.m_ClipType=n,this.m_UsingPolyTree=!0;try{var s=this.ExecuteInternal();s&&this.BuildResult2(l)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return s}else if(e==2&&!r){var n=t[0],i=t[1];return this.Execute(n,i,y.PolyFillType.pftEvenOdd,y.PolyFillType.pftEvenOdd)}else if(e==2&&r){var n=t[0],l=t[1];return this.Execute(n,l,y.PolyFillType.pftEvenOdd,y.PolyFillType.pftEvenOdd)}};y.Clipper.prototype.FixHoleLinkage=function(t){if(!(t.FirstLeft===null||t.IsHole!=t.FirstLeft.IsHole&&t.FirstLeft.Pts!==null)){for(var e=t.FirstLeft;e!==null&&(e.IsHole==t.IsHole||e.Pts===null);)e=e.FirstLeft;t.FirstLeft=e}};y.Clipper.prototype.ExecuteInternal=function(){try{if(this.Reset(),this.m_CurrentLM===null)return!1;var t=this.PopScanbeam();do{if(this.InsertLocalMinimaIntoAEL(t),y.Clear(this.m_GhostJoins),this.ProcessHorizontals(!1),this.m_Scanbeam===null)break;var e=this.PopScanbeam();if(!this.ProcessIntersections(t,e))return!1;this.ProcessEdgesAtTopOfScanbeam(e),t=e}while(this.m_Scanbeam!==null||this.m_CurrentLM!==null);for(var r=0,n=this.m_PolyOuts.length;r<n;r++){var i=this.m_PolyOuts[r];i.Pts===null||i.IsOpen||(i.IsHole^this.ReverseSolution)==this.Area(i)>0&&this.ReversePolyPtLinks(i.Pts)}this.JoinCommonEdges();for(var r=0,n=this.m_PolyOuts.length;r<n;r++){var i=this.m_PolyOuts[r];i.Pts!==null&&!i.IsOpen&&this.FixupOutPolygon(i)}return this.StrictlySimple&&this.DoSimplePolygons(),!0}finally{y.Clear(this.m_Joins),y.Clear(this.m_GhostJoins)}};y.Clipper.prototype.PopScanbeam=function(){var t=this.m_Scanbeam.Y,e=this.m_Scanbeam;return this.m_Scanbeam=this.m_Scanbeam.Next,e=null,t};y.Clipper.prototype.DisposeAllPolyPts=function(){for(var t=0,e=this.m_PolyOuts.length;t<e;++t)this.DisposeOutRec(t);y.Clear(this.m_PolyOuts)};y.Clipper.prototype.DisposeOutRec=function(t){var e=this.m_PolyOuts[t];e.Pts!==null&&this.DisposeOutPts(e.Pts),e=null,this.m_PolyOuts[t]=null};y.Clipper.prototype.DisposeOutPts=function(t){if(t!==null){var e=null;for(t.Prev.Next=null;t!==null;)e=t,t=t.Next,e=null}};y.Clipper.prototype.AddJoin=function(t,e,r){var n=new y.Join;n.OutPt1=t,n.OutPt2=e,n.OffPt.X=r.X,n.OffPt.Y=r.Y,this.m_Joins.push(n)};y.Clipper.prototype.AddGhostJoin=function(t,e){var r=new y.Join;r.OutPt1=t,r.OffPt.X=e.X,r.OffPt.Y=e.Y,this.m_GhostJoins.push(r)};Ao&&(y.Clipper.prototype.SetZ=function(t,e){t.Z=0,this.ZFillFunction!==null&&(e.OutIdx<0?this.ZFillFunction(e.Bot,e.Top,t):this.ZFillFunction(e.Top,e.Bot,t))});y.Clipper.prototype.InsertLocalMinimaIntoAEL=function(t){for(;this.m_CurrentLM!==null&&this.m_CurrentLM.Y==t;){var e=this.m_CurrentLM.LeftBound,r=this.m_CurrentLM.RightBound;this.PopLocalMinima();var n=null;if(e===null?(this.InsertEdgeIntoAEL(r,null),this.SetWindingCount(r),this.IsContributing(r)&&(n=this.AddOutPt(r,r.Bot))):r==null?(this.InsertEdgeIntoAEL(e,null),this.SetWindingCount(e),this.IsContributing(e)&&(n=this.AddOutPt(e,e.Bot)),this.InsertScanbeam(e.Top.Y)):(this.InsertEdgeIntoAEL(e,null),this.InsertEdgeIntoAEL(r,e),this.SetWindingCount(e),r.WindCnt=e.WindCnt,r.WindCnt2=e.WindCnt2,this.IsContributing(e)&&(n=this.AddLocalMinPoly(e,r,e.Bot)),this.InsertScanbeam(e.Top.Y)),r!=null&&(y.ClipperBase.IsHorizontal(r)?this.AddEdgeToSEL(r):this.InsertScanbeam(r.Top.Y)),!(e==null||r==null)){if(n!==null&&y.ClipperBase.IsHorizontal(r)&&this.m_GhostJoins.length>0&&r.WindDelta!==0)for(var i=0,o=this.m_GhostJoins.length;i<o;i++){var a=this.m_GhostJoins[i];this.HorzSegmentsOverlap(a.OutPt1.Pt,a.OffPt,r.Bot,r.Top)&&this.AddJoin(a.OutPt1,n,a.OffPt)}if(e.OutIdx>=0&&e.PrevInAEL!==null&&e.PrevInAEL.Curr.X==e.Bot.X&&e.PrevInAEL.OutIdx>=0&&y.ClipperBase.SlopesEqual(e.PrevInAEL,e,this.m_UseFullRange)&&e.WindDelta!==0&&e.PrevInAEL.WindDelta!==0){var s=this.AddOutPt(e.PrevInAEL,e.Bot);this.AddJoin(n,s,e.Top)}if(e.NextInAEL!=r){if(r.OutIdx>=0&&r.PrevInAEL.OutIdx>=0&&y.ClipperBase.SlopesEqual(r.PrevInAEL,r,this.m_UseFullRange)&&r.WindDelta!==0&&r.PrevInAEL.WindDelta!==0){var s=this.AddOutPt(r.PrevInAEL,r.Bot);this.AddJoin(n,s,r.Top)}var l=e.NextInAEL;if(l!==null)for(;l!=r;)this.IntersectEdges(r,l,e.Curr,!1),l=l.NextInAEL}}}};y.Clipper.prototype.InsertEdgeIntoAEL=function(t,e){if(this.m_ActiveEdges===null)t.PrevInAEL=null,t.NextInAEL=null,this.m_ActiveEdges=t;else if(e===null&&this.E2InsertsBeforeE1(this.m_ActiveEdges,t))t.PrevInAEL=null,t.NextInAEL=this.m_ActiveEdges,this.m_ActiveEdges.PrevInAEL=t,this.m_ActiveEdges=t;else{for(e===null&&(e=this.m_ActiveEdges);e.NextInAEL!==null&&!this.E2InsertsBeforeE1(e.NextInAEL,t);)e=e.NextInAEL;t.NextInAEL=e.NextInAEL,e.NextInAEL!==null&&(e.NextInAEL.PrevInAEL=t),t.PrevInAEL=e,e.NextInAEL=t}};y.Clipper.prototype.E2InsertsBeforeE1=function(t,e){return e.Curr.X==t.Curr.X?e.Top.Y>t.Top.Y?e.Top.X<y.Clipper.TopX(t,e.Top.Y):t.Top.X>y.Clipper.TopX(e,t.Top.Y):e.Curr.X<t.Curr.X};y.Clipper.prototype.IsEvenOddFillType=function(t){return t.PolyTyp==y.PolyType.ptSubject?this.m_SubjFillType==y.PolyFillType.pftEvenOdd:this.m_ClipFillType==y.PolyFillType.pftEvenOdd};y.Clipper.prototype.IsEvenOddAltFillType=function(t){return t.PolyTyp==y.PolyType.ptSubject?this.m_ClipFillType==y.PolyFillType.pftEvenOdd:this.m_SubjFillType==y.PolyFillType.pftEvenOdd};y.Clipper.prototype.IsContributing=function(t){var e,r;switch(t.PolyTyp==y.PolyType.ptSubject?(e=this.m_SubjFillType,r=this.m_ClipFillType):(e=this.m_ClipFillType,r=this.m_SubjFillType),e){case y.PolyFillType.pftEvenOdd:if(t.WindDelta===0&&t.WindCnt!=1)return!1;break;case y.PolyFillType.pftNonZero:if(Math.abs(t.WindCnt)!=1)return!1;break;case y.PolyFillType.pftPositive:if(t.WindCnt!=1)return!1;break;default:if(t.WindCnt!=-1)return!1;break}switch(this.m_ClipType){case y.ClipType.ctIntersection:switch(r){case y.PolyFillType.pftEvenOdd:case y.PolyFillType.pftNonZero:return t.WindCnt2!==0;case y.PolyFillType.pftPositive:return t.WindCnt2>0;default:return t.WindCnt2<0}case y.ClipType.ctUnion:switch(r){case y.PolyFillType.pftEvenOdd:case y.PolyFillType.pftNonZero:return t.WindCnt2===0;case y.PolyFillType.pftPositive:return t.WindCnt2<=0;default:return t.WindCnt2>=0}case y.ClipType.ctDifference:if(t.PolyTyp==y.PolyType.ptSubject)switch(r){case y.PolyFillType.pftEvenOdd:case y.PolyFillType.pftNonZero:return t.WindCnt2===0;case y.PolyFillType.pftPositive:return t.WindCnt2<=0;default:return t.WindCnt2>=0}else switch(r){case y.PolyFillType.pftEvenOdd:case y.PolyFillType.pftNonZero:return t.WindCnt2!==0;case y.PolyFillType.pftPositive:return t.WindCnt2>0;default:return t.WindCnt2<0}case y.ClipType.ctXor:if(t.WindDelta===0)switch(r){case y.PolyFillType.pftEvenOdd:case y.PolyFillType.pftNonZero:return t.WindCnt2===0;case y.PolyFillType.pftPositive:return t.WindCnt2<=0;default:return t.WindCnt2>=0}else return!0}return!0};y.Clipper.prototype.SetWindingCount=function(t){for(var e=t.PrevInAEL;e!==null&&(e.PolyTyp!=t.PolyTyp||e.WindDelta===0);)e=e.PrevInAEL;if(e===null)t.WindCnt=t.WindDelta===0?1:t.WindDelta,t.WindCnt2=0,e=this.m_ActiveEdges;else if(t.WindDelta===0&&this.m_ClipType!=y.ClipType.ctUnion)t.WindCnt=1,t.WindCnt2=e.WindCnt2,e=e.NextInAEL;else if(this.IsEvenOddFillType(t)){if(t.WindDelta===0){for(var r=!0,n=e.PrevInAEL;n!==null;)n.PolyTyp==e.PolyTyp&&n.WindDelta!==0&&(r=!r),n=n.PrevInAEL;t.WindCnt=r?0:1}else t.WindCnt=t.WindDelta;t.WindCnt2=e.WindCnt2,e=e.NextInAEL}else e.WindCnt*e.WindDelta<0?Math.abs(e.WindCnt)>1?e.WindDelta*t.WindDelta<0?t.WindCnt=e.WindCnt:t.WindCnt=e.WindCnt+t.WindDelta:t.WindCnt=t.WindDelta===0?1:t.WindDelta:t.WindDelta===0?t.WindCnt=e.WindCnt<0?e.WindCnt-1:e.WindCnt+1:e.WindDelta*t.WindDelta<0?t.WindCnt=e.WindCnt:t.WindCnt=e.WindCnt+t.WindDelta,t.WindCnt2=e.WindCnt2,e=e.NextInAEL;if(this.IsEvenOddAltFillType(t))for(;e!=t;)e.WindDelta!==0&&(t.WindCnt2=t.WindCnt2===0?1:0),e=e.NextInAEL;else for(;e!=t;)t.WindCnt2+=e.WindDelta,e=e.NextInAEL};y.Clipper.prototype.AddEdgeToSEL=function(t){this.m_SortedEdges===null?(this.m_SortedEdges=t,t.PrevInSEL=null,t.NextInSEL=null):(t.NextInSEL=this.m_SortedEdges,t.PrevInSEL=null,this.m_SortedEdges.PrevInSEL=t,this.m_SortedEdges=t)};y.Clipper.prototype.CopyAELToSEL=function(){var t=this.m_ActiveEdges;for(this.m_SortedEdges=t;t!==null;)t.PrevInSEL=t.PrevInAEL,t.NextInSEL=t.NextInAEL,t=t.NextInAEL};y.Clipper.prototype.SwapPositionsInAEL=function(t,e){if(!(t.NextInAEL==t.PrevInAEL||e.NextInAEL==e.PrevInAEL)){if(t.NextInAEL==e){var r=e.NextInAEL;r!==null&&(r.PrevInAEL=t);var n=t.PrevInAEL;n!==null&&(n.NextInAEL=e),e.PrevInAEL=n,e.NextInAEL=t,t.PrevInAEL=e,t.NextInAEL=r}else if(e.NextInAEL==t){var r=t.NextInAEL;r!==null&&(r.PrevInAEL=e);var n=e.PrevInAEL;n!==null&&(n.NextInAEL=t),t.PrevInAEL=n,t.NextInAEL=e,e.PrevInAEL=t,e.NextInAEL=r}else{var r=t.NextInAEL,n=t.PrevInAEL;t.NextInAEL=e.NextInAEL,t.NextInAEL!==null&&(t.NextInAEL.PrevInAEL=t),t.PrevInAEL=e.PrevInAEL,t.PrevInAEL!==null&&(t.PrevInAEL.NextInAEL=t),e.NextInAEL=r,e.NextInAEL!==null&&(e.NextInAEL.PrevInAEL=e),e.PrevInAEL=n,e.PrevInAEL!==null&&(e.PrevInAEL.NextInAEL=e)}t.PrevInAEL===null?this.m_ActiveEdges=t:e.PrevInAEL===null&&(this.m_ActiveEdges=e)}};y.Clipper.prototype.SwapPositionsInSEL=function(t,e){if(!(t.NextInSEL===null&&t.PrevInSEL===null)&&!(e.NextInSEL===null&&e.PrevInSEL===null)){if(t.NextInSEL==e){var r=e.NextInSEL;r!==null&&(r.PrevInSEL=t);var n=t.PrevInSEL;n!==null&&(n.NextInSEL=e),e.PrevInSEL=n,e.NextInSEL=t,t.PrevInSEL=e,t.NextInSEL=r}else if(e.NextInSEL==t){var r=t.NextInSEL;r!==null&&(r.PrevInSEL=e);var n=e.PrevInSEL;n!==null&&(n.NextInSEL=t),t.PrevInSEL=n,t.NextInSEL=e,e.PrevInSEL=t,e.NextInSEL=r}else{var r=t.NextInSEL,n=t.PrevInSEL;t.NextInSEL=e.NextInSEL,t.NextInSEL!==null&&(t.NextInSEL.PrevInSEL=t),t.PrevInSEL=e.PrevInSEL,t.PrevInSEL!==null&&(t.PrevInSEL.NextInSEL=t),e.NextInSEL=r,e.NextInSEL!==null&&(e.NextInSEL.PrevInSEL=e),e.PrevInSEL=n,e.PrevInSEL!==null&&(e.PrevInSEL.NextInSEL=e)}t.PrevInSEL===null?this.m_SortedEdges=t:e.PrevInSEL===null&&(this.m_SortedEdges=e)}};y.Clipper.prototype.AddLocalMaxPoly=function(t,e,r){this.AddOutPt(t,r),e.WindDelta==0&&this.AddOutPt(e,r),t.OutIdx==e.OutIdx?(t.OutIdx=-1,e.OutIdx=-1):t.OutIdx<e.OutIdx?this.AppendPolygon(t,e):this.AppendPolygon(e,t)};y.Clipper.prototype.AddLocalMinPoly=function(t,e,r){var n,i,o;if(y.ClipperBase.IsHorizontal(e)||t.Dx>e.Dx?(n=this.AddOutPt(t,r),e.OutIdx=t.OutIdx,t.Side=y.EdgeSide.esLeft,e.Side=y.EdgeSide.esRight,i=t,i.PrevInAEL==e?o=e.PrevInAEL:o=i.PrevInAEL):(n=this.AddOutPt(e,r),t.OutIdx=e.OutIdx,t.Side=y.EdgeSide.esRight,e.Side=y.EdgeSide.esLeft,i=e,i.PrevInAEL==t?o=t.PrevInAEL:o=i.PrevInAEL),o!==null&&o.OutIdx>=0&&y.Clipper.TopX(o,r.Y)==y.Clipper.TopX(i,r.Y)&&y.ClipperBase.SlopesEqual(i,o,this.m_UseFullRange)&&i.WindDelta!==0&&o.WindDelta!==0){var a=this.AddOutPt(o,r);this.AddJoin(n,a,i.Top)}return n};y.Clipper.prototype.CreateOutRec=function(){var t=new y.OutRec;return t.Idx=-1,t.IsHole=!1,t.IsOpen=!1,t.FirstLeft=null,t.Pts=null,t.BottomPt=null,t.PolyNode=null,this.m_PolyOuts.push(t),t.Idx=this.m_PolyOuts.length-1,t};y.Clipper.prototype.AddOutPt=function(t,e){var r=t.Side==y.EdgeSide.esLeft;if(t.OutIdx<0){var n=this.CreateOutRec();n.IsOpen=t.WindDelta===0;var i=new y.OutPt;return n.Pts=i,i.Idx=n.Idx,i.Pt.X=e.X,i.Pt.Y=e.Y,i.Next=i,i.Prev=i,n.IsOpen||this.SetHoleState(t,n),Ao&&(y.IntPoint.op_Equality(e,t.Bot)?(i.Pt.X=t.Bot.X,i.Pt.Y=t.Bot.Y,i.Pt.Z=t.Bot.Z):y.IntPoint.op_Equality(e,t.Top)?(i.Pt.X=t.Top.X,i.Pt.Y=t.Top.Y,i.Pt.Z=t.Top.Z):this.SetZ(i.Pt,t)),t.OutIdx=n.Idx,i}else{var n=this.m_PolyOuts[t.OutIdx],o=n.Pts;if(r&&y.IntPoint.op_Equality(e,o.Pt))return o;if(!r&&y.IntPoint.op_Equality(e,o.Prev.Pt))return o.Prev;var i=new y.OutPt;return i.Idx=n.Idx,i.Pt.X=e.X,i.Pt.Y=e.Y,i.Next=o,i.Prev=o.Prev,i.Prev.Next=i,o.Prev=i,r&&(n.Pts=i),Ao&&(y.IntPoint.op_Equality(e,t.Bot)?(i.Pt.X=t.Bot.X,i.Pt.Y=t.Bot.Y,i.Pt.Z=t.Bot.Z):y.IntPoint.op_Equality(e,t.Top)?(i.Pt.X=t.Top.X,i.Pt.Y=t.Top.Y,i.Pt.Z=t.Top.Z):this.SetZ(i.Pt,t)),i}};y.Clipper.prototype.SwapPoints=function(t,e){var r=new y.IntPoint(t.Value);t.Value.X=e.Value.X,t.Value.Y=e.Value.Y,e.Value.X=r.X,e.Value.Y=r.Y};y.Clipper.prototype.HorzSegmentsOverlap=function(t,e,r,n){return t.X>r.X==t.X<n.X||e.X>r.X==e.X<n.X||r.X>t.X==r.X<e.X||n.X>t.X==n.X<e.X||t.X==r.X&&e.X==n.X?!0:t.X==n.X&&e.X==r.X};y.Clipper.prototype.InsertPolyPtBetween=function(t,e,r){var n=new y.OutPt;return n.Pt.X=r.X,n.Pt.Y=r.Y,e==t.Next?(t.Next=n,e.Prev=n,n.Next=e,n.Prev=t):(e.Next=n,t.Prev=n,n.Next=t,n.Prev=e),n};y.Clipper.prototype.SetHoleState=function(t,e){for(var r=!1,n=t.PrevInAEL;n!==null;)n.OutIdx>=0&&n.WindDelta!=0&&(r=!r,e.FirstLeft===null&&(e.FirstLeft=this.m_PolyOuts[n.OutIdx])),n=n.PrevInAEL;r&&(e.IsHole=!0)};y.Clipper.prototype.GetDx=function(t,e){return t.Y==e.Y?y.ClipperBase.horizontal:(e.X-t.X)/(e.Y-t.Y)};y.Clipper.prototype.FirstIsBottomPt=function(t,e){for(var r=t.Prev;y.IntPoint.op_Equality(r.Pt,t.Pt)&&r!=t;)r=r.Prev;var n=Math.abs(this.GetDx(t.Pt,r.Pt));for(r=t.Next;y.IntPoint.op_Equality(r.Pt,t.Pt)&&r!=t;)r=r.Next;var i=Math.abs(this.GetDx(t.Pt,r.Pt));for(r=e.Prev;y.IntPoint.op_Equality(r.Pt,e.Pt)&&r!=e;)r=r.Prev;var o=Math.abs(this.GetDx(e.Pt,r.Pt));for(r=e.Next;y.IntPoint.op_Equality(r.Pt,e.Pt)&&r!=e;)r=r.Next;var a=Math.abs(this.GetDx(e.Pt,r.Pt));return n>=o&&n>=a||i>=o&&i>=a};y.Clipper.prototype.GetBottomPt=function(t){for(var e=null,r=t.Next;r!=t;)r.Pt.Y>t.Pt.Y?(t=r,e=null):r.Pt.Y==t.Pt.Y&&r.Pt.X<=t.Pt.X&&(r.Pt.X<t.Pt.X?(e=null,t=r):r.Next!=t&&r.Prev!=t&&(e=r)),r=r.Next;if(e!==null)for(;e!=r;)for(this.FirstIsBottomPt(r,e)||(t=e),e=e.Next;y.IntPoint.op_Inequality(e.Pt,t.Pt);)e=e.Next;return t};y.Clipper.prototype.GetLowermostRec=function(t,e){t.BottomPt===null&&(t.BottomPt=this.GetBottomPt(t.Pts)),e.BottomPt===null&&(e.BottomPt=this.GetBottomPt(e.Pts));var r=t.BottomPt,n=e.BottomPt;return r.Pt.Y>n.Pt.Y?t:r.Pt.Y<n.Pt.Y?e:r.Pt.X<n.Pt.X?t:r.Pt.X>n.Pt.X||r.Next==r?e:n.Next==n||this.FirstIsBottomPt(r,n)?t:e};y.Clipper.prototype.Param1RightOfParam2=function(t,e){do if(t=t.FirstLeft,t==e)return!0;while(t!==null);return!1};y.Clipper.prototype.GetOutRec=function(t){for(var e=this.m_PolyOuts[t];e!=this.m_PolyOuts[e.Idx];)e=this.m_PolyOuts[e.Idx];return e};y.Clipper.prototype.AppendPolygon=function(t,e){var r=this.m_PolyOuts[t.OutIdx],n=this.m_PolyOuts[e.OutIdx],i;this.Param1RightOfParam2(r,n)?i=n:this.Param1RightOfParam2(n,r)?i=r:i=this.GetLowermostRec(r,n);var o=r.Pts,a=o.Prev,s=n.Pts,l=s.Prev,u;t.Side==y.EdgeSide.esLeft?(e.Side==y.EdgeSide.esLeft?(this.ReversePolyPtLinks(s),s.Next=o,o.Prev=s,a.Next=l,l.Prev=a,r.Pts=l):(l.Next=o,o.Prev=l,s.Prev=a,a.Next=s,r.Pts=s),u=y.EdgeSide.esLeft):(e.Side==y.EdgeSide.esRight?(this.ReversePolyPtLinks(s),a.Next=l,l.Prev=a,s.Next=o,o.Prev=s):(a.Next=s,s.Prev=a,o.Prev=l,l.Next=o),u=y.EdgeSide.esRight),r.BottomPt=null,i==n&&(n.FirstLeft!=r&&(r.FirstLeft=n.FirstLeft),r.IsHole=n.IsHole),n.Pts=null,n.BottomPt=null,n.FirstLeft=r;var c=t.OutIdx,p=e.OutIdx;t.OutIdx=-1,e.OutIdx=-1;for(var h=this.m_ActiveEdges;h!==null;){if(h.OutIdx==p){h.OutIdx=c,h.Side=u;break}h=h.NextInAEL}n.Idx=r.Idx};y.Clipper.prototype.ReversePolyPtLinks=function(t){if(t!==null){var e,r;e=t;do r=e.Next,e.Next=e.Prev,e.Prev=r,e=r;while(e!=t)}};y.Clipper.SwapSides=function(t,e){var r=t.Side;t.Side=e.Side,e.Side=r};y.Clipper.SwapPolyIndexes=function(t,e){var r=t.OutIdx;t.OutIdx=e.OutIdx,e.OutIdx=r};y.Clipper.prototype.IntersectEdges=function(t,e,r,n){var i=!n&&t.NextInLML===null&&t.Top.X==r.X&&t.Top.Y==r.Y,o=!n&&e.NextInLML===null&&e.Top.X==r.X&&e.Top.Y==r.Y,a=t.OutIdx>=0,s=e.OutIdx>=0;if(mM&&(t.WindDelta===0||e.WindDelta===0)){t.WindDelta===0&&e.WindDelta===0?(i||o)&&a&&s&&this.AddLocalMaxPoly(t,e,r):t.PolyTyp==e.PolyTyp&&t.WindDelta!=e.WindDelta&&this.m_ClipType==y.ClipType.ctUnion?t.WindDelta===0?s&&(this.AddOutPt(t,r),a&&(t.OutIdx=-1)):a&&(this.AddOutPt(e,r),s&&(e.OutIdx=-1)):t.PolyTyp!=e.PolyTyp&&(t.WindDelta===0&&Math.abs(e.WindCnt)==1&&(this.m_ClipType!=y.ClipType.ctUnion||e.WindCnt2===0)?(this.AddOutPt(t,r),a&&(t.OutIdx=-1)):e.WindDelta===0&&Math.abs(t.WindCnt)==1&&(this.m_ClipType!=y.ClipType.ctUnion||t.WindCnt2===0)&&(this.AddOutPt(e,r),s&&(e.OutIdx=-1))),i&&(t.OutIdx<0?this.DeleteFromAEL(t):y.Error("Error intersecting polylines")),o&&(e.OutIdx<0?this.DeleteFromAEL(e):y.Error("Error intersecting polylines"));return}if(t.PolyTyp==e.PolyTyp)if(this.IsEvenOddFillType(t)){var l=t.WindCnt;t.WindCnt=e.WindCnt,e.WindCnt=l}else t.WindCnt+e.WindDelta===0?t.WindCnt=-t.WindCnt:t.WindCnt+=e.WindDelta,e.WindCnt-t.WindDelta===0?e.WindCnt=-e.WindCnt:e.WindCnt-=t.WindDelta;else this.IsEvenOddFillType(e)?t.WindCnt2=t.WindCnt2===0?1:0:t.WindCnt2+=e.WindDelta,this.IsEvenOddFillType(t)?e.WindCnt2=e.WindCnt2===0?1:0:e.WindCnt2-=t.WindDelta;var u,c,p,h;t.PolyTyp==y.PolyType.ptSubject?(u=this.m_SubjFillType,p=this.m_ClipFillType):(u=this.m_ClipFillType,p=this.m_SubjFillType),e.PolyTyp==y.PolyType.ptSubject?(c=this.m_SubjFillType,h=this.m_ClipFillType):(c=this.m_ClipFillType,h=this.m_SubjFillType);var f,d;switch(u){case y.PolyFillType.pftPositive:f=t.WindCnt;break;case y.PolyFillType.pftNegative:f=-t.WindCnt;break;default:f=Math.abs(t.WindCnt);break}switch(c){case y.PolyFillType.pftPositive:d=e.WindCnt;break;case y.PolyFillType.pftNegative:d=-e.WindCnt;break;default:d=Math.abs(e.WindCnt);break}if(a&&s)i||o||f!==0&&f!=1||d!==0&&d!=1||t.PolyTyp!=e.PolyTyp&&this.m_ClipType!=y.ClipType.ctXor?this.AddLocalMaxPoly(t,e,r):(this.AddOutPt(t,r),this.AddOutPt(e,r),y.Clipper.SwapSides(t,e),y.Clipper.SwapPolyIndexes(t,e));else if(a)(d===0||d==1)&&(this.AddOutPt(t,r),y.Clipper.SwapSides(t,e),y.Clipper.SwapPolyIndexes(t,e));else if(s)(f===0||f==1)&&(this.AddOutPt(e,r),y.Clipper.SwapSides(t,e),y.Clipper.SwapPolyIndexes(t,e));else if((f===0||f==1)&&(d===0||d==1)&&!i&&!o){var g,x;switch(p){case y.PolyFillType.pftPositive:g=t.WindCnt2;break;case y.PolyFillType.pftNegative:g=-t.WindCnt2;break;default:g=Math.abs(t.WindCnt2);break}switch(h){case y.PolyFillType.pftPositive:x=e.WindCnt2;break;case y.PolyFillType.pftNegative:x=-e.WindCnt2;break;default:x=Math.abs(e.WindCnt2);break}if(t.PolyTyp!=e.PolyTyp)this.AddLocalMinPoly(t,e,r);else if(f==1&&d==1)switch(this.m_ClipType){case y.ClipType.ctIntersection:g>0&&x>0&&this.AddLocalMinPoly(t,e,r);break;case y.ClipType.ctUnion:g<=0&&x<=0&&this.AddLocalMinPoly(t,e,r);break;case y.ClipType.ctDifference:(t.PolyTyp==y.PolyType.ptClip&&g>0&&x>0||t.PolyTyp==y.PolyType.ptSubject&&g<=0&&x<=0)&&this.AddLocalMinPoly(t,e,r);break;case y.ClipType.ctXor:this.AddLocalMinPoly(t,e,r);break}else y.Clipper.SwapSides(t,e)}i!=o&&(i&&t.OutIdx>=0||o&&e.OutIdx>=0)&&(y.Clipper.SwapSides(t,e),y.Clipper.SwapPolyIndexes(t,e)),i&&this.DeleteFromAEL(t),o&&this.DeleteFromAEL(e)};y.Clipper.prototype.DeleteFromAEL=function(t){var e=t.PrevInAEL,r=t.NextInAEL;e===null&&r===null&&t!=this.m_ActiveEdges||(e!==null?e.NextInAEL=r:this.m_ActiveEdges=r,r!==null&&(r.PrevInAEL=e),t.NextInAEL=null,t.PrevInAEL=null)};y.Clipper.prototype.DeleteFromSEL=function(t){var e=t.PrevInSEL,r=t.NextInSEL;e===null&&r===null&&t!=this.m_SortedEdges||(e!==null?e.NextInSEL=r:this.m_SortedEdges=r,r!==null&&(r.PrevInSEL=e),t.NextInSEL=null,t.PrevInSEL=null)};y.Clipper.prototype.UpdateEdgeIntoAEL=function(t){t.NextInLML===null&&y.Error("UpdateEdgeIntoAEL: invalid call");var e=t.PrevInAEL,r=t.NextInAEL;return t.NextInLML.OutIdx=t.OutIdx,e!==null?e.NextInAEL=t.NextInLML:this.m_ActiveEdges=t.NextInLML,r!==null&&(r.PrevInAEL=t.NextInLML),t.NextInLML.Side=t.Side,t.NextInLML.WindDelta=t.WindDelta,t.NextInLML.WindCnt=t.WindCnt,t.NextInLML.WindCnt2=t.WindCnt2,t=t.NextInLML,t.Curr.X=t.Bot.X,t.Curr.Y=t.Bot.Y,t.PrevInAEL=e,t.NextInAEL=r,y.ClipperBase.IsHorizontal(t)||this.InsertScanbeam(t.Top.Y),t};y.Clipper.prototype.ProcessHorizontals=function(t){for(var e=this.m_SortedEdges;e!==null;)this.DeleteFromSEL(e),this.ProcessHorizontal(e,t),e=this.m_SortedEdges};y.Clipper.prototype.GetHorzDirection=function(t,e){t.Bot.X<t.Top.X?(e.Left=t.Bot.X,e.Right=t.Top.X,e.Dir=y.Direction.dLeftToRight):(e.Left=t.Top.X,e.Right=t.Bot.X,e.Dir=y.Direction.dRightToLeft)};y.Clipper.prototype.PrepareHorzJoins=function(t,e){var r=this.m_PolyOuts[t.OutIdx].Pts;t.Side!=y.EdgeSide.esLeft&&(r=r.Prev),e&&(y.IntPoint.op_Equality(r.Pt,t.Top)?this.AddGhostJoin(r,t.Bot):this.AddGhostJoin(r,t.Top))};y.Clipper.prototype.ProcessHorizontal=function(t,e){var r={Dir:null,Left:null,Right:null};this.GetHorzDirection(t,r);for(var n=r.Dir,i=r.Left,o=r.Right,a=t,s=null;a.NextInLML!==null&&y.ClipperBase.IsHorizontal(a.NextInLML);)a=a.NextInLML;for(a.NextInLML===null&&(s=this.GetMaximaPair(a));;){for(var l=t==a,u=this.GetNextInAEL(t,n);u!==null&&!(u.Curr.X==t.Top.X&&t.NextInLML!==null&&u.Dx<t.NextInLML.Dx);){var c=this.GetNextInAEL(u,n);if(n==y.Direction.dLeftToRight&&u.Curr.X<=o||n==y.Direction.dRightToLeft&&u.Curr.X>=i){if(t.OutIdx>=0&&t.WindDelta!=0&&this.PrepareHorzJoins(t,e),u==s&&l){n==y.Direction.dLeftToRight?this.IntersectEdges(t,u,u.Top,!1):this.IntersectEdges(u,t,u.Top,!1),s.OutIdx>=0&&y.Error("ProcessHorizontal error");return}else if(n==y.Direction.dLeftToRight){var p=new y.IntPoint(u.Curr.X,t.Curr.Y);this.IntersectEdges(t,u,p,!0)}else{var p=new y.IntPoint(u.Curr.X,t.Curr.Y);this.IntersectEdges(u,t,p,!0)}this.SwapPositionsInAEL(t,u)}else if(n==y.Direction.dLeftToRight&&u.Curr.X>=o||n==y.Direction.dRightToLeft&&u.Curr.X<=i)break;u=c}if(t.OutIdx>=0&&t.WindDelta!==0&&this.PrepareHorzJoins(t,e),t.NextInLML!==null&&y.ClipperBase.IsHorizontal(t.NextInLML)){t=this.UpdateEdgeIntoAEL(t),t.OutIdx>=0&&this.AddOutPt(t,t.Bot);var r={Dir:n,Left:i,Right:o};this.GetHorzDirection(t,r),n=r.Dir,i=r.Left,o=r.Right}else break}if(t.NextInLML!==null)if(t.OutIdx>=0){var h=this.AddOutPt(t,t.Top);if(t=this.UpdateEdgeIntoAEL(t),t.WindDelta===0)return;var f=t.PrevInAEL,c=t.NextInAEL;if(f!==null&&f.Curr.X==t.Bot.X&&f.Curr.Y==t.Bot.Y&&f.WindDelta!==0&&f.OutIdx>=0&&f.Curr.Y>f.Top.Y&&y.ClipperBase.SlopesEqual(t,f,this.m_UseFullRange)){var d=this.AddOutPt(f,t.Bot);this.AddJoin(h,d,t.Top)}else if(c!==null&&c.Curr.X==t.Bot.X&&c.Curr.Y==t.Bot.Y&&c.WindDelta!==0&&c.OutIdx>=0&&c.Curr.Y>c.Top.Y&&y.ClipperBase.SlopesEqual(t,c,this.m_UseFullRange)){var d=this.AddOutPt(c,t.Bot);this.AddJoin(h,d,t.Top)}}else t=this.UpdateEdgeIntoAEL(t);else s!==null?s.OutIdx>=0?(n==y.Direction.dLeftToRight?this.IntersectEdges(t,s,t.Top,!1):this.IntersectEdges(s,t,t.Top,!1),s.OutIdx>=0&&y.Error("ProcessHorizontal error")):(this.DeleteFromAEL(t),this.DeleteFromAEL(s)):(t.OutIdx>=0&&this.AddOutPt(t,t.Top),this.DeleteFromAEL(t))};y.Clipper.prototype.GetNextInAEL=function(t,e){return e==y.Direction.dLeftToRight?t.NextInAEL:t.PrevInAEL};y.Clipper.prototype.IsMinima=function(t){return t!==null&&t.Prev.NextInLML!=t&&t.Next.NextInLML!=t};y.Clipper.prototype.IsMaxima=function(t,e){return t!==null&&t.Top.Y==e&&t.NextInLML===null};y.Clipper.prototype.IsIntermediate=function(t,e){return t.Top.Y==e&&t.NextInLML!==null};y.Clipper.prototype.GetMaximaPair=function(t){var e=null;return y.IntPoint.op_Equality(t.Next.Top,t.Top)&&t.Next.NextInLML===null?e=t.Next:y.IntPoint.op_Equality(t.Prev.Top,t.Top)&&t.Prev.NextInLML===null&&(e=t.Prev),e!==null&&(e.OutIdx==-2||e.NextInAEL==e.PrevInAEL&&!y.ClipperBase.IsHorizontal(e))?null:e};y.Clipper.prototype.ProcessIntersections=function(t,e){if(this.m_ActiveEdges==null)return!0;try{if(this.BuildIntersectList(t,e),this.m_IntersectList.length==0)return!0;if(this.m_IntersectList.length==1||this.FixupIntersectionOrder())this.ProcessIntersectList();else return!1}catch(r){this.m_SortedEdges=null,this.m_IntersectList.length=0,y.Error("ProcessIntersections error")}return this.m_SortedEdges=null,!0};y.Clipper.prototype.BuildIntersectList=function(t,e){if(this.m_ActiveEdges!==null){var r=this.m_ActiveEdges;for(this.m_SortedEdges=r;r!==null;)r.PrevInSEL=r.PrevInAEL,r.NextInSEL=r.NextInAEL,r.Curr.X=y.Clipper.TopX(r,e),r=r.NextInAEL;for(var n=!0;n&&this.m_SortedEdges!==null;){for(n=!1,r=this.m_SortedEdges;r.NextInSEL!==null;){var i=r.NextInSEL,o=new y.IntPoint;if(r.Curr.X>i.Curr.X){!this.IntersectPoint(r,i,o)&&r.Curr.X>i.Curr.X+1&&y.Error("Intersection error"),o.Y>t&&(o.Y=t,Math.abs(r.Dx)>Math.abs(i.Dx)?o.X=y.Clipper.TopX(i,t):o.X=y.Clipper.TopX(r,t));var a=new y.IntersectNode;a.Edge1=r,a.Edge2=i,a.Pt.X=o.X,a.Pt.Y=o.Y,this.m_IntersectList.push(a),this.SwapPositionsInSEL(r,i),n=!0}else r=i}if(r.PrevInSEL!==null)r.PrevInSEL.NextInSEL=null;else break}this.m_SortedEdges=null}};y.Clipper.prototype.EdgesAdjacent=function(t){return t.Edge1.NextInSEL==t.Edge2||t.Edge1.PrevInSEL==t.Edge2};y.Clipper.IntersectNodeSort=function(t,e){return e.Pt.Y-t.Pt.Y};y.Clipper.prototype.FixupIntersectionOrder=function(){this.m_IntersectList.sort(this.m_IntersectNodeComparer),this.CopyAELToSEL();for(var t=this.m_IntersectList.length,e=0;e<t;e++){if(!this.EdgesAdjacent(this.m_IntersectList[e])){for(var r=e+1;r<t&&!this.EdgesAdjacent(this.m_IntersectList[r]);)r++;if(r==t)return!1;var n=this.m_IntersectList[e];this.m_IntersectList[e]=this.m_IntersectList[r],this.m_IntersectList[r]=n}this.SwapPositionsInSEL(this.m_IntersectList[e].Edge1,this.m_IntersectList[e].Edge2)}return!0};y.Clipper.prototype.ProcessIntersectList=function(){for(var t=0,e=this.m_IntersectList.length;t<e;t++){var r=this.m_IntersectList[t];this.IntersectEdges(r.Edge1,r.Edge2,r.Pt,!0),this.SwapPositionsInAEL(r.Edge1,r.Edge2)}this.m_IntersectList.length=0};var G4=function(t){return t<0?Math.ceil(t-.5):Math.round(t)},j4=function(t){return t<0?Math.ceil(t-.5):Math.floor(t+.5)},H4=function(t){return t<0?-Math.round(Math.abs(t)):Math.round(t)},X4=function(t){return t<0?(t-=.5,t<-2147483648?Math.ceil(t):t|0):(t+=.5,t>2147483647?Math.floor(t):t|0)};Me.msie?y.Clipper.Round=G4:Me.chromium?y.Clipper.Round=H4:Me.safari?y.Clipper.Round=X4:y.Clipper.Round=j4;y.Clipper.TopX=function(t,e){return e==t.Top.Y?t.Top.X:t.Bot.X+y.Clipper.Round(t.Dx*(e-t.Bot.Y))};y.Clipper.prototype.IntersectPoint=function(t,e,r){r.X=0,r.Y=0;var n,i;if(y.ClipperBase.SlopesEqual(t,e,this.m_UseFullRange)||t.Dx==e.Dx)return e.Bot.Y>t.Bot.Y?(r.X=e.Bot.X,r.Y=e.Bot.Y):(r.X=t.Bot.X,r.Y=t.Bot.Y),!1;if(t.Delta.X===0)r.X=t.Bot.X,y.ClipperBase.IsHorizontal(e)?r.Y=e.Bot.Y:(i=e.Bot.Y-e.Bot.X/e.Dx,r.Y=y.Clipper.Round(r.X/e.Dx+i));else if(e.Delta.X===0)r.X=e.Bot.X,y.ClipperBase.IsHorizontal(t)?r.Y=t.Bot.Y:(n=t.Bot.Y-t.Bot.X/t.Dx,r.Y=y.Clipper.Round(r.X/t.Dx+n));else{n=t.Bot.X-t.Bot.Y*t.Dx,i=e.Bot.X-e.Bot.Y*e.Dx;var o=(i-n)/(t.Dx-e.Dx);r.Y=y.Clipper.Round(o),Math.abs(t.Dx)<Math.abs(e.Dx)?r.X=y.Clipper.Round(t.Dx*o+n):r.X=y.Clipper.Round(e.Dx*o+i)}if(r.Y<t.Top.Y||r.Y<e.Top.Y){if(t.Top.Y>e.Top.Y)return r.Y=t.Top.Y,r.X=y.Clipper.TopX(e,t.Top.Y),r.X<t.Top.X;r.Y=e.Top.Y,Math.abs(t.Dx)<Math.abs(e.Dx)?r.X=y.Clipper.TopX(t,r.Y):r.X=y.Clipper.TopX(e,r.Y)}return!0};y.Clipper.prototype.ProcessEdgesAtTopOfScanbeam=function(t){for(var e=this.m_ActiveEdges;e!==null;){var r=this.IsMaxima(e,t);if(r){var n=this.GetMaximaPair(e);r=n===null||!y.ClipperBase.IsHorizontal(n)}if(r){var i=e.PrevInAEL;this.DoMaxima(e),i===null?e=this.m_ActiveEdges:e=i.NextInAEL}else{if(this.IsIntermediate(e,t)&&y.ClipperBase.IsHorizontal(e.NextInLML)?(e=this.UpdateEdgeIntoAEL(e),e.OutIdx>=0&&this.AddOutPt(e,e.Bot),this.AddEdgeToSEL(e)):(e.Curr.X=y.Clipper.TopX(e,t),e.Curr.Y=t),this.StrictlySimple){var i=e.PrevInAEL;if(e.OutIdx>=0&&e.WindDelta!==0&&i!==null&&i.OutIdx>=0&&i.Curr.X==e.Curr.X&&i.WindDelta!==0){var o=this.AddOutPt(i,e.Curr),a=this.AddOutPt(e,e.Curr);this.AddJoin(o,a,e.Curr)}}e=e.NextInAEL}}for(this.ProcessHorizontals(!0),e=this.m_ActiveEdges;e!==null;){if(this.IsIntermediate(e,t)){var o=null;e.OutIdx>=0&&(o=this.AddOutPt(e,e.Top)),e=this.UpdateEdgeIntoAEL(e);var i=e.PrevInAEL,s=e.NextInAEL;if(i!==null&&i.Curr.X==e.Bot.X&&i.Curr.Y==e.Bot.Y&&o!==null&&i.OutIdx>=0&&i.Curr.Y>i.Top.Y&&y.ClipperBase.SlopesEqual(e,i,this.m_UseFullRange)&&e.WindDelta!==0&&i.WindDelta!==0){var a=this.AddOutPt(i,e.Bot);this.AddJoin(o,a,e.Top)}else if(s!==null&&s.Curr.X==e.Bot.X&&s.Curr.Y==e.Bot.Y&&o!==null&&s.OutIdx>=0&&s.Curr.Y>s.Top.Y&&y.ClipperBase.SlopesEqual(e,s,this.m_UseFullRange)&&e.WindDelta!==0&&s.WindDelta!==0){var a=this.AddOutPt(s,e.Bot);this.AddJoin(o,a,e.Top)}}e=e.NextInAEL}};y.Clipper.prototype.DoMaxima=function(t){var e=this.GetMaximaPair(t);if(e===null){t.OutIdx>=0&&this.AddOutPt(t,t.Top),this.DeleteFromAEL(t);return}for(var r=t.NextInAEL,n=!0;r!==null&&r!=e;)this.IntersectEdges(t,r,t.Top,!0),this.SwapPositionsInAEL(t,r),r=t.NextInAEL;t.OutIdx==-1&&e.OutIdx==-1?(this.DeleteFromAEL(t),this.DeleteFromAEL(e)):t.OutIdx>=0&&e.OutIdx>=0?this.IntersectEdges(t,e,t.Top,!1):n&&t.WindDelta===0?(t.OutIdx>=0&&(this.AddOutPt(t,t.Top),t.OutIdx=-1),this.DeleteFromAEL(t),e.OutIdx>=0&&(this.AddOutPt(e,t.Top),e.OutIdx=-1),this.DeleteFromAEL(e)):y.Error("DoMaxima error")};y.Clipper.ReversePaths=function(t){for(var e=0,r=t.length;e<r;e++)t[e].reverse()};y.Clipper.Orientation=function(t){return y.Clipper.Area(t)>=0};y.Clipper.prototype.PointCount=function(t){if(t===null)return 0;var e=0,r=t;do e++,r=r.Next;while(r!=t);return e};y.Clipper.prototype.BuildResult=function(t){y.Clear(t);for(var e=0,r=this.m_PolyOuts.length;e<r;e++){var n=this.m_PolyOuts[e];if(n.Pts!==null){var i=n.Pts.Prev,o=this.PointCount(i);if(!(o<2)){for(var a=new Array(o),s=0;s<o;s++)a[s]=i.Pt,i=i.Prev;t.push(a)}}}};y.Clipper.prototype.BuildResult2=function(t){t.Clear();for(var e=0,r=this.m_PolyOuts.length;e<r;e++){var n=this.m_PolyOuts[e],i=this.PointCount(n.Pts);if(!(n.IsOpen&&i<2||!n.IsOpen&&i<3)){this.FixHoleLinkage(n);var o=new y.PolyNode;t.m_AllPolys.push(o),n.PolyNode=o,o.m_polygon.length=i;for(var a=n.Pts.Prev,s=0;s<i;s++)o.m_polygon[s]=a.Pt,a=a.Prev}}for(var e=0,r=this.m_PolyOuts.length;e<r;e++){var n=this.m_PolyOuts[e];n.PolyNode!==null&&(n.IsOpen?(n.PolyNode.IsOpen=!0,t.AddChild(n.PolyNode)):n.FirstLeft!==null&&n.FirstLeft.PolyNode!=null?n.FirstLeft.PolyNode.AddChild(n.PolyNode):t.AddChild(n.PolyNode))}};y.Clipper.prototype.FixupOutPolygon=function(t){var e=null;t.BottomPt=null;for(var r=t.Pts;;){if(r.Prev==r||r.Prev==r.Next){this.DisposeOutPts(r),t.Pts=null;return}if(y.IntPoint.op_Equality(r.Pt,r.Next.Pt)||y.IntPoint.op_Equality(r.Pt,r.Prev.Pt)||y.ClipperBase.SlopesEqual(r.Prev.Pt,r.Pt,r.Next.Pt,this.m_UseFullRange)&&(!this.PreserveCollinear||!this.Pt2IsBetweenPt1AndPt3(r.Prev.Pt,r.Pt,r.Next.Pt))){e=null;var n=r;r.Prev.Next=r.Next,r.Next.Prev=r.Prev,r=r.Prev,n=null}else{if(r==e)break;e===null&&(e=r),r=r.Next}}t.Pts=r};y.Clipper.prototype.DupOutPt=function(t,e){var r=new y.OutPt;return r.Pt.X=t.Pt.X,r.Pt.Y=t.Pt.Y,r.Idx=t.Idx,e?(r.Next=t.Next,r.Prev=t,t.Next.Prev=r,t.Next=r):(r.Prev=t.Prev,r.Next=t,t.Prev.Next=r,t.Prev=r),r};y.Clipper.prototype.GetOverlap=function(t,e,r,n,i){return t<e?r<n?(i.Left=Math.max(t,r),i.Right=Math.min(e,n)):(i.Left=Math.max(t,n),i.Right=Math.min(e,r)):r<n?(i.Left=Math.max(e,r),i.Right=Math.min(t,n)):(i.Left=Math.max(e,n),i.Right=Math.min(t,r)),i.Left<i.Right};y.Clipper.prototype.JoinHorz=function(t,e,r,n,i,o){var a=t.Pt.X>e.Pt.X?y.Direction.dRightToLeft:y.Direction.dLeftToRight,s=r.Pt.X>n.Pt.X?y.Direction.dRightToLeft:y.Direction.dLeftToRight;if(a==s)return!1;if(a==y.Direction.dLeftToRight){for(;t.Next.Pt.X<=i.X&&t.Next.Pt.X>=t.Pt.X&&t.Next.Pt.Y==i.Y;)t=t.Next;o&&t.Pt.X!=i.X&&(t=t.Next),e=this.DupOutPt(t,!o),y.IntPoint.op_Inequality(e.Pt,i)&&(t=e,t.Pt.X=i.X,t.Pt.Y=i.Y,e=this.DupOutPt(t,!o))}else{for(;t.Next.Pt.X>=i.X&&t.Next.Pt.X<=t.Pt.X&&t.Next.Pt.Y==i.Y;)t=t.Next;!o&&t.Pt.X!=i.X&&(t=t.Next),e=this.DupOutPt(t,o),y.IntPoint.op_Inequality(e.Pt,i)&&(t=e,t.Pt.X=i.X,t.Pt.Y=i.Y,e=this.DupOutPt(t,o))}if(s==y.Direction.dLeftToRight){for(;r.Next.Pt.X<=i.X&&r.Next.Pt.X>=r.Pt.X&&r.Next.Pt.Y==i.Y;)r=r.Next;o&&r.Pt.X!=i.X&&(r=r.Next),n=this.DupOutPt(r,!o),y.IntPoint.op_Inequality(n.Pt,i)&&(r=n,r.Pt.X=i.X,r.Pt.Y=i.Y,n=this.DupOutPt(r,!o))}else{for(;r.Next.Pt.X>=i.X&&r.Next.Pt.X<=r.Pt.X&&r.Next.Pt.Y==i.Y;)r=r.Next;!o&&r.Pt.X!=i.X&&(r=r.Next),n=this.DupOutPt(r,o),y.IntPoint.op_Inequality(n.Pt,i)&&(r=n,r.Pt.X=i.X,r.Pt.Y=i.Y,n=this.DupOutPt(r,o))}return a==y.Direction.dLeftToRight==o?(t.Prev=r,r.Next=t,e.Next=n,n.Prev=e):(t.Next=r,r.Prev=t,e.Prev=n,n.Next=e),!0};y.Clipper.prototype.JoinPoints=function(t,e,r){var n=t.OutPt1,i=new y.OutPt,o=t.OutPt2,a=new y.OutPt,s=t.OutPt1.Pt.Y==t.OffPt.Y;if(s&&y.IntPoint.op_Equality(t.OffPt,t.OutPt1.Pt)&&y.IntPoint.op_Equality(t.OffPt,t.OutPt2.Pt)){for(i=t.OutPt1.Next;i!=n&&y.IntPoint.op_Equality(i.Pt,t.OffPt);)i=i.Next;var l=i.Pt.Y>t.OffPt.Y;for(a=t.OutPt2.Next;a!=o&&y.IntPoint.op_Equality(a.Pt,t.OffPt);)a=a.Next;var u=a.Pt.Y>t.OffPt.Y;return l==u?!1:l?(i=this.DupOutPt(n,!1),a=this.DupOutPt(o,!0),n.Prev=o,o.Next=n,i.Next=a,a.Prev=i,t.OutPt1=n,t.OutPt2=i,!0):(i=this.DupOutPt(n,!0),a=this.DupOutPt(o,!1),n.Next=o,o.Prev=n,i.Prev=a,a.Next=i,t.OutPt1=n,t.OutPt2=i,!0)}else if(s){for(i=n;n.Prev.Pt.Y==n.Pt.Y&&n.Prev!=i&&n.Prev!=o;)n=n.Prev;for(;i.Next.Pt.Y==i.Pt.Y&&i.Next!=n&&i.Next!=o;)i=i.Next;if(i.Next==n||i.Next==o)return!1;for(a=o;o.Prev.Pt.Y==o.Pt.Y&&o.Prev!=a&&o.Prev!=i;)o=o.Prev;for(;a.Next.Pt.Y==a.Pt.Y&&a.Next!=o&&a.Next!=n;)a=a.Next;if(a.Next==o||a.Next==n)return!1;var c={Left:null,Right:null};if(!this.GetOverlap(n.Pt.X,i.Pt.X,o.Pt.X,a.Pt.X,c))return!1;var p=c.Left,h=c.Right,f=new y.IntPoint,d;return n.Pt.X>=p&&n.Pt.X<=h?(f.X=n.Pt.X,f.Y=n.Pt.Y,d=n.Pt.X>i.Pt.X):o.Pt.X>=p&&o.Pt.X<=h?(f.X=o.Pt.X,f.Y=o.Pt.Y,d=o.Pt.X>a.Pt.X):i.Pt.X>=p&&i.Pt.X<=h?(f.X=i.Pt.X,f.Y=i.Pt.Y,d=i.Pt.X>n.Pt.X):(f.X=a.Pt.X,f.Y=a.Pt.Y,d=a.Pt.X>o.Pt.X),t.OutPt1=n,t.OutPt2=o,this.JoinHorz(n,i,o,a,f,d)}else{for(i=n.Next;y.IntPoint.op_Equality(i.Pt,n.Pt)&&i!=n;)i=i.Next;var g=i.Pt.Y>n.Pt.Y||!y.ClipperBase.SlopesEqual(n.Pt,i.Pt,t.OffPt,this.m_UseFullRange);if(g){for(i=n.Prev;y.IntPoint.op_Equality(i.Pt,n.Pt)&&i!=n;)i=i.Prev;if(i.Pt.Y>n.Pt.Y||!y.ClipperBase.SlopesEqual(n.Pt,i.Pt,t.OffPt,this.m_UseFullRange))return!1}for(a=o.Next;y.IntPoint.op_Equality(a.Pt,o.Pt)&&a!=o;)a=a.Next;var x=a.Pt.Y>o.Pt.Y||!y.ClipperBase.SlopesEqual(o.Pt,a.Pt,t.OffPt,this.m_UseFullRange);if(x){for(a=o.Prev;y.IntPoint.op_Equality(a.Pt,o.Pt)&&a!=o;)a=a.Prev;if(a.Pt.Y>o.Pt.Y||!y.ClipperBase.SlopesEqual(o.Pt,a.Pt,t.OffPt,this.m_UseFullRange))return!1}return i==n||a==o||i==a||e==r&&g==x?!1:g?(i=this.DupOutPt(n,!1),a=this.DupOutPt(o,!0),n.Prev=o,o.Next=n,i.Next=a,a.Prev=i,t.OutPt1=n,t.OutPt2=i,!0):(i=this.DupOutPt(n,!0),a=this.DupOutPt(o,!1),n.Next=o,o.Prev=n,i.Prev=a,a.Next=i,t.OutPt1=n,t.OutPt2=i,!0)}};y.Clipper.GetBounds=function(t){for(var e=0,r=t.length;e<r&&t[e].length==0;)e++;if(e==r)return new y.IntRect(0,0,0,0);var n=new y.IntRect;for(n.left=t[e][0].X,n.right=n.left,n.top=t[e][0].Y,n.bottom=n.top;e<r;e++)for(var i=0,o=t[e].length;i<o;i++)t[e][i].X<n.left?n.left=t[e][i].X:t[e][i].X>n.right&&(n.right=t[e][i].X),t[e][i].Y<n.top?n.top=t[e][i].Y:t[e][i].Y>n.bottom&&(n.bottom=t[e][i].Y);return n};y.Clipper.prototype.GetBounds2=function(t){var e=t,r=new y.IntRect;for(r.left=t.Pt.X,r.right=t.Pt.X,r.top=t.Pt.Y,r.bottom=t.Pt.Y,t=t.Next;t!=e;)t.Pt.X<r.left&&(r.left=t.Pt.X),t.Pt.X>r.right&&(r.right=t.Pt.X),t.Pt.Y<r.top&&(r.top=t.Pt.Y),t.Pt.Y>r.bottom&&(r.bottom=t.Pt.Y),t=t.Next;return r};y.Clipper.PointInPolygon=function(t,e){var r=0,n=e.length;if(n<3)return 0;for(var i=e[0],o=1;o<=n;++o){var a=o==n?e[0]:e[o];if(a.Y==t.Y&&(a.X==t.X||i.Y==t.Y&&a.X>t.X==i.X<t.X))return-1;if(i.Y<t.Y!=a.Y<t.Y){if(i.X>=t.X)if(a.X>t.X)r=1-r;else{var s=(i.X-t.X)*(a.Y-t.Y)-(a.X-t.X)*(i.Y-t.Y);if(s==0)return-1;s>0==a.Y>i.Y&&(r=1-r)}else if(a.X>t.X){var s=(i.X-t.X)*(a.Y-t.Y)-(a.X-t.X)*(i.Y-t.Y);if(s==0)return-1;s>0==a.Y>i.Y&&(r=1-r)}}i=a}return r};y.Clipper.prototype.PointInPolygon=function(t,e){for(var r=0,n=e;;){var i=e.Pt.X,o=e.Pt.Y,a=e.Next.Pt.X,s=e.Next.Pt.Y;if(s==t.Y&&(a==t.X||o==t.Y&&a>t.X==i<t.X))return-1;if(o<t.Y!=s<t.Y){if(i>=t.X)if(a>t.X)r=1-r;else{var l=(i-t.X)*(s-t.Y)-(a-t.X)*(o-t.Y);if(l==0)return-1;l>0==s>o&&(r=1-r)}else if(a>t.X){var l=(i-t.X)*(s-t.Y)-(a-t.X)*(o-t.Y);if(l==0)return-1;l>0==s>o&&(r=1-r)}}if(e=e.Next,n==e)break}return r};y.Clipper.prototype.Poly2ContainsPoly1=function(t,e){var r=t;do{var n=this.PointInPolygon(r.Pt,e);if(n>=0)return n!=0;r=r.Next}while(r!=t);return!0};y.Clipper.prototype.FixupFirstLefts1=function(t,e){for(var r=0,n=this.m_PolyOuts.length;r<n;r++){var i=this.m_PolyOuts[r];i.Pts!==null&&i.FirstLeft==t&&this.Poly2ContainsPoly1(i.Pts,e.Pts)&&(i.FirstLeft=e)}};y.Clipper.prototype.FixupFirstLefts2=function(t,e){for(var r=0,n=this.m_PolyOuts,i=n.length,o=n[r];r<i;r++,o=n[r])o.FirstLeft==t&&(o.FirstLeft=e)};y.Clipper.ParseFirstLeft=function(t){for(;t!=null&&t.Pts==null;)t=t.FirstLeft;return t};y.Clipper.prototype.JoinCommonEdges=function(){for(var t=0,e=this.m_Joins.length;t<e;t++){var r=this.m_Joins[t],n=this.GetOutRec(r.OutPt1.Idx),i=this.GetOutRec(r.OutPt2.Idx);if(!(n.Pts==null||i.Pts==null)){var o;if(n==i?o=n:this.Param1RightOfParam2(n,i)?o=i:this.Param1RightOfParam2(i,n)?o=n:o=this.GetLowermostRec(n,i),!!this.JoinPoints(r,n,i))if(n==i){if(n.Pts=r.OutPt1,n.BottomPt=null,i=this.CreateOutRec(),i.Pts=r.OutPt2,this.UpdateOutPtIdxs(i),this.m_UsingPolyTree)for(var a=0,s=this.m_PolyOuts.length;a<s-1;a++){var l=this.m_PolyOuts[a];l.Pts==null||y.Clipper.ParseFirstLeft(l.FirstLeft)!=n||l.IsHole==n.IsHole||this.Poly2ContainsPoly1(l.Pts,r.OutPt2)&&(l.FirstLeft=i)}this.Poly2ContainsPoly1(i.Pts,n.Pts)?(i.IsHole=!n.IsHole,i.FirstLeft=n,this.m_UsingPolyTree&&this.FixupFirstLefts2(i,n),(i.IsHole^this.ReverseSolution)==this.Area(i)>0&&this.ReversePolyPtLinks(i.Pts)):this.Poly2ContainsPoly1(n.Pts,i.Pts)?(i.IsHole=n.IsHole,n.IsHole=!i.IsHole,i.FirstLeft=n.FirstLeft,n.FirstLeft=i,this.m_UsingPolyTree&&this.FixupFirstLefts2(n,i),(n.IsHole^this.ReverseSolution)==this.Area(n)>0&&this.ReversePolyPtLinks(n.Pts)):(i.IsHole=n.IsHole,i.FirstLeft=n.FirstLeft,this.m_UsingPolyTree&&this.FixupFirstLefts1(n,i))}else i.Pts=null,i.BottomPt=null,i.Idx=n.Idx,n.IsHole=o.IsHole,o==i&&(n.FirstLeft=i.FirstLeft),i.FirstLeft=n,this.m_UsingPolyTree&&this.FixupFirstLefts2(i,n)}}};y.Clipper.prototype.UpdateOutPtIdxs=function(t){var e=t.Pts;do e.Idx=t.Idx,e=e.Prev;while(e!=t.Pts)};y.Clipper.prototype.DoSimplePolygons=function(){for(var t=0;t<this.m_PolyOuts.length;){var e=this.m_PolyOuts[t++],r=e.Pts;if(r!==null)do{for(var n=r.Next;n!=e.Pts;){if(y.IntPoint.op_Equality(r.Pt,n.Pt)&&n.Next!=r&&n.Prev!=r){var i=r.Prev,o=n.Prev;r.Prev=o,o.Next=r,n.Prev=i,i.Next=n,e.Pts=r;var a=this.CreateOutRec();a.Pts=n,this.UpdateOutPtIdxs(a),this.Poly2ContainsPoly1(a.Pts,e.Pts)?(a.IsHole=!e.IsHole,a.FirstLeft=e):this.Poly2ContainsPoly1(e.Pts,a.Pts)?(a.IsHole=e.IsHole,e.IsHole=!a.IsHole,a.FirstLeft=e.FirstLeft,e.FirstLeft=a):(a.IsHole=e.IsHole,a.FirstLeft=e.FirstLeft),n=r}n=n.Next}r=r.Next}while(r!=e.Pts)}};y.Clipper.Area=function(t){var e=t.length;if(e<3)return 0;for(var r=0,n=0,i=e-1;n<e;++n)r+=(t[i].X+t[n].X)*(t[i].Y-t[n].Y),i=n;return-r*.5};y.Clipper.prototype.Area=function(t){var e=t.Pts;if(e==null)return 0;var r=0;do r=r+(e.Prev.Pt.X+e.Pt.X)*(e.Prev.Pt.Y-e.Pt.Y),e=e.Next;while(e!=t.Pts);return r*.5};dM&&(y.Clipper.OffsetPaths=function(t,e,r,n,i){var o=new y.Paths,a=new y.ClipperOffset(i,i);return a.AddPaths(t,r,n),a.Execute(o,e),o});y.Clipper.SimplifyPolygon=function(t,e){var r=new Array,n=new y.Clipper(0);return n.StrictlySimple=!0,n.AddPath(t,y.PolyType.ptSubject,!0),n.Execute(y.ClipType.ctUnion,r,e,e),r};y.Clipper.SimplifyPolygons=function(t,e){typeof e>"u"&&(e=y.PolyFillType.pftEvenOdd);var r=new Array,n=new y.Clipper(0);return n.StrictlySimple=!0,n.AddPaths(t,y.PolyType.ptSubject,!0),n.Execute(y.ClipType.ctUnion,r,e,e),r};y.Clipper.DistanceSqrd=function(t,e){var r=t.X-e.X,n=t.Y-e.Y;return r*r+n*n};y.Clipper.DistanceFromLineSqrd=function(t,e,r){var n=e.Y-r.Y,i=r.X-e.X,o=n*e.X+i*e.Y;return o=n*t.X+i*t.Y-o,o*o/(n*n+i*i)};y.Clipper.SlopesNearCollinear=function(t,e,r,n){return y.Clipper.DistanceFromLineSqrd(e,t,r)<n};y.Clipper.PointsAreClose=function(t,e,r){var n=t.X-e.X,i=t.Y-e.Y;return n*n+i*i<=r};y.Clipper.ExcludeOp=function(t){var e=t.Prev;return e.Next=t.Next,t.Next.Prev=e,e.Idx=0,e};y.Clipper.CleanPolygon=function(t,e){typeof e>"u"&&(e=1.415);var r=t.length;if(r==0)return new Array;for(var n=new Array(r),i=0;i<r;++i)n[i]=new y.OutPt;for(var i=0;i<r;++i)n[i].Pt=t[i],n[i].Next=n[(i+1)%r],n[i].Next.Prev=n[i],n[i].Idx=0;for(var o=e*e,a=n[0];a.Idx==0&&a.Next!=a.Prev;)y.Clipper.PointsAreClose(a.Pt,a.Prev.Pt,o)?(a=y.Clipper.ExcludeOp(a),r--):y.Clipper.PointsAreClose(a.Prev.Pt,a.Next.Pt,o)?(y.Clipper.ExcludeOp(a.Next),a=y.Clipper.ExcludeOp(a),r-=2):y.Clipper.SlopesNearCollinear(a.Prev.Pt,a.Pt,a.Next.Pt,o)?(a=y.Clipper.ExcludeOp(a),r--):(a.Idx=1,a=a.Next);r<3&&(r=0);for(var s=new Array(r),i=0;i<r;++i)s[i]=new y.IntPoint(a.Pt),a=a.Next;return n=null,s};y.Clipper.CleanPolygons=function(t,e){for(var r=new Array(t.length),n=0,i=t.length;n<i;n++)r[n]=y.Clipper.CleanPolygon(t[n],e);return r};y.Clipper.Minkowski=function(t,e,r,n){var i=n?1:0,o=t.length,a=e.length,s=new Array;if(r)for(var l=0;l<a;l++){for(var u=new Array(o),c=0,p=t.length,h=t[c];c<p;c++,h=t[c])u[c]=new y.IntPoint(e[l].X+h.X,e[l].Y+h.Y);s.push(u)}else for(var l=0;l<a;l++){for(var u=new Array(o),c=0,p=t.length,h=t[c];c<p;c++,h=t[c])u[c]=new y.IntPoint(e[l].X-h.X,e[l].Y-h.Y);s.push(u)}for(var f=new Array,l=0;l<a-1+i;l++)for(var c=0;c<o;c++){var d=new Array;d.push(s[l%a][c%o]),d.push(s[(l+1)%a][c%o]),d.push(s[(l+1)%a][(c+1)%o]),d.push(s[l%a][(c+1)%o]),y.Clipper.Orientation(d)||d.reverse(),f.push(d)}var g=new y.Clipper(0);return g.AddPaths(f,y.PolyType.ptSubject,!0),g.Execute(y.ClipType.ctUnion,s,y.PolyFillType.pftNonZero,y.PolyFillType.pftNonZero),s};y.Clipper.MinkowskiSum=function(){var t=arguments,e=t.length;if(e==3){var r=t[0],n=t[1],i=t[2];return y.Clipper.Minkowski(r,n,!0,i)}else if(e==4){for(var r=t[0],o=t[1],a=t[2],i=t[3],s=new y.Clipper,l,u=0,c=o.length;u<c;++u){var l=y.Clipper.Minkowski(r,o[u],!0,i);s.AddPaths(l,y.PolyType.ptSubject,!0)}i&&s.AddPaths(o,y.PolyType.ptClip,!0);var p=new y.Paths;return s.Execute(y.ClipType.ctUnion,p,a,a),p}};y.Clipper.MinkowskiDiff=function(t,e,r){return y.Clipper.Minkowski(t,e,!1,r)};y.Clipper.PolyTreeToPaths=function(t){var e=new Array;return y.Clipper.AddPolyNodeToPaths(t,y.Clipper.NodeType.ntAny,e),e};y.Clipper.AddPolyNodeToPaths=function(t,e,r){var n=!0;switch(e){case y.Clipper.NodeType.ntOpen:return;case y.Clipper.NodeType.ntClosed:n=!t.IsOpen;break;default:break}t.m_polygon.length>0&&n&&r.push(t.m_polygon);for(var i=0,o=t.Childs(),a=o.length,s=o[i];i<a;i++,s=o[i])y.Clipper.AddPolyNodeToPaths(s,e,r)};y.Clipper.OpenPathsFromPolyTree=function(t){for(var e=new y.Paths,r=0,n=t.ChildCount();r<n;r++)t.Childs()[r].IsOpen&&e.push(t.Childs()[r].m_polygon);return e};y.Clipper.ClosedPathsFromPolyTree=function(t){var e=new y.Paths;return y.Clipper.AddPolyNodeToPaths(t,y.Clipper.NodeType.ntClosed,e),e};vm(y.Clipper,y.ClipperBase);y.Clipper.NodeType={ntAny:0,ntOpen:1,ntClosed:2};y.ClipperOffset=function(t,e){typeof t>"u"&&(t=2),typeof e>"u"&&(e=y.ClipperOffset.def_arc_tolerance),this.m_destPolys=new y.Paths,this.m_srcPoly=new y.Path,this.m_destPoly=new y.Path,this.m_normals=new Array,this.m_delta=0,this.m_sinA=0,this.m_sin=0,this.m_cos=0,this.m_miterLim=0,this.m_StepsPerRad=0,this.m_lowest=new y.IntPoint,this.m_polyNodes=new y.PolyNode,this.MiterLimit=t,this.ArcTolerance=e,this.m_lowest.X=-1};y.ClipperOffset.two_pi=6.28318530717959;y.ClipperOffset.def_arc_tolerance=.25;y.ClipperOffset.prototype.Clear=function(){y.Clear(this.m_polyNodes.Childs()),this.m_lowest.X=-1};y.ClipperOffset.Round=y.Clipper.Round;y.ClipperOffset.prototype.AddPath=function(t,e,r){var n=t.length-1;if(!(n<0)){var i=new y.PolyNode;if(i.m_jointype=e,i.m_endtype=r,r==y.EndType.etClosedLine||r==y.EndType.etClosedPolygon)for(;n>0&&y.IntPoint.op_Equality(t[0],t[n]);)n--;i.m_polygon.push(t[0]);for(var o=0,a=0,s=1;s<=n;s++)y.IntPoint.op_Inequality(i.m_polygon[o],t[s])&&(o++,i.m_polygon.push(t[s]),(t[s].Y>i.m_polygon[a].Y||t[s].Y==i.m_polygon[a].Y&&t[s].X<i.m_polygon[a].X)&&(a=o));if(!(r==y.EndType.etClosedPolygon&&o<2||r!=y.EndType.etClosedPolygon&&o<0)&&(this.m_polyNodes.AddChild(i),r==y.EndType.etClosedPolygon))if(this.m_lowest.X<0)this.m_lowest=new y.IntPoint(0,a);else{var l=this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon[this.m_lowest.Y];(i.m_polygon[a].Y>l.Y||i.m_polygon[a].Y==l.Y&&i.m_polygon[a].X<l.X)&&(this.m_lowest=new y.IntPoint(this.m_polyNodes.ChildCount()-1,a))}}};y.ClipperOffset.prototype.AddPaths=function(t,e,r){for(var n=0,i=t.length;n<i;n++)this.AddPath(t[n],e,r)};y.ClipperOffset.prototype.FixOrientations=function(){if(this.m_lowest.X>=0&&!y.Clipper.Orientation(this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon))for(var t=0;t<this.m_polyNodes.ChildCount();t++){var e=this.m_polyNodes.Childs()[t];(e.m_endtype==y.EndType.etClosedPolygon||e.m_endtype==y.EndType.etClosedLine&&y.Clipper.Orientation(e.m_polygon))&&e.m_polygon.reverse()}else for(var t=0;t<this.m_polyNodes.ChildCount();t++){var e=this.m_polyNodes.Childs()[t];e.m_endtype==y.EndType.etClosedLine&&!y.Clipper.Orientation(e.m_polygon)&&e.m_polygon.reverse()}};y.ClipperOffset.GetUnitNormal=function(t,e){var r=e.X-t.X,n=e.Y-t.Y;if(r==0&&n==0)return new y.DoublePoint(0,0);var i=1/Math.sqrt(r*r+n*n);return r*=i,n*=i,new y.DoublePoint(n,-r)};y.ClipperOffset.prototype.DoOffset=function(t){if(this.m_destPolys=new Array,this.m_delta=t,y.ClipperBase.near_zero(t)){for(var e=0;e<this.m_polyNodes.ChildCount();e++){var r=this.m_polyNodes.Childs()[e];r.m_endtype==y.EndType.etClosedPolygon&&this.m_destPolys.push(r.m_polygon)}return}this.MiterLimit>2?this.m_miterLim=2/(this.MiterLimit*this.MiterLimit):this.m_miterLim=.5;var n;this.ArcTolerance<=0?n=y.ClipperOffset.def_arc_tolerance:this.ArcTolerance>Math.abs(t)*y.ClipperOffset.def_arc_tolerance?n=Math.abs(t)*y.ClipperOffset.def_arc_tolerance:n=this.ArcTolerance;var i=3.14159265358979/Math.acos(1-n/Math.abs(t));this.m_sin=Math.sin(y.ClipperOffset.two_pi/i),this.m_cos=Math.cos(y.ClipperOffset.two_pi/i),this.m_StepsPerRad=i/y.ClipperOffset.two_pi,t<0&&(this.m_sin=-this.m_sin);for(var e=0;e<this.m_polyNodes.ChildCount();e++){var r=this.m_polyNodes.Childs()[e];this.m_srcPoly=r.m_polygon;var o=this.m_srcPoly.length;if(!(o==0||t<=0&&(o<3||r.m_endtype!=y.EndType.etClosedPolygon))){if(this.m_destPoly=new Array,o==1){if(r.m_jointype==y.JoinType.jtRound)for(var a=1,s=0,l=1;l<=i;l++){this.m_destPoly.push(new y.IntPoint(y.ClipperOffset.Round(this.m_srcPoly[0].X+a*t),y.ClipperOffset.Round(this.m_srcPoly[0].Y+s*t)));var u=a;a=a*this.m_cos-this.m_sin*s,s=u*this.m_sin+s*this.m_cos}else for(var a=-1,s=-1,l=0;l<4;++l)this.m_destPoly.push(new y.IntPoint(y.ClipperOffset.Round(this.m_srcPoly[0].X+a*t),y.ClipperOffset.Round(this.m_srcPoly[0].Y+s*t))),a<0?a=1:s<0?s=1:a=-1;this.m_destPolys.push(this.m_destPoly);continue}this.m_normals.length=0;for(var l=0;l<o-1;l++)this.m_normals.push(y.ClipperOffset.GetUnitNormal(this.m_srcPoly[l],this.m_srcPoly[l+1]));if(r.m_endtype==y.EndType.etClosedLine||r.m_endtype==y.EndType.etClosedPolygon?this.m_normals.push(y.ClipperOffset.GetUnitNormal(this.m_srcPoly[o-1],this.m_srcPoly[0])):this.m_normals.push(new y.DoublePoint(this.m_normals[o-2])),r.m_endtype==y.EndType.etClosedPolygon){for(var c=o-1,l=0;l<o;l++)c=this.OffsetPoint(l,c,r.m_jointype);this.m_destPolys.push(this.m_destPoly)}else if(r.m_endtype==y.EndType.etClosedLine){for(var c=o-1,l=0;l<o;l++)c=this.OffsetPoint(l,c,r.m_jointype);this.m_destPolys.push(this.m_destPoly),this.m_destPoly=new Array;for(var p=this.m_normals[o-1],l=o-1;l>0;l--)this.m_normals[l]=new y.DoublePoint(-this.m_normals[l-1].X,-this.m_normals[l-1].Y);this.m_normals[0]=new y.DoublePoint(-p.X,-p.Y),c=0;for(var l=o-1;l>=0;l--)c=this.OffsetPoint(l,c,r.m_jointype);this.m_destPolys.push(this.m_destPoly)}else{for(var c=0,l=1;l<o-1;++l)c=this.OffsetPoint(l,c,r.m_jointype);var h;if(r.m_endtype==y.EndType.etOpenButt){var l=o-1;h=new y.IntPoint(y.ClipperOffset.Round(this.m_srcPoly[l].X+this.m_normals[l].X*t),y.ClipperOffset.Round(this.m_srcPoly[l].Y+this.m_normals[l].Y*t)),this.m_destPoly.push(h),h=new y.IntPoint(y.ClipperOffset.Round(this.m_srcPoly[l].X-this.m_normals[l].X*t),y.ClipperOffset.Round(this.m_srcPoly[l].Y-this.m_normals[l].Y*t)),this.m_destPoly.push(h)}else{var l=o-1;c=o-2,this.m_sinA=0,this.m_normals[l]=new y.DoublePoint(-this.m_normals[l].X,-this.m_normals[l].Y),r.m_endtype==y.EndType.etOpenSquare?this.DoSquare(l,c):this.DoRound(l,c)}for(var l=o-1;l>0;l--)this.m_normals[l]=new y.DoublePoint(-this.m_normals[l-1].X,-this.m_normals[l-1].Y);this.m_normals[0]=new y.DoublePoint(-this.m_normals[1].X,-this.m_normals[1].Y),c=o-1;for(var l=c-1;l>0;--l)c=this.OffsetPoint(l,c,r.m_jointype);r.m_endtype==y.EndType.etOpenButt?(h=new y.IntPoint(y.ClipperOffset.Round(this.m_srcPoly[0].X-this.m_normals[0].X*t),y.ClipperOffset.Round(this.m_srcPoly[0].Y-this.m_normals[0].Y*t)),this.m_destPoly.push(h),h=new y.IntPoint(y.ClipperOffset.Round(this.m_srcPoly[0].X+this.m_normals[0].X*t),y.ClipperOffset.Round(this.m_srcPoly[0].Y+this.m_normals[0].Y*t)),this.m_destPoly.push(h)):(c=1,this.m_sinA=0,r.m_endtype==y.EndType.etOpenSquare?this.DoSquare(0,1):this.DoRound(0,1)),this.m_destPolys.push(this.m_destPoly)}}}};y.ClipperOffset.prototype.Execute=function(){var t=arguments,e=t[0]instanceof y.PolyTree;if(e){var r=t[0],n=t[1];r.Clear(),this.FixOrientations(),this.DoOffset(n);var i=new y.Clipper(0);if(i.AddPaths(this.m_destPolys,y.PolyType.ptSubject,!0),n>0)i.Execute(y.ClipType.ctUnion,r,y.PolyFillType.pftPositive,y.PolyFillType.pftPositive);else{var o=y.Clipper.GetBounds(this.m_destPolys),a=new y.Path;if(a.push(new y.IntPoint(o.left-10,o.bottom+10)),a.push(new y.IntPoint(o.right+10,o.bottom+10)),a.push(new y.IntPoint(o.right+10,o.top-10)),a.push(new y.IntPoint(o.left-10,o.top-10)),i.AddPath(a,y.PolyType.ptSubject,!0),i.ReverseSolution=!0,i.Execute(y.ClipType.ctUnion,r,y.PolyFillType.pftNegative,y.PolyFillType.pftNegative),r.ChildCount()==1&&r.Childs()[0].ChildCount()>0){var s=r.Childs()[0];r.Childs()[0]=s.Childs()[0];for(var l=1;l<s.ChildCount();l++)r.AddChild(s.Childs()[l])}else r.Clear()}}else{var r=t[0],n=t[1];y.Clear(r),this.FixOrientations(),this.DoOffset(n);var i=new y.Clipper(0);if(i.AddPaths(this.m_destPolys,y.PolyType.ptSubject,!0),n>0)i.Execute(y.ClipType.ctUnion,r,y.PolyFillType.pftPositive,y.PolyFillType.pftPositive);else{var o=y.Clipper.GetBounds(this.m_destPolys),a=new y.Path;a.push(new y.IntPoint(o.left-10,o.bottom+10)),a.push(new y.IntPoint(o.right+10,o.bottom+10)),a.push(new y.IntPoint(o.right+10,o.top-10)),a.push(new y.IntPoint(o.left-10,o.top-10)),i.AddPath(a,y.PolyType.ptSubject,!0),i.ReverseSolution=!0,i.Execute(y.ClipType.ctUnion,r,y.PolyFillType.pftNegative,y.PolyFillType.pftNegative),r.length>0&&r.splice(0,1)}}};y.ClipperOffset.prototype.OffsetPoint=function(t,e,r){if(this.m_sinA=this.m_normals[e].X*this.m_normals[t].Y-this.m_normals[t].X*this.m_normals[e].Y,this.m_sinA<5e-5&&this.m_sinA>-5e-5)return e;if(this.m_sinA>1?this.m_sinA=1:this.m_sinA<-1&&(this.m_sinA=-1),this.m_sinA*this.m_delta<0)this.m_destPoly.push(new y.IntPoint(y.ClipperOffset.Round(this.m_srcPoly[t].X+this.m_normals[e].X*this.m_delta),y.ClipperOffset.Round(this.m_srcPoly[t].Y+this.m_normals[e].Y*this.m_delta))),this.m_destPoly.push(new y.IntPoint(this.m_srcPoly[t])),this.m_destPoly.push(new y.IntPoint(y.ClipperOffset.Round(this.m_srcPoly[t].X+this.m_normals[t].X*this.m_delta),y.ClipperOffset.Round(this.m_srcPoly[t].Y+this.m_normals[t].Y*this.m_delta)));else switch(r){case y.JoinType.jtMiter:{var n=1+(this.m_normals[t].X*this.m_normals[e].X+this.m_normals[t].Y*this.m_normals[e].Y);n>=this.m_miterLim?this.DoMiter(t,e,n):this.DoSquare(t,e);break}case y.JoinType.jtSquare:this.DoSquare(t,e);break;case y.JoinType.jtRound:this.DoRound(t,e);break}return e=t,e};y.ClipperOffset.prototype.DoSquare=function(t,e){var r=Math.tan(Math.atan2(this.m_sinA,this.m_normals[e].X*this.m_normals[t].X+this.m_normals[e].Y*this.m_normals[t].Y)/4);this.m_destPoly.push(new y.IntPoint(y.ClipperOffset.Round(this.m_srcPoly[t].X+this.m_delta*(this.m_normals[e].X-this.m_normals[e].Y*r)),y.ClipperOffset.Round(this.m_srcPoly[t].Y+this.m_delta*(this.m_normals[e].Y+this.m_normals[e].X*r)))),this.m_destPoly.push(new y.IntPoint(y.ClipperOffset.Round(this.m_srcPoly[t].X+this.m_delta*(this.m_normals[t].X+this.m_normals[t].Y*r)),y.ClipperOffset.Round(this.m_srcPoly[t].Y+this.m_delta*(this.m_normals[t].Y-this.m_normals[t].X*r))))};y.ClipperOffset.prototype.DoMiter=function(t,e,r){var n=this.m_delta/r;this.m_destPoly.push(new y.IntPoint(y.ClipperOffset.Round(this.m_srcPoly[t].X+(this.m_normals[e].X+this.m_normals[t].X)*n),y.ClipperOffset.Round(this.m_srcPoly[t].Y+(this.m_normals[e].Y+this.m_normals[t].Y)*n)))};y.ClipperOffset.prototype.DoRound=function(t,e){for(var r=Math.atan2(this.m_sinA,this.m_normals[e].X*this.m_normals[t].X+this.m_normals[e].Y*this.m_normals[t].Y),n=y.Cast_Int32(y.ClipperOffset.Round(this.m_StepsPerRad*Math.abs(r))),i=this.m_normals[e].X,o=this.m_normals[e].Y,a,s=0;s<n;++s)this.m_destPoly.push(new y.IntPoint(y.ClipperOffset.Round(this.m_srcPoly[t].X+i*this.m_delta),y.ClipperOffset.Round(this.m_srcPoly[t].Y+o*this.m_delta))),a=i,i=i*this.m_cos-this.m_sin*o,o=a*this.m_sin+o*this.m_cos;this.m_destPoly.push(new y.IntPoint(y.ClipperOffset.Round(this.m_srcPoly[t].X+this.m_normals[t].X*this.m_delta),y.ClipperOffset.Round(this.m_srcPoly[t].Y+this.m_normals[t].Y*this.m_delta)))};y.Error=function(t){try{throw new Error(t)}catch(e){alert(e.message)}};y.JS={};y.JS.AreaOfPolygon=function(t,e){return e||(e=1),y.Clipper.Area(t)/(e*e)};y.JS.AreaOfPolygons=function(t,e){e||(e=1);for(var r=0,n=0;n<t.length;n++)r+=y.Clipper.Area(t[n]);return r/(e*e)};y.JS.BoundsOfPath=function(t,e){return y.JS.BoundsOfPaths([t],e)};y.JS.BoundsOfPaths=function(t,e){e||(e=1);var r=y.Clipper.GetBounds(t);return r.left/=e,r.bottom/=e,r.right/=e,r.top/=e,r};y.JS.Clean=function(n,e){if(!(n instanceof Array))return[];var r=n[0]instanceof Array,n=y.JS.Clone(n);if(typeof e!="number"||e===null)return y.Error("Delta is not a number in Clean()."),n;if(n.length===0||n.length==1&&n[0].length===0||e<0)return n;r||(n=[n]);for(var i=n.length,o,a,s,l,u,c,p,h=[],f=0;f<i;f++)if(a=n[f],o=a.length,o!==0){if(o<3){s=a,h.push(s);continue}for(s=a,l=e*e,u=a[0],c=1,p=1;p<o;p++)(a[p].X-u.X)*(a[p].X-u.X)+(a[p].Y-u.Y)*(a[p].Y-u.Y)<=l||(s[c]=a[p],u=a[p],c++);u=a[c-1],(a[0].X-u.X)*(a[0].X-u.X)+(a[0].Y-u.Y)*(a[0].Y-u.Y)<=l&&c--,c<o&&s.splice(c,o-c),s.length&&h.push(s)}return!r&&h.length?h=h[0]:!r&&h.length===0?h=[]:r&&h.length===0&&(h=[[]]),h};y.JS.Clone=function(t){if(!(t instanceof Array))return[];if(t.length===0)return[];if(t.length==1&&t[0].length===0)return[[]];var e=t[0]instanceof Array;e||(t=[t]);var r=t.length,n,i,o,a,s=new Array(r);for(i=0;i<r;i++){for(n=t[i].length,a=new Array(n),o=0;o<n;o++)a[o]={X:t[i][o].X,Y:t[i][o].Y};s[i]=a}return e||(s=s[0]),s};y.JS.Lighten=function(t,e){if(!(t instanceof Array))return[];if(typeof e!="number"||e===null)return y.Error("Tolerance is not a number in Lighten()."),y.JS.Clone(t);if(t.length===0||t.length==1&&t[0].length===0||e<0)return y.JS.Clone(t);t[0]instanceof Array||(t=[t]);var r,n,i,o,a,s,l,u,c,p,h,f,d,g,x,b,v,P=t.length,w=e*e,T=[];for(r=0;r<P;r++)if(i=t[r],s=i.length,s!=0){for(o=0;o<1e6;o++){for(a=[],s=i.length,i[s-1].X!=i[0].X||i[s-1].Y!=i[0].Y?(f=1,i.push({X:i[0].X,Y:i[0].Y}),s=i.length):f=0,h=[],n=0;n<s-2;n++)l=i[n],c=i[n+1],u=i[n+2],b=l.X,v=l.Y,d=u.X-b,g=u.Y-v,(d!==0||g!==0)&&(x=((c.X-b)*d+(c.Y-v)*g)/(d*d+g*g),x>1?(b=u.X,v=u.Y):x>0&&(b+=d*x,v+=g*x)),d=c.X-b,g=c.Y-v,p=d*d+g*g,p<=w&&(h[n+1]=1,n++);for(a.push({X:i[0].X,Y:i[0].Y}),n=1;n<s-1;n++)h[n]||a.push({X:i[n].X,Y:i[n].Y});if(a.push({X:i[s-1].X,Y:i[s-1].Y}),f&&i.pop(),h.length)i=a;else break}s=a.length,a[s-1].X==a[0].X&&a[s-1].Y==a[0].Y&&a.pop(),a.length>2&&T.push(a)}return!t[0]instanceof Array&&(T=T[0]),typeof T>"u"&&(T=[[]]),T};y.JS.PerimeterOfPath=function(t,e,r){if(typeof t>"u")return 0;var n=Math.sqrt,i=0,o,a,s=0,l=0,u=0,c=0,p=t.length;if(p<2)return 0;for(e&&(t[p]=t[0],p++);--p;)o=t[p],s=o.X,l=o.Y,a=t[p-1],u=a.X,c=a.Y,i+=n((s-u)*(s-u)+(l-c)*(l-c));return e&&t.pop(),i/r};y.JS.PerimeterOfPaths=function(t,e,r){r||(r=1);for(var n=0,i=0;i<t.length;i++)n+=y.JS.PerimeterOfPath(t[i],e,r);return n};y.JS.ScaleDownPath=function(t,e){var r,n;for(e||(e=1),r=t.length;r--;)n=t[r],n.X=n.X/e,n.Y=n.Y/e};y.JS.ScaleDownPaths=function(t,e){var r,n,i,o=Math.round;for(e||(e=1),r=t.length;r--;)for(n=t[r].length;n--;)i=t[r][n],i.X=i.X/e,i.Y=i.Y/e};y.JS.ScaleUpPath=function(t,e){var r,n,i=Math.round;for(e||(e=1),r=t.length;r--;)n=t[r],n.X=i(n.X*e),n.Y=i(n.Y*e)};y.JS.ScaleUpPaths=function(t,e){var r,n,i,o=Math.round;for(e||(e=1),r=t.length;r--;)for(n=t[r].length;n--;)i=t[r][n],i.X=o(i.X*e),i.Y=o(i.Y*e)};y.ExPolygons=function(){return[]};y.ExPolygon=function(){this.outer=null,this.holes=null};y.JS.AddOuterPolyNodeToExPolygons=function(t,e){var r=new y.ExPolygon;r.outer=t.Contour();var n=t.Childs(),i=n.length;r.holes=new Array(i);var o,a,s,l,u,c;for(s=0;s<i;s++)for(o=n[s],r.holes[s]=o.Contour(),l=0,u=o.Childs(),c=u.length;l<c;l++)a=u[l],y.JS.AddOuterPolyNodeToExPolygons(a,e);e.push(r)};y.JS.ExPolygonsToPaths=function(t){var e,r,n,i,o=new y.Paths;for(e=0,n=t.length;e<n;e++)for(o.push(t[e].outer),r=0,i=t[e].holes.length;r<i;r++)o.push(t[e].holes[r]);return o};y.JS.PolyTreeToExPolygons=function(t){var e=new y.ExPolygons,r,n,i,o;for(n=0,i=t.Childs(),o=i.length;n<o;n++)r=i[n],y.JS.AddOuterPolyNodeToExPolygons(r,e);return e};zu.exports=y});m();var qu="[MappedinJS]",XM=(i=>(i[i.LOG=0]="LOG",i[i.WARN=1]="WARN",i[i.ERROR=2]="ERROR",i[i.SILENT=3]="SILENT",i))(XM||{});function ZM(t="",{prefix:e=qu}={}){let r="".concat(e).concat(t?"-".concat(t):""),n=(i,o)=>{if(typeof window<"u"&&window.rnDebug){let a=o.map(s=>s instanceof Error&&s.stack?"".concat(s.message,"\n").concat(s.stack):s);window.rnDebug("".concat(t," ").concat(i,": ").concat(a.join(" ")))}};return{logState:_.env.NODE_ENV==="test"?3:0,log(...i){this.logState<=0&&(console.log(r,...i),n("log",i))},warn(...i){this.logState<=1&&(console.warn(r,...i),n("warn",i))},error(...i){this.logState<=2&&(console.error(r,...i),n("error",i))},assert(...i){console.assert(...i)},time(i){console.time(i)},timeEnd(i){console.timeEnd(i)},setLevel(i){0<=i&&i<=3&&(this.logState=i)}}}var Lx=ZM();function y5(t){0<=t&&t<=3&&(Lx.logState=t)}var Et=Lx;m();m();var Vi=class extends Error{};Vi.prototype.name="InvalidTokenError";function qM(t){return decodeURIComponent(atob(t).replace(/(.)/g,(e,r)=>{let n=r.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n}))}function YM(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return qM(e)}catch(r){return atob(e)}}function Dx(t,e){if(typeof t!="string")throw new Vi("Invalid token specified: must be a string");e||(e={});let r=e.header===!0?0:1,n=t.split(".")[r];if(typeof n!="string")throw new Vi("Invalid token specified: missing part #".concat(r+1));let i;try{i=YM(n)}catch(o){throw new Vi("Invalid token specified: invalid base64 for part #".concat(r+1," (").concat(o.message,")"))}try{return JSON.parse(i)}catch(o){throw new Vi("Invalid token specified: invalid json for part #".concat(r+1," (").concat(o.message,")"))}}m();var Yn=63710088e-1;m();function WM(t,e,r,n){return(t<e||t>r)&&Et.warn(n),Math.min(r,Math.max(e,t))}m();function $M(t,e){if(t==null||e==null)return t===e;if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}function L5(t){var r,n;let e=Dx(t);if(e.sub==null)throw new Error("Access token is missing sub claim.");return{sub:e.sub,aud:typeof e.aud=="string"?[e.aud]:(r=e.aud)!=null?r:[],capabilities:(n=e.capabilities)!=null?n:{}}}function Yu(t){return t*(Math.PI/180)}function D5(t,e){let r=Math.pow(10,e);return Math.sign(t)*Math.round(Math.abs(t)*r)/r}function Rx(t,e){return(t%e+e)%e}function R5(t,e){let r=Rx(t,Math.PI*2),n=Rx(e,Math.PI*2),i=n-r,o=n+(i>Math.PI?-Math.PI*2:i<-Math.PI?Math.PI*2:0);return{start:r,end:o}}function KM(t){return t instanceof Xu?Number.isFinite(t.min.x)&&Number.isFinite(t.min.y)&&Number.isFinite(t.max.x)&&Number.isFinite(t.max.y):Number.isFinite(t.min.x)&&Number.isFinite(t.min.y)&&Number.isFinite(t.max.x)&&Number.isFinite(t.max.y)&&Number.isFinite(t.min.z)&&Number.isFinite(t.max.z)}function k5(){return typeof window<"u"&&window!==null}function F5(t,e){let[r,n]=t,[i,o]=e,a=Yu(i-r),s=Yu(o-n);return Math.sqrt(a*a+s*s)*Yn}function O5(t,e){let[r,n]=t.map(c=>Yu(c)),[i,o]=e.map(c=>Yu(c)),a=o-n,l=(i-r)*Math.cos((n+o)/2),u=a;return Math.sqrt(l*l+u*u)*Yn}m();function N5(t,e,r=!1){let n=null,i=0;return function(...o){i++,i===1&&r===!0&&t(...o);let a=()=>{(!r||i>1)&&t(...o),n=null,i=0};clearTimeout(n),n=setTimeout(a,e)}}m();m();function JM(t,e){return"".concat(e," ").concat(t)}var Qa=class extends Error{constructor(e,r=qu){super(JM(e,r)),this.name="MappedinError"}},kx=class extends Qa{constructor(e,r=qu){super(e,r),this.name="MappedinRenderError"}};m();var Fm=class t extends Error{constructor(r){super(r);C(this,"name","AssertionError");Error.captureStackTrace&&Error.captureStackTrace(this,t)}};function Fx(t,e){if(t==null){let r;if(e!=null&&e.customMessage)r=e.customMessage;else{let o=e!=null&&e.valueName?"'".concat(e.valueName,"'"):"value";r="Expected ".concat(o," to be defined, but received ").concat(t)}let n=(e==null?void 0:e.errorClass)||Fm,i=new n(r);throw(e==null?void 0:e.captureStackTrace)!==!1&&Error.captureStackTrace&&Error.captureStackTrace(i,Fx),i}}function q5(t,e,r){if(Fx(t),(t==null?void 0:t.type)!==e){let n="Expected type ".concat(e," but got ").concat(t==null?void 0:t.type);throw new Error(r!=null?r:n)}}m();var Om=[0,4,6,8,10],Ut=()=>{let t=new Array(16).fill(0),e=Math.random()*4294967296;for(let n=0;n<t.length;n++)n>0&&(n&3)===0&&(e=Math.random()*4294967296),t[n]=e>>>((n&3)<<3)&255;let r=t.map(n=>n.toString(16).padStart(2,"0"));return r[6]="4"+r[6][1],r[8]=["8","9","a","b"].includes(r[7][0])?r[7]:"a"+r[7][1],Om.map((n,i)=>r.slice(n,i===Om.length-1?void 0:Om[i+1]).join("")).join("-")};function K5(t,e=0){let r=3735928559^e,n=1103547991^e;for(let i=0,o;i<t.length;i++)o=t.charCodeAt(i),r=Math.imul(r^o,2654435761),n=Math.imul(n^o,1597334677);return r=Math.imul(r^r>>>16,2246822507)^Math.imul(n^n>>>13,3266489909),n=Math.imul(n^n>>>16,2246822507)^Math.imul(r^r>>>13,3266489909),4294967296*(2097151&n)+(r>>>0)}m();var es=class{constructor(){C(this,"_subscribers",{});C(this,"_destroyed",!1)}publish(e,r){!this._subscribers||!this._subscribers[e]||this._destroyed||this._subscribers[e].forEach(function(n){typeof n=="function"&&n(r)})}on(e,r){(!this._subscribers||this._destroyed)&&(this._subscribers={}),this._subscribers[e]=this._subscribers[e]||[],this._subscribers[e].push(r)}off(e,r){if(!this._subscribers||this._subscribers[e]==null||this._destroyed)return;let n=this._subscribers[e].indexOf(r);n!==-1&&this._subscribers[e].splice(n,1)}destroy(){this._destroyed=!0,this._subscribers={}}};m();var Ox="mi-session-data",Bx="mi-local-data",ts="id",rs="deviceId",Ui,Hr,Xr,Wu=class Wu{constructor(){mr(this,Hr);mr(this,Xr);try{let e=sessionStorage.getItem(Ox);e?At(this,Hr,JSON.parse(e)):At(this,Hr,{[ts]:Ut()})}catch(e){At(this,Hr,{[ts]:Ut()})}try{let e=localStorage.getItem(Bx);e?At(this,Xr,JSON.parse(e)):At(this,Xr,{[rs]:Ut()})}catch(e){At(this,Xr,{[rs]:Ut()})}Ke(this,Hr)[ts]||(Ke(this,Hr)[ts]=Ut()),Ke(this,Xr)[rs]||(Ke(this,Xr)[rs]=Ut())}static getInstance(){return Ke(this,Ui)||At(this,Ui,new Wu),Ke(this,Ui)}static ___clearInstance(){At(this,Ui,void 0)}saveSessionData(e,r){Ke(this,Hr)[e]=r;try{return sessionStorage.setItem(Ox,JSON.stringify(Ke(this,Hr))),!0}catch(n){return!1}}loadSessionData(e){let r=Ke(this,Hr)[e];if(r!=null)return r}saveLocalData(e,r){Ke(this,Xr)[e]=r;try{return localStorage.setItem(Bx,JSON.stringify(Ke(this,Xr))),!0}catch(n){return!1}}loadLocalData(e){let r=Ke(this,Xr)[e];if(r!=null)return r}};Ui=new WeakMap,Hr=new WeakMap,Xr=new WeakMap,mr(Wu,Ui);var Bm=Wu;m();var QM=new Set(Object.keys(Lr.NAMES)),zm;function zx(){return zm==null&&(zm=new Lr),zm}var eI=t=>QM.has(t.toLowerCase()),tI=t=>{if(!t.startsWith("#"))return!1;let e=t.slice(1);if(e.length!==3&&e.length!==6)return!1;for(let r=0;r<e.length;r++)if(!(e[r]>="0"&&e[r]<="9"||e[r]>="A"&&e[r]<="F"||e[r]>="a"&&e[r]<="f"))return!1;return!0},rI=t=>{if(!t.startsWith("rgb(")&&!t.startsWith("rgba("))return!1;let e=t.indexOf("("),r=t.lastIndexOf(")");if(e===-1||r===-1||r<=e||r!==t.length-1)return!1;let n=t.slice(e+1,r).split(",");if(n.length!==3&&n.length!==4)return!1;for(let i=0;i<n.length;i++){let o=n[i].trim();if(i<3)if(o.endsWith("%")){let a=parseFloat(o.slice(0,-1));if(isNaN(a)||a<0||a>100)return!1}else{let a=parseInt(o,10);if(isNaN(a)||a<0||a>255)return!1}else{let a=parseFloat(o);if(isNaN(a)||a<0||a>1)return!1}}return!0},nI=t=>{if(!t.startsWith("hsl(")&&!t.startsWith("hsla("))return!1;let e=t.indexOf("("),r=t.lastIndexOf(")");if(e===-1||r===-1||r<=e||r!==t.length-1)return!1;let n=t.slice(e+1,r).split(",");if(n.length!==3&&n.length!==4)return!1;for(let i=0;i<n.length;i++){let o=n[i].trim();if(i===0){let a=parseFloat(o);if(isNaN(a))return!1}else if(i<3){if(!o.endsWith("%"))return!1;let a=parseFloat(o.slice(0,-1));if(isNaN(a)||a<0||a>100)return!1}else{let a=parseFloat(o);if(isNaN(a)||a<0||a>1)return!1}}return!0},$u=t=>t==null||typeof t!="string"?!1:!!(tI(t)||rI(t)||nI(t)||eI(t)),lN=t=>{let e=zx();return e.set(t),[e.r,e.g,e.b]},uN=t=>{let e=zx();return e.set(t[0],t[1],t[2]),"#"+e.getHexString()};m();var Vx=["ease-in","ease-out","ease-in-out","linear"];var Ux=t=>t,iI=t=>t*t,oI=t=>1-Math.cos(t*Math.PI/2),aI=t=>1-(1-t)*(1-t),Nx={linear:Ux,"ease-in":iI,"ease-out":aI,"ease-in-out":oI};function fN(t,e,r,n,i,o=Ux){if(e===r)return i;t=Math.max(e,Math.min(t,r));let a=(t-Math.min(e,r))/Math.abs(r-e),s=typeof o=="function"?o(a):Nx[o](a);return n+s*(i-n)}function sI(t,e){let r=0;if(e.length<2)return r;let i=e[0]<e[1]?(o,a)=>o>a:(o,a)=>o<a;for(;r<e.length-1&&i(t,e[r+1]);)r++;return r>e.length-2?Math.max(0,e.length-2):r}function mN(t,e,r,n="ease-in"){if(e.length!==r.length)throw new Qa("Input and output ranges must have the same number of values.");t=Math.max(e[0],Math.min(t,e[e.length-1]));let i=sI(t,e),o=(t-e[i])/(e[i+1]-e[i]),a=typeof n=="function"?n(o):Nx[n](o);return r[i]+a*(r[i+1]-r[i])}m();function Ku(t){return(t%(2*Math.PI)+2*Math.PI)%(2*Math.PI)}m();m();var Ju={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"]};m();m();var Fb=se(fe(),1),Ob=se(Xx(),1);m();m();var Vm;function Qu(){return Vm==null&&(Vm=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Vm}var ec;function Um(){if(ec==null&&(ec=!1,Qu())){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){ec=!0;break}}}return ec||!1}m();m();var ue=1e-6,Ae=typeof Float32Array<"u"?Float32Array:Array,Yt=Math.random;var NN=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 Wn={};Oi(Wn,{LDU:()=>SI,add:()=>CI,adjoint:()=>gI,clone:()=>cI,copy:()=>pI,create:()=>uI,determinant:()=>xI,equals:()=>II,exactEquals:()=>MI,frob:()=>TI,fromRotation:()=>vI,fromScaling:()=>PI,fromValues:()=>fI,identity:()=>hI,invert:()=>yI,mul:()=>LI,multiply:()=>Zx,multiplyScalar:()=>AI,multiplyScalarAndAdd:()=>EI,rotate:()=>bI,scale:()=>_I,set:()=>mI,str:()=>wI,sub:()=>DI,subtract:()=>qx,transpose:()=>dI});m();function uI(){var t=new Ae(4);return Ae!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t}function cI(t){var e=new Ae(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function pI(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function hI(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t}function fI(t,e,r,n){var i=new Ae(4);return i[0]=t,i[1]=e,i[2]=r,i[3]=n,i}function mI(t,e,r,n,i){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t}function dI(t,e){if(t===e){var r=e[1];t[1]=e[2],t[2]=r}else t[0]=e[0],t[1]=e[2],t[2]=e[1],t[3]=e[3];return t}function yI(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=r*o-i*n;return a?(a=1/a,t[0]=o*a,t[1]=-n*a,t[2]=-i*a,t[3]=r*a,t):null}function gI(t,e){var r=e[0];return t[0]=e[3],t[1]=-e[1],t[2]=-e[2],t[3]=r,t}function xI(t){return t[0]*t[3]-t[2]*t[1]}function Zx(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=r[0],l=r[1],u=r[2],c=r[3];return t[0]=n*s+o*l,t[1]=i*s+a*l,t[2]=n*u+o*c,t[3]=i*u+a*c,t}function bI(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=Math.sin(r),l=Math.cos(r);return t[0]=n*l+o*s,t[1]=i*l+a*s,t[2]=n*-s+o*l,t[3]=i*-s+a*l,t}function _I(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=r[0],l=r[1];return t[0]=n*s,t[1]=i*s,t[2]=o*l,t[3]=a*l,t}function vI(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=r,t[2]=-r,t[3]=n,t}function PI(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t}function wI(t){return"mat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}function TI(t){return Math.hypot(t[0],t[1],t[2],t[3])}function SI(t,e,r,n){return t[2]=n[2]/n[0],r[0]=n[0],r[1]=n[1],r[3]=n[3]-t[2]*r[1],[t,e,r]}function CI(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 qx(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 MI(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]}function II(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)<=ue*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(n-s)<=ue*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-l)<=ue*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(o-u)<=ue*Math.max(1,Math.abs(o),Math.abs(u))}function AI(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 EI(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}var LI=Zx,DI=qx;var wn={};Oi(wn,{add:()=>tA,adjoint:()=>NI,clone:()=>kI,copy:()=>FI,create:()=>Nm,determinant:()=>GI,equals:()=>oA,exactEquals:()=>iA,frob:()=>eA,fromMat2d:()=>WI,fromMat4:()=>RI,fromQuat:()=>$I,fromRotation:()=>qI,fromScaling:()=>YI,fromTranslation:()=>ZI,fromValues:()=>OI,identity:()=>zI,invert:()=>UI,mul:()=>aA,multiply:()=>Yx,multiplyScalar:()=>rA,multiplyScalarAndAdd:()=>nA,normalFromMat4:()=>KI,projection:()=>JI,rotate:()=>HI,scale:()=>XI,set:()=>BI,str:()=>QI,sub:()=>sA,subtract:()=>Wx,translate:()=>jI,transpose:()=>VI});m();function Nm(){var t=new Ae(9);return Ae!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function RI(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t}function kI(t){var e=new Ae(9);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function FI(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function OI(t,e,r,n,i,o,a,s,l){var u=new Ae(9);return u[0]=t,u[1]=e,u[2]=r,u[3]=n,u[4]=i,u[5]=o,u[6]=a,u[7]=s,u[8]=l,u}function BI(t,e,r,n,i,o,a,s,l,u){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t[4]=o,t[5]=a,t[6]=s,t[7]=l,t[8]=u,t}function zI(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function VI(t,e){if(t===e){var r=e[1],n=e[2],i=e[5];t[1]=e[3],t[2]=e[6],t[3]=r,t[5]=e[7],t[6]=n,t[7]=i}else t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8];return t}function UI(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],c=e[8],p=c*a-s*u,h=-c*o+s*l,f=u*o-a*l,d=r*p+n*h+i*f;return d?(d=1/d,t[0]=p*d,t[1]=(-c*n+i*u)*d,t[2]=(s*n-i*a)*d,t[3]=h*d,t[4]=(c*r-i*l)*d,t[5]=(-s*r+i*o)*d,t[6]=f*d,t[7]=(-u*r+n*l)*d,t[8]=(a*r-n*o)*d,t):null}function NI(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],c=e[8];return t[0]=a*c-s*u,t[1]=i*u-n*c,t[2]=n*s-i*a,t[3]=s*l-o*c,t[4]=r*c-i*l,t[5]=i*o-r*s,t[6]=o*u-a*l,t[7]=n*l-r*u,t[8]=r*a-n*o,t}function GI(t){var e=t[0],r=t[1],n=t[2],i=t[3],o=t[4],a=t[5],s=t[6],l=t[7],u=t[8];return e*(u*o-a*l)+r*(-u*i+a*s)+n*(l*i-o*s)}function Yx(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],p=e[8],h=r[0],f=r[1],d=r[2],g=r[3],x=r[4],b=r[5],v=r[6],P=r[7],w=r[8];return t[0]=h*n+f*a+d*u,t[1]=h*i+f*s+d*c,t[2]=h*o+f*l+d*p,t[3]=g*n+x*a+b*u,t[4]=g*i+x*s+b*c,t[5]=g*o+x*l+b*p,t[6]=v*n+P*a+w*u,t[7]=v*i+P*s+w*c,t[8]=v*o+P*l+w*p,t}function jI(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],p=e[8],h=r[0],f=r[1];return t[0]=n,t[1]=i,t[2]=o,t[3]=a,t[4]=s,t[5]=l,t[6]=h*n+f*a+u,t[7]=h*i+f*s+c,t[8]=h*o+f*l+p,t}function HI(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],p=e[8],h=Math.sin(r),f=Math.cos(r);return t[0]=f*n+h*a,t[1]=f*i+h*s,t[2]=f*o+h*l,t[3]=f*a-h*n,t[4]=f*s-h*i,t[5]=f*l-h*o,t[6]=u,t[7]=c,t[8]=p,t}function XI(t,e,r){var n=r[0],i=r[1];return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=i*e[3],t[4]=i*e[4],t[5]=i*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t}function ZI(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=e[0],t[7]=e[1],t[8]=1,t}function qI(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=r,t[2]=0,t[3]=-r,t[4]=n,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function YI(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=e[1],t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function WI(t,e){return t[0]=e[0],t[1]=e[1],t[2]=0,t[3]=e[2],t[4]=e[3],t[5]=0,t[6]=e[4],t[7]=e[5],t[8]=1,t}function $I(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=r+r,s=n+n,l=i+i,u=r*a,c=n*a,p=n*s,h=i*a,f=i*s,d=i*l,g=o*a,x=o*s,b=o*l;return t[0]=1-p-d,t[3]=c-b,t[6]=h+x,t[1]=c+b,t[4]=1-u-d,t[7]=f-g,t[2]=h-x,t[5]=f+g,t[8]=1-u-p,t}function KI(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],c=e[8],p=e[9],h=e[10],f=e[11],d=e[12],g=e[13],x=e[14],b=e[15],v=r*s-n*a,P=r*l-i*a,w=r*u-o*a,T=n*l-i*s,S=n*u-o*s,I=i*u-o*l,M=c*g-p*d,E=c*x-h*d,L=c*b-f*d,k=p*x-h*g,F=p*b-f*g,z=h*b-f*x,A=v*z-P*F+w*k+T*L-S*E+I*M;return A?(A=1/A,t[0]=(s*z-l*F+u*k)*A,t[1]=(l*L-a*z-u*E)*A,t[2]=(a*F-s*L+u*M)*A,t[3]=(i*F-n*z-o*k)*A,t[4]=(r*z-i*L+o*E)*A,t[5]=(n*L-r*F-o*M)*A,t[6]=(g*I-x*S+b*T)*A,t[7]=(x*w-d*I-b*P)*A,t[8]=(d*S-g*w+b*v)*A,t):null}function JI(t,e,r){return t[0]=2/e,t[1]=0,t[2]=0,t[3]=0,t[4]=-2/r,t[5]=0,t[6]=-1,t[7]=1,t[8]=1,t}function QI(t){return"mat3("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+")"}function eA(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])}function tA(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[4]=e[4]+r[4],t[5]=e[5]+r[5],t[6]=e[6]+r[6],t[7]=e[7]+r[7],t[8]=e[8]+r[8],t}function Wx(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[4]=e[4]-r[4],t[5]=e[5]-r[5],t[6]=e[6]-r[6],t[7]=e[7]-r[7],t[8]=e[8]-r[8],t}function rA(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[4]=e[4]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*r,t}function nA(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[4]=e[4]+r[4]*n,t[5]=e[5]+r[5]*n,t[6]=e[6]+r[6]*n,t[7]=e[7]+r[7]*n,t[8]=e[8]+r[8]*n,t}function iA(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]}function oA(t,e){var r=t[0],n=t[1],i=t[2],o=t[3],a=t[4],s=t[5],l=t[6],u=t[7],c=t[8],p=e[0],h=e[1],f=e[2],d=e[3],g=e[4],x=e[5],b=e[6],v=e[7],P=e[8];return Math.abs(r-p)<=ue*Math.max(1,Math.abs(r),Math.abs(p))&&Math.abs(n-h)<=ue*Math.max(1,Math.abs(n),Math.abs(h))&&Math.abs(i-f)<=ue*Math.max(1,Math.abs(i),Math.abs(f))&&Math.abs(o-d)<=ue*Math.max(1,Math.abs(o),Math.abs(d))&&Math.abs(a-g)<=ue*Math.max(1,Math.abs(a),Math.abs(g))&&Math.abs(s-x)<=ue*Math.max(1,Math.abs(s),Math.abs(x))&&Math.abs(l-b)<=ue*Math.max(1,Math.abs(l),Math.abs(b))&&Math.abs(u-v)<=ue*Math.max(1,Math.abs(u),Math.abs(v))&&Math.abs(c-P)<=ue*Math.max(1,Math.abs(c),Math.abs(P))}var aA=Yx,sA=Wx;var B={};Oi(B,{add:()=>XA,adjoint:()=>dA,clone:()=>uA,copy:()=>cA,create:()=>lA,determinant:()=>yA,equals:()=>WA,exactEquals:()=>YA,frob:()=>HA,fromQuat:()=>kA,fromQuat2:()=>AA,fromRotation:()=>SA,fromRotationTranslation:()=>Jx,fromRotationTranslationScale:()=>DA,fromRotationTranslationScaleOrigin:()=>RA,fromScaling:()=>TA,fromTranslation:()=>wA,fromValues:()=>pA,fromXRotation:()=>CA,fromYRotation:()=>MA,fromZRotation:()=>IA,frustum:()=>FA,getRotation:()=>LA,getScaling:()=>Qx,getTranslation:()=>EA,identity:()=>$x,invert:()=>mA,lookAt:()=>NA,mul:()=>$A,multiply:()=>Kx,multiplyScalar:()=>ZA,multiplyScalarAndAdd:()=>qA,ortho:()=>VA,orthoNO:()=>tb,orthoZO:()=>UA,perspective:()=>OA,perspectiveFromFieldOfView:()=>zA,perspectiveNO:()=>eb,perspectiveZO:()=>BA,rotate:()=>bA,rotateX:()=>_A,rotateY:()=>vA,rotateZ:()=>PA,scale:()=>xA,set:()=>hA,str:()=>jA,sub:()=>KA,subtract:()=>rb,targetTo:()=>GA,translate:()=>gA,transpose:()=>fA});m();function lA(){var t=new Ae(16);return Ae!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t}function uA(t){var e=new Ae(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function cA(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function pA(t,e,r,n,i,o,a,s,l,u,c,p,h,f,d,g){var x=new Ae(16);return x[0]=t,x[1]=e,x[2]=r,x[3]=n,x[4]=i,x[5]=o,x[6]=a,x[7]=s,x[8]=l,x[9]=u,x[10]=c,x[11]=p,x[12]=h,x[13]=f,x[14]=d,x[15]=g,x}function hA(t,e,r,n,i,o,a,s,l,u,c,p,h,f,d,g,x){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t[4]=o,t[5]=a,t[6]=s,t[7]=l,t[8]=u,t[9]=c,t[10]=p,t[11]=h,t[12]=f,t[13]=d,t[14]=g,t[15]=x,t}function $x(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function fA(t,e){if(t===e){var r=e[1],n=e[2],i=e[3],o=e[6],a=e[7],s=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=r,t[6]=e[9],t[7]=e[13],t[8]=n,t[9]=o,t[11]=e[14],t[12]=i,t[13]=a,t[14]=s}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t}function mA(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],c=e[8],p=e[9],h=e[10],f=e[11],d=e[12],g=e[13],x=e[14],b=e[15],v=r*s-n*a,P=r*l-i*a,w=r*u-o*a,T=n*l-i*s,S=n*u-o*s,I=i*u-o*l,M=c*g-p*d,E=c*x-h*d,L=c*b-f*d,k=p*x-h*g,F=p*b-f*g,z=h*b-f*x,A=v*z-P*F+w*k+T*L-S*E+I*M;return A?(A=1/A,t[0]=(s*z-l*F+u*k)*A,t[1]=(i*F-n*z-o*k)*A,t[2]=(g*I-x*S+b*T)*A,t[3]=(h*S-p*I-f*T)*A,t[4]=(l*L-a*z-u*E)*A,t[5]=(r*z-i*L+o*E)*A,t[6]=(x*w-d*I-b*P)*A,t[7]=(c*I-h*w+f*P)*A,t[8]=(a*F-s*L+u*M)*A,t[9]=(n*L-r*F-o*M)*A,t[10]=(d*S-g*w+b*v)*A,t[11]=(p*w-c*S-f*v)*A,t[12]=(s*E-a*k-l*M)*A,t[13]=(r*k-n*E+i*M)*A,t[14]=(g*P-d*T-x*v)*A,t[15]=(c*T-p*P+h*v)*A,t):null}function dA(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],c=e[8],p=e[9],h=e[10],f=e[11],d=e[12],g=e[13],x=e[14],b=e[15];return t[0]=s*(h*b-f*x)-p*(l*b-u*x)+g*(l*f-u*h),t[1]=-(n*(h*b-f*x)-p*(i*b-o*x)+g*(i*f-o*h)),t[2]=n*(l*b-u*x)-s*(i*b-o*x)+g*(i*u-o*l),t[3]=-(n*(l*f-u*h)-s*(i*f-o*h)+p*(i*u-o*l)),t[4]=-(a*(h*b-f*x)-c*(l*b-u*x)+d*(l*f-u*h)),t[5]=r*(h*b-f*x)-c*(i*b-o*x)+d*(i*f-o*h),t[6]=-(r*(l*b-u*x)-a*(i*b-o*x)+d*(i*u-o*l)),t[7]=r*(l*f-u*h)-a*(i*f-o*h)+c*(i*u-o*l),t[8]=a*(p*b-f*g)-c*(s*b-u*g)+d*(s*f-u*p),t[9]=-(r*(p*b-f*g)-c*(n*b-o*g)+d*(n*f-o*p)),t[10]=r*(s*b-u*g)-a*(n*b-o*g)+d*(n*u-o*s),t[11]=-(r*(s*f-u*p)-a*(n*f-o*p)+c*(n*u-o*s)),t[12]=-(a*(p*x-h*g)-c*(s*x-l*g)+d*(s*h-l*p)),t[13]=r*(p*x-h*g)-c*(n*x-i*g)+d*(n*h-i*p),t[14]=-(r*(s*x-l*g)-a*(n*x-i*g)+d*(n*l-i*s)),t[15]=r*(s*h-l*p)-a*(n*h-i*p)+c*(n*l-i*s),t}function yA(t){var e=t[0],r=t[1],n=t[2],i=t[3],o=t[4],a=t[5],s=t[6],l=t[7],u=t[8],c=t[9],p=t[10],h=t[11],f=t[12],d=t[13],g=t[14],x=t[15],b=e*a-r*o,v=e*s-n*o,P=e*l-i*o,w=r*s-n*a,T=r*l-i*a,S=n*l-i*s,I=u*d-c*f,M=u*g-p*f,E=u*x-h*f,L=c*g-p*d,k=c*x-h*d,F=p*x-h*g;return b*F-v*k+P*L+w*E-T*M+S*I}function Kx(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],p=e[8],h=e[9],f=e[10],d=e[11],g=e[12],x=e[13],b=e[14],v=e[15],P=r[0],w=r[1],T=r[2],S=r[3];return t[0]=P*n+w*s+T*p+S*g,t[1]=P*i+w*l+T*h+S*x,t[2]=P*o+w*u+T*f+S*b,t[3]=P*a+w*c+T*d+S*v,P=r[4],w=r[5],T=r[6],S=r[7],t[4]=P*n+w*s+T*p+S*g,t[5]=P*i+w*l+T*h+S*x,t[6]=P*o+w*u+T*f+S*b,t[7]=P*a+w*c+T*d+S*v,P=r[8],w=r[9],T=r[10],S=r[11],t[8]=P*n+w*s+T*p+S*g,t[9]=P*i+w*l+T*h+S*x,t[10]=P*o+w*u+T*f+S*b,t[11]=P*a+w*c+T*d+S*v,P=r[12],w=r[13],T=r[14],S=r[15],t[12]=P*n+w*s+T*p+S*g,t[13]=P*i+w*l+T*h+S*x,t[14]=P*o+w*u+T*f+S*b,t[15]=P*a+w*c+T*d+S*v,t}function gA(t,e,r){var n=r[0],i=r[1],o=r[2],a,s,l,u,c,p,h,f,d,g,x,b;return e===t?(t[12]=e[0]*n+e[4]*i+e[8]*o+e[12],t[13]=e[1]*n+e[5]*i+e[9]*o+e[13],t[14]=e[2]*n+e[6]*i+e[10]*o+e[14],t[15]=e[3]*n+e[7]*i+e[11]*o+e[15]):(a=e[0],s=e[1],l=e[2],u=e[3],c=e[4],p=e[5],h=e[6],f=e[7],d=e[8],g=e[9],x=e[10],b=e[11],t[0]=a,t[1]=s,t[2]=l,t[3]=u,t[4]=c,t[5]=p,t[6]=h,t[7]=f,t[8]=d,t[9]=g,t[10]=x,t[11]=b,t[12]=a*n+c*i+d*o+e[12],t[13]=s*n+p*i+g*o+e[13],t[14]=l*n+h*i+x*o+e[14],t[15]=u*n+f*i+b*o+e[15]),t}function xA(t,e,r){var n=r[0],i=r[1],o=r[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function bA(t,e,r,n){var i=n[0],o=n[1],a=n[2],s=Math.hypot(i,o,a),l,u,c,p,h,f,d,g,x,b,v,P,w,T,S,I,M,E,L,k,F,z,A,R;return s<ue?null:(s=1/s,i*=s,o*=s,a*=s,l=Math.sin(r),u=Math.cos(r),c=1-u,p=e[0],h=e[1],f=e[2],d=e[3],g=e[4],x=e[5],b=e[6],v=e[7],P=e[8],w=e[9],T=e[10],S=e[11],I=i*i*c+u,M=o*i*c+a*l,E=a*i*c-o*l,L=i*o*c-a*l,k=o*o*c+u,F=a*o*c+i*l,z=i*a*c+o*l,A=o*a*c-i*l,R=a*a*c+u,t[0]=p*I+g*M+P*E,t[1]=h*I+x*M+w*E,t[2]=f*I+b*M+T*E,t[3]=d*I+v*M+S*E,t[4]=p*L+g*k+P*F,t[5]=h*L+x*k+w*F,t[6]=f*L+b*k+T*F,t[7]=d*L+v*k+S*F,t[8]=p*z+g*A+P*R,t[9]=h*z+x*A+w*R,t[10]=f*z+b*A+T*R,t[11]=d*z+v*A+S*R,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)}function _A(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[4],a=e[5],s=e[6],l=e[7],u=e[8],c=e[9],p=e[10],h=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=o*i+u*n,t[5]=a*i+c*n,t[6]=s*i+p*n,t[7]=l*i+h*n,t[8]=u*i-o*n,t[9]=c*i-a*n,t[10]=p*i-s*n,t[11]=h*i-l*n,t}function vA(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[0],a=e[1],s=e[2],l=e[3],u=e[8],c=e[9],p=e[10],h=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*i-u*n,t[1]=a*i-c*n,t[2]=s*i-p*n,t[3]=l*i-h*n,t[8]=o*n+u*i,t[9]=a*n+c*i,t[10]=s*n+p*i,t[11]=l*n+h*i,t}function PA(t,e,r){var n=Math.sin(r),i=Math.cos(r),o=e[0],a=e[1],s=e[2],l=e[3],u=e[4],c=e[5],p=e[6],h=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*i+u*n,t[1]=a*i+c*n,t[2]=s*i+p*n,t[3]=l*i+h*n,t[4]=u*i-o*n,t[5]=c*i-a*n,t[6]=p*i-s*n,t[7]=h*i-l*n,t}function wA(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e[0],t[13]=e[1],t[14]=e[2],t[15]=1,t}function TA(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function SA(t,e,r){var n=r[0],i=r[1],o=r[2],a=Math.hypot(n,i,o),s,l,u;return a<ue?null:(a=1/a,n*=a,i*=a,o*=a,s=Math.sin(e),l=Math.cos(e),u=1-l,t[0]=n*n*u+l,t[1]=i*n*u+o*s,t[2]=o*n*u-i*s,t[3]=0,t[4]=n*i*u-o*s,t[5]=i*i*u+l,t[6]=o*i*u+n*s,t[7]=0,t[8]=n*o*u+i*s,t[9]=i*o*u-n*s,t[10]=o*o*u+l,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t)}function CA(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=n,t[6]=r,t[7]=0,t[8]=0,t[9]=-r,t[10]=n,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function MA(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=0,t[2]=-r,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=r,t[9]=0,t[10]=n,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function IA(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=r,t[2]=0,t[3]=0,t[4]=-r,t[5]=n,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Jx(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=n+n,l=i+i,u=o+o,c=n*s,p=n*l,h=n*u,f=i*l,d=i*u,g=o*u,x=a*s,b=a*l,v=a*u;return t[0]=1-(f+g),t[1]=p+v,t[2]=h-b,t[3]=0,t[4]=p-v,t[5]=1-(c+g),t[6]=d+x,t[7]=0,t[8]=h+b,t[9]=d-x,t[10]=1-(c+f),t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t}function AA(t,e){var r=new Ae(3),n=-e[0],i=-e[1],o=-e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],p=n*n+i*i+o*o+a*a;return p>0?(r[0]=(s*a+c*n+l*o-u*i)*2/p,r[1]=(l*a+c*i+u*n-s*o)*2/p,r[2]=(u*a+c*o+s*i-l*n)*2/p):(r[0]=(s*a+c*n+l*o-u*i)*2,r[1]=(l*a+c*i+u*n-s*o)*2,r[2]=(u*a+c*o+s*i-l*n)*2),Jx(t,e,r),t}function EA(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t}function Qx(t,e){var r=e[0],n=e[1],i=e[2],o=e[4],a=e[5],s=e[6],l=e[8],u=e[9],c=e[10];return t[0]=Math.hypot(r,n,i),t[1]=Math.hypot(o,a,s),t[2]=Math.hypot(l,u,c),t}function LA(t,e){var r=new Ae(3);Qx(r,e);var n=1/r[0],i=1/r[1],o=1/r[2],a=e[0]*n,s=e[1]*i,l=e[2]*o,u=e[4]*n,c=e[5]*i,p=e[6]*o,h=e[8]*n,f=e[9]*i,d=e[10]*o,g=a+c+d,x=0;return g>0?(x=Math.sqrt(g+1)*2,t[3]=.25*x,t[0]=(p-f)/x,t[1]=(h-l)/x,t[2]=(s-u)/x):a>c&&a>d?(x=Math.sqrt(1+a-c-d)*2,t[3]=(p-f)/x,t[0]=.25*x,t[1]=(s+u)/x,t[2]=(h+l)/x):c>d?(x=Math.sqrt(1+c-a-d)*2,t[3]=(h-l)/x,t[0]=(s+u)/x,t[1]=.25*x,t[2]=(p+f)/x):(x=Math.sqrt(1+d-a-c)*2,t[3]=(s-u)/x,t[0]=(h+l)/x,t[1]=(p+f)/x,t[2]=.25*x),t}function DA(t,e,r,n){var i=e[0],o=e[1],a=e[2],s=e[3],l=i+i,u=o+o,c=a+a,p=i*l,h=i*u,f=i*c,d=o*u,g=o*c,x=a*c,b=s*l,v=s*u,P=s*c,w=n[0],T=n[1],S=n[2];return t[0]=(1-(d+x))*w,t[1]=(h+P)*w,t[2]=(f-v)*w,t[3]=0,t[4]=(h-P)*T,t[5]=(1-(p+x))*T,t[6]=(g+b)*T,t[7]=0,t[8]=(f+v)*S,t[9]=(g-b)*S,t[10]=(1-(p+d))*S,t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t}function RA(t,e,r,n,i){var o=e[0],a=e[1],s=e[2],l=e[3],u=o+o,c=a+a,p=s+s,h=o*u,f=o*c,d=o*p,g=a*c,x=a*p,b=s*p,v=l*u,P=l*c,w=l*p,T=n[0],S=n[1],I=n[2],M=i[0],E=i[1],L=i[2],k=(1-(g+b))*T,F=(f+w)*T,z=(d-P)*T,A=(f-w)*S,R=(1-(h+b))*S,H=(x+v)*S,W=(d+P)*I,$=(x-v)*I,he=(1-(h+g))*I;return t[0]=k,t[1]=F,t[2]=z,t[3]=0,t[4]=A,t[5]=R,t[6]=H,t[7]=0,t[8]=W,t[9]=$,t[10]=he,t[11]=0,t[12]=r[0]+M-(k*M+A*E+W*L),t[13]=r[1]+E-(F*M+R*E+$*L),t[14]=r[2]+L-(z*M+H*E+he*L),t[15]=1,t}function kA(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=r+r,s=n+n,l=i+i,u=r*a,c=n*a,p=n*s,h=i*a,f=i*s,d=i*l,g=o*a,x=o*s,b=o*l;return t[0]=1-p-d,t[1]=c+b,t[2]=h-x,t[3]=0,t[4]=c-b,t[5]=1-u-d,t[6]=f+g,t[7]=0,t[8]=h+x,t[9]=f-g,t[10]=1-u-p,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function FA(t,e,r,n,i,o,a){var s=1/(r-e),l=1/(i-n),u=1/(o-a);return t[0]=o*2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o*2*l,t[6]=0,t[7]=0,t[8]=(r+e)*s,t[9]=(i+n)*l,t[10]=(a+o)*u,t[11]=-1,t[12]=0,t[13]=0,t[14]=a*o*2*u,t[15]=0,t}function eb(t,e,r,n,i){var o=1/Math.tan(e/2),a;return t[0]=o/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,i!=null&&i!==1/0?(a=1/(n-i),t[10]=(i+n)*a,t[14]=2*i*n*a):(t[10]=-1,t[14]=-2*n),t}var OA=eb;function BA(t,e,r,n,i){var o=1/Math.tan(e/2),a;return t[0]=o/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,i!=null&&i!==1/0?(a=1/(n-i),t[10]=i*a,t[14]=i*n*a):(t[10]=-1,t[14]=-n),t}function zA(t,e,r,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),l=2/(a+s),u=2/(i+o);return t[0]=l,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=u,t[6]=0,t[7]=0,t[8]=-((a-s)*l*.5),t[9]=(i-o)*u*.5,t[10]=n/(r-n),t[11]=-1,t[12]=0,t[13]=0,t[14]=n*r/(r-n),t[15]=0,t}function tb(t,e,r,n,i,o,a){var s=1/(e-r),l=1/(n-i),u=1/(o-a);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*u,t[11]=0,t[12]=(e+r)*s,t[13]=(i+n)*l,t[14]=(a+o)*u,t[15]=1,t}var VA=tb;function UA(t,e,r,n,i,o,a){var s=1/(e-r),l=1/(n-i),u=1/(o-a);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=u,t[11]=0,t[12]=(e+r)*s,t[13]=(i+n)*l,t[14]=o*u,t[15]=1,t}function NA(t,e,r,n){var i,o,a,s,l,u,c,p,h,f,d=e[0],g=e[1],x=e[2],b=n[0],v=n[1],P=n[2],w=r[0],T=r[1],S=r[2];return Math.abs(d-w)<ue&&Math.abs(g-T)<ue&&Math.abs(x-S)<ue?$x(t):(c=d-w,p=g-T,h=x-S,f=1/Math.hypot(c,p,h),c*=f,p*=f,h*=f,i=v*h-P*p,o=P*c-b*h,a=b*p-v*c,f=Math.hypot(i,o,a),f?(f=1/f,i*=f,o*=f,a*=f):(i=0,o=0,a=0),s=p*a-h*o,l=h*i-c*a,u=c*o-p*i,f=Math.hypot(s,l,u),f?(f=1/f,s*=f,l*=f,u*=f):(s=0,l=0,u=0),t[0]=i,t[1]=s,t[2]=c,t[3]=0,t[4]=o,t[5]=l,t[6]=p,t[7]=0,t[8]=a,t[9]=u,t[10]=h,t[11]=0,t[12]=-(i*d+o*g+a*x),t[13]=-(s*d+l*g+u*x),t[14]=-(c*d+p*g+h*x),t[15]=1,t)}function GA(t,e,r,n){var i=e[0],o=e[1],a=e[2],s=n[0],l=n[1],u=n[2],c=i-r[0],p=o-r[1],h=a-r[2],f=c*c+p*p+h*h;f>0&&(f=1/Math.sqrt(f),c*=f,p*=f,h*=f);var d=l*h-u*p,g=u*c-s*h,x=s*p-l*c;return f=d*d+g*g+x*x,f>0&&(f=1/Math.sqrt(f),d*=f,g*=f,x*=f),t[0]=d,t[1]=g,t[2]=x,t[3]=0,t[4]=p*x-h*g,t[5]=h*d-c*x,t[6]=c*g-p*d,t[7]=0,t[8]=c,t[9]=p,t[10]=h,t[11]=0,t[12]=i,t[13]=o,t[14]=a,t[15]=1,t}function jA(t){return"mat4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+", "+t[9]+", "+t[10]+", "+t[11]+", "+t[12]+", "+t[13]+", "+t[14]+", "+t[15]+")"}function HA(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])}function XA(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[4]=e[4]+r[4],t[5]=e[5]+r[5],t[6]=e[6]+r[6],t[7]=e[7]+r[7],t[8]=e[8]+r[8],t[9]=e[9]+r[9],t[10]=e[10]+r[10],t[11]=e[11]+r[11],t[12]=e[12]+r[12],t[13]=e[13]+r[13],t[14]=e[14]+r[14],t[15]=e[15]+r[15],t}function rb(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[4]=e[4]-r[4],t[5]=e[5]-r[5],t[6]=e[6]-r[6],t[7]=e[7]-r[7],t[8]=e[8]-r[8],t[9]=e[9]-r[9],t[10]=e[10]-r[10],t[11]=e[11]-r[11],t[12]=e[12]-r[12],t[13]=e[13]-r[13],t[14]=e[14]-r[14],t[15]=e[15]-r[15],t}function ZA(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[4]=e[4]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12]*r,t[13]=e[13]*r,t[14]=e[14]*r,t[15]=e[15]*r,t}function qA(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[4]=e[4]+r[4]*n,t[5]=e[5]+r[5]*n,t[6]=e[6]+r[6]*n,t[7]=e[7]+r[7]*n,t[8]=e[8]+r[8]*n,t[9]=e[9]+r[9]*n,t[10]=e[10]+r[10]*n,t[11]=e[11]+r[11]*n,t[12]=e[12]+r[12]*n,t[13]=e[13]+r[13]*n,t[14]=e[14]+r[14]*n,t[15]=e[15]+r[15]*n,t}function YA(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[11]===e[11]&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[15]===e[15]}function WA(t,e){var r=t[0],n=t[1],i=t[2],o=t[3],a=t[4],s=t[5],l=t[6],u=t[7],c=t[8],p=t[9],h=t[10],f=t[11],d=t[12],g=t[13],x=t[14],b=t[15],v=e[0],P=e[1],w=e[2],T=e[3],S=e[4],I=e[5],M=e[6],E=e[7],L=e[8],k=e[9],F=e[10],z=e[11],A=e[12],R=e[13],H=e[14],W=e[15];return Math.abs(r-v)<=ue*Math.max(1,Math.abs(r),Math.abs(v))&&Math.abs(n-P)<=ue*Math.max(1,Math.abs(n),Math.abs(P))&&Math.abs(i-w)<=ue*Math.max(1,Math.abs(i),Math.abs(w))&&Math.abs(o-T)<=ue*Math.max(1,Math.abs(o),Math.abs(T))&&Math.abs(a-S)<=ue*Math.max(1,Math.abs(a),Math.abs(S))&&Math.abs(s-I)<=ue*Math.max(1,Math.abs(s),Math.abs(I))&&Math.abs(l-M)<=ue*Math.max(1,Math.abs(l),Math.abs(M))&&Math.abs(u-E)<=ue*Math.max(1,Math.abs(u),Math.abs(E))&&Math.abs(c-L)<=ue*Math.max(1,Math.abs(c),Math.abs(L))&&Math.abs(p-k)<=ue*Math.max(1,Math.abs(p),Math.abs(k))&&Math.abs(h-F)<=ue*Math.max(1,Math.abs(h),Math.abs(F))&&Math.abs(f-z)<=ue*Math.max(1,Math.abs(f),Math.abs(z))&&Math.abs(d-A)<=ue*Math.max(1,Math.abs(d),Math.abs(A))&&Math.abs(g-R)<=ue*Math.max(1,Math.abs(g),Math.abs(R))&&Math.abs(x-H)<=ue*Math.max(1,Math.abs(x),Math.abs(H))&&Math.abs(b-W)<=ue*Math.max(1,Math.abs(b),Math.abs(W))}var $A=Kx,KA=rb;var $n={};Oi($n,{add:()=>xE,calculateW:()=>sE,clone:()=>mE,conjugate:()=>pE,copy:()=>yE,create:()=>td,dot:()=>Pb,equals:()=>TE,exactEquals:()=>wE,exp:()=>xb,fromEuler:()=>hE,fromMat3:()=>_b,fromValues:()=>dE,getAngle:()=>nE,getAxisAngle:()=>rE,identity:()=>tE,invert:()=>cE,len:()=>vE,length:()=>wb,lerp:()=>_E,ln:()=>bb,mul:()=>bE,multiply:()=>gb,normalize:()=>rd,pow:()=>lE,random:()=>uE,rotateX:()=>iE,rotateY:()=>oE,rotateZ:()=>aE,rotationTo:()=>SE,scale:()=>vb,set:()=>gE,setAxes:()=>ME,setAxisAngle:()=>yb,slerp:()=>ac,sqlerp:()=>CE,sqrLen:()=>PE,squaredLength:()=>Tb,str:()=>fE});m();var V={};Oi(V,{add:()=>t2,angle:()=>v2,bezier:()=>f2,ceil:()=>r2,clone:()=>JA,copy:()=>QA,create:()=>tc,cross:()=>ns,dist:()=>A2,distance:()=>sb,div:()=>I2,divide:()=>ab,dot:()=>nc,equals:()=>S2,exactEquals:()=>T2,floor:()=>n2,forEach:()=>D2,fromValues:()=>rc,hermite:()=>h2,inverse:()=>c2,len:()=>jm,length:()=>nb,lerp:()=>p2,max:()=>o2,min:()=>i2,mul:()=>M2,multiply:()=>ob,negate:()=>u2,normalize:()=>Gm,random:()=>m2,rotateX:()=>x2,rotateY:()=>b2,rotateZ:()=>_2,round:()=>a2,scale:()=>s2,scaleAndAdd:()=>l2,set:()=>e2,sqrDist:()=>E2,sqrLen:()=>L2,squaredDistance:()=>lb,squaredLength:()=>ub,str:()=>w2,sub:()=>C2,subtract:()=>ib,transformMat3:()=>y2,transformMat4:()=>d2,transformQuat:()=>g2,zero:()=>P2});m();function tc(){var t=new Ae(3);return Ae!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function JA(t){var e=new Ae(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function nb(t){var e=t[0],r=t[1],n=t[2];return Math.hypot(e,r,n)}function rc(t,e,r){var n=new Ae(3);return n[0]=t,n[1]=e,n[2]=r,n}function QA(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function e2(t,e,r,n){return t[0]=e,t[1]=r,t[2]=n,t}function t2(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t}function ib(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t}function ob(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t}function ab(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t[2]=e[2]/r[2],t}function r2(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t}function n2(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t}function i2(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}function o2(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}function a2(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t}function s2(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t}function l2(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t}function sb(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2];return Math.hypot(r,n,i)}function lb(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2];return r*r+n*n+i*i}function ub(t){var e=t[0],r=t[1],n=t[2];return e*e+r*r+n*n}function u2(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t}function c2(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t}function Gm(t,e){var r=e[0],n=e[1],i=e[2],o=r*r+n*n+i*i;return o>0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o,t}function nc(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function ns(t,e,r){var n=e[0],i=e[1],o=e[2],a=r[0],s=r[1],l=r[2];return t[0]=i*l-o*s,t[1]=o*a-n*l,t[2]=n*s-i*a,t}function p2(t,e,r,n){var i=e[0],o=e[1],a=e[2];return t[0]=i+n*(r[0]-i),t[1]=o+n*(r[1]-o),t[2]=a+n*(r[2]-a),t}function h2(t,e,r,n,i,o){var a=o*o,s=a*(2*o-3)+1,l=a*(o-2)+o,u=a*(o-1),c=a*(3-2*o);return t[0]=e[0]*s+r[0]*l+n[0]*u+i[0]*c,t[1]=e[1]*s+r[1]*l+n[1]*u+i[1]*c,t[2]=e[2]*s+r[2]*l+n[2]*u+i[2]*c,t}function f2(t,e,r,n,i,o){var a=1-o,s=a*a,l=o*o,u=s*a,c=3*o*s,p=3*l*a,h=l*o;return t[0]=e[0]*u+r[0]*c+n[0]*p+i[0]*h,t[1]=e[1]*u+r[1]*c+n[1]*p+i[1]*h,t[2]=e[2]*u+r[2]*c+n[2]*p+i[2]*h,t}function m2(t,e){e=e||1;var r=Yt()*2*Math.PI,n=Yt()*2-1,i=Math.sqrt(1-n*n)*e;return t[0]=Math.cos(r)*i,t[1]=Math.sin(r)*i,t[2]=n*e,t}function d2(t,e,r){var n=e[0],i=e[1],o=e[2],a=r[3]*n+r[7]*i+r[11]*o+r[15];return a=a||1,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}function y2(t,e,r){var n=e[0],i=e[1],o=e[2];return t[0]=n*r[0]+i*r[3]+o*r[6],t[1]=n*r[1]+i*r[4]+o*r[7],t[2]=n*r[2]+i*r[5]+o*r[8],t}function g2(t,e,r){var n=r[0],i=r[1],o=r[2],a=r[3],s=e[0],l=e[1],u=e[2],c=i*u-o*l,p=o*s-n*u,h=n*l-i*s,f=i*h-o*p,d=o*c-n*h,g=n*p-i*c,x=a*2;return c*=x,p*=x,h*=x,f*=2,d*=2,g*=2,t[0]=s+c+f,t[1]=l+p+d,t[2]=u+h+g,t}function x2(t,e,r,n){var i=[],o=[];return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[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),t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2],t}function b2(t,e,r,n){var i=[],o=[];return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[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),t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2],t}function _2(t,e,r,n){var i=[],o=[];return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[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],t[0]=o[0]+r[0],t[1]=o[1]+r[1],t[2]=o[2]+r[2],t}function v2(t,e){var r=t[0],n=t[1],i=t[2],o=e[0],a=e[1],s=e[2],l=Math.sqrt(r*r+n*n+i*i),u=Math.sqrt(o*o+a*a+s*s),c=l*u,p=c&&nc(t,e)/c;return Math.acos(Math.min(Math.max(p,-1),1))}function P2(t){return t[0]=0,t[1]=0,t[2]=0,t}function w2(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"}function T2(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]}function S2(t,e){var r=t[0],n=t[1],i=t[2],o=e[0],a=e[1],s=e[2];return Math.abs(r-o)<=ue*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(n-a)<=ue*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(i-s)<=ue*Math.max(1,Math.abs(i),Math.abs(s))}var C2=ib,M2=ob,I2=ab,A2=sb,E2=lb,jm=nb,L2=ub,D2=function(){var t=tc();return function(e,r,n,i,o,a){var s,l;for(r||(r=3),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],o(t,t,a),e[s]=t[0],e[s+1]=t[1],e[s+2]=t[2];return e}}();var Ne={};Oi(Ne,{add:()=>Ym,ceil:()=>R2,clone:()=>Hm,copy:()=>Zm,create:()=>cb,cross:()=>N2,dist:()=>$2,distance:()=>mb,div:()=>W2,divide:()=>fb,dot:()=>Km,equals:()=>ed,exactEquals:()=>Qm,floor:()=>k2,forEach:()=>eE,fromValues:()=>Xm,inverse:()=>U2,len:()=>J2,length:()=>ic,lerp:()=>Jm,max:()=>O2,min:()=>F2,mul:()=>Y2,multiply:()=>hb,negate:()=>V2,normalize:()=>$m,random:()=>G2,round:()=>B2,scale:()=>Wm,scaleAndAdd:()=>z2,set:()=>qm,sqrDist:()=>K2,sqrLen:()=>Q2,squaredDistance:()=>db,squaredLength:()=>oc,str:()=>Z2,sub:()=>q2,subtract:()=>pb,transformMat4:()=>j2,transformQuat:()=>H2,zero:()=>X2});m();function cb(){var t=new Ae(4);return Ae!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function Hm(t){var e=new Ae(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function Xm(t,e,r,n){var i=new Ae(4);return i[0]=t,i[1]=e,i[2]=r,i[3]=n,i}function Zm(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function qm(t,e,r,n,i){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t}function Ym(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 pb(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 hb(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 fb(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 R2(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 k2(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 F2(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 O2(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 B2(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 Wm(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 z2(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 mb(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 db(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 ic(t){var e=t[0],r=t[1],n=t[2],i=t[3];return Math.hypot(e,r,n,i)}function oc(t){var e=t[0],r=t[1],n=t[2],i=t[3];return e*e+r*r+n*n+i*i}function V2(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t}function U2(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 $m(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 Km(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}function N2(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],h=e[2],f=e[3];return t[0]=p*u-h*l+f*s,t[1]=-(c*u)+h*a-f*o,t[2]=c*l-p*a+f*i,t[3]=-(c*s)+p*o-h*i,t}function Jm(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 G2(t,e){e=e||1;var r,n,i,o,a,s;do r=Yt()*2-1,n=Yt()*2-1,a=r*r+n*n;while(a>=1);do i=Yt()*2-1,o=Yt()*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 j2(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 H2(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,h=u*o+a*i-s*n,f=-a*n-s*i-l*o;return t[0]=c*u+f*-a+p*-l-h*-s,t[1]=p*u+f*-s+h*-a-c*-l,t[2]=h*u+f*-l+c*-s-p*-a,t[3]=e[3],t}function X2(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t}function Z2(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}function Qm(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]}function ed(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)<=ue*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(n-s)<=ue*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-l)<=ue*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(o-u)<=ue*Math.max(1,Math.abs(o),Math.abs(u))}var q2=pb,Y2=hb,W2=fb,$2=mb,K2=db,J2=ic,Q2=oc,eE=function(){var t=cb();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 td(){var t=new Ae(4);return Ae!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function tE(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t}function yb(t,e,r){r=r*.5;var n=Math.sin(r);return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=Math.cos(r),t}function rE(t,e){var r=Math.acos(e[3])*2,n=Math.sin(r/2);return n>ue?(t[0]=e[0]/n,t[1]=e[1]/n,t[2]=e[2]/n):(t[0]=1,t[1]=0,t[2]=0),r}function nE(t,e){var r=Pb(t,e);return Math.acos(2*r*r-1)}function gb(t,e,r){var n=e[0],i=e[1],o=e[2],a=e[3],s=r[0],l=r[1],u=r[2],c=r[3];return t[0]=n*c+a*s+i*u-o*l,t[1]=i*c+a*l+o*s-n*u,t[2]=o*c+a*u+n*l-i*s,t[3]=a*c-n*s-i*l-o*u,t}function iE(t,e,r){r*=.5;var n=e[0],i=e[1],o=e[2],a=e[3],s=Math.sin(r),l=Math.cos(r);return t[0]=n*l+a*s,t[1]=i*l+o*s,t[2]=o*l-i*s,t[3]=a*l-n*s,t}function oE(t,e,r){r*=.5;var n=e[0],i=e[1],o=e[2],a=e[3],s=Math.sin(r),l=Math.cos(r);return t[0]=n*l-o*s,t[1]=i*l+a*s,t[2]=o*l+n*s,t[3]=a*l-i*s,t}function aE(t,e,r){r*=.5;var n=e[0],i=e[1],o=e[2],a=e[3],s=Math.sin(r),l=Math.cos(r);return t[0]=n*l+i*s,t[1]=i*l-n*s,t[2]=o*l+a*s,t[3]=a*l-o*s,t}function sE(t,e){var r=e[0],n=e[1],i=e[2];return t[0]=r,t[1]=n,t[2]=i,t[3]=Math.sqrt(Math.abs(1-r*r-n*n-i*i)),t}function xb(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=Math.sqrt(r*r+n*n+i*i),s=Math.exp(o),l=a>0?s*Math.sin(a)/a:0;return t[0]=r*l,t[1]=n*l,t[2]=i*l,t[3]=s*Math.cos(a),t}function bb(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=Math.sqrt(r*r+n*n+i*i),s=a>0?Math.atan2(a,o)/a:0;return t[0]=r*s,t[1]=n*s,t[2]=i*s,t[3]=.5*Math.log(r*r+n*n+i*i+o*o),t}function lE(t,e,r){return bb(t,e),vb(t,t,r),xb(t,t),t}function ac(t,e,r,n){var i=e[0],o=e[1],a=e[2],s=e[3],l=r[0],u=r[1],c=r[2],p=r[3],h,f,d,g,x;return f=i*l+o*u+a*c+s*p,f<0&&(f=-f,l=-l,u=-u,c=-c,p=-p),1-f>ue?(h=Math.acos(f),d=Math.sin(h),g=Math.sin((1-n)*h)/d,x=Math.sin(n*h)/d):(g=1-n,x=n),t[0]=g*i+x*l,t[1]=g*o+x*u,t[2]=g*a+x*c,t[3]=g*s+x*p,t}function uE(t){var e=Yt(),r=Yt(),n=Yt(),i=Math.sqrt(1-e),o=Math.sqrt(e);return t[0]=i*Math.sin(2*Math.PI*r),t[1]=i*Math.cos(2*Math.PI*r),t[2]=o*Math.sin(2*Math.PI*n),t[3]=o*Math.cos(2*Math.PI*n),t}function cE(t,e){var r=e[0],n=e[1],i=e[2],o=e[3],a=r*r+n*n+i*i+o*o,s=a?1/a:0;return t[0]=-r*s,t[1]=-n*s,t[2]=-i*s,t[3]=o*s,t}function pE(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t}function _b(t,e){var r=e[0]+e[4]+e[8],n;if(r>0)n=Math.sqrt(r+1),t[3]=.5*n,n=.5/n,t[0]=(e[5]-e[7])*n,t[1]=(e[6]-e[2])*n,t[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),t[i]=.5*n,n=.5/n,t[3]=(e[o*3+a]-e[a*3+o])*n,t[o]=(e[o*3+i]+e[i*3+o])*n,t[a]=(e[a*3+i]+e[i*3+a])*n}return t}function hE(t,e,r,n){var i=.5*Math.PI/180;e*=i,r*=i,n*=i;var o=Math.sin(e),a=Math.cos(e),s=Math.sin(r),l=Math.cos(r),u=Math.sin(n),c=Math.cos(n);return t[0]=o*l*c-a*s*u,t[1]=a*s*c+o*l*u,t[2]=a*l*u-o*s*c,t[3]=a*l*c+o*s*u,t}function fE(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}var mE=Hm,dE=Xm,yE=Zm,gE=qm,xE=Ym,bE=gb,vb=Wm,Pb=Km,_E=Jm,wb=ic,vE=wb,Tb=oc,PE=Tb,rd=$m,wE=Qm,TE=ed,SE=function(){var t=tc(),e=rc(1,0,0),r=rc(0,1,0);return function(n,i,o){var a=nc(i,o);return a<-.999999?(ns(t,e,i),jm(t)<1e-6&&ns(t,r,i),Gm(t,t),yb(n,t,Math.PI),n):a>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(ns(t,i,o),n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=1+a,rd(n,n))}}(),CE=function(){var t=td(),e=td();return function(r,n,i,o,a,s){return ac(t,n,a,s),ac(e,i,o,s),ac(r,t,e,2*s*(1-s)),r}}(),ME=function(){var t=Nm();return function(e,r,n,i){return t[0]=n[0],t[3]=n[1],t[6]=n[2],t[1]=i[0],t[4]=i[1],t[7]=i[2],t[2]=-r[0],t[5]=-r[1],t[8]=-r[2],rd(e,_b(e,t))}}();var Tt={};Oi(Tt,{add:()=>DE,angle:()=>JE,ceil:()=>RE,clone:()=>IE,copy:()=>EE,create:()=>Sb,cross:()=>HE,dist:()=>sL,distance:()=>Ab,div:()=>aL,divide:()=>Ib,dot:()=>jE,equals:()=>rL,exactEquals:()=>tL,floor:()=>kE,forEach:()=>cL,fromValues:()=>AE,inverse:()=>NE,len:()=>nL,length:()=>Lb,lerp:()=>XE,max:()=>OE,min:()=>FE,mul:()=>oL,multiply:()=>Mb,negate:()=>UE,normalize:()=>GE,random:()=>ZE,rotate:()=>KE,round:()=>BE,scale:()=>zE,scaleAndAdd:()=>VE,set:()=>LE,sqrDist:()=>lL,sqrLen:()=>uL,squaredDistance:()=>Eb,squaredLength:()=>Db,str:()=>eL,sub:()=>iL,subtract:()=>Cb,transformMat2:()=>qE,transformMat2d:()=>YE,transformMat3:()=>WE,transformMat4:()=>$E,zero:()=>QE});m();function Sb(){var t=new Ae(2);return Ae!=Float32Array&&(t[0]=0,t[1]=0),t}function IE(t){var e=new Ae(2);return e[0]=t[0],e[1]=t[1],e}function AE(t,e){var r=new Ae(2);return r[0]=t,r[1]=e,r}function EE(t,e){return t[0]=e[0],t[1]=e[1],t}function LE(t,e,r){return t[0]=e,t[1]=r,t}function DE(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t}function Cb(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t}function Mb(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t}function Ib(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t}function RE(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t}function kE(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t}function FE(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t}function OE(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t}function BE(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t}function zE(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t}function VE(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t}function Ab(t,e){var r=e[0]-t[0],n=e[1]-t[1];return Math.hypot(r,n)}function Eb(t,e){var r=e[0]-t[0],n=e[1]-t[1];return r*r+n*n}function Lb(t){var e=t[0],r=t[1];return Math.hypot(e,r)}function Db(t){var e=t[0],r=t[1];return e*e+r*r}function UE(t,e){return t[0]=-e[0],t[1]=-e[1],t}function NE(t,e){return t[0]=1/e[0],t[1]=1/e[1],t}function GE(t,e){var r=e[0],n=e[1],i=r*r+n*n;return i>0&&(i=1/Math.sqrt(i)),t[0]=e[0]*i,t[1]=e[1]*i,t}function jE(t,e){return t[0]*e[0]+t[1]*e[1]}function HE(t,e,r){var n=e[0]*r[1]-e[1]*r[0];return t[0]=t[1]=0,t[2]=n,t}function XE(t,e,r,n){var i=e[0],o=e[1];return t[0]=i+n*(r[0]-i),t[1]=o+n*(r[1]-o),t}function ZE(t,e){e=e||1;var r=Yt()*2*Math.PI;return t[0]=Math.cos(r)*e,t[1]=Math.sin(r)*e,t}function qE(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[2]*i,t[1]=r[1]*n+r[3]*i,t}function YE(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[2]*i+r[4],t[1]=r[1]*n+r[3]*i+r[5],t}function WE(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[3]*i+r[6],t[1]=r[1]*n+r[4]*i+r[7],t}function $E(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[4]*i+r[12],t[1]=r[1]*n+r[5]*i+r[13],t}function KE(t,e,r,n){var i=e[0]-r[0],o=e[1]-r[1],a=Math.sin(n),s=Math.cos(n);return t[0]=i*s-o*a+r[0],t[1]=i*a+o*s+r[1],t}function JE(t,e){var r=t[0],n=t[1],i=e[0],o=e[1],a=Math.sqrt(r*r+n*n)*Math.sqrt(i*i+o*o),s=a&&(r*i+n*o)/a;return Math.acos(Math.min(Math.max(s,-1),1))}function QE(t){return t[0]=0,t[1]=0,t}function eL(t){return"vec2("+t[0]+", "+t[1]+")"}function tL(t,e){return t[0]===e[0]&&t[1]===e[1]}function rL(t,e){var r=t[0],n=t[1],i=e[0],o=e[1];return Math.abs(r-i)<=ue*Math.max(1,Math.abs(r),Math.abs(i))&&Math.abs(n-o)<=ue*Math.max(1,Math.abs(n),Math.abs(o))}var nL=Lb,iL=Cb,oL=Mb,aL=Ib,sL=Ab,lL=Eb,uL=Db,cL=function(){var t=Sb();return function(e,r,n,i,o,a){var s,l;for(r||(r=2),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],o(t,t,a),e[s]=t[0],e[s+1]=t[1];return e}}();m();m();function gt(t,e,r){return e*(8192/(t.tileSize*Math.pow(2,r-t.tileID.overscaledZ)))}function Bo(){return new Float64Array(4)}function nt(){return new Float64Array(3)}function Zr(){return new Float64Array(16)}function Kn(){let t=new Float64Array(16);return B.identity(t),t}function sc(){let t=new Float32Array(16);return B.identity(t),t}function Wt(t,e,r,n,i=!1){if(!r[0]&&!r[1])return[0,0];let o=i?n==="map"?-t.bearingInRadians:0:n==="viewport"?t.bearingInRadians:0;if(o){let a=Math.sin(o),s=Math.cos(o);r=[r[0]*s-r[1]*a,r[0]*a+r[1]*s]}return[i?r[0]:gt(e,r[0],t.zoom),i?r[1]:gt(e,r[1],t.zoom)]}function is(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]}function dr(t,e,r){let n=wn.determinant([t[0],t[1],t[2],e[0],e[1],e[2],r[0],r[1],r[2]]);if(n===0)return null;let i=V.cross([],[e[0],e[1],e[2]],[r[0],r[1],r[2]]),o=V.cross([],[r[0],r[1],r[2]],[t[0],t[1],t[2]]),a=V.cross([],[t[0],t[1],t[2]],[e[0],e[1],e[2]]),s=V.scale([],i,-t[3]);return V.add(s,s,V.scale([],o,-e[3])),V.add(s,s,V.scale([],a,-r[3])),V.scale(s,s,1/n),s}function Bb(t,e,r){let n=t[0]*r[0]+t[1]*r[1]+t[2]*r[2],i=e[0]*r[0]+e[1]*r[1]+e[2]*r[2];return i===0?null:(-n-r[3])/i}function os(t,e,r,n){let i=Math.sqrt(t*t+e*e),o=Math.sqrt(r*r+n*n);t/=i,e/=i,r/=o,n/=o;let a=t*r+e*n,s=Math.acos(a);return-e*r+t*n>0?s:-s}function Nt(t,e){let r=ji(t,360),n=ji(e,360),i=n-r,o=n>r?i-360:i+360;return Math.abs(i)<Math.abs(o)?i:o}function as(t,e){let r=ji(t,Math.PI*2),n=ji(e,Math.PI*2);return Math.min(Math.abs(r-n),Math.abs(r-n+Math.PI*2),Math.abs(r-n-Math.PI*2))}function ji(t,e){return(t%e+e)%e}function zo(t,e,r,n,i){let o=ce((t-e)/(r-e),0,1);return Tn(n,i,o)}function Tn(t,e,r){return t*(1-r)+e*r}function zb(t){let e=1/0,r=1/0,n=-1/0,i=-1/0;for(let o of t)e=Math.min(e,o.x),r=Math.min(r,o.y),n=Math.max(n,o.x),i=Math.max(i,o.y);return[e,r,n,i]}function lc(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 ss(t,e,r,n){let i=new Ob.default(t,e,r,n);return o=>i.solve(o)}var ls=ss(.25,.1,.25,1);function ce(t,e,r){return Math.min(r,Math.max(e,t))}function Rr(t,e,r){let n=r-e,i=((t-e)%n+n)%n+e;return i===e?r:i}function Vb(t,e){let r=[];for(let n in t)n in e||r.push(n);return r}function Z(t,...e){for(let r of e)for(let n in r)t[n]=r[n];return t}function an(t,e){let r={};for(let n=0;n<e.length;n++){let i=e[n];i in t&&(r[i]=t[i])}return r}var pL=1;function uc(){return pL++}function Ub(t){return Math.log(t)/Math.LN2%1===0}function Nb(t){return t<=1?1:Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function ct(t){return Math.pow(2,t)}function it(t){return Math.log(t)/Math.LN2}function us(t,e,r){let n={};for(let i in t)n[i]=e.call(r||this,t[i],i,t);return n}function cc(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 Dr(t,e){if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(!Dr(t[r],e[r]))return!1;return!0}if(typeof t=="object"&&t!==null&&e!==null){if(typeof e!="object"||Object.keys(t).length!==Object.keys(e).length)return!1;for(let n in t)if(!Dr(t[n],e[n]))return!1;return!0}return t===e}function Ft(t){return Array.isArray(t)?t.map(Ft):typeof t=="object"&&t?us(t,Ft):t}var Rb={};function ve(t){Rb[t]||(typeof console<"u"&&console.warn(t),Rb[t]=!0)}function Sn(t,e,r){return(r.y-t.y)*(e.x-t.x)>(e.y-t.y)*(r.x-t.x)}function Gb(t,e,r,n){let i=e.y-t.y,o=e.x-t.x,a=n.y-r.y,s=n.x-r.x,l=a*o-s*i;if(l===0)return null;let u=t.y-r.y,c=t.x-r.x,p=(s*u-a*c)/l;return new Fb.default(t.x+p*o,t.y+p*i)}function jb([t,e,r]){return e+=90,e*=Math.PI/180,r*=Math.PI/180,{x:t*Math.cos(e)*Math.sin(r),y:t*Math.sin(e)*Math.sin(r),z:t*Math.cos(r)}}function Cn(t){return typeof WorkerGlobalScope<"u"&&typeof t<"u"&&t instanceof WorkerGlobalScope}function Hb(t){let e=/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,r={};if(t.replace(e,(n,i,o,a)=>{let s=o||a;return r[i]=s?s.toLowerCase():!0,""}),r["max-age"]){let n=parseInt(r["max-age"],10);isNaN(n)?delete r["max-age"]:r["max-age"]=n}return r}var nd=null;function Xb(t){if(nd==null){let e=t.navigator?t.navigator.userAgent:null;nd=!!t.safari||!!(e&&(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return nd}function $t(t){return typeof ImageBitmap<"u"&&t instanceof ImageBitmap}var Zb=async t=>{if(t.byteLength===0)return createImageBitmap(new ImageData(1,1));let e=new Blob([new Uint8Array(t)],{type:"image/png"});try{return createImageBitmap(e)}catch(r){throw new Error("Could not load image because of ".concat(r.message,". Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))}},kb="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=",qb=t=>new Promise((e,r)=>{let n=new Image;n.onload=()=>{e(n),URL.revokeObjectURL(n.src),n.onload=null,window.requestAnimationFrame(()=>{n.src=kb})},n.onerror=()=>r(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(t)],{type:"image/png"});n.src=t.byteLength?URL.createObjectURL(i):kb});function hL(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),h=Math.min(t.width,e+n),f=Math.min(t.height,r+i);return{rect:{x:c,y:p,width:h-c,height:f-p},layout:[{offset:l,stride:u}]}}async function Yb(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,hL(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()}}function cs(t,e,r,n){return t.addEventListener(e,r,n),{unsubscribe:()=>{t.removeEventListener(e,r,n)}}}function Ve(t){return t*Math.PI/180}function Gi(t){return t/Math.PI*180}function pc(t,e){return t.roll==e.roll&&t.pitch==e.pitch&&t.bearing==e.bearing}function Wb(t){let e=new Float64Array(9);wn.fromQuat(e,t);let r=Gi(-Math.asin(ce(e[2],-1,1))),n,i;return Math.hypot(e[5],e[8])<.001?(n=0,i=-Gi(Math.atan2(e[3],e[4]))):(n=Gi(e[5]===0&&e[8]===0?0:Math.atan2(e[5],e[8])),i=Gi(e[1]===0&&e[0]===0?0:Math.atan2(e[1],e[0]))),{roll:n,pitch:r+90,bearing:i}}function id(t,e,r){let n=Tt.fromValues(e.x-r.x,e.y-r.y),i=Tt.fromValues(t.x-r.x,t.y-r.y),o=n[0]*i[1]-n[1]*i[0],a=Math.atan2(o,Tt.dot(n,i));return Gi(a)}function od(t,e,r){let n=new Float64Array(4);return $n.fromEuler(n,t,e-90,r),n}var Hi=25,ps=0,Gt=85.051129,$b={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},Kb={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0};function Jb(t,e){return $b[e]&&"touches"in t}function Qb(t,e){return Kb[e]&&(t instanceof MouseEvent||t instanceof WheelEvent)}function e_(t){return $b[t]||Kb[t]}m();m();var t_="AbortError";function r_(t){return t.message===t_}function Xi(){return new Error(t_)}var fL=typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),hc,ad,ae={now:fL,frame(t,e,r){let n=requestAnimationFrame(o=>{i(),e(o)}),{unsubscribe:i}=cs(t.signal,"abort",()=>{i(),cancelAnimationFrame(n),r(Xi())},!1)},frameAsync(t){return new Promise((e,r)=>{this.frame(t,e,r)})},getImageData(t,e=0){return this.getImageCanvasContext(t).getImageData(-e,-e,t.width+2*e,t.height+2*e)},getImageCanvasContext(t){let e=window.document.createElement("canvas"),r=e.getContext("2d",{willReadFrequently:!0});if(!r)throw new Error("failed to create canvas 2d context");return e.width=t.width,e.height=t.height,r.drawImage(t,0,0,t.width,t.height),r},resolveURL(t){return hc||(hc=document.createElement("a")),hc.href=t,hc.href},hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return matchMedia?(ad==null&&(ad=matchMedia("(prefers-reduced-motion: reduce)")),ad.matches):!1}};m();var n_=se(fe(),1),Be=class Be{static testProp(e){if(!Be.docStyle)return e[0];for(let r=0;r<e.length;r++)if(e[r]in Be.docStyle)return e[r];return e[0]}static create(e,r,n){let i=window.document.createElement(e);return r!==void 0&&(i.className=r),n&&n.appendChild(i),i}static createNS(e,r){return window.document.createElementNS(e,r)}static disableDrag(){Be.docStyle&&Be.selectProp&&(Be.userSelect=Be.docStyle[Be.selectProp],Be.docStyle[Be.selectProp]="none")}static enableDrag(){Be.docStyle&&Be.selectProp&&(Be.docStyle[Be.selectProp]=Be.userSelect)}static setTransform(e,r){e.style[Be.transformProp]=r}static addEventListener(e,r,n,i={}){"passive"in i?e.addEventListener(r,n,i):e.addEventListener(r,n,i.capture)}static removeEventListener(e,r,n,i={}){"passive"in i?e.removeEventListener(r,n,i):e.removeEventListener(r,n,i.capture)}static suppressClickInternal(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener("click",Be.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",Be.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",Be.suppressClickInternal,!0)},0)}static getScale(e){let r=e.getBoundingClientRect();return{x:r.width/e.offsetWidth||1,y:r.height/e.offsetHeight||1,boundingClientRect:r}}static getPoint(e,r,n){let i=r.boundingClientRect;return new n_.default((n.clientX-i.left)/r.x-e.clientLeft,(n.clientY-i.top)/r.y-e.clientTop)}static mousePos(e,r){let n=Be.getScale(e);return Be.getPoint(e,n,r)}static touchPos(e,r){let n=[],i=Be.getScale(e);for(let o=0;o<r.length;o++)n.push(Be.getPoint(e,i,r[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 Be.clean(i),i.innerHTML}static isPossiblyDangerous(e,r){let n=r.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 r=e.children;for(let n of r)Be.removeAttributes(n),Be.clean(n)}static removeAttributes(e){for(let{name:r,value:n}of e.attributes)Be.isPossiblyDangerous(r,n)&&e.removeAttribute(r)}};Be.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,Be.selectProp=Be.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),Be.transformProp=Be.testProp(["transform","WebkitTransform"]);var ie=Be;m();m();m();var Kt={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function fc(t){return Kt.REGISTERED_PROTOCOLS[t.substring(0,t.indexOf("://"))]}m();var mc="global-dispatcher",Jn=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}},dc=()=>Cn(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,mL=t=>/^file:/.test(t)||/^file:/.test(dc())&&!/^\w+:/.test(t);async function dL(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:dc(),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 Jn(0,a.message,t.url,new Blob)}if(!n.ok){let a=await n.blob();throw new Jn(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 Xi();return{data:o,cacheControl:n.headers.get("Cache-Control"),expires:n.headers.get("Expires")}}function yL(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 Jn(i.status,i.statusText,t.url,a))}},e.signal.addEventListener("abort",()=>{i.abort(),n(Xi())}),i.send(t.body)})}var Vo=function(t,e){if(/:\/\//.test(t.url)&&!/^https?:|^file:/.test(t.url)){let r=fc(t.url);if(r)return r(t,e);if(Cn(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:t,targetMapId:mc},e)}if(!mL(t.url)){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return dL(t,e);if(Cn(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:t,mustQueue:!0,targetMapId:mc},e)}return yL(t,e)},Qn=(t,e)=>Vo(Z(t,{type:"json"}),e),i_=(t,e)=>Vo(Z(t,{type:"arrayBuffer"}),e);function sd(t){if(!t||t.indexOf("://")<=0||t.indexOf("data:image/")===0||t.indexOf("blob:")===0)return!0;let e=new URL(t),r=window.location;return e.protocol===r.protocol&&e.host===r.host}var o_=t=>{let e=window.document.createElement("video");return e.muted=!0,new Promise(r=>{e.onloadstart=()=>{r(e)};for(let n of t){let i=window.document.createElement("source");sd(n)||(e.crossOrigin="Anonymous"),i.src=n,e.appendChild(i)}})};m();m();var fs={supported:!1,testSupport:gL},hs,ld=!1,Uo,a_=!1;typeof document<"u"&&(Uo=document.createElement("img"),Uo.onload=()=>{hs&&s_(hs),hs=null,a_=!0},Uo.onerror=()=>{ld=!0,hs=null},Uo.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");function gL(t){ld||!Uo||(a_?s_(t):hs=t)}function s_(t){let e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e);try{if(t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,Uo),t.isContextLost())return;fs.supported=!0}catch(r){}t.deleteTexture(e),ld=!0}var jt;(f=>{let t,e,r,n;f.resetRequestQueue=()=>{t=[],e=0,r=0,n={}},f.addThrottleControl=d=>{let g=r++;return n[g]=d,g},f.removeThrottleControl=d=>{delete n[d],p()};let s=()=>{for(let d of Object.keys(n))if(n[d]())return!0;return!1};f.getImage=(d,g,x=!0)=>new Promise((b,v)=>{fs.supported&&(d.headers||(d.headers={}),d.headers.accept="image/webp,*/*"),Z(d,{type:"image"});let P={abortController:g,requestParameters:d,supportImageRefresh:x,state:"queued",onError:w=>{v(w)},onSuccess:w=>{b(w)}};t.push(P),p()});let u=d=>typeof createImageBitmap=="function"?Zb(d):qb(d),c=async d=>{d.state="running";let{requestParameters:g,supportImageRefresh:x,onError:b,onSuccess:v,abortController:P}=d,w=x===!1&&!Cn(self)&&!fc(g.url)&&(!g.headers||Object.keys(g.headers).reduce((S,I)=>S&&I==="accept",!0));e++;let T=w?h(g,P):Vo(g,P);try{let S=await T;if(delete d.abortController,d.state="completed",S.data instanceof HTMLImageElement||$t(S.data))v(S);else if(S.data){let I=await u(S.data);v({data:I,cacheControl:S.cacheControl,expires:S.expires})}}catch(S){delete d.abortController,b(S)}finally{e--,p()}},p=()=>{let d=s()?Kt.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:Kt.MAX_PARALLEL_IMAGE_REQUESTS;for(let g=e;g<d&&t.length>0;g++){let x=t.shift();if(x.abortController.signal.aborted){g--;continue}c(x)}},h=(d,g)=>new Promise((x,b)=>{let v=new Image,P=d.url,w=d.credentials;w&&w==="include"?v.crossOrigin="use-credentials":(w&&w==="same-origin"||!sd(P))&&(v.crossOrigin="anonymous"),g.signal.addEventListener("abort",()=>{v.src="",b(Xi())}),v.fetchPriority="high",v.onload=()=>{v.onerror=v.onload=null,x({data:v})},v.onerror=()=>{v.onerror=v.onload=null,!g.signal.aborted&&b(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."))},v.src=P})})(jt||(jt={}));jt.resetRequestQueue();m();var yc=class{constructor(e){this._transformRequestFn=e}transformRequest(e,r){return this._transformRequestFn?this._transformRequestFn(e,r)||{url:e}:{url:e}}setTransformRequest(e){this._transformRequestFn=e}};m();m();function l_(t,e,r){r[t]&&r[t].indexOf(e)!==-1||(r[t]=r[t]||[],r[t].push(e))}function ud(t,e,r){if(r&&r[t]){let n=r[t].indexOf(e);n!==-1&&r[t].splice(n,1)}}var U=class{constructor(e,r={}){Z(this,r),this.type=e}},Q=class extends U{constructor(e,r={}){super("error",Z({error:e},r))}},Ee=class{on(e,r){return this._listeners=this._listeners||{},l_(e,r,this._listeners),{unsubscribe:()=>{this.off(e,r)}}}off(e,r){return ud(e,r,this._listeners),ud(e,r,this._oneTimeListeners),this}once(e,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},l_(e,r,this._oneTimeListeners),this):new Promise(n=>this.once(e,n))}fire(e,r){typeof e=="string"&&(e=new U(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)ud(n,s,this._oneTimeListeners),s.call(this,e);let a=this._eventedParent;a&&(Z(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),a.fire(e))}else e instanceof Q&&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}};m();m();m();m();var xL=8,bL={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"}},_L={"*":{type:"source"}},vL=["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],PL={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:"*"}},wL={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:"*"}},TL={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:"*"}},SL={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"}},CL={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"}}},ML={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"}}},IL={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"}},AL=["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],EL={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},LL={"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"}},DL={"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"}},RL={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},kL={"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"}},FL={"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"}},OL={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},BL={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},zL={type:"array",value:"*"},VL={type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},UL={type:"enum",values:{Point:{},LineString:{},Polygon:{}}},NL={type:"array",minimum:0,maximum:24,value:["number","color"],length:2},GL={type:"array",value:"*",minimum:1},jL={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}},HL={"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}},XL={source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},ZL={type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},qL=["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],YL={"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"}},WL={"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"}},$L={"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"}},KL={"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"}},JL={"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"}},QL={"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"}},eD={"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"}},tD={"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"}},rD={duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},nD={"*":{type:"string"}},D={$version:xL,$root:bL,sources:_L,source:vL,source_vector:PL,source_raster:wL,source_raster_dem:TL,source_geojson:SL,source_video:CL,source_image:ML,layer:IL,layout:AL,layout_background:EL,layout_fill:LL,layout_circle:DL,layout_heatmap:RL,"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:kL,layout_symbol:FL,layout_raster:OL,layout_hillshade:BL,"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:zL,filter_operator:VL,geometry_type:UL,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:NL,expression:GL,light:jL,sky:HL,terrain:XL,projection:ZL,paint:qL,paint_fill:YL,"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:WL,paint_circle:$L,paint_heatmap:KL,paint_symbol:JL,paint_raster:QL,paint_hillshade:eD,"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:tD,transition:rD,"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:nD},iD=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function oD(t,e){let r={};for(let n in t)n!=="ref"&&(r[n]=t[n]);return iD.forEach(n=>{n in e&&(r[n]=e[n])}),r}function Od(t){t=t.slice();let e=Object.create(null);for(let r=0;r<t.length;r++)e[t[r].id]=t[r];for(let r=0;r<t.length;r++)"ref"in t[r]&&(t[r]=oD(t[r],e[t[r].ref]));return t}function Ge(t,e){if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(!Ge(t[r],e[r]))return!1;return!0}if(typeof t=="object"&&t!==null&&e!==null){if(typeof e!="object"||Object.keys(t).length!==Object.keys(e).length)return!1;for(let n in t)if(!Ge(t[n],e[n]))return!1;return!0}return t===e}function kr(t,e){t.push(e)}function L_(t,e,r){kr(r,{command:"addSource",args:[t,e[t]]})}function D_(t,e,r){kr(e,{command:"removeSource",args:[t]}),r[t]=!0}function aD(t,e,r,n){D_(t,r,n),L_(t,e,r)}function sD(t,e,r){let n;for(n in t[r])if(Object.prototype.hasOwnProperty.call(t[r],n)&&n!=="data"&&!Ge(t[r][n],e[r][n]))return!1;for(n in e[r])if(Object.prototype.hasOwnProperty.call(e[r],n)&&n!=="data"&&!Ge(t[r][n],e[r][n]))return!1;return!0}function lD(t,e,r,n){t=t||{},e=e||{};let i;for(i in t)Object.prototype.hasOwnProperty.call(t,i)&&(Object.prototype.hasOwnProperty.call(e,i)||D_(i,r,n));for(i in e)Object.prototype.hasOwnProperty.call(e,i)&&(Object.prototype.hasOwnProperty.call(t,i)?Ge(t[i],e[i])||(t[i].type==="geojson"&&e[i].type==="geojson"&&sD(t,e,i)?kr(r,{command:"setGeoJSONSourceData",args:[i,e[i].data]}):aD(i,e,r,n)):L_(i,e,r))}function gc(t,e,r,n,i,o){t=t||{},e=e||{};for(let a in t)Object.prototype.hasOwnProperty.call(t,a)&&(Ge(t[a],e[a])||r.push({command:o,args:[n,a,e[a],i]}));for(let a in e)!Object.prototype.hasOwnProperty.call(e,a)||Object.prototype.hasOwnProperty.call(t,a)||Ge(t[a],e[a])||r.push({command:o,args:[n,a,e[a],i]})}function u_(t){return t.id}function c_(t,e){return t[e.id]=e,t}function uD(t,e,r){t=t||[],e=e||[];let n=t.map(u_),i=e.map(u_),o=t.reduce(c_,{}),a=e.reduce(c_,{}),s=n.slice(),l=Object.create(null),u,c,p,h,f;for(let d=0,g=0;d<n.length;d++)u=n[d],Object.prototype.hasOwnProperty.call(a,u)?g++:(kr(r,{command:"removeLayer",args:[u]}),s.splice(s.indexOf(u,g),1));for(let d=0,g=0;d<i.length;d++)u=i[i.length-1-d],s[s.length-1-d]!==u&&(Object.prototype.hasOwnProperty.call(o,u)?(kr(r,{command:"removeLayer",args:[u]}),s.splice(s.lastIndexOf(u,s.length-g),1)):g++,h=s[s.length-d],kr(r,{command:"addLayer",args:[a[u],h]}),s.splice(s.length-d,0,u),l[u]=!0);for(let d=0;d<i.length;d++)if(u=i[d],c=o[u],p=a[u],!(l[u]||Ge(c,p))){if(!Ge(c.source,p.source)||!Ge(c["source-layer"],p["source-layer"])||!Ge(c.type,p.type)){kr(r,{command:"removeLayer",args:[u]}),h=s[s.lastIndexOf(u)+1],kr(r,{command:"addLayer",args:[p,h]});continue}gc(c.layout,p.layout,r,u,null,"setLayoutProperty"),gc(c.paint,p.paint,r,u,null,"setPaintProperty"),Ge(c.filter,p.filter)||kr(r,{command:"setFilter",args:[u,p.filter]}),(!Ge(c.minzoom,p.minzoom)||!Ge(c.maxzoom,p.maxzoom))&&kr(r,{command:"setLayerZoomRange",args:[u,p.minzoom,p.maxzoom]});for(f in c)Object.prototype.hasOwnProperty.call(c,f)&&(f==="layout"||f==="paint"||f==="filter"||f==="metadata"||f==="minzoom"||f==="maxzoom"||(f.indexOf("paint.")===0?gc(c[f],p[f],r,u,f.slice(6),"setPaintProperty"):Ge(c[f],p[f])||kr(r,{command:"setLayerProperty",args:[u,f,p[f]]})));for(f in p)!Object.prototype.hasOwnProperty.call(p,f)||Object.prototype.hasOwnProperty.call(c,f)||f==="layout"||f==="paint"||f==="filter"||f==="metadata"||f==="minzoom"||f==="maxzoom"||(f.indexOf("paint.")===0?gc(c[f],p[f],r,u,f.slice(6),"setPaintProperty"):Ge(c[f],p[f])||kr(r,{command:"setLayerProperty",args:[u,f,p[f]]}))}}function R_(t,e){if(!t)return[{command:"setStyle",args:[e]}];let r=[];try{if(!Ge(t.version,e.version))return[{command:"setStyle",args:[e]}];Ge(t.center,e.center)||r.push({command:"setCenter",args:[e.center]}),Ge(t.state,e.state)||r.push({command:"setGlobalState",args:[e.state]}),Ge(t.centerAltitude,e.centerAltitude)||r.push({command:"setCenterAltitude",args:[e.centerAltitude]}),Ge(t.zoom,e.zoom)||r.push({command:"setZoom",args:[e.zoom]}),Ge(t.bearing,e.bearing)||r.push({command:"setBearing",args:[e.bearing]}),Ge(t.pitch,e.pitch)||r.push({command:"setPitch",args:[e.pitch]}),Ge(t.roll,e.roll)||r.push({command:"setRoll",args:[e.roll]}),Ge(t.sprite,e.sprite)||r.push({command:"setSprite",args:[e.sprite]}),Ge(t.glyphs,e.glyphs)||r.push({command:"setGlyphs",args:[e.glyphs]}),Ge(t.transition,e.transition)||r.push({command:"setTransition",args:[e.transition]}),Ge(t.light,e.light)||r.push({command:"setLight",args:[e.light]}),Ge(t.terrain,e.terrain)||r.push({command:"setTerrain",args:[e.terrain]}),Ge(t.sky,e.sky)||r.push({command:"setSky",args:[e.sky]}),Ge(t.projection,e.projection)||r.push({command:"setProjection",args:[e.projection]});let n={},i=[];lD(t.sources,e.sources,i,n);let o=[];t.layers&&t.layers.forEach(a=>{"source"in a&&n[a.source]?r.push({command:"removeLayer",args:[a.id]}):o.push(a)}),r=r.concat(i),uD(o,e.layers,r)}catch(n){console.warn("Unable to compute style diff:",n),r=[{command:"setStyle",args:[e]}]}return r}var G=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 Ho(t,...e){for(let r of e)for(let n in r)t[n]=r[n];return t}var Fr=class extends Error{constructor(e,r){super(r),this.message=r,this.key=e}},bd=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}},Yo={kind:"null"},Y={kind:"number"},Pe={kind:"string"},ge={kind:"boolean"},Br={kind:"color"},Oc={kind:"projectionDefinition"},Wi={kind:"object"},me={kind:"value"},cD={kind:"error"},Bc={kind:"collator"},Wo={kind:"formatted"},zc={kind:"padding"},gs={kind:"colorArray"},Vc={kind:"numberArray"},Ls={kind:"resolvedImage"},Uc={kind:"variableAnchorOffsetCollection"};function yr(t,e){return{kind:"array",itemType:t,N:e}}function ot(t){if(t.kind==="array"){let e=ot(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 pD=[Yo,Y,Pe,ge,Br,Oc,Wo,Wi,yr(me),zc,Vc,gs,Ls,Uc];function xs(t,e){if(e.kind==="error")return null;if(t.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!xs(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 pD)if(!xs(r,e))return null}}return"Expected ".concat(ot(t)," but found ").concat(ot(e)," instead.")}function Bd(t,e){return e.some(r=>r.kind===t.kind)}function $i(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 ei(t,e){return t.kind==="array"&&e.kind==="array"?t.itemType.kind===e.itemType.kind&&typeof t.N=="number":t.kind===e.kind}var k_=.96422,F_=1,O_=.82521,B_=4/29,jo=6/29,z_=3*jo*jo,hD=jo*jo*jo,fD=Math.PI/180,mD=180/Math.PI;function V_(t){return t=t%360,t<0&&(t+=360),t}function U_([t,e,r,n]){t=cd(t),e=cd(e),r=cd(r);let i,o,a=pd((.2225045*t+.7168786*e+.0606169*r)/F_);t===e&&e===r?i=o=a:(i=pd((.4360747*t+.3850649*e+.1430804*r)/k_),o=pd((.0139322*t+.0971045*e+.7141733*r)/O_));let s=116*a-16;return[s<0?0:s,500*(i-a),200*(a-o),n]}function cd(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function pd(t){return t>hD?Math.pow(t,1/3):t/z_+B_}function N_([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=F_*fd(i),o=k_*fd(o),a=O_*fd(a),[hd(3.1338561*o-1.6168667*i-.4906146*a),hd(-.9787684*o+1.9161415*i+.033454*a),hd(.0719453*o-.2289914*i+1.4052427*a),n]}function hd(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 fd(t){return t>jo?t*t*t:z_*(t-B_)}function dD(t){let[e,r,n,i]=U_(t),o=Math.sqrt(r*r+n*n);return[Math.round(o*1e4)?V_(Math.atan2(n,r)*mD):NaN,o,e,i]}function yD([t,e,r,n]){return t=isNaN(t)?0:t*fD,N_([r,Math.cos(t)*e,Math.sin(t)*e,n])}function gD([t,e,r,n]){t=V_(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 xD=Object.hasOwn||function(e,r){return Object.prototype.hasOwnProperty.call(e,r)};function ds(t,e){return xD(t,e)?t[e]:void 0}function bD(t){if(t=t.toLowerCase().trim(),t==="transparent")return[0,0,0,0];let e=ds(_D,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[xc(t.slice(a,a+=o)),xc(t.slice(a,a+=o)),xc(t.slice(a,a+=o)),xc(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,h,f,d,g,x,b]=o,v=[u||" ",h||" ",g].join("");if(v===" "||v===" /"||v===",,"||v===",,,"){let P=[l,p,d].join(""),w=P==="%%%"?100:P===""?255:0;if(w){let T=[No(+s/w,0,1),No(+c/w,0,1),No(+f/w,0,1),x?p_(+x,b):1];if(h_(T))return T}}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,h]=n,f=[a||" ",l||" ",c].join("");if(f===" "||f===" /"||f===",,"||f===",,,"){let d=[+o,No(+s,0,100),No(+u,0,100),p?p_(+p,h):1];if(h_(d))return gD(d)}}}function xc(t){return parseInt(t.padEnd(2,t),16)/255}function p_(t,e){return No(e?t/100:t,0,1)}function No(t,e,r){return Math.min(Math.max(e,t),r)}function h_(t){return!t.some(Number.isNaN)}var _D={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 ri(t,e,r){return t+r*(e-t)}function Xo(t,e,r){return t.map((n,i)=>ri(n,e[i],r))}function vD(t){return t==="rgb"||t==="hcl"||t==="lab"}var K=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=bD(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",dD(this.rgb))}get lab(){return this.overwriteGetter("lab",U_(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]=Xo(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,h]=r.hcl,f,d;if(!isNaN(o)&&!isNaN(u)){let P=u-o;u>o&&P>180?P-=360:u<o&&o-u>180&&(P+=360),f=o+n*P}else isNaN(o)?isNaN(u)?f=NaN:(f=u,(s===1||s===0)&&(d=c)):(f=o,(p===1||p===0)&&(d=a));let[g,x,b,v]=yD([f,d!=null?d:ri(a,c,n),ri(s,p,n),ri(l,h,n)]);return new t(g,x,b,v,!1)}case"lab":{let[o,a,s,l]=N_(Xo(e.lab,r.lab,n));return new t(o,a,s,l,!1)}}}};K.black=new K(0,0,0,1);K.white=new K(1,1,1,1);K.transparent=new K(0,0,0,0);K.red=new K(1,0,0,1);var bs=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}},PD=["bottom","center","top"],_s=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}},gr=class t{constructor(e){this.sections=e}static fromString(e){return new t([new _s(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("")}},zr=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(Xo(e.values,r.values,n))}},Vr=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(Xo(e.values,r.values,n))}},Jt=class t{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof t)return e;if(typeof e=="string"){let n=K.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=K.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(K.interpolate(e.values[a],r.values[a],n,i));return new t(o)}},Je=class extends Error{constructor(e){super(e),this.name="RuntimeError"}toJSON(){return this.message}},wD=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]),ln=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"||!wD.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 Je("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 Je("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([ri(l,c,n),ri(u,p,n)])}return new t(a)}},Qt=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}},un=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 G_(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 vs(t){if(t===null||typeof t=="string"||typeof t=="boolean"||typeof t=="number"||t instanceof un||t instanceof K||t instanceof bs||t instanceof gr||t instanceof zr||t instanceof Vr||t instanceof Jt||t instanceof ln||t instanceof Qt)return!0;if(Array.isArray(t)){for(let e of t)if(!vs(e))return!1;return!0}else if(typeof t=="object"){for(let e in t)if(!vs(t[e]))return!1;return!0}else return!1}function ht(t){if(t===null)return Yo;if(typeof t=="string")return Pe;if(typeof t=="boolean")return ge;if(typeof t=="number")return Y;if(t instanceof K)return Br;if(t instanceof un)return Oc;if(t instanceof bs)return Bc;if(t instanceof gr)return Wo;if(t instanceof zr)return zc;if(t instanceof Vr)return Vc;if(t instanceof Jt)return gs;if(t instanceof ln)return Uc;if(t instanceof Qt)return Ls;if(Array.isArray(t)){let e=t.length,r;for(let n of t){let i=ht(n);if(!r)r=i;else{if(r===i)continue;r=me;break}}return yr(r||me,e)}else return Wi}function ys(t){let e=typeof t;return t===null?"":e==="string"||e==="number"||e==="boolean"?String(t):t instanceof K||t instanceof un||t instanceof gr||t instanceof zr||t instanceof Vr||t instanceof Jt||t instanceof ln||t instanceof Qt?t.toString():JSON.stringify(t)}var ni=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(!vs(e[1]))return r.error("invalid value");let n=e[1],i=ht(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}},bc={string:Pe,number:Y,boolean:ge,object:Wi},qr=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 bc)||u==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);s=bc[u],n++}else s=me;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=yr(s,l)}else{if(!bc[o])throw new Error("Types doesn't contain name = ".concat(o));i=bc[o]}let a=[];for(;n<e.length;n++){let s=r.parse(e[n],n,me);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(xs(this.type,ht(n))){if(r===this.args.length-1)throw new Je("Expected value to be of type ".concat(ot(this.type),", but found ").concat(ot(ht(n))," instead."))}else return n}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},f_={"to-boolean":ge,"to-color":Br,"to-number":Y,"to-string":Pe},ti=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(!f_[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=f_[n],o=[];for(let a=1;a<e.length;a++){let s=r.parse(e[a],a,me);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 K)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=G_(r[0],r[1],r[2],r[3]),!n))return new K(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new Je(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=zr.parse(r);if(i)return i}throw new Je("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=Vr.parse(r);if(i)return i}throw new Je("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=Jt.parse(r);if(i)return i}throw new Je("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=ln.parse(r);if(i)return i}throw new Je("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 Je("Could not convert ".concat(JSON.stringify(r)," to number."))}case"formatted":return gr.fromString(ys(this.args[0].evaluate(e)));case"resolvedImage":return Qt.fromString(ys(this.args[0].evaluate(e)));case"projectionDefinition":return this.args[0].evaluate(e);default:return ys(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},TD=["Unknown","Point","LineString","Polygon"],wc=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"?TD[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=K.parse(e),this._parseColorCache.set(e,r)),r}},Tc=class t{constructor(e,r,n=[],i,o=new bd,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 qr(o,[i]):a==="coerce"?new ti(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 ni)&&a.type.kind!=="resolvedImage"&&this._isConstant(a)){let s=new wc;try{a=new ni(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 Fr(n,e))}checkSubtype(e,r){let n=xs(e,r);return n&&this.error(n),n}},Sc=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()}},Cc=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}},_d=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,Y),i=r.parse(e[2],2,yr(r.expectedType||me));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 Je("Array index out of bounds: ".concat(r," < 0."));if(r>=n.length)throw new Je("Array index out of bounds: ".concat(r," > ").concat(n.length-1,"."));if(r!==Math.floor(r))throw new Je("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}},vd=class t{constructor(e,r){this.type=ge,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,me),i=r.parse(e[2],2,me);return!n||!i?null:Bd(n.type,[ge,Pe,Y,Yo,me])?new t(n,i):r.error("Expected first argument to be of type boolean, string, number or null, but found ".concat(ot(n.type)," instead"))}evaluate(e){let r=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!n)return!1;if(!$i(r,["boolean","string","number","null"]))throw new Je("Expected first argument to be of type boolean, string, number or null, but found ".concat(ot(ht(r))," instead."));if(!$i(n,["string","array"]))throw new Je("Expected second argument to be of type array or string, but found ".concat(ot(ht(n))," instead."));return n.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}},Pd=class t{constructor(e,r,n){this.type=Y,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,me),i=r.parse(e[2],2,me);if(!n||!i)return null;if(!Bd(n.type,[ge,Pe,Y,Yo,me]))return r.error("Expected first argument to be of type boolean, string, number or null, but found ".concat(ot(n.type)," instead"));if(e.length===4){let o=r.parse(e[3],3,Y);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(!$i(r,["boolean","string","number","null"]))throw new Je("Expected first argument to be of type boolean, string, number or null, but found ".concat(ot(ht(r))," instead."));let i;if(this.fromIndex&&(i=this.fromIndex.evaluate(e)),$i(n,["string"])){let o=n.indexOf(r,i);return o===-1?-1:[...n.slice(0,o)].length}else{if($i(n,["array"]))return n.indexOf(r,i);throw new Je("Expected second argument to be of type array or string, but found ".concat(ot(ht(n))," instead."))}}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}},wd=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 h=r.concat(u);if(c.length===0)return h.error("Expected at least one branch label.");for(let d of c){if(typeof d!="number"&&typeof d!="string")return h.error("Branch labels must be numbers or strings.");if(typeof d=="number"&&Math.abs(d)>Number.MAX_SAFE_INTEGER)return h.error("Branch labels must be integers no larger than ".concat(Number.MAX_SAFE_INTEGER,"."));if(typeof d=="number"&&Math.floor(d)!==d)return h.error("Numeric branch labels must be integer values.");if(!n)n=ht(d);else if(h.checkSubtype(n,ht(d)))return null;if(typeof o[String(d)]<"u")return h.error("Branch labels must be unique.");o[String(d)]=a.length}let f=r.parse(p,u,i);if(!f)return null;i=i||f.type,a.push(f)}let s=r.parse(e[1],1,me);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(ht(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()}},Td=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,ge);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()}},Sd=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,me),i=r.parse(e[2],2,Y);if(!n||!i)return null;if(!Bd(n.type,[yr(me),Pe,me]))return r.error("Expected first argument to be of type array or string, but found ".concat(ot(n.type)," instead"));if(e.length===4){let o=r.parse(e[3],3,Y);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)),$i(r,["string"]))return[...r].slice(n,i).join("");if($i(r,["array"]))return r.slice(n,i);throw new Je("Expected first argument to be of type array or string, but found ".concat(ot(ht(r))," instead."))}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}};function Nc(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 Je("Input is not a number.");return 0}var Zo=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,Y);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=Nc(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 SD(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var md,m_;function CD(){if(m_)return md;m_=1,md=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))}},md}var MD=CD(),ID=SD(MD),Ht=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=dd(r,e.base,n,i);else if(e.name==="linear")o=dd(r,1,n,i);else if(e.name==="cubic-bezier"){let a=e.controlPoints;o=new ID(a[0],a[1],a[2],a[3]).solve(dd(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,Y),!o)return null;let s=[],l=null;(n==="interpolate-hcl"||n==="interpolate-lab")&&r.expectedType!=gs?l=Br: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],h=u+3,f=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.',h);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.',h);let d=r.parse(p,f,l);if(!d)return null;l=l||d.type,s.push([c,d])}return!ei(l,Y)&&!ei(l,Oc)&&!ei(l,Br)&&!ei(l,zc)&&!ei(l,Vc)&&!ei(l,gs)&&!ei(l,Uc)&&!ei(l,yr(Y))?r.error("Type ".concat(ot(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=Nc(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 ri(c,p,u);case"color":return K.interpolate(c,p,u);case"padding":return zr.interpolate(c,p,u);case"colorArray":return Jt.interpolate(c,p,u);case"numberArray":return Vr.interpolate(c,p,u);case"variableAnchorOffsetCollection":return ln.interpolate(c,p,u);case"array":return Xo(c,p,u);case"projectionDefinition":return un.interpolate(c,p,u)}case"interpolate-hcl":switch(this.type.kind){case"color":return K.interpolate(c,p,u,"hcl");case"colorArray":return Jt.interpolate(c,p,u,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return K.interpolate(c,p,u,"lab");case"colorArray":return Jt.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 dd(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 Fe={color:K.interpolate,number:ri,padding:zr.interpolate,numberArray:Vr.interpolate,colorArray:Jt.interpolate,variableAnchorOffsetCollection:ln.interpolate,array:Xo},Mc=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=>xs(i,s.type))?new t(me,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 Qt&&!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 d_(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 AD(t,e,r){return e===r}function ED(t,e,r){return e!==r}function LD(t,e,r){return e<r}function DD(t,e,r){return e>r}function RD(t,e,r){return e<=r}function kD(t,e,r){return e>=r}function j_(t,e,r,n){return n.compare(e,r)===0}function FD(t,e,r,n){return!j_(t,e,r,n)}function OD(t,e,r,n){return n.compare(e,r)<0}function BD(t,e,r,n){return n.compare(e,r)>0}function zD(t,e,r,n){return n.compare(e,r)<=0}function VD(t,e,r,n){return n.compare(e,r)>=0}function $o(t,e,r){let n=t!=="=="&&t!=="!=";return class H_{constructor(o,a,s){this.type=ge,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,me);if(!l)return null;if(!d_(s,l.type))return a.concat(1).error('"'.concat(s,"\" comparisons are not supported for type '").concat(ot(l.type),"'."));let u=a.parse(o[2],2,me);if(!u)return null;if(!d_(s,u.type))return a.concat(2).error('"'.concat(s,"\" comparisons are not supported for type '").concat(ot(u.type),"'."));if(l.type.kind!==u.type.kind&&l.type.kind!=="value"&&u.type.kind!=="value")return a.error("Cannot compare types '".concat(ot(l.type),"' and '").concat(ot(u.type),"'."));n&&(l.type.kind==="value"&&u.type.kind!=="value"?l=new qr(u.type,[l]):l.type.kind!=="value"&&u.type.kind==="value"&&(u=new qr(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,Bc),!c)return null}return new H_(l,u,c)}evaluate(o){let a=this.lhs.evaluate(o),s=this.rhs.evaluate(o);if(n&&this.hasUntypedArgument){let l=ht(a),u=ht(s);if(l.kind!==u.kind||!(l.kind==="string"||l.kind==="number"))throw new Je('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=ht(a),u=ht(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 UD=$o("==",AD,j_),ND=$o("!=",ED,FD),GD=$o("<",LD,OD),jD=$o(">",DD,BD),HD=$o("<=",RD,zD),XD=$o(">=",kD,VD),Ic=class t{constructor(e,r,n){this.type=Bc,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,ge);if(!i)return null;let o=r.parse(n["diacritic-sensitive"]===void 0?!1:n["diacritic-sensitive"],1,ge);if(!o)return null;let a=null;return n.locale&&(a=r.parse(n.locale,1,Pe),!a)?null:new t(i,o,a)}evaluate(e){return new bs(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}},Cd=class t{constructor(e,r,n,i,o){this.type=Pe,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,Y);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,Pe),!o))return null;let a=null;if(i.currency&&(a=r.parse(i.currency,1,Pe),!a))return null;let s=null;if(i["min-fraction-digits"]&&(s=r.parse(i["min-fraction-digits"],1,Y),!s))return null;let l=null;return i["max-fraction-digits"]&&(l=r.parse(i["max-fraction-digits"],1,Y),!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}},Ps=class t{constructor(e){this.type=Wo,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,Y),!l))return null;let u=null;if(s["text-font"]&&(u=r.parse(s["text-font"],1,yr(Pe)),!u))return null;let c=null;if(s["text-color"]&&(c=r.parse(s["text-color"],1,Br),!c))return null;let p=null;if(s["vertical-align"]){if(typeof s["vertical-align"]=="string"&&!PD.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,Pe),!p)return null}let h=i[i.length-1];h.scale=l,h.font=u,h.textColor=c,h.verticalAlign=p}else{let l=r.parse(e[a],1,me);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 ht(i)===Ls?new _s("",i,null,null,null,n.verticalAlign?n.verticalAlign.evaluate(e):null):new _s(ys(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 gr(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}},Md=class t{constructor(e){this.type=Ls,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");let n=r.parse(e[1],1,Pe);return n?new t(n):r.error("No image name provided.")}evaluate(e){let r=this.input.evaluate(e),n=Qt.fromString(r);return n&&e.availableImages&&(n.available=e.availableImages.indexOf(r)>-1),n}eachChild(e){e(this.input)}outputDefined(){return!1}},Id=class t{constructor(e){this.type=Y,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(ot(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 Je("Expected value to be of type string or array, but found ".concat(ot(ht(r))," instead."))}eachChild(e){e(this.input)}outputDefined(){return!1}},sn=8192;function ZD(t,e){let r=qD(t[0]),n=WD(t[1]),i=Math.pow(2,e.z);return[Math.round(r*i*sn),Math.round(n*i*sn)]}function zd(t,e){let r=Math.pow(2,e.z),n=(t[0]/sn+e.x)/r,i=(t[1]/sn+e.y)/r;return[YD(n),$D(i)]}function qD(t){return(180+t)/360}function YD(t){return t*360-180}function WD(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function $D(t){return 360/Math.PI*Math.atan(Math.exp((180-t*360)*Math.PI/180))-90}function Ds(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 ws(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function KD(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 JD(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 Gc(t,e,r,n){let i=[e[0]-t[0],e[1]-t[1]],o=[n[0]-r[0],n[1]-r[1]];return rR(o,i)===0?!1:!!(y_(t,e,r,n)&&y_(r,n,t,e))}function QD(t,e,r){for(let n of r)for(let i=0;i<n.length-1;++i)if(Gc(t,e,n[i],n[i+1]))return!0;return!1}function Ko(t,e,r=!1){let n=!1;for(let i of e)for(let o=0;o<i.length-1;o++){if(JD(t,i[o],i[o+1]))return r;KD(t,i[o],i[o+1])&&(n=!n)}return n}function eR(t,e){for(let r of e)if(Ko(t,r))return!0;return!1}function X_(t,e){for(let r of t)if(!Ko(r,e))return!1;for(let r=0;r<t.length-1;++r)if(QD(t[r],t[r+1],e))return!1;return!0}function tR(t,e){for(let r of e)if(X_(t,r))return!0;return!1}function rR(t,e){return t[0]*e[1]-t[1]*e[0]}function y_(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 Vd(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=ZD(t[i][a],r);Ds(e,s),o.push(s)}n.push(o)}return n}function Z_(t,e,r){let n=[];for(let i=0;i<t.length;i++){let o=Vd(t[i],e,r);n.push(o)}return n}function q_(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}Ds(e,t)}function nR(t){t[0]=t[1]=1/0,t[2]=t[3]=-1/0}function g_(t,e,r,n){let i=Math.pow(2,n.z)*sn,o=[n.x*sn,n.y*sn],a=[];for(let s of t)for(let l of s){let u=[l.x+o[0],l.y+o[1]];q_(u,e,r,i),a.push(u)}return a}function x_(t,e,r,n){let i=Math.pow(2,n.z)*sn,o=[n.x*sn,n.y*sn],a=[];for(let s of t){let l=[];for(let u of s){let c=[u.x+o[0],u.y+o[1]];Ds(e,c),l.push(c)}a.push(l)}if(e[2]-e[0]<=i/2){nR(e);for(let s of a)for(let l of s)q_(l,e,r,i)}return a}function iR(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=Vd(e.coordinates,n,i),a=g_(t.geometry(),r,n,i);if(!ws(r,n))return!1;for(let s of a)if(!Ko(s,o))return!1}if(e.type==="MultiPolygon"){let o=Z_(e.coordinates,n,i),a=g_(t.geometry(),r,n,i);if(!ws(r,n))return!1;for(let s of a)if(!eR(s,o))return!1}return!0}function oR(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=Vd(e.coordinates,n,i),a=x_(t.geometry(),r,n,i);if(!ws(r,n))return!1;for(let s of a)if(!X_(s,o))return!1}if(e.type==="MultiPolygon"){let o=Z_(e.coordinates,n,i),a=x_(t.geometry(),r,n,i);if(!ws(r,n))return!1;for(let s of a)if(!tR(s,o))return!1}return!0}var Ts=class t{constructor(e,r){this.type=ge,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(vs(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 iR(e,this.geometries);if(e.geometryType()==="LineString")return oR(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}},Ac=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 Y_(t,e,r=0,n=t.length-1,i=aR){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),h=.5*Math.sqrt(c*p*(l-p)/l)*(u-l/2<0?-1:1),f=Math.max(r,Math.floor(e-u*p/l+h)),d=Math.min(n,Math.floor(e+(l-u)*p/l+h));Y_(t,e,f,d,i)}let o=t[e],a=r,s=n;for(ms(t,r,e),i(t[n],o)>0&&ms(t,r,n);a<s;){for(ms(t,a,s),a++,s--;i(t[a],o)<0;)a++;for(;i(t[s],o)>0;)s--}i(t[r],o)===0?ms(t,r,s):(s++,ms(t,s,n)),s<=e&&(r=s+1),e<=s&&(n=s-1)}}function ms(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}function aR(t,e){return t<e?-1:t>e?1:0}function Rs(t,e){if(t.length<=1)return[t];let n=[],i,o;for(let a of t){let s=lR(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||(Y_(n[a],e,1,n[a].length-1,sR),n[a]=n[a].slice(0,e));return n}function sR(t,e){return e.area-t.area}function lR(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 uR=6378.137,b_=1/298.257223563,__=b_*(2-b_),v_=Math.PI/180,Ss=class{constructor(e){let r=v_*uR*1e3,n=Math.cos(e*v_),i=1/(1-__*(1-n*n)),o=Math.sqrt(i);this.kx=r*o*n,this.ky=r*o*i*(1-__)}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,h=(e[l+1][1]-c)*this.ky,f=0;(p!==0||h!==0)&&(f=(this.wrap(r[0]-u)*this.kx*p+(r[1]-c)*this.ky*h)/(p*p+h*h),f>1?(u=e[l+1][0],c=e[l+1][1]):f>0&&(u+=p/this.kx*f,c+=h/this.ky*f)),p=this.wrap(r[0]-u)*this.kx,h=(r[1]-c)*this.ky;let d=p*p+h*h;d<n&&(n=d,i=u,o=c,a=l,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}},Ad=100,Ed=50;function W_(t,e){return e[0]-t[0]}function Ec(t){return t[1]-t[0]+1}function Mn(t,e){return t[1]>=t[0]&&t[1]<e}function Ld(t,e){if(t[0]>t[1])return[null,null];let r=Ec(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 Dd(t,e){if(!Mn(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)Ds(r,t[n]);return r}function Rd(t){let e=[1/0,1/0,-1/0,-1/0];for(let r of t)for(let n of r)Ds(e,n);return e}function P_(t){return t[0]!==-1/0&&t[1]!==-1/0&&t[2]!==1/0&&t[3]!==1/0}function Ud(t,e,r){if(!P_(t)||!P_(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 Yi(t,e,r){let n=r.pointOnLine(e,t);return r.distance(t,n.point)}function Nd(t,e,r,n,i){let o=Math.min(Yi(t,[r,n],i),Yi(e,[r,n],i)),a=Math.min(Yi(r,[t,e],i),Yi(n,[t,e],i));return Math.min(o,a)}function cR(t,e,r,n,i){if(!(Mn(e,t.length)&&Mn(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],h=r[c+1];if(Gc(l,u,p,h))return 0;a=Math.min(a,Nd(l,u,p,h,i))}}return a}function pR(t,e,r,n,i){if(!(Mn(e,t.length)&&Mn(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 hR(t,e,r){if(Ko(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,Yi(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 fR(t,e,r,n){if(!Mn(e,t.length))return NaN;for(let o=e[0];o<=e[1];++o)if(Ko(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 h=l[p],f=l[u];if(Gc(a,s,h,f))return 0;i=Math.min(i,Nd(a,s,h,f,n))}}return i}function w_(t,e){for(let r of t)for(let n of r)if(Ko(n,e,!0))return!0;return!1}function mR(t,e,r,n=1/0){let i=Rd(t),o=Rd(e);if(n!==1/0&&Ud(i,o,r)>=n)return n;if(ws(i,o)){if(w_(t,e))return 0}else if(w_(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],h=s[l];for(let f of e)for(let d=0,g=f.length,x=g-1;d<g;x=d++){let b=f[x],v=f[d];if(Gc(p,h,b,v))return 0;a=Math.min(a,Nd(p,h,b,v,r))}}return a}function T_(t,e,r,n,i,o){if(!o)return;let a=Ud(Dd(n,o),i,r);a<e&&t.push([a,o,[0,0]])}function _c(t,e,r,n,i,o,a){if(!o||!a)return;let s=Ud(Dd(n,o),Dd(i,a),r);s<e&&t.push([s,o,a])}function Lc(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 Ac([[0,[0,t.length-1],[0,0]]],W_),s=Rd(r);for(;a.length>0;){let l=a.pop();if(l[0]>=o)continue;let u=l[1],c=e?Ed:Ad;if(Ec(u)<=c){if(!Mn(u,t.length))return NaN;if(e){let p=fR(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 h=hR(t[p],r,n);if(o=Math.min(o,h),o===0)return 0}}else{let p=Ld(u,e);T_(a,o,n,t,s,p[0]),T_(a,o,n,t,s,p[1])}}return o}function Dc(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 Ac([[0,[0,t.length-1],[0,r.length-1]]],W_);for(;s.length>0;){let l=s.pop();if(l[0]>=a)continue;let u=l[1],c=l[2],p=e?Ed:Ad,h=n?Ed:Ad;if(Ec(u)<=p&&Ec(c)<=h){if(!Mn(u,t.length)&&Mn(c,r.length))return NaN;let f;if(e&&n)f=cR(t,u,r,c,i),a=Math.min(a,f);else if(e&&!n){let d=t.slice(u[0],u[1]+1);for(let g=c[0];g<=c[1];++g)if(f=Yi(r[g],d,i),a=Math.min(a,f),a===0)return a}else if(!e&&n){let d=r.slice(c[0],c[1]+1);for(let g=u[0];g<=u[1];++g)if(f=Yi(t[g],d,i),a=Math.min(a,f),a===0)return a}else f=pR(t,u,r,c,i),a=Math.min(a,f)}else{let f=Ld(u,e),d=Ld(c,n);_c(s,a,i,t,r,f[0],d[0]),_c(s,a,i,t,r,f[0],d[1]),_c(s,a,i,t,r,f[1],d[0]),_c(s,a,i,t,r,f[1],d[1])}}return a}function dR(t,e){let r=t.geometry(),n=r.flat().map(a=>zd([a.x,a.y],t.canonical));if(r.length===0)return NaN;let i=new Ss(n[0][1]),o=1/0;for(let a of e){switch(a.type){case"Point":o=Math.min(o,Dc(n,!1,[a.coordinates],!1,i,o));break;case"LineString":o=Math.min(o,Dc(n,!1,a.coordinates,!0,i,o));break;case"Polygon":o=Math.min(o,Lc(n,!1,a.coordinates,i,o));break}if(o===0)return o}return o}function yR(t,e){let r=t.geometry(),n=r.flat().map(a=>zd([a.x,a.y],t.canonical));if(r.length===0)return NaN;let i=new Ss(n[0][1]),o=1/0;for(let a of e){switch(a.type){case"Point":o=Math.min(o,Dc(n,!0,[a.coordinates],!1,i,o));break;case"LineString":o=Math.min(o,Dc(n,!0,a.coordinates,!0,i,o));break;case"Polygon":o=Math.min(o,Lc(n,!0,a.coordinates,i,o));break}if(o===0)return o}return o}function gR(t,e){let r=t.geometry();if(r.length===0||r[0].length===0)return NaN;let n=Rs(r,0).map(a=>a.map(s=>s.map(l=>zd([l.x,l.y],t.canonical)))),i=new Ss(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,Lc([a.coordinates],!1,s,i,o));break;case"LineString":o=Math.min(o,Lc(a.coordinates,!0,s,i,o));break;case"Polygon":o=Math.min(o,mR(s,a.coordinates,i,o));break}if(o===0)return o}return o}function yd(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 Cs=class t{constructor(e,r){this.type=Y,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(vs(e[1])){let n=e[1];if(n.type==="FeatureCollection")return new t(n,n.features.map(i=>yd(i.geometry)).flat());if(n.type==="Feature")return new t(n,yd(n.geometry));if("type"in n&&"coordinates"in n)return new t(n,yd(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 dR(e,this.geometries);if(e.geometryType()==="LineString")return yR(e,this.geometries);if(e.geometryType()==="Polygon")return gR(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}},Ms=class t{constructor(e){this.type=me,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:ds(n,this.key)}eachChild(){}outputDefined(){return!1}},eo={"==":UD,"!=":ND,">":jD,"<":GD,">=":XD,"<=":HD,array:qr,at:_d,boolean:qr,case:Td,coalesce:Mc,collator:Ic,format:Ps,image:Md,in:vd,"index-of":Pd,interpolate:Ht,"interpolate-hcl":Ht,"interpolate-lab":Ht,length:Id,let:Sc,literal:ni,match:wd,number:qr,"number-format":Cd,object:qr,slice:Sd,step:Zo,string:qr,"to-boolean":ti,"to-color":ti,"to-number":ti,"to-string":ti,var:Cc,within:Ts,distance:Cs,"global-state":Ms},cn=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 Tc(r.registry,Rc,r.path,null,r.scope);let p=[],h=!1;for(let f=1;f<e.length;f++){let d=e[f],g=Array.isArray(u)?u[f-1]:u.type,x=l.parse(d,1+p.length,g);if(!x){h=!0;break}p.push(x)}if(!h){if(Array.isArray(u)&&u.length!==p.length){l.error("Expected ".concat(u.length," arguments, but found ").concat(p.length," instead."));continue}for(let f=0;f<p.length;f++){let d=Array.isArray(u)?u[f]:u.type,g=p[f];l.concat(f+1).checkSubtype(d,g.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(([h])=>bR(h)).join(" | "),p=[];for(let h=1;h<e.length;h++){let f=r.parse(e[h],1+p.length);if(!f)return null;p.push(ot(f.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 S_(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=G_(e,r,n,o);if(a)throw new Je(a);return new K(e/255,r/255,n/255,o,!1)}function C_(t,e){return t in e}function gd(t,e){let r=e[t];return typeof r>"u"?null:r}function xR(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 qi(t){return{type:t}}cn.register(eo,{error:[cD,[Pe],(t,[e])=>{throw new Je(e.evaluate(t))}],typeof:[Pe,[me],(t,[e])=>ot(ht(e.evaluate(t)))],"to-rgba":[yr(Y,4),[Br],(t,[e])=>{let[r,n,i,o]=e.evaluate(t).rgb;return[r*255,n*255,i*255,o]}],rgb:[Br,[Y,Y,Y],S_],rgba:[Br,[Y,Y,Y,Y],S_],has:{type:ge,overloads:[[[Pe],(t,[e])=>C_(e.evaluate(t),t.properties())],[[Pe,Wi],(t,[e,r])=>C_(e.evaluate(t),r.evaluate(t))]]},get:{type:me,overloads:[[[Pe],(t,[e])=>gd(e.evaluate(t),t.properties())],[[Pe,Wi],(t,[e,r])=>gd(e.evaluate(t),r.evaluate(t))]]},"feature-state":[me,[Pe],(t,[e])=>gd(e.evaluate(t),t.featureState||{})],properties:[Wi,[],t=>t.properties()],"geometry-type":[Pe,[],t=>t.geometryType()],id:[me,[],t=>t.id()],zoom:[Y,[],t=>t.globals.zoom],"heatmap-density":[Y,[],t=>t.globals.heatmapDensity||0],elevation:[Y,[],t=>t.globals.elevation||0],"line-progress":[Y,[],t=>t.globals.lineProgress||0],accumulated:[me,[],t=>t.globals.accumulated===void 0?null:t.globals.accumulated],"+":[Y,qi(Y),(t,e)=>{let r=0;for(let n of e)r+=n.evaluate(t);return r}],"*":[Y,qi(Y),(t,e)=>{let r=1;for(let n of e)r*=n.evaluate(t);return r}],"-":{type:Y,overloads:[[[Y,Y],(t,[e,r])=>e.evaluate(t)-r.evaluate(t)],[[Y],(t,[e])=>-e.evaluate(t)]]},"/":[Y,[Y,Y],(t,[e,r])=>e.evaluate(t)/r.evaluate(t)],"%":[Y,[Y,Y],(t,[e,r])=>e.evaluate(t)%r.evaluate(t)],ln2:[Y,[],()=>Math.LN2],pi:[Y,[],()=>Math.PI],e:[Y,[],()=>Math.E],"^":[Y,[Y,Y],(t,[e,r])=>Math.pow(e.evaluate(t),r.evaluate(t))],sqrt:[Y,[Y],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[Y,[Y],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[Y,[Y],(t,[e])=>Math.log(e.evaluate(t))],log2:[Y,[Y],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[Y,[Y],(t,[e])=>Math.sin(e.evaluate(t))],cos:[Y,[Y],(t,[e])=>Math.cos(e.evaluate(t))],tan:[Y,[Y],(t,[e])=>Math.tan(e.evaluate(t))],asin:[Y,[Y],(t,[e])=>Math.asin(e.evaluate(t))],acos:[Y,[Y],(t,[e])=>Math.acos(e.evaluate(t))],atan:[Y,[Y],(t,[e])=>Math.atan(e.evaluate(t))],min:[Y,qi(Y),(t,e)=>Math.min(...e.map(r=>r.evaluate(t)))],max:[Y,qi(Y),(t,e)=>Math.max(...e.map(r=>r.evaluate(t)))],abs:[Y,[Y],(t,[e])=>Math.abs(e.evaluate(t))],round:[Y,[Y],(t,[e])=>{let r=e.evaluate(t);return r<0?-Math.round(-r):Math.round(r)}],floor:[Y,[Y],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[Y,[Y],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[ge,[Pe,me],(t,[e,r])=>t.properties()[e.value]===r.value],"filter-id-==":[ge,[me],(t,[e])=>t.id()===e.value],"filter-type-==":[ge,[Pe],(t,[e])=>t.geometryType()===e.value],"filter-<":[ge,[Pe,me],(t,[e,r])=>{let n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n<i}],"filter-id-<":[ge,[me],(t,[e])=>{let r=t.id(),n=e.value;return typeof r==typeof n&&r<n}],"filter->":[ge,[Pe,me],(t,[e,r])=>{let n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>i}],"filter-id->":[ge,[me],(t,[e])=>{let r=t.id(),n=e.value;return typeof r==typeof n&&r>n}],"filter-<=":[ge,[Pe,me],(t,[e,r])=>{let n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n<=i}],"filter-id-<=":[ge,[me],(t,[e])=>{let r=t.id(),n=e.value;return typeof r==typeof n&&r<=n}],"filter->=":[ge,[Pe,me],(t,[e,r])=>{let n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>=i}],"filter-id->=":[ge,[me],(t,[e])=>{let r=t.id(),n=e.value;return typeof r==typeof n&&r>=n}],"filter-has":[ge,[me],(t,[e])=>e.value in t.properties()],"filter-has-id":[ge,[],t=>t.id()!==null&&t.id()!==void 0],"filter-type-in":[ge,[yr(Pe)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[ge,[yr(me)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[ge,[Pe,yr(me)],(t,[e,r])=>r.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[ge,[Pe,yr(me)],(t,[e,r])=>xR(t.properties()[e.value],r.value,0,r.value.length-1)],all:{type:ge,overloads:[[[ge,ge],(t,[e,r])=>e.evaluate(t)&&r.evaluate(t)],[qi(ge),(t,e)=>{for(let r of e)if(!r.evaluate(t))return!1;return!0}]]},any:{type:ge,overloads:[[[ge,ge],(t,[e,r])=>e.evaluate(t)||r.evaluate(t)],[qi(ge),(t,e)=>{for(let r of e)if(r.evaluate(t))return!0;return!1}]]},"!":[ge,[ge],(t,[e])=>!e.evaluate(t)],"is-supported-script":[ge,[Pe],(t,[e])=>{let r=t.globals&&t.globals.isSupportedScript;return r?r(e.evaluate(t)):!0}],upcase:[Pe,[Pe],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[Pe,[Pe],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[Pe,qi(me),(t,e)=>e.map(r=>ys(r.evaluate(t))).join("")],"resolved-locale":[Pe,[Bc],(t,[e])=>e.evaluate(t).resolvedLocale()]});function bR(t){return Array.isArray(t)?"(".concat(t.map(ot).join(", "),")"):"(".concat(ot(t.type),"...)")}function Rc(t){if(t instanceof Cc)return Rc(t.boundExpression);if(t instanceof cn&&t.name==="error")return!1;if(t instanceof Ic)return!1;if(t instanceof Ts)return!1;if(t instanceof Cs)return!1;if(t instanceof Ms)return!1;let e=t instanceof ti||t instanceof qr,r=!0;return t.eachChild(n=>{e?r=r&&Rc(n):r=r&&n instanceof ni}),r?jc(t)&&Hc(t,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"]):!1}function jc(t){if(t instanceof cn){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 Ts||t instanceof Cs)return!1;let e=!0;return t.eachChild(r=>{e&&!jc(r)&&(e=!1)}),e}function Is(t){if(t instanceof cn&&t.name==="feature-state")return!1;let e=!0;return t.eachChild(r=>{e&&!Is(r)&&(e=!1)}),e}function Hc(t,e){if(t instanceof cn&&e.indexOf(t.name)>=0)return!1;let r=!0;return t.eachChild(n=>{r&&!Hc(n,e)&&(r=!1)}),r}function kd(t){return{result:"success",value:t}}function Go(t){return{result:"error",value:t}}function ii(t){return t["property-type"]==="data-driven"||t["property-type"]==="cross-faded-data-driven"}function $_(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function Gd(t){return!!t.expression&&t.expression.interpolated}function we(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":t===null?"null":typeof t}function Xc(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)&&ht(t)===Wi}function _R(t){return t}function vR(t){switch(t.type){case"color":return K.parse;case"padding":return zr.parse;case"numberArray":return Vr.parse;case"colorArray":return Jt.parse;default:return null}}function PR(t){switch(t){case"exponential":return J_;case"interval":return TR;case"categorical":return wR;case"identity":return SR;default:throw new Error('Unknown function type "'.concat(t,'"'))}}function K_(t,e){let r=t.stops&&typeof t.stops[0][0]=="object",n=r||t.property!==void 0,i=r||!n,o=t.type||(Gd(e)?"exponential":"interval"),a=vR(e);if(a&&(t=Ho({},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&&!vD(t.colorSpace))throw new Error('Unknown color space: "'.concat(t.colorSpace,'"'));let s=PR(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 d=0;d<t.stops.length;d++){let g=t.stops[d],x=g[0].zoom;c[x]===void 0&&(c[x]={zoom:x,type:t.type,property:t.property,default:t.default,stops:[]},p.push(x)),c[x].stops.push([g[0].value,g[1]])}let h=[];for(let d of p)h.push([c[d].zoom,K_(c[d],e)]);let f={name:"linear"};return{kind:"composite",interpolationType:f,interpolationFactor:Ht.interpolationFactor.bind(void 0,f),zoomStops:h.map(d=>d[0]),evaluate({zoom:d},g){return J_({stops:h,base:t.base},e,d).evaluate(d,g)}}}else if(i){let c=o==="exponential"?{name:"exponential",base:t.base!==void 0?t.base:1}:null;return{kind:"camera",interpolationType:c,interpolationFactor:Ht.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 h=p&&p.properties?p.properties[t.property]:void 0;return h===void 0?ks(t.default,e.default):s(t,e,h,l,u)}}}function ks(t,e,r){if(t!==void 0)return t;if(e!==void 0)return e;if(r!==void 0)return r}function wR(t,e,r,n,i){let o=typeof r===i?n[r]:void 0;return ks(o,t.default,e.default)}function TR(t,e,r){if(we(r)!=="number")return ks(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=Nc(t.stops.map(o=>o[0]),r);return t.stops[i][1]}function J_(t,e,r){let n=t.base!==void 0?t.base:1;if(we(r)!=="number")return ks(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=Nc(t.stops.map(c=>c[0]),r),a=CR(r,n,t.stops[o][0],t.stops[o+1][0]),s=t.stops[o][1],l=t.stops[o+1][1],u=Fe[e.type]||_R;return typeof s.evaluate=="function"?{evaluate(...c){let p=s.evaluate.apply(void 0,c),h=l.evaluate.apply(void 0,c);if(!(p===void 0||h===void 0))return u(p,h,a,t.colorSpace)}}:u(s,l,a,t.colorSpace)}function SR(t,e,r){switch(e.type){case"color":r=K.parse(r);break;case"formatted":r=gr.fromString(r.toString());break;case"resolvedImage":r=Qt.fromString(r.toString());break;case"padding":r=zr.parse(r);break;case"colorArray":r=Jt.parse(r);break;case"numberArray":r=Vr.parse(r);break;default:we(r)!==e.type&&(e.type!=="enum"||!e.values[r])&&(r=void 0)}return ks(r,t.default,e.default)}function CR(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 Ki=class{constructor(e,r){this.expression=e,this._warningHistory={},this._evaluator=new wc,this._defaultValue=r?IR(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 Je("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 Fs(t){return Array.isArray(t)&&t.length>0&&typeof t[0]=="string"&&t[0]in eo}function jd(t,e){let r=new Tc(eo,Rc,[],e?MR(e):void 0),n=r.parse(t,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return n?kd(new Ki(n,e)):Go(r.errors)}var pn=class{constructor(e,r){this.kind=e,this._styleExpression=r,this.isStateDependent=e!=="constant"&&!Is(r.expression),this.globalStateRefs=Zc(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)}},oi=class{constructor(e,r,n,i){this.kind=e,this.zoomStops=n,this._styleExpression=r,this.isStateDependent=e!=="camera"&&!Is(r.expression),this.globalStateRefs=Zc(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?Ht.interpolationFactor(this.interpolationType,e,r,n):0}};function Q_(t){return t._styleExpression!==void 0}function ev(t,e){let r=jd(t,e);if(r.result==="error")return r;let n=r.value.expression,i=jc(n);if(!i&&!ii(e))return Go([new Fr("","data expressions not supported")]);let o=Hc(n,["zoom"]);if(!o&&!$_(e))return Go([new Fr("","zoom expressions not supported")]);let a=Pc(n);if(!a&&!o)return Go([new Fr("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(a instanceof Fr)return Go([a]);if(a instanceof Ht&&!Gd(e))return Go([new Fr("",'"interpolate" expressions cannot be used with this property')]);if(!a)return kd(i?new pn("constant",r.value):new pn("source",r.value));let s=a instanceof Ht?a.interpolation:void 0;return kd(i?new oi("camera",r.value,a.labels,s):new oi("composite",r.value,a.labels,s))}var As=class t{constructor(e,r){this._parameters=e,this._specification=r,Ho(this,K_(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 tv(t,e){if(Xc(t))return new As(t,e);if(Fs(t)){let r=ev(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=K.parse(t):e.type==="padding"&&(typeof t=="number"||Array.isArray(t))?r=zr.parse(t):e.type==="numberArray"&&(typeof t=="number"||Array.isArray(t))?r=Vr.parse(t):e.type==="colorArray"&&(typeof t=="string"||Array.isArray(t))?r=Jt.parse(t):e.type==="variableAnchorOffsetCollection"&&Array.isArray(t)?r=ln.parse(t):e.type==="projectionDefinition"&&typeof t=="string"&&(r=un.parse(t)),{globalStateRefs:new Set,kind:"constant",evaluate:()=>r}}}function Pc(t){let e=null;if(t instanceof Sc)e=Pc(t.result);else if(t instanceof Mc){for(let r of t.args)if(e=Pc(r),e)break}else(t instanceof Zo||t instanceof Ht)&&t.input instanceof cn&&t.input.name==="zoom"&&(e=t);return e instanceof Fr||t.eachChild(r=>{let n=Pc(r);n instanceof Fr?e=n:!e&&n?e=new Fr("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&n&&e!==n&&(e=new Fr("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function Zc(t,e=new Set){return t instanceof Ms&&e.add(t.key),t.eachChild(r=>{Zc(r,e)}),e}function MR(t){let e={color:Br,string:Pe,number:Y,enum:Pe,boolean:ge,formatted:Wo,padding:zc,numberArray:Vc,colorArray:gs,projectionDefinition:Oc,resolvedImage:Ls,variableAnchorOffsetCollection:Uc};return t.type==="array"?yr(e[t.value]||me,t.length):e[t.type]}function IR(t){if(t.type==="color"&&Xc(t.default))return new K(0,0,0,0);switch(t.type){case"color":return K.parse(t.default)||null;case"padding":return zr.parse(t.default)||null;case"numberArray":return Vr.parse(t.default)||null;case"colorArray":return Jt.parse(t.default)||null;case"variableAnchorOffsetCollection":return ln.parse(t.default)||null;case"projectionDefinition":return un.parse(t.default)||null;default:return t.default===void 0?null:t.default}}function Hd(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(!Hd(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}var AR={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function ai(t){if(t==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};Hd(t)||(t=kc(t));let e=jd(t,AR);if(e.result==="error")throw new Error(e.value.map(r=>"".concat(r.key,": ").concat(r.message)).join(", "));{let r=rv(t);return{filter:(n,i,o)=>e.value.evaluate(n,i,{},o),needGeometry:r,getGlobalStateRefs:()=>Zc(e.value.expression)}}}function ER(t,e){return t<e?-1:t>e?1:0}function rv(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(rv(t[e]))return!0;return!1}function kc(t){if(!t)return!0;let e=t[0];return t.length<=1?e!=="any":e==="=="?xd(t[1],t[2],"=="):e==="!="?vc(xd(t[1],t[2],"==")):e==="<"||e===">"||e==="<="||e===">="?xd(t[1],t[2],e):e==="any"?LR(t.slice(1)):e==="all"?["all"].concat(t.slice(1).map(kc)):e==="none"?["all"].concat(t.slice(1).map(kc).map(vc)):e==="in"?M_(t[1],t.slice(2)):e==="!in"?vc(M_(t[1],t.slice(2))):e==="has"?I_(t[1]):e==="!has"?vc(I_(t[1])):!0}function xd(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 LR(t){return["any"].concat(t.map(kc))}function M_(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(ER)]]:["filter-in-small",t,["literal",e]]}}function I_(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function vc(t){return["!",t]}function nv(){let t={},e=D.$version;for(let r in D.$root){let n=D.$root[r];if(n.required){let i=null;r==="version"?i=e:n.type==="array"?i=[]:i={},i!=null&&(t[r]=i)}}return t}function iv(t){let e=t.key,r=t.value;return r?[new G(e,r,"constants have been deprecated as of v8")]:[]}function pt(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function Ji(t){if(Array.isArray(t))return t.map(Ji);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){let e={};for(let r in t)e[r]=Ji(t[r]);return e}return pt(t)}function Or(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=we(r);if(u!=="object")return[new G(e,r,"object expected, ".concat(u," found"))];for(let c in r){let p=c.split(".")[0],h=ds(n,p)||n["*"],f;if(ds(i,p))f=i[p];else if(ds(n,p))f=s;else if(i["*"])f=i["*"];else if(n["*"])f=s;else{l.push(new G(e,r[c],'unknown property "'.concat(c,'"')));continue}l=l.concat(f({key:(e&&"".concat(e,"."))+c,value:r[c],valueSpec:h,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 G(e,r,'missing required property "'.concat(c,'"')));return l}function Xd(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(we(e)!=="array")return[new G(a,e,"array expected, ".concat(we(e)," found"))];if(r.length&&e.length!==r.length)return[new G(a,e,"array length ".concat(r.length," expected, length ").concat(e.length," found"))];if(r["min-length"]&&e.length<r["min-length"])return[new G(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),we(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 qc(t){let e=t.key,r=t.value,n=t.valueSpec,i=we(r);return i==="number"&&r!==r&&(i="NaN"),i!=="number"?[new G(e,r,"number expected, ".concat(i," found"))]:"minimum"in n&&r<n.minimum?[new G(e,r,"".concat(r," is less than the minimum value ").concat(n.minimum))]:"maximum"in n&&r>n.maximum?[new G(e,r,"".concat(r," is greater than the maximum value ").concat(n.maximum))]:[]}function ov(t){let e=t.valueSpec,r=pt(t.value.type),n,i={},o,a,s=r!=="categorical"&&t.value.property===void 0,l=!s,u=we(t.value.stops)==="array"&&we(t.value.stops[0])==="array"&&we(t.value.stops[0][0])==="object",c=Or({key:t.key,value:t.value,valueSpec:t.styleSpec.function,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:p,default:d}});return r==="identity"&&s&&c.push(new G(t.key,t.value,'missing required property "property"')),r!=="identity"&&!t.value.stops&&c.push(new G(t.key,t.value,'missing required property "stops"')),r==="exponential"&&t.valueSpec.expression&&!Gd(t.valueSpec)&&c.push(new G(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!ii(t.valueSpec)?c.push(new G(t.key,t.value,"property functions not supported")):s&&!$_(t.valueSpec)&&c.push(new G(t.key,t.value,"zoom functions not supported"))),(r==="categorical"||u)&&t.value.property===void 0&&c.push(new G(t.key,t.value,'"property" property is required')),c;function p(g){if(r==="identity")return[new G(g.key,g.value,'identity function may not have a "stops" property')];let x=[],b=g.value;return x=x.concat(Xd({key:g.key,value:b,valueSpec:g.valueSpec,validateSpec:g.validateSpec,style:g.style,styleSpec:g.styleSpec,arrayElementValidator:h})),we(b)==="array"&&b.length===0&&x.push(new G(g.key,b,"array must have at least one stop")),x}function h(g){let x=[],b=g.value,v=g.key;if(we(b)!=="array")return[new G(v,b,"array expected, ".concat(we(b)," found"))];if(b.length!==2)return[new G(v,b,"array length 2 expected, length ".concat(b.length," found"))];if(u){if(we(b[0])!=="object")return[new G(v,b,"object expected, ".concat(we(b[0])," found"))];if(b[0].zoom===void 0)return[new G(v,b,"object stop key must have zoom")];if(b[0].value===void 0)return[new G(v,b,"object stop key must have value")];if(a&&a>pt(b[0].zoom))return[new G(v,b[0].zoom,"stop zoom values must appear in ascending order")];pt(b[0].zoom)!==a&&(a=pt(b[0].zoom),o=void 0,i={}),x=x.concat(Or({key:"".concat(v,"[0]"),value:b[0],valueSpec:{zoom:{}},validateSpec:g.validateSpec,style:g.style,styleSpec:g.styleSpec,objectElementValidators:{zoom:qc,value:f}}))}else x=x.concat(f({key:"".concat(v,"[0]"),value:b[0],validateSpec:g.validateSpec,style:g.style,styleSpec:g.styleSpec},b));return Fs(Ji(b[1]))?x.concat([new G("".concat(v,"[1]"),b[1],"expressions are not allowed in function stops.")]):x.concat(g.validateSpec({key:"".concat(v,"[1]"),value:b[1],valueSpec:e,validateSpec:g.validateSpec,style:g.style,styleSpec:g.styleSpec}))}function f(g,x){let b=we(g.value),v=pt(g.value),P=g.value!==null?g.value:x;if(!n)n=b;else if(b!==n)return[new G(g.key,P,"".concat(b," stop domain type must match previous stop domain type ").concat(n))];if(b!=="number"&&b!=="string"&&b!=="boolean")return[new G(g.key,P,"stop domain value must be a number, string, or boolean")];if(b!=="number"&&r!=="categorical"){let w="number expected, ".concat(b," found");return ii(e)&&r===void 0&&(w+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new G(g.key,P,w)]}return r==="categorical"&&b==="number"&&(!isFinite(v)||Math.floor(v)!==v)?[new G(g.key,P,"integer expected, found ".concat(v))]:r!=="categorical"&&b==="number"&&o!==void 0&&v<o?[new G(g.key,P,"stop domain values must appear in ascending order")]:(o=v,r==="categorical"&&v in i?[new G(g.key,P,"stop domain values must be unique")]:(i[v]=!0,[]))}function d(g){return g.validateSpec({key:g.key,value:g.value,valueSpec:e,validateSpec:g.validateSpec,style:g.style,styleSpec:g.styleSpec})}}function qo(t){let e=(t.expressionContext==="property"?ev:jd)(Ji(t.value),t.valueSpec);if(e.result==="error")return e.value.map(n=>new G("".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 G(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"&&!Is(r))return[new G(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if(t.expressionContext==="filter"&&!Is(r))return[new G(t.key,t.value,'"feature-state" data expressions are not supported with filters.')];if(t.expressionContext&&t.expressionContext.indexOf("cluster")===0){if(!Hc(r,["zoom","feature-state"]))return[new G(t.key,t.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(t.expressionContext==="cluster-initial"&&!jc(r))return[new G(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function DR(t){let e=t.value,r=t.key,n=we(e);return n!=="boolean"?[new G(r,e,"boolean expected, ".concat(n," found"))]:[]}function Fd(t){let e=t.key,r=t.value,n=we(r);return n!=="string"?[new G(e,r,"color expected, ".concat(n," found"))]:K.parse(String(r))?[]:[new G(e,r,'color expected, "'.concat(r,'" found'))]}function Es(t){let e=t.key,r=t.value,n=t.valueSpec,i=[];return Array.isArray(n.values)?n.values.indexOf(pt(r))===-1&&i.push(new G(e,r,"expected one of [".concat(n.values.join(", "),"], ").concat(JSON.stringify(r)," found"))):Object.keys(n.values).indexOf(pt(r))===-1&&i.push(new G(e,r,"expected one of [".concat(Object.keys(n.values).join(", "),"], ").concat(JSON.stringify(r)," found"))),i}function Zd(t){return Hd(Ji(t.value))?qo(Ho({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):av(t)}function av(t){let e=t.value,r=t.key;if(we(e)!=="array")return[new G(r,e,"array expected, ".concat(we(e)," found"))];let n=t.styleSpec,i,o=[];if(e.length<1)return[new G(r,e,"filter array must have at least 1 element")];switch(o=o.concat(Es({key:"".concat(r,"[0]"),value:e[0],valueSpec:n.filter_operator,style:t.style,styleSpec:t.styleSpec})),pt(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&pt(e[1])==="$type"&&o.push(new G(r,e,'"$type" cannot be use with operator "'.concat(e[0],'"')));case"==":case"!=":e.length!==3&&o.push(new G(r,e,'filter array for operator "'.concat(e[0],'" must have 3 elements')));case"in":case"!in":e.length>=2&&(i=we(e[1]),i!=="string"&&o.push(new G("".concat(r,"[1]"),e[1],"string expected, ".concat(i," found"))));for(let a=2;a<e.length;a++)i=we(e[a]),pt(e[1])==="$type"?o=o.concat(Es({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 G("".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(av({key:"".concat(r,"[").concat(a,"]"),value:e[a],style:t.style,styleSpec:t.styleSpec}));break;case"has":case"!has":i=we(e[1]),e.length!==2?o.push(new G(r,e,'filter array for "'.concat(e[0],'" operator must have 2 elements'))):i!=="string"&&o.push(new G("".concat(r,"[1]"),e[1],"string expected, ".concat(i," found")));break}return o}function sv(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 G(r,a,'unknown property "'.concat(s,'"'))];let p;if(we(a)==="string"&&ii(c)&&!c.tokens&&(p=/^{([^}]+)}$/.exec(a)))return[new G(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 h=[];return t.layerType==="symbol"&&(s==="text-field"&&i&&!i.glyphs&&h.push(new G(r,a,'use of "text-field" requires a style "glyphs" property')),s==="text-font"&&Xc(Ji(a))&&pt(a.type)==="identity"&&h.push(new G(r,a,'"text-font" does not support identity functions'))),h.concat(n({key:t.key,value:a,valueSpec:c,style:i,styleSpec:o,expressionContext:"property",propertyType:e,propertyKey:s}))}function lv(t){return sv(t,"paint")}function uv(t){return sv(t,"layout")}function cv(t){let e=[],r=t.value,n=t.key,i=t.style,o=t.styleSpec;if(we(r)!=="object")return[new G(n,r,"object expected, ".concat(we(r)," found"))];!r.type&&!r.ref&&e.push(new G(n,r,'either "type" or "ref" is required'));let a=pt(r.type),s=pt(r.ref);if(r.id){let l=pt(r.id);for(let u=0;u<t.arrayIndex;u++){let c=i.layers[u];pt(c.id)===l&&e.push(new G(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 G(n,r[u],'"'.concat(u,'" is prohibited for ref layers')))});let l;i.layers.forEach(u=>{pt(u.id)===s&&(l=u)}),l?l.ref?e.push(new G(n,r.ref,"ref cannot reference another ref layer")):a=pt(l.type):e.push(new G(n,r.ref,'ref layer "'.concat(s,'" not found')))}else if(a!=="background")if(!r.source)e.push(new G(n,r,'missing required property "source"'));else{let l=i.sources&&i.sources[r.source],u=l&&pt(l.type);l?u==="vector"&&a==="raster"?e.push(new G(n,r.source,'layer "'.concat(r.id,'" requires a raster source'))):u!=="raster-dem"&&a==="hillshade"?e.push(new G(n,r.source,'layer "'.concat(r.id,'" requires a raster-dem source'))):u!=="raster-dem"&&a==="color-relief"?e.push(new G(n,r.source,'layer "'.concat(r.id,'" requires a raster-dem source'))):u==="raster"&&a!=="raster"?e.push(new G(n,r.source,'layer "'.concat(r.id,'" requires a vector source'))):u==="vector"&&!r["source-layer"]?e.push(new G(n,r,'layer "'.concat(r.id,'" must specify a "source-layer"'))):u==="raster-dem"&&a!=="hillshade"&&a!=="color-relief"?e.push(new G(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 G(n,r,'layer "'.concat(r.id,'" specifies a line-gradient, which requires a GeoJSON source with `lineMetrics` enabled.'))):e.push(new G(n,r.source,'source "'.concat(r.source,'" not found')))}return e=e.concat(Or({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:Zd,layout(l){return Or({layer:r,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return uv(Ho({layerType:a},u))}}})},paint(l){return Or({layer:r,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return lv(Ho({layerType:a},u))}}})}}})),e}function Qi(t){let e=t.value,r=t.key,n=we(e);return n!=="string"?[new G(r,e,"string expected, ".concat(n," found"))]:[]}function RR(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=we(n);if(n===void 0)return s;if(l!=="object")return s.push(new G("source_raster_dem",n,"object expected, ".concat(l," found"))),s;let c=pt(n.encoding)==="custom",p=["redFactor","greenFactor","blueFactor","baseShift"],h=t.value.encoding?'"'.concat(t.value.encoding,'"'):"Default";for(let f in n)!c&&p.includes(f)?s.push(new G(f,n[f],'In "'.concat(r,'": "').concat(f,'" is only valid when "encoding" is set to "custom". ').concat(h," encoding found"))):o[f]?s=s.concat(t.validateSpec({key:f,value:n[f],valueSpec:o[f],validateSpec:t.validateSpec,style:a,styleSpec:i})):s.push(new G(f,n[f],'unknown property "'.concat(f,'"')));return s}var A_={promoteId:kR};function pv(t){let e=t.value,r=t.key,n=t.styleSpec,i=t.style,o=t.validateSpec;if(!e.type)return[new G(r,e,'"type" is required')];let a=pt(e.type),s;switch(a){case"vector":case"raster":return s=Or({key:r,value:e,valueSpec:n["source_".concat(a.replace("-","_"))],style:t.style,styleSpec:n,objectElementValidators:A_,validateSpec:o}),s;case"raster-dem":return s=RR({sourceName:r,value:e,style:t.style,styleSpec:n,validateSpec:o}),s;case"geojson":if(s=Or({key:r,value:e,valueSpec:n.source_geojson,style:i,styleSpec:n,validateSpec:o,objectElementValidators:A_}),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(...qo({key:"".concat(r,".").concat(l,".map"),value:c,expressionContext:"cluster-map"})),s.push(...qo({key:"".concat(r,".").concat(l,".reduce"),value:p,expressionContext:"cluster-reduce"}))}return s;case"video":return Or({key:r,value:e,valueSpec:n.source_video,style:i,validateSpec:o,styleSpec:n});case"image":return Or({key:r,value:e,valueSpec:n.source_image,style:i,validateSpec:o,styleSpec:n});case"canvas":return[new G(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Es({key:"".concat(r,".type"),value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function kR({key:t,value:e}){if(we(e)==="string")return Qi({key:t,value:e});{let r=[];for(let n in e)r.push(...Qi({key:"".concat(t,".").concat(n),value:e[n]}));return r}}function hv(t){let e=t.value,r=t.styleSpec,n=r.light,i=t.style,o=[],a=we(e);if(e===void 0)return o;if(a!=="object")return o=o.concat([new G("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 G(s,e[s],'unknown property "'.concat(s,'"'))])}return o}function fv(t){let e=t.value,r=t.styleSpec,n=r.sky,i=t.style,o=we(e);if(e===void 0)return[];if(o!=="object")return[new G("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 G(s,e[s],'unknown property "'.concat(s,'"'))]);return a}function mv(t){let e=t.value,r=t.styleSpec,n=r.terrain,i=t.style,o=[],a=we(e);if(e===void 0)return o;if(a!=="object")return o=o.concat([new G("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 G(s,e[s],'unknown property "'.concat(s,'"'))]);return o}function FR(t){return Qi(t).length===0?[]:qo(t)}function OR(t){return Qi(t).length===0?[]:qo(t)}function BR(t){let e=t.key,r=t.value;if(we(r)==="array"){if(r.length<1||r.length>4)return[new G(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 qc({key:e,value:r,valueSpec:{}})}function zR(t){let e=t.key,r=t.value;if(we(r)==="array"){let i={type:"number"};if(r.length<1)return[new G(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 qc({key:e,value:r,valueSpec:{}})}function VR(t){let e=t.key,r=t.value;if(we(r)==="array"){if(r.length<1)return[new G(e,r,"array length at least 1 expected, length 0 found")];let i=[];for(let o=0;o<r.length;o++)i=i.concat(Fd({key:"".concat(e,"[").concat(o,"]"),value:r[o]}));return i}else return Fd({key:e,value:r})}function UR(t){let e=t.key,r=t.value,n=we(r),i=t.styleSpec;if(n!=="array"||r.length<1||r.length%2!==0)return[new G(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(Es({key:"".concat(e,"[").concat(a,"]"),value:r[a],valueSpec:i.layout_symbol["text-anchor"]})),o=o.concat(Xd({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 dv(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 G(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 G(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(Or({key:"".concat(n,"[").concat(a,"]"),value:r[a],valueSpec:s,validateSpec:t.validateSpec}))}return e}else return Qi({key:n,value:r})}function NR(t){let e=t.value,r=t.styleSpec,n=r.projection,i=t.style,o=we(e);if(e===void 0)return[];if(o!=="object")return[new G("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 G(s,e[s],'unknown property "'.concat(s,'"'))]);return a}function GR(t){let e=t.key,r=t.value;r=r instanceof String?r.valueOf():r;let n=we(r);return n==="array"&&!HR(r)&&!jR(r)?[new G(e,r,"projection expected, invalid array ".concat(JSON.stringify(r)," found"))]:["array","string"].includes(n)?[]:[new G(e,r,'projection expected, invalid type "'.concat(n,'" found'))]}function jR(t){return!!["interpolate","step","literal"].includes(t[0])}function HR(t){return Array.isArray(t)&&t.length===3&&typeof t[0]=="string"&&typeof t[1]=="string"&&typeof t[2]=="number"}function XR(t){return!!t&&t.constructor===Object}function yv(t){return XR(t.value)?[]:[new G(t.key,t.value,"object expected, ".concat(we(t.value)," found"))]}var E_={"*"(){return[]},array:Xd,boolean:DR,number:qc,color:Fd,constants:iv,enum:Es,filter:Zd,function:ov,layer:cv,object:Or,source:pv,light:hv,sky:fv,terrain:mv,projection:NR,projectionDefinition:GR,string:Qi,formatted:FR,resolvedImage:OR,padding:BR,numberArray:zR,colorArray:VR,variableAnchorOffsetCollection:UR,sprite:dv,state:yv};function Fc(t){let e=t.value,r=t.valueSpec,n=t.styleSpec;return t.validateSpec=Fc,r.expression&&Xc(pt(e))?ov(t):r.expression&&Fs(Ji(e))?qo(t):r.type&&E_[r.type]?E_[r.type](t):Or(Ho({},t,{valueSpec:r.type?n[r.type]:r}))}function gv(t){let e=t.value,r=t.key,n=Qi(t);return n.length||(e.indexOf("{fontstack}")===-1&&n.push(new G(r,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&n.push(new G(r,e,'"glyphs" url must include a "{range}" token'))),n}function xr(t,e=D){let r=[];return r=r.concat(Fc({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,validateSpec:Fc,objectElementValidators:{glyphs:gv,"*"(){return[]}}})),t.constants&&(r=r.concat(iv({key:"constants",value:t.constants}))),xv(r)}xr.source=Wr(Yr(pv));xr.sprite=Wr(Yr(dv));xr.glyphs=Wr(Yr(gv));xr.light=Wr(Yr(hv));xr.sky=Wr(Yr(fv));xr.terrain=Wr(Yr(mv));xr.state=Wr(Yr(yv));xr.layer=Wr(Yr(cv));xr.filter=Wr(Yr(Zd));xr.paintProperty=Wr(Yr(lv));xr.layoutProperty=Wr(Yr(uv));function Yr(t){return function(e){return t(wt(Ze({},e),{validateSpec:Fc}))}}function xv(t){return[].concat(t).sort((e,r)=>e.line-r.line)}function Wr(t){return function(...e){return xv(t.apply(this,e))}}m();var Qe=xr,W6=Qe.source,bv=Qe.light,_v=Qe.sky,$6=Qe.terrain,K6=Qe.filter,vv=Qe.paintProperty,Pv=Qe.layoutProperty;function si(t,e){let r=!1;if(e&&e.length)for(let n of e)t.fire(new Q(new Error(n.message))),r=!0;return r}m();m();m();var to=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 h=0;h<u.length;h++){let f=u[h];if(s[f]===void 0){let d=f*4;(l?l(p[d+0],p[d+1],p[d+2],p[d+3]):e<=p[d+2]&&r<=p[d+3]&&n>=p[d+0]&&i>=p[d+1])?(s[f]=!0,a.push(c[f])):s[f]=!1}}}}_forEachCell(e,r,n,i,o,a,s,l){let u=this._convertToCellCoord(e),c=this._convertToCellCoord(r),p=this._convertToCellCoord(n),h=this._convertToCellCoord(i);for(let f=u;f<=p;f++)for(let d=c;d<=h;d++){let g=this.d*d+f;if(!(l&&!l(this._convertFromCellCoord(f),this._convertFromCellCoord(d),this._convertFromCellCoord(f+1),this._convertFromCellCoord(d+1)))&&o.call(this,e,r,n,i,g,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 In={};function X(t,e,r={}){if(In[t])throw new Error("".concat(t," is already registered."));Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),In[t]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}X("Object",Object);X("Set",Set);X("TransferableGridIndex",to);X("Color",K);X("Error",Error);X("AJAXError",Jn);X("ResolvedImage",Qt);X("StylePropertyFunction",As);X("StyleExpression",Ki,{omit:["_evaluator"]});X("ZoomDependentExpression",oi);X("ZoomConstantExpression",pn);X("CompoundExpression",cn,{omit:["_evaluate"]});for(let t in eo)eo[t]._classRegistryKey||X("Expression_".concat(t),eo[t]);function wv(t){return t&&typeof ArrayBuffer<"u"&&(t instanceof ArrayBuffer||t.constructor&&t.constructor.name==="ArrayBuffer")}function qd(t){let e=t.constructor;return t.$name||e._classRegistryKey}function ZR(t){if(t===null||typeof t!="object")return!1;let e=qd(t);return!!(e&&e!=="Object")}function Tv(t){return!ZR(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||wv(t)||$t(t)||ArrayBuffer.isView(t)||t instanceof ImageData)}function Jo(t,e){if(Tv(t)){if((wv(t)||$t(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(Jo(a,e));return o}if(typeof t!="object")throw new Error("can't serialize object of type ".concat(typeof t));let r=qd(t);if(!r)throw new Error("can't serialize object of unregistered class ".concat(t.constructor.name));if(!In[r])throw new Error("".concat(r," is not registered."));let{klass:n}=In[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)||In[r].omit.indexOf(o)>=0)continue;let a=t[o];i[o]=In[r].shallow.indexOf(o)>=0?a:Jo(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 Qo(t){if(Tv(t))return t;if(Array.isArray(t))return t.map(Qo);if(typeof t!="object")throw new Error("can't deserialize object of type ".concat(typeof t));let e=qd(t)||"Object";if(!In[e])throw new Error("can't deserialize unregistered class ".concat(e));let{klass:r}=In[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]=In[e].shallow.indexOf(i)>=0?o:Qo(o)}return n}m();m();var ro=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)}};m();m();var mt={"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 Yd(t){for(let e of t)if(Sv(e.charCodeAt(0)))return!0;return!1}function Wd(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 qR=["Arab","Dupl","Mong","Ougr","Syrc"],fG=Wd(qR);var YR=["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"],WR=Wd(YR);function Sv(t){return t===746||t===747?!0:t<4352?!1:!!(mt["CJK Compatibility Forms"](t)&&!(t>=65097&&t<=65103)||mt["CJK Compatibility"](t)||mt["CJK Strokes"](t)||mt["CJK Symbols and Punctuation"](t)&&!(t>=12296&&t<=12305)&&!(t>=12308&&t<=12319)&&t!==12336||mt["Enclosed CJK Letters and Months"](t)||mt["Ideographic Description Characters"](t)||mt.Kanbun(t)||mt.Katakana(t)&&t!==12540||mt["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)||mt["Small Form Variants"](t)&&!(t>=65112&&t<=65118)&&!(t>=65123&&t<=65126)||mt["Vertical Forms"](t)||mt["Yijing Hexagram Symbols"](t)||new RegExp("\\p{sc=Cans}","u").test(String.fromCodePoint(t))||new RegExp("\\p{sc=Hang}","u").test(String.fromCodePoint(t))||WR.test(String.fromCodePoint(t)))}var $R=["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"],KR=Wd($R);function Cv(t){return KR.test(String.fromCodePoint(t))}function JR(t,e){return!(!e&&Cv(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||mt.Khmer(t))}function Mv(t){for(let e of t)if(Cv(e.charCodeAt(0)))return!0;return!1}function Iv(t,e){for(let r of t)if(!JR(r.charCodeAt(0),e))return!1;return!0}m();var $d=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(hn.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))}},hn=new $d;var Te=class{constructor(e,r){this.zoom=e,r?(this.now=r.now||0,this.fadeDuration=r.fadeDuration||0,this.zoomHistory=r.zoomHistory||new ro,this.transition=r.transition||{},this.globalState=r.globalState||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new ro,this.transition={},this.globalState={})}isSupportedScript(e){return Iv(e,hn.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 ea=class{constructor(e,r){this.property=e,this.value=r,this.expression=tv(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)}},Os=class{constructor(e){this.property=e,this.value=new ea(e,void 0)}transitioned(e,r){return new Yc(this.property,this.value,r,Z({},e.transition,this.transition),e.now)}untransitioned(){return new Yc(this.property,this.value,null,{},0)}},fn=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return Ft(this._values[e].value.value)}setValue(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Os(this._values[e].property)),this._values[e].value=new ea(this._values[e].property,r===null?void 0:Ft(r))}getTransition(e){return Ft(this._values[e].transition)}setTransition(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Os(this._values[e].property)),this._values[e].transition=Ft(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 Wc(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 Wc(this._properties);for(let r of Object.keys(this._values))e._values[r]=this._values[r].untransitioned();return e}},Yc=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,lc(s))}}else return o}},Wc=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,r,n){let i=new li(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}},$c=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}hasValue(e){return this._values[e].value!==void 0}getValue(e){return Ft(this._values[e].value)}setValue(e,r){this._values[e]=new ea(this._values[e].property,r===null?void 0:Ft(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 li(this._properties);for(let o of Object.keys(this._values))i._values[o]=this._values[o].possiblyEvaluate(e,r,n);return i}},Ot=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)}},li=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}},q=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=Fe[i];return o?o(e,r,n):e}},te=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 Ot(this,{kind:"constant",value:e.expression.evaluate(r,null,{},n,i)},r):new Ot(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 Ot(this,{kind:"constant",value:void 0},e.parameters);let i=this.specification.type,o=Fe[i];if(o){let a=o(e.value.value,r.value.value,n);return new Ot(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)}},An=class extends te{possiblyEvaluate(e,r,n,i){if(e.value===void 0)return new Ot(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 Ot(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 Ot(this,{kind:"constant",value:o},r)}else return new Ot(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}},no=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 Te(Math.floor(r.zoom-1),r)),e.expression.evaluate(new Te(Math.floor(r.zoom),r)),e.expression.evaluate(new Te(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}},En=class{constructor(e){this.specification=e}possiblyEvaluate(e,r,n,i){return!!e.expression.evaluate(r,null,{},n,i)}interpolate(){return!1}},Ue=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 ea(n,void 0),o=this.defaultTransitionablePropertyValues[r]=new Os(n);this.defaultTransitioningPropertyValues[r]=o.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=i.possiblyEvaluate({})}}};X("DataDrivenProperty",te);X("DataConstantProperty",q);X("CrossFadedDataDrivenProperty",An);X("CrossFadedProperty",no);X("ColorRampProperty",En);var Kc="-transition",at=class extends Ee{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=ai(e.filter)),r.layout&&(this._unevaluatedLayout=new $c(r.layout)),r.paint)){this._transitionablePaint=new fn(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 li(r.paint)}}setFilter(e){this.filter=e,this._featureFilter=ai(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(Pv,i,e,r,n))return}if(e==="visibility"){this.visibility=r;return}this._unevaluatedLayout.setValue(e,r)}getPaintProperty(e){return e.endsWith(Kc)?this._transitionablePaint.getTransition(e.slice(0,-Kc.length)):this._transitionablePaint.getValue(e)}setPaintProperty(e,r,n={}){if(r!=null){let i="layers.".concat(this.id,".paint.").concat(e);if(this._validate(vv,i,e,r,n))return!1}if(e.endsWith(Kc))return this._transitionablePaint.setTransition(e.slice(0,-Kc.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),cc(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:si(this,e.call(Qe,{key:r,layerType:this.type,objectKey:n,value:i,styleSpec:D,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 Ot)||!ii(r.property.specification))&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}};m();m();m();var QR={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},ui=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}},ek=128,tk=5,Ye=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*tk),ek),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 ze(t,e=1){let r=0,n=0,i=t.map(a=>{let s=rk(a.type),l=r=Av(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=Av(r,Math.max(n,e));return{members:i,size:o,alignment:e}}function rk(t){return QR[t].BYTES_PER_ELEMENT}function Av(t,e){return Math.ceil(t/e)*e}var Ev=se(fe(),1),io=class extends Ye{_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}};io.prototype.bytesPerElement=4;X("StructArrayLayout2i4",io);var ta=class extends Ye{_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}};ta.prototype.bytesPerElement=6;X("StructArrayLayout3i6",ta);var Bs=class extends Ye{_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}};Bs.prototype.bytesPerElement=8;X("StructArrayLayout4i8",Bs);var zs=class extends Ye{_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}};zs.prototype.bytesPerElement=12;X("StructArrayLayout2i4i12",zs);var Vs=class extends Ye{_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}};Vs.prototype.bytesPerElement=8;X("StructArrayLayout2i4ub8",Vs);var ci=class extends Ye{_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}};ci.prototype.bytesPerElement=8;X("StructArrayLayout2f8",ci);var Us=class extends Ye{_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 h=e*10;return this.uint16[h+0]=r,this.uint16[h+1]=n,this.uint16[h+2]=i,this.uint16[h+3]=o,this.uint16[h+4]=a,this.uint16[h+5]=s,this.uint16[h+6]=l,this.uint16[h+7]=u,this.uint16[h+8]=c,this.uint16[h+9]=p,e}};Us.prototype.bytesPerElement=20;X("StructArrayLayout10ui20",Us);var Ns=class extends Ye{_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,h){let f=this.length;return this.resize(f+1),this.emplace(f,e,r,n,i,o,a,s,l,u,c,p,h)}emplace(e,r,n,i,o,a,s,l,u,c,p,h,f){let d=e*12;return this.int16[d+0]=r,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]=l,this.uint16[d+7]=u,this.int16[d+8]=c,this.int16[d+9]=p,this.int16[d+10]=h,this.int16[d+11]=f,e}};Ns.prototype.bytesPerElement=24;X("StructArrayLayout4i4ui4i24",Ns);var Gs=class extends Ye{_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}};Gs.prototype.bytesPerElement=12;X("StructArrayLayout3f12",Gs);var js=class extends Ye{_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}};js.prototype.bytesPerElement=4;X("StructArrayLayout1ul4",js);var Hs=class extends Ye{_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,h=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[h+3]=l,this.uint16[p+8]=u,this.uint16[p+9]=c,e}};Hs.prototype.bytesPerElement=20;X("StructArrayLayout6i1ul2ui20",Hs);var Xs=class extends Ye{_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}};Xs.prototype.bytesPerElement=12;X("StructArrayLayout2i2i2i12",Xs);var Zs=class extends Ye{_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}};Zs.prototype.bytesPerElement=16;X("StructArrayLayout2f1f2i16",Zs);var qs=class extends Ye{_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}};qs.prototype.bytesPerElement=16;X("StructArrayLayout2ub2f2i16",qs);var ra=class extends Ye{_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}};ra.prototype.bytesPerElement=6;X("StructArrayLayout3ui6",ra);var Ys=class extends Ye{_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,h,f,d,g,x,b){let v=this.length;return this.resize(v+1),this.emplace(v,e,r,n,i,o,a,s,l,u,c,p,h,f,d,g,x,b)}emplace(e,r,n,i,o,a,s,l,u,c,p,h,f,d,g,x,b,v){let P=e*24,w=e*12,T=e*48;return this.int16[P+0]=r,this.int16[P+1]=n,this.uint16[P+2]=i,this.uint16[P+3]=o,this.uint32[w+2]=a,this.uint32[w+3]=s,this.uint32[w+4]=l,this.uint16[P+10]=u,this.uint16[P+11]=c,this.uint16[P+12]=p,this.float32[w+7]=h,this.float32[w+8]=f,this.uint8[T+36]=d,this.uint8[T+37]=g,this.uint8[T+38]=x,this.uint32[w+10]=b,this.int16[P+22]=v,e}};Ys.prototype.bytesPerElement=48;X("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Ys);var Ws=class extends Ye{_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,h,f,d,g,x,b,v,P,w,T,S,I,M,E,L,k,F){let z=this.length;return this.resize(z+1),this.emplace(z,e,r,n,i,o,a,s,l,u,c,p,h,f,d,g,x,b,v,P,w,T,S,I,M,E,L,k,F)}emplace(e,r,n,i,o,a,s,l,u,c,p,h,f,d,g,x,b,v,P,w,T,S,I,M,E,L,k,F,z){let A=e*32,R=e*16;return this.int16[A+0]=r,this.int16[A+1]=n,this.int16[A+2]=i,this.int16[A+3]=o,this.int16[A+4]=a,this.int16[A+5]=s,this.int16[A+6]=l,this.int16[A+7]=u,this.uint16[A+8]=c,this.uint16[A+9]=p,this.uint16[A+10]=h,this.uint16[A+11]=f,this.uint16[A+12]=d,this.uint16[A+13]=g,this.uint16[A+14]=x,this.uint16[A+15]=b,this.uint16[A+16]=v,this.uint16[A+17]=P,this.uint16[A+18]=w,this.uint16[A+19]=T,this.uint16[A+20]=S,this.uint16[A+21]=I,this.uint16[A+22]=M,this.uint32[R+12]=E,this.float32[R+13]=L,this.float32[R+14]=k,this.uint16[A+30]=F,this.uint16[A+31]=z,e}};Ws.prototype.bytesPerElement=64;X("StructArrayLayout8i15ui1ul2f2ui64",Ws);var oo=class extends Ye{_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}};oo.prototype.bytesPerElement=4;X("StructArrayLayout1f4",oo);var $s=class extends Ye{_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}};$s.prototype.bytesPerElement=12;X("StructArrayLayout1ui2f12",$s);var Ks=class extends Ye{_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}};Ks.prototype.bytesPerElement=8;X("StructArrayLayout1ul2ui8",Ks);var Js=class extends Ye{_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}};Js.prototype.bytesPerElement=4;X("StructArrayLayout2ui4",Js);var Qs=class extends Ye{_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}};Qs.prototype.bytesPerElement=2;X("StructArrayLayout1ui2",Qs);var na=class extends Ye{_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}};na.prototype.bytesPerElement=16;X("StructArrayLayout4f16",na);var Jc=class extends ui{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 Ev.default(this.anchorPointX,this.anchorPointY)}};Jc.prototype.size=20;var el=class extends Hs{get(e){return new Jc(this,e)}};X("CollisionBoxArray",el);var Qc=class extends ui{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]}};Qc.prototype.size=48;var tl=class extends Ys{get(e){return new Qc(this,e)}};X("PlacedSymbolArray",tl);var ep=class extends ui{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]}};ep.prototype.size=64;var rl=class extends Ws{get(e){return new ep(this,e)}};X("SymbolInstanceArray",rl);var nl=class extends oo{getoffsetX(e){return this.float32[e*1+0]}};X("GlyphOffsetArray",nl);var il=class extends ta{getx(e){return this.int16[e*3+0]}gety(e){return this.int16[e*3+1]}gettileUnitDistanceFromAnchor(e){return this.int16[e*3+2]}};X("SymbolLineVertexArray",il);var tp=class extends ui{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]}};tp.prototype.size=12;var ol=class extends $s{get(e){return new tp(this,e)}};X("TextAnchorOffsetArray",ol);var rp=class extends ui{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]}};rp.prototype.size=8;var al=class extends Ks{get(e){return new rp(this,e)}};X("FeatureIndexArray",al);var Dt=class extends io{},np=class extends ta{},ip=class extends Bs{},op=class extends io{},ap=class extends io{},sp=class extends zs{};var lp=class extends Vs{},up=class extends ci{},Ln=class extends Us{},cp=class extends Ns{},pp=class extends Gs{},hp=class extends js{},sl=class extends Xs{},fp=class extends Zs{},mp=class extends qs{},dp=class extends ra{},et=class extends ra{},pi=class extends Js{},ll=class extends Qs{};m();var nk=ze([{name:"a_pos",components:2,type:"Int16"}],4);var{members:Lv,size:jG,alignment:HG}=nk;m();var de=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&&ve("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}])}};de.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1;X("SegmentVector",de);m();m();function Kd(t,e){return t=ce(Math.floor(t),0,255),e=ce(Math.floor(e),0,255),256*t+e}m();var ul=ze([{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"}]);m();var Ov=se(ey(),1);var cl=class t{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,n,i){this.ids.push(Fv(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=Fv(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 ty(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 Fv(t){let e=+t;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:(0,Ov.default)(String(t))}function ty(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;gp(t,o,a),gp(e,3*o,3*a),gp(e,3*o+1,3*a+1),gp(e,3*o+2,3*a+2)}a-r<n-a?(ty(t,e,r,a),r=a+1):(ty(t,e,a+1,n),n=a)}}function gp(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}X("FeaturePositionMap",cl);m();var $r=class{constructor(e,r){this.gl=e.gl,this.location=r}},re=class extends $r{constructor(e,r){super(e,r),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1i(this.location,e))}},N=class extends $r{constructor(e,r){super(e,r),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}},ee=class extends $r{constructor(e,r){super(e,r),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]))}},xt=class extends $r{constructor(e,r){super(e,r),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]))}},Bt=class extends $r{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]))}},zt=class extends $r{constructor(e,r){super(e,r),this.current=K.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))}},pl=class extends $r{constructor(e,r){super(e,r),this.current=new Array}set(e){if(e!=this.current){this.current=e;let r=new Float32Array(e.length*4);for(let n=0;n<e.length;n++)r[4*n]=e[n].r,r[4*n+1]=e[n].g,r[4*n+2]=e[n].b,r[4*n+3]=e[n].a;this.gl.uniform4fv(this.location,r)}}},hl=class extends $r{constructor(e,r){super(e,r),this.current=new Array}set(e){if(e!=this.current){this.current=e;let r=new Float32Array(e);this.gl.uniform1fv(this.location,r)}}},sk=new Float32Array(16),dt=class extends $r{constructor(e,r){super(e,r),this.current=sk}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 r=1;r<16;r++)if(e[r]!==this.current[r]){this.current=e,this.gl.uniformMatrix4fv(this.location,!1,e);break}}};function ry(t){return[Kd(255*t.r,255*t.g),Kd(255*t.b,255*t.a)]}var ao=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 zt(e,r):new N(e,r)}},hi=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 Bt(e,r):new N(e,r)}},Kr=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 Te(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=ry(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()}},br=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 Te(this.zoom),r,{},i,[],o),s=this.expression.evaluate(new Te(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=ry(n),a=ry(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=ce(this.expression.interpolationFactor(n,this.zoom,this.zoom+1),0,1);e.set(i)}getBinding(e,r,n){return new N(e,r)}},mn=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,ul.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,ul.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}},xp=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 Ot)||!ii(a.property.specification))continue;let s=lk(o,e.type),l=a.value,u=a.property.specification.type,c=a.property.useIntegerZoom,p=a.property.specification["property-type"],h=p==="cross-faded"||p==="cross-faded-data-driven";if(l.kind==="constant")this.binders[o]=h?new hi(l.value,s):new ao(l.value,s,u),i.push("/u_".concat(o));else if(l.kind==="source"||h){let f=Bv(o,u,"source");this.binders[o]=h?new mn(l,u,c,r,f,e.id):new Kr(l,s,u,f),i.push("/a_".concat(o))}else{let f=Bv(o,u,"composite");this.binders[o]=new br(l,s,u,c,r,f),i.push("/z_".concat(o))}}this.cacheKey=i.sort().join("")}getMaxValue(e){let r=this.binders[e];return r instanceof Kr||r instanceof br?r.maxValue:0}populatePaintArrays(e,r,n,i,o){for(let a in this.binders){let s=this.binders[a];(s instanceof Kr||s instanceof br||s instanceof mn)&&s.populatePaintArray(e,r,n,i,o)}}setConstantPatternPositions(e,r){for(let n in this.binders){let i=this.binders[n];i instanceof hi&&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 h=this.binders[p];if((h instanceof Kr||h instanceof br||h instanceof mn)&&h.expression.isStateDependent===!0){let f=i.paint.get(p);h.expression=f.value,h.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 ao||n instanceof hi)&&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 Kr||n instanceof br)for(let i=0;i<n.paintVertexAttributes.length;i++)e.push(n.paintVertexAttributes[i].name);else if(n instanceof mn)for(let i=0;i<ul.members.length;i++)e.push(ul.members[i].name)}return e}getBinderUniforms(){let e=[];for(let r in this.binders){let n=this.binders[r];if(n instanceof ao||n instanceof hi||n instanceof br)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 ao||o instanceof hi||o instanceof br){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 mn){let i=e.fromScale===2?n.zoomInPaintVertexBuffer:n.zoomOutPaintVertexBuffer;i&&this._buffers.push(i)}else(n instanceof Kr||n instanceof br)&&n.paintVertexBuffer&&this._buffers.push(n.paintVertexBuffer)}}upload(e){for(let r in this.binders){let n=this.binders[r];(n instanceof Kr||n instanceof br||n instanceof mn)&&n.upload(e)}this.updatePaintBuffers()}destroy(){for(let e in this.binders){let r=this.binders[e];(r instanceof Kr||r instanceof br||r instanceof mn)&&r.destroy()}}},er=class{constructor(e,r,n=()=>!0){this.programConfigurations={};for(let i of e)this.programConfigurations[i.id]=new xp(i,r,n);this.needsUpload=!1,this._featureMap=new cl,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 lk(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 uk(t){return{"line-pattern":{source:Ln,composite:Ln},"fill-pattern":{source:Ln,composite:Ln},"fill-extrusion-pattern":{source:Ln,composite:Ln}}[t]}function Bv(t,e,r){let n={color:{source:ci,composite:na},number:{source:oo,composite:ci}},i=uk(t);return i&&i[r]||n[e][r]}X("ConstantBinder",ao);X("CrossFadedConstantBinder",hi);X("SourceExpressionBinder",Kr);X("CrossFadedCompositeBinder",mn);X("CompositeExpressionBinder",br);X("ProgramConfiguration",xp,{omit:["_buffers"]});X("ProgramConfigurationSet",er);m();m();var ck=15,ny=Math.pow(2,ck-1)-1,zv=-ny-1;function tr(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=ce(s,zv,ny),a.y=ce(l,zv,ny),(s<a.x||s>a.x+1||l<a.y||l>a.y+1)&&ve("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}m();function rr(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?tr(t):[]}}var Vv=-32768;function pk(t,e,r,n,i){t.emplaceBack(Vv+e*8+n,Vv+r*8+i)}var so=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 op,this.indexArray=new et,this.segments=new de,this.programConfigurations=new er(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:h,sourceLayerIndex:f}of e){let d=this.layers[0]._featureFilter.needGeometry,g=rr(c,d);if(!this.layers[0]._featureFilter.filter(new Te(this.zoom,{globalState:this.globalState}),g,n))continue;let x=s?a.evaluate(g,{},n):void 0,b={id:p,properties:c.properties,type:c.type,sourceLayerIndex:f,index:h,geometry:d?g.geometry:tr(c),patterns:{},sortKey:x};o.push(b)}s&&o.sort((c,p)=>c.sortKey-p.sortKey);for(let c of o){let{geometry:p,index:h,sourceLayerIndex:f}=c,d=e[h].feature;this.addFeature(c,p,h,n,u),r.featureIndex.insert(d,p,h,f,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,Lv),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 h=this.segments.prepareSegment(s*s,this.layoutVertexArray,this.indexArray,e.sortKey),f=h.vertexLength;for(let d=0;d<s;d++)for(let g=0;g<s;g++)pk(this.layoutVertexArray,c,p,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,b=f+(d+1)*s+g;this.indexArray.emplaceBack(x,b+1,x+1),this.indexArray.emplaceBack(x,b,b+1)}h.vertexLength+=s*s,h.primitiveLength+=(s-1)*(s-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,{},i)}};X("CircleBucket",so,{omit:["layers"]});m();var fl=se(fe(),1);function bp(t,e){for(let r=0;r<t.length;r++)if(ia(e,t[r]))return!0;for(let r=0;r<e.length;r++)if(ia(t,e[r]))return!0;return!!oy(t,e)}function Nv(t,e,r){return!!(ia(t,e)||iy(e,t,r))}function _p(t,e){if(t.length===1)return Uv(e,t[0]);for(let r=0;r<e.length;r++){let n=e[r];for(let i=0;i<n.length;i++)if(ia(t,n[i]))return!0}for(let r=0;r<t.length;r++)if(Uv(e,t[r]))return!0;for(let r=0;r<e.length;r++)if(oy(t,e[r]))return!0;return!1}function Gv(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(ia(t,i[o]))return!0}if(hk(t,i,r))return!0}return!1}function hk(t,e,r){if(t.length>1){if(oy(t,e))return!0;for(let n=0;n<e.length;n++)if(iy(e[n],t,r))return!0}for(let n=0;n<t.length;n++)if(iy(t[n],e,r))return!0;return!1}function oy(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(fk(n,i,a,s))return!0}}return!1}function fk(t,e,r,n){return Sn(t,r,n)!==Sn(e,r,n)&&Sn(t,e,r)!==Sn(t,e,n)}function iy(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(jv(t,o,a)<n)return!0}return!1}function jv(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 Uv(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 ia(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 Hv(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 fl.default(e,r),new fl.default(e,i),new fl.default(n,i),new fl.default(n,r)];if(t.length>2){for(let a of o)if(ia(t,a))return!0}for(let a=0;a<t.length-1;a++){let s=t[a],l=t[a+1];if(mk(s,l,o))return!0}return!1}function mk(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=Sn(t,e,r[0]);return o!==Sn(t,e,r[1])||o!==Sn(t,e,r[2])||o!==Sn(t,e,r[3])}m();var vp=se(fe(),1);function lo(t,e,r){let n=e.paint.get(t).value;return n.kind==="constant"?n.value:r.programConfigurations.get(e.id).getMaxValue(t)}function fi(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function mi(t,e,r,n,i){if(!e[0]&&!e[1])return t;let o=vp.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 Xv(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 vp.default(0,0):l.sub(s)._unit()._perp(),p=a===i.length-1?new vp.default(0,0):u.sub(l)._unit()._perp(),h=c._add(p)._unit(),f=h.x*p.x+h.y*p.y;f!==0&&h._mult(1/f),o.push(h._mult(e)._add(l))}r.push(o)}return r}m();var Zv,yk=()=>Zv=Zv||new Ue({"circle-sort-key":new te(D.layout_circle["circle-sort-key"])}),qv,gk=()=>qv=qv||new Ue({"circle-radius":new te(D.paint_circle["circle-radius"]),"circle-color":new te(D.paint_circle["circle-color"]),"circle-blur":new te(D.paint_circle["circle-blur"]),"circle-opacity":new te(D.paint_circle["circle-opacity"]),"circle-translate":new q(D.paint_circle["circle-translate"]),"circle-translate-anchor":new q(D.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new q(D.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new q(D.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new te(D.paint_circle["circle-stroke-width"]),"circle-stroke-color":new te(D.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new te(D.paint_circle["circle-stroke-opacity"])}),Yv={get paint(){return gk()},get layout(){return yk()}};var Wv=se(fe(),1),$v=t=>t.type==="circle",Pp=class extends at{constructor(e){super(e,Yv)}createBucket(e){return new so(e)}queryRadius(e){let r=e;return lo("circle-radius",this,r)+lo("circle-stroke-width",this,r)+fi(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:e,feature:r,featureState:n,geometry:i,transform:o,pixelsToTileUnits:a,unwrappedTileID:s,getElevation:l}){let u=mi(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),h=c+p,f=this.paint.get("circle-pitch-alignment")==="map",d=f?u:xk(u,o,s,l),g=f?h*a:h;for(let x of i)for(let b of x){let v=f?b:Kv(b,o,s,l),P=g,w=o.projectTileCoordinates(b.x,b.y,s,l).signedDistanceFromCamera;if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?P*=w/o.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(P*=o.cameraToCenterDistance/w),Nv(d,v,P))return!0}return!1}};function Kv(t,e,r,n){let i=e.projectTileCoordinates(t.x,t.y,r,n).point;return new Wv.default((i.x*.5+.5)*e.width,(-i.y*.5+.5)*e.height)}function xk(t,e,r,n){return t.map(i=>Kv(i,e,r,n))}m();m();var ml=class extends so{};X("HeatmapBucket",ml,{omit:["layers"]});m();var Jv,bk=()=>Jv=Jv||new Ue({"heatmap-radius":new te(D.paint_heatmap["heatmap-radius"]),"heatmap-weight":new te(D.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new q(D.paint_heatmap["heatmap-intensity"]),"heatmap-color":new En(D.paint_heatmap["heatmap-color"]),"heatmap-opacity":new q(D.paint_heatmap["heatmap-opacity"])}),Qv={get paint(){return bk()}};m();m();function ay(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 e0(t,{width:e,height:r},n){if(e===t.width&&r===t.height)return;let i=ay({},{width:e,height:r},n);sy(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 sy(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 uo=class t{constructor(e,r){ay(this,e,1,r)}resize(e){e0(this,e,1)}clone(){return new t({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,n,i,o){sy(e,r,n,i,o,1)}},Le=class t{constructor(e,r){ay(this,e,4,r)}resize(e){e0(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){sy(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)}};X("AlphaImage",uo);X("RGBAImage",Le);function wp(t){let e={},r=t.resolution||256,n=t.clips?t.clips.length:1,i=t.image||new Le({width:r,height:n});if(!Ub(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:h}=t.clips[a],f=p*(1-c)+h*c;o(s,u,f)}else for(let a=0,s=0;a<r;a++,s+=4){let l=a/(r-1);o(0,s,l)}return i}var oa="big-fb",t0=t=>t.type==="heatmap",Tp=class extends at{createBucket(e){return new ml(e)}constructor(e){super(e,Qv),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=wp({expression:e,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(oa)&&this.heatmapFbos.delete(oa)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}};m();m();var r0,_k=()=>r0=r0||new Ue({"hillshade-illumination-direction":new q(D.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-altitude":new q(D.paint_hillshade["hillshade-illumination-altitude"]),"hillshade-illumination-anchor":new q(D.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new q(D.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new q(D.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new q(D.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new q(D.paint_hillshade["hillshade-accent-color"]),"hillshade-method":new q(D.paint_hillshade["hillshade-method"])}),n0={get paint(){return _k()}};var i0=t=>t.type==="hillshade",Sp=class extends at{constructor(e){super(e,n0),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(Ve);return{directionRadians:e.map(Ve),altitudeRadians:a,shadowColor:i,highlightColor:n}}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}};m();m();var o0,vk=()=>o0=o0||new Ue({"color-relief-opacity":new q(D["paint_color-relief"]["color-relief-opacity"]),"color-relief-color":new En(D["paint_color-relief"]["color-relief-color"])}),a0={get paint(){return vk()}};m();var Se=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||$t(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||$t(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}};m();var ly=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)){ve('"'.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 uy(e,this.getUnpackVector())}getPixels(){return new Le({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 uy(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}}X("DEMData",ly);var s0=t=>t.type==="color-relief",Cp=class extends at{constructor(e){super(e,a0)}_createColorRamp(e){let r={elevationStops:[],colorStops:[]},n=this._transitionablePaint._values["color-relief-color"].value.expression;if(n instanceof pn&&n._styleExpression.expression instanceof Ht){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=[K.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 ve("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 Le({width:i.colorStops.length,height:1}),a=new Le({width:i.colorStops.length,height:1});for(let s=0;s<i.elevationStops.length;s++){let l=uy(i.elevationStops[s],n);a.setPixel(0,s,new K(l.r/255,l.g/255,l.b/255,1)),o.setPixel(0,s,i.colorStops[s])}return this.colorRampTextures={elevationTexture:new Se(e,a,e.gl.RGBA),colorTexture:new Se(e,o,e.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return this.visibility!=="none"&&!!this.colorRampTextures}};m();m();m();var Pk=ze([{name:"a_pos",components:2,type:"Int16"}],4);var{members:l0,size:IH,alignment:AH}=Pk;m();function aa(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 sa(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}m();var bl=se(fe(),1);m();function hy(t,e,r=2){let n=e&&e.length,i=n?e[0]*r:t.length,o=c0(t,0,i,r,!0),a=[];if(!o||o.next===o.prev)return a;let s,l,u;if(n&&(o=Mk(t,e,o,r)),t.length>80*r){s=1/0,l=1/0;let c=-1/0,p=-1/0;for(let h=r;h<i;h+=r){let f=t[h],d=t[h+1];f<s&&(s=f),d<l&&(l=d),f>c&&(c=f),d>p&&(p=d)}u=Math.max(c-s,p-l),u=u!==0?32767/u:0}return yl(o,a,r,s,l,u,0),a}function c0(t,e,r,n,i){let o;if(i===zk(t,e,r,n)>0)for(let a=e;a<r;a+=n)o=u0(a/n|0,t[a],t[a+1],o);else for(let a=r-n;a>=e;a-=n)o=u0(a/n|0,t[a],t[a+1],o);return o&&la(o,o.next)&&(xl(o),o=o.next),o}function co(t,e){if(!t)return t;e||(e=t);let r=t,n;do if(n=!1,!r.steiner&&(la(r,r.next)||lt(r.prev,r,r.next)===0)){if(xl(r),r=e=r.prev,r===r.next)break;n=!0}else r=r.next;while(n||r!==e);return e}function yl(t,e,r,n,i,o,a){if(!t)return;!a&&o&&Dk(t,n,i,o);let s=t;for(;t.prev!==t.next;){let l=t.prev,u=t.next;if(o?Tk(t,n,i,o):wk(t)){e.push(l.i,t.i,u.i),xl(t),t=u.next,s=u.next;continue}if(t=u,t===s){a?a===1?(t=Sk(co(t),e),yl(t,e,r,n,i,o,2)):a===2&&Ck(t,e,r,n,i,o):yl(co(t),e,r,n,i,o,1);break}}}function wk(t){let e=t.prev,r=t,n=t.next;if(lt(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),h=Math.max(i,o,a),f=Math.max(s,l,u),d=n.next;for(;d!==e;){if(d.x>=c&&d.x<=h&&d.y>=p&&d.y<=f&&dl(i,s,o,l,a,u,d.x,d.y)&<(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function Tk(t,e,r,n){let i=t.prev,o=t,a=t.next;if(lt(i,o,a)>=0)return!1;let s=i.x,l=o.x,u=a.x,c=i.y,p=o.y,h=a.y,f=Math.min(s,l,u),d=Math.min(c,p,h),g=Math.max(s,l,u),x=Math.max(c,p,h),b=cy(f,d,e,r,n),v=cy(g,x,e,r,n),P=t.prevZ,w=t.nextZ;for(;P&&P.z>=b&&w&&w.z<=v;){if(P.x>=f&&P.x<=g&&P.y>=d&&P.y<=x&&P!==i&&P!==a&&dl(s,c,l,p,u,h,P.x,P.y)&<(P.prev,P,P.next)>=0||(P=P.prevZ,w.x>=f&&w.x<=g&&w.y>=d&&w.y<=x&&w!==i&&w!==a&&dl(s,c,l,p,u,h,w.x,w.y)&<(w.prev,w,w.next)>=0))return!1;w=w.nextZ}for(;P&&P.z>=b;){if(P.x>=f&&P.x<=g&&P.y>=d&&P.y<=x&&P!==i&&P!==a&&dl(s,c,l,p,u,h,P.x,P.y)&<(P.prev,P,P.next)>=0)return!1;P=P.prevZ}for(;w&&w.z<=v;){if(w.x>=f&&w.x<=g&&w.y>=d&&w.y<=x&&w!==i&&w!==a&&dl(s,c,l,p,u,h,w.x,w.y)&<(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function Sk(t,e){let r=t;do{let n=r.prev,i=r.next.next;!la(n,i)&&h0(n,r,r.next,i)&&gl(n,i)&&gl(i,n)&&(e.push(n.i,r.i,i.i),xl(r),xl(r.next),r=t=i),r=r.next}while(r!==t);return co(r)}function Ck(t,e,r,n,i,o){let a=t;do{let s=a.next.next;for(;s!==a.prev;){if(a.i!==s.i&&Fk(a,s)){let l=f0(a,s);a=co(a,a.next),l=co(l,l.next),yl(a,e,r,n,i,o,0),yl(l,e,r,n,i,o,0);return}s=s.next}a=a.next}while(a!==t)}function Mk(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=c0(t,s,l,n,!1);u===u.next&&(u.steiner=!0),i.push(kk(u))}i.sort(Ik);for(let o=0;o<i.length;o++)r=Ak(i[o],r);return r}function Ik(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 Ak(t,e){let r=Ek(t,e);if(!r)return e;let n=f0(r,t);return co(n,n.next),co(r,r.next)}function Ek(t,e){let r=e,n=t.x,i=t.y,o=-1/0,a;if(la(t,r))return r;do{if(la(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&&p0(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);gl(r,t)&&(p<c||p===c&&(r.x>a.x||r.x===a.x&&Lk(a,r)))&&(a=r,c=p)}r=r.next}while(r!==s);return a}function Lk(t,e){return lt(t.prev,t,e.prev)<0&<(e.next,t,t.next)<0}function Dk(t,e,r,n){let i=t;do i.z===0&&(i.z=cy(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,Rk(i)}function Rk(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 cy(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 kk(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 p0(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 dl(t,e,r,n,i,o,a,s){return!(t===a&&e===s)&&p0(t,e,r,n,i,o,a,s)}function Fk(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!Ok(t,e)&&(gl(t,e)&&gl(e,t)&&Bk(t,e)&&(lt(t.prev,t,e.prev)||lt(t,e.prev,e))||la(t,e)&<(t.prev,t,t.next)>0&<(e.prev,e,e.next)>0)}function lt(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function la(t,e){return t.x===e.x&&t.y===e.y}function h0(t,e,r,n){let i=Ip(lt(t,e,r)),o=Ip(lt(t,e,n)),a=Ip(lt(r,n,t)),s=Ip(lt(r,n,e));return!!(i!==o&&a!==s||i===0&&Mp(t,r,e)||o===0&&Mp(t,n,e)||a===0&&Mp(r,t,n)||s===0&&Mp(r,e,n))}function Mp(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 Ip(t){return t>0?1:t<0?-1:0}function Ok(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&&h0(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}function gl(t,e){return lt(t.prev,t,t.next)<0?lt(t,e,t.next)>=0&<(t,t.prev,e)>=0:lt(t,e,t.prev)<0||lt(t,t.next,e)<0}function Bk(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 f0(t,e){let r=py(t.i,t.x,t.y),n=py(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 u0(t,e,r,n){let i=py(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 xl(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 py(t,e,r){return{i:t,x:e,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function zk(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}m();var _r=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)}},Ap=class Ap{constructor(e){this.fill=e.fill,this.line=e.line,this.tile=e.tile,this.stencil=e.stencil,this.circle=e.circle}};Ap.noSubdivision=new Ap({fill:new _r(0,0),line:new _r(0,0),tile:new _r(0,0),stencil:new _r(0,0),circle:1});var di=Ap;X("SubdivisionGranularityExpression",_r);X("SubdivisionGranularitySetting",di);var dn=-32768,Dn=32767,fy=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 Uk(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 g=0;g<3;g++){let x=a[g*2],b=a[g*2+1];s=Math.min(s,x),u=Math.max(u,x),l=Math.min(l,b),c=Math.max(c,b)}if(s===u||l===c)continue;let p=Math.floor(s/this._granularityCellSize),h=Math.ceil(u/this._granularityCellSize),f=Math.floor(l/this._granularityCellSize),d=Math.ceil(c/this._granularityCellSize);if(p===h&&f===d){r.push(...o);continue}for(let g=f;g<d;g++){let x=this._scanlineGenerateVertexRingForCellRow(g,a,o);Nk(this._vertexBuffer,x,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],h=r[(s+2)*2%6],f=r[((s+2)*2+1)%6],d=c-l,g=p-u,x=d===0,b=g===0,v=(i-u)/g,P=(o-u)/g,w=Math.min(v,P),T=Math.max(v,P);if(!b&&(w>=1||T<=0)||b&&(u<i||u>o)){p>=i&&p<=o&&a.push(n[(s+1)%3]);continue}if(!b&&w>0){let M=l+d*w,E=u+g*w;a.push(this._vertexToIndex(M,E))}let S=l+d*Math.max(w,0),I=l+d*Math.min(T,1);if(x||this._generateIntraEdgeVertices(a,l,u,c,p,S,I),!b&&T<1){let M=l+d*T,E=u+g*T;a.push(this._vertexToIndex(M,E))}(b||p>=i&&p<=o)&&a.push(n[(s+1)%3]),!b&&(p<=i||p>=o)&&this._generateInterEdgeVertices(a,l,u,c,p,h,f,I,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),h=c?Math.max(r,i):Math.max(a,s),f=Math.floor(p/this._granularityCellSize)+1,d=Math.ceil(h/this._granularityCellSize)-1;if(c?r<i:a<s)for(let x=f;x<=d;x++){let b=x*this._granularityCellSize,v=n+u*(b-r)/l;e.push(this._vertexToIndex(b,v))}else for(let x=d;x>=f;x--){let b=x*this._granularityCellSize,v=n+u*(b-r)/l;e.push(this._vertexToIndex(b,v))}}_generateInterEdgeVertices(e,r,n,i,o,a,s,l,u,c){let p=o-n,h=a-i,f=s-o,d=(u-o)/f,g=(c-o)/f,x=Math.min(d,g),b=Math.max(d,g),v=i+h*x,P=Math.floor(Math.min(v,l)/this._granularityCellSize)+1,w=Math.ceil(Math.max(v,l)/this._granularityCellSize)-1,T=l<v,S=f===0;if(S&&(s===u||s===c))return;if(S||x>=1||b<=0){let M=r-a,E=n-s,L=(u-s)/E,k=(c-s)/E,F=Math.min(L,k),z=a+M*F;P=Math.floor(Math.min(z,l)/this._granularityCellSize)+1,w=Math.ceil(Math.max(z,l)/this._granularityCellSize)-1,T=l<z}let I=p>0?c:u;if(T)for(let M=P;M<=w;M++){let E=M*this._granularityCellSize;e.push(this._vertexToIndex(E,I))}else for(let M=w;M>=P;M--){let E=M*this._granularityCellSize;e.push(this._vertexToIndex(E,I))}}_generateOutline(e){let r=[];for(let n of e){let i=ua(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===dn&&(e[r+1]=dn+1),n===Dn&&(e[r+1]=Dn-1)}}_generatePoleQuad(e,r,n,i,o,a){i>o!=(a===dn)?(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],h=i[u*2],f=i[u*2+1],d=i[c*2],g=i[c*2+1],x=i[p*2],b=i[p*2+1];r&&(f===o&&g===o&&this._generatePoleQuad(e,u,c,h,d,dn),g===o&&b===o&&this._generatePoleQuad(e,c,p,d,x,dn),b===o&&f===o&&this._generatePoleQuad(e,p,u,x,h,dn)),n&&(f===a&&g===a&&this._generatePoleQuad(e,u,c,h,d,Dn),g===a&&b===a&&this._generatePoleQuad(e,c,p,d,x,Dn),b===a&&f===a&&this._generatePoleQuad(e,p,u,x,h,Dn))}}_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}=Vk(e);this._initializeVertices(n);let o;try{let s=hy(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 Ep(t,e,r,n=!0){return new fy(r,e).subdividePolygonInternal(t,n)}function ua(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 bl.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],h=c<l-1?t[c+1]:t[0],f=p.x,d=p.y,g=h.x,x=h.y,b=f!==g,v=d!==x;if(!b&&!v)continue;let P=g-f,w=x-d,T=Math.abs(P),S=Math.abs(w),I=f,M=d;for(;;){let L=P>0?(Math.floor(I/a)+1)*a:(Math.ceil(I/a)-1)*a,k=w>0?(Math.floor(M/a)+1)*a:(Math.ceil(M/a)-1)*a,F=Math.abs(I-L),z=Math.abs(M-k),A=Math.abs(I-g),R=Math.abs(M-x),H=b?F/T:Number.POSITIVE_INFINITY,W=v?z/S:Number.POSITIVE_INFINITY;if((A<=F||!b)&&(R<=z||!v))break;if(H<W&&b||!v){I=L,M=M+w*H;let $=new bl.default(I,Math.round(M));(s[s.length-1].x!==$.x||s[s.length-1].y!==$.y)&&s.push($)}else{I=I+P*W,M=k;let $=new bl.default(Math.round(I),M);(s[s.length-1].x!==$.x||s[s.length-1].y!==$.y)&&s.push($)}}let E=new bl.default(g,x);(s[s.length-1].x!==E.x||s[s.length-1].y!==E.y)&&s.push(E)}return s}function Vk(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 Uk(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],h=t[a*2+1],f=u-s,d=c-l,g=p-s,x=h-l;f*x-d*g>0?(r.push(i),r.push(a),r.push(o)):(r.push(i),r.push(o),r.push(a))}return r}function Nk(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],h=t[e[u]*2],f=t[e[u]*2+1],d=t[e[a]*2],g=t[e[a]*2+1],x=t[e[s]*2],b=t[e[s]*2+1],v=!1;if(c<h)v=!0;else if(c>h)v=!1;else{let P=x-d,T=b-g,S=-P,I=g<b?1:-1,M=((c-d)*T+(p-g)*S)*I,E=((h-d)*T+(f-g)*S)*I;M>E&&(v=!0)}if(v){let P=e[l],w=e[a],T=e[s];P!==w&&P!==T&&w!==T&&r.push(T,w,P),a--,a<0&&(a=o-1)}else{let P=e[u],w=e[a],T=e[s];P!==w&&P!==T&&w!==T&&r.push(T,w,P),s++,s>=o&&(s=0)}if(l===u)break}}m();function Lp(t,e,r,n,i,o,a,s,l){let u=i.length/2,c=a&&s&&l;if(u<de.MAX_VERTEX_ARRAY_LENGTH){let p=e.prepareSegment(u,r,n),h=p.vertexLength;for(let g=0;g<o.length;g+=3)n.emplaceBack(h+o[g],h+o[g+1],h+o[g+2]);p.vertexLength+=u,p.primitiveLength+=o.length/3;let f,d;c&&(d=a.prepareSegment(u,r,s),f=d.vertexLength,d.vertexLength+=u);for(let g=0;g<i.length;g+=2)t(i[g],i[g+1]);if(c)for(let g=0;g<l.length;g++){let x=l[g];for(let b=1;b<x.length;b+=2)s.emplaceBack(f+x[b-1],f+x[b]);d.primitiveLength+=x.length/2}}else Gk(e,r,n,i,o,t),c&&jk(a,r,s,i,l,t),e.forceNewSegmentOnNextPrepare(),a==null||a.forceNewSegmentOnNextPrepare()}function _l(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 Gk(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 h=i[p-2],f=i[p-1],d=i[p],g=a[h]<l,x=a[f]<l,b=a[d]<l,v=(g?1:0)+(x?1:0)+(b?1:0);u.vertexLength+v>de.MAX_VERTEX_ARRAY_LENGTH&&(u=t.createNewSegment(e,r),l=s.count,g=!0,x=!0,b=!0,c=0);let P=_l(a,n,o,s,h,g,u),w=_l(a,n,o,s,f,x,u),T=_l(a,n,o,s,d,b,u);r.emplaceBack(c+P-l,c+w-l,c+T-l),u.primitiveLength++}}function jk(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 h=i[p];for(let f=1;f<i[p].length;f+=2){let d=h[f-1],g=h[f],x=a[d]<l,b=a[g]<l,v=(x?1:0)+(b?1:0);u.vertexLength+v>de.MAX_VERTEX_ARRAY_LENGTH&&(u=t.createNewSegment(e,r),l=s.count,x=!0,b=!0,c=0);let P=_l(a,n,o,s,d,x,u),w=_l(a,n,o,s,g,b,u);r.emplaceBack(c+P-l,c+w-l),u.primitiveLength++}}}var Hk=500,vl=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 ap,this.indexArray=new et,this.indexArray2=new pi,this.programConfigurations=new er(e.layers,e.zoom),this.segments=new de,this.segments2=new de,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,n){this.hasPattern=aa("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,h=rr(s,p);if(!this.layers[0]._featureFilter.filter(new Te(this.zoom,{globalState:this.globalState}),h,n))continue;let f=o?i.evaluate(h,{},n,r.availableImages):void 0,d={id:l,properties:s.properties,type:s.type,sourceLayerIndex:c,index:u,geometry:p?h.geometry:tr(s),patterns:{},sortKey:f};a.push(d)}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 h=sa("fill",this.layers,s,this.zoom,r);this.patternFeatures.push(h)}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,l0),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 Rs(r,Hk)){let l=Ep(s,i,a.fill.getGranularityForZoomLevel(i.z)),u=this.layoutVertexArray;Lp((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)}};X("FillBucket",vl,{omit:["layers","patternFeatures"]});m();var m0,Xk=()=>m0=m0||new Ue({"fill-sort-key":new te(D.layout_fill["fill-sort-key"])}),d0,Zk=()=>d0=d0||new Ue({"fill-antialias":new q(D.paint_fill["fill-antialias"]),"fill-opacity":new te(D.paint_fill["fill-opacity"]),"fill-color":new te(D.paint_fill["fill-color"]),"fill-outline-color":new te(D.paint_fill["fill-outline-color"]),"fill-translate":new q(D.paint_fill["fill-translate"]),"fill-translate-anchor":new q(D.paint_fill["fill-translate-anchor"]),"fill-pattern":new An(D.paint_fill["fill-pattern"])}),y0={get paint(){return Zk()},get layout(){return Xk()}};var g0=t=>t.type==="fill",Dp=class extends at{constructor(e){super(e,y0)}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 vl(e)}queryRadius(){return fi(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:e,geometry:r,transform:n,pixelsToTileUnits:i}){let o=mi(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-n.bearingInRadians,i);return _p(o,r)}isTileClipped(){return!0}};m();m();m();var qk=ze([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),x0=ze([{name:"a_centroid",components:2,type:"Int16"}],4);var{members:b0,size:TX,alignment:SX}=qk;var C0=se(Pl(),1);var oF=C0.default.VectorTileFeature.types,aF=500,yy=Math.pow(2,13);function wl(t,e,r,n,i,o,a,s){t.emplaceBack(e,r,Math.floor(n*yy)*2+a,i*yy*2,o*yy*2,Math.round(s))}var Tl=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 sp,this.centroidVertexArray=new Dt,this.indexArray=new et,this.programConfigurations=new er(e.layers,e.zoom),this.segments=new de,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,n){this.features=[],this.hasPattern=aa("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=rr(i,l);if(!this.layers[0]._featureFilter.filter(new Te(this.zoom,{globalState:this.globalState}),u,n))continue;let c={id:o,sourceLayerIndex:s,index:a,geometry:l?u.geometry:tr(i),properties:i.properties,type:i.type,patterns:{}};this.hasPattern?this.features.push(sa("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,b0),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,x0.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 Rs(r,aF)){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),h=Math.floor(l.y/l.sampleCount);for(let f=0;f<c;f++)this.centroidVertexArray.emplaceBack(p,h)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,o,i)}processPolygon(e,r,n,i,o){if(i.length<1||S0(i[0]))return;for(let p of i)p.length!==0&&sF(e,p);let a={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},s=o.fill.getGranularityForZoomLevel(r.z),l=oF[n.type]==="Polygon";for(let p of i){if(p.length===0||S0(p))continue;let h=ua(p,s,l);this._generateSideFaces(h,a)}if(!l)return;let u=Ep(i,r,s,!1),c=this.layoutVertexArray;Lp((p,h)=>{wl(c,p,h,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(lF(o,a))continue;r.segment.vertexLength+4>de.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),wl(this.layoutVertexArray,o.x,o.y,s.x,s.y,0,0,n),wl(this.layoutVertexArray,o.x,o.y,s.x,s.y,0,1,n),n+=l,wl(this.layoutVertexArray,a.x,a.y,s.x,s.y,0,0,n),wl(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 sF(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++)}}X("FillExtrusionBucket",Tl,{omit:["layers","features"]});function lF(t,e){return t.x===e.x&&(t.x<0||t.x>8192)||t.y===e.y&&(t.y<0||t.y>8192)}function S0(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)}m();var M0,uF=()=>M0=M0||new Ue({"fill-extrusion-opacity":new q(D["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new te(D["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new q(D["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new q(D["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new An(D["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new te(D["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new te(D["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new q(D["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])}),I0={get paint(){return uF()}};var kp=se(fe(),1);var E0=t=>t.type==="fill-extrusion",Fp=class extends at{constructor(e){super(e,I0)}createBucket(e){return new Tl(e)}queryRadius(){return fi(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=mi(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=hF(l,s,0),h=pF(i,c,u,s),f=h[0],d=h[1];return cF(f,d,p)}};function Sl(t,e){return t.x*e.x+t.y*e.y}function A0(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=Sl(s,s),p=Sl(s,l),h=Sl(l,l),f=Sl(u,s),d=Sl(u,l),g=c*h-p*p,x=(h*f-p*d)/g,b=(c*d-p*f)/g,v=1-x-b,P=n.z*v+i.z*x+o.z*b;if(isFinite(P))return P}return 1/0}else{let r=1/0;for(let n of e)r=Math.min(r,n.z);return r}}function cF(t,e,r){let n=1/0;_p(r,e)&&(n=A0(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],h=[l,u,p,c,l];bp(r,h)&&(n=Math.min(n,A0(r,h)))}}return n===1/0?!1:n}function pF(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,h=n[10]*r,f=n[11]*r;for(let d of t){let g=[],x=[];for(let b of d){let v=b.x,P=b.y,w=n[0]*v+n[4]*P+n[12],T=n[1]*v+n[5]*P+n[13],S=n[2]*v+n[6]*P+n[14],I=n[3]*v+n[7]*P+n[15],M=w+a,E=T+s,L=S+l,k=I+u,F=w+c,z=T+p,A=S+h,R=I+f,H=new kp.default(M/k,E/k);H.z=L/k,g.push(H);let W=new kp.default(F/R,z/R);W.z=A/R,x.push(W)}i.push(g),o.push(x)}return[i,o]}function hF(t,e,r){let n=[];for(let i of t){let o=[i.x,i.y,r,1];Ne.transformMat4(o,o,e),n.push(new kp.default(o[0]/o[3],o[1]/o[3]))}return n}m();m();m();var fF=ze([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:L0,size:dZ,alignment:yZ}=fF;m();var mF=ze([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:D0,size:_Z,alignment:vZ}=mF;var F0=se(Pl(),1);var dF=F0.default.VectorTileFeature.types,R0=63,yF=Math.cos(75/2*(Math.PI/180)),gF=15,xF=20,bF=15,O0=1/2,k0=Math.pow(2,bF-1)/O0,Cl=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 lp,this.layoutVertexArray2=new up,this.indexArray=new et,this.programConfigurations=new er(e.layers,e.zoom),this.segments=new de,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,n){this.hasPattern=aa("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,h=rr(s,p);if(!this.layers[0]._featureFilter.filter(new Te(this.zoom,{globalState:this.globalState}),h,n))continue;let f=o?i.evaluate(h,{},n):void 0,d={id:l,properties:s.properties,type:s.type,sourceLayerIndex:c,index:u,geometry:p?h.geometry:tr(s),patterns:{},sortKey:f};a.push(d)}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 h=sa("line",this.layers,s,this.zoom,r);this.patternFeatures.push(h)}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,D0)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,L0),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 h of r)this.addLine(h,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=ua(e,u),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 c=dF[r.type]==="Polygon",p=e.length;for(;p>=2&&e[p-1].equals(e[p-2]);)p--;let h=0;for(;h<p-1&&e[h].equals(e[h+1]);)h++;if(p<(c?3:2))return;n==="bevel"&&(o=1.05);let f=this.overscaling<=16?gF*8192/(512*this.overscaling):0,d=this.segments.prepareSegment(p*10,this.layoutVertexArray,this.indexArray),g,x,b,v,P;this.e1=this.e2=-1,c&&(g=e[p-2],P=e[h].sub(g)._unit()._perp());for(let w=h;w<p;w++){if(b=w===p-1?c?e[h+1]:void 0:e[w+1],b&&e[w].equals(b))continue;P&&(v=P),g&&(x=g),g=e[w],P=b?b.sub(g)._unit()._perp():v,v=v||P;let T=v.add(P);(T.x!==0||T.y!==0)&&T._unit();let S=v.x*P.x+v.y*P.y,I=T.x*P.x+T.y*P.y,M=I!==0?1/I:1/0,E=2*Math.sqrt(2-2*I),L=I<yF&&x&&b,k=v.x*P.y-v.y*P.x>0;if(L&&w>h){let A=g.dist(x);if(A>2*f){let R=g.sub(g.sub(x)._mult(f/A)._round());this.updateDistance(x,R),this.addCurrentVertex(R,v,0,0,d),x=R}}let F=x&&b,z=F?n:c?"butt":i;if(F&&z==="round"&&(M<a?z="miter":M<=2&&(z="fakeround")),z==="miter"&&M>o&&(z="bevel"),z==="bevel"&&(M>2&&(z="flipbevel"),M<o&&(z="miter")),x&&this.updateDistance(x,g),z==="miter")T._mult(M),this.addCurrentVertex(g,T,0,0,d);else if(z==="flipbevel"){if(M>100)T=P.mult(-1);else{let A=M*v.add(P).mag()/v.sub(P).mag();T._perp()._mult(A*(k?-1:1))}this.addCurrentVertex(g,T,0,0,d),this.addCurrentVertex(g,T.mult(-1),0,0,d)}else if(z==="bevel"||z==="fakeround"){let A=-Math.sqrt(M*M-1),R=k?A:0,H=k?0:A;if(x&&this.addCurrentVertex(g,v,R,H,d),z==="fakeround"){let W=Math.round(E*180/Math.PI/xF);for(let $=1;$<W;$++){let he=$/W;if(he!==.5){let be=he-.5,ye=1.0904+S*(-3.2452+S*(3.55645-S*1.43519)),qe=.848013+S*(-1.06021+S*.215638);he=he+he*be*(he-1)*(ye*be*be+qe)}let Xe=P.sub(v)._mult(he)._add(v)._unit()._mult(k?-1:1);this.addHalfVertex(g,Xe.x,Xe.y,!1,k,0,d)}}b&&this.addCurrentVertex(g,P,-R,-H,d)}else if(z==="butt")this.addCurrentVertex(g,T,0,0,d);else if(z==="square"){let A=x?1:-1;this.addCurrentVertex(g,T,A,A,d)}else z==="round"&&(x&&(this.addCurrentVertex(g,v,0,0,d),this.addCurrentVertex(g,v,1,1,d,!0)),b&&(this.addCurrentVertex(g,P,-1,-1,d,!0),this.addCurrentVertex(g,P,0,0,d)));if(L&&w<p-1){let A=g.dist(b);if(A>2*f){let R=g.add(b.sub(g)._mult(f/A)._round());this.updateDistance(g,R),this.addCurrentVertex(R,P,0,0,d),g=R}}}}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>k0/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*(k0-1):this.scaledDistance)*O0;if(this.layoutVertexArray.emplaceBack((e<<1)+(o?1:0),(r<<1)+(a?1:0),Math.round(R0*n)+128,Math.round(R0*i)+128,(s===0?0:s<0?-1:1)+1|(c&63)<<2,c>>6),this.lineClips){let h=this.scaledDistance-this.lineClips.start,f=this.lineClips.end-this.lineClips.start,d=h/f;this.layoutVertexArray2.emplaceBack(d,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()}};X("LineBucket",Cl,{omit:["layers","patternFeatures"]});m();var B0,_F=()=>B0=B0||new Ue({"line-cap":new q(D.layout_line["line-cap"]),"line-join":new te(D.layout_line["line-join"]),"line-miter-limit":new q(D.layout_line["line-miter-limit"]),"line-round-limit":new q(D.layout_line["line-round-limit"]),"line-sort-key":new te(D.layout_line["line-sort-key"])}),z0,vF=()=>z0=z0||new Ue({"line-opacity":new te(D.paint_line["line-opacity"]),"line-color":new te(D.paint_line["line-color"]),"line-translate":new q(D.paint_line["line-translate"]),"line-translate-anchor":new q(D.paint_line["line-translate-anchor"]),"line-width":new te(D.paint_line["line-width"]),"line-gap-width":new te(D.paint_line["line-gap-width"]),"line-offset":new te(D.paint_line["line-offset"]),"line-blur":new te(D.paint_line["line-blur"]),"line-dasharray":new no(D.paint_line["line-dasharray"]),"line-pattern":new An(D.paint_line["line-pattern"]),"line-gradient":new En(D.paint_line["line-gradient"])}),gy={get paint(){return vF()},get layout(){return _F()}};var xy=class extends te{possiblyEvaluate(e,r){return r=new Te(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=Z({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(e,r,n,i)}},Op,U0=t=>t.type==="line",Bp=class extends at{constructor(e){super(e,gy),this.gradientVersion=0,Op||(Op=new xy(gy.paint.properties["line-width"].specification),Op.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){let r=this.gradientExpression();Q_(r)?this.stepInterpolant=r._styleExpression.expression instanceof Zo: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"]=Op.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new Cl(e)}queryRadius(e){let r=e,n=V0(lo("line-width",this,r),lo("line-gap-width",this,r)),i=lo("line-offset",this,r);return n/2+Math.abs(i)+fi(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:e,feature:r,featureState:n,geometry:i,transform:o,pixelsToTileUnits:a}){let s=mi(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-o.bearingInRadians,a),l=a/2*V0(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=Xv(i,u*a)),Gv(s,i,l)}isTileClipped(){return!0}};function V0(t,e){return e>0?e+2*t:t}m();m();m();var N0=ze([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),G0=ze([{name:"a_projected_pos",components:3,type:"Float32"}],4),nq=ze([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),j0=ze([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]),iq=ze([{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"}]),by=ze([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),H0=ze([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4),oq=ze([{name:"triangle",components:3,type:"Uint16"}]),aq=ze([{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"}]),sq=ze([{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"}]),lq=ze([{type:"Float32",name:"offsetX"}]),uq=ze([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),cq=ze([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);var Al=se(fe(),1);m();function PF(t,e,r){let n=e.layout.get("text-transform").evaluate(r,{});return n==="uppercase"?t=t.toLocaleUpperCase():n==="lowercase"&&(t=t.toLocaleLowerCase()),hn.applyArabicShaping&&(t=hn.applyArabicShaping(t)),t}function X0(t,e,r){return t.sections.forEach(n=>{n.text=PF(n.text,e,r)}),t}m();function Z0(t){let e={},r={},n=[],i=0;function o(u){n.push(t[u]),i++}function a(u,c,p){let h=r[u];return delete r[u],r[c]=h,n[h].geometry[0].pop(),n[h].geometry[0]=n[h].geometry[0].concat(p[0]),h}function s(u,c,p){let h=e[c];return delete e[c],e[u]=h,n[h].geometry[0].shift(),n[h].geometry[0]=p[0].concat(n[h].geometry[0]),h}function l(u,c,p){let h=p?c[0][c[0].length-1]:c[0][0];return"".concat(u,":").concat(h.x,":").concat(h.y)}for(let u=0;u<t.length;u++){let c=t[u],p=c.geometry,h=c.text?c.text.toString():null;if(!h){o(u);continue}let f=l(h,p),d=l(h,p,!0);if(f in r&&d in e&&r[f]!==e[d]){let g=s(f,d,p),x=a(f,d,n[g].geometry);delete e[f],delete r[d],r[l(h,n[x].geometry,!0)]=x,n[g].geometry=null}else f in r?a(f,d,p):d in e?s(f,d,p):(o(u),e[f]=i-1,r[d]=i-1)}return n.filter(u=>u.geometry)}m();m();var q0={"!":"\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"};m();var yi=24;m();var t1=se(Py(),1),e1=3;function UF(t,e,r){t===1&&r.readMessage(NF,e)}function NF(t,e,r){if(t===3){let{id:n,bitmap:i,width:o,height:a,left:s,top:l,advance:u}=r.readMessage(GF,{});e.push({id:n,bitmap:new uo({width:o+2*e1,height:a+2*e1},i),metrics:{width:o,height:a,left:s,top:l,advance:u}})}}function GF(t,e,r){t===1?e.id=r.readVarint():t===2?e.bitmap=r.readBytes():t===3?e.width=r.readVarint():t===4?e.height=r.readVarint():t===5?e.left=r.readSVarint():t===6?e.top=r.readSVarint():t===7&&(e.advance=r.readVarint())}function r1(t){return new t1.default(t).readFields(UF,[])}m();function n1(t){let{userImage:e}=t;return e&&e.render&&e.render()?(t.data.replace(new Uint8Array(e.data.buffer)),!0):!1}m();m();function Ml(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 nr=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+nr,this.paddedRect.y+nr]}get br(){return[this.paddedRect.x+this.paddedRect.w-nr,this.paddedRect.y+this.paddedRect.h-nr]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-nr*2)/this.pixelRatio,(this.paddedRect.h-nr*2)/this.pixelRatio]}},wy=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}=Ml(o),l=new Le({width:a||1,height:s||1});for(let u in e){let c=e[u],p=n[u].paddedRect;Le.copy(c.data,l,{x:0,y:0},{x:p.x+nr,y:p.y+nr},c.data)}for(let u in r){let c=r[u],p=i[u].paddedRect,h=p.x+nr,f=p.y+nr,d=c.data.width,g=c.data.height;Le.copy(c.data,l,{x:0,y:0},{x:h,y:f},c.data),Le.copy(c.data,l,{x:0,y:g-1},{x:h,y:f-1},{width:d,height:1}),Le.copy(c.data,l,{x:0,y:0},{x:h,y:f+g},{width:d,height:1}),Le.copy(c.data,l,{x:d-1,y:0},{x:h-1,y:f},{width:1,height:g}),Le.copy(c.data,l,{x:0,y:0},{x:h+d,y:f},{width:1,height:g})}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*nr,h:o.data.height+2*nr};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})}};X("ImagePosition",fa);X("ImageAtlas",wy);var po=(i=>(i[i.none=0]="none",i[i.horizontal=1]="horizontal",i[i.vertical=2]="vertical",i[i.horizontalOnly=3]="horizontalOnly",i))(po||{});function Up(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}}var a1=se(Pl(),1);m();var i1=255,Il=128,Np=i1*Il;function Ty(t,e){let{expression:r}=e;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new Te(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 Te(s)),c=r.evaluate(new Te(l));return{kind:"camera",minZoom:s,maxZoom:l,minSize:u,maxSize:c,interpolationType:i}}}function ma(t,{uSize:e,uSizeT:r},{lowerSize:n,upperSize:i}){return t.kind==="source"?n/Il:t.kind==="composite"?Fe.number(n/Il,i/Il,r):e}function ho(t,e){let r=0,n=0;if(t.kind==="constant")n=t.layoutSize;else if(t.kind!=="source"){let{interpolationType:i,minZoom:o,maxZoom:a}=t,s=i?ce(Ht.interpolationFactor(i,e,o,a),0,1):0;t.kind==="camera"?n=Fe.number(t.minSize,t.maxSize,s):r=s}return{uSizeT:r,uSize:n}}m();function da(t,e,r){let n="never",i=t.get(e);return i?n=i:t.get(r)&&(n="always"),n}var HF=a1.default.VectorTileFeature.types,XF=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Gp(t,e,r,n,i,o,a,s,l,u,c,p,h){let f=s?Math.min(Np,Math.round(s[0])):0,d=s?Math.min(Np,Math.round(s[1])):0;t.emplaceBack(e,r,Math.round(n*32),Math.round(i*32),o,a,(f<<1)+(l?1:0),d,u*16,c*16,p*256,h*256)}function fo(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 ZF(t){for(let e of t.sections)if(Mv(e.text))return!0;return!1}var El=class{constructor(e){this.layoutVertexArray=new cp,this.indexArray=new et,this.programConfigurations=e,this.segments=new de,this.dynamicLayoutVertexArray=new pp,this.opacityVertexArray=new hp,this.hasVisibleVertices=!1,this.placedSymbolArray=new tl}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,N0.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,G0.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,XF,!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())}};X("SymbolBuffers",El);var Ll=class{constructor(e,r,n){this.layoutVertexArray=new e,this.layoutAttributes=r,this.indexArray=new n,this.segments=new de,this.collisionVertexArray=new mp}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,j0.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}};X("CollisionBuffers",Ll);var Jr=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=Ty(this.zoom,n["text-size"]),this.iconSizeData=Ty(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=da(i,"text-overlap","text-allow-overlap")!=="never"||da(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=>po[l])),this.stateDependentLayerIds=this.layers.filter(l=>l.isStateDependent()).map(l=>l.id),this.sourceID=e.sourceID}createArrays(){this.text=new El(new er(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new El(new er(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new nl,this.lineVertexArray=new il,this.symbolInstances=new rl,this.textAnchorOffsets=new ol}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=q0[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 gr&&!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 h=r.iconDependencies,f=r.glyphDependencies,d=r.availableImages,g=new Te(this.zoom,{globalState:this.globalState});for(let{feature:x,id:b,index:v,sourceLayerIndex:P}of e){let w=i._featureFilter.needGeometry,T=rr(x,w);if(!i._featureFilter.filter(g,T,n))continue;w||(T.geometry=tr(x));let S;if(u){let L=i.getValueAndResolveTokens("text-field",T,n,d),k=gr.factory(L),F=this.hasRTLText=this.hasRTLText||ZF(k);(!F||hn.getRTLTextPluginStatus()==="unavailable"||F&&hn.isParsed())&&(S=X0(k,i,T))}let I;if(c){let L=i.getValueAndResolveTokens("icon-image",T,n,d);L instanceof Qt?I=L:I=Qt.fromString(L)}if(!S&&!I)continue;let M=this.sortFeaturesByKey?p.evaluate(T,{},n):void 0,E={id:b,text:S,icon:I,index:v,sourceLayerIndex:P,geometry:T.geometry,properties:x.properties,type:HF[x.type],sortKey:M};if(this.features.push(E),I&&(h[I.name]=!0),S){let L=a.evaluate(T,{},n).join(","),k=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)h[F.image.name]=!0;else{let z=Yd(S.toString()),A=F.fontStack||L,R=f[A]=f[A]||{};this.calculateGlyphDependencies(F.text,R,k,this.allowVerticalPlacement,z)}}}o.get("symbol-placement")==="line"&&(this.features=Z0(this.features)),this.sortFeaturesByKey&&this.features.sort((x,b)=>x.sortKey-b.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,h){let f=e.indexArray,d=e.layoutVertexArray,g=e.segments.prepareSegment(4*r.length,d,f,this.canOverlap?a.sortKey:void 0),x=this.glyphOffsetArray.length,b=g.vertexLength,v=this.allowVerticalPlacement&&s===2?Math.PI/2:0,P=a.text&&a.text.sections;for(let w=0;w<r.length;w++){let{tl:T,tr:S,bl:I,br:M,tex:E,pixelOffsetTL:L,pixelOffsetBR:k,minFontScaleX:F,minFontScaleY:z,glyphOffset:A,isSDF:R,sectionIndex:H}=r[w],W=g.vertexLength,$=A[1];Gp(d,l.x,l.y,T.x,$+T.y,E.x,E.y,n,R,L.x,L.y,F,z),Gp(d,l.x,l.y,S.x,$+S.y,E.x+E.w,E.y,n,R,k.x,L.y,F,z),Gp(d,l.x,l.y,I.x,$+I.y,E.x,E.y+E.h,n,R,L.x,k.y,F,z),Gp(d,l.x,l.y,M.x,$+M.y,E.x+E.w,E.y+E.h,n,R,k.x,k.y,F,z),fo(e.dynamicLayoutVertexArray,l,v),f.emplaceBack(W,W+2,W+1),f.emplaceBack(W+1,W+2,W+3),g.vertexLength+=4,g.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(A[0]),(w===r.length-1||H!==r[w+1].sectionIndex)&&e.programConfigurations.populatePaintArrays(d.length,a,a.index,{},h,P&&P[H])}e.placedSymbolArray.emplaceBack(l.x,l.y,x,this.glyphOffsetArray.length-x,b,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,h=s.anchorX,f=s.anchorY;this._addCollisionDebugVertex(c,p,a,h,f,new Al.default(e,r)),this._addCollisionDebugVertex(c,p,a,h,f,new Al.default(n,r)),this._addCollisionDebugVertex(c,p,a,h,f,new Al.default(n,i)),this._addCollisionDebugVertex(c,p,a,h,f,new Al.default(e,i)),l.vertexLength+=4;let d=o.indexArray;d.emplaceBack(u,u+1),d.emplaceBack(u+1,u+2),d.emplaceBack(u+2,u+3),d.emplaceBack(u+3,u),l.primitiveLength+=4}addDebugCollisionBoxes(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 Ll(sl,by.members,pi),this.iconCollisionBox=new Ll(sl,by.members,pi);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 h=e.get(p);c.textBox={x1:h.x1,y1:h.y1,x2:h.x2,y2:h.y2,anchorPointX:h.anchorPointX,anchorPointY:h.anchorPointY},c.textFeatureIndex=h.featureIndex;break}for(let p=i;p<o;p++){let h=e.get(p);c.verticalTextBox={x1:h.x1,y1:h.y1,x2:h.x2,y2:h.y2,anchorPointX:h.anchorPointX,anchorPointY:h.anchorPointY},c.verticalTextFeatureIndex=h.featureIndex;break}for(let p=a;p<s;p++){let h=e.get(p);c.iconBox={x1:h.x1,y1:h.y1,x2:h.x2,y2:h.y2,anchorPointX:h.anchorPointX,anchorPointY:h.anchorPointY},c.iconFeatureIndex=h.featureIndex;break}for(let p=l;p<u;p++){let h=e.get(p);c.verticalIconBox={x1:h.x1,y1:h.y1,x2:h.x2,y2:h.y2,anchorPointX:h.anchorPointX,anchorPointY:h.anchorPointY},c.verticalIconFeatureIndex=h.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)}}};X("SymbolBucket",Jr,{omit:["layers","collisionBoxArray","features","compareText"]});Jr.MAX_GLYPHS=65535;Jr.addDynamicAttributes=fo;m();function s1(t,e){return e.replace(/{([^{}]+)}/g,(r,n)=>t&&n in t?String(t[n]):"")}m();var l1,qF=()=>l1=l1||new Ue({"symbol-placement":new q(D.layout_symbol["symbol-placement"]),"symbol-spacing":new q(D.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new q(D.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new te(D.layout_symbol["symbol-sort-key"]),"symbol-z-order":new q(D.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new q(D.layout_symbol["icon-allow-overlap"]),"icon-overlap":new q(D.layout_symbol["icon-overlap"]),"icon-ignore-placement":new q(D.layout_symbol["icon-ignore-placement"]),"icon-optional":new q(D.layout_symbol["icon-optional"]),"icon-rotation-alignment":new q(D.layout_symbol["icon-rotation-alignment"]),"icon-size":new te(D.layout_symbol["icon-size"]),"icon-text-fit":new q(D.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new q(D.layout_symbol["icon-text-fit-padding"]),"icon-image":new te(D.layout_symbol["icon-image"]),"icon-rotate":new te(D.layout_symbol["icon-rotate"]),"icon-padding":new te(D.layout_symbol["icon-padding"]),"icon-keep-upright":new q(D.layout_symbol["icon-keep-upright"]),"icon-offset":new te(D.layout_symbol["icon-offset"]),"icon-anchor":new te(D.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new q(D.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new q(D.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new q(D.layout_symbol["text-rotation-alignment"]),"text-field":new te(D.layout_symbol["text-field"]),"text-font":new te(D.layout_symbol["text-font"]),"text-size":new te(D.layout_symbol["text-size"]),"text-max-width":new te(D.layout_symbol["text-max-width"]),"text-line-height":new q(D.layout_symbol["text-line-height"]),"text-letter-spacing":new te(D.layout_symbol["text-letter-spacing"]),"text-justify":new te(D.layout_symbol["text-justify"]),"text-radial-offset":new te(D.layout_symbol["text-radial-offset"]),"text-variable-anchor":new q(D.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new te(D.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new te(D.layout_symbol["text-anchor"]),"text-max-angle":new q(D.layout_symbol["text-max-angle"]),"text-writing-mode":new q(D.layout_symbol["text-writing-mode"]),"text-rotate":new te(D.layout_symbol["text-rotate"]),"text-padding":new q(D.layout_symbol["text-padding"]),"text-keep-upright":new q(D.layout_symbol["text-keep-upright"]),"text-transform":new te(D.layout_symbol["text-transform"]),"text-offset":new te(D.layout_symbol["text-offset"]),"text-allow-overlap":new q(D.layout_symbol["text-allow-overlap"]),"text-overlap":new q(D.layout_symbol["text-overlap"]),"text-ignore-placement":new q(D.layout_symbol["text-ignore-placement"]),"text-optional":new q(D.layout_symbol["text-optional"])}),u1,YF=()=>u1=u1||new Ue({"icon-opacity":new te(D.paint_symbol["icon-opacity"]),"icon-color":new te(D.paint_symbol["icon-color"]),"icon-halo-color":new te(D.paint_symbol["icon-halo-color"]),"icon-halo-width":new te(D.paint_symbol["icon-halo-width"]),"icon-halo-blur":new te(D.paint_symbol["icon-halo-blur"]),"icon-translate":new q(D.paint_symbol["icon-translate"]),"icon-translate-anchor":new q(D.paint_symbol["icon-translate-anchor"]),"text-opacity":new te(D.paint_symbol["text-opacity"]),"text-color":new te(D.paint_symbol["text-color"],{runtimeType:Br,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new te(D.paint_symbol["text-halo-color"]),"text-halo-width":new te(D.paint_symbol["text-halo-width"]),"text-halo-blur":new te(D.paint_symbol["text-halo-blur"]),"text-translate":new q(D.paint_symbol["text-translate"]),"text-translate-anchor":new q(D.paint_symbol["text-translate-anchor"])}),jp={get paint(){return YF()},get layout(){return qF()}};m();var Dl=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:Yo,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}};X("FormatSectionOverride",Dl,{omit:["defaultValue"]});var c1=t=>t.type==="symbol",Hp=class t extends at{constructor(e){super(e,jp)}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()&&!Fs(a.value)&&o?s1(r.properties,o):o}createBucket(e){return new Jr(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let e of jp.paint.overridableProperties){if(!t.hasPaintOverride(this.layout,e))continue;let r=this.paint.get(e),n=new Dl(r),i=new Ki(n,r.property.specification),o=null;r.value.kind==="constant"||r.value.kind==="source"?o=new pn("source",i):o=new oi("composite",i,r.value.zoomStops),this.paint._values[e]=new Ot(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=jp.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 gr)a(n.value.value.sections);else if(n.value.kind==="source"){let s=u=>{if(!o)if(u instanceof ni&&ht(u.value)===Wo){let c=u.value;a(c.sections)}else u instanceof Ps?a(u.sections):u.eachChild(s)},l=n.value;l._styleExpression&&s(l._styleExpression.expression)}return o}};m();m();var p1,WF=()=>p1=p1||new Ue({"background-color":new q(D.paint_background["background-color"]),"background-pattern":new no(D.paint_background["background-pattern"]),"background-opacity":new q(D.paint_background["background-opacity"])}),h1={get paint(){return WF()}};var f1=t=>t.type==="background",Xp=class extends at{constructor(e){super(e,h1)}};m();m();var m1,$F=()=>m1=m1||new Ue({"raster-opacity":new q(D.paint_raster["raster-opacity"]),"raster-hue-rotate":new q(D.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new q(D.paint_raster["raster-brightness-min"]),"raster-brightness-max":new q(D.paint_raster["raster-brightness-max"]),"raster-saturation":new q(D.paint_raster["raster-saturation"]),"raster-contrast":new q(D.paint_raster["raster-contrast"]),"raster-resampling":new q(D.paint_raster["raster-resampling"]),"raster-fade-duration":new q(D.paint_raster["raster-fade-duration"])}),d1={get paint(){return $F()}};var y1=t=>t.type==="raster",Zp=class extends at{constructor(e){super(e,d1)}};m();function g1(t){let e=[],r=t.id;return r===void 0&&e.push({message:"layers.".concat(r,': missing required property "id"')}),t.render===void 0&&e.push({message:"layers.".concat(r,': missing required method "render"')}),t.renderingMode&&t.renderingMode!=="2d"&&t.renderingMode!=="3d"&&e.push({message:"layers.".concat(r,': property "renderingMode" must be either "2d" or "3d"')}),e}var x1=t=>t.type==="custom",qp=class extends at{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 Yp(t){if(t.type==="custom")return new qp(t);switch(t.type){case"background":return new Xp(t);case"circle":return new Pp(t);case"color-relief":return new Cp(t);case"fill":return new Dp(t);case"fill-extrusion":return new Fp(t);case"heatmap":return new Tp(t);case"hillshade":return new Sp(t);case"line":return new Bp(t);case"raster":return new Zp(t);case"symbol":return new Hp(t)}}m();m();function ya(t){let e=[];if(typeof t=="string")e.push({id:"default",url:t});else if(t&&t.length>0){let r=[];for(let{id:n,url:i}of t){let o="".concat(n).concat(i);r.indexOf(o)===-1&&(r.push(o),e.push({id:n,url:i}))}}return e}function b1(t,e,r){try{let n=new URL(t);return n.pathname+="".concat(e).concat(r),n.toString()}catch(n){throw new Error('Invalid sprite URL "'.concat(t,'", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically'))}}async function _1(t,e,r,n){let i=ya(t),o=r>1?"@2x":"",a={},s={};for(let{id:l,url:u}of i){let c=e.transformRequest(b1(u,o,".json"),"SpriteJSON");a[l]=Qn(c,n);let p=e.transformRequest(b1(u,o,".png"),"SpriteImage");s[l]=jt.getImage(p,n)}return await Promise.all([...Object.values(a),...Object.values(s)]),KF(a,s)}async function KF(t,e){let r={};for(let n in t){r[n]={};let i=ae.getImageCanvasContext((await e[n]).data),o=(await t[n]).data;for(let a in o){let{width:s,height:l,x:u,y:c,sdf:p,pixelRatio:h,stretchX:f,stretchY:d,content:g,textFitWidth:x,textFitHeight:b}=o[a],v={width:s,height:l,x:u,y:c,context:i};r[n][a]={data:null,pixelRatio:h,sdf:p,stretchX:f,stretchY:d,content:g,textFitWidth:x,textFitHeight:b,spriteData:v}}}return r}m();var Wp=1,$p=class extends Ee{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new Le({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(let{ids:r,promiseResolve:n}of this.requestors)n(this._getImagesForIds(r));this.requestors=[]}}getImage(e){let r=this.images[e];if(r&&!r.data&&r.spriteData){let n=r.spriteData;r.data=new Le({width:n.width,height:n.height},n.context.getImageData(n.x,n.y,n.width,n.height).data),r.spriteData=null}return r}addImage(e,r){if(this.images[e])throw new Error("Image id ".concat(e," already exist, use updateImage instead"));this._validate(e,r)&&(this.images[e]=r)}_validate(e,r){let n=!0,i=r.data||r.spriteData;return this._validateStretch(r.stretchX,i&&i.width)||(this.fire(new Q(new Error('Image "'.concat(e,'" has invalid "stretchX" value')))),n=!1),this._validateStretch(r.stretchY,i&&i.height)||(this.fire(new Q(new Error('Image "'.concat(e,'" has invalid "stretchY" value')))),n=!1),this._validateContent(r.content,r)||(this.fire(new Q(new Error('Image "'.concat(e,'" has invalid "content" value')))),n=!1),n}_validateStretch(e,r){if(!e)return!0;let n=0;for(let i of e){if(i[0]<n||i[1]<i[0]||r<i[1])return!1;n=i[1]}return!0}_validateContent(e,r){if(!e)return!0;if(e.length!==4)return!1;let n=r.spriteData,i=n&&n.width||r.data.width,o=n&&n.height||r.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,r,n=!0){let i=this.getImage(e);if(n&&(i.data.width!==r.data.width||i.data.height!==r.data.height))throw new Error("size mismatch between old image (".concat(i.data.width,"x").concat(i.data.height,") and new image (").concat(r.data.width,"x").concat(r.data.height,")."));r.version=i.version+1,this.images[e]=r,this.updatedImages[e]=!0}removeImage(e){let r=this.images[e];delete this.images[e],delete this.patterns[e],r.userImage&&r.userImage.onRemove&&r.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(e){return new Promise((r,n)=>{let i=!0;if(!this.isLoaded())for(let o of e)this.images[o]||(i=!1);this.isLoaded()||i?r(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:r})})}_getImagesForIds(e){let r={};for(let n of e){let i=this.getImage(n);i||(this.fire(new U("styleimagemissing",{id:n})),i=this.getImage(n)),i?r[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)}:ve('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 r}getPixelSize(){let{width:e,height:r}=this.atlasImage;return{width:e,height:r}}getPattern(e){let r=this.patterns[e],n=this.getImage(e);if(!n)return null;if(r&&r.position.version===n.version)return r.position;if(r)r.position.version=n.version;else{let i=n.data.width+Wp*2,o=n.data.height+Wp*2,a={w:i,h:o,x:0,y:0},s=new fa(a,n);this.patterns[e]={bin:a,position:s}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){let r=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new Se(e,this.atlasImage,r.RGBA),this.atlasTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)}_updatePatternAtlas(){let e=[];for(let o in this.patterns)e.push(this.patterns[o].bin);let{w:r,h:n}=Ml(e),i=this.atlasImage;i.resize({width:r||1,height:n||1});for(let o in this.patterns){let{bin:a}=this.patterns[o],s=a.x+Wp,l=a.y+Wp,u=this.getImage(o).data,c=u.width,p=u.height;Le.copy(u,i,{x:0,y:0},{x:s,y:l},{width:c,height:p}),Le.copy(u,i,{x:0,y:p-1},{x:s,y:l-1},{width:c,height:1}),Le.copy(u,i,{x:0,y:0},{x:s,y:l+p},{width:c,height:1}),Le.copy(u,i,{x:c-1,y:0},{x:s-1,y:l},{width:1,height:p}),Le.copy(u,i,{x:0,y:0},{x:s+c,y:l},{width:1,height:p})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(let r of e){if(this.callbackDispatchedThisFrame[r])continue;this.callbackDispatchedThisFrame[r]=!0;let n=this.getImage(r);n||ve('Image with ID: "'.concat(r,'" was not found')),n1(n)&&this.updateImage(r,n)}}};m();m();async function v1(t,e,r,n){let i=e*256,o=i+255,a=n.transformRequest(r.replace("{fontstack}",t).replace("{range}","".concat(i,"-").concat(o)),"Glyphs"),s=await i_(a,new AbortController);if(!s||!s.data)throw new Error("Could not load glyph range. range: ".concat(e,", ").concat(i,"-").concat(o));let l={};for(let u of r1(s.data))l[u.id]=u;return l}m();var Rl=class{constructor({fontSize:e=24,buffer:r=3,radius:n=8,cutoff:i=.25,fontFamily:o="sans-serif",fontWeight:a="normal",fontStyle:s="normal"}={}){this.buffer=r,this.cutoff=i,this.radius=n;let l=this.size=e+r*4,u=this._createCanvas(l),c=this.ctx=u.getContext("2d",{willReadFrequently:!0});c.font="".concat(s," ").concat(a," ").concat(e,"px ").concat(o),c.textBaseline="alphabetic",c.textAlign="left",c.fillStyle="black",this.gridOuter=new Float64Array(l*l),this.gridInner=new Float64Array(l*l),this.f=new Float64Array(l),this.z=new Float64Array(l+1),this.v=new Uint16Array(l)}_createCanvas(e){let r=document.createElement("canvas");return r.width=r.height=e,r}draw(e){let{width:r,actualBoundingBoxAscent:n,actualBoundingBoxDescent:i,actualBoundingBoxLeft:o,actualBoundingBoxRight:a}=this.ctx.measureText(e),s=Math.ceil(n),l=0,u=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(a-o))),c=Math.min(this.size-this.buffer,s+Math.ceil(i)),p=u+2*this.buffer,h=c+2*this.buffer,f=Math.max(p*h,0),d=new Uint8ClampedArray(f),g={data:d,width:p,height:h,glyphWidth:u,glyphHeight:c,glyphTop:s,glyphLeft:l,glyphAdvance:r};if(u===0||c===0)return g;let{ctx:x,buffer:b,gridInner:v,gridOuter:P}=this;x.clearRect(b,b,u,c),x.fillText(e,b,b+s);let w=x.getImageData(b,b,u,c);P.fill(1e20,0,f),v.fill(0,0,f);for(let T=0;T<c;T++)for(let S=0;S<u;S++){let I=w.data[4*(T*u+S)+3]/255;if(I===0)continue;let M=(T+b)*p+S+b;if(I===1)P[M]=0,v[M]=1e20;else{let E=.5-I;P[M]=E>0?E*E:0,v[M]=E<0?E*E:0}}P1(P,0,0,p,h,p,this.f,this.v,this.z),P1(v,b,b,u,c,p,this.f,this.v,this.z);for(let T=0;T<f;T++){let S=Math.sqrt(P[T])-Math.sqrt(v[T]);d[T]=Math.round(255-255*(S/this.radius+this.cutoff))}return g}};function P1(t,e,r,n,i,o,a,s,l){for(let u=e;u<e+n;u++)w1(t,r*o+u,o,i,a,s,l);for(let u=r;u<r+i;u++)w1(t,u*o+e,1,n,a,s,l)}function w1(t,e,r,n,i,o,a){o[0]=0,a[0]=-1e20,a[1]=1e20,i[0]=t[e];for(let s=1,l=0,u=0;s<n;s++){i[s]=t[e+s*r];let c=s*s;do{let p=o[l];u=(i[s]-i[p]+c-p*p)/(s-p)/2}while(u<=a[l]&&--l>-1);l++,o[l]=s,a[l]=u,a[l+1]=1e20}for(let s=0,l=0;s<n;s++){for(;a[l+1]<s;)l++;let u=o[l],c=s-u;t[e+s*r]=i[u]+c*c}}var ga=class ga{constructor(e,r){this.requestManager=e,this.localIdeographFontFamily=r,this.entries={}}setURL(e){this.url=e}async getGlyphs(e){let r=[];for(let o in e)for(let a of e[o])r.push(this._getAndCacheGlyphsPromise(o,a));let n=await Promise.all(r),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,r){let n=this.entries[e];n||(n=this.entries[e]={glyphs:{},requests:{},ranges:{}});let i=n.glyphs[r];if(i!==void 0)return{stack:e,id:r,glyph:i};if(i=this._tinySDF(n,e,r),i)return n.glyphs[r]=i,{stack:e,id:r,glyph:i};let o=Math.floor(r/256);if(o*256>65535)throw new Error("glyphs > 65535 not supported");if(n.ranges[o])return{stack:e,id:r,glyph:i};if(!this.url)throw new Error("glyphsUrl is not set");if(!n.requests[o]){let s=ga.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:r,glyph:a[r]||null}}_doesCharSupportLocalGlyph(e){return!!this.localIdeographFontFamily&&(new RegExp("\\p{Ideo}|\\p{sc=Hang}|\\p{sc=Hira}|\\p{sc=Kana}","u").test(String.fromCodePoint(e))||mt["CJK Unified Ideographs"](e)||mt["Hangul Syllables"](e)||mt.Hiragana(e)||mt.Katakana(e)||mt["CJK Symbols and Punctuation"](e)||mt["Halfwidth and Fullwidth Forms"](e))}_tinySDF(e,r,n){let i=this.localIdeographFontFamily;if(!i||!this._doesCharSupportLocalGlyph(n))return;let o=2,a=e.tinySDF;if(!a){let c="400";/bold/i.test(r)?c="900":/medium/i.test(r)?c="500":/light/i.test(r)&&(c="200"),a=e.tinySDF=new ga.TinySDF({fontSize:24*o,buffer:3*o,radius:8*o,cutoff:.25,fontFamily:i,fontWeight:c})}let s=a.draw(String.fromCharCode(n));return{id:n,bitmap:new uo({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}}}};ga.loadGlyphRange=v1,ga.TinySDF=Rl;var Kp=ga;m();var Cy=class{constructor(){this.specification=D.light.position}possiblyEvaluate(e,r){return jb(e.expression.evaluate(r))}interpolate(e,r,n){return{x:Fe.number(e.x,r.x,n),y:Fe.number(e.y,r.y,n),z:Fe.number(e.z,r.z,n)}}},T1="-transition",Sy,Jp=class extends Ee{constructor(e){super(),Sy=Sy||new Ue({anchor:new q(D.light.anchor),position:new Cy,color:new q(D.light.color),intensity:new q(D.light.intensity)}),this._transitionable=new fn(Sy),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,r={}){if(!this._validate(bv,e,r))for(let n in e){let i=e[n];n.endsWith(T1)?this._transitionable.setTransition(n.slice(0,-T1.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,r,n){return n&&n.validate===!1?!1:si(this,e.call(Qe,{value:r,style:{glyphs:!0,sprite:!0},styleSpec:D}))}};m();var JF=new Ue({"sky-color":new q(D.sky["sky-color"]),"horizon-color":new q(D.sky["horizon-color"]),"fog-color":new q(D.sky["fog-color"]),"fog-ground-blend":new q(D.sky["fog-ground-blend"]),"horizon-fog-blend":new q(D.sky["horizon-fog-blend"]),"sky-horizon-blend":new q(D.sky["sky-horizon-blend"]),"atmosphere-blend":new q(D.sky["atmosphere-blend"])}),S1="-transition",Qp=class extends Ee{constructor(e){super(),this._transitionable=new fn(JF),this.setSky(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new Te(0))}setSky(e,r={}){if(!this._validate(_v,e,r)){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(S1)?this._transitionable.setTransition(n.slice(0,-S1.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,r,n={}){return(n==null?void 0:n.validate)===!1?!1:si(this,e.call(Qe,Z({value:r,style:{glyphs:!0,sprite:!0},styleSpec:D})))}calculateFogBlendOpacity(e){return e<60?0:e<70?(e-60)/10:1}};m();var eh=class{constructor(e,r){this.width=e,this.height=r,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(e,r){let n=e.join(",")+String(r);return this.dashEntry[n]||(this.dashEntry[n]=this.addDash(e,r)),this.dashEntry[n]}getDashRanges(e,r,n){let i=e.length%2===1,o=[],a=i?-e[e.length-1]*n:0,s=e[0]*n,l=!0;o.push({left:a,right:s,isDash:l,zeroLength:e[0]===0});let u=e[0];for(let c=1;c<e.length;c++){l=!l;let p=e[c];a=u*n,u+=p,s=u*n,o.push({left:a,right:s,isDash:l,zeroLength:p===0})}return o}addRoundDash(e,r,n){let i=r/2;for(let o=-n;o<=n;o++){let a=this.nextRow+n+o,s=this.width*a,l=0,u=e[l];for(let c=0;c<this.width;c++){c/u.right>1&&(u=e[++l]);let p=Math.abs(c-u.left),h=Math.abs(c-u.right),f=Math.min(p,h),d,g=o/n*(i+1);if(u.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+c]=Math.max(0,Math.min(255,d+128))}}}addRegularDash(e){for(let s=e.length-1;s>=0;--s){let l=e[s],u=e[s+1];l.zeroLength?e.splice(s,1):u&&u.isDash===l.isDash&&(u.left=l.left,e.splice(s,1))}let r=e[0],n=e[e.length-1];r.isDash===n.isDash&&(r.left=n.left-this.width,n.right=r.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 l=Math.abs(s-a.left),u=Math.abs(s-a.right),c=Math.min(l,u),p=a.isDash?c:-c;this.data[i+s]=Math.max(0,Math.min(255,p+128))}}addDash(e,r){let n=r?7:0,i=2*n+1;if(this.nextRow+i>this.height)return ve("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,l=this.getDashRanges(e,this.width,s);r?this.addRoundDash(l,s,n):this.addRegularDash(l)}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 r=e.gl;this.texture?(r.bindTexture(r.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,r.texSubImage2D(r.TEXTURE_2D,0,0,0,this.width,this.height,r.ALPHA,r.UNSIGNED_BYTE,this.data))):(this.texture=r.createTexture(),r.bindTexture(r.TEXTURE_2D,this.texture),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.REPEAT),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.REPEAT),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),r.texImage2D(r.TEXTURE_2D,0,r.ALPHA,this.width,this.height,0,r.ALPHA,r.UNSIGNED_BYTE,this.data))}};m();m();m();var th=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 QF={once:!0},rh=class{constructor(e,r){this.target=e,this.mapId=r,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new th(()=>this.process()),this.subscription=cs(this.target,"message",n=>this.receive(n),!1),this.globalScope=Cn(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?cs(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)},QF):null;this.resolveRejects[o]={resolve:u=>{a==null||a.unsubscribe(),n(u)},reject:u=>{a==null||a.unsubscribe(),i(u)}};let s=[],l=wt(Ze({},e),{id:o,sourceMapId:this.mapId,origin:location.origin,data:Jo(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(Cn(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(Qo(r.error)):o.resolve(Qo(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=Qo(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?Jo(r):null,data:Jo(n,i)};this.target.postMessage(o,{transfer:i})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}};m();m();m();m();var C1='(()=>{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 eO=()=>Kt.WORKER_URL?Kt.WORKER_URL:URL.createObjectURL(new Blob([C1],{type:"text/javascript"}));function M1(){return new Worker(eO())}var I1="maplibre_preloaded_worker_pool",xa=class t{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<t.workerCount;)this.workers.push(M1());return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],this.numActive()===0&&(this.workers.forEach(r=>{r.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[I1]}numActive(){return Object.keys(this.active).length}},tO=Math.floor(ae.hardwareConcurrency/2);xa.workerCount=Xb(globalThis)?Math.max(Math.min(tO,3),1):1;var My;function nh(){return My||(My=new xa),My}var kl=class{constructor(e,r){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=r;let n=this.workerPool.acquire(r);for(let i=0;i<n.length;i++){let o=n[i],a=new rh(o,r);a.name="Worker ".concat(i),this.actors.push(a)}if(!this.actors.length)throw new Error("No actors found")}broadcast(e,r){let n=[];for(let i of this.actors)n.push(i.sendAsync({type:e,data:r}));return Promise.all(n)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(e=!0){this.actors.forEach(r=>{r.remove()}),this.actors=[],e&&this.workerPool.release(this.id)}registerMessageHandler(e,r){for(let n of this.actors)n.registerMessageHandler(e,r)}},ih;function Iy(){return ih||(ih=new kl(nh(),mc),ih.registerMessageHandler("GR",(t,e,r)=>Vo(e,r))),ih}m();function rO(t,e){let r=B.create();return B.translate(r,r,[1,1,0]),B.scale(r,r,[t.width*.5,t.height*.5,1]),t.calculatePosMatrix?B.multiply(r,r,t.calculatePosMatrix(e.toUnwrapped())):r}function nO(t,e,r){if(t)for(let n of t){let i=e[n];if(i&&i.source===r&&i.type==="fill-extrusion")return!0}else for(let n in e){let i=e[n];if(i.source===r&&i.type==="fill-extrusion")return!0}return!1}function A1(t,e,r,n,i,o,a){var h;let s=nO((h=i==null?void 0:i.layers)!=null?h:null,e,t.id),l=o.maxPitchScaleFactor(),u=t.tilesIn(n,l,s);u.sort(D1);let c=[];for(let f of u)c.push({wrappedTileID:f.tileID.wrapped().key,queryResults:f.tile.queryRenderedFeatures(e,r,t._state,f.queryGeometry,f.cameraQueryGeometry,f.scale,i,o,l,rO(t.transform,f.tileID),a?(d,g)=>a(f.tileID,d,g):void 0)});let p=iO(c);return oO(p,t)}function E1(t,e,r,n,i,o,a){let s={},l=o.queryRenderedSymbols(n),u=[];for(let c of Object.keys(l).map(Number))u.push(a[c]);u.sort(D1);for(let c of u){let p=c.featureIndex.lookupSymbolFeatures(l[c.bucketInstanceId],e,c.bucketIndex,c.sourceLayerIndex,i.filter,i.layers,i.availableImages,t);for(let h in p){let f=s[h]=s[h]||[],d=p[h];d.sort((g,x)=>{let b=c.featureSortOrder;if(b){let v=b.indexOf(g.featureIndex);return b.indexOf(x.featureIndex)-v}else return x.featureIndex-g.featureIndex});for(let g of d)f.push(g)}}return aO(s,t,r)}function L1(t,e){let r=t.getRenderableIds().map(o=>t.getTileByID(o)),n=[],i={};for(let o=0;o<r.length;o++){let a=r[o],s=a.tileID.canonical.key;i[s]||(i[s]=!0,a.querySourceFeatures(n,e))}return n}function D1(t,e){let r=t.tileID,n=e.tileID;return r.overscaledZ-n.overscaledZ||r.canonical.y-n.canonical.y||r.wrap-n.wrap||r.canonical.x-n.canonical.x}function iO(t){let e={},r={};for(let n of t){let i=n.queryResults,o=n.wrappedTileID,a=r[o]=r[o]||{};for(let s in i){let l=i[s],u=a[s]=a[s]||{},c=e[s]=e[s]||[];for(let p of l)u[p.featureIndex]||(u[p.featureIndex]=!0,c.push(p))}}return e}function oO(t,e){for(let r in t)for(let n of t[r])R1(n,e);return t}function aO(t,e,r){for(let n in t)for(let i of t[n]){let o=e[n],a=r[o.source];R1(i,a)}return t}function R1(t,e){let r=t.feature,n=e.getFeatureState(r.layer["source-layer"],r.id);r.source=r.layer.source,r.layer["source-layer"]&&(r.sourceLayer=r.layer["source-layer"]),r.state=n}m();m();m();m();async function oh(t,e,r){let n=t;if(t.url?n=(await Qn(e.transformRequest(t.url,"Source"),r)).data:await ae.frameAsync(r),!n)return null;let i=an(Z(n,t),["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}m();m();m();var or=63710088e-1,J=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(Rr(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 or*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 yt=class t{constructor(e,r){e&&(r?this.setSouthWest(e).setNorthEast(r):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 J?new J(e.lng,e.lat):J.convert(e),this}setSouthWest(e){return this._sw=e instanceof J?new J(e.lng,e.lat):J.convert(e),this}extend(e){let r=this._sw,n=this._ne,i,o;if(e instanceof J)i=e,o=e;else if(e instanceof t){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(t.convert(a))}else{let a=e;return this.extend(J.convert(a))}else if(e&&("lng"in e||"lon"in e)&&"lat"in e)return this.extend(J.convert(e));return this}return!r&&!n?(this._sw=new J(i.lng,i.lat),this._ne=new J(o.lng,o.lat)):(r.lng=Math.min(i.lng,r.lng),r.lat=Math.min(i.lat,r.lat),n.lng=Math.max(o.lng,n.lng),n.lat=Math.max(o.lat,n.lat)),this}getCenter(){return new J((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 J(this.getWest(),this.getNorth())}getSouthEast(){return new J(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:r,lat:n}=J.convert(e),i=this._sw.lat<=n&&n<=this._ne.lat,o=this._sw.lng<=r&&r<=this._ne.lng;return this._sw.lng>this._ne.lng&&(o=this._sw.lng>=r&&r>=this._ne.lng),i&&o}static convert(e){return e instanceof t||!e?e:new t(e)}static fromLngLat(e,r=0){let i=360*r/40075017,o=i/Math.cos(Math.PI/180*e.lat);return new t(new J(e.lng-o,e.lat-i),new J(e.lng+o,e.lat+i))}adjustAntiMeridian(){let e=new J(this._sw.lng,this._sw.lat),r=new J(this._ne.lng,this._ne.lat);return e.lng>r.lng?new t(e,new J(r.lng+360,r.lat)):new t(e,r)}};m();var k1=2*Math.PI*or;function F1(t){return k1*Math.cos(t*Math.PI/180)}function kn(t){return(180+t)/360}function Qr(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function gn(t,e){return t/F1(e)}function sO(t){return t*360-180}function Ay(t){let e=180-t*360;return 360/Math.PI*Math.atan(Math.exp(e*Math.PI/180))-90}function ah(t,e){return t*F1(Ay(e))}function lO(t){return 1/Math.cos(t*Math.PI/180)}var xe=class t{constructor(e,r,n=0){this.x=+e,this.y=+r,this.z=+n}static fromLngLat(e,r=0){let n=J.convert(e);return new t(kn(n.lng),Qr(n.lat),gn(r,n.lat))}toLngLat(){return new J(sO(this.x),Ay(this.y))}toAltitude(){return ah(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/k1*lO(Ay(this.y))}};var ba=class{constructor(e,r,n){this.bounds=yt.convert(this.validateBounds(e)),this.minzoom=r||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 r=Math.pow(2,e.z),n={minX:Math.floor(kn(this.bounds.getWest())*r),minY:Math.floor(Qr(this.bounds.getNorth())*r),maxX:Math.ceil(kn(this.bounds.getEast())*r),maxY:Math.ceil(Qr(this.bounds.getSouth())*r)};return e.x>=n.minX&&e.x<n.maxX&&e.y>=n.minY&&e.y<n.maxY}};var Fl=class extends Ee{constructor(e,r,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,Z(this,an(r,["url","scheme","tileSize","promoteId"])),this._options=Z({type:"vector"},r),this._collectResourceTiming=r.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 U("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let e=await oh(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),e&&(Z(this,e),e.bounds&&(this.tileBounds=new ba(e.bounds,this.minzoom,this.maxzoom)),this.fire(new U("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new U("data",{dataType:"source",sourceDataType:"content"})))}catch(e){this._tileJSONRequest=null,this.fire(new Q(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 Z({},this._options)}async loadTile(e){let r=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),n={request:this.map._requestManager.transformRequest(r,"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,r){if(r&&r.resourceTiming&&(e.resourceTiming=r.resourceTiming),r&&this.map._refreshExpiredTiles&&e.setExpiryData(r),e.loadVectorData(r,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}};m();var mo=class extends Ee{constructor(e,r,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=Z({type:"raster"},r),Z(this,an(r,["url","scheme","tileSize"]))}async load(e=!1){this._loaded=!1,this.fire(new U("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let r=await oh(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,r&&(Z(this,r),r.bounds&&(this.tileBounds=new ba(r.bounds,this.minzoom,this.maxzoom)),this.fire(new U("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new U("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:e})))}catch(r){this._tileJSONRequest=null,this.fire(new Q(r))}}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 Z({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}async loadTile(e){let r=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.abortController=new AbortController;try{let n=await jt.getImage(this.map._requestManager.transformRequest(r,"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 Se(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}};m();m();m();function B1(t,e,r){e=Math.pow(2,r)-e-1;var n=O1(t*256,e*256,r),i=O1((t+1)*256,(e+1)*256,r);return n[0]+","+n[1]+","+i[0]+","+i[1]}function O1(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 U1=se(fe(),1);m();function z1(t,e,r){return!(t<ps||t>Hi||r<0||r>=Math.pow(2,t)||e<0||e>=Math.pow(2,t))}function V1(t,e){let{x:r,y:n}=xe.fromLngLat(e);return!(t<ps||t>Hi||n<0||n>=1||r<0||r>=1)}var gi=class{constructor(e,r,n){if(!z1(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(ps,"<=z<=").concat(Hi," "));this.z=e,this.x=r,this.y=n,this.key=yo(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=B1(this.x,this.y,this.z),o=uO(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 U1.default((e.x*r-this.x)*8192,(e.y*r-this.y)*8192)}toString(){return"".concat(this.z,"/").concat(this.x,"/").concat(this.y)}},xi=class{constructor(e,r){this.wrap=e,this.canonical=r,this.key=yo(e,r.z,r.z,r.x,r.y)}},We=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 gi(n,+i,+o),this.key=yo(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?yo(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):yo(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 xi(this.wrap,this.canonical)}toString(){return"".concat(this.overscaledZ,"/").concat(this.canonical.x,"/").concat(this.canonical.y)}getTilePoint(e){return this.canonical.getTilePoint(new xe(e.x-this.wrap,e.y))}};function yo(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 uO(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}X("CanonicalTileID",gi);X("OverscaledTileID",We,{omit:["terrainRttPosMatrix32f"]});var Ol=class extends mo{constructor(e,r,n,i){super(e,r,n,i),this.type="raster-dem",this.maxzoom=22,this._options=Z({type:"raster-dem"},r),this.encoding=r.encoding||"mapbox",this.redFactor=r.redFactor,this.greenFactor=r.greenFactor,this.blueFactor=r.blueFactor,this.baseShift=r.baseShift}async loadTile(e){let r=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),n=this.map._requestManager.transformRequest(r,"Tile");e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{let i=await jt.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=$t(o)&&Qu()?o:await this.readImageNow(o),l={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 u=await e.actor.sendAsync({type:"LDT",data:l});e.dem=u,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"&&Um()){let r=e.width+2,n=e.height+2;try{return new Le({width:r,height:n},await Yb(e,-1,-1,r,n))}catch(i){}}return ae.getImageData(e,1)}_getNeighboringTiles(e){let r=e.canonical,n=Math.pow(2,r.z),i=(r.x-1+n)%n,o=r.x===0?e.wrap-1:e.wrap,a=(r.x+1+n)%n,s=r.x+1===n?e.wrap+1:e.wrap,l={};return l[new We(e.overscaledZ,o,r.z,i,r.y).key]={backfilled:!1},l[new We(e.overscaledZ,s,r.z,a,r.y).key]={backfilled:!1},r.y>0&&(l[new We(e.overscaledZ,o,r.z,i,r.y-1).key]={backfilled:!1},l[new We(e.overscaledZ,e.wrap,r.z,r.x,r.y-1).key]={backfilled:!1},l[new We(e.overscaledZ,s,r.z,a,r.y-1).key]={backfilled:!1}),r.y+1<n&&(l[new We(e.overscaledZ,o,r.z,i,r.y+1).key]={backfilled:!1},l[new We(e.overscaledZ,e.wrap,r.z,r.x,r.y+1).key]={backfilled:!1},l[new We(e.overscaledZ,s,r.z,a,r.y+1).key]={backfilled:!1}),l}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}})}};m();var Bl=class extends Ee{constructor(e,r,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=r.data,this._options=Z({},r),this._collectResourceTiming=r.collectResourceTiming,r.maxzoom!==void 0&&(this.maxzoom=r.maxzoom),r.type&&(this.type=r.type),r.attribution&&(this.attribution=r.attribution),this.promoteId=r.promoteId,r.clusterMaxZoom!==void 0&&this.maxzoom<=r.clusterMaxZoom&&ve('The maxzoom value "'.concat(this.maxzoom,'" is expected to be greater than the clusterMaxZoom value "').concat(r.clusterMaxZoom,'".')),this.workerOptions=Z({source:this.id,cluster:r.cluster||!1,geojsonVtOptions:{buffer:this._pixelsToTileUnits(r.buffer!==void 0?r.buffer:128),tolerance:this._pixelsToTileUnits(r.tolerance!==void 0?r.tolerance:.375),extent:8192,maxZoom:this.maxzoom,lineMetrics:r.lineMetrics||!1,generateId:r.generateId||!1},superclusterOptions:{maxZoom:this._getClusterMaxZoom(r.clusterMaxZoom),minPoints:Math.max(2,r.clusterMinPoints||2),extent:8192,radius:this._pixelsToTileUnits(r.clusterRadius||50),log:!1,generateId:r.generateId||!1},clusterProperties:r.clusterProperties,filter:r.filter},r.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}_pixelsToTileUnits(e){return e*(8192/this.tileSize)}_getClusterMaxZoom(e){let r=e?Math.round(e):this.maxzoom-1;return Number.isInteger(e)||e===void 0||ve("Integer expected for option 'clusterMaxZoom': provided value \"".concat(e,'" rounded to "').concat(r,'"')),r}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=Z({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:e})}getCoordinatesFromGeometry(e){return e.type==="GeometryCollection"?e.geometries.map(r=>r.coordinates).flat(1/0):e.coordinates.flat(1/0)}async getBounds(){let e=new yt,r=await this.getData(),n;switch(r.type){case"FeatureCollection":n=r.features.map(i=>this.getCoordinatesFromGeometry(i.geometry)).flat(1/0);break;case"Feature":n=this.getCoordinatesFromGeometry(r.geometry);break;default:n=this.getCoordinatesFromGeometry(r);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,r,n){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:e,limit:r,offset:n}})}async _updateWorkerData(e){let r=Z({type:this.type},this.workerOptions);e?r.dataDiff=e:typeof this._data=="string"?(r.request=this.map._requestManager.transformRequest(ae.resolveURL(this._data),"Source"),r.request.collectResourceTiming=this._collectResourceTiming):r.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new U("dataloading",{dataType:"source"}));try{let n=await this.actor.sendAsync({type:"LD",data:r});if(this._pendingLoads--,this._removed||n.abandoned){this.fire(new U("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&&Z(o,{resourceTiming:i}),this.fire(new U("data",wt(Ze({},o),{sourceDataType:"metadata"}))),this.fire(new U("data",wt(Ze({},o),{sourceDataType:"content"})))}catch(n){if(this._pendingLoads--,this._removed){this.fire(new U("dataabort",{dataType:"source"}));return}this.fire(new Q(n))}}loaded(){return this._pendingLoads===0}async loadTile(e){let r=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:r,data:n},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(i,this.map.painter,r==="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 Z({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}};m();m();m();var zl=se(fe(),1),St=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 zl.default(this.minX,this.minY))),r.extend(e(new zl.default(this.maxX,this.minY))),r.extend(e(new zl.default(this.minX,this.maxY))),r.extend(e(new zl.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 vr=class extends Ee{constructor(r,n,i,o){super();this.flippedWindingOrder=!1;this.id=r,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(r){this._loaded=!1,this.fire(new U("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{let n=await jt.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,n&&n.data&&(this.image=n.data,r&&(this.coordinates=r),this._finishLoading())}catch(n){this._request=null,this._loaded=!0,this.fire(new Q(n))}}loaded(){return this._loaded}updateImage(r){return r.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=r.url,this.load(r.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new U("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(r){this.map=r,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(r){this.coordinates=r;let n=r.map(xe.fromLngLat);return this.tileID=cO(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=pO(this.tileCoords),this.fire(new U("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;let r=this.map.painter.context,n=r.gl;this.texture||(this.texture=new Se(r,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 U("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}async loadTile(r){this.tileID&&this.tileID.equals(r.tileID.canonical)?(this.tiles[String(r.tileID.wrap)]=r,r.buckets={}):r.state="errored"}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}_getOverlappingTileRanges(r){let{minX:n,minY:i,maxX:o,maxY:a}=St.fromPoints(r),s={};for(let l=0;l<=Hi;l++){let u=Math.pow(2,l),c=Math.floor(n*u),p=Math.floor(i*u),h=Math.floor(o*u),f=Math.floor(a*u);s[l]={minTileX:c,minTileY:p,maxTileX:h,maxTileY:f}}return s}};function cO(t){let e=St.fromPoints(t),r=e.width(),n=e.height(),i=Math.max(r,n),o=Math.max(0,Math.floor(-Math.log(i)/Math.LN2)),a=Math.pow(2,o);return new gi(o,Math.floor((e.minX+e.maxX)/2*a),Math.floor((e.minY+e.maxY)/2*a))}function pO(t){let e=t[1].x-t[0].x,r=t[1].y-t[0].y,n=t[2].x-t[0].x,i=t[2].y-t[0].y;return e*i-r*n<0}var Vl=class extends vr{constructor(e,r,n,i){super(e,r,n,i),this.roundZoom=!0,this.type="video",this.options=r}async load(){this._loaded=!1;let e=this.options;this.urls=[];for(let r of e.urls)this.urls.push(this.map._requestManager.transformRequest(r,"Source").url);try{let r=await o_(this.urls);if(this._loaded=!0,!r)return;this.video=r,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(r){this.fire(new Q(r))}}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){let r=this.video.seekable;e<r.start(0)||e>r.end(0)?this.fire(new Q(new G("sources.".concat(this.id),null,"Playback for this video can be set only between the ".concat(r.start(0)," and ").concat(r.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,r=e.gl;this.texture?this.video.paused||(this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE),r.texSubImage2D(r.TEXTURE_2D,0,0,0,r.RGBA,r.UNSIGNED_BYTE,this.video)):(this.texture=new Se(e,this.video,r.RGBA),this.texture.bind(r.LINEAR,r.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 U("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}};m();var Ul=class extends vr{constructor(e,r,n,i){super(e,r,n,i),r.coordinates?(!Array.isArray(r.coordinates)||r.coordinates.length!==4||r.coordinates.some(o=>!Array.isArray(o)||o.length!==2||o.some(a=>typeof a!="number")))&&this.fire(new Q(new G("sources.".concat(e),null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new Q(new G("sources.".concat(e),null,'missing required property "coordinates"'))),r.animate&&typeof r.animate!="boolean"&&this.fire(new Q(new G("sources.".concat(e),null,'optional "animate" property must be a boolean value'))),r.canvas?typeof r.canvas!="string"&&!(r.canvas instanceof HTMLCanvasElement)&&this.fire(new Q(new G("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 Q(new G("sources.".concat(e),null,'missing required property "canvas"'))),this.options=r,this.animate=r.animate!==void 0?r.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 Q(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 r=this.map.painter.context,n=r.gl;this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new Se(r,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 U("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}};var hO={},N1=(t,e,r,n)=>{let i=fO(e.type),o=new i(t,e,r,n);if(o.id!==t)throw new Error("Expected Source id to be ".concat(t," instead of ").concat(o.id));return o},fO=t=>{switch(t){case"geojson":return Bl;case"image":return vr;case"raster":return mo;case"raster-dem":return Ol;case"vector":return Fl;case"video":return Vl;case"canvas":return Ul}return hO[t]};m();m();function G1(t,e){let r={};if(!e)return r;for(let n of t){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)r[o.id]=n}}return r}m();m();var sh=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 H1=se(Pl(),1),X1=se(Py(),1);m();var _a=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 Ey=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 to(8192,16,0),this.grid3D=new to(8192,16,0),this.featureIndexArray=new al,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 h=0;h<c.length;h++){let f=c[h];p[0]=Math.min(p[0],f.x),p[1]=Math.min(p[1],f.y),p[2]=Math.max(p[2],f.x),p[3]=Math.max(p[3],f.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 H1.default.VectorTile(new X1.default(this.rawTileData)).layers,this.sourceLayerCoder=new sh(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=ai(o.filter),l=e.queryGeometry,u=e.queryPadding*a,c=St.fromPoints(l),p=this.grid.query(c.minX-u,c.minY-u,c.maxX+u,c.maxY+u),h=St.fromPoints(e.cameraQueryGeometry).expandBy(u),f=this.grid3D.query(h.minX,h.minY,h.maxX,h.maxY,(x,b,v,P)=>Hv(e.cameraQueryGeometry,x-u,b-u,v+u,P+u));for(let x of f)p.push(x);p.sort(mO);let d={},g;for(let x=0;x<p.length;x++){let b=p[x];if(b===g)continue;g=b;let v=this.featureIndexArray.get(b),P=null;this.loadMatchingFeature(d,v.bucketIndex,v.sourceLayerIndex,v.featureIndex,s,o.layers,o.availableImages,r,n,i,(w,T,S)=>(P||(P=tr(w)),T.queryIntersectsFeature({queryGeometry:l,feature:w,featureState:S,geometry:P,zoom:this.z,transform:e.transform,pixelsToTileUnits:a,pixelPosMatrix:e.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:e.getElevation})))}return d}loadMatchingFeature(e,r,n,i,o,a,s,l,u,c,p){let h=this.bucketLayerIDs[r];if(a&&!h.some(b=>a.has(b)))return;let f=this.sourceLayerCoder.decode(n),g=this.vtLayers[f].feature(i);if(o.needGeometry){let b=rr(g,!0);if(!o.filter(new Te(this.tileID.overscaledZ),b,this.tileID.canonical))return}else if(!o.filter(new Te(this.tileID.overscaledZ),g))return;let x=this.getId(g,f);for(let b=0;b<h.length;b++){let v=h[b];if(a&&!a.has(v))continue;let P=l[v];if(!P)continue;let w={};x&&c&&(w=c.getState(P.sourceLayer||"_geojsonTileLayer",x));let T=Z({},u[v]);T.paint=j1(T.paint,P.paint,g,w,s),T.layout=j1(T.layout,P.layout,g,w,s);let S=!p||p(g,P,w);if(!S)continue;let I=new _a(g,this.z,this.x,this.y,x);I.layer=T;let M=e[v];M===void 0&&(M=e[v]=[]),M.push({featureIndex:i,feature:I,intersectionZ:S})}}lookupSymbolFeatures(e,r,n,i,o,a,s,l){let u={};this.loadVTLayers();let c=ai(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}};X("FeatureIndex",Ey,{omit:["rawTileData","sourceLayerCoder"]});function j1(t,e,r,n,i){return us(t,(o,a)=>{let s=e instanceof li?e.get(a):null;return s&&s.evaluate?s.evaluate(r,n,i):s})}function mO(t,e){return e-t}m();m();var Nl="RTLPluginLoaded";var Dy=class extends Ee{constructor(){super(...arguments);this.status="unavailable";this.url=null;this.dispatcher=Iy()}_syncState(r){return this.status=r,this.dispatcher.broadcast("SRPS",{pluginStatus:r,pluginURL:this.url}).catch(n=>{throw this.status="error",n})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}async setRTLTextPlugin(r,n=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=ae.resolveURL(r),!this.url)throw new Error("requested url ".concat(r," 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 U(Nl))}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}},Ly=null;function va(){return Ly||(Ly=new Dy),Ly}var dO=3e4,Pa=class{constructor(e,r){this.timeAdded=0;this.fadeEndTime=0;this.tileID=e,this.uid=uc(),this.uses=0,this.tileSize=r,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 r=e+this.timeAdded;r<this.fadeEndTime||(this.fadeEndTime=r)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(e){this.demTexture&&e.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(e,r,n){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",!e){this.collisionBoxArray=new el;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=G1(e.buckets,r==null?void 0:r.style),this.hasSymbolBuckets=!1;for(let i in this.buckets){let o=this.buckets[i];if(o instanceof Jr)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 Jr&&o.hasRTLText){this.hasRTLText=!0,va().lazyLoad();break}}this.queryPadding=0;for(let i in this.buckets){let o=this.buckets[i];this.queryPadding=Math.max(this.queryPadding,r.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 r=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Se(e,this.imageAtlas.image,r.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Se(e,this.glyphAtlasImage,r.ALPHA),this.glyphAtlasImage=null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,r,n,i,o,a,s,l,u,c,p){return!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData?{}:this.latestFeatureIndex.query({queryGeometry:i,cameraQueryGeometry:o,scale:a,tileSize:this.tileSize,pixelPosMatrix:c,transform:l,params:s,queryPadding:this.queryPadding*u,getElevation:p},e,r,n)}querySourceFeatures(e,r){let n=this.latestFeatureIndex;if(!n||!n.rawTileData)return;let i=n.loadVTLayers(),o=r&&r.sourceLayer?r.sourceLayer:"",a=i._geojsonTileLayer||i[o];if(!a)return;let s=ai(r&&r.filter),{z:l,x:u,y:c}=this.tileID.canonical,p={z:l,x:u,y:c};for(let h=0;h<a.length;h++){let f=a.feature(h);if(s.needGeometry){let x=rr(f,!0);if(!s.filter(new Te(this.tileID.overscaledZ),x,this.tileID.canonical))continue}else if(!s.filter(new Te(this.tileID.overscaledZ),f))continue;let d=n.getId(f,o),g=new _a(f,l,u,c,d);g.tile=p,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 r=this.expirationTime;if(e.cacheControl){let n=Hb(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(!r)i=!0;else if(this.expirationTime<r)i=!0;else{let o=this.expirationTime-r;o?this.expirationTime=n+Math.max(o,dO):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,r){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(e).length===0)return;let n=this.latestFeatureIndex.loadVTLayers();for(let i in this.buckets){if(!r.style.hasLayer(i))continue;let o=this.buckets[i],a=o.layers[0].sourceLayer||"_geojsonTileLayer",s=n[a],l=e[a];if(!s||!l||Object.keys(l).length===0)continue;o.update(l,s,this.imageAtlas&&this.imageAtlas.patternPositions||{});let u=r&&r.style&&r.style.getLayer(i);u&&(this.queryPadding=Math.max(this.queryPadding,u.queryRadius(o)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<ae.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(e){this.symbolFadeHoldUntil=ae.now()+e}setDependencies(e,r){let n={};for(let i of r)n[i]=!0;this.dependencies[e]=n}hasDependency(e,r){for(let n of e){let i=this.dependencies[n];if(i){for(let o of r)if(i[o])return!0}}return!1}};m();var lh=class{constructor(e,r){this.max=e,this.onRemove=r,this.reset()}reset(){for(let e in this.data)for(let r of this.data[e])r.timeout&&clearTimeout(r.timeout),this.onRemove(r.value);return this.data={},this.order=[],this}add(e,r,n){let i=e.wrapped().key;this.data[i]===void 0&&(this.data[i]=[]);let o={value:r,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 r=this.data[e].shift();return r.timeout&&clearTimeout(r.timeout),this.data[e].length===0&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),r.value}getByKey(e){let r=this.data[e];return r?r[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,r){if(!this.has(e))return this;let n=e.wrapped().key,i=r===void 0?0:this.data[n].indexOf(r),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 r=this._getAndRemoveByKey(this.order[0]);r&&this.onRemove(r)}return this}filter(e){let r=[];for(let n in this.data)for(let i of this.data[n])e(i.value)||r.push(i);for(let n of r)this.remove(n.value.tileID,n)}};var ky=se(fe(),1);m();var uh=class{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,r,n){let i=String(r);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][i]=this.stateChanges[e][i]||{},Z(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,r,n){if(this.deletedStates[e]===null)return;let o=String(r);if(this.deletedStates[e]=this.deletedStates[e]||{},n&&r!==void 0)this.deletedStates[e][o]!==null&&(this.deletedStates[e][o]=this.deletedStates[e][o]||{},this.deletedStates[e][o][n]=null);else if(r!==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,r){let n=String(r),i=this.state[e]||{},o=this.stateChanges[e]||{},a=Z({},i[n],o[n]);if(this.deletedStates[e]===null)return{};if(this.deletedStates[e]){let s=this.deletedStates[e][r];if(s===null)return{};for(let l in s)delete a[l]}return a}initializeTileState(e,r){e.setFeatureState(this.state,r)}coalesceChanges(e,r){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]={}),Z(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 l of Object.keys(this.deletedStates[i][a]))delete this.state[i][a][l];o[a]=this.state[i][a]}n[i]=n[i]||{},Z(n[i],o)}if(this.stateChanges={},this.deletedStates={},Object.keys(n).length!==0)for(let i in e)e[i].setFeatureState(n,r)}};m();m();var Z1=se(fe(),1),bi=89.25;function q1(t,e,r){let n=1/(1<<r.z);return new xe(t/8192*n+r.x*n,e/8192*n+r.y*n)}function Pr(t,e){let r=ce(e.lat,-Gt,Gt);return new Z1.default(kn(e.lng)*t,Qr(r)*t)}function _i(t,e){return new xe(e.x/t,e.y/t).toLngLat()}function wa(t){return t.cameraToCenterDistance*Math.min(Math.tan(Ve(90-t.pitch))*.85,Math.tan(Ve(bi-t.pitch)))}function ch(t,e){let r=t.canonical,n=e/ct(r.z),i=r.x+Math.pow(2,r.z)*t.wrap,o=B.identity(new Float64Array(16));return B.translate(o,o,[i*n,r.y*n,0]),B.scale(o,o,[n/8192,n/8192,1]),o}function Gl(t,e,r,n,i){let o=xe.fromLngLat(t,e),a=gn(1,t.lat),s=i*a,l=s*Math.cos(Ve(r)),u=Math.sqrt(s*s-l*l),c=u*Math.sin(Ve(-n)),p=u*Math.cos(Ve(-n));return new xe(o.x+c,o.y+p,o.z+l)}m();function yO(t,e,r){let n=e.intersectsFrustum(t);if(!r||n===0)return n;let i=e.intersectsPlane(r);return i===0?0:n===2&&i===2?2:1}function Y1(t,e,r){let i=0,o=(r-e)/10;for(let a=0;a<10;a++){let s=e+(a+.5)/10*(r-e);i+=o*Math.pow(Math.cos(s),t)}return i}function ph(t,e){return function(r,n,i,o,a){let s=2*((t-1)/it(Math.cos(Ve(bi-a))/Math.cos(Ve(bi)))-1),l=Math.acos(i/o),u=2*Y1(s-1,0,Ve(a/2)),c=Math.min(Ve(bi),l+Ve(a/2)),p=Math.min(c,l-Ve(a/2)),h=Y1(s-1,p,c),f=Math.atan(n/i),d=Math.hypot(n,i),g=r;return g=g+it(o/d/Math.max(.5,Math.cos(Ve(a/2)))),g+=s*it(Math.cos(f))/2,g-=it(Math.max(1,h/u/e))/2,g}}var gO=9.314,xO=3,bO=ph(gO,xO);function go(t,e){let r=(e.roundZoom?Math.round:Math.floor)(t.zoom+it(t.tileSize/e.tileSize));return Math.max(0,r)}function vi(t,e){let r=t.getCameraFrustum(),n=t.getClippingPlane(),i=t.screenPointToMercatorCoordinate(t.getCameraPoint()),o=xe.fromLngLat(t.center,t.elevation);i.z=o.z+Math.cos(t.pitchInRadians)*t.cameraToCenterDistance/t.worldSize;let a=t.getCoveringTilesDetailsProvider(),s=a.allowVariableZoom(t,e),l=go(t,e),u=e.minzoom||0,c=e.maxzoom!==void 0?e.maxzoom:t.maxZoom,p=Math.min(Math.max(0,l),c),h=Math.pow(2,p),f=[h*i.x,h*i.y,0],d=[h*o.x,h*o.y,0],g=Math.hypot(o.x-i.x,o.y-i.y),x=Math.abs(o.z-i.z),b=Math.hypot(g,x),v=T=>({zoom:0,x:0,y:0,wrap:T,fullyVisible:!1}),P=[],w=[];if(t.renderWorldCopies&&a.allowWorldCopies())for(let T=1;T<=3;T++)P.push(v(-T)),P.push(v(T));for(P.push(v(0));P.length>0;){let T=P.pop(),S=T.x,I=T.y,M=T.fullyVisible,E={x:S,y:I,z:T.zoom},L=a.getTileBoundingVolume(E,T.wrap,t.elevation,e);if(!M){let A=yO(r,L,n);if(A===0)continue;M=A===2}let k=a.distanceToTile2d(i.x,i.y,E,L),F=l;s&&(F=(e.calculateTileZoom||bO)(t.zoom+it(t.tileSize/e.tileSize),k,x,b,t.fov)),F=(e.roundZoom?Math.round:Math.floor)(F),F=Math.max(0,F);let z=Math.min(F,c);if(T.wrap=a.getWrap(o,E,T.wrap),T.zoom>=z){if(T.zoom<u)continue;let A=p-T.zoom,R=f[0]-.5-(S<<A),H=f[1]-.5-(I<<A),W=e.reparseOverscaled?Math.max(T.zoom,F):T.zoom;w.push({tileID:new We(T.zoom===c?W:T.zoom,T.wrap,T.zoom,S,I),distanceSq:Tt.sqrLen([d[0]-.5-S,d[1]-.5-I]),tileDistanceToCamera:Math.sqrt(R*R+H*H)});continue}for(let A=0;A<4;A++){let R=(S<<1)+A%2,H=(I<<1)+(A>>1),W=T.zoom+1;P.push({zoom:W,x:R,y:H,wrap:T.wrap,fullyVisible:M})}}return w.sort((T,S)=>T.distanceSq-S.distanceSq).map(T=>T.tileID)}m();var Ry=se(fe(),1);var $1=St.fromPoints([new Ry.default(0,0),new Ry.default(8192,8192)]);var Fn=class t extends Ee{constructor(e,r,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=N1(e,r,n,this),this._tiles={},this._cache=new lh(0,i=>this._unloadTile(i)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new uh,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 r=this._tiles[e];if(r.state!=="loaded"&&r.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,r,n){try{await this._source.loadTile(e),this._tileLoaded(e,r,n)}catch(i){e.state="errored",i.status!==404?this._source.fire(new Q(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 U("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 r in this._tiles){let n=this._tiles[r];n.upload(e),n.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(e=>e.tileID).sort(K1).map(e=>e.key)}getRenderableIds(e){let r=[];for(let n in this._tiles)this._isIdRenderable(n,e)&&r.push(this._tiles[n]);return e?r.sort((n,i)=>{let o=n.tileID,a=i.tileID,s=new ky.default(o.canonical.x,o.canonical.y)._rotate(-this.transform.bearingInRadians),l=new ky.default(a.canonical.x,a.canonical.y)._rotate(-this.transform.bearingInRadians);return o.overscaledZ-a.overscaledZ||l.y-s.y||l.x-s.x}).map(n=>n.tileID.key):r.map(n=>n.tileID).sort(K1).map(n=>n.key)}hasRenderableParent(e){let r=this.findLoadedParent(e,0);return r?this._isIdRenderable(r.tileID.key):!1}_isIdRenderable(e,r){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(r||!this._tiles[e].holdingForFade())}reload(e){if(this._paused){this._shouldReloadOnResume=!0;return}this._cache.reset();for(let r in this._tiles)e?this._reloadTile(r,"expired"):this._tiles[r].state!=="errored"&&this._reloadTile(r,"reloading")}async _reloadTile(e,r){let n=this._tiles[e];n&&(n.state!=="loading"&&(n.state=r),await this._loadTile(n,e,r))}_tileLoaded(e,r,n){e.timeAdded=ae.now(),n==="expired"&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(r,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 U("data",{dataType:"source",tile:e,coord:e.tileID}))}_backfillDEM(e){let r=this.getRenderableIds();for(let i=0;i<r.length;i++){let o=r[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,l=Math.pow(2,i.tileID.canonical.z),u=o.tileID.key;a===0&&s===0||Math.abs(s)>1||(Math.abs(a)>1&&(Math.abs(a+l)===1?a+=l:Math.abs(a-l)===1&&(a-=l)),!(!o.dem||!i.dem)&&(i.dem.backfillBorder(o.dem,a,s),i.neighboringTiles&&i.neighboringTiles[u]&&(i.neighboringTiles[u].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,r,n,i){for(let o in this._tiles){let a=this._tiles[o];if(i[o]||!a.hasData()||a.tileID.overscaledZ<=r||a.tileID.overscaledZ>n)continue;let s=a.tileID;for(;a&&a.tileID.overscaledZ>r+1;){let u=a.tileID.scaledTo(a.tileID.overscaledZ-1);a=this._tiles[u.key],a&&a.hasData()&&(s=u)}let l=s;for(;l.overscaledZ>r;)if(l=l.scaledTo(l.overscaledZ-1),e[l.key]||e[l.canonical.key]){i[s.key]=s;break}}}findLoadedParent(e,r){if(e.key in this._loadedParentTiles){let n=this._loadedParentTiles[e.key];return n&&n.tileID.overscaledZ>=r?n:null}for(let n=e.overscaledZ-1;n>=r;n--){let i=e.scaledTo(n),o=this._getLoadedTile(i);if(o)return o}}findLoadedSibling(e){return this._getLoadedTile(e)}_getLoadedTile(e){let r=this._tiles[e.key];return r&&r.hasData()?r:this._cache.getByKey(e.wrapped().key)}updateCacheSize(e){let r=Math.ceil(e.width/this._source.tileSize)+1,n=Math.ceil(e.height/this._source.tileSize)+1,i=r*n,o=this._maxTileCacheZoomLevels===null?Kt.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 r=this._prevLng===void 0?e:this._prevLng,i=(e-r)/360,o=Math.round(i);if(this._prevLng=e,o){let a={};for(let s in this._tiles){let l=this._tiles[s];l.tileID=l.tileID.unwrapTo(l.tileID.wrap+o),a[l.tileID.key]=l}this._tiles=a;for(let s in this._timers)clearTimeout(this._timers[s]),delete this._timers[s];for(let s in this._tiles){let l=this._tiles[s];this._setTileReloadTimer(s,l)}}}_updateCoveredAndRetainedTiles(e,r,n,i,o,a){let s={},l={},u=Object.keys(e),c=ae.now();for(let p of u){let h=e[p],f=this._tiles[p];if(!f||f.fadeEndTime!==0&&f.fadeEndTime<=c)continue;let d=this.findLoadedParent(h,r),g=this.findLoadedSibling(h),x=d||g||null;x&&(this._addTile(x.tileID),s[x.tileID.key]=x.tileID),l[p]=h}this._retainLoadedChildren(l,i,n,e);for(let p in s)e[p]||(this._coveredTiles[p]=!0,e[p]=s[p]);if(a){let p={},h={};for(let f of o)this._tiles[f.key].hasData()?p[f.key]=f:h[f.key]=f;for(let f in h){let d=h[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]&&(p[d[0].key]=e[d[0].key]=d[0],p[d[1].key]=e[d[1].key]=d[1],p[d[2].key]=e[d[2].key]=d[2],p[d[3].key]=e[d[3].key]=d[3],delete h[f])}for(let f in h){let d=h[f],g=this.findLoadedParent(d,this._source.minzoom),x=this.findLoadedSibling(d),b=g||x||null;if(b){p[b.tileID.key]=e[b.tileID.key]=b.tileID;for(let v in p)p[v].isChildOf(b.tileID)&&delete p[v]}}for(let f in this._tiles)p[f]||(this._coveredTiles[f]=!0)}}update(e,r){if(!this._sourceLoaded||this._paused)return;this.transform=e,this.terrain=r,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(c=>new We(c.canonical.z,c.wrap,c.canonical.z,c.canonical.x,c.canonical.y)):(n=vi(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:r,calculateTileZoom:this._source.calculateTileZoom}),this._source.hasTile&&(n=n.filter(c=>this._source.hasTile(c))));let i=go(e,this._source),o=Math.max(i-t.maxOverzooming,this._source.minzoom),a=Math.max(i+t.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){let c={};for(let p of n)if(p.canonical.z>this._source.minzoom){let h=p.scaledTo(p.canonical.z-1);c[h.key]=h;let f=p.scaledTo(Math.max(this._source.minzoom,Math.min(p.canonical.z,5)));c[f.key]=f}n=n.concat(Object.values(c))}let s=n.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,s&&this.fire(new U("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));let l=this._updateRetainedTiles(n,i);J1(this._source.type)&&this._updateCoveredAndRetainedTiles(l,o,a,i,n,r);for(let c in l)this._tiles[c].clearFadeHold();let u=Vb(this._tiles,l);for(let c of u){let p=this._tiles[c];p.hasSymbolBuckets&&!p.holdingForFade()?p.setHoldDuration(this.map._fadeDuration):(!p.hasSymbolBuckets||p.symbolFadeFinished())&&this._removeTile(c)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(let e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(e)}_updateRetainedTiles(e,r){var l;let n={},i={},o=Math.max(r-t.maxOverzooming,this._source.minzoom),a=Math.max(r+t.maxUnderzooming,this._source.minzoom),s={};for(let u of e){let c=this._addTile(u);n[u.key]=u,!c.hasData()&&r<this._source.maxzoom&&(s[u.key]=u)}this._retainLoadedChildren(s,r,a,n);for(let u of e){let c=this._tiles[u.key];if(c.hasData())continue;if(r+1>this._source.maxzoom){let h=u.children(this._source.maxzoom)[0],f=this.getTile(h);if(f&&f.hasData()){n[h.key]=h;continue}}else{let h=u.children(this._source.maxzoom);if(n[h[0].key]&&n[h[1].key]&&n[h[2].key]&&n[h[3].key])continue}let p=c.wasRequested();for(let h=u.overscaledZ-1;h>=o;--h){let f=u.scaledTo(h);if(i[f.key])break;if(i[f.key]=!0,c=this.getTile(f),!c&&p&&(c=this._addTile(f)),c){let d=c.hasData();if((d||!((l=this.map)!=null&&l.cancelPendingTileRequestsWhileZooming)||p)&&(n[f.key]=f),p=c.wasRequested(),d)break}}}return n}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(let e in this._tiles){let r=[],n,i=this._tiles[e].tileID;for(;i.overscaledZ>0;){if(i.key in this._loadedParentTiles){n=this._loadedParentTiles[i.key];break}r.push(i.key);let o=i.scaledTo(i.overscaledZ-1);if(n=this._getLoadedTile(o),n)break;i=o}for(let o of r)this._loadedParentTiles[o]=n}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(let e in this._tiles){let r=this._tiles[e].tileID,n=this._getLoadedTile(r);this._loadedSiblingTiles[r.key]=n}}_addTile(e){let r=this._tiles[e.key];if(r)return r;r=this._cache.getAndRemove(e),r&&(this._setTileReloadTimer(e.key,r),r.tileID=e,this._state.initializeTileState(r,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,r)));let n=r;return r||(r=new Pa(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(r,e.key,r.state)),r.uses++,this._tiles[e.key]=r,n||this._source.fire(new U("dataloading",{tile:r,coord:r.tileID,dataType:"source"})),r}_setTileReloadTimer(e,r){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);let n=r.getExpiryTimeout();n&&(this._timers[e]=setTimeout(()=>{this._reloadTile(e,"expired"),delete this._timers[e]},n))}refreshTiles(e){for(let r in this._tiles)!this._isIdRenderable(r)&&this._tiles[r].state!="errored"||e.some(n=>n.equals(this._tiles[r].tileID.canonical))&&this._reloadTile(r,"expired")}_removeTile(e){let r=this._tiles[e];r&&(r.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),!(r.uses>0)&&(r.hasData()&&r.state!=="reloading"?this._cache.add(r.tileID,r,r.getExpiryTimeout()):(r.aborted=!0,this._abortTile(r),this._unloadTile(r))))}_dataHandler(e){let r=e.sourceDataType;e.dataType==="source"&&r==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&e.dataType==="source"&&r==="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,r,n){let i=[],o=this.transform;if(!o)return i;let a=o.getCoveringTilesDetailsProvider().allowWorldCopies(),s=n?o.getCameraQueryGeometry(e):e,l=f=>o.screenPointToMercatorCoordinate(f,this.terrain),u=this.transformBbox(e,l,!a),c=this.transformBbox(s,l,!a),p=this.getIds(),h=St.fromPoints(c);for(let f=0;f<p.length;f++){let d=this._tiles[p[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),b=r*d.queryPadding*8192/d.tileSize/x;for(let v of g){let P=h.map(w=>v.getTilePoint(new xe(w.x,w.y)));if(P.expandBy(b),P.intersects($1)){let w=u.map(S=>v.getTilePoint(S)),T=c.map(S=>v.getTilePoint(S));i.push({tile:d,tileID:a?v:v.unwrapTo(0),queryGeometry:w,cameraQueryGeometry:T,scale:x})}}}return i}transformBbox(e,r,n){let i=e.map(r);if(n){let o=St.fromPoints(e);o.shrinkBy(Math.min(o.width(),o.height())*.001);let a=o.map(r);St.fromPoints(i).covers(a)||(i=i.map(l=>l.x>.5?new xe(l.x-1,l.y,l.z):l))}return i}getVisibleCoordinates(e){let r=this.getRenderableIds(e).map(n=>this._tiles[n].tileID);return this.transform&&this.transform.populateCache(r),r}hasTransition(){if(this._source.hasTransition())return!0;if(J1(this._source.type)){let e=ae.now();for(let r in this._tiles)if(this._tiles[r].fadeEndTime>=e)return!0}return!1}setFeatureState(e,r,n){e=e||"_geojsonTileLayer",this._state.updateState(e,r,n)}removeFeatureState(e,r,n){e=e||"_geojsonTileLayer",this._state.removeFeatureState(e,r,n)}getFeatureState(e,r){return e=e||"_geojsonTileLayer",this._state.getState(e,r)}setDependencies(e,r,n){let i=this._tiles[e];i&&i.setDependencies(r,n)}reloadTilesForDependencies(e,r){for(let n in this._tiles)this._tiles[n].hasDependency(e,r)&&this._reloadTile(n,"reloading");this._cache.filter(n=>!n.hasDependency(e,r))}};Fn.maxOverzooming=10;Fn.maxUnderzooming=3;function K1(t,e){let r=Math.abs(t.wrap*2)-+(t.wrap<0),n=Math.abs(e.wrap*2)-+(e.wrap<0);return t.overscaledZ-e.overscaledZ||n-r||e.canonical.y-t.canonical.y||e.canonical.x-t.canonical.x}function J1(t){return t==="raster"||t==="image"||t==="video"}m();m();m();var en=se(fe(),1);m();var On=se(fe(),1);function Fy(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 On.default(e,c.y+(p.y-c.y)*((e-c.x)/(p.x-c.x)))._round():p.x<e&&(p=new On.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 On.default(c.x+(p.x-c.x)*((r-c.y)/(p.y-c.y)),r)._round():p.y<r&&(p=new On.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 On.default(n,c.y+(p.y-c.y)*((n-c.x)/(p.x-c.x)))._round():p.x>=n&&(p=new On.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 On.default(c.x+(p.x-c.x)*((i-c.y)/(p.y-c.y)),i)._round():p.y>=i&&(p=new On.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}m();var hh=class{constructor(e,r){this.reset(e,r)}reset(e,r){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(r||0,this.length*.5),this.paddedLength=this.length-this.padding*2}lerp(e){if(this.points.length===1)return this.points[0];e=ce(e,0,1);let r=1,n=this._distances[r],i=e*this.paddedLength+this.padding;for(;n<i&&r<this._distances.length;)n=this._distances[++r];let o=r-1,a=this._distances[o],s=n-a,l=s>0?(i-a)/s:0;return this.points[o].mult(1-l).add(this.points[r].mult(l))}};m();function fh(t,e){let r=!0;return t==="always"||(t==="never"||e==="never")&&(r=!1),r}var jl=class{constructor(e,r,n){let i=this.boxCells=[],o=this.circleCells=[];this.xCellCount=Math.ceil(e/n),this.yCellCount=Math.ceil(r/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=r,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/r,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,r,n,i,o){this._forEachCell(r,n,i,o,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(r),this.bboxes.push(n),this.bboxes.push(i),this.bboxes.push(o)}insertCircle(e,r,n,i){this._forEachCell(r-i,n-i,r+i,n+i,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(r),this.circles.push(n),this.circles.push(i)}_insertBoxCell(e,r,n,i,o,a){this.boxCells[o].push(a)}_insertCircleCell(e,r,n,i,o,a){this.circleCells[o].push(a)}_query(e,r,n,i,o,a,s){if(n<0||e>this.width||i<0||r>this.height)return[];let l=[];if(e<=0&&r<=0&&this.width<=n&&this.height<=i){if(o)return[{key:null,x1:e,y1:r,x2:n,y2:i}];for(let u=0;u<this.boxKeys.length;u++)l.push({key:this.boxKeys[u],x1:this.bboxes[u*4],y1:this.bboxes[u*4+1],x2:this.bboxes[u*4+2],y2:this.bboxes[u*4+3]});for(let u=0;u<this.circleKeys.length;u++){let c=this.circles[u*3],p=this.circles[u*3+1],h=this.circles[u*3+2];l.push({key:this.circleKeys[u],x1:c-h,y1:p-h,x2:c+h,y2:p+h})}}else{let u={hitTest:o,overlapMode:a,seenUids:{box:{},circle:{}}};this._forEachCell(e,r,n,i,this._queryCell,l,u,s)}return l}query(e,r,n,i){return this._query(e,r,n,i,!1,null)}hitTest(e,r,n,i,o,a){return this._query(e,r,n,i,!0,o,a).length>0}hitTestCircle(e,r,n,i,o){let a=e-n,s=e+n,l=r-n,u=r+n;if(s<0||a>this.width||u<0||l>this.height)return!1;let c=[],p={hitTest:!0,overlapMode:i,circle:{x:e,y:r,radius:n},seenUids:{box:{},circle:{}}};return this._forEachCell(a,l,s,u,this._queryCellCircle,c,p,o),c.length>0}_queryCell(e,r,n,i,o,a,s,l){let{seenUids:u,hitTest:c,overlapMode:p}=s,h=this.boxCells[o];if(h!==null){let d=this.bboxes;for(let g of h)if(!u.box[g]){u.box[g]=!0;let x=g*4,b=this.boxKeys[g];if(e<=d[x+2]&&r<=d[x+3]&&n>=d[x+0]&&i>=d[x+1]&&(!l||l(b))&&(!c||!fh(p,b.overlapMode))&&(a.push({key:b,x1:d[x],y1:d[x+1],x2:d[x+2],y2:d[x+3]}),c))return!0}}let f=this.circleCells[o];if(f!==null){let d=this.circles;for(let g of f)if(!u.circle[g]){u.circle[g]=!0;let x=g*3,b=this.circleKeys[g];if(this._circleAndRectCollide(d[x],d[x+1],d[x+2],e,r,n,i)&&(!l||l(b))&&(!c||!fh(p,b.overlapMode))){let v=d[x],P=d[x+1],w=d[x+2];if(a.push({key:b,x1:v-w,y1:P-w,x2:v+w,y2:P+w}),c)return!0}}}return!1}_queryCellCircle(e,r,n,i,o,a,s,l){let{circle:u,seenUids:c,overlapMode:p}=s,h=this.boxCells[o];if(h!==null){let d=this.bboxes;for(let g of h)if(!c.box[g]){c.box[g]=!0;let x=g*4,b=this.boxKeys[g];if(this._circleAndRectCollide(u.x,u.y,u.radius,d[x+0],d[x+1],d[x+2],d[x+3])&&(!l||l(b))&&!fh(p,b.overlapMode))return a.push(!0),!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,b=this.circleKeys[g];if(this._circlesCollide(d[x],d[x+1],d[x+2],u.x,u.y,u.radius)&&(!l||l(b))&&!fh(p,b.overlapMode))return a.push(!0),!0}}}_forEachCell(e,r,n,i,o,a,s,l){let u=this._convertToXCellCoord(e),c=this._convertToYCellCoord(r),p=this._convertToXCellCoord(n),h=this._convertToYCellCoord(i);for(let f=u;f<=p;f++)for(let d=c;d<=h;d++){let g=this.xCellCount*d+f;if(o.call(this,e,r,n,i,g,a,s,l))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,r,n,i,o,a){let s=i-e,l=o-r,u=n+a;return u*u>s*s+l*l}_circleAndRectCollide(e,r,n,i,o,a,s){let l=(a-i)/2,u=Math.abs(e-(i+l));if(u>l+n)return!1;let c=(s-o)/2,p=Math.abs(r-(o+c));if(p>c+n)return!1;if(u<=l||p<=c)return!0;let h=u-l,f=p-c;return h*h+f*f<=n*n}};m();var Ta=se(fe(),1);function Hl(t,e,r){let n=B.create();if(!t){let{vecSouth:i,vecEast:o}=yh(e),a=Wn.create();a[0]=o[0],a[1]=o[1],a[2]=i[0],a[3]=i[1],Wn.invert(a,a),n[0]=a[0],n[1]=a[1],n[4]=a[2],n[5]=a[3]}return B.scale(n,n,[1/r,1/r,1]),n}function tP(t,e,r,n){if(t){let i=B.create();if(!e){let{vecSouth:o,vecEast:a}=yh(r);i[0]=a[0],i[1]=a[1],i[4]=o[0],i[5]=o[1]}return B.scale(i,i,[n,n,1]),i}else return r.pixelsToClipSpaceMatrix}function yh(t){let e=Math.cos(t.rollInRadians),r=Math.sin(t.rollInRadians),n=Math.cos(t.pitchInRadians),i=Math.cos(t.bearingInRadians),o=Math.sin(t.bearingInRadians),a=Tt.create();a[0]=-i*n*r-o*e,a[1]=-o*n*r+i*e;let s=Tt.length(a);s<1e-9?Tt.zero(a):Tt.scale(a,a,1/s);let l=Tt.create();l[0]=i*n*e-o*r,l[1]=o*n*e+i*r;let u=Tt.length(l);return u<1e-9?Tt.zero(l):Tt.scale(l,l,1/u),{vecEast:l,vecSouth:a}}function gh(t,e,r,n){let i;n?(i=[t,e,n(t,e),1],Ne.transformMat4(i,i,r)):(i=[t,e,0,1],Xl(i,i,r));let o=i[3];return{point:new Ta.default(i[0]/o,i[1]/o),signedDistanceFromCamera:o,isOccluded:!1}}function zy(t,e){return .5+.5*(t/e)}function _O(t,e){return t.x>=-e[0]&&t.x<=e[0]&&t.y>=-e[1]&&t.y<=e[1]}function rP(t,e,r,n,i,o,a,s,l,u,c,p,h){let f=r?t.textSizeData:t.iconSizeData,d=ho(f,e.transform.zoom),g=[256/e.width*2+1,256/e.height*2+1],x=r?t.text.dynamicLayoutVertexArray:t.icon.dynamicLayoutVertexArray;x.clear();let b=t.lineVertexArray,v=r?t.text.placedSymbolArray:t.icon.placedSymbolArray,P=e.transform.width/e.transform.height,w=!1;for(let T=0;T<v.length;T++){let S=v.get(T);if(S.hidden||S.writingMode===2&&!w){xo(S.numGlyphs,x);continue}w=!1;let I=new Ta.default(S.anchorX,S.anchorY),E={getElevation:h,pitchedLabelPlaneMatrix:n,lineVertexArray:b,pitchWithMap:o,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:e.transform,tileAnchorPoint:I,unwrappedTileID:l,width:u,height:c,translation:p},L=Uy(S.anchorX,S.anchorY,E);if(!_O(L.point,g)){xo(S.numGlyphs,x);continue}let k=L.signedDistanceFromCamera,F=zy(e.transform.cameraToCenterDistance,k),z=ma(f,d,S),A=o?z*e.transform.getPitchedTextCorrection(S.anchorX,S.anchorY,l)/F:z*F,R=eP({projectionContext:E,pitchedLabelPlaneMatrixInverse:i,symbol:S,fontSize:A,flip:!1,keepUpright:a,glyphOffsetArray:t.glyphOffsetArray,dynamicLayoutVertexArray:x,aspectRatio:P,rotateToLine:s});w=R.useVertical,(R.notEnoughRoom||w||R.needsFlipping&&eP({projectionContext:E,pitchedLabelPlaneMatrixInverse:i,symbol:S,fontSize:A,flip:!0,keepUpright:a,glyphOffsetArray:t.glyphOffsetArray,dynamicLayoutVertexArray:x,aspectRatio:P,rotateToLine:s}).notEnoughRoom)&&xo(S.numGlyphs,x)}r?t.text.dynamicLayoutVertexBuffer.updateData(x):t.icon.dynamicLayoutVertexBuffer.updateData(x)}function Vy(t,e,r,n,i,o,a,s){let l=o.glyphStartIndex+o.numGlyphs,u=o.lineStartIndex,c=o.lineStartIndex+o.lineLength,p=e.getoffsetX(o.glyphStartIndex),h=e.getoffsetX(l-1),f=dh(t*p,r,n,i,o.segment,u,c,s,a);if(!f)return null;let d=dh(t*h,r,n,i,o.segment,u,c,s,a);return!d||s.projectionCache.anyProjectionOccluded?null:{first:f,last:d}}function Q1(t,e,r,n){if(t===1){let i=Math.abs(r.y-e.y),o=Math.abs(r.x-e.x)*n;if(i>o)return{useVertical:!0}}return(t===2?e.y<r.y:e.x>r.x)?{needsFlipping:!0}:null}function eP(t){let{projectionContext:e,pitchedLabelPlaneMatrixInverse:r,symbol:n,fontSize:i,flip:o,keepUpright:a,glyphOffsetArray:s,dynamicLayoutVertexArray:l,aspectRatio:u,rotateToLine:c}=t,p=i/24,h=n.lineOffsetX*p,f=n.lineOffsetY*p,d;if(n.numGlyphs>1){let g=n.glyphStartIndex+n.numGlyphs,x=n.lineStartIndex,b=n.lineStartIndex+n.lineLength,v=Vy(p,s,h,f,o,n,c,e);if(!v)return{notEnoughRoom:!0};let P=mh(v.first.point.x,v.first.point.y,e,r),w=mh(v.last.point.x,v.last.point.y,e,r);if(a&&!o){let T=Q1(n.writingMode,P,w,u);if(T)return T}d=[v.first];for(let T=n.glyphStartIndex+1;T<g-1;T++){let S=dh(p*s.getoffsetX(T),h,f,o,n.segment,x,b,e,c);if(!S)return{notEnoughRoom:!0};d.push(S)}d.push(v.last)}else{if(a&&!o){let x=Pi(e.tileAnchorPoint.x,e.tileAnchorPoint.y,e).point,b=n.lineStartIndex+n.segment+1,v=new Ta.default(e.lineVertexArray.getx(b),e.lineVertexArray.gety(b)),P=Pi(v.x,v.y,e),w=P.signedDistanceFromCamera>0?P.point:nP(e.tileAnchorPoint,v,x,1,e),T=mh(x.x,x.y,e,r),S=mh(w.x,w.y,e,r),I=Q1(n.writingMode,T,S,u);if(I)return I}let g=dh(p*s.getoffsetX(n.glyphStartIndex),h,f,o,n.segment,n.lineStartIndex,n.lineStartIndex+n.lineLength,e,c);if(!g||e.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};d=[g]}for(let g of d)fo(l,g.point,g.angle);return{}}function nP(t,e,r,n,i){let o=t.add(t.sub(e)._unit()),a=Pi(o.x,o.y,i).point,s=r.sub(a);return r.add(s._mult(n/s.mag()))}function Oy(t,e,r){let n=e.projectionCache;if(n.projections[t])return n.projections[t];let i=new Ta.default(e.lineVertexArray.getx(t),e.lineVertexArray.gety(t)),o=Pi(i.x,i.y,e);if(o.signedDistanceFromCamera>0)return n.projections[t]=o.point,n.anyProjectionOccluded=n.anyProjectionOccluded||o.isOccluded,o.point;let a=t-r.direction,s=r.distanceFromAnchor===0?e.tileAnchorPoint:new Ta.default(e.lineVertexArray.getx(a),e.lineVertexArray.gety(a)),l=r.absOffsetX-r.distanceFromAnchor+1;return nP(s,i,r.previousVertex,l,e)}function Pi(t,e,r){let n=t+r.translation[0],i=e+r.translation[1],o;return r.pitchWithMap?(o=gh(n,i,r.pitchedLabelPlaneMatrix,r.getElevation),o.isOccluded=!1):(o=r.transform.projectTileCoordinates(n,i,r.unwrappedTileID,r.getElevation),o.point.x=(o.point.x*.5+.5)*r.width,o.point.y=(-o.point.y*.5+.5)*r.height),o}function mh(t,e,r,n){if(r.pitchWithMap){let i=[t,e,0,1];return Ne.transformMat4(i,i,n),r.transform.projectTileCoordinates(i[0]/i[3],i[1]/i[3],r.unwrappedTileID,r.getElevation).point}else return{x:t/r.width*2-1,y:e/r.height*2-1}}function Uy(t,e,r){return r.transform.projectTileCoordinates(t,e,r.unwrappedTileID,r.getElevation)}function By(t,e,r){return t._unit()._perp()._mult(e*r)}function vO(t,e,r,n,i,o,a,s,l){if(s.projectionCache.offsets[t])return s.projectionCache.offsets[t];let u=r.add(e);if(t+l.direction<n||t+l.direction>=i)return s.projectionCache.offsets[t]=u,u;let c=Oy(t+l.direction,s,l),p=By(c.sub(r),a,l.direction),h=r.add(p),f=c.add(p);return s.projectionCache.offsets[t]=Gb(o,u,h,f)||u,s.projectionCache.offsets[t]}function dh(t,e,r,n,i,o,a,s,l){let u=n?t-e:t+e,c=u>0?1:-1,p=0;n&&(c*=-1,p=Math.PI),c<0&&(p+=Math.PI);let h=c>0?o+i:o+i+1,f;s.projectionCache.cachedAnchorPoint?f=s.projectionCache.cachedAnchorPoint:(f=Pi(s.tileAnchorPoint.x,s.tileAnchorPoint.y,s).point,s.projectionCache.cachedAnchorPoint=f);let d=f,g=f,x,b,v=0,P=0,w=Math.abs(u),T=[],S;do{if(h+=c,h<o||h>=a)return null;v+=P,g=d,b=x;let L={absOffsetX:w,direction:c,distanceFromAnchor:v,previousVertex:g};if(d=Oy(h,s,L),r===0)T.push(g),S=d.sub(g);else{let k,F=d.sub(g);if(F.mag()===0){let z=Oy(h+c,s,L);k=By(z.sub(d),r,c)}else k=By(F,r,c);b||(b=g.add(k)),x=vO(h,k,d,o,a,b,r,s,L),T.push(b),S=x.sub(b)}P=S.mag()}while(v+P<=w);let I=(w-v)/P,M=S._mult(I)._add(b||g),E=p+Math.atan2(d.y-g.y,d.x-g.x);return T.push(M),{point:M,angle:l?E:0,path:T}}var PO=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function xo(t,e){for(let r=0;r<t;r++){let n=e.length;e.resize(n+4),e.float32.set(PO,n*3)}}function Xl(t,e,r){let n=e[0],i=e[1];return t[0]=r[0]*n+r[4]*i+r[12],t[1]=r[1]*n+r[5]*i+r[13],t[3]=r[3]*n+r[7]*i+r[15],t}function iP(t,e){let r=B.create();return B.invert(r,e.pitchedLabelPlaneMatrix),t.map(n=>{let i=gh(n.x,n.y,r,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})}function oP(t){let e=0,r=0,n=0,i=0;for(let o=0;o<t.length;o++)t[o].isOccluded?(n=o+1,i=0):(i++,i>r&&(r=i,e=n));return t.slice(e,e+r)}var He=100,xh=class{constructor(e,r=new jl(e.width+2*He,e.height+2*He,25),n=new jl(e.width+2*He,e.height+2*He,25)){this.transform=e,this.grid=r,this.ignoredGrid=n,this.pitchFactor=Math.cos(e.pitch*Math.PI/180)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+He,this.screenBottomBoundary=e.height+He,this.gridRightBoundary=e.width+2*He,this.gridBottomBoundary=e.height+2*He,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,r,n,i,o,a,s,l,u,c,p,h){let f=e.anchorPointX+l[0],d=e.anchorPointY+l[1],g=this.projectAndGetPerspectiveRatio(f,d,o,c,h),x=n*g.perspectiveRatio,b;if(!a&&!s){let M=g.x+(p?p.x*x:0),E=g.y+(p?p.y*x:0);b={allPointsOccluded:!1,box:[M+e.x1*x,E+e.y1*x,M+e.x2*x,E+e.y2*x]}}else b=this._projectCollisionBox(e,x,i,o,a,s,l,g,c,p,h);let[v,P,w,T]=b.box,S=a?b.allPointsOccluded:g.isOccluded,I=S;return I||(I=g.perspectiveRatio<this.perspectiveRatioCutoff),I||(I=!this.isInsideGrid(v,P,w,T)),I||r!=="always"&&this.grid.hitTest(v,P,w,T,r,u)?{box:[v,P,w,T],placeable:!1,offscreen:!1,occluded:S}:{box:[v,P,w,T],placeable:!0,offscreen:this.isOffscreen(v,P,w,T),occluded:S}}placeCollisionCircles(e,r,n,i,o,a,s,l,u,c,p,h,f,d){let g=[],x=new en.default(r.anchorX,r.anchorY),b=this.getPerspectiveRatio(x.x,x.y,a,d),P=(u?o*this.transform.getPitchedTextCorrection(r.anchorX,r.anchorY,a)/b:o*b)/yi,w={projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},T=r.lineOffsetX*P,S=r.lineOffsetY*P,I={getElevation:d,pitchedLabelPlaneMatrix:s,lineVertexArray:n,pitchWithMap:u,projectionCache:w,transform:this.transform,tileAnchorPoint:x,unwrappedTileID:a,width:this.transform.width,height:this.transform.height,translation:f},M=Vy(P,i,T,S,!1,r,!1,I),E=!1,L=!1,k=!0;if(M){let F=p*.5*b+h,z=new en.default(-He,-He),A=new en.default(this.screenRightBoundary,this.screenBottomBoundary),R=new hh,H=M.first,W=M.last,$=[];for(let be=H.path.length-1;be>=1;be--)$.push(H.path[be]);for(let be=1;be<W.path.length;be++)$.push(W.path[be]);let he=F*2.5;if(u){let be=this.projectPathToScreenSpace($,I);be.some(ye=>ye.signedDistanceFromCamera<=0)?$=[]:$=be.map(ye=>ye.point)}let Xe=[];if($.length>0){let be=$[0].clone(),ye=$[0].clone();for(let qe=1;qe<$.length;qe++)be.x=Math.min(be.x,$[qe].x),be.y=Math.min(be.y,$[qe].y),ye.x=Math.max(ye.x,$[qe].x),ye.y=Math.max(ye.y,$[qe].y);be.x>=z.x&&ye.x<=A.x&&be.y>=z.y&&ye.y<=A.y?Xe=[$]:ye.x<z.x||be.x>A.x||ye.y<z.y||be.y>A.y?Xe=[]:Xe=Fy([$],z.x,z.y,A.x,A.y)}for(let be of Xe){R.reset(be,F*.25);let ye=0;R.length<=.5*F?ye=1:ye=Math.ceil(R.paddedLength/he)+1;for(let qe=0;qe<ye;qe++){let rt=qe/Math.max(ye-1,1),Pt=R.lerp(rt),ut=Pt.x+He,Vt=Pt.y+He;g.push(ut,Vt,F,0);let pr=ut-F,on=Vt-F,hr=ut+F,Mt=Vt+F;if(k=k&&this.isOffscreen(pr,on,hr,Mt),L=L||this.isInsideGrid(pr,on,hr,Mt),e!=="always"&&this.grid.hitTestCircle(ut,Vt,F,e,c)&&(E=!0,!l))return{circles:[],offscreen:!1,collisionDetected:E}}}}return{circles:!l&&E||!L||b<this.perspectiveRatioCutoff?[]:g,offscreen:k,collisionDetected:E}}projectPathToScreenSpace(e,r){let n=iP(e,r);return oP(n)}queryRenderedSymbols(e){if(e.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};let r=[],n=new St;for(let p of e){let h=new en.default(p.x+He,p.y+He);n.extend(h),r.push(h)}let{minX:i,minY:o,maxX:a,maxY:s}=n,l=this.grid.query(i,o,a,s).concat(this.ignoredGrid.query(i,o,a,s)),u={},c={};for(let p of l){let h=p.key;if(u[h.bucketInstanceId]===void 0&&(u[h.bucketInstanceId]={}),u[h.bucketInstanceId][h.featureIndex])continue;let f=[new en.default(p.x1,p.y1),new en.default(p.x2,p.y1),new en.default(p.x2,p.y2),new en.default(p.x1,p.y2)];bp(r,f)&&(u[h.bucketInstanceId][h.featureIndex]=!0,c[h.bucketInstanceId]===void 0&&(c[h.bucketInstanceId]=[]),c[h.bucketInstanceId].push(h.featureIndex))}return c}insertCollisionBox(e,r,n,i,o,a){let s=n?this.ignoredGrid:this.grid,l={bucketInstanceId:i,featureIndex:o,collisionGroupID:a,overlapMode:r};s.insert(l,e[0],e[1],e[2],e[3])}insertCollisionCircles(e,r,n,i,o,a){let s=n?this.ignoredGrid:this.grid,l={bucketInstanceId:i,featureIndex:o,collisionGroupID:a,overlapMode:r};for(let u=0;u<e.length;u+=4)s.insertCircle(l,e[u],e[u+1],e[u+2])}projectAndGetPerspectiveRatio(e,r,n,i,o){if(o){let a;i?(a=[e,r,i(e,r),1],Ne.transformMat4(a,a,o)):(a=[e,r,0,1],Xl(a,a,o));let s=a[3];return{x:(a[0]/s+1)/2*this.transform.width+He,y:(-a[1]/s+1)/2*this.transform.height+He,perspectiveRatio:.5+.5*(this.transform.cameraToCenterDistance/s),isOccluded:!1,signedDistanceFromCamera:s}}else{let a=this.transform.projectTileCoordinates(e,r,n,i);return{x:(a.point.x+1)/2*this.transform.width+He,y:(-a.point.y+1)/2*this.transform.height+He,perspectiveRatio:.5+.5*(this.transform.cameraToCenterDistance/a.signedDistanceFromCamera),isOccluded:a.isOccluded,signedDistanceFromCamera:a.signedDistanceFromCamera}}}getPerspectiveRatio(e,r,n,i){let o=this.transform.projectTileCoordinates(e,r,n,i);return .5+.5*(this.transform.cameraToCenterDistance/o.signedDistanceFromCamera)}isOffscreen(e,r,n,i){return n<He||e>=this.screenRightBoundary||i<He||r>this.screenBottomBoundary}isInsideGrid(e,r,n,i){return n>=0&&e<this.gridRightBoundary&&i>=0&&r<this.gridBottomBoundary}getViewportMatrix(){let e=B.identity([]);return B.translate(e,e,[-He,-He,0]),e}_projectCollisionBox(e,r,n,i,o,a,s,l,u,c,p){let h=1,f=0,d=0,g=1,x=e.anchorPointX+s[0],b=e.anchorPointY+s[1];if(a&&!o){let A=this.projectAndGetPerspectiveRatio(x+1,b,i,u,p),R=A.x-l.x,H=A.y-l.y,W=Math.atan(H/R)+(R<0?Math.PI:0),$=Math.sin(W),he=Math.cos(W);h=he,f=$,d=-$,g=he}else if(!a&&o){let A=yh(this.transform);h=A.vecEast[0],f=A.vecEast[1],d=A.vecSouth[0],g=A.vecSouth[1]}let v=l.x,P=l.y,w=r;if(o){v=x,P=b;let A=this.transform.zoom-n.overscaledZ;if(w=Math.pow(2,-A),w*=this.transform.getPitchedTextCorrection(x,b,i),!c){let R=l.signedDistanceFromCamera/this.transform.cameraToCenterDistance,H=ce(.5+.5*R,0,4);w*=H}}c&&(v+=h*c.x*w+d*c.y*w,P+=f*c.x*w+g*c.y*w);let T=e.x1*w,S=e.x2*w,I=(T+S)/2,M=e.y1*w,E=e.y2*w,L=(M+E)/2,k=[{offsetX:T,offsetY:M},{offsetX:I,offsetY:M},{offsetX:S,offsetY:M},{offsetX:S,offsetY:L},{offsetX:S,offsetY:E},{offsetX:I,offsetY:E},{offsetX:T,offsetY:E},{offsetX:T,offsetY:L}],F=[];for(let{offsetX:A,offsetY:R}of k)F.push(new en.default(v+h*A+d*R,P+f*A+g*R));let z=!1;if(o){let A=F.map(R=>this.projectAndGetPerspectiveRatio(R.x,R.y,i,u,p));z=A.some(R=>!R.isOccluded),F=A.map(R=>new en.default(R.x,R.y))}else z=!0;return{box:zb(F),allPointsOccluded:!z}}};m();m();var aP=se(fe(),1);var Zl=class t extends aP.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)}};X("Anchor",Zl);m();m();m();var SO=se(fe(),1);m();var CO=se(fe(),1);m();m();var MO=se(fe(),1);var AO=se(ey(),1);m();var ql=(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))(ql||{});var IO=Number.POSITIVE_INFINITY;function sP(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"}var jy=se(fe(),1);var bh=class{constructor(e,r,n,i){e?this.opacity=Math.max(0,Math.min(1,e.opacity+(e.placed?r:-r))):this.opacity=i&&n?1:0,this.placed=n}isHidden(){return this.opacity===0&&!this.placed}},bo=class{constructor(e,r,n,i,o){this.text=new bh(e?e.text:null,r,n,o),this.icon=new bh(e?e.icon:null,r,i,o)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}},_h=class{constructor(e,r,n){this.text=e,this.icon=r,this.skipFade=n}},Ny=class{constructor(e,r,n,i,o){this.bucketInstanceId=e,this.featureIndex=r,this.sourceLayerIndex=n,this.bucketIndex=i,this.tileID=o}},Gy=class{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 r=++this.maxGroupID;this.collisionGroups[e]={ID:r,predicate:n=>n.collisionGroupID===r}}return this.collisionGroups[e]}};function lP(t,e,r,n,i){let{horizontalAlign:o,verticalAlign:a}=Up(t),s=-(o-.5)*e,l=-(a-.5)*r;return new jy.default(s+n[0]*i,l+n[1]*i)}var vh=class{constructor(e,r,n,i,o){this.transform=e.clone(),this.terrain=r,this.collisionIndex=new xh(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=n,this.retainedQueryData={},this.collisionGroups=new Gy(i),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=o,o&&(o.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(e){let r=this.terrain;return r?(n,i)=>r.getElevation(e,n,i):null}getBucketParts(e,r,n,i){let o=n.getBucket(r),a=n.latestFeatureIndex;if(!o||!a||r.id!==o.layerIds[0])return;let s=n.collisionBoxArray,l=o.layers[0].layout,u=o.layers[0].paint,c=Math.pow(2,this.transform.zoom-n.tileID.overscaledZ),p=n.tileSize/8192,h=n.tileID.toUnwrapped(),f=l.get("text-rotation-alignment")==="map",d=gt(n,1,this.transform.zoom),g=Wt(this.collisionIndex.transform,n,u.get("text-translate"),u.get("text-translate-anchor")),x=Wt(this.collisionIndex.transform,n,u.get("icon-translate"),u.get("icon-translate-anchor")),b=Hl(f,this.transform,d);this.retainedQueryData[o.bucketInstanceId]=new Ny(o.bucketInstanceId,a,o.sourceLayerIndex,o.index,n.tileID);let v={bucket:o,layout:l,translationText:g,translationIcon:x,unwrappedTileID:h,pitchedLabelPlaneMatrix:b,scale:c,textPixelRatio:p,holdingForFade:n.holdingForFade(),collisionBoxArray:s,partiallyEvaluatedTextSize:ho(o.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(o.sourceID)};if(i)for(let P of o.sortKeyRanges){let{sortKey:w,symbolInstanceStart:T,symbolInstanceEnd:S}=P;e.push({sortKey:w,symbolInstanceStart:T,symbolInstanceEnd:S,parameters:v})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:o.symbolInstances.length,parameters:v})}attemptAnchorPlacement(e,r,n,i,o,a,s,l,u,c,p,h,f,d,g,x,b,v,P,w){let T=ql[e.textAnchor],S=[e.textOffset0,e.textOffset1],I=lP(T,n,i,S,o),M=this.collisionIndex.placeCollisionBox(r,h,l,u,c,s,a,x,p.predicate,P,I,w);if(!(v&&!this.collisionIndex.placeCollisionBox(v,h,l,u,c,s,a,b,p.predicate,P,I,w).placeable)&&M.placeable){let E;if(this.prevPlacement&&this.prevPlacement.variableOffsets[f.crossTileID]&&this.prevPlacement.placements[f.crossTileID]&&this.prevPlacement.placements[f.crossTileID].text&&(E=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:E},this.markUsedJustification(d,T,f,g),d.allowVerticalPlacement&&(this.markUsedOrientation(d,g,f),this.placedOrientations[f.crossTileID]=g),{shift:I,placedGlyphBoxes:M}}}placeLayerBucketPart(e,r,n){let{bucket:i,layout:o,translationText:a,translationIcon:s,unwrappedTileID:l,pitchedLabelPlaneMatrix:u,textPixelRatio:c,holdingForFade:p,collisionBoxArray:h,partiallyEvaluatedTextSize:f,collisionGroup:d}=e.parameters,g=o.get("text-optional"),x=o.get("icon-optional"),b=da(o,"text-overlap","text-allow-overlap"),v=b==="always",P=da(o,"icon-overlap","icon-allow-overlap"),w=P==="always",T=o.get("text-rotation-alignment")==="map",S=o.get("text-pitch-alignment")==="map",I=o.get("icon-text-fit")!=="none",M=o.get("symbol-z-order")==="viewport-y",E=v&&(w||!i.hasIconData()||x),L=w&&(v||!i.hasTextData()||g);!i.collisionArrays&&h&&i.deserializeCollisionBoxes(h);let k=this.retainedQueryData[i.bucketInstanceId].tileID,F=this._getTerrainElevationFunc(k),z=this.transform.getFastPathSimpleProjectionMatrix(k),A=(R,H,W)=>{var Fo,Zn;if(r[R.crossTileID])return;if(p){this.placements[R.crossTileID]=new _h(!1,!1,!1);return}let $=!1,he=!1,Xe=!0,be=null,ye={box:null,placeable:!1,offscreen:null,occluded:!1},qe={box:null,placeable:!1,offscreen:null},rt=null,Pt=null,ut=null,Vt=0,pr=0,on=0;H.textFeatureIndex?Vt=H.textFeatureIndex:R.useRuntimeCollisionCircles&&(Vt=R.featureIndex),H.verticalTextFeatureIndex&&(pr=H.verticalTextFeatureIndex);let hr=H.textBox;if(hr){let Ir=It=>{let jr=1;if(i.allowVerticalPlacement&&!It&&this.prevPlacement){let vn=this.prevPlacement.placedOrientations[R.crossTileID];vn&&(this.placedOrientations[R.crossTileID]=vn,jr=vn,this.markUsedOrientation(i,jr,R))}return jr},Gr=(It,jr)=>{if(i.allowVerticalPlacement&&R.numVerticalGlyphVertices>0&&H.verticalTextBox){for(let vn of i.writingModes)if(vn===2?(ye=jr(),qe=ye):ye=It(),ye&&ye.placeable)break}else ye=It()},ki=R.textAnchorOffsetStartIndex,Ar=R.textAnchorOffsetEndIndex;if(Ar===ki){let It=(Ka,Hu)=>{let kt=this.collisionIndex.placeCollisionBox(Ka,b,c,k,l,S,T,a,d.predicate,F,void 0,z);return kt&&kt.placeable&&(this.markUsedOrientation(i,Hu,R),this.placedOrientations[R.crossTileID]=Hu),kt};Gr(()=>It(hr,1),()=>{let Ka=H.verticalTextBox;return i.allowVerticalPlacement&&R.numVerticalGlyphVertices>0&&Ka?It(Ka,2):{box:null,offscreen:null}}),Ir(ye&&ye.placeable)}else{let It=ql[(Zn=(Fo=this.prevPlacement)==null?void 0:Fo.variableOffsets[R.crossTileID])==null?void 0:Zn.anchor],jr=(kt,Mm,UM)=>{let NM=kt.x2-kt.x1,GM=kt.y2-kt.y1,jM=R.textBoxScale,HM=I&&P==="never"?Mm:null,Fi=null,mx=b==="never"?1:2,dx="never";It&&mx++;for(let Im=0;Im<mx;Im++){for(let Am=ki;Am<Ar;Am++){let yx=i.textAnchorOffsets.get(Am);if(It&&yx.textAnchor!==It)continue;let Em=this.attemptAnchorPlacement(yx,kt,NM,GM,jM,T,S,c,k,l,d,dx,R,i,UM,a,s,HM,F);if(Em&&(Fi=Em.placedGlyphBoxes,Fi&&Fi.placeable))return $=!0,be=Em.shift,Fi}It?It=null:dx=b}return n&&!Fi&&(Fi={box:this.collisionIndex.placeCollisionBox(hr,"always",c,k,l,S,T,a,d.predicate,F,void 0,z).box,offscreen:!1,placeable:!1,occluded:!1}),Fi};Gr(()=>jr(hr,H.iconBox,1),()=>{let kt=H.verticalTextBox,Mm=ye&&ye.placeable;return i.allowVerticalPlacement&&!Mm&&R.numVerticalGlyphVertices>0&&kt?jr(kt,H.verticalIconBox,2):{box:null,occluded:!0,offscreen:null}}),ye&&($=ye.placeable,Xe=ye.offscreen);let Hu=Ir(ye&&ye.placeable);if(!$&&this.prevPlacement){let kt=this.prevPlacement.variableOffsets[R.crossTileID];kt&&(this.variableOffsets[R.crossTileID]=kt,this.markUsedJustification(i,kt.anchor,R,Hu))}}}if(rt=ye,$=rt&&rt.placeable,Xe=rt&&rt.offscreen,R.useRuntimeCollisionCircles){let Ir=i.text.placedSymbolArray.get(R.centerJustifiedTextSymbolIndex),Gr=ma(i.textSizeData,f,Ir),ki=o.get("text-padding"),Ar=R.collisionCircleDiameter;Pt=this.collisionIndex.placeCollisionCircles(b,Ir,i.lineVertexArray,i.glyphOffsetArray,Gr,l,u,n,S,d.predicate,Ar,ki,a,F),Pt.circles.length&&Pt.collisionDetected&&!n&&ve("Collisions detected, but collision boxes are not shown"),$=v||Pt.circles.length>0&&!Pt.collisionDetected,Xe=Xe&&Pt.offscreen}if(H.iconFeatureIndex&&(on=H.iconFeatureIndex),H.iconBox){let Ir=Gr=>this.collisionIndex.placeCollisionBox(Gr,P,c,k,l,S,T,s,d.predicate,F,I&&be?be:void 0,z);qe&&qe.placeable&&H.verticalIconBox?(ut=Ir(H.verticalIconBox),he=ut.placeable):(ut=Ir(H.iconBox),he=ut.placeable),Xe=Xe&&ut.offscreen}let Mt=g||R.numHorizontalGlyphVertices===0&&R.numVerticalGlyphVertices===0,$a=x||R.numIconVertices===0;!Mt&&!$a?he=$=he&&$:$a?Mt||(he=he&&$):$=he&&$;let Ro=$&&rt.placeable,Ri=he&&ut.placeable;if(Ro&&(qe&&qe.placeable&&pr?this.collisionIndex.insertCollisionBox(rt.box,b,o.get("text-ignore-placement"),i.bucketInstanceId,pr,d.ID):this.collisionIndex.insertCollisionBox(rt.box,b,o.get("text-ignore-placement"),i.bucketInstanceId,Vt,d.ID)),Ri&&this.collisionIndex.insertCollisionBox(ut.box,P,o.get("icon-ignore-placement"),i.bucketInstanceId,on,d.ID),Pt&&$&&this.collisionIndex.insertCollisionCircles(Pt.circles,b,o.get("text-ignore-placement"),i.bucketInstanceId,Vt,d.ID),n&&this.storeCollisionData(i.bucketInstanceId,W,H,rt,ut,Pt),R.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 _n=($||E)&&!(rt!=null&&rt.occluded),ko=(he||L)&&!(ut!=null&&ut.occluded);this.placements[R.crossTileID]=new _h(_n,ko,Xe||i.justReloaded),r[R.crossTileID]=!0};if(M){if(e.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");let R=i.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let H=R.length-1;H>=0;--H){let W=R[H];A(i.symbolInstances.get(W),i.collisionArrays[W],W)}}else for(let R=e.symbolInstanceStart;R<e.symbolInstanceEnd;R++)A(i.symbolInstances.get(R),i.collisionArrays[R],R);i.justReloaded=!1}storeCollisionData(e,r,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 l;s.has(r)?l=s.get(r):(l={text:null,icon:null},s.set(r,l)),n.textBox&&(l.text=i.box),n.iconBox&&(l.icon=o.box)}if(a){let s=this.collisionCircleArrays[e];s===void 0&&(s=this.collisionCircleArrays[e]=[]);for(let l=0;l<a.circles.length;l+=4)s.push(a.circles[l+0]-He),s.push(a.circles[l+1]-He),s.push(a.circles[l+2]),s.push(a.collisionDetected?1:0)}}markUsedJustification(e,r,n,i){let o={left:n.leftJustifiedTextSymbolIndex,center:n.centerJustifiedTextSymbolIndex,right:n.rightJustifiedTextSymbolIndex},a;i===2?a=n.verticalPlacedTextSymbolIndex:a=o[sP(r)];let s=[n.leftJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.rightJustifiedTextSymbolIndex,n.verticalPlacedTextSymbolIndex];for(let l of s)l>=0&&(a>=0&&l!==a?e.text.placedSymbolArray.get(l).crossTileID=0:e.text.placedSymbolArray.get(l).crossTileID=n.crossTileID)}markUsedOrientation(e,r,n){let i=r===1||r===3?r:0,o=r===2?r: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 r=this.prevPlacement,n=!1;this.prevZoomAdjustment=r?r.zoomAdjustment(this.transform.zoom):0;let i=r?r.symbolFadeChange(e):1,o=r?r.opacities:{},a=r?r.variableOffsets:{},s=r?r.placedOrientations:{};for(let l in this.placements){let u=this.placements[l],c=o[l];c?(this.opacities[l]=new bo(c,i,u.text,u.icon),n=n||u.text!==c.text.placed||u.icon!==c.icon.placed):(this.opacities[l]=new bo(null,i,u.text,u.icon,u.skipFade),n=n||u.text||u.icon)}for(let l in o){let u=o[l];if(!this.opacities[l]){let c=new bo(u,i,!1,!1);c.isHidden()||(this.opacities[l]=c,n=n||u.text.placed||u.icon.placed)}}for(let l in a)!this.variableOffsets[l]&&this.opacities[l]&&!this.opacities[l].isHidden()&&(this.variableOffsets[l]=a[l]);for(let l in s)!this.placedOrientations[l]&&this.opacities[l]&&!this.opacities[l].isHidden()&&(this.placedOrientations[l]=s[l]);if(r&&r.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=r?r.lastPlacementChangeTime:e)}updateLayerOpacities(e,r){let n={};for(let i of r){let o=i.getBucket(e);o&&i.latestFeatureIndex&&e.id===o.layerIds[0]&&this.updateBucketOpacities(o,i.tileID,n,i.collisionBoxArray)}}updateBucketOpacities(e,r,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 bo(null,0,!1,!1,!0),l=a.get("text-allow-overlap"),u=a.get("icon-allow-overlap"),c=o._unevaluatedLayout.hasValue("text-variable-anchor")||o._unevaluatedLayout.hasValue("text-variable-anchor-offset"),p=a.get("text-rotation-alignment")==="map",h=a.get("text-pitch-alignment")==="map",f=a.get("icon-text-fit")!=="none",d=new bo(null,0,l&&(u||!e.hasIconData()||a.get("icon-optional")),u&&(l||!e.hasTextData()||a.get("text-optional")),!0);!e.collisionArrays&&i&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(i);let g=(b,v,P)=>{for(let w=0;w<v/4;w++)b.opacityVertexArray.emplaceBack(P);b.hasVisibleVertices=b.hasVisibleVertices||P!==Yl},x=this.collisionBoxArrays.get(e.bucketInstanceId);for(let b=0;b<e.symbolInstances.length;b++){let v=e.symbolInstances.get(b),{numHorizontalGlyphVertices:P,numVerticalGlyphVertices:w,crossTileID:T}=v,S=n[T],I=this.opacities[T];S?I=s:I||(I=d,this.opacities[T]=I),n[T]=!0;let M=P>0||w>0,E=v.numIconVertices>0,L=this.placedOrientations[v.crossTileID],k=L===2,F=L===1||L===3;if(M){let A=cP(I.text),R=k?Yl:A;g(e.text,P,R);let H=F?Yl:A;g(e.text,w,H);let W=I.text.isHidden();[v.rightJustifiedTextSymbolIndex,v.centerJustifiedTextSymbolIndex,v.leftJustifiedTextSymbolIndex].forEach(Xe=>{Xe>=0&&(e.text.placedSymbolArray.get(Xe).hidden=W||k?1:0)}),v.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(v.verticalPlacedTextSymbolIndex).hidden=W||F?1:0);let $=this.variableOffsets[v.crossTileID];$&&this.markUsedJustification(e,$.anchor,v,L);let he=this.placedOrientations[v.crossTileID];he&&(this.markUsedJustification(e,"left",v,he),this.markUsedOrientation(e,he,v))}if(E){let A=cP(I.icon),R=!(f&&v.verticalPlacedIconSymbolIndex&&k);if(v.placedIconSymbolIndex>=0){let H=R?A:Yl;g(e.icon,v.numIconVertices,H),e.icon.placedSymbolArray.get(v.placedIconSymbolIndex).hidden=I.icon.isHidden()}if(v.verticalPlacedIconSymbolIndex>=0){let H=R?Yl:A;g(e.icon,v.numVerticalIconVertices,H),e.icon.placedSymbolArray.get(v.verticalPlacedIconSymbolIndex).hidden=I.icon.isHidden()}}let z=x&&x.has(b)?x.get(b):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){let A=e.collisionArrays[b];if(A){let R=new jy.default(0,0);if(A.textBox||A.verticalTextBox){let H=!0;if(c){let W=this.variableOffsets[T];W?(R=lP(W.anchor,W.width,W.height,W.textOffset,W.textBoxScale),p&&R._rotate(h?-this.transform.bearingInRadians:this.transform.bearingInRadians)):H=!1}if(A.textBox||A.verticalTextBox){let W;A.textBox&&(W=k),A.verticalTextBox&&(W=F),uP(e.textCollisionBox.collisionVertexArray,I.text.placed,!H||W,z.text,R.x,R.y)}}if(A.iconBox||A.verticalIconBox){let H=!!(!F&&A.verticalIconBox),W;A.iconBox&&(W=H),A.verticalIconBox&&(W=!H),uP(e.iconCollisionBox.collisionVertexArray,I.icon.placed,W,z.icon,f?R.x:0,f?R.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,r){let n=this.zoomAtLastRecencyCheck===r?1-this.zoomAdjustment(r):1;return this.zoomAtLastRecencyCheck=r,this.commitTime+this.fadeDuration*n>e}setStale(){this.stale=!0}};function uP(t,e,r,n,i,o){(!n||n.length===0)&&(n=[0,0,0,0]);let a=n[0]-He,s=n[1]-He,l=n[2]-He,u=n[3]-He;t.emplaceBack(e?1:0,r?1:0,i||0,o||0,a,s),t.emplaceBack(e?1:0,r?1:0,i||0,o||0,l,s),t.emplaceBack(e?1:0,r?1:0,i||0,o||0,l,u),t.emplaceBack(e?1:0,r?1:0,i||0,o||0,a,u)}var EO=Math.pow(2,25),LO=Math.pow(2,24),DO=Math.pow(2,17),RO=Math.pow(2,16),kO=Math.pow(2,9),FO=Math.pow(2,8),OO=Math.pow(2,1);function cP(t){if(t.opacity===0&&!t.placed)return 0;if(t.opacity===1&&t.placed)return 4294967295;let e=t.placed?1:0,r=Math.floor(t.opacity*127);return r*EO+e*LO+r*DO+e*RO+r*kO+e*FO+r*OO+e}var Yl=0;var Hy=class{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,r,n,i,o){let a=this._bucketParts;for(;this._currentTileIndex<e.length;){let s=e[this._currentTileIndex];if(r.getBucketParts(a,i,s,this._sortAcrossTiles),this._currentTileIndex++,o())return!0}for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,a.sort((s,l)=>s.sortKey-l.sortKey));this._currentPartIndex<a.length;){let s=a[this._currentPartIndex];if(r.placeLayerBucketPart(s,this._seenCrossTileIDs,n),this._currentPartIndex++,o())return!0}return!1}},Ph=class{constructor(e,r,n,i,o,a,s,l){this.placement=new vh(e,r,a,s,l),this._currentPlacementIndex=n.length-1,this._forceFullPlacement=i,this._showCollisionBoxes=o,this._done=!1}isDone(){return this._done}continuePlacement(e,r,n){let i=ae.now(),o=()=>this._forceFullPlacement?!1:ae.now()-i>2;for(;this._currentPlacementIndex>=0;){let a=e[this._currentPlacementIndex],s=r[a],l=this.placement.collisionIndex.transform.zoom;if(s.type==="symbol"&&(!s.minzoom||s.minzoom<=l)&&(!s.maxzoom||s.maxzoom>l)){if(this._inProgressLayer||(this._inProgressLayer=new Hy(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}};m();m();var pP=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],Xy=1,Wl=8,Kl=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!==Xy)throw new Error("Got v".concat(i," data when expected v").concat(Xy,"."));let o=pP[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=pP.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,Wl,e),this.coords=new this.ArrayType(this.data,Wl+s+l,e*2),this._pos=e*2,this._finished=!0):(this.data=new ArrayBuffer(Wl+a+s+l),this.ids=new this.IndexArrayType(this.data,Wl,e),this.coords=new this.ArrayType(this.data,Wl+s+l,e*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,(Xy<<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 qy(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,h=l.pop()||0;if(p-h<=s){for(let x=h;x<=p;x++){let b=a[2*x],v=a[2*x+1];b>=e&&b<=n&&v>=r&&v<=i&&u.push(o[x])}continue}let f=h+p>>1,d=a[2*f],g=a[2*f+1];d>=e&&d<=n&&g>=r&&g<=i&&u.push(o[f]),(c===0?e<=d:r<=g)&&(l.push(h),l.push(f-1),l.push(1-c)),(c===0?n>=d:i>=g)&&(l.push(f+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,h=s.pop()||0;if(p-h<=a){for(let x=h;x<=p;x++)hP(o[2*x],o[2*x+1],e,r)<=u&&l.push(i[x]);continue}let f=h+p>>1,d=o[2*f],g=o[2*f+1];hP(d,g,e,r)<=u&&l.push(i[f]),(c===0?e-n<=d:r-n<=g)&&(s.push(h),s.push(f-1),s.push(1-c)),(c===0?e+n>=d:r+n>=g)&&(s.push(f+1),s.push(p),s.push(1-c))}return l}};function qy(t,e,r,n,i,o){if(i-n<=r)return;let a=n+i>>1;fP(t,e,a,n,i,o),qy(t,e,r,n,a-1,1-o),qy(t,e,r,a+1,i,1-o)}function fP(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),h=.5*Math.exp(2*p/3),f=.5*Math.sqrt(p*h*(u-h)/u)*(c-u/2<0?-1:1),d=Math.max(n,Math.floor(r-c*h/u+f)),g=Math.min(i,Math.floor(r+(u-c)*h/u+f));fP(t,e,r,d,g,o)}let a=e[2*r+o],s=n,l=i;for($l(t,e,n,r),e[2*i+o]>a&&$l(t,e,n,i);s<l;){for($l(t,e,s,l),s++,l--;e[2*s+o]<a;)s++;for(;e[2*l+o]>a;)l--}e[2*n+o]===a?$l(t,e,n,l):(l++,$l(t,e,l,i)),l<=r&&(n=l+1),r<=l&&(i=l-1)}}function $l(t,e,r,n){Zy(t,r,n),Zy(e,2*r,2*n),Zy(e,2*r+1,2*n+1)}function Zy(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}function hP(t,e,r,n){let i=t-r,o=e-n;return i*i+o*o}var Jl=512/8192/2,BO=128,Yy=class{constructor(e,r,n){this.tileID=e;this.bucketInstanceId=n;this._symbolsByKey={};let i=new Map;for(let o=0;o<r.length;o++){let a=r.get(o),s=a.key,l=i.get(s);l?l.push(a):i.set(s,[a])}for(let[o,a]of i){let s=a.map(c=>({x:Math.floor(c.anchorX*Jl),y:Math.floor(c.anchorY*Jl)})),l=a.map(c=>c.crossTileID),u={positions:s,crossTileIDs:l};if(u.positions.length>BO){let c=new Kl(u.positions.length,16,Uint16Array);for(let{x:p,y:h}of u.positions)c.add(p,h);c.finish(),delete u.positions,u.index=c}this._symbolsByKey[o]=u}}getScaledCoordinates(e,r){let{x:n,y:i,z:o}=this.tileID.canonical,{x:a,y:s,z:l}=r.canonical,u=l-o,c=Jl/Math.pow(2,u),p=(a*8192+e.anchorX)*c,h=(s*8192+e.anchorY)*c,f=n*8192*Jl,d=i*8192*Jl;return{x:Math.floor(p-f),y:Math.floor(h-d)}}findMatches(e,r,n){let i=this.tileID.canonical.z<r.canonical.z?1:Math.pow(2,this.tileID.canonical.z-r.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 l=this.getScaledCoordinates(a,r);if(s.index){let u=s.index.range(l.x-i,l.y-i,l.x+i,l.y+i).sort();for(let c of u){let p=s.crossTileIDs[c];if(!n[p]){n[p]=!0,a.crossTileID=p;break}}}else if(s.positions)for(let u=0;u<s.positions.length;u++){let c=s.positions[u],p=s.crossTileIDs[u];if(Math.abs(c.x-l.x)<=i&&Math.abs(c.y-l.y)<=i&&!n[p]){n[p]=!0,a.crossTileID=p;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:e})=>e)}},Wy=class{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}},$y=class{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){let r=Math.round((e-this.lng)/360);if(r!==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+r),o[s.tileID.key]=s}this.indexes[n]=o}this.lng=e}addBucket(e,r,n){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===r.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let o=0;o<r.symbolInstances.length;o++){let a=r.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 l=a[s];l.tileID.isChildOf(e)&&l.findMatches(r.symbolInstances,e,i)}else{let s=e.scaledTo(Number(o)),l=a[s.key];l&&l.findMatches(r.symbolInstances,e,i)}}for(let o=0;o<r.symbolInstances.length;o++){let a=r.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 Yy(e,r.symbolInstances,r.bucketInstanceId),!0}removeBucketCrossTileIDs(e,r){for(let n of r.getCrossTileIDsLists())for(let i of n)delete this.usedCrossTileIDs[e][i]}removeStaleBuckets(e){let r=!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],r=!0)}return r}},Sa=class{constructor(){this.layerIndexes={},this.crossTileIDs=new Wy,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,r,n){let i=this.layerIndexes[e.id];i===void 0&&(i=this.layerIndexes[e.id]=new $y);let o=!1,a={};i.handleWrapJump(n);for(let s of r){let l=s.getBucket(e);!l||e.id!==l.layerIds[0]||(l.bucketInstanceId||(l.bucketInstanceId=++this.maxBucketInstanceId),i.addBucket(s.tileID,l,this.crossTileIDs)&&(o=!0),a[l.bucketInstanceId]=!0)}return i.removeStaleBuckets(a)&&(o=!0),o}pruneUnusedLayers(e){let r={};e.forEach(n=>{r[n]=!0});for(let n in this.layerIndexes)r[n]||delete this.layerIndexes[n]}};m();m();m();m();var mP="#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;";m();var dP="#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;";m();var yP="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}";m();var gP="in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}";m();var xP="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}";m();var bP="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);}";m();var _P="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}";m();var vP="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);}";m();var Ky="void main() {fragColor=vec4(1.0);}";m();var PP="in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}";m();var wP="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}";m();var TP="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}";m();var SP="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}";m();var CP="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;}";m();var MP="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;}}";m();var IP="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;}";m();var AP="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;}";m();var EP="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);}";m();var LP="#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}";m();var DP="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;}}";m();var RP="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);}";m();var kP="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));}";m();var FP="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}";m();var OP="#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}";m();var BP="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);}";m();var zP="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}";m();var VP="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}";m();var UP="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}";m();var NP="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}";m();var GP="#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}";m();var jP="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);}";m();var HP="in vec4 v_color;void main() {fragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}";m();var XP="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;}";m();var ZP="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}";m();var qP="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;}";m();var YP="#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}";m();var WP="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;}";m();var $P="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}";m();var KP="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;}}";m();var JP="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}";m();var QP="\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);}";m();var ew="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}";m();var tw="\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);}";m();var rw="#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}";m();var nw="\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;}";m();var iw="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}";m();var ow="\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);}";m();var aw="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}";m();var sw="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;}";m();var lw="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}";m();var uw="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));}";m();var cw="#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}";m();var pw="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);}";m();var hw="#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}";m();var fw="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);}";m();var mw="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);}";m();var dw="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);}";m();var yw="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;}}";m();var gw="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;}";m();var xw="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;}";m();var bw="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);}";m();var _w="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);}";m();var vw="in vec4 v_output_error_encoded;void main() {fragColor=v_output_error_encoded;}";m();var Pw="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);}";m();var ww="#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);}";m();var Tw="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;}";m();var Sw="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);}";m();var Cw="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);}";m();var Mw="in vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}";var ar={prelude:Ie(mP,dP),projectionMercator:Ie("",Pw),projectionGlobe:Ie("",ww),background:Ie(yP,gP),backgroundPattern:Ie(xP,bP),circle:Ie(_P,vP),clippingMask:Ie(Ky,PP),heatmap:Ie(wP,TP),heatmapTexture:Ie(SP,CP),collisionBox:Ie(MP,IP),collisionCircle:Ie(AP,EP),colorRelief:Ie(LP,DP),debug:Ie(RP,kP),depth:Ie(Ky,FP),fill:Ie(OP,BP),fillOutline:Ie(zP,VP),fillOutlinePattern:Ie(UP,NP),fillPattern:Ie(GP,jP),fillExtrusion:Ie(HP,XP),fillExtrusionPattern:Ie(ZP,qP),hillshadePrepare:Ie(YP,WP),hillshade:Ie($P,KP),line:Ie(JP,QP),lineGradient:Ie(ew,tw),linePattern:Ie(rw,nw),lineSDF:Ie(iw,ow),raster:Ie(aw,sw),symbolIcon:Ie(lw,uw),symbolSDF:Ie(cw,pw),symbolTextAndIcon:Ie(hw,fw),terrain:Ie(yw,gw),terrainDepth:Ie(mw,xw),terrainCoords:Ie(dw,bw),projectionErrorMeasurement:Ie(vw,_w),atmosphere:Ie(Tw,Sw),sky:Ie(Cw,Mw)};function Ie(t,e){let r=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,n=e.match(/in ([\w]+) ([\w]+)/g),i=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),o=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),a=o?o.concat(i):i,s={};return t=t.replace(r,(l,u,c,p,h)=>(s[h]=!0,u==="define"?"\n#ifndef HAS_UNIFORM_u_".concat(h,"\nin ").concat(c," ").concat(p," ").concat(h,";\n#else\nuniform ").concat(c," ").concat(p," u_").concat(h,";\n#endif\n"):"\n#ifdef HAS_UNIFORM_u_".concat(h,"\n ").concat(c," ").concat(p," ").concat(h," = u_").concat(h,";\n#endif\n"))),e=e.replace(r,(l,u,c,p,h)=>{let f=p==="float"?"vec2":"vec4",d=h.match(/color/)?"color":f;return s[h]?u==="define"?"\n#ifndef HAS_UNIFORM_u_".concat(h,"\nuniform lowp float u_").concat(h,"_t;\nin ").concat(c," ").concat(f," a_").concat(h,";\nout ").concat(c," ").concat(p," ").concat(h,";\n#else\nuniform ").concat(c," ").concat(p," u_").concat(h,";\n#endif\n"):d==="vec4"?"\n#ifndef HAS_UNIFORM_u_".concat(h,"\n ").concat(h," = a_").concat(h,";\n#else\n ").concat(c," ").concat(p," ").concat(h," = u_").concat(h,";\n#endif\n"):"\n#ifndef HAS_UNIFORM_u_".concat(h,"\n ").concat(h," = unpack_mix_").concat(d,"(a_").concat(h,", u_").concat(h,"_t);\n#else\n ").concat(c," ").concat(p," ").concat(h," = u_").concat(h,";\n#endif\n"):u==="define"?"\n#ifndef HAS_UNIFORM_u_".concat(h,"\nuniform lowp float u_").concat(h,"_t;\nin ").concat(c," ").concat(f," a_").concat(h,";\n#else\nuniform ").concat(c," ").concat(p," u_").concat(h,";\n#endif\n"):d==="vec4"?"\n#ifndef HAS_UNIFORM_u_".concat(h,"\n ").concat(c," ").concat(p," ").concat(h," = a_").concat(h,";\n#else\n ").concat(c," ").concat(p," ").concat(h," = u_").concat(h,";\n#endif\n"):"\n#ifndef HAS_UNIFORM_u_".concat(h,"\n ").concat(c," ").concat(p," ").concat(h," = unpack_mix_").concat(d,"(a_").concat(h,", u_").concat(h,"_t);\n#else\n ").concat(c," ").concat(p," ").concat(h," = u_").concat(h,";\n#endif\n")}),{fragmentSource:t,vertexSource:e,staticAttributes:n,staticUniforms:a}}function Iw(t){return t.replace(/\bin\s/g,"attribute ").replace(/\bout\s/g,"varying ").replace(/texture\(/g,"texture2D(")}function Aw(t){return t.replace(/\bin\s/g,"varying ").replace("out highp vec4 fragColor;","").replace(/fragColor/g,"gl_FragColor").replace(/texture\(/g,"texture2D(")}m();var sr=class{constructor(e,r,n){this.vertexBuffer=e,this.indexBuffer=r,this.segments=n}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}};m();var wr=ze([{name:"a_pos",type:"Int16",components:2}]);var Jy="#define PROJECTION_MERCATOR",Qy="mercator",_o=class{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return Qy}get shaderDefine(){return Jy}get shaderPreludeCode(){return ar.projectionMercator}get vertexShaderPreludeCode(){return ar.projectionMercator.vertexSource}get subdivisionGranularity(){return di.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}get latitudeErrorCorrectionRadians(){return 0}destroy(){}updateGPUdependent(e){}getMeshFromTileID(e,r,n,i,o){if(this._cachedMesh)return this._cachedMesh;let a=new Dt;a.emplaceBack(0,0),a.emplaceBack(8192,0),a.emplaceBack(0,8192),a.emplaceBack(8192,8192);let s=e.createVertexBuffer(a,wr.members),l=de.simpleSegment(0,0,4,2),u=new et;u.emplaceBack(1,0,2),u.emplaceBack(1,2,3);let c=e.createIndexBuffer(u);return this._cachedMesh=new sr(s,c,l),this._cachedMesh}recalculate(){}hasTransition(){return!1}setErrorQueryLatitudeDegrees(e){}};m();var lr=se(fe(),1);m();var wi=se(fe(),1);m();var Ew=se(fe(),1);var Ca=class t{constructor(e=0,r=0,n=0,i=0){if(isNaN(e)||e<0||isNaN(r)||r<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=r,this.left=n,this.right=i}interpolate(e,r,n){return r.top!=null&&e.top!=null&&(this.top=Fe.number(e.top,r.top,n)),r.bottom!=null&&e.bottom!=null&&(this.bottom=Fe.number(e.bottom,r.bottom,n)),r.left!=null&&e.left!=null&&(this.left=Fe.number(e.left,r.left,n)),r.right!=null&&e.right!=null&&(this.right=Fe.number(e.right,r.right,n)),this}getCenter(e,r){let n=ce((this.left+e-this.right)/2,0,e),i=ce((this.top+r-this.bottom)/2,0,r);return new Ew.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 t(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}};function Ma(t,e){if(!t.renderWorldCopies||t.lngRange)return;let r=e.lng-t.center.lng;e.lng+=r>180?-360:r<-180?360:0}function Lw(t){return Math.max(0,Math.floor(t))}var Ti=class{constructor(e,r,n,i,o,a){this._callbacks=e,this._tileSize=512,this._renderWorldCopies=a===void 0?!0:!!a,this._minZoom=r||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 J(0,0),this._elevation=0,this._zoom=0,this._tileZoom=Lw(this._zoom),this._scale=ct(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new Ca,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(e,r,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=Lw(this._zoom),this._scale=ct(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 Ca(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,r&&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 wi.default(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(e){let r=Rr(e,-180,180)*Math.PI/180;this._bearingInRadians!==r&&(this._unmodified=!1,this._bearingInRadians=r,this._calcMatrices(),this._rotationMatrix=Wn.create(),Wn.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 r=ce(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==r&&(this._unmodified=!1,this._pitchInRadians=r,this._calcMatrices())}get rollInRadians(){return this._rollInRadians}get roll(){return this._rollInRadians/Math.PI*180}setRoll(e){let r=e/180*Math.PI;this._rollInRadians!==r&&(this._unmodified=!1,this._rollInRadians=r,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return Gi(this._fovInRadians)}setFov(e){e=ce(e,.1,150),this.fov!==e&&(this._unmodified=!1,this._fovInRadians=Ve(e),this._calcMatrices())}get zoom(){return this._zoom}setZoom(e){let r=this.getConstrained(this._center,e).zoom;this._zoom!==r&&(this._unmodified=!1,this._zoom=r,this._tileZoom=Math.max(0,Math.floor(r)),this._scale=ct(r),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,r){this._autoCalculateNearFarZ=!1,this._nearZ=e,this._farZ=r,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices()}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,r,n){this._unmodified=!1,this._edgeInsets.interpolate(e,r,n),this._constrain(),this._calcMatrices()}resize(e,r,n=!0){this._width=e,this._height=r,n&&this._constrain(),this._calcMatrices()}getMaxBounds(){return!this._latRange||this._latRange.length!==2||!this._lngRange||this._lngRange.length!==2?null:new yt([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=[-Gt,Gt])}getConstrained(e,r){return this._callbacks.getConstrained(e,r)}getCameraQueryGeometry(e,r){if(r.length===1)return[r[0],e];{let{minX:n,minY:i,maxX:o,maxY:a}=St.fromPoints(r).extend(e);return[new wi.default(n,i),new wi.default(o,i),new wi.default(o,a),new wi.default(n,a),new wi.default(n,i)]}}_constrain(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;let e=this._unmodified,{center:r,zoom:n}=this.getConstrained(this.center,this.zoom);this.setCenter(r),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=B.identity(new Float64Array(16));B.scale(e,e,[this._width/2,-this._height/2,1]),B.translate(e,e,[1,-1,0]),this._clipSpaceToPixelsMatrix=e,e=B.identity(new Float64Array(16)),B.scale(e,e,[1,-1,1]),B.translate(e,e,[-1,-1,0]),B.scale(e,e,[2/this._width,2/this._height,1]),this._pixelsToClipSpaceMatrix=e;let r=this.fovInRadians/2;this._cameraToCenterDistance=.5/Math.tan(r)*this._height}this._callbacks.calcMatrices()}calculateCenterFromCameraLngLatAlt(e,r,n,i){let o=n!==void 0?n:this.bearing,a=i=i!==void 0?i:this.pitch,s=xe.fromLngLat(e,r),l=-Math.cos(Ve(a)),u=Math.sin(Ve(a)),c=u*Math.sin(Ve(o)),p=-u*Math.cos(Ve(o)),h=this.elevation,f=r-h,d;l*f>=0||Math.abs(l)<.1?(d=1e4,h=r+d*l):d=-f/l;let g=ah(1,s.y),x,b,v=0,P=10;do{if(v+=1,v>P)break;b=d/g;let S=c*b,I=p*b;x=new xe(s.x+S,s.y+I),g=1/x.meterInMercatorCoordinateUnits()}while(Math.abs(d-b*g)>1e-12);let w=x.toLngLat(),T=it(this.height/2/Math.tan(this.fovInRadians/2)/b/this.tileSize);return{center:w,elevation:h,zoom:T}}recalculateZoomAndCenter(e){if(this.elevation-e===0)return;let r=gn(1,this.center.lat)*this.worldSize,n=this.cameraToCenterDistance/r,i=xe.fromLngLat(this.center,this.elevation),o=Gl(this.center,this.elevation,this.pitch,this.bearing,n);this._elevation=e;let a=this.calculateCenterFromCameraLngLatAlt(o.toLngLat(),ah(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,r=Math.tan(e)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new wi.default(r*Math.sin(this.rollInRadians),r*Math.cos(this.rollInRadians)))}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this._cameraToCenterDistance/this._pixelPerMeter+this.elevation}getCameraLngLat(){let e=gn(1,this.center.lat)*this.worldSize,r=this.cameraToCenterDistance/e;return Gl(this.center,this.elevation,this.pitch,this.bearing,r).toLngLat()}getMercatorTileCoordinates(e){if(!e)return[0,0,1,1];let r=e.canonical.z>=0?1<<e.canonical.z:Math.pow(2,e.canonical.z);return[e.canonical.x/r,e.canonical.y/r,1/r/8192,1/r/8192]}};m();m();var Ia=class t{constructor(e,r){this.min=e,this.max=r,this.center=V.scale([],V.add([],this.min,this.max),.5)}quadrant(e){let r=[e%2===0,e<2],n=V.clone(this.min),i=V.clone(this.max);for(let o=0;o<r.length;o++)n[o]=r[o]?this.min[o]:this.center[o],i[o]=r[o]?this.center[o]:this.max[o];return i[2]=this.max[2],new t(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 r=!0;for(let n=0;n<e.planes.length;n++){let i=this.intersectsPlane(e.planes[n]);if(i===0)return 0;i===1&&(r=!1)}return r?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 r=e[3],n=e[3];for(let i=0;i<3;i++)e[i]>0?(r+=e[i]*this.min[i],n+=e[i]*this.max[i]):(n+=e[i]*this.min[i],r+=e[i]*this.max[i]);return r>=0?2:n<0?0:1}};var wh=class{distanceToTile2d(e,r,n,i){let o=i.distanceX([e,r]),a=i.distanceY([e,r]);return Math.hypot(o,a)}getWrap(e,r,n){return n}getTileBoundingVolume(e,r,n,i){var l,u;let o=0,a=0;if(i!=null&&i.terrain){let c=new We(e.z,r,e.z,e.x,e.y),p=i.terrain.getMinMaxElevation(c);o=(l=p.minElevation)!=null?l:Math.min(0,n),a=(u=p.maxElevation)!=null?u:Math.max(0,n)}let s=1<<e.z;return new Ia([r+e.x/s,e.y/s,o],[r+(e.x+1)/s,(e.y+1)/s,a])}allowVariableZoom(e,r){let n=e.fov*(Math.abs(Math.cos(e.rollInRadians))*e.height+Math.abs(Math.sin(e.rollInRadians))*e.width)/e.height,i=ce(78.5-n/2,0,60);return!!r.terrain||e.pitch>i}allowWorldCopies(){return!0}prepareNextFrame(){}};m();var Aa=class t{constructor(e,r,n){this.points=e;this.planes=r;this.aabb=n}static fromInvProjectionMatrix(e,r=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]],l=Math.pow(2,n),u=a.map(f=>zO(f,e,r,l));i&&VO(u,s[0],i,o);let c=s.map(f=>{let d=V.sub([],u[f[0]],u[f[1]]),g=V.sub([],u[f[2]],u[f[1]]),x=V.normalize([],V.cross([],d,g)),b=-V.dot(x,u[f[1]]);return x.concat(b)}),p=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY],h=[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];for(let f of u)for(let d=0;d<3;d++)p[d]=Math.min(p[d],f[d]),h[d]=Math.max(h[d],f[d]);return new t(u,c,new Ia(p,h))}};function zO(t,e,r,n){let i=Ne.transformMat4([],t,e),o=1/i[3]/r*n;return Ne.mul(i,i,[o,o,1/i[3],o])}function VO(t,e,r,n){let i=n?4:0,o=n?0:4,a=0,s=[],l=[];for(let p=0;p<4;p++){let h=V.sub([],t[p+o],t[p+i]),f=V.length(h);V.scale(h,h,1/f),s.push(f),l.push(h)}for(let p=0;p<4;p++){let h=Bb(t[p+i],l[p],r);h!==null&&h>=0?a=Math.max(a,h):a=Math.max(a,s[p])}let u=UO(t,e),c=NO(r,u);if(c!==null){let p=c/V.dot(l[0],u);a=Math.min(a,p)}for(let p=0;p<4;p++){let h=Math.min(a,s[p]),f=[t[p+i][0]+l[p][0]*h,t[p+i][1]+l[p][1]*h,t[p+i][2]+l[p][2]*h,1];t[p+o]=f}}function UO(t,e){let r=V.sub([],t[e[0]],t[e[1]]),n=V.sub([],t[e[2]],t[e[1]]),i=[0,0,0,0];return V.normalize(i,V.cross([],r,n)),i[3]=-V.dot(i,t[e[0]]),i}function NO(t,e){let r=V.len(t),n=Ne.scale([],t,1/r),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]),l=V.add([],s,V.scale([],i,a/o));return is(e,l)}else return null}var Bn=class t{constructor(e,r,n,i,o){this._posMatrixCache=new Map;this._alignedPosMatrixCache=new Map;this._fogMatrixCacheF32=new Map;this._helper=new Ti({calcMatrices:()=>{this._calcMatrices()},getConstrained:(a,s)=>this.getConstrained(a,s)},e,r,n,i,o),this._coveringTilesDetailsProvider=new wh}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,r,n){return this._helper.interpolatePadding(e,r,n)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,r,n=!0){this._helper.resize(e,r,n)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}overrideNearFarZ(e,r){this._helper.overrideNearFarZ(e,r)}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,r){}clone(){let e=new t;return e.apply(this),e}apply(e,r,n){this._helper.apply(e,r,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 r=[new xi(0,e)];if(this._helper._renderWorldCopies){let n=this.screenPointToMercatorCoordinate(new lr.default(0,0)),i=this.screenPointToMercatorCoordinate(new lr.default(this._helper._width,0)),o=this.screenPointToMercatorCoordinate(new lr.default(this._helper._width,this._helper._height)),a=this.screenPointToMercatorCoordinate(new lr.default(0,this._helper._height)),s=Math.floor(Math.min(n.x,i.x,o.x,a.x)),l=Math.floor(Math.max(n.x,i.x,o.x,a.x)),u=1;for(let c=s-u;c<=l+u;c++)c!==0&&r.push(new xi(c,e))}return r}getCameraFrustum(){return Aa.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(e){let r=this.screenPointToLocation(this.centerPoint,e),n=e?e.getElevationForLngLatZoom(r,this._helper._tileZoom):0;this._helper.recalculateZoomAndCenter(n)}setLocationAtPoint(e,r){let n=gn(this.elevation,this.center.lat),i=this.screenPointToMercatorCoordinateAtZ(r,n),o=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,n),a=xe.fromLngLat(e),s=new xe(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,r){return r?this.coordinatePoint(xe.fromLngLat(e),r.getElevationForLngLatZoom(e,this._helper._tileZoom),this._pixelMatrix3D):this.coordinatePoint(xe.fromLngLat(e))}screenPointToLocation(e,r){var n;return(n=this.screenPointToMercatorCoordinate(e,r))==null?void 0:n.toLngLat()}screenPointToMercatorCoordinate(e,r){if(r){let n=r.pointCoordinate(e);if(n!=null)return n}return this.screenPointToMercatorCoordinateAtZ(e)}screenPointToMercatorCoordinateAtZ(e,r){let n=r||0,i=[e.x,e.y,0,1],o=[e.x,e.y,1,1];Ne.transformMat4(i,i,this._pixelMatrixInverse),Ne.transformMat4(o,o,this._pixelMatrixInverse);let a=i[3],s=o[3],l=i[0]/a,u=o[0]/s,c=i[1]/a,p=o[1]/s,h=i[2]/a,f=o[2]/s,d=h===f?0:(n-h)/(f-h);return new xe(Fe.number(l,u,d)/this.worldSize,Fe.number(c,p,d)/this.worldSize,n)}coordinatePoint(e,r=0,n=this._pixelMatrix){let i=[e.x*this.worldSize,e.y*this.worldSize,r,1];return Ne.transformMat4(i,i,n),new lr.default(i[0]/i[3],i[1]/i[3])}getBounds(){let e=Math.max(0,this._helper._height/2-wa(this));return new yt().extend(this.screenPointToLocation(new lr.default(0,e))).extend(this.screenPointToLocation(new lr.default(this._helper._width,e))).extend(this.screenPointToLocation(new lr.default(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new lr.default(0,this._helper._height)))}isPointOnMapSurface(e,r){return r?r.pointCoordinate(e)!=null:e.y>this.height/2-wa(this)}calculatePosMatrix(e,r=!1,n){var l;let i=(l=e.key)!=null?l:yo(e.wrap,e.canonical.z,e.canonical.z,e.canonical.x,e.canonical.y),o=r?this._alignedPosMatrixCache:this._posMatrixCache;if(o.has(i)){let u=o.get(i);return n?u.f32:u.f64}let a=ch(e,this.worldSize);B.multiply(a,r?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 r=e.key,n=this._fogMatrixCacheF32;if(n.has(r))return n.get(r);let i=ch(e,this.worldSize);return B.multiply(i,this._fogMatrix,i),n.set(r,new Float32Array(i)),n.get(r)}getConstrained(e,r){r=ce(+r,this.minZoom,this.maxZoom);let n={center:new J(e.lng,e.lat),zoom:r},i=this._helper._lngRange;if(!this._helper._renderWorldCopies&&i===null){let P=179.9999999999;i=[-P,P]}let o=this.tileSize*ct(n.zoom),a=0,s=o,l=0,u=o,c=0,p=0,{x:h,y:f}=this.size;if(this._helper._latRange){let P=this._helper._latRange;a=Qr(P[1])*o,s=Qr(P[0])*o,s-a<f&&(c=f/(s-a))}i&&(l=Rr(kn(i[0])*o,0,o),u=Rr(kn(i[1])*o,0,o),u<l&&(u+=o),u-l<h&&(p=h/(u-l)));let{x:d,y:g}=Pr(o,e),x,b,v=Math.max(p||0,c||0);if(v){let P=new lr.default(p?(u+l)/2:d,c?(s+a)/2:g);return n.center=_i(o,P).wrap(),n.zoom+=it(v),n}if(this._helper._latRange){let P=f/2;g-P<a&&(b=a+P),g+P>s&&(b=s-P)}if(i){let P=(l+u)/2,w=d;this._helper._renderWorldCopies&&(w=Rr(d,P-o/2,P+o/2));let T=h/2;w-T<l&&(x=l+T),w+T>u&&(x=u-T)}if(x!==void 0||b!==void 0){let P=new lr.default(x!=null?x:d,b!=null?b:g);n.center=_i(o,P).wrap()}return n}calculateCenterFromCameraLngLatAlt(e,r,n,i){return this._helper.calculateCenterFromCameraLngLatAlt(e,r,n,i)}_calculateNearFarZIfNeeded(e,r,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(r),s=o<0?a:e,l=Math.PI/2+this.pitchInRadians,c=Ve(this.fov)*(Math.abs(Math.cos(Ve(this.roll)))*this.height+Math.abs(Math.sin(Ve(this.roll)))*this.width)/this.height*(.5+n.y/this.height),p=Math.sin(c)*s/Math.sin(ce(Math.PI-l-c,.01,Math.PI-.01)),h=wa(this),f=Math.atan(h/this._helper.cameraToCenterDistance),d=Ve(90-bi),g=f>d?2*f*(.5+n.y/(h*2)):d,x=Math.sin(g)*s/Math.sin(ce(Math.PI-l-g,.01,Math.PI-.01)),b=Math.min(p,x);this._helper._farZ=(Math.cos(Math.PI/2-r)*b+s)*1.01,this._helper._nearZ=this._helper._height/50}_calcMatrices(){if(!this._helper._height)return;let e=this.centerOffset,r=Pr(this.worldSize,this.center),n=r.x,i=r.y;this._helper._pixelPerMeter=gn(1,this.center.lat)*this.worldSize;let o=Ve(Math.min(this.pitch,bi)),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),B.perspective(s,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),B.invert(this._invProjMatrix,s),s[8]=-e.x*2/this._helper._width,s[9]=e.y*2/this._helper._height,this._projectionMatrix=B.clone(s),B.scale(s,s,[1,-1,1]),B.translate(s,s,[0,0,-this._helper.cameraToCenterDistance]),B.rotateZ(s,s,-this.rollInRadians),B.rotateX(s,s,this.pitchInRadians),B.rotateZ(s,s,-this.bearingInRadians),B.translate(s,s,[-n,-i,0]),this._mercatorMatrix=B.scale([],s,[this.worldSize,this.worldSize,this.worldSize]),B.scale(s,s,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=B.multiply(new Float64Array(16),this.clipSpaceToPixelsMatrix,s),B.translate(s,s,[0,0,-this.elevation]),this._viewProjMatrix=s,this._invViewProjMatrix=B.invert([],s);let l=[0,0,-1,1];Ne.transformMat4(l,l,this._invViewProjMatrix),this._cameraPosition=[l[0]/l[3],l[1]/l[3],l[2]/l[3]],this._fogMatrix=new Float64Array(16),B.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,B.scale(this._fogMatrix,this._fogMatrix,[1,-1,1]),B.translate(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),B.rotateZ(this._fogMatrix,this._fogMatrix,-this.rollInRadians),B.rotateX(this._fogMatrix,this._fogMatrix,this.pitchInRadians),B.rotateZ(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),B.translate(this._fogMatrix,this._fogMatrix,[-n,-i,0]),B.scale(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),B.translate(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=B.multiply(new Float64Array(16),this.clipSpaceToPixelsMatrix,s);let u=this._helper._width%2/2,c=this._helper._height%2/2,p=Math.cos(this.bearingInRadians),h=Math.sin(-this.bearingInRadians),f=n-Math.round(n)+p*u+h*c,d=i-Math.round(i)+p*c+h*u,g=new Float64Array(s);if(B.translate(g,g,[f>.5?f-1:f,d>.5?d-1:d,0]),this._alignedProjMatrix=g,s=B.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 lr.default(0,0)),r=[e.x*this.worldSize,e.y*this.worldSize,0,1];return Ne.transformMat4(r,r,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){let e=gn(1,this.center.lat)*this.worldSize,r=this._helper.cameraToCenterDistance/e;return Gl(this.center,this.elevation,this.pitch,this.bearing,r).toLngLat()}lngLatToCameraDepth(e,r){let n=xe.fromLngLat(e),i=[n.x*this.worldSize,n.y*this.worldSize,r,1];return Ne.transformMat4(i,i,this._viewProjMatrix),i[2]/i[3]}getProjectionData(e){let{overscaledTileID:r,aligned:n,applyTerrainMatrix:i}=e,o=this._helper.getMercatorTileCoordinates(r),a=r?this.calculatePosMatrix(r,n,!0):null,s;return r&&r.terrainRttPosMatrix32f&&i?s=r.terrainRttPosMatrix32f:a?s=a:s=sc(),{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,r,n){return 1}transformLightDirection(e){return V.clone(e)}getRayDirectionFromPixel(e){throw new Error("Not implemented.")}projectTileCoordinates(e,r,n,i){let o=this.calculatePosMatrix(n),a;i?(a=[e,r,i(e,r),1],Ne.transformMat4(a,a,o)):(a=[e,r,0,1],Xl(a,a,o));let s=a[3];return{point:new lr.default(a[0]/s,a[1]/s),signedDistanceFromCamera:s,isOccluded:!1}}populateCache(e){for(let r of e)this.calculatePosMatrix(r)}getMatrixForModel(e,r){let n=xe.fromLngLat(e,r),i=n.meterInMercatorCoordinateUnits(),o=Kn();return B.translate(o,o,[n.x,n.y,n.z]),B.rotateZ(o,o,Math.PI),B.rotateX(o,o,Math.PI/2),B.scale(o,o,[-i,i,i]),o}getProjectionDataForCustomLayer(e=!0){let r=new We(0,0,0,0,0),n=this.getProjectionData({overscaledTileID:r,applyGlobeMatrix:e}),i=ch(r,this.worldSize);B.multiply(i,this._viewProjMatrix,i),n.tileMercatorCoords=[0,0,1,1];let o=[8192,8192,this.worldSize/this._helper.pixelsPerMeter],a=Zr();return B.scale(a,i,o),n.fallbackMatrix=a,n.mainMatrix=a,n}getFastPathSimpleProjectionMatrix(e){return this.calculatePosMatrix(e)}};m();m();var Ql=se(fe(),1);function eg(){ve("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function Th(t){if(t.useSlerp)if(t.k<1){let e=od(t.startEulerAngles.roll,t.startEulerAngles.pitch,t.startEulerAngles.bearing),r=od(t.endEulerAngles.roll,t.endEulerAngles.pitch,t.endEulerAngles.bearing),n=new Float64Array(4);$n.slerp(n,e,r,t.k);let i=Wb(n);t.tr.setRoll(i.roll),t.tr.setPitch(i.pitch),t.tr.setBearing(i.bearing)}else t.tr.setRoll(t.endEulerAngles.roll),t.tr.setPitch(t.endEulerAngles.pitch),t.tr.setBearing(t.endEulerAngles.bearing);else t.tr.setRoll(Fe.number(t.startEulerAngles.roll,t.endEulerAngles.roll,t.k)),t.tr.setPitch(Fe.number(t.startEulerAngles.pitch,t.endEulerAngles.pitch,t.k)),t.tr.setBearing(Fe.number(t.startEulerAngles.bearing,t.endEulerAngles.bearing,t.k))}function Sh(t,e,r,n,i){let o=i.padding,a=Pr(i.worldSize,r.getNorthWest()),s=Pr(i.worldSize,r.getNorthEast()),l=Pr(i.worldSize,r.getSouthEast()),u=Pr(i.worldSize,r.getSouthWest()),c=Ve(-n),p=a.rotate(c),h=s.rotate(c),f=l.rotate(c),d=u.rotate(c),g=new Ql.default(Math.max(p.x,h.x,d.x,f.x),Math.max(p.y,h.y,d.y,f.y)),x=new Ql.default(Math.min(p.x,h.x,d.x,f.x),Math.min(p.y,h.y,d.y,f.y)),b=g.sub(x),v=i.width-(o.left+o.right+e.left+e.right),P=i.height-(o.top+o.bottom+e.top+e.bottom),w=v/b.x,T=P/b.y;if(T<0||w<0){eg();return}let S=Math.min(it(i.scale*Math.min(w,T)),t.maxZoom),I=Ql.default.convert(t.offset),M=(e.left-e.right)/2,E=(e.top-e.bottom)/2,k=new Ql.default(M,E).rotate(Ve(n)),z=I.add(k).mult(i.scale/ct(S));return{center:_i(i.worldSize,a.add(l).div(2).sub(z)),zoom:S,bearing:n}}var zn=class{get useGlobeControls(){return!1}handlePanInertia(e,r){return{easingOffset:e,easingCenter:r.center}}handleMapControlsRollPitchBearingZoom(e,r){e.bearingDelta&&r.setBearing(r.bearing+e.bearingDelta),e.pitchDelta&&r.setPitch(r.pitch+e.pitchDelta),e.rollDelta&&r.setRoll(r.roll+e.rollDelta),e.zoomDelta&&r.setZoom(r.zoom+e.zoomDelta)}handleMapControlsPan(e,r,n){e.around.distSqr(r.centerPoint)<.01||r.setLocationAtPoint(n,e.around)}cameraForBoxAndBearing(e,r,n,i,o){return Sh(e,r,n,i,o)}handleJumpToCenterZoom(e,r){let i=typeof r.zoom<"u"?+r.zoom:e.zoom;e.zoom!==i&&e.setZoom(+r.zoom),r.center!==void 0&&e.setCenter(J.convert(r.center))}handleEaseTo(e,r){let n=e.zoom,i=e.padding,o={roll:e.roll,pitch:e.pitch,bearing:e.bearing},a=r.roll===void 0?e.roll:r.roll,s=r.pitch===void 0?e.pitch:r.pitch,l=r.bearing===void 0?e.bearing:r.bearing,u={roll:a,pitch:s,bearing:l},c=typeof r.zoom<"u",p=!e.isPaddingEqual(r.padding),h=!1,f=c?+r.zoom:e.zoom,d=e.centerPoint.add(r.offsetAsPoint),g=e.screenPointToLocation(d),{center:x,zoom:b}=e.getConstrained(J.convert(r.center||g),f!=null?f:n);Ma(e,x);let v=Pr(e.worldSize,g),P=Pr(e.worldSize,x).sub(v),w=ct(b-n);return h=b!==n,{easeFunc:S=>{if(h&&e.setZoom(Fe.number(n,b,S)),pc(o,u)||Th({startEulerAngles:o,endEulerAngles:u,tr:e,k:S,useSlerp:o.roll!=u.roll}),p&&(e.interpolatePadding(i,r.padding,S),d=e.centerPoint.add(r.offsetAsPoint)),r.around)e.setLocationAtPoint(r.around,r.aroundPoint);else{let I=ct(e.zoom-n),M=b>n?Math.min(2,w):Math.max(.5,w),E=Math.pow(M,1-S),L=_i(e.worldSize,v.add(P.mult(S*E)).mult(I));e.setLocationAtPoint(e.renderWorldCopies?L.wrap():L,d)}},isZooming:h,elevationCenter:x}}handleFlyTo(e,r){let n=typeof r.zoom<"u",i=e.zoom,o=e.getConstrained(J.convert(r.center||r.locationAtOffset),n?+r.zoom:i),a=o.center,s=o.zoom;Ma(e,a);let l=Pr(e.worldSize,r.locationAtOffset),u=Pr(e.worldSize,a).sub(l),c=u.mag(),p=ct(s-i),h=typeof r.minZoom<"u",f;if(h){let g=Math.min(+r.minZoom,i,s),x=e.getConstrained(a,g).zoom;f=ct(x-i)}return{easeFunc:(g,x,b,v)=>{e.setZoom(g===1?s:i+it(x));let P=g===1?a:_i(e.worldSize,l.add(u.mult(b)).mult(x));e.setLocationAtPoint(e.renderWorldCopies?P.wrap():P,v)},scaleOfZoom:p,targetCenter:a,scaleOfMinZoom:f,pixelPathLength:c}}};m();m();m();m();var GO=0,Dw=1,jO=771,De=class{constructor(e,r,n){this.blendFunction=e,this.blendColor=r,this.mask=n}};De.Replace=[Dw,GO];De.disabled=new De(De.Replace,K.transparent,[!1,!1,!1,!1]);De.unblended=new De(De.Replace,K.transparent,[!0,!0,!0,!0]);De.alphaBlended=new De([Dw,jO],K.transparent,[!0,!0,!0,!0]);m();var le=class{constructor(e,r,n){this.enable=e,this.mode=r,this.frontFace=n}};le.disabled=new le(!1,1029,2305);le.backCCW=new le(!0,1029,2305);le.frontCCW=new le(!0,1028,2305);m();var ne=class{constructor(e,r,n){this.func=e,this.mask=r,this.range=n}};ne.ReadOnly=!1;ne.ReadWrite=!0;ne.disabled=new ne(519,ne.ReadOnly,[0,1]);m();var pe=class{constructor(e,r,n,i,o,a){this.test=e,this.ref=r,this.mask=n,this.fail=i,this.depthFail=o,this.pass=a}};pe.disabled=new pe({func:519,mask:0},0,0,7680,7680,7680);m();var Rw=(t,e)=>({u_input:new N(t,e.u_input),u_output_expected:new N(t,e.u_output_expected)}),kw=(t,e)=>({u_input:t,u_output_expected:e});m();var tg=new WeakMap;function Tr(t){var e;if(tg.has(t))return tg.get(t);{let r=(e=t.getParameter(t.VERSION))==null?void 0:e.startsWith("WebGL 2.0");return tg.set(t,r),r}}var Ch=class t{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 r=e.context,n=r.gl;this._texFormat=n.RGBA,this._texType=n.UNSIGNED_BYTE;let i=new Dt;i.emplaceBack(-1,-1),i.emplaceBack(2,-1),i.emplaceBack(-1,2);let o=new et;o.emplaceBack(0,1,2),this._fullscreenTriangle=new sr(r.createVertexBuffer(i,wr.members),r.createIndexBuffer(o),de.simpleSegment(0,0,i.length,o.length)),this._resultBuffer=new Uint8Array(4),r.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=r.createFramebuffer(this._texWidth,this._texHeight,!1,!1),this._fbo.colorAttachment.set(a),Tr(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,r){let n=this._updateCount;return this._readbackQueue?n>=this._readbackQueue.frameNumberIssued+this._readbackWaitFrames&&this._tryReadback():n>=this._lastReadbackFrame+this._measureWaitFrames&&this._renderErrorTexture(e,r),this._updateCount++,this._measuredError}_bindFramebuffer(){let e=this._cachedRenderContext.context,r=e.gl;e.activeTexture.set(r.TEXTURE1),r.bindTexture(r.TEXTURE_2D,this._fbo.colorAttachment.get()),e.bindFramebuffer.set(this._fbo.framebuffer)}_renderErrorTexture(e,r){let n=this._cachedRenderContext.context,i=n.gl;if(this._bindFramebuffer(),n.viewport.set([0,0,this._texWidth,this._texHeight]),n.clear({color:K.transparent}),this._cachedRenderContext.useProgram("projectionErrorMeasurement").draw(n,i.TRIANGLES,ne.disabled,pe.disabled,De.unblended,le.disabled,kw(e,r),null,null,"$clipping",this._fullscreenTriangle.vertexBuffer,this._fullscreenTriangle.indexBuffer,this._fullscreenTriangle.segments),this._pbo&&Tr(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&&Tr(e)){let r=e.clientWaitSync(this._readbackQueue.sync,0,0);if(r===e.WAIT_FAILED){ve("WebGL2 clientWaitSync failed."),this._readbackQueue=null,this._lastReadbackFrame=this._updateCount;return}if(r===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=t._parseRGBA8float(this._resultBuffer),this._lastReadbackFrame=this._updateCount}static _parseRGBA8float(e){let r=0;return r+=e[0]/256,r+=e[1]/65536,r+=e[2]/16777216,e[3]<127&&(r=-r),r/128}};m();var Mh=8192/128;function Fw(t,e){let r=Ow(e,"16bit"),n=Dt.deserialize({arrayBuffer:r.vertices,length:r.vertices.byteLength/2/2}),i=et.deserialize({arrayBuffer:r.indices,length:r.indices.byteLength/2/3});return new sr(t.createVertexBuffer(n,wr.members),t.createIndexBuffer(i),de.simpleSegment(0,0,n.length,i.length))}function Ow(t,e){let r=t.granularity!==void 0?Math.max(t.granularity,1):1,n=r+(t.generateBorders?2:0),i=r+(t.extendToNorthPole||t.generateBorders?1:0)+(t.extendToSouthPole||t.generateBorders?1:0),o=n+1,a=i+1,s=t.generateBorders?-1:0,l=t.generateBorders||t.extendToNorthPole?-1:0,u=r+(t.generateBorders?1:0),c=r+(t.generateBorders||t.extendToSouthPole?1:0),p=o*a,h=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(p*2),x=0;for(let P=l;P<=c;P++)for(let w=s;w<=u;w++){let T=w/r*8192;w===-1&&(T=-Mh),w===r+1&&(T=8192+Mh);let S=P/r*8192;P===-1&&(S=t.extendToNorthPole?dn:-Mh),P===r+1&&(S=t.extendToSouthPole?Dn:8192+Mh),g[x++]=T,g[x++]=S}let b=d?new Uint32Array(h):new Uint16Array(h),v=0;for(let P=0;P<i;P++)for(let w=0;w<n;w++){let T=w+P*o,S=w+1+P*o,I=w+(P+1)*o,M=w+1+(P+1)*o;b[v++]=T,b[v++]=I,b[v++]=S,b[v++]=S,b[v++]=I,b[v++]=M}return{vertices:g.buffer.slice(0),indices:b.buffer.slice(0),uses32bitIndices:d}}var HO="#define GLOBE",XO="globe",Bw={errorTransitionTimeSeconds:.5},rg=new di({fill:new _r(128,2),line:new _r(512,0),tile:new _r(128,32),stencil:new _r(128,1),circle:3}),Ea=class{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 XO}get shaderDefine(){return HO}get shaderPreludeCode(){return ar.projectionGlobe}get vertexShaderPreludeCode(){return ar.projectionMercator.vertexSource}get subdivisionGranularity(){return rg}get useGlobeControls(){return!0}get latitudeErrorCorrectionRadians(){return this._errorCorrectionUsable}destroy(){this._errorMeasurement&&this._errorMeasurement.destroy()}updateGPUdependent(e){this._errorMeasurement||(this._errorMeasurement=new Ch(e));let r=Qr(this._errorQueryLatitudeDegrees),n=2*Math.atan(Math.exp(Math.PI-r*Math.PI*2))-Math.PI*.5,i=this._errorMeasurement.updateErrorLoop(r,n),o=ae.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/Bw.errorTransitionTimeSeconds,0),1),l=-this._errorMeasurementLastValue;this._errorCorrectionUsable=Tn(this._errorCorrectionPreviousValue,l,lc(s))}_getMeshKey(e){return"".concat(e.granularity.toString(36),"_").concat(e.generateBorders?"b":"").concat(e.extendToNorthPole?"n":"").concat(e.extendToSouthPole?"s":"")}getMeshFromTileID(e,r,n,i,o){let s=(o==="stencil"?rg.stencil:rg.tile).getGranularityForZoomLevel(r.z),l=r.y===0&&i,u=r.y===(1<<r.z)-1&&i;return this._getMesh(e,{granularity:s,generateBorders:n,extendToNorthPole:l,extendToSouthPole:u})}_getMesh(e,r){let n=this._getMeshKey(r);if(n in this._tileMeshCache)return this._tileMeshCache[n];let i=Fw(e,r);return this._tileMeshCache[n]=i,i}recalculate(e){}hasTransition(){let e=ae.now(),r=!1;return r=r||(e-this._errorMeasurementLastChangeTime)/1e3<Bw.errorTransitionTimeSeconds+.2,r=r||this._errorMeasurement&&this._errorMeasurement.awaitingQuery,r}setErrorQueryLatitudeDegrees(e){this._errorQueryLatitudeDegrees=e}};var ZO=new Ue({type:new q(D.projection.type)}),eu=class extends Ee{constructor(e){super(),this._transitionable=new fn(ZO),this.setProjection(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new Te(0)),this._mercatorProjection=new _o,this._verticalPerspectiveProjection=new Ea}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 un){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,r,n,i,o){return this.currentProjection.getMeshFromTileID(e,r,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)}};m();m();var tn=se(fe(),1);m();function zw(t){let e=vo(t.worldSize,t.center.lat);return 2*Math.PI*e}function Vw(t,e,r){let n=Lt(e),i=Lt(r),o=V.dot(n,i),a=Math.acos(o),s=zw(t);return a/(2*Math.PI)*s}function Uw(t,e){let r=ji(t*Math.PI*2+Math.PI,Math.PI*2),n=2*Math.atan(Math.exp(Math.PI-e*Math.PI*2))-Math.PI*.5;return[r,n]}function qO(t,e){let r=Math.cos(e),n=new Float64Array(3);return n[0]=Math.sin(t)*r,n[1]=Math.sin(e),n[2]=Math.cos(t)*r,n}function xn(t,e,r,n,i){let o=1/(1<<i),a=t/8192*o+r*o,s=e/8192*o+n*o,l=ji(a*Math.PI*2+Math.PI,Math.PI*2),u=2*Math.atan(Math.exp(Math.PI-s*Math.PI*2))-Math.PI*.5,c=Math.cos(u),p=new Float64Array(3);return p[0]=Math.sin(l)*c,p[1]=Math.sin(u),p[2]=Math.cos(l)*c,p}function Lt(t){return qO(t.lng*Math.PI/180,t.lat*Math.PI/180)}function vo(t,e){return t/(2*Math.PI)/Math.cos(e*Math.PI/180)}function ig(t){let r=Math.asin(t[1])/Math.PI*180,n=Math.sqrt(t[0]*t[0]+t[2]*t[2]);if(n>1e-6){let i=t[0]/n,o=t[2]/n,a=Math.acos(o),l=(i>0?a:-a)/Math.PI*180;return new J(Rr(l,-180,180),r)}else return new J(0,r)}function Nw(t){let e=nt();e[0]=t[0]*-t[3],e[1]=t[1]*-t[3],e[2]=t[2]*-t[3];let r=Math.sqrt(1-t[3]*t[3]);return{center:e,radius:r}}function Gw(t,e,r){let n=nt();V.sub(n,r,t);let i=nt();return V.scaleAndAdd(i,t,n,e/V.len(n)),i}function Ih(t){return Math.cos(t*Math.PI/180)}function bt(t,e){let r=Ih(t),n=Ih(e);return it(n/r)}function YO(t,e){return 360/zw({worldSize:t,center:{lat:e}})}function og(t,e){let r=t.rotate(e.bearingInRadians),n=e.zoom+bt(e.center.lat,0),i=Tn(1/Ih(e.center.lat),1/Ih(Math.min(Math.abs(e.center.lat),60)),zo(n,7,3,0,1)),o=YO(e.worldSize,e.center.lat);return new J(e.center.lng-r.x*o*i,ce(e.center.lat+r.y*o,-Gt,Gt))}function ng(t){let e=.5*t,r=Math.sin(e),n=Math.cos(e);return Math.log(r+n)-Math.log(n-r)}function ag(t,e,r,n){let i=t.lat+r*n;if(Math.abs(r)>1){let o=t.lat+r,s=(Math.sign(o)!==Math.sign(t.lat)?-Math.abs(t.lat):Math.abs(t.lat))*Math.PI/180,l=Math.abs(t.lat+r)*Math.PI/180,u=ng(s+n*(l-s)),c=ng(s),p=ng(l),h=(u-c)/(p-c),f=t.lng+e*h;return new J(f,i)}else{let o=t.lng+e*n;return new J(o,i)}}m();m();var Ah=class{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,r,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 l=this._boundingVolumeFactory(e,r,n,i);return this._cache.set(o,l),this._hadAnyChanges=!0,l}};m();var La=class t{constructor(e,r,n,i){this.min=n,this.max=i,this.points=e,this.planes=r}static fromAabb(e,r){let n=[];for(let i=0;i<8;i++)n.push([(i>>0&1)===1?r[0]:e[0],(i>>1&1)===1?r[1]:e[1],(i>>2&1)===1?r[2]:e[2]]);return new t(n,[[-1,0,0,r[0]],[1,0,0,-e[0]],[0,-1,0,r[1]],[0,1,0,-e[1]],[0,0,-1,r[2]],[0,0,1,-e[2]]],e,r)}static fromCenterSizeAngles(e,r,n){let i=$n.fromEuler([],n[0],n[1],n[2]),o=V.transformQuat([],[r[0],0,0],i),a=V.transformQuat([],[0,r[1],0],i),s=V.transformQuat([],[0,0,r[2]],i),l=[...e],u=[...e];for(let p=0;p<8;p++)for(let h=0;h<3;h++){let f=e[h]+o[h]*((p>>0&1)===1?1:-1)+a[h]*((p>>1&1)===1?1:-1)+s[h]*((p>>2&1)===1?1:-1);l[h]=Math.min(l[h],f),u[h]=Math.max(u[h],f)}let c=[];for(let p=0;p<8;p++){let h=[...e];V.add(h,h,V.scale([],o,(p>>0&1)===1?1:-1)),V.add(h,h,V.scale([],a,(p>>1&1)===1?1:-1)),V.add(h,h,V.scale([],s,(p>>2&1)===1?1:-1)),c.push(h)}return new t(c,[[...o,-V.dot(o,c[0])],[...a,-V.dot(a,c[0])],[...s,-V.dot(s,c[0])],[-o[0],-o[1],-o[2],-V.dot(o,c[7])],[-a[0],-a[1],-a[2],-V.dot(a,c[7])],[-s[0],-s[1],-s[2],-V.dot(s,c[7])]],l,u)}intersectsFrustum(e){let r=!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 l=e.planes[s],u=0;for(let c=0;c<n;c++){let p=this.points[c];l[0]*p[0]+l[1]*p[1]+l[2]*p[2]+l[3]>=0&&u++}if(u===0)return 0;u<n&&(r=!1)}if(r)return 2;for(let s=0;s<i;s++){let l=this.planes[s],u=0;for(let c=0;c<a;c++){let p=e.points[c];l[0]*p[0]+l[1]*p[1]+l[2]*p[2]+l[3]>=0&&u++}if(u===0)return 0}return 1}intersectsPlane(e){let r=this.points.length,n=0;for(let i=0;i<r;i++){let o=this.points[i];e[0]*o[0]+e[1]*o[1]+e[2]*o[2]+e[3]>=0&&n++}return n===r?2:n===0?0:1}};function Eh(t,e,r){let n=t-e;return n<0?-n:Math.max(0,n-r)}function sg(t,e,r,n,i){let o=t-r,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,Eh(e,n,i))}var Lh=class{constructor(){this._boundingVolumeCache=new Ah(this._computeTileBoundingVolume)}prepareNextFrame(){this._boundingVolumeCache.swapBuffers()}distanceToTile2d(e,r,n,i){let o=1<<n.z,a=1/o,s=n.x/o,l=n.y/o,u=1,c=.5*u,p=2*u;return p=Math.min(p,sg(e,r,s,l,a)),p=Math.min(p,sg(e,r,s+c,-l-a,a)),p=Math.min(p,sg(e,r,s+c,u+u-l-a,a)),p}getWrap(e,r,n){let i=1<<r.z,o=1/i,a=r.x/i,s=Eh(e.x,a,o),l=Eh(e.x,a-1,o),u=Eh(e.x,a+1,o),c=Math.min(s,l,u);return c===u?1:c===l?-1:0}allowVariableZoom(e,r){return go(e,r)>4}allowWorldCopies(){return!1}getTileBoundingVolume(e,r,n,i){return this._boundingVolumeCache.getTileBoundingVolume(e,r,n,i)}_computeTileBoundingVolume(e,r,n,i){var s,l;let o=0,a=0;if(i!=null&&i.terrain){let u=new We(e.z,r,e.z,e.x,e.y),c=i.terrain.getMinMaxElevation(u);o=(s=c.minElevation)!=null?s:Math.min(0,n),a=(l=c.maxElevation)!=null?l:Math.max(0,n)}if(o/=or,a/=or,o+=1,a+=1,e.z<=0)return La.fromAabb([-a,-a,-a],[a,a,a]);if(e.z===1)return La.fromAabb([e.x===0?-a:0,e.y===0?0:-a,-a],[e.x===0?0:a,e.y===0?a:0,a]);{let u=[xn(0,0,e.x,e.y,e.z),xn(8192,0,e.x,e.y,e.z),xn(8192,8192,e.x,e.y,e.z),xn(0,8192,e.x,e.y,e.z)],c=[];for(let k of u)c.push(V.scale([],k,a));if(a!==o)for(let k of u)c.push(V.scale([],k,o));e.y===0&&c.push([0,1,0]),e.y===(1<<e.z)-1&&c.push([0,-1,0]);let p=[1,1,1],h=[-1,-1,-1];for(let k of c)for(let F=0;F<3;F++)p[F]=Math.min(p[F],k[F]),h[F]=Math.max(h[F],k[F]);let f=xn(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([],u[2],u[1]);V.normalize(x,x);let b=V.cross([],u[0],u[3]);V.normalize(b,b),c.push(V.scale([],f,a)),e.y>=(1<<e.z)/2&&c.push(V.scale([],xn(8192/2,0,e.x,e.y,e.z),a)),e.y<(1<<e.z)/2&&c.push(V.scale([],xn(8192/2,8192,e.x,e.y,e.z),a));let v=jw(f,c),P=jw(g,c),w=[-f[0],-f[1],-f[2],v.max],T=[f[0],f[1],f[2],-v.min],S=[-g[0],-g[1],-g[2],P.max],I=[g[0],g[1],g[2],-P.min],M=[...x,0],E=[...b,0],L=[];return e.y===0?L.push(dr(E,M,w),dr(E,M,T)):L.push(dr(S,M,w),dr(S,M,T),dr(S,E,w),dr(S,E,T)),e.y===(1<<e.z)-1?L.push(dr(E,M,w),dr(E,M,T)):L.push(dr(I,M,w),dr(I,M,T),dr(I,E,w),dr(I,E,T)),new La(L,[w,T,S,I,M,E],p,h)}}};function jw(t,e){let r=1/0,n=-1/0;for(let i of e){let o=V.dot(t,i);r=Math.min(r,o),n=Math.max(n,o)}return{min:r,max:n}}var Da=class t{constructor(){this._cachedClippingPlane=Bo();this._projectionMatrix=Kn();this._globeViewProjMatrix32f=sc();this._globeViewProjMatrixNoCorrection=Kn();this._globeViewProjMatrixNoCorrectionInverted=Kn();this._globeProjMatrixInverted=Kn();this._cameraPosition=nt();this._globeLatitudeErrorCorrectionRadians=0;this._helper=new Ti({calcMatrices:()=>{this._calcMatrices()},getConstrained:(e,r)=>this.getConstrained(e,r)}),this._coveringTilesDetailsProvider=new Lh}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,r,n){return this._helper.interpolatePadding(e,r,n)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,r){this._helper.resize(e,r)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}overrideNearFarZ(e,r){this._helper.overrideNearFarZ(e,r)}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 t;return e.apply(this),e}apply(e,r){this._globeLatitudeErrorCorrectionRadians=r||0,this._helper.apply(e)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixNoCorrection}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){let e=nt();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:r,applyGlobeMatrix:n}=e,i=this._helper.getMercatorTileCoordinates(r);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:i,clippingPlane:this._cachedClippingPlane,projectionTransition:n?1:0,fallbackMatrix:this._globeViewProjMatrix32f}}_computeClippingPlane(e){let r=this.pitchInRadians,n=this.cameraToCenterDistance/e,i=1,o=Math.sin(r)*n,a=Math.cos(r)*n+i,s=Math.sqrt(o*o+a*a),u=i/s*i,c=-o,p=a,h=Math.sqrt(c*c+p*p);c/=h,p/=h;let f=[0,c,p];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,-u*d]}isLocationOccluded(e){return!this.isSurfacePointVisible(Lt(e))}transformLightDirection(e){let r=this._helper._center.lng*Math.PI/180,n=this._helper._center.lat*Math.PI/180,i=Math.cos(n),o=[Math.sin(r)*i,Math.sin(n),Math.cos(r)*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 l=[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]],u=[0,0,0];return V.normalize(u,l),u}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,r,n){let i=q1(e,r,n.canonical),o=Uw(i.x,i.y);return this.getCircleRadiusCorrection()/Math.cos(o[1])}projectTileCoordinates(e,r,n,i){let o=n.canonical,a=xn(e,r,o.x,o.y,o.z),l=1+(i?i(e,r):0)/or,u=[a[0]*l,a[1]*l,a[2]*l,1];Ne.transformMat4(u,u,this._globeViewProjMatrixNoCorrection);let c=this._cachedClippingPlane,h=c[0]*a[0]+c[1]*a[1]+c[2]*a[2]+c[3]<0;return{point:new tn.default(u[0]/u[3],u[1]/u[3]),signedDistanceFromCamera:u[3],isOccluded:h}}_calcMatrices(){if(!this._helper._width||!this._helper._height)return;let e=vo(this.worldSize,this.center.lat),r=Zr(),n=Zr();this._helper.autoCalculateNearFarZ&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+e*2),B.perspective(r,this.fovInRadians,this.width/this.height,this._helper._nearZ,this._helper._farZ);let i=this.centerOffset;r[8]=-i.x*2/this._helper._width,r[9]=i.y*2/this._helper._height,this._projectionMatrix=B.clone(r),this._globeProjMatrixInverted=Zr(),B.invert(this._globeProjMatrixInverted,r),B.translate(r,r,[0,0,-this.cameraToCenterDistance]),B.rotateZ(r,r,this.rollInRadians),B.rotateX(r,r,-this.pitchInRadians),B.rotateZ(r,r,this.bearingInRadians),B.translate(r,r,[0,0,-e]);let o=nt();o[0]=e,o[1]=e,o[2]=e,B.rotateX(n,r,this.center.lat*Math.PI/180),B.rotateY(n,n,-this.center.lng*Math.PI/180),B.scale(n,n,o),this._globeViewProjMatrixNoCorrection=n,B.rotateX(r,r,this.center.lat*Math.PI/180-this._globeLatitudeErrorCorrectionRadians),B.rotateY(r,r,-this.center.lng*Math.PI/180),B.scale(r,r,o),this._globeViewProjMatrix32f=new Float32Array(r),this._globeViewProjMatrixNoCorrectionInverted=Zr(),B.invert(this._globeViewProjMatrixNoCorrectionInverted,n);let a=nt();this._cameraPosition=nt(),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=B.clone(this._globeViewProjMatrixNoCorrectionInverted);B.scale(s,s,[1,1,-1]),this._cachedFrustum=Aa.fromInvProjectionMatrix(s,1,0,this._cachedClippingPlane,!0)}calculateFogMatrix(e){ve("calculateFogMatrix is not supported on globe projection.");let r=Zr();return B.identity(r),r}getVisibleUnwrappedCoordinates(e){return[new xi(0,e)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(e){e&&ve("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,r){if(!this._globeViewProjMatrixNoCorrection)return 1;let n=Lt(e);V.scale(n,n,1+r/or);let i=Bo();return Ne.transformMat4(i,[n[0],n[1],n[2],1],this._globeViewProjMatrixNoCorrection),i[2]/i[3]}populateCache(e){}getBounds(){let e=this.width*.5,r=this.height*.5,n=[new tn.default(0,0),new tn.default(e,0),new tn.default(this.width,0),new tn.default(this.width,r),new tn.default(this.width,this.height),new tn.default(e,this.height),new tn.default(0,this.height),new tn.default(0,r)],i=[];for(let p of n)i.push(this.unprojectScreenPoint(p));let o=0,a=0,s=0,l=0,u=this.center;for(let p of i){let h=Nt(u.lng,p.lng),f=Nt(u.lat,p.lat);h<a&&(a=h),h>o&&(o=h),f<l&&(l=f),f>s&&(s=f)}let c=[u.lng+a,u.lat+l,u.lng+o,u.lat+s];return this.isSurfacePointOnScreen([0,1,0])&&(c[3]=90,c[0]=-180,c[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(c[1]=-90,c[0]=-180,c[2]=180),new yt(c)}getConstrained(e,r){let n=ce(e.lat,-Gt,Gt),i=ce(+r,this.minZoom+bt(0,n),this.maxZoom);return{center:new J(e.lng,n),zoom:i}}calculateCenterFromCameraLngLatAlt(e,r,n,i){return this._helper.calculateCenterFromCameraLngLatAlt(e,r,n,i)}setLocationAtPoint(e,r){let n=this.unprojectScreenPoint(r),i=Lt(n),o=Lt(e),a=nt();V.zero(a);let s=nt();V.rotateY(s,i,a,-this.center.lng*Math.PI/180),V.rotateX(s,s,a,this.center.lat*Math.PI/180);let l=o[0]*o[0]+o[2]*o[2],u=s[0]*s[0];if(l<u)return;let c=Math.sqrt(l-u),p=-c,h=os(o[0],o[2],s[0],c),f=os(o[0],o[2],s[0],p),d=nt();V.rotateY(d,o,a,-h);let g=os(d[1],d[2],s[1],s[2]),x=nt();V.rotateY(x,o,a,-f);let b=os(x[1],x[2],s[1],s[2]),v=Math.PI*.5,P=g>=-v&&g<=v,w=b>=-v&&b<=v,T,S;if(P&&w){let L=this.center.lng*Math.PI/180,k=this.center.lat*Math.PI/180,F=as(h,L),z=as(g,k),A=as(f,L),R=as(b,k);F+z<A+R?(T=h,S=g):(T=f,S=b)}else if(P)T=h,S=g;else if(w)T=f,S=b;else return;let I=T/Math.PI*180,M=S/Math.PI*180,E=this.center.lat;this.setCenter(new J(I,ce(M,-90,90))),this.setZoom(this.zoom+bt(E,this.center.lat))}locationToScreenPoint(e,r){let n=Lt(e);if(r){let i=r.getElevationForLngLatZoom(e,this._helper._tileZoom);V.scale(n,n,1+i/or)}return this._projectSurfacePointToScreen(n)}_projectSurfacePointToScreen(e){let r=Bo();return Ne.transformMat4(r,[...e,1],this._globeViewProjMatrixNoCorrection),r[0]/=r[3],r[1]/=r[3],new tn.default((r[0]*.5+.5)*this.width,(-r[1]*.5+.5)*this.height)}screenPointToMercatorCoordinate(e,r){if(r){let n=r.pointCoordinate(e);if(n)return n}return xe.fromLngLat(this.unprojectScreenPoint(e))}screenPointToLocation(e,r){var n;return(n=this.screenPointToMercatorCoordinate(e,r))==null?void 0:n.toLngLat()}isPointOnMapSurface(e,r){let n=this._cameraPosition,i=this.getRayDirectionFromPixel(e);return!!this.rayPlanetIntersection(n,i)}getRayDirectionFromPixel(e){let r=Bo();r[0]=e.x/this.width*2-1,r[1]=(e.y/this.height*2-1)*-1,r[2]=1,r[3]=1,Ne.transformMat4(r,r,this._globeViewProjMatrixNoCorrectionInverted),r[0]/=r[3],r[1]/=r[3],r[2]/=r[3];let n=nt();n[0]=r[0]-this._cameraPosition[0],n[1]=r[1]-this._cameraPosition[1],n[2]=r[2]-this._cameraPosition[2];let i=nt();return V.normalize(i,n),i}isSurfacePointVisible(e){let r=this._cachedClippingPlane;return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]+r[3]>=0}isSurfacePointOnScreen(e){if(!this.isSurfacePointVisible(e))return!1;let r=Bo();return Ne.transformMat4(r,[...e,1],this._globeViewProjMatrixNoCorrection),r[0]/=r[3],r[1]/=r[3],r[2]/=r[3],r[0]>-1&&r[0]<1&&r[1]>-1&&r[1]<1&&r[2]>-1&&r[2]<1}rayPlanetIntersection(e,r){let n=V.dot(e,r),i=1,o=nt(),a=nt();V.scale(a,r,n),V.sub(o,e,a);let s=i-V.dot(o,o);if(s<0)return null;let l=V.dot(e,e)-i,u=-n+(n<0?1:-1)*Math.sqrt(s),c=l/u,p=u,h=Math.min(c,p),f=Math.max(c,p);return{tMin:h,tMax:f}}unprojectScreenPoint(e){let r=this._cameraPosition,n=this.getRayDirectionFromPixel(e),i=this.rayPlanetIntersection(r,n);if(i){let f=nt();V.add(f,r,[n[0]*i.tMin,n[1]*i.tMin,n[2]*i.tMin]);let d=nt();return V.normalize(d,f),ig(d)}let o=this._cachedClippingPlane,a=o[0]*n[0]+o[1]*n[1]+o[2]*n[2],l=-is(o,r)/a,u=2,c=nt();if(l>0)V.add(c,r,[n[0]*l,n[1]*l,n[2]*l]);else{let f=nt();V.add(f,r,[n[0]*u,n[1]*u,n[2]*u]);let d=is(this._cachedClippingPlane,f);V.sub(c,f,[this._cachedClippingPlane[0]*d,this._cachedClippingPlane[1]*d,this._cachedClippingPlane[2]*d])}let p=Nw(o),h=Gw(p.center,p.radius,c);return ig(h)}getMatrixForModel(e,r){let n=J.convert(e),i=1/or,o=Kn();return B.rotateY(o,o,n.lng/180*Math.PI),B.rotateX(o,o,-n.lat/180*Math.PI),B.translate(o,o,[0,0,1+r/or]),B.rotateX(o,o,Math.PI*.5),B.scale(o,o,[i,i,i]),o}getProjectionDataForCustomLayer(e=!0){let r=this.getProjectionData({overscaledTileID:new We(0,0,0,0,0),applyGlobeMatrix:e});return r.tileMercatorCoords=[0,0,1,1],r}getFastPathSimpleProjectionMatrix(e){}};var tu=class t{constructor(){this._globeLatitudeErrorCorrectionRadians=0;this._globeness=1;this._helper=new Ti({calcMatrices:()=>{this._calcMatrices()},getConstrained:(e,r)=>this.getConstrained(e,r)}),this._globeness=1,this._mercatorTransform=new Bn,this._verticalPerspectiveTransform=new Da}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,r,n){return this._helper.interpolatePadding(e,r,n)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,r,n=!0){this._helper.resize(e,r,n)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}overrideNearFarZ(e,r){this._helper.overrideNearFarZ(e,r)}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,r){this._globeness=e,this._globeLatitudeErrorCorrectionRadians=r,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().prepareNextFrame(),this._mercatorTransform.getCoveringTilesDetailsProvider().prepareNextFrame()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}clone(){let e=new t;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 r=this._mercatorTransform.getProjectionData(e),n=this._verticalPerspectiveTransform.getProjectionData(e);return{mainMatrix:this.isGlobeRendering?n.mainMatrix:r.mainMatrix,clippingPlane:n.clippingPlane,tileMercatorCoords:n.tileMercatorCoords,projectionTransition:e.applyGlobeMatrix?this._globeness:0,fallbackMatrix:r.fallbackMatrix}}isLocationOccluded(e){return this.currentTransform.isLocationOccluded(e)}transformLightDirection(e){return this.currentTransform.transformLightDirection(e)}getPixelScale(){return Tn(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return Tn(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(e,r,n){let i=this._mercatorTransform.getPitchedTextCorrection(e,r,n),o=this._verticalPerspectiveTransform.getPitchedTextCorrection(e,r,n);return Tn(i,o,this._globeness)}projectTileCoordinates(e,r,n,i){return this.currentTransform.projectTileCoordinates(e,r,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,r){return this.currentTransform.lngLatToCameraDepth(e,r)}populateCache(e){this._mercatorTransform.populateCache(e),this._verticalPerspectiveTransform.populateCache(e)}getBounds(){return this.currentTransform.getBounds()}getConstrained(e,r){return this.currentTransform.getConstrained(e,r)}calculateCenterFromCameraLngLatAlt(e,r,n,i){return this._helper.calculateCenterFromCameraLngLatAlt(e,r,n,i)}setLocationAtPoint(e,r){if(!this.isGlobeRendering){this._mercatorTransform.setLocationAtPoint(e,r),this.apply(this._mercatorTransform);return}this._verticalPerspectiveTransform.setLocationAtPoint(e,r),this.apply(this._verticalPerspectiveTransform)}locationToScreenPoint(e,r){return this.currentTransform.locationToScreenPoint(e,r)}screenPointToMercatorCoordinate(e,r){return this.currentTransform.screenPointToMercatorCoordinate(e,r)}screenPointToLocation(e,r){return this.currentTransform.screenPointToLocation(e,r)}isPointOnMapSurface(e,r){return this.currentTransform.isPointOnMapSurface(e,r)}getRayDirectionFromPixel(e){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(e)}getMatrixForModel(e,r){return this.currentTransform.getMatrixForModel(e,r)}getProjectionDataForCustomLayer(e=!0){let r=this._mercatorTransform.getProjectionDataForCustomLayer(e);if(!this.isGlobeRendering)return r;let n=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(e);return n.fallbackMatrix=r.mainMatrix,n}getFastPathSimpleProjectionMatrix(e){return this.currentTransform.getFastPathSimpleProjectionMatrix(e)}};m();m();var Dh=se(fe(),1);var Ra=class t{get useGlobeControls(){return!0}handlePanInertia(e,r){let n=og(e,r);return Math.abs(n.lng-r.center.lng)>180&&(n.lng=r.center.lng+179.5*Math.sign(n.lng-r.center.lng)),{easingCenter:n,easingOffset:new Dh.default(0,0)}}handleMapControlsRollPitchBearingZoom(e,r){let n=e.around,i=r.screenPointToLocation(n);e.bearingDelta&&r.setBearing(r.bearing+e.bearingDelta),e.pitchDelta&&r.setPitch(r.pitch+e.pitchDelta),e.rollDelta&&r.setRoll(r.roll+e.rollDelta);let o=r.zoom;e.zoomDelta&&r.setZoom(r.zoom+e.zoomDelta);let a=r.zoom-o;if(a===0)return;let s=.3,l=.5,u=45,c=85,p=.25,h=.75,f=.35,d=.9,g=.5,x=.25,b=Nt(r.center.lng,i.lng),v=b/(Math.abs(b/180)+1),P=Nt(r.center.lat,i.lat),w=r.getRayDirectionFromPixel(n),T=r.cameraPosition,S=V.dot(T,w)*-1,I=nt();V.add(I,T,[w[0]*S,w[1]*S,w[2]*S]);let M=V.length(I)-1,E=Math.exp(-Math.max(M-s,0)*l),L=vo(r.worldSize,r.center.lat)/Math.min(r.width,r.height),k=zo(L,d,g,1,x),F=(1-ct(-a))*Math.min(E,k),z=r.center.lat,A=r.zoom,R=new J(r.center.lng+v*F,ce(r.center.lat+P*F,-Gt,Gt));r.setLocationAtPoint(i,n);let H=r.center,W=zo(Math.abs(b),u,c,0,1),$=zo(L,h,f,0,1),he=Math.pow(Math.max(W,$),p),Xe=Nt(H.lng,R.lng),be=Nt(H.lat,R.lat);r.setCenter(new J(H.lng+Xe*he,H.lat+be*he).wrap()),r.setZoom(A+bt(z,r.center.lat))}handleMapControlsPan(e,r,n){if(!e.panDelta)return;let i=r.center.lat,o=r.zoom;r.setCenter(og(e.panDelta,r).wrap()),r.setZoom(o+bt(i,r.center.lat))}cameraForBoxAndBearing(e,r,n,i,o){let a=Sh(e,r,n,i,o),s=r.left/o.width*2-1,l=(o.width-r.right)/o.width*2-1,u=r.top/o.height*-2+1,c=(o.height-r.bottom)/o.height*-2+1,p=Nt(n.getWest(),n.getEast())<0,h=p?n.getEast():n.getWest(),f=p?n.getWest():n.getEast(),d=Math.max(n.getNorth(),n.getSouth()),g=Math.min(n.getNorth(),n.getSouth()),x=h+Nt(h,f)*.5,b=d+Nt(d,g)*.5,v=o.clone();v.setCenter(a.center),v.setBearing(a.bearing),v.setPitch(0),v.setRoll(0),v.setZoom(a.zoom);let P=v.modelViewProjectionMatrix,w=[Lt(n.getNorthWest()),Lt(n.getNorthEast()),Lt(n.getSouthWest()),Lt(n.getSouthEast()),Lt(new J(f,b)),Lt(new J(h,b)),Lt(new J(x,d)),Lt(new J(x,g))],T=Lt(a.center),S=Number.POSITIVE_INFINITY;for(let I of w)s<0&&(S=t.getLesserNonNegativeNonNull(S,t.solveVectorScale(I,T,P,"x",s))),l>0&&(S=t.getLesserNonNegativeNonNull(S,t.solveVectorScale(I,T,P,"x",l))),u>0&&(S=t.getLesserNonNegativeNonNull(S,t.solveVectorScale(I,T,P,"y",u))),c<0&&(S=t.getLesserNonNegativeNonNull(S,t.solveVectorScale(I,T,P,"y",c)));if(!Number.isFinite(S)||S===0){eg();return}return a.zoom=v.zoom+it(S),a}handleJumpToCenterZoom(e,r){let n=e.center.lat,i=e.getConstrained(r.center?J.convert(r.center):e.center,e.zoom).center;e.setCenter(i.wrap());let o=typeof r.zoom<"u"?+r.zoom:e.zoom+bt(n,i.lat);e.zoom!==o&&e.setZoom(o)}handleEaseTo(e,r){let n=e.zoom,i=e.center,o=e.padding,a={roll:e.roll,pitch:e.pitch,bearing:e.bearing},s=r.roll===void 0?e.roll:r.roll,l=r.pitch===void 0?e.pitch:r.pitch,u=r.bearing===void 0?e.bearing:r.bearing,c={roll:s,pitch:l,bearing:u},p=typeof r.zoom<"u",h=!e.isPaddingEqual(r.padding),f=!1,d=r.center?J.convert(r.center):i,g=e.getConstrained(d,n).center;Ma(e,g);let x=e.clone();x.setCenter(g),x.setZoom(p?+r.zoom:n+bt(i.lat,d.lat)),x.setBearing(r.bearing);let b=new Dh.default(ce(e.centerPoint.x+r.offsetAsPoint.x,0,e.width),ce(e.centerPoint.y+r.offsetAsPoint.y,0,e.height));x.setLocationAtPoint(g,b);let v=(r.offset&&r.offsetAsPoint.mag())>0?x.center:g,P=p?+r.zoom:n+bt(i.lat,v.lat),w=n+bt(i.lat,0),T=P+bt(v.lat,0),S=Nt(i.lng,v.lng),I=Nt(i.lat,v.lat),M=ct(T-w);return f=P!==n,{easeFunc:L=>{if(pc(a,c)||Th({startEulerAngles:a,endEulerAngles:c,tr:e,k:L,useSlerp:a.roll!=c.roll}),h&&e.interpolatePadding(o,r.padding,L),r.around)ve("Easing around a point is not supported under globe projection."),e.setLocationAtPoint(r.around,r.aroundPoint);else{let k=T>w?Math.min(2,M):Math.max(.5,M),F=Math.pow(k,1-L),z=L*F,A=ag(i,S,I,z);e.setCenter(A.wrap())}if(f){let F=Fe.number(w,T,L)+bt(0,e.center.lat);e.setZoom(F)}},isZooming:f,elevationCenter:v}}handleFlyTo(e,r){let n=typeof r.zoom<"u",i=e.center,o=e.zoom,a=e.padding,s=!e.isPaddingEqual(r.padding),l=e.getConstrained(J.convert(r.center||r.locationAtOffset),o).center,u=n?+r.zoom:e.zoom+bt(e.center.lat,l.lat),c=e.clone();c.setCenter(l),c.setZoom(u),c.setBearing(r.bearing);let p=new Dh.default(ce(e.centerPoint.x+r.offsetAsPoint.x,0,e.width),ce(e.centerPoint.y+r.offsetAsPoint.y,0,e.height));c.setLocationAtPoint(l,p);let h=c.center;Ma(e,h);let f=Vw(e,i,h),d=o+bt(i.lat,0),g=u+bt(h.lat,0),x=ct(g-d),b=typeof r.minZoom=="number",v;if(b){let S=+r.minZoom+bt(h.lat,0),M=Math.min(S,d,g)+bt(0,h.lat),L=e.getConstrained(h,M).zoom+bt(h.lat,0);v=ct(L-d)}let P=Nt(i.lng,h.lng),w=Nt(i.lat,h.lat);return{easeFunc:(S,I,M,E)=>{let L=ag(i,P,w,M);s&&e.interpolatePadding(a,r.padding,S);let k=S===1?h:L;e.setCenter(k.wrap());let F=d+it(I);e.setZoom(S===1?u:F+bt(0,k.lat))},scaleOfZoom:x,targetCenter:h,scaleOfMinZoom:v,pixelPathLength:f}}static solveVectorScale(e,r,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]],l=[n[3],n[7],n[11],n[15]],u=e[0]*s[0]+e[1]*s[1]+e[2]*s[2],c=e[0]*l[0]+e[1]*l[1]+e[2]*l[2],p=r[0]*s[0]+r[1]*s[1]+r[2]*s[2],h=r[0]*l[0]+r[1]*l[1]+r[2]*l[2],f=(p+s[3]-a*h-a*l[3])/(p-u-a*h+a*c);return p+a*c===u+a*h||l[3]*(u-p)+s[3]*(h-c)+u*h===p*c?null:f}static getLesserNonNegativeNonNull(e,r){return r!==null&&r>=0&&r<e?r:e}};var ru=class{constructor(e){this._globe=e,this._mercatorCameraHelper=new zn,this._verticalPerspectiveCameraHelper=new Ra}get useGlobeControls(){return this._globe.useGlobeRendering}get currentHelper(){return this.useGlobeControls?this._verticalPerspectiveCameraHelper:this._mercatorCameraHelper}handlePanInertia(e,r){return this.currentHelper.handlePanInertia(e,r)}handleMapControlsRollPitchBearingZoom(e,r){return this.currentHelper.handleMapControlsRollPitchBearingZoom(e,r)}handleMapControlsPan(e,r,n){this.currentHelper.handleMapControlsPan(e,r,n)}cameraForBoxAndBearing(e,r,n,i,o){return this.currentHelper.cameraForBoxAndBearing(e,r,n,i,o)}handleJumpToCenterZoom(e,r){this.currentHelper.handleJumpToCenterZoom(e,r)}handleEaseTo(e,r){return this.currentHelper.handleEaseTo(e,r)}handleFlyTo(e,r){return this.currentHelper.handleFlyTo(e,r)}};function Hw(t){if(Array.isArray(t)){let e=new eu({type:t});return{projection:e,transform:new tu,cameraHelper:new ru(e)}}switch(t){case"mercator":return{projection:new _o,transform:new Bn,cameraHelper:new zn};case"globe":{let e=new eu({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]});return{projection:e,transform:new tu,cameraHelper:new ru(e)}}case"vertical-perspective":return{projection:new Ea,transform:new Da,cameraHelper:new Ra};default:return ve("Unknown projection name: ".concat(t,". Falling back to mercator projection.")),{projection:new _o,transform:new Bn,cameraHelper:new zn}}}var Rh=(t,e)=>si(t,e&&e.filter(r=>r.identifier!=="source.canvas")),WO=nv(),ka=class extends Ee{constructor(r,n={}){super();this._rtlPluginLoaded=()=>{for(let r in this.sourceCaches){let n=this.sourceCaches[r].getSource().type;(n==="vector"||n==="geojson")&&this.sourceCaches[r].reload()}};this.map=r,this.dispatcher=new kl(nh(),r._getMapId()),this.dispatcher.registerMessageHandler("GG",(i,o)=>this.getGlyphs(i,o)),this.dispatcher.registerMessageHandler("GI",(i,o)=>this.getImages(i,o)),this.imageManager=new $p,this.imageManager.setEventedParent(this),this.glyphManager=new Kp(r._requestManager,n.localIdeographFontFamily),this.lineAtlas=new eh(256,512),this.crossTileSymbolIndex=new Sa,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new ro,this._loaded=!1,this._availableImages=[],this._globalState={},this._resetUpdates(),this.dispatcher.broadcast("SR",dc()),va().on(Nl,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 l=this._layers[s];l.source===a.id&&this._validateLayer(l)}})}setGlobalStateProperty(r,n){var a,s,l;this._checkLoaded();let i=n===null?(l=(s=(a=this.stylesheet.state)==null?void 0:a[r])==null?void 0:s.default)!=null?l:null:n;if(Dr(i,this._globalState[r]))return this;this._globalState[r]=i;let o=this._findGlobalStateAffectedSources([r]);for(let u in this.sourceCaches)o.has(u)&&(this._reloadSource(u),this._changed=!0)}getGlobalState(){return this._globalState}setGlobalState(r){this._checkLoaded();let n=[];for(let o in r)!Dr(this._globalState[o],r[o].default)&&(n.push(o),this._globalState[o]=r[o].default);let i=this._findGlobalStateAffectedSources(n);for(let o in this.sourceCaches)i.has(o)&&(this._reloadSource(o),this._changed=!0)}_findGlobalStateAffectedSources(r){if(r.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 r)a.has(s)&&n.add(o.source)}return n}loadURL(r,n={},i){this.fire(new U("dataloading",{dataType:"style"})),n.validate=typeof n.validate=="boolean"?n.validate:!0;let o=this.map._requestManager.transformRequest(r,"Style");this._loadStyleRequest=new AbortController;let a=this._loadStyleRequest;Qn(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 Q(s))})}loadJSON(r,n={},i){this.fire(new U("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,ae.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,n.validate=n.validate!==!1,this._load(r,n,i)}).catch(()=>{})}loadEmpty(){this.fire(new U("dataloading",{dataType:"style"})),this._load(WO,{validate:!1})}_load(r,n,i){var a,s,l;let o=n.transformStyle?n.transformStyle(i,r):r;if(!(n.validate&&Rh(this,Qe(o)))){this._loaded=!0,this.stylesheet=o;for(let u in o.sources)this.addSource(u,o.sources[u],{validate:!1});o.sprite?this._loadSprite(o.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(o.glyphs),this._createLayers(),this.light=new Jp(this.stylesheet.light),this._setProjectionInternal(((a=this.stylesheet.projection)==null?void 0:a.type)||"mercator"),this.sky=new Qp(this.stylesheet.sky),this.map.setTerrain((s=this.stylesheet.terrain)!=null?s:null),this.setGlobalState((l=this.stylesheet.state)!=null?l:null),this.fire(new U("data",{dataType:"style"})),this.fire(new U("style.load"))}}_createLayers(){let r=Od(this.stylesheet.layers);this.dispatcher.broadcast("SL",r),this._order=r.map(n=>n.id),this._layers={},this._serializedLayers=null;for(let n of r){let i=Yp(n);i.setEventedParent(this,{layer:{id:n.id}}),this._layers[n.id]=i}}_loadSprite(r,n=!1,i=void 0){this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController;let o;_1(r,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(a=>{if(this._spriteRequest=null,a)for(let s in a){this._spritesImagesIds[s]=[];let l=this._spritesImagesIds[s]?this._spritesImagesIds[s].filter(u=>!(u in a)):[];for(let u of l)this.imageManager.removeImage(u),this._changedImages[u]=!0;for(let u in a[s]){let c=s==="default"?u:"".concat(s,":").concat(u);this._spritesImagesIds[s].push(c),c in this.imageManager.images?this.imageManager.updateImage(c,a[s][u],!1):this.imageManager.addImage(c,a[s][u]),n&&(this._changedImages[c]=!0)}}}).catch(a=>{this._spriteRequest=null,o=a,this.fire(new Q(o))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),n&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new U("data",{dataType:"style"})),i&&i(o)})}_unloadSprite(){for(let r of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(r),this._changedImages[r]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new U("data",{dataType:"style"}))}_validateLayer(r){let n=this.sourceCaches[r.source];if(!n)return;let i=r.sourceLayer;if(!i)return;let o=n.getSource();(o.type==="geojson"||o.vectorLayerIds&&o.vectorLayerIds.indexOf(i)===-1)&&this.fire(new Q(new Error('Source layer "'.concat(i,'" ')+'does not exist on source "'.concat(o.id,'" ')+'as specified by style layer "'.concat(r.id,'".'))))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let r in this.sourceCaches)if(!this.sourceCaches[r].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(r,n=!1){let i=this._serializedAllLayers();if(!r||r.length===0)return Object.values(n?Ft(i):i);let o=[];for(let a of r)if(i[a]){let s=n?Ft(i[a]):i[a];o.push(s)}return o}_serializedAllLayers(){let r=this._serializedLayers;if(r)return r;r=this._serializedLayers={};let n=Object.keys(this._layers);for(let i of n){let o=this._layers[i];o.type!=="custom"&&(r[i]=o.serialize())}return r}hasTransitions(){var r,n,i;if((r=this.light)!=null&&r.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(r){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 l=this._updatedSources[s];if(l==="reload")this._reloadSource(s);else if(l==="clear")this._clearSource(s);else throw new Error("Invalid action ".concat(l))}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(let s in this._updatedPaintProps)this._layers[s].updateTransitions(r);this.light.updateTransitions(r),this.sky.updateTransitions(r),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(r,this._availableImages),!a.isHidden(r.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 U("data",{sourceDataType:"visibility",dataType:"source",sourceId:o}))}this.light.recalculate(r),this.sky.recalculate(r),this.projection.recalculate(r),this.z=r.zoom,n&&this.fire(new U("data",{dataType:"style"}))}_updateTilesForChangedImages(){let r=Object.keys(this._changedImages);if(r.length){for(let n in this.sourceCaches)this.sourceCaches[n].reloadTilesForDependencies(["icons","patterns"],r);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(let r in this.sourceCaches)this.sourceCaches[r].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(r,n){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(r,!1),removedIds:n})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(r,n={}){var l;this._checkLoaded();let i=this.serialize();if(r=n.transformStyle?n.transformStyle(i,r):r,((l=n.validate)!=null?l:!0)&&Rh(this,Qe(r)))return!1;r=Ft(r),r.layers=Od(r.layers);let a=R_(i,r),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 u of s.operations)u();return this.stylesheet=r,this._serializedLayers=null,!0}_getOperationsToPerform(r){let n=[],i=[];for(let o of r)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(r,n){if(this.getImage(r))return this.fire(new Q(new Error('An image named "'.concat(r,'" already exists.'))));this.imageManager.addImage(r,n),this._afterImageUpdated(r)}updateImage(r,n){this.imageManager.updateImage(r,n)}getImage(r){return this.imageManager.getImage(r)}removeImage(r){if(!this.getImage(r))return this.fire(new Q(new Error('An image named "'.concat(r,'" does not exist.'))));this.imageManager.removeImage(r),this._afterImageUpdated(r)}_afterImageUpdated(r){this._availableImages=this.imageManager.listImages(),this._changedImages[r]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new U("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(r,n,i={}){if(this._checkLoaded(),this.sourceCaches[r]!==void 0)throw new Error('Source "'.concat(r,'" 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(Qe.source,"sources.".concat(r),n,null,i))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);let s=this.sourceCaches[r]=new Fn(r,n,this.dispatcher);s.style=this,s.setEventedParent(this,()=>({isSourceLoaded:s.loaded(),source:s.serialize(),sourceId:r})),s.onAdd(this.map),this._changed=!0}removeSource(r){if(this._checkLoaded(),this.sourceCaches[r]===void 0)throw new Error("There is no source with this ID");for(let i in this._layers)if(this._layers[i].source===r)return this.fire(new Q(new Error('Source "'.concat(r,'" cannot be removed while layer "').concat(i,'" is using it.'))));let n=this.sourceCaches[r];delete this.sourceCaches[r],delete this._updatedSources[r],n.fire(new U("data",{sourceDataType:"metadata",dataType:"source",sourceId:r})),n.setEventedParent(null),n.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(r,n){if(this._checkLoaded(),this.sourceCaches[r]===void 0)throw new Error("There is no source with this ID=".concat(r));let i=this.sourceCaches[r].getSource();if(i.type!=="geojson")throw new Error("geojsonSource.type is ".concat(i.type,", which is !== 'geojson"));i.setData(n),this._changed=!0}getSource(r){return this.sourceCaches[r]&&this.sourceCaches[r].getSource()}addLayer(r,n,i={}){this._checkLoaded();let o=r.id;if(this.getLayer(o)){this.fire(new Q(new Error('Layer "'.concat(o,'" already exists on this map.'))));return}let a;if(r.type==="custom"){if(Rh(this,g1(r)))return;a=Yp(r)}else{if("source"in r&&typeof r.source=="object"&&(this.addSource(o,r.source),r=Ft(r),r=Z(r,{source:o})),this._validate(Qe.layer,"layers.".concat(o),r,{arrayIndex:-1},i))return;a=Yp(r),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 Q(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 l=this._removedLayers[o];delete this._removedLayers[o],l.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(r,n){if(this._checkLoaded(),this._changed=!0,!this._layers[r]){this.fire(new Q(new Error("The layer '".concat(r,"' does not exist in the map's style and cannot be moved."))));return}if(r===n)return;let o=this._order.indexOf(r);this._order.splice(o,1);let a=n?this._order.indexOf(n):this._order.length;if(n&&a===-1){this.fire(new Q(new Error('Cannot move layer "'.concat(r,'" before non-existing layer "').concat(n,'".'))));return}this._order.splice(a,0,r),this._layerOrderChanged=!0}removeLayer(r){this._checkLoaded();let n=this._layers[r];if(!n){this.fire(new Q(new Error('Cannot remove non-existing layer "'.concat(r,'".'))));return}n.setEventedParent(null);let i=this._order.indexOf(r);this._order.splice(i,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[r]=n,delete this._layers[r],this._serializedLayers&&delete this._serializedLayers[r],delete this._updatedLayers[r],delete this._updatedPaintProps[r],n.onRemove&&n.onRemove(this.map)}getLayer(r){return this._layers[r]}getLayersOrder(){return[...this._order]}hasLayer(r){return r in this._layers}setLayerZoomRange(r,n,i){this._checkLoaded();let o=this.getLayer(r);if(!o){this.fire(new Q(new Error('Cannot set the zoom range of non-existing layer "'.concat(r,'".'))));return}o.minzoom===n&&o.maxzoom===i||(n!=null&&(o.minzoom=n),i!=null&&(o.maxzoom=i),this._updateLayer(o))}setFilter(r,n,i={}){this._checkLoaded();let o=this.getLayer(r);if(!o){this.fire(new Q(new Error('Cannot filter non-existing layer "'.concat(r,'".'))));return}if(!Dr(o.filter,n)){if(n==null){o.setFilter(void 0),this._updateLayer(o);return}this._validate(Qe.filter,"layers.".concat(o.id,".filter"),n,null,i)||(o.setFilter(Ft(n)),this._updateLayer(o))}}getFilter(r){return Ft(this.getLayer(r).filter)}setLayoutProperty(r,n,i,o={}){this._checkLoaded();let a=this.getLayer(r);if(!a){this.fire(new Q(new Error('Cannot style non-existing layer "'.concat(r,'".'))));return}Dr(a.getLayoutProperty(n),i)||(a.setLayoutProperty(n,i,o),this._updateLayer(a))}getLayoutProperty(r,n){let i=this.getLayer(r);if(!i){this.fire(new Q(new Error('Cannot get style of non-existing layer "'.concat(r,'".'))));return}return i.getLayoutProperty(n)}setPaintProperty(r,n,i,o={}){this._checkLoaded();let a=this.getLayer(r);if(!a){this.fire(new Q(new Error('Cannot style non-existing layer "'.concat(r,'".'))));return}if(Dr(a.getPaintProperty(n),i))return;a.setPaintProperty(n,i,o)&&this._updateLayer(a),this._changed=!0,this._updatedPaintProps[r]=!0,this._serializedLayers=null}getPaintProperty(r,n){return this.getLayer(r).getPaintProperty(n)}setFeatureState(r,n){this._checkLoaded();let i=r.source,o=r.sourceLayer,a=this.sourceCaches[i];if(a===void 0){this.fire(new Q(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 Q(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));return}if(s==="vector"&&!o){this.fire(new Q(new Error("The sourceLayer parameter must be provided for vector source types.")));return}r.id===void 0&&this.fire(new Q(new Error("The feature id parameter must be provided."))),a.setFeatureState(o,r.id,n)}removeFeatureState(r,n){this._checkLoaded();let i=r.source,o=this.sourceCaches[i];if(o===void 0){this.fire(new Q(new Error("The source '".concat(i,"' does not exist in the map's style."))));return}let a=o.getSource().type,s=a==="vector"?r.sourceLayer:void 0;if(a==="vector"&&!s){this.fire(new Q(new Error("The sourceLayer parameter must be provided for vector source types.")));return}if(n&&typeof r.id!="string"&&typeof r.id!="number"){this.fire(new Q(new Error("A feature id is required to remove its specific state property.")));return}o.removeFeatureState(s,r.id,n)}getFeatureState(r){this._checkLoaded();let n=r.source,i=r.sourceLayer,o=this.sourceCaches[n];if(o===void 0){this.fire(new Q(new Error("The source '".concat(n,"' does not exist in the map's style."))));return}if(o.getSource().type==="vector"&&!i){this.fire(new Q(new Error("The sourceLayer parameter must be provided for vector source types.")));return}return r.id===void 0&&this.fire(new Q(new Error("The feature id parameter must be provided."))),o.getFeatureState(i,r.id)}getTransition(){return Z({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;let r=us(this.sourceCaches,a=>a.serialize()),n=this._serializeByIds(this._order,!0),i=this.map.getTerrain()||void 0,o=this.stylesheet;return cc({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:r,layers:n,terrain:i},a=>a!==void 0)}_updateLayer(r){this._updatedLayers[r.id]=!0,r.source&&!this._updatedSources[r.source]&&this.sourceCaches[r.source].getSource().type!=="raster"&&(this._updatedSources[r.source]="reload",this.sourceCaches[r.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(r){let n=s=>this._layers[s].type==="fill-extrusion",i={},o=[];for(let s=this._order.length-1;s>=0;s--){let l=this._order[s];if(n(l)){i[l]=s;for(let u of r){let c=u[l];if(c)for(let p of c)o.push(p)}}}o.sort((s,l)=>l.intersectionZ-s.intersectionZ);let a=[];for(let s=this._order.length-1;s>=0;s--){let l=this._order[s];if(n(l))for(let u=o.length-1;u>=0;u--){let c=o[u].feature;if(i[c.layer.id]<s)break;a.push(c),o.pop()}else for(let u of r){let c=u[l];if(c)for(let p of c)a.push(p.feature)}}return a}queryRenderedFeatures(r,n,i){n&&n.filter&&this._validate(Qe.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 Q(new Error("parameters.layers must be an Array or a Set of strings"))),[];for(let p of n.layers){let h=this._layers[p];if(!h)return this.fire(new Q(new Error("The layer '".concat(p,"' does not exist in the map's style and cannot be queried for features.")))),[];o[h.source]=!0}}let a=[];n.availableImages=this._availableImages;let s=this._serializedAllLayers(),l=n.layers instanceof Set?n.layers:Array.isArray(n.layers)?new Set(n.layers):null,u=wt(Ze({},n),{layers:l});for(let c in this.sourceCaches)n.layers&&!o[c]||a.push(A1(this.sourceCaches[c],this._layers,s,r,u,i,this.map.terrain?(p,h,f)=>this.map.terrain.getElevation(p,h,f):void 0));return this.placement&&a.push(E1(this._layers,s,this.sourceCaches,r,u,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(a)}querySourceFeatures(r,n){n&&n.filter&&this._validate(Qe.filter,"querySourceFeatures.filter",n.filter,null,n);let i=this.sourceCaches[r];return i?L1(i,n):[]}getLight(){return this.light.getLight()}setLight(r,n={}){this._checkLoaded();let i=this.light.getLight(),o=!1;for(let s in r)if(!Dr(r[s],i[s])){o=!0;break}if(!o)return;let a={now:ae.now(),transition:Z({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(r,n),this.light.updateTransitions(a)}getProjection(){var r;return(r=this.stylesheet)==null?void 0:r.projection}setProjection(r){if(this._checkLoaded(),this.projection){if(this.projection.name===r.type)return;this.projection.destroy(),delete this.projection}this.stylesheet.projection=r,this._setProjectionInternal(r.type)}getSky(){var r;return(r=this.stylesheet)==null?void 0:r.sky}setSky(r,n={}){this._checkLoaded();let i=this.getSky(),o=!1;if(!r&&!i)return;if(r&&!i)o=!0;else if(!r&&i)o=!0;else for(let s in r)if(!Dr(r[s],i[s])){o=!0;break}if(!o)return;let a={now:ae.now(),transition:Z({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=r,this.sky.setSky(r,n),this.sky.updateTransitions(a)}_setProjectionInternal(r){let n=Hw(r);this.projection=n.projection,this.map.migrateProjection(n.transform,n.cameraHelper);for(let i in this.sourceCaches)this.sourceCaches[i].reload()}_validate(r,n,i,o,a={}){return a&&a.validate===!1?!1:Rh(this,r.call(Qe,Z({key:n,style:this.serialize(),value:i,styleSpec:D},o)))}_remove(r=!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),va().off(Nl,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),r&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(r)}_clearSource(r){this.sourceCaches[r].clearTiles()}_reloadSource(r){this.sourceCaches[r].resume(),this.sourceCaches[r].reload()}_updateSources(r){for(let n in this.sourceCaches)this.sourceCaches[n].update(r,this.map.terrain)}_generateCollisionBoxes(){for(let r in this.sourceCaches)this._reloadSource(r)}_updatePlacement(r,n,i,o,a=!1){let s=!1,l=!1,u={};for(let p of this._order){let h=this._layers[p];if(h.type!=="symbol")continue;if(!u[h.source]){let d=this.sourceCaches[h.source];u[h.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(h,u[h.source],r.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(ae.now(),r.zoom))&&(this.pauseablePlacement=new Ph(r,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,u),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(ae.now()),l=!0),s&&this.pauseablePlacement.placement.setStale()),l||s)for(let p of this._order){let h=this._layers[p];h.type==="symbol"&&this.placement.updateLayerOpacities(h,u[h.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(ae.now())}_releaseSymbolFadeTiles(){for(let r in this.sourceCaches)this.sourceCaches[r].releaseSymbolFadeTiles()}async getImages(r,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(r,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(r,n={}){this._checkLoaded(),!(r&&this._validate(Qe.glyphs,"glyphs",r,null,n))&&(this._glyphsDidChange=!0,this.stylesheet.glyphs=r,this.glyphManager.entries={},this.glyphManager.setURL(r))}addSprite(r,n,i={},o){this._checkLoaded();let a=[{id:r,url:n}],s=[...ya(this.stylesheet.sprite),...a];this._validate(Qe.sprite,"sprite",s,null,i)||(this.stylesheet.sprite=s,this._loadSprite(a,!0,o))}removeSprite(r){this._checkLoaded();let n=ya(this.stylesheet.sprite);if(!n.find(i=>i.id===r)){this.fire(new Q(new Error('Sprite "'.concat(r,"\" doesn't exists on this map."))));return}if(this._spritesImagesIds[r])for(let i of this._spritesImagesIds[r])this.imageManager.removeImage(i),this._changedImages[i]=!0;n.splice(n.findIndex(i=>i.id===r),1),this.stylesheet.sprite=n.length>0?n:void 0,delete this._spritesImagesIds[r],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new U("data",{dataType:"style"}))}getSprite(){return ya(this.stylesheet.sprite)}setSprite(r,n={},i){this._checkLoaded(),!(r&&this._validate(Qe.sprite,"sprite",r,null,n))&&(this.stylesheet.sprite=r,r?this._loadSprite(r,!0,i):(this._unloadSprite(),i&&i(null)))}};m();m();var Xw=ze([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);m();m();var kh=class{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(e,r,n,i,o,a,s,l,u){this.context=e;let c=this.boundPaintVertexBuffers.length!==i.length;for(let h=0;!c&&h<i.length;h++)this.boundPaintVertexBuffers[h]!==i[h]&&(c=!0);!this.vao||this.boundProgram!==r||this.boundLayoutVertexBuffer!==n||c||this.boundIndexBuffer!==o||this.boundVertexOffset!==a||this.boundDynamicVertexBuffer!==s||this.boundDynamicVertexBuffer2!==l||this.boundDynamicVertexBuffer3!==u?this.freshBind(r,n,i,o,a,s,l,u):(e.bindVertexArray.set(this.vao),s&&s.bind(),o&&o.dynamicDraw&&o.bind(),l&&l.bind(),u&&u.bind())}freshBind(e,r,n,i,o,a,s,l){let u=e.numAttributes,c=this.context,p=c.gl;this.vao&&this.destroy(),this.vao=c.createVertexArray(),c.bindVertexArray.set(this.vao),this.boundProgram=e,this.boundLayoutVertexBuffer=r,this.boundPaintVertexBuffers=n,this.boundIndexBuffer=i,this.boundVertexOffset=o,this.boundDynamicVertexBuffer=a,this.boundDynamicVertexBuffer2=s,this.boundDynamicVertexBuffer3=l,r.enableAttributes(p,e);for(let h of n)h.enableAttributes(p,e);a&&a.enableAttributes(p,e),s&&s.enableAttributes(p,e),l&&l.enableAttributes(p,e),r.bind(),r.setVertexAttribPointers(p,e,o);for(let h of n)h.bind(),h.setVertexAttribPointers(p,e,o);a&&(a.bind(),a.setVertexAttribPointers(p,e,o)),i&&i.bind(),s&&(s.bind(),s.setVertexAttribPointers(p,e,o)),l&&(l.bind(),l.setVertexAttribPointers(p,e,o)),c.currentNumAttributes=u}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}};m();var Zw=(t,e)=>({u_depth:new re(t,e.u_depth),u_terrain:new re(t,e.u_terrain),u_terrain_dim:new N(t,e.u_terrain_dim),u_terrain_matrix:new dt(t,e.u_terrain_matrix),u_terrain_unpack:new Bt(t,e.u_terrain_unpack),u_terrain_exaggeration:new N(t,e.u_terrain_exaggeration)}),qw=(t,e)=>({u_texture:new re(t,e.u_texture),u_ele_delta:new N(t,e.u_ele_delta),u_fog_matrix:new dt(t,e.u_fog_matrix),u_fog_color:new zt(t,e.u_fog_color),u_fog_ground_blend:new N(t,e.u_fog_ground_blend),u_fog_ground_blend_opacity:new N(t,e.u_fog_ground_blend_opacity),u_horizon_color:new zt(t,e.u_horizon_color),u_horizon_fog_blend:new N(t,e.u_horizon_fog_blend),u_is_globe_mode:new N(t,e.u_is_globe_mode)}),Yw=(t,e)=>({u_ele_delta:new N(t,e.u_ele_delta)}),Ww=(t,e)=>({u_texture:new re(t,e.u_texture),u_terrain_coords_id:new N(t,e.u_terrain_coords_id),u_ele_delta:new N(t,e.u_ele_delta)}),$w=(t,e,r,n,i)=>({u_texture:0,u_ele_delta:t,u_fog_matrix:e,u_fog_color:r?r.properties.get("fog-color"):K.white,u_fog_ground_blend:r?r.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:i?0:r?r.calculateFogBlendOpacity(n):0,u_horizon_color:r?r.properties.get("horizon-color"):K.white,u_horizon_fog_blend:r?r.properties.get("horizon-fog-blend"):1,u_is_globe_mode:i?1:0}),Kw=t=>({u_ele_delta:t}),Jw=(t,e)=>({u_terrain_coords_id:t/255,u_texture:0,u_ele_delta:e});m();var Qw=(t,e)=>({u_projection_matrix:new dt(t,e.u_projection_matrix),u_projection_tile_mercator_coords:new Bt(t,e.u_projection_tile_mercator_coords),u_projection_clipping_plane:new Bt(t,e.u_projection_clipping_plane),u_projection_transition:new N(t,e.u_projection_transition),u_projection_fallback_matrix:new dt(t,e.u_projection_fallback_matrix)}),eT={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 Fh(t){let e=[];for(let r=0;r<t.length;r++){if(t[r]===null)continue;let n=t[r].split(" ");e.push(n.pop())}return e}var Oh=class{constructor(e,r,n,i,o,a,s,l,u=[]){let c=e.gl;this.program=c.createProgram();let p=Fh(r.staticAttributes),h=n?n.getBinderAttributes():[],f=p.concat(h),d=ar.prelude.staticUniforms?Fh(ar.prelude.staticUniforms):[],g=s.staticUniforms?Fh(s.staticUniforms):[],x=r.staticUniforms?Fh(r.staticUniforms):[],b=n?n.getBinderUniforms():[],v=d.concat(g).concat(x).concat(b),P=[];for(let L of v)P.indexOf(L)<0&&P.push(L);let w=n?n.defines():[];Tr(c)&&w.unshift("#version 300 es"),o&&w.push("#define OVERDRAW_INSPECTOR;"),a&&w.push("#define TERRAIN3D;"),l&&w.push(l),u&&w.push(...u);let T=w.concat(ar.prelude.fragmentSource,s.fragmentSource,r.fragmentSource).join("\n"),S=w.concat(ar.prelude.vertexSource,s.vertexSource,r.vertexSource).join("\n");Tr(c)||(T=Aw(T),S=Iw(S));let I=c.createShader(c.FRAGMENT_SHADER);if(c.isContextLost()){this.failedToCreate=!0;return}if(c.shaderSource(I,T),c.compileShader(I),!c.getShaderParameter(I,c.COMPILE_STATUS))throw new Error("Could not compile fragment shader: ".concat(c.getShaderInfoLog(I)));c.attachShader(this.program,I);let M=c.createShader(c.VERTEX_SHADER);if(c.isContextLost()){this.failedToCreate=!0;return}if(c.shaderSource(M,S),c.compileShader(M),!c.getShaderParameter(M,c.COMPILE_STATUS))throw new Error("Could not compile vertex shader: ".concat(c.getShaderInfoLog(M)));c.attachShader(this.program,M),this.attributes={};let E={};this.numAttributes=f.length;for(let L=0;L<this.numAttributes;L++)f[L]&&(c.bindAttribLocation(this.program,L,f[L]),this.attributes[f[L]]=L);if(c.linkProgram(this.program),!c.getProgramParameter(this.program,c.LINK_STATUS))throw new Error("Program failed to link: ".concat(c.getProgramInfoLog(this.program)));c.deleteShader(M),c.deleteShader(I);for(let L=0;L<P.length;L++){let k=P[L];if(k&&!E[k]){let F=c.getUniformLocation(this.program,k);F&&(E[k]=F)}}this.fixedUniforms=i(e,E),this.terrainUniforms=Zw(e,E),this.projectionUniforms=Qw(e,E),this.binderUniforms=n?n.getUniforms(e,E):[]}draw(e,r,n,i,o,a,s,l,u,c,p,h,f,d,g,x,b,v,P){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),l){e.activeTexture.set(w.TEXTURE2),w.bindTexture(w.TEXTURE_2D,l.depthTexture),e.activeTexture.set(w.TEXTURE3),w.bindTexture(w.TEXTURE_2D,l.texture);for(let S in this.terrainUniforms)this.terrainUniforms[S].set(l[S])}if(u)for(let S in u){let I=eT[S];this.projectionUniforms[I].set(u[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(r){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 I=S.vaos||(S.vaos={});(I[c]||(I[c]=new kh)).bind(e,this,p,x?x.getPaintVertexBuffers():[],h,S.vertexOffset,b,v,P),w.drawElements(r,S.primitiveLength*T,w.UNSIGNED_SHORT,S.primitiveOffset*T*2)}}};m();m();m();function Bh(t,e,r){let n=1/gt(r,1,e.transform.tileZoom),i=Math.pow(2,r.tileID.overscaledZ),o=r.tileSize*Math.pow(2,e.transform.tileZoom)/i,a=o*(r.tileID.canonical.x+r.tileID.wrap*i),s=o*r.tileID.canonical.y;return{u_image:0,u_texsize:r.imageAtlasTexture.size,u_scale:[n,t.fromScale,t.toScale],u_fade:t.t,u_pixel_coord_upper:[a>>16,s>>16],u_pixel_coord_lower:[a&65535,s&65535]}}function tT(t,e,r,n){let i=r.imageManager.getPattern(t.from.toString()),o=r.imageManager.getPattern(t.to.toString()),{width:a,height:s}=r.imageManager.getPixelSize(),l=Math.pow(2,n.tileID.overscaledZ),u=n.tileSize*Math.pow(2,r.transform.tileZoom)/l,c=u*(n.tileID.canonical.x+n.tileID.wrap*l),p=u*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/gt(n,1,r.transform.tileZoom),u_pixel_coord_upper:[c>>16,p>>16],u_pixel_coord_lower:[c&65535,p&65535]}}var rT=(t,e)=>({u_lightpos:new xt(t,e.u_lightpos),u_lightpos_globe:new xt(t,e.u_lightpos_globe),u_lightintensity:new N(t,e.u_lightintensity),u_lightcolor:new xt(t,e.u_lightcolor),u_vertical_gradient:new N(t,e.u_vertical_gradient),u_opacity:new N(t,e.u_opacity),u_fill_translate:new ee(t,e.u_fill_translate)}),nT=(t,e)=>({u_lightpos:new xt(t,e.u_lightpos),u_lightpos_globe:new xt(t,e.u_lightpos_globe),u_lightintensity:new N(t,e.u_lightintensity),u_lightcolor:new xt(t,e.u_lightcolor),u_vertical_gradient:new N(t,e.u_vertical_gradient),u_height_factor:new N(t,e.u_height_factor),u_opacity:new N(t,e.u_opacity),u_fill_translate:new ee(t,e.u_fill_translate),u_image:new re(t,e.u_image),u_texsize:new ee(t,e.u_texsize),u_pixel_coord_upper:new ee(t,e.u_pixel_coord_upper),u_pixel_coord_lower:new ee(t,e.u_pixel_coord_lower),u_scale:new xt(t,e.u_scale),u_fade:new N(t,e.u_fade)}),lg=(t,e,r,n)=>{let i=t.style.light,o=i.properties.get("position"),a=[o.x,o.y,o.z],s=wn.create();i.properties.get("anchor")==="viewport"&&wn.fromRotation(s,t.transform.bearingInRadians),V.transformMat3(a,a,s);let l=t.transform.transformLightDirection(a),u=i.properties.get("color");return{u_lightpos:a,u_lightpos_globe:l,u_lightintensity:i.properties.get("intensity"),u_lightcolor:[u.r,u.g,u.b],u_vertical_gradient:+e,u_opacity:r,u_fill_translate:n}},iT=(t,e,r,n,i,o,a)=>Z(lg(t,e,r,n),Bh(o,t,a),{u_height_factor:-Math.pow(2,i.overscaledZ)/a.tileSize/8});m();var oT=(t,e)=>({u_fill_translate:new ee(t,e.u_fill_translate)}),aT=(t,e)=>({u_image:new re(t,e.u_image),u_texsize:new ee(t,e.u_texsize),u_pixel_coord_upper:new ee(t,e.u_pixel_coord_upper),u_pixel_coord_lower:new ee(t,e.u_pixel_coord_lower),u_scale:new xt(t,e.u_scale),u_fade:new N(t,e.u_fade),u_fill_translate:new ee(t,e.u_fill_translate)}),sT=(t,e)=>({u_world:new ee(t,e.u_world),u_fill_translate:new ee(t,e.u_fill_translate)}),lT=(t,e)=>({u_world:new ee(t,e.u_world),u_image:new re(t,e.u_image),u_texsize:new ee(t,e.u_texsize),u_pixel_coord_upper:new ee(t,e.u_pixel_coord_upper),u_pixel_coord_lower:new ee(t,e.u_pixel_coord_lower),u_scale:new xt(t,e.u_scale),u_fade:new N(t,e.u_fade),u_fill_translate:new ee(t,e.u_fill_translate)}),ug=(t,e,r,n)=>Z(Bh(e,t,r),{u_fill_translate:n}),uT=t=>({u_fill_translate:t}),cT=(t,e)=>({u_world:t,u_fill_translate:e}),pT=(t,e,r,n,i)=>Z(ug(t,e,r,i),{u_world:n});m();var hT=(t,e)=>({u_camera_to_center_distance:new N(t,e.u_camera_to_center_distance),u_scale_with_map:new re(t,e.u_scale_with_map),u_pitch_with_map:new re(t,e.u_pitch_with_map),u_extrude_scale:new ee(t,e.u_extrude_scale),u_device_pixel_ratio:new N(t,e.u_device_pixel_ratio),u_globe_extrude_scale:new N(t,e.u_globe_extrude_scale),u_translate:new ee(t,e.u_translate)}),fT=(t,e,r,n,i)=>{let o=t.transform,a,s,l=0;if(r.paint.get("circle-pitch-alignment")==="map"){let u=gt(e,1,o.zoom);a=!0,s=[u,u],l=u/(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:+(r.paint.get("circle-pitch-scale")==="map"),u_pitch_with_map:+a,u_device_pixel_ratio:t.pixelRatio,u_extrude_scale:s,u_globe_extrude_scale:l,u_translate:n}};m();var mT=(t,e)=>({u_pixel_extrude_scale:new ee(t,e.u_pixel_extrude_scale)}),dT=(t,e)=>({u_viewport_size:new ee(t,e.u_viewport_size)}),yT=t=>({u_pixel_extrude_scale:[1/t.width,1/t.height]}),gT=t=>({u_viewport_size:[t.width,t.height]});m();var xT=(t,e)=>({u_color:new zt(t,e.u_color),u_overlay:new re(t,e.u_overlay),u_overlay_scale:new N(t,e.u_overlay_scale)}),cg=(t,e=1)=>({u_color:t,u_overlay:0,u_overlay_scale:e});m();var bT=(t,e)=>({u_extrude_scale:new N(t,e.u_extrude_scale),u_intensity:new N(t,e.u_intensity),u_globe_extrude_scale:new N(t,e.u_globe_extrude_scale)}),_T=(t,e)=>({u_matrix:new dt(t,e.u_matrix),u_world:new ee(t,e.u_world),u_image:new re(t,e.u_image),u_color_ramp:new re(t,e.u_color_ramp),u_opacity:new N(t,e.u_opacity)}),pg=(t,e,r,n)=>{let o=gt(t,1,e)/(8192*Math.pow(2,t.tileID.overscaledZ))*2*Math.PI*n;return{u_extrude_scale:gt(t,1,e),u_intensity:r,u_globe_extrude_scale:o}},hg=(t,e,r,n)=>{let i=B.create();B.ortho(i,0,t.width,t.height,0,0,1);let o=t.context.gl;return{u_matrix:i,u_world:[o.drawingBufferWidth,o.drawingBufferHeight],u_image:r,u_color_ramp:n,u_opacity:e.paint.get("heatmap-opacity")}};m();var vT=(t,e)=>({u_image:new re(t,e.u_image),u_latrange:new ee(t,e.u_latrange),u_exaggeration:new N(t,e.u_exaggeration),u_altitudes:new hl(t,e.u_altitudes),u_azimuths:new hl(t,e.u_azimuths),u_accent:new zt(t,e.u_accent),u_method:new re(t,e.u_method),u_shadows:new pl(t,e.u_shadows),u_highlights:new pl(t,e.u_highlights)}),PT=(t,e)=>({u_matrix:new dt(t,e.u_matrix),u_image:new re(t,e.u_image),u_dimension:new ee(t,e.u_dimension),u_zoom:new N(t,e.u_zoom),u_unpack:new Bt(t,e.u_unpack)}),wT=(t,e,r)=>{let n=r.paint.get("hillshade-accent-color"),i;switch(r.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=r.getIlluminationProperties();for(let a=0;a<o.directionRadians.length;a++)r.paint.get("hillshade-illumination-anchor")==="viewport"&&(o.directionRadians[a]+=t.transform.bearingInRadians);return{u_image:0,u_latrange:$O(t,e.tileID),u_exaggeration:r.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}},TT=(t,e)=>{let r=e.stride,n=B.create();return B.ortho(n,0,8192,-8192,0,0,1),B.translate(n,n,[0,-8192,0]),{u_matrix:n,u_image:1,u_dimension:[r,r],u_zoom:t.overscaledZ,u_unpack:e.getUnpackVector()}};function $O(t,e){let r=Math.pow(2,e.canonical.z),n=e.canonical.y;return[new xe(0,n/r).toLngLat().lat,new xe(0,(n+1)/r).toLngLat().lat]}m();var ST=(t,e)=>({u_image:new re(t,e.u_image),u_unpack:new Bt(t,e.u_unpack),u_dimension:new ee(t,e.u_dimension),u_elevation_stops:new re(t,e.u_elevation_stops),u_color_stops:new re(t,e.u_color_stops),u_opacity:new N(t,e.u_opacity)}),CT=(t,e)=>({u_image:0,u_unpack:e.getUnpackVector(),u_dimension:[e.stride,e.stride],u_elevation_stops:1,u_color_stops:4,u_opacity:t.paint.get("color-relief-opacity")});m();var MT=(t,e)=>({u_translation:new ee(t,e.u_translation),u_ratio:new N(t,e.u_ratio),u_device_pixel_ratio:new N(t,e.u_device_pixel_ratio),u_units_to_pixels:new ee(t,e.u_units_to_pixels)}),IT=(t,e)=>({u_translation:new ee(t,e.u_translation),u_ratio:new N(t,e.u_ratio),u_device_pixel_ratio:new N(t,e.u_device_pixel_ratio),u_units_to_pixels:new ee(t,e.u_units_to_pixels),u_image:new re(t,e.u_image),u_image_height:new N(t,e.u_image_height)}),AT=(t,e)=>({u_translation:new ee(t,e.u_translation),u_texsize:new ee(t,e.u_texsize),u_ratio:new N(t,e.u_ratio),u_device_pixel_ratio:new N(t,e.u_device_pixel_ratio),u_image:new re(t,e.u_image),u_units_to_pixels:new ee(t,e.u_units_to_pixels),u_scale:new xt(t,e.u_scale),u_fade:new N(t,e.u_fade)}),ET=(t,e)=>({u_translation:new ee(t,e.u_translation),u_ratio:new N(t,e.u_ratio),u_device_pixel_ratio:new N(t,e.u_device_pixel_ratio),u_units_to_pixels:new ee(t,e.u_units_to_pixels),u_patternscale_a:new ee(t,e.u_patternscale_a),u_patternscale_b:new ee(t,e.u_patternscale_b),u_sdfgamma:new N(t,e.u_sdfgamma),u_image:new re(t,e.u_image),u_tex_y_a:new N(t,e.u_tex_y_a),u_tex_y_b:new N(t,e.u_tex_y_b),u_mix:new N(t,e.u_mix)}),zh=(t,e,r,n)=>{let i=t.transform;return{u_translation:FT(t,e,r),u_ratio:n/gt(e,1,i.zoom),u_device_pixel_ratio:t.pixelRatio,u_units_to_pixels:[1/i.pixelsToGLUnits[0],1/i.pixelsToGLUnits[1]]}},LT=(t,e,r,n,i)=>Z(zh(t,e,r,n),{u_image:0,u_image_height:i}),DT=(t,e,r,n,i)=>{let o=t.transform,a=kT(e,o);return{u_translation:FT(t,e,r),u_texsize:e.imageAtlasTexture.size,u_ratio:n/gt(e,1,o.zoom),u_device_pixel_ratio:t.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]]}},RT=(t,e,r,n,i,o)=>{let a=t.transform,s=t.lineAtlas,l=kT(e,a),u=r.layout.get("line-cap")==="round",c=s.getDash(i.from,u),p=s.getDash(i.to,u),h=c.width*o.fromScale,f=p.width*o.toScale;return Z(zh(t,e,r,n),{u_patternscale_a:[l/h,-c.height/2],u_patternscale_b:[l/f,-p.height/2],u_sdfgamma:s.width/(Math.min(h,f)*256*t.pixelRatio)/2,u_image:0,u_tex_y_a:c.y,u_tex_y_b:p.y,u_mix:o.t})};function kT(t,e){return 1/gt(t,1,e.tileZoom)}function FT(t,e,r){return Wt(t.transform,e,r.paint.get("line-translate"),r.paint.get("line-translate-anchor"))}m();var OT=(t,e)=>({u_tl_parent:new ee(t,e.u_tl_parent),u_scale_parent:new N(t,e.u_scale_parent),u_buffer_scale:new N(t,e.u_buffer_scale),u_fade_t:new N(t,e.u_fade_t),u_opacity:new N(t,e.u_opacity),u_image0:new re(t,e.u_image0),u_image1:new re(t,e.u_image1),u_brightness_low:new N(t,e.u_brightness_low),u_brightness_high:new N(t,e.u_brightness_high),u_saturation_factor:new N(t,e.u_saturation_factor),u_contrast_factor:new N(t,e.u_contrast_factor),u_spin_weights:new xt(t,e.u_spin_weights),u_coords_top:new Bt(t,e.u_coords_top),u_coords_bottom:new Bt(t,e.u_coords_bottom)}),BT=(t,e,r,n,i)=>({u_tl_parent:t,u_scale_parent:e,u_buffer_scale:1,u_fade_t:r.mix,u_opacity:r.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:QO(n.paint.get("raster-saturation")),u_contrast_factor:JO(n.paint.get("raster-contrast")),u_spin_weights:KO(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]});function KO(t){t*=Math.PI/180;let e=Math.sin(t),r=Math.cos(t);return[(2*r+1)/3,(-Math.sqrt(3)*e-r+1)/3,(Math.sqrt(3)*e-r+1)/3]}function JO(t){return t>0?1/(1-t):1+t}function QO(t){return t>0?1-1/(1.001-t):-t}m();var zT=(t,e)=>({u_is_size_zoom_constant:new re(t,e.u_is_size_zoom_constant),u_is_size_feature_constant:new re(t,e.u_is_size_feature_constant),u_size_t:new N(t,e.u_size_t),u_size:new N(t,e.u_size),u_camera_to_center_distance:new N(t,e.u_camera_to_center_distance),u_pitch:new N(t,e.u_pitch),u_rotate_symbol:new re(t,e.u_rotate_symbol),u_aspect_ratio:new N(t,e.u_aspect_ratio),u_fade_change:new N(t,e.u_fade_change),u_label_plane_matrix:new dt(t,e.u_label_plane_matrix),u_coord_matrix:new dt(t,e.u_coord_matrix),u_is_text:new re(t,e.u_is_text),u_pitch_with_map:new re(t,e.u_pitch_with_map),u_is_along_line:new re(t,e.u_is_along_line),u_is_variable_anchor:new re(t,e.u_is_variable_anchor),u_texsize:new ee(t,e.u_texsize),u_texture:new re(t,e.u_texture),u_translation:new ee(t,e.u_translation),u_pitched_scale:new N(t,e.u_pitched_scale)}),VT=(t,e)=>({u_is_size_zoom_constant:new re(t,e.u_is_size_zoom_constant),u_is_size_feature_constant:new re(t,e.u_is_size_feature_constant),u_size_t:new N(t,e.u_size_t),u_size:new N(t,e.u_size),u_camera_to_center_distance:new N(t,e.u_camera_to_center_distance),u_pitch:new N(t,e.u_pitch),u_rotate_symbol:new re(t,e.u_rotate_symbol),u_aspect_ratio:new N(t,e.u_aspect_ratio),u_fade_change:new N(t,e.u_fade_change),u_label_plane_matrix:new dt(t,e.u_label_plane_matrix),u_coord_matrix:new dt(t,e.u_coord_matrix),u_is_text:new re(t,e.u_is_text),u_pitch_with_map:new re(t,e.u_pitch_with_map),u_is_along_line:new re(t,e.u_is_along_line),u_is_variable_anchor:new re(t,e.u_is_variable_anchor),u_texsize:new ee(t,e.u_texsize),u_texture:new re(t,e.u_texture),u_gamma_scale:new N(t,e.u_gamma_scale),u_device_pixel_ratio:new N(t,e.u_device_pixel_ratio),u_is_halo:new re(t,e.u_is_halo),u_translation:new ee(t,e.u_translation),u_pitched_scale:new N(t,e.u_pitched_scale)}),UT=(t,e)=>({u_is_size_zoom_constant:new re(t,e.u_is_size_zoom_constant),u_is_size_feature_constant:new re(t,e.u_is_size_feature_constant),u_size_t:new N(t,e.u_size_t),u_size:new N(t,e.u_size),u_camera_to_center_distance:new N(t,e.u_camera_to_center_distance),u_pitch:new N(t,e.u_pitch),u_rotate_symbol:new re(t,e.u_rotate_symbol),u_aspect_ratio:new N(t,e.u_aspect_ratio),u_fade_change:new N(t,e.u_fade_change),u_label_plane_matrix:new dt(t,e.u_label_plane_matrix),u_coord_matrix:new dt(t,e.u_coord_matrix),u_is_text:new re(t,e.u_is_text),u_pitch_with_map:new re(t,e.u_pitch_with_map),u_is_along_line:new re(t,e.u_is_along_line),u_is_variable_anchor:new re(t,e.u_is_variable_anchor),u_texsize:new ee(t,e.u_texsize),u_texsize_icon:new ee(t,e.u_texsize_icon),u_texture:new re(t,e.u_texture),u_texture_icon:new re(t,e.u_texture_icon),u_gamma_scale:new N(t,e.u_gamma_scale),u_device_pixel_ratio:new N(t,e.u_device_pixel_ratio),u_is_halo:new re(t,e.u_is_halo),u_translation:new ee(t,e.u_translation),u_pitched_scale:new N(t,e.u_pitched_scale)}),fg=(t,e,r,n,i,o,a,s,l,u,c,p,h)=>{let f=a.transform;return{u_is_size_zoom_constant:+(t==="constant"||t==="source"),u_is_size_feature_constant:+(t==="constant"||t==="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:+r,u_aspect_ratio:f.width/f.height,u_fade_change:a.options.fadeDuration?a.symbolFadeChange:1,u_label_plane_matrix:s,u_coord_matrix:l,u_is_text:+c,u_pitch_with_map:+n,u_is_along_line:i,u_is_variable_anchor:o,u_texsize:p,u_texture:0,u_translation:u,u_pitched_scale:h}},mg=(t,e,r,n,i,o,a,s,l,u,c,p,h,f)=>{let d=a.transform;return Z(fg(t,e,r,n,i,o,a,s,l,u,c,p,f),{u_gamma_scale:n?Math.cos(d.pitch*Math.PI/180)*d.cameraToCenterDistance:1,u_device_pixel_ratio:a.pixelRatio,u_is_halo:+h})},NT=(t,e,r,n,i,o,a,s,l,u,c,p,h)=>Z(mg(t,e,r,n,i,o,a,s,l,u,!0,c,!0,h),{u_texsize_icon:p,u_texture_icon:1});m();var GT=(t,e)=>({u_opacity:new N(t,e.u_opacity),u_color:new zt(t,e.u_color)}),jT=(t,e)=>({u_opacity:new N(t,e.u_opacity),u_image:new re(t,e.u_image),u_pattern_tl_a:new ee(t,e.u_pattern_tl_a),u_pattern_br_a:new ee(t,e.u_pattern_br_a),u_pattern_tl_b:new ee(t,e.u_pattern_tl_b),u_pattern_br_b:new ee(t,e.u_pattern_br_b),u_texsize:new ee(t,e.u_texsize),u_mix:new N(t,e.u_mix),u_pattern_size_a:new ee(t,e.u_pattern_size_a),u_pattern_size_b:new ee(t,e.u_pattern_size_b),u_scale_a:new N(t,e.u_scale_a),u_scale_b:new N(t,e.u_scale_b),u_pixel_coord_upper:new ee(t,e.u_pixel_coord_upper),u_pixel_coord_lower:new ee(t,e.u_pixel_coord_lower),u_tile_units_to_pixels:new N(t,e.u_tile_units_to_pixels)}),HT=(t,e)=>({u_opacity:t,u_color:e}),XT=(t,e,r,n,i)=>Z(tT(r,i,e,n),{u_opacity:t});m();var ZT=(t,e)=>({u_sun_pos:new xt(t,e.u_sun_pos),u_atmosphere_blend:new N(t,e.u_atmosphere_blend),u_globe_position:new xt(t,e.u_globe_position),u_globe_radius:new N(t,e.u_globe_radius),u_inv_proj_matrix:new dt(t,e.u_inv_proj_matrix)}),qT=(t,e,r,n,i)=>({u_sun_pos:t,u_atmosphere_blend:e,u_globe_position:r,u_globe_radius:n,u_inv_proj_matrix:i});m();var YT=(t,e)=>({u_sky_color:new zt(t,e.u_sky_color),u_horizon_color:new zt(t,e.u_horizon_color),u_horizon:new ee(t,e.u_horizon),u_horizon_normal:new ee(t,e.u_horizon_normal),u_sky_horizon_blend:new N(t,e.u_sky_horizon_blend),u_sky_blend:new N(t,e.u_sky_blend)}),WT=(t,e,r)=>{let n=Math.cos(e.rollInRadians),i=Math.sin(e.rollInRadians),o=wa(e),s=e.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:t.properties.get("sky-color"),u_horizon_color:t.properties.get("horizon-color"),u_horizon:[(e.width/2-o*i)*r,(e.height/2+o*n)*r],u_horizon_normal:[-i,n],u_sky_horizon_blend:t.properties.get("sky-horizon-blend")*e.height/2*r,u_sky_blend:s}};var $T=(t,e)=>{},KT={fillExtrusion:rT,fillExtrusionPattern:nT,fill:oT,fillPattern:aT,fillOutline:sT,fillOutlinePattern:lT,circle:hT,collisionBox:mT,collisionCircle:dT,debug:xT,depth:$T,clippingMask:$T,heatmap:bT,heatmapTexture:_T,hillshade:vT,hillshadePrepare:PT,colorRelief:ST,line:MT,lineGradient:IT,linePattern:AT,lineSDF:ET,raster:OT,symbolIcon:zT,symbolSDF:VT,symbolTextAndIcon:UT,background:GT,backgroundPattern:jT,terrain:qw,terrainDepth:Yw,terrainCoords:Ww,projectionErrorMeasurement:Rw,atmosphere:ZT,sky:YT};m();m();var Vh=class{constructor(e,r,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,r.arrayBuffer,this.dynamicDraw?i.DYNAMIC_DRAW:i.STATIC_DRAW),this.dynamicDraw||delete r.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){let r=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),r.bufferSubData(r.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){let e=this.context.gl;this.buffer&&(e.deleteBuffer(this.buffer),delete this.buffer)}};m();var eB={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"},Uh=class{constructor(e,r,n,i){this.length=r.length,this.attributes=n,this.itemSize=r.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,r.arrayBuffer,this.dynamicDraw?o.DYNAMIC_DRAW:o.STATIC_DRAW),this.dynamicDraw||delete r.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 r=this.context.gl;this.bind(),r.bufferSubData(r.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,r){for(let n=0;n<this.attributes.length;n++){let i=this.attributes[n],o=r.attributes[i.name];o!==void 0&&e.enableVertexAttribArray(o)}}setVertexAttribPointers(e,r,n){for(let i=0;i<this.attributes.length;i++){let o=this.attributes[i],a=r.attributes[o.name];a!==void 0&&e.vertexAttribPointer(a,o.components,e[eB[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)}};m();m();var Oe=class{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)}},Nh=class extends Oe{getDefault(){return K.transparent}set(e){let r=this.current;e.r===r.r&&e.g===r.g&&e.b===r.b&&e.a===r.a&&!this.dirty||(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}},Gh=class extends Oe{getDefault(){return 1}set(e){e===this.current&&!this.dirty||(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}},jh=class extends Oe{getDefault(){return 0}set(e){e===this.current&&!this.dirty||(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}},Hh=class extends Oe{getDefault(){return[!0,!0,!0,!0]}set(e){let r=this.current;e[0]===r[0]&&e[1]===r[1]&&e[2]===r[2]&&e[3]===r[3]&&!this.dirty||(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}},Xh=class extends Oe{getDefault(){return!0}set(e){e===this.current&&!this.dirty||(this.gl.depthMask(e),this.current=e,this.dirty=!1)}},Zh=class extends Oe{getDefault(){return 255}set(e){e===this.current&&!this.dirty||(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}},qh=class extends Oe{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){let r=this.current;e.func===r.func&&e.ref===r.ref&&e.mask===r.mask&&!this.dirty||(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}},Yh=class extends Oe{getDefault(){let e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){let r=this.current;e[0]===r[0]&&e[1]===r[1]&&e[2]===r[2]&&!this.dirty||(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}},Wh=class extends Oe{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let r=this.gl;e?r.enable(r.STENCIL_TEST):r.disable(r.STENCIL_TEST),this.current=e,this.dirty=!1}},$h=class extends Oe{getDefault(){return[0,1]}set(e){let r=this.current;e[0]===r[0]&&e[1]===r[1]&&!this.dirty||(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}},Kh=class extends Oe{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let r=this.gl;e?r.enable(r.DEPTH_TEST):r.disable(r.DEPTH_TEST),this.current=e,this.dirty=!1}},Jh=class extends Oe{getDefault(){return this.gl.LESS}set(e){e===this.current&&!this.dirty||(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}},Qh=class extends Oe{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let r=this.gl;e?r.enable(r.BLEND):r.disable(r.BLEND),this.current=e,this.dirty=!1}},ef=class extends Oe{getDefault(){let e=this.gl;return[e.ONE,e.ZERO]}set(e){let r=this.current;e[0]===r[0]&&e[1]===r[1]&&!this.dirty||(this.gl.blendFunc(e[0],e[1]),this.current=e,this.dirty=!1)}},tf=class extends Oe{getDefault(){return K.transparent}set(e){let r=this.current;e.r===r.r&&e.g===r.g&&e.b===r.b&&e.a===r.a&&!this.dirty||(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}},rf=class extends Oe{getDefault(){return this.gl.FUNC_ADD}set(e){e===this.current&&!this.dirty||(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}},nf=class extends Oe{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let r=this.gl;e?r.enable(r.CULL_FACE):r.disable(r.CULL_FACE),this.current=e,this.dirty=!1}},of=class extends Oe{getDefault(){return this.gl.BACK}set(e){e===this.current&&!this.dirty||(this.gl.cullFace(e),this.current=e,this.dirty=!1)}},af=class extends Oe{getDefault(){return this.gl.CCW}set(e){e===this.current&&!this.dirty||(this.gl.frontFace(e),this.current=e,this.dirty=!1)}},sf=class extends Oe{getDefault(){return null}set(e){e===this.current&&!this.dirty||(this.gl.useProgram(e),this.current=e,this.dirty=!1)}},lf=class extends Oe{getDefault(){return this.gl.TEXTURE0}set(e){e===this.current&&!this.dirty||(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}},uf=class extends Oe{getDefault(){let e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){let r=this.current;e[0]===r[0]&&e[1]===r[1]&&e[2]===r[2]&&e[3]===r[3]&&!this.dirty||(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}},cf=class extends Oe{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let r=this.gl;r.bindFramebuffer(r.FRAMEBUFFER,e),this.current=e,this.dirty=!1}},pf=class extends Oe{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let r=this.gl;r.bindRenderbuffer(r.RENDERBUFFER,e),this.current=e,this.dirty=!1}},hf=class extends Oe{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let r=this.gl;r.bindTexture(r.TEXTURE_2D,e),this.current=e,this.dirty=!1}},ff=class extends Oe{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let r=this.gl;r.bindBuffer(r.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}},mf=class extends Oe{getDefault(){return null}set(e){let r=this.gl;r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}},df=class extends Oe{getDefault(){return null}set(e){var n;if(e===this.current&&!this.dirty)return;let r=this.gl;Tr(r)?r.bindVertexArray(e):(n=r.getExtension("OES_vertex_array_object"))==null||n.bindVertexArrayOES(e),this.current=e,this.dirty=!1}},yf=class extends Oe{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;let r=this.gl;r.pixelStorei(r.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}},gf=class extends Oe{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let r=this.gl;r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}},xf=class extends Oe{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let r=this.gl;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}},nu=class extends Oe{constructor(e,r){super(e),this.context=e,this.parent=r}getDefault(){return null}},bf=class extends nu{setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let r=this.gl;r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}},_f=class extends nu{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let r=this.gl;r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.RENDERBUFFER,e),this.current=e,this.dirty=!1}},vf=class extends nu{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let r=this.gl;r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.RENDERBUFFER,e),this.current=e,this.dirty=!1}};m();var JT="Framebuffer is not complete";function QT(t){return t.message===JT}function eS(){return new Error(JT)}var Pf=class{constructor(e,r,n,i,o){this.context=e,this.width=r,this.height=n;let a=e.gl,s=this.framebuffer=a.createFramebuffer();if(this.colorAttachment=new bf(e,s),i)this.depthAttachment=o?new vf(e,s):new _f(e,s);else if(o)throw new Error("Stencil cannot be set without depth");if(a.checkFramebufferStatus(a.FRAMEBUFFER)!==a.FRAMEBUFFER_COMPLETE)throw eS()}destroy(){let e=this.context.gl,r=this.colorAttachment.get();if(r&&e.deleteTexture(r),this.depthAttachment){let n=this.depthAttachment.get();n&&e.deleteRenderbuffer(n)}e.deleteFramebuffer(this.framebuffer)}};var wf=class{constructor(e){var r,n;if(this.gl=e,this.clearColor=new Nh(this),this.clearDepth=new Gh(this),this.clearStencil=new jh(this),this.colorMask=new Hh(this),this.depthMask=new Xh(this),this.stencilMask=new Zh(this),this.stencilFunc=new qh(this),this.stencilOp=new Yh(this),this.stencilTest=new Wh(this),this.depthRange=new $h(this),this.depthTest=new Kh(this),this.depthFunc=new Jh(this),this.blend=new Qh(this),this.blendFunc=new ef(this),this.blendColor=new tf(this),this.blendEquation=new rf(this),this.cullFace=new nf(this),this.cullFaceSide=new of(this),this.frontFace=new af(this),this.program=new sf(this),this.activeTexture=new lf(this),this.viewport=new uf(this),this.bindFramebuffer=new cf(this),this.bindRenderbuffer=new pf(this),this.bindTexture=new hf(this),this.bindVertexBuffer=new ff(this),this.bindElementBuffer=new mf(this),this.bindVertexArray=new df(this),this.pixelStoreUnpack=new yf(this),this.pixelStoreUnpackPremultiplyAlpha=new gf(this),this.pixelStoreUnpackFlipY=new xf(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),Tr(e)){this.HALF_FLOAT=e.HALF_FLOAT;let i=e.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(r=e.RGBA16F)!=null?r: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,r){return new Vh(this,e,r)}createVertexBuffer(e,r,n){return new Uh(this,e,r,n)}createRenderbuffer(e,r,n){let i=this.gl,o=i.createRenderbuffer();return this.bindRenderbuffer.set(o),i.renderbufferStorage(i.RENDERBUFFER,e,r,n),this.bindRenderbuffer.set(null),o}createFramebuffer(e,r,n,i){return new Pf(this,e,r,n,i)}clear({color:e,depth:r,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 r<"u"&&(o|=i.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(r),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){Dr(e.blendFunction,De.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 Tr(this.gl)?this.gl.createVertexArray():(e=this.gl.getExtension("OES_vertex_array_object"))==null?void 0:e.createVertexArrayOES()}deleteVertexArray(e){var r;return Tr(this.gl)?this.gl.deleteVertexArray(e):(r=this.gl.getExtension("OES_vertex_array_object"))==null?void 0:r.deleteVertexArrayOES(e)}unbindVAO(){this.bindVertexArray.set(null)}};m();var Sf=se(fe(),1);m();var Tf;function dg(t,e,r,n,i){let o=t.context,a=t.transform,s=o.gl,l=t.useProgram("collisionBox"),u=[],c=0,p=0;for(let b=0;b<n.length;b++){let v=n[b],w=e.getTile(v).getBucket(r);if(!w)continue;let T=i?w.textCollisionBox:w.iconCollisionBox,S=w.collisionCircleArray;S.length>0&&(u.push({circleArray:S,circleOffset:p,coord:v}),c+=S.length/4,p=c),T&&l.draw(o,s.LINES,ne.disabled,pe.disabled,t.colorModeForRenderPass(),le.disabled,yT(t.transform),t.style.map.terrain&&t.style.map.terrain.getTerrainData(v),a.getProjectionData({overscaledTileID:v,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),r.id,T.layoutVertexBuffer,T.indexBuffer,T.segments,null,t.transform.zoom,null,null,T.collisionVertexBuffer)}if(!i||!u.length)return;let h=t.useProgram("collisionCircle"),f=new fp;f.resize(c*4),f._trim();let d=0;for(let b of u)for(let v=0;v<b.circleArray.length/4;v++){let P=v*4,w=b.circleArray[P+0],T=b.circleArray[P+1],S=b.circleArray[P+2],I=b.circleArray[P+3];f.emplace(d++,w,T,S,I,0),f.emplace(d++,w,T,S,I,1),f.emplace(d++,w,T,S,I,2),f.emplace(d++,w,T,S,I,3)}(!Tf||Tf.length<c*2)&&(Tf=tB(c));let g=o.createIndexBuffer(Tf,!0),x=o.createVertexBuffer(f,H0.members,!0);for(let b of u){let v=gT(t.transform);h.draw(o,s.TRIANGLES,ne.disabled,pe.disabled,t.colorModeForRenderPass(),le.disabled,v,t.style.map.terrain&&t.style.map.terrain.getTerrainData(b.coord),null,r.id,x,g,de.simpleSegment(0,b.circleOffset*2,b.circleArray.length,b.circleArray.length/2),null,t.transform.zoom,null,null,null)}x.destroy(),g.destroy()}function tB(t){let e=t*2,r=new dp;r.resize(e),r._trim();for(let n=0;n<e;n++){let i=n*6;r.uint16[i+0]=n*4+0,r.uint16[i+1]=n*4+1,r.uint16[i+2]=n*4+2,r.uint16[i+3]=n*4+2,r.uint16[i+4]=n*4+3,r.uint16[i+5]=n*4+0}return r}var rB=B.identity(new Float32Array(16));function nS(t,e,r,n,i,o){if(t.renderPass!=="translucent")return;let{isRenderingToTexture:a}=o,s=pe.disabled,l=t.colorModeForRenderPass();(r._unevaluatedLayout.hasValue("text-variable-anchor")||r._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&iB(n,t,r,e,r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),i),r.paint.get("icon-opacity").constantOr(1)!==0&&tS(t,e,r,n,!1,r.paint.get("icon-translate"),r.paint.get("icon-translate-anchor"),r.layout.get("icon-rotation-alignment"),r.layout.get("icon-pitch-alignment"),r.layout.get("icon-keep-upright"),s,l,a),r.paint.get("text-opacity").constantOr(1)!==0&&tS(t,e,r,n,!0,r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),r.layout.get("text-keep-upright"),s,l,a),e.map.showCollisionBoxes&&(dg(t,e,r,n,!0),dg(t,e,r,n,!1))}function nB(t,e,r,n,i,o){let{horizontalAlign:a,verticalAlign:s}=Up(t),l=-(a-.5)*e,u=-(s-.5)*r;return new Sf.default((l/i+n[0])*o,(u/i+n[1])*o)}function iB(t,e,r,n,i,o,a,s,l){let u=e.transform,c=e.style.map.terrain,p=i==="map",h=o==="map";for(let f of t){let d=n.getTile(f),g=d.getBucket(r);if(!g||!g.text||!g.text.segments.get().length)continue;let x=g.textSizeData,b=ho(x,u.zoom),v=gt(d,1,e.transform.zoom),P=Hl(p,e.transform,v),w=r.layout.get("icon-text-fit")!=="none"&&g.hasIconData();if(b){let T=Math.pow(2,u.zoom-d.tileID.overscaledZ),S=c?(M,E)=>c.getElevation(f,M,E):null,I=Wt(u,d,a,s);aB(g,p,h,l,u,P,T,b,w,I,f.toUnwrapped(),S)}}}function oB(t,e,r,n,i,o){let a=e.tileAnchorPoint.add(new Sf.default(e.translation[0],e.translation[1]));if(e.pitchWithMap){let s=n.mult(o);r||(s=s.rotate(-i));let l=a.add(s);return gh(l.x,l.y,e.pitchedLabelPlaneMatrix,e.getElevation).point}else if(r){let l=Pi(e.tileAnchorPoint.x+1,e.tileAnchorPoint.y,e).point.sub(t),u=Math.atan(l.y/l.x)+(l.x<0?Math.PI:0);return t.add(n.rotate(u))}else return t.add(n)}function aB(t,e,r,n,i,o,a,s,l,u,c,p){let h=t.text.placedSymbolArray,f=t.text.dynamicLayoutVertexArray,d=t.icon.dynamicLayoutVertexArray,g={};f.clear();for(let x=0;x<h.length;x++){let b=h.get(x),v=t.allowVerticalPlacement&&!b.placedOrientation,P=!b.hidden&&b.crossTileID&&!v?n[b.crossTileID]:null;if(!P)xo(b.numGlyphs,f);else{let w=new Sf.default(b.anchorX,b.anchorY),T={getElevation:p,width:i.width,height:i.height,pitchedLabelPlaneMatrix:o,lineVertexArray:null,pitchWithMap:r,transform:i,projectionCache:null,tileAnchorPoint:w,translation:u,unwrappedTileID:c},S=r?Uy(w.x,w.y,T):Pi(w.x,w.y,T),I=zy(i.cameraToCenterDistance,S.signedDistanceFromCamera),M=ma(t.textSizeData,s,b)*I/yi;r&&(M*=t.tilePixelRatio/a);let{width:E,height:L,anchor:k,textOffset:F,textBoxScale:z}=P,A=nB(k,E,L,F,z,M),R=i.getPitchedTextCorrection(w.x+u[0],w.y+u[1],c),H=oB(S.point,T,e,A,-i.bearingInRadians,R),W=t.allowVerticalPlacement&&b.placedOrientation===2?Math.PI/2:0;for(let $=0;$<b.numGlyphs;$++)fo(f,H,W);l&&b.associatedIconIndex>=0&&(g[b.associatedIconIndex]={shiftedAnchor:H,angle:W})}}if(l){d.clear();let x=t.icon.placedSymbolArray;for(let b=0;b<x.length;b++){let v=x.get(b);if(v.hidden)xo(v.numGlyphs,d);else{let P=g[b];if(!P)xo(v.numGlyphs,d);else for(let w=0;w<v.numGlyphs;w++)fo(d,P.shiftedAnchor,P.angle)}}t.icon.dynamicLayoutVertexBuffer.updateData(d)}t.text.dynamicLayoutVertexBuffer.updateData(f)}function sB(t,e,r){return r.iconsInText&&e?"symbolTextAndIcon":t?"symbolSDF":"symbolIcon"}function tS(t,e,r,n,i,o,a,s,l,u,c,p,h){let f=t.context,d=f.gl,g=t.transform,x=s==="map",b=l==="map",v=s!=="viewport"&&r.layout.get("symbol-placement")!=="point",P=x&&!b&&!v,w=!r.layout.get("symbol-sort-key").isConstant(),T=!1,S=t.getDepthModeForSublayer(0,ne.ReadOnly),I=r._unevaluatedLayout.hasValue("text-variable-anchor")||r._unevaluatedLayout.hasValue("text-variable-anchor-offset"),M=[],E=g.getCircleRadiusCorrection();for(let L of n){let k=e.getTile(L),F=k.getBucket(r);if(!F)continue;let z=i?F.text:F.icon;if(!z||!z.segments.get().length||!z.hasVisibleVertices)continue;let A=z.programConfigurations.get(r.id),R=i||F.sdfIcons,H=i?F.textSizeData:F.iconSizeData,W=b||g.pitch!==0,$=t.useProgram(sB(R,i,F),A),he=ho(H,g.zoom),Xe=t.style.map.terrain&&t.style.map.terrain.getTerrainData(L),be,ye=[0,0],qe,rt,Pt=null,ut;if(i){if(qe=k.glyphAtlasTexture,rt=d.LINEAR,be=k.glyphAtlasTexture.size,F.iconsInText){ye=k.imageAtlasTexture.size,Pt=k.imageAtlasTexture;let Ar=H.kind==="composite"||H.kind==="camera";ut=W||t.options.rotating||t.options.zooming||Ar?d.LINEAR:d.NEAREST}}else{let Ar=r.layout.get("icon-size").constantOr(0)!==1||F.iconsNeedLinear;qe=k.imageAtlasTexture,rt=R||t.options.rotating||t.options.zooming||Ar||W?d.LINEAR:d.NEAREST,be=k.imageAtlasTexture.size}let Vt=gt(k,1,t.transform.zoom),pr=Hl(x,t.transform,Vt),on=B.create();B.invert(on,pr);let hr=tP(b,x,t.transform,Vt),Mt=Wt(g,k,o,a),$a=g.getProjectionData({overscaledTileID:L,applyGlobeMatrix:!h,applyTerrainMatrix:!0}),Ro=I&&F.hasTextData(),Ri=r.layout.get("icon-text-fit")!=="none"&&Ro&&F.hasIconData();if(v){let Ar=t.style.map.terrain?(jr,vn)=>t.style.map.terrain.getElevation(L,jr,vn):null,It=r.layout.get("text-rotation-alignment")==="map";rP(F,t,i,pr,on,b,u,It,L.toUnwrapped(),g.width,g.height,Mt,Ar)}let _n=i&&I||Ri,ko=b?pr:t.transform.clipSpaceToPixelsMatrix,Zn=v||_n?rB:ko,Ir=R&&r.paint.get(i?"text-halo-width":"icon-halo-width").constantOr(1)!==0,Gr;R?F.iconsInText?Gr=NT(H.kind,he,P,b,v,_n,t,Zn,hr,Mt,be,ye,E):Gr=mg(H.kind,he,P,b,v,_n,t,Zn,hr,Mt,i,be,!0,E):Gr=fg(H.kind,he,P,b,v,_n,t,Zn,hr,Mt,i,be,E);let ki={program:$,buffers:z,uniformValues:Gr,projectionData:$a,atlasTexture:qe,atlasTextureIcon:Pt,atlasInterpolation:rt,atlasInterpolationIcon:ut,isSDF:R,hasHalo:Ir};if(w&&F.canOverlap){T=!0;let Ar=z.segments.get();for(let It of Ar)M.push({segments:new de([It]),sortKey:It.sortKey,state:ki,terrainData:Xe})}else M.push({segments:z.segments,sortKey:0,state:ki,terrainData:Xe})}T&&M.sort((L,k)=>L.sortKey-k.sortKey);for(let L of M){let k=L.state;if(f.activeTexture.set(d.TEXTURE0),k.atlasTexture.bind(k.atlasInterpolation,d.CLAMP_TO_EDGE),k.atlasTextureIcon&&(f.activeTexture.set(d.TEXTURE1),k.atlasTextureIcon&&k.atlasTextureIcon.bind(k.atlasInterpolationIcon,d.CLAMP_TO_EDGE)),k.isSDF){let F=k.uniformValues;k.hasHalo&&(F.u_is_halo=1,rS(k.buffers,L.segments,r,t,k.program,S,c,p,F,k.projectionData,L.terrainData)),F.u_is_halo=0}rS(k.buffers,L.segments,r,t,k.program,S,c,p,k.uniformValues,k.projectionData,L.terrainData)}}function rS(t,e,r,n,i,o,a,s,l,u,c){let p=n.context,h=p.gl;i.draw(p,h.TRIANGLES,o,a,s,le.backCCW,l,c,u,r.id,t.layoutVertexBuffer,t.indexBuffer,e,r.paint,n.transform.zoom,t.programConfigurations.get(r.id),t.dynamicLayoutVertexBuffer,t.opacityVertexBuffer)}m();function iS(t,e,r,n,i){if(t.renderPass!=="translucent")return;let{isRenderingToTexture:o}=i,a=r.paint.get("circle-opacity"),s=r.paint.get("circle-stroke-width"),l=r.paint.get("circle-stroke-opacity"),u=!r.layout.get("circle-sort-key").isConstant();if(a.constantOr(1)===0&&(s.constantOr(1)===0||l.constantOr(1)===0))return;let c=t.context,p=c.gl,h=t.transform,f=t.getDepthModeForSublayer(0,ne.ReadOnly),d=pe.disabled,g=t.colorModeForRenderPass(),x=[],b=h.getCircleRadiusCorrection();for(let v=0;v<n.length;v++){let P=n[v],w=e.getTile(P),T=w.getBucket(r);if(!T)continue;let S=r.paint.get("circle-translate"),I=r.paint.get("circle-translate-anchor"),M=Wt(h,w,S,I),E=T.programConfigurations.get(r.id),L=t.useProgram("circle",E),k=T.layoutVertexBuffer,F=T.indexBuffer,z=t.style.map.terrain&&t.style.map.terrain.getTerrainData(P),A=fT(t,w,r,M,b),R=h.getProjectionData({overscaledTileID:P,applyGlobeMatrix:!o,applyTerrainMatrix:!0}),H={programConfiguration:E,program:L,layoutVertexBuffer:k,indexBuffer:F,uniformValues:A,terrainData:z,projectionData:R};if(u){let W=T.segments.get();for(let $ of W)x.push({segments:new de([$]),sortKey:$.sortKey,state:H})}else x.push({segments:T.segments,sortKey:0,state:H})}u&&x.sort((v,P)=>v.sortKey-P.sortKey);for(let v of x){let{programConfiguration:P,program:w,layoutVertexBuffer:T,indexBuffer:S,uniformValues:I,terrainData:M,projectionData:E}=v.state,L=v.segments;w.draw(c,p.TRIANGLES,f,d,g,le.backCCW,I,M,E,r.id,T,S,L,r.paint,t.transform.zoom,P)}}m();function oS(t,e,r,n,i){if(r.paint.get("heatmap-opacity")===0)return;let o=t.context,{isRenderingToTexture:a,isRenderingGlobe:s}=i;if(t.style.map.terrain){for(let l of n){let u=e.getTile(l);e.hasRenderableParent(l)||(t.renderPass==="offscreen"?cB(t,u,r,l,s):t.renderPass==="translucent"&&pB(t,r,l,a,s))}o.viewport.set([0,0,t.width,t.height])}else t.renderPass==="offscreen"?lB(t,e,r,n):t.renderPass==="translucent"&&uB(t,r)}function lB(t,e,r,n){let i=t.context,o=i.gl,a=t.transform,s=pe.disabled,l=new De([o.ONE,o.ONE],K.transparent,[!0,!0,!0,!0]);hB(i,t,r),i.clear({color:K.transparent});for(let u=0;u<n.length;u++){let c=n[u];if(e.hasRenderableParent(c))continue;let p=e.getTile(c),h=p.getBucket(r);if(!h)continue;let f=h.programConfigurations.get(r.id),d=t.useProgram("heatmap",f),g=a.getProjectionData({overscaledTileID:c,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),x=a.getCircleRadiusCorrection();d.draw(i,o.TRIANGLES,ne.disabled,s,l,le.backCCW,pg(p,a.zoom,r.paint.get("heatmap-intensity"),x),null,g,r.id,h.layoutVertexBuffer,h.indexBuffer,h.segments,r.paint,a.zoom,f)}i.viewport.set([0,0,t.width,t.height])}function uB(t,e){let r=t.context,n=r.gl;r.setColorMode(t.colorModeForRenderPass());let i=e.heatmapFbos.get(oa);if(!i)return;r.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,i.colorAttachment.get()),r.activeTexture.set(n.TEXTURE1),sS(r,e).bind(n.LINEAR,n.CLAMP_TO_EDGE),t.useProgram("heatmapTexture").draw(r,n.TRIANGLES,ne.disabled,pe.disabled,t.colorModeForRenderPass(),le.disabled,hg(t,e,0,1),null,null,e.id,t.viewportBuffer,t.quadTriangleIndexBuffer,t.viewportSegments,e.paint,t.transform.zoom)}function cB(t,e,r,n,i){let o=t.context,a=o.gl,s=pe.disabled,l=new De([a.ONE,a.ONE],K.transparent,[!0,!0,!0,!0]),u=e.getBucket(r);if(!u)return;let c=n.key,p=r.heatmapFbos.get(c);p||(p=aS(o,e.tileSize,e.tileSize),r.heatmapFbos.set(c,p)),o.bindFramebuffer.set(p.framebuffer),o.viewport.set([0,0,e.tileSize,e.tileSize]),o.clear({color:K.transparent});let h=u.programConfigurations.get(r.id),f=t.useProgram("heatmap",h,!i),d=t.transform.getProjectionData({overscaledTileID:e.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),g=t.style.map.terrain.getTerrainData(n);f.draw(o,a.TRIANGLES,ne.disabled,s,l,le.disabled,pg(e,t.transform.zoom,r.paint.get("heatmap-intensity"),1),g,d,r.id,u.layoutVertexBuffer,u.indexBuffer,u.segments,r.paint,t.transform.zoom,h)}function pB(t,e,r,n,i){let o=t.context,a=o.gl,s=t.transform;o.setColorMode(t.colorModeForRenderPass());let l=sS(o,e),u=r.key,c=e.heatmapFbos.get(u);if(!c)return;o.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,c.colorAttachment.get()),o.activeTexture.set(a.TEXTURE1),l.bind(a.LINEAR,a.CLAMP_TO_EDGE);let p=s.getProjectionData({overscaledTileID:r,applyTerrainMatrix:i,applyGlobeMatrix:!n});t.useProgram("heatmapTexture").draw(o,a.TRIANGLES,ne.disabled,pe.disabled,t.colorModeForRenderPass(),le.disabled,hg(t,e,0,1),null,p,e.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments,e.paint,s.zoom),c.destroy(),e.heatmapFbos.delete(u)}function hB(t,e,r){let n=t.gl;t.activeTexture.set(n.TEXTURE1),t.viewport.set([0,0,e.width/4,e.height/4]);let i=r.heatmapFbos.get(oa);i?(n.bindTexture(n.TEXTURE_2D,i.colorAttachment.get()),t.bindFramebuffer.set(i.framebuffer)):(i=aS(t,e.width/4,e.height/4),r.heatmapFbos.set(oa,i))}function aS(t,e,r){var l,u;let n=t.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=(l=t.HALF_FLOAT)!=null?l:n.UNSIGNED_BYTE,a=(u=t.RGBA16F)!=null?u:n.RGBA;n.texImage2D(n.TEXTURE_2D,0,a,e,r,0,n.RGBA,o,null);let s=t.createFramebuffer(e,r,!1,!1);return s.colorAttachment.set(i),s}function sS(t,e){return e.colorRampTexture||(e.colorRampTexture=new Se(t,e.colorRamp,t.gl.RGBA)),e.colorRampTexture}m();function lS(t,e,r,n,i){if(t.renderPass!=="translucent")return;let{isRenderingToTexture:o}=i,a=r.paint.get("line-opacity"),s=r.paint.get("line-width");if(a.constantOr(1)===0||s.constantOr(1)===0)return;let l=t.getDepthModeForSublayer(0,ne.ReadOnly),u=t.colorModeForRenderPass(),c=r.paint.get("line-dasharray"),p=r.paint.get("line-pattern"),h=p.constantOr(1),f=r.paint.get("line-gradient"),d=r.getCrossfadeParameters(),g=h?"linePattern":c?"lineSDF":f?"lineGradient":"line",x=t.context,b=x.gl,v=t.transform,P=!0;for(let w of n){let T=e.getTile(w);if(h&&!T.patternsLoaded())continue;let S=T.getBucket(r);if(!S)continue;let I=S.programConfigurations.get(r.id),M=t.context.program.get(),E=t.useProgram(g,I),L=P||E.program!==M,k=t.style.map.terrain&&t.style.map.terrain.getTerrainData(w),F=p.constantOr(null);if(F&&T.imageAtlas){let W=T.imageAtlas,$=W.patternPositions[F.to.toString()],he=W.patternPositions[F.from.toString()];$&&he&&I.setConstantPatternPositions($,he)}let z=v.getProjectionData({overscaledTileID:w,applyGlobeMatrix:!o,applyTerrainMatrix:!0}),A=v.getPixelScale(),R=h?DT(t,T,r,A,d):c?RT(t,T,r,A,c,d):f?LT(t,T,r,A,S.lineClipsArray.length):zh(t,T,r,A);if(h)x.activeTexture.set(b.TEXTURE0),T.imageAtlasTexture.bind(b.LINEAR,b.CLAMP_TO_EDGE),I.updatePaintBuffers(d);else if(c&&(L||t.lineAtlas.dirty))x.activeTexture.set(b.TEXTURE0),t.lineAtlas.bind(x);else if(f){let W=S.gradients[r.id],$=W.texture;if(r.gradientVersion!==W.version){let he=256;if(r.stepInterpolant){let Xe=e.getSource().maxzoom,be=w.canonical.z===Xe?Math.ceil(1<<t.transform.maxZoom-w.canonical.z):1,rt=S.maxLineLength/8192*1024*be;he=ce(Nb(rt),256,x.maxTextureSize)}W.gradient=wp({expression:r.gradientExpression(),evaluationKey:"lineProgress",resolution:he,image:W.gradient||void 0,clips:S.lineClipsArray}),W.texture?W.texture.update(W.gradient):W.texture=new Se(x,W.gradient,b.RGBA),W.version=r.gradientVersion,$=W.texture}x.activeTexture.set(b.TEXTURE0),$.bind(r.stepInterpolant?b.NEAREST:b.LINEAR,b.CLAMP_TO_EDGE)}let H=t.stencilModeForClipping(w);E.draw(x,b.TRIANGLES,l,H,u,le.disabled,R,k,z,r.id,S.layoutVertexBuffer,S.indexBuffer,S.segments,r.paint,t.transform.zoom,I,S.layoutVertexBuffer2),P=!1}}m();m();function Cf(t,e,r,n,i){if(!r||!n||!n.imageAtlas)return;let o=n.imageAtlas.patternPositions,a=o[r.to.toString()],s=o[r.from.toString()];if(!a&&s&&(a=s),!s&&a&&(s=a),!a||!s){let l=i.getPaintProperty(e);a=o[l],s=o[l]}a&&s&&t.setConstantPatternPositions(a,s)}function cS(t,e,r,n,i){let o=r.paint.get("fill-color"),a=r.paint.get("fill-opacity");if(a.constantOr(1)===0)return;let{isRenderingToTexture:s}=i,l=t.colorModeForRenderPass(),u=r.paint.get("fill-pattern"),c=t.opaquePassEnabledForLayer()&&!u.constantOr(1)&&o.constantOr(K.transparent).a===1&&a.constantOr(0)===1?"opaque":"translucent";if(t.renderPass===c){let p=t.getDepthModeForSublayer(1,t.renderPass==="opaque"?ne.ReadWrite:ne.ReadOnly);uS(t,e,r,n,p,l,!1,s)}if(t.renderPass==="translucent"&&r.paint.get("fill-antialias")){let p=t.getDepthModeForSublayer(r.getPaintProperty("fill-outline-color")?2:0,ne.ReadOnly);uS(t,e,r,n,p,l,!0,s)}}function uS(t,e,r,n,i,o,a,s){let l=t.context.gl,u="fill-pattern",c=r.paint.get(u),p=c&&c.constantOr(1),h=r.getCrossfadeParameters(),f,d,g,x,b,v=t.transform,P=r.paint.get("fill-translate"),w=r.paint.get("fill-translate-anchor");a?(d=p&&!r.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",f=l.LINES):(d=p?"fillPattern":"fill",f=l.TRIANGLES);let T=c.constantOr(null);for(let S of n){let I=e.getTile(S);if(p&&!I.patternsLoaded())continue;let M=I.getBucket(r);if(!M)continue;let E=M.programConfigurations.get(r.id),L=t.useProgram(d,E),k=t.style.map.terrain&&t.style.map.terrain.getTerrainData(S);p&&(t.context.activeTexture.set(l.TEXTURE0),I.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),E.updatePaintBuffers(h)),Cf(E,u,T,I,r);let F=v.getProjectionData({overscaledTileID:S,applyGlobeMatrix:!s,applyTerrainMatrix:!0}),z=Wt(v,I,P,w);if(!a)x=M.indexBuffer,b=M.segments,g=p?ug(t,h,I,z):uT(z);else{x=M.indexBuffer2,b=M.segments2;let R=[l.drawingBufferWidth,l.drawingBufferHeight];g=d==="fillOutlinePattern"&&p?pT(t,h,I,R,z):cT(R,z)}let A=t.stencilModeForClipping(S);L.draw(t.context,f,i,A,o,le.backCCW,g,k,F,r.id,M.layoutVertexBuffer,x,b,r.paint,t.transform.zoom,E)}}m();function pS(t,e,r,n,i){let o=r.paint.get("fill-extrusion-opacity");if(o===0)return;let{isRenderingToTexture:a}=i;if(t.renderPass==="translucent"){let s=new ne(t.context.gl.LEQUAL,ne.ReadWrite,t.depthRangeFor3D);if(o===1&&!r.paint.get("fill-extrusion-pattern").constantOr(1)){let l=t.colorModeForRenderPass();yg(t,e,r,n,s,pe.disabled,l,a)}else yg(t,e,r,n,s,pe.disabled,De.disabled,a),yg(t,e,r,n,s,t.stencilModeFor3D(),t.colorModeForRenderPass(),a)}}function yg(t,e,r,n,i,o,a,s){let l=t.context,u=l.gl,c="fill-extrusion-pattern",p=r.paint.get(c),h=p.constantOr(1),f=r.getCrossfadeParameters(),d=r.paint.get("fill-extrusion-opacity"),g=p.constantOr(null),x=t.transform;for(let b of n){let v=e.getTile(b),P=v.getBucket(r);if(!P)continue;let w=t.style.map.terrain&&t.style.map.terrain.getTerrainData(b),T=P.programConfigurations.get(r.id),S=t.useProgram(h?"fillExtrusionPattern":"fillExtrusion",T);h&&(t.context.activeTexture.set(u.TEXTURE0),v.imageAtlasTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE),T.updatePaintBuffers(f));let I=x.getProjectionData({overscaledTileID:b,applyGlobeMatrix:!s,applyTerrainMatrix:!0});Cf(T,c,g,v,r);let M=Wt(x,v,r.paint.get("fill-extrusion-translate"),r.paint.get("fill-extrusion-translate-anchor")),E=r.paint.get("fill-extrusion-vertical-gradient"),L=h?iT(t,E,d,M,b,f,v):lg(t,E,d,M);S.draw(l,l.gl.TRIANGLES,i,o,a,le.backCCW,L,w,I,r.id,P.layoutVertexBuffer,P.indexBuffer,P.segments,r.paint,t.transform.zoom,T,t.style.map.terrain&&P.centroidVertexBuffer)}}m();function hS(t,e,r,n,i){if(t.renderPass!=="offscreen"&&t.renderPass!=="translucent")return;let{isRenderingToTexture:o}=i,a=t.context,l=t.style.projection.useSubdivision,u=t.getDepthModeForSublayer(0,ne.ReadOnly),c=t.colorModeForRenderPass();if(t.renderPass==="offscreen")fB(t,e,n,r,u,pe.disabled,c),a.viewport.set([0,0,t.width,t.height]);else if(t.renderPass==="translucent")if(l){let[p,h,f]=t.stencilConfigForOverlapTwoPass(n);gg(t,e,r,f,p,u,c,!1,o),gg(t,e,r,f,h,u,c,!0,o)}else{let[p,h]=t.getStencilConfigForOverlapAndUpdateStencilID(n);gg(t,e,r,h,p,u,c,!1,o)}}function gg(t,e,r,n,i,o,a,s,l){var x;let u=t.style.projection,c=t.context,p=t.transform,h=c.gl,f=["#define NUM_ILLUMINATION_SOURCES ".concat(r.paint.get("hillshade-highlight-color").values.length)],d=t.useProgram("hillshade",null,!1,f),g=!t.options.moving;for(let b of n){let v=e.getTile(b),P=v.fbo;if(!P)continue;let w=u.getMeshFromTileID(c,b.canonical,s,!0,"raster"),T=(x=t.style.map.terrain)==null?void 0:x.getTerrainData(b);c.activeTexture.set(h.TEXTURE0),h.bindTexture(h.TEXTURE_2D,P.colorAttachment.get());let S=p.getProjectionData({overscaledTileID:b,aligned:g,applyGlobeMatrix:!l,applyTerrainMatrix:!0});d.draw(c,h.TRIANGLES,o,i[b.overscaledZ],a,le.backCCW,wT(t,v,r),T,S,r.id,w.vertexBuffer,w.indexBuffer,w.segments)}}function fB(t,e,r,n,i,o,a){let s=t.context,l=s.gl;for(let u of r){let c=e.getTile(u),p=c.dem;if(!p||!p.data||!c.needsHillshadePrepare)continue;let h=p.dim,f=p.stride,d=p.getPixels();if(s.activeTexture.set(l.TEXTURE1),s.pixelStoreUnpackPremultiplyAlpha.set(!1),c.demTexture=c.demTexture||t.getTileTexture(f),c.demTexture){let x=c.demTexture;x.update(d,{premultiply:!1}),x.bind(l.NEAREST,l.CLAMP_TO_EDGE)}else c.demTexture=new Se(s,d,l.RGBA,{premultiply:!1}),c.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE);s.activeTexture.set(l.TEXTURE0);let g=c.fbo;if(!g){let x=new Se(s,{width:h,height:h,data:null},l.RGBA);x.bind(l.LINEAR,l.CLAMP_TO_EDGE),g=c.fbo=s.createFramebuffer(h,h,!0,!1),g.colorAttachment.set(x.texture)}s.bindFramebuffer.set(g.framebuffer),s.viewport.set([0,0,h,h]),t.useProgram("hillshadePrepare").draw(s,l.TRIANGLES,i,o,a,le.disabled,TT(c.tileID,p),null,null,n.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments),c.needsHillshadePrepare=!1}}m();function fS(t,e,r,n,i){if(t.renderPass!=="translucent"||!n.length)return;let{isRenderingToTexture:o}=i,s=t.style.projection.useSubdivision,l=t.getDepthModeForSublayer(0,ne.ReadOnly),u=t.colorModeForRenderPass();if(s){let[c,p,h]=t.stencilConfigForOverlapTwoPass(n);xg(t,e,r,h,c,l,u,!1,o),xg(t,e,r,h,p,l,u,!0,o)}else{let[c,p]=t.getStencilConfigForOverlapAndUpdateStencilID(n);xg(t,e,r,p,c,l,u,!1,o)}}function xg(t,e,r,n,i,o,a,s,l){var x;let u=t.style.projection,c=t.context,p=t.transform,h=c.gl,f=t.useProgram("colorRelief"),d=!t.options.moving,g=!0;for(let b of n){let v=e.getTile(b),P=v.dem;if(g){let E=h.getParameter(h.MAX_TEXTURE_SIZE),{elevationTexture:L,colorTexture:k}=r.getColorRampTextures(c,E,P.getUnpackVector());c.activeTexture.set(h.TEXTURE1),L.bind(h.NEAREST,h.CLAMP_TO_EDGE),c.activeTexture.set(h.TEXTURE4),k.bind(h.LINEAR,h.CLAMP_TO_EDGE),g=!1}if(!P||!P.data)continue;let w=P.stride,T=P.getPixels();if(c.activeTexture.set(h.TEXTURE0),c.pixelStoreUnpackPremultiplyAlpha.set(!1),v.demTexture=v.demTexture||t.getTileTexture(w),v.demTexture){let E=v.demTexture;E.update(T,{premultiply:!1}),E.bind(h.LINEAR,h.CLAMP_TO_EDGE)}else v.demTexture=new Se(c,T,h.RGBA,{premultiply:!1}),v.demTexture.bind(h.LINEAR,h.CLAMP_TO_EDGE);let S=u.getMeshFromTileID(c,b.canonical,s,!0,"raster"),I=(x=t.style.map.terrain)==null?void 0:x.getTerrainData(b),M=p.getProjectionData({overscaledTileID:b,aligned:d,applyGlobeMatrix:!l,applyTerrainMatrix:!0});f.draw(c,h.TRIANGLES,o,i[b.overscaledZ],a,le.backCCW,CT(r,v.dem),I,M,r.id,S.vertexBuffer,S.indexBuffer,S.segments)}}m();var iu=se(fe(),1),bg=[new iu.default(0,0),new iu.default(8192,0),new iu.default(8192,8192),new iu.default(0,8192)];function mS(t,e,r,n,i){if(t.renderPass!=="translucent"||r.paint.get("raster-opacity")===0||!n.length)return;let{isRenderingToTexture:o}=i,a=e.getSource(),l=t.style.projection.useSubdivision;if(a instanceof vr)Mf(t,e,r,n,null,!1,!1,a.tileCoords,a.flippedWindingOrder,o);else if(l){let[u,c,p]=t.stencilConfigForOverlapTwoPass(n);Mf(t,e,r,p,u,!1,!0,bg,!1,o),Mf(t,e,r,p,c,!0,!0,bg,!1,o)}else{let[u,c]=t.getStencilConfigForOverlapAndUpdateStencilID(n);Mf(t,e,r,c,u,!1,!0,bg,!1,o)}}function Mf(t,e,r,n,i,o,a,s,l=!1,u=!1){let c=n[n.length-1].overscaledZ,p=t.context,h=p.gl,f=t.useProgram("raster"),d=t.transform,g=t.style.projection,x=t.colorModeForRenderPass(),b=!t.options.moving;for(let v of n){let P=t.getDepthModeForSublayer(v.overscaledZ-c,r.paint.get("raster-opacity")===1?ne.ReadWrite:ne.ReadOnly,h.LESS),w=e.getTile(v);w.registerFadeDuration(r.paint.get("raster-fade-duration"));let T=e.findLoadedParent(v,0),S=e.findLoadedSibling(v),M=mB(w,T||S||null,e,r,t.transform,t.style.map.terrain),E,L,k=r.paint.get("raster-resampling")==="nearest"?h.NEAREST:h.LINEAR;p.activeTexture.set(h.TEXTURE0),w.texture.bind(k,h.CLAMP_TO_EDGE,h.LINEAR_MIPMAP_NEAREST),p.activeTexture.set(h.TEXTURE1),T?(T.texture.bind(k,h.CLAMP_TO_EDGE,h.LINEAR_MIPMAP_NEAREST),E=Math.pow(2,T.tileID.overscaledZ-w.tileID.overscaledZ),L=[w.tileID.canonical.x*E%1,w.tileID.canonical.y*E%1]):w.texture.bind(k,h.CLAMP_TO_EDGE,h.LINEAR_MIPMAP_NEAREST),w.texture.useMipmap&&p.extTextureFilterAnisotropic&&t.transform.pitch>20&&h.texParameterf(h.TEXTURE_2D,p.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,p.extTextureFilterAnisotropicMax);let F=t.style.map.terrain&&t.style.map.terrain.getTerrainData(v),z=d.getProjectionData({overscaledTileID:v,aligned:b,applyGlobeMatrix:!u,applyTerrainMatrix:!0}),A=BT(L||[0,0],E||1,M,r,s),R=g.getMeshFromTileID(p,v.canonical,o,a,"raster"),H=i?i[v.overscaledZ]:pe.disabled;f.draw(p,h.TRIANGLES,P,H,x,l?le.frontCCW:le.backCCW,A,F,z,r.id,R.vertexBuffer,R.indexBuffer,R.segments)}}function mB(t,e,r,n,i,o){let a=n.paint.get("raster-fade-duration");if(!o&&a>0){let s=ae.now(),l=(s-t.timeAdded)/a,u=e?(s-e.timeAdded)/a:-1,c=r.getSource(),p=go(i,{tileSize:c.tileSize,roundZoom:c.roundZoom}),h=!e||Math.abs(e.tileID.overscaledZ-p)>Math.abs(t.tileID.overscaledZ-p),f=h&&t.refreshedUponExpiration?1:ce(h?l:1-u,0,1);return t.refreshedUponExpiration&&l>=1&&(t.refreshedUponExpiration=!1),e?{opacity:1,mix:1-f}:{opacity:f,mix:0}}else return{opacity:1,mix:0}}m();function dS(t,e,r,n,i){let o=r.paint.get("background-color"),a=r.paint.get("background-opacity");if(a===0)return;let{isRenderingToTexture:s}=i,l=t.context,u=l.gl,c=t.style.projection,p=t.transform,h=p.tileSize,f=r.paint.get("background-pattern");if(t.isPatternMissing(f))return;let d=!f&&o.a===1&&a===1&&t.opaquePassEnabledForLayer()?"opaque":"translucent";if(t.renderPass!==d)return;let g=pe.disabled,x=t.getDepthModeForSublayer(0,d==="opaque"?ne.ReadWrite:ne.ReadOnly),b=t.colorModeForRenderPass(),v=t.useProgram(f?"backgroundPattern":"background"),P=n||vi(p,{tileSize:h,terrain:t.style.map.terrain});f&&(l.activeTexture.set(u.TEXTURE0),t.imageManager.bind(t.context));let w=r.getCrossfadeParameters();for(let T of P){let S=p.getProjectionData({overscaledTileID:T,applyGlobeMatrix:!s,applyTerrainMatrix:!0}),I=f?XT(a,t,f,{tileID:T,tileSize:h},w):HT(a,o),M=t.style.map.terrain&&t.style.map.terrain.getTerrainData(T),E=c.getMeshFromTileID(l,T.canonical,!1,!0,"raster");v.draw(l,u.TRIANGLES,x,g,b,le.backCCW,I,M,S,r.id,E.vertexBuffer,E.indexBuffer,E.segments)}}m();var dB=new K(1,0,0,1),yB=new K(0,1,0,1),gB=new K(0,0,1,1),xB=new K(1,0,1,1),bB=new K(0,1,1,1);function xS(t){let e=t.transform.padding,r=3;yS(t,t.transform.height-(e.top||0),r,dB),yS(t,e.bottom||0,r,yB),gS(t,e.left||0,r,gB),gS(t,t.transform.width-(e.right||0),r,xB);let n=t.transform.centerPoint;_B(t,n.x,t.transform.height-n.y,bB)}function _B(t,e,r,n){If(t,e-2/2,r-20/2,2,20,n),If(t,e-20/2,r-2/2,20,2,n)}function yS(t,e,r,n){If(t,0,e+r/2,t.transform.width,r,n)}function gS(t,e,r,n){If(t,e-r/2,0,r,t.transform.height,n)}function If(t,e,r,n,i,o){let a=t.context,s=a.gl;s.enable(s.SCISSOR_TEST),s.scissor(e*t.pixelRatio,r*t.pixelRatio,n*t.pixelRatio,i*t.pixelRatio),a.clear({color:o}),s.disable(s.SCISSOR_TEST)}function bS(t,e,r){for(let n=0;n<r.length;n++)vB(t,e,r[n])}function vB(t,e,r){let n=t.context,i=n.gl,o=t.useProgram("debug"),a=ne.disabled,s=pe.disabled,l=t.colorModeForRenderPass(),u="$debug",c=t.style.map.terrain&&t.style.map.terrain.getTerrainData(r);n.activeTexture.set(i.TEXTURE0);let p=e.getTileByID(r.key).latestRawTileData,h=p&&p.byteLength||0,f=Math.floor(h/1024),d=e.getTile(r).tileSize,g=512/Math.min(d,512)*(r.overscaledZ/t.transform.zoom)*.5,x=r.canonical.toString();r.overscaledZ!==r.canonical.z&&(x+=" => ".concat(r.overscaledZ));let b="".concat(x," ").concat(f,"kB");PB(t,b);let v=t.transform.getProjectionData({overscaledTileID:r,applyGlobeMatrix:!0,applyTerrainMatrix:!0});o.draw(n,i.TRIANGLES,a,s,De.alphaBlended,le.disabled,cg(K.transparent,g),null,v,u,t.debugBuffer,t.quadTriangleIndexBuffer,t.debugSegments),o.draw(n,i.LINE_STRIP,a,s,l,le.disabled,cg(K.red),c,v,u,t.debugBuffer,t.tileBorderIndexBuffer,t.debugSegments)}function PB(t,e){t.initDebugOverlayCanvas();let r=t.debugOverlayCanvas,n=t.context.gl,i=t.debugOverlayCanvas.getContext("2d");i.clearRect(0,0,r.width,r.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),t.debugOverlayTexture.update(r),t.debugOverlayTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}function _S(t,e){let r=null,i=Object.values(t._layers).flatMap(l=>l.source&&!l.isHidden(e)?[t.sourceCaches[l.source]]:[]),o=i.filter(l=>l.getSource().type==="vector"),a=i.filter(l=>l.getSource().type!=="vector"),s=l=>{(!r||r.getSource().maxzoom<l.getSource().maxzoom)&&(r=l)};return o.forEach(l=>s(l)),r||a.forEach(l=>s(l)),r}m();function vS(t,e,r,n){let{isRenderingGlobe:i}=n,o=t.context,a=r.implementation,s=t.style.projection,l=t.transform,u=l.getProjectionDataForCustomLayer(i),c={farZ:l.farZ,nearZ:l.nearZ,fov:l.fov*Math.PI/180,modelViewProjectionMatrix:l.modelViewProjectionMatrix,projectionMatrix:l.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:u},p=a.renderingMode?a.renderingMode:"2d";if(t.renderPass==="offscreen"){let h=a.prerender;h&&(t.setCustomLayerDefaults(),o.setColorMode(t.colorModeForRenderPass()),h.call(a,o.gl,c),o.setDirty(),t.setBaseState())}else if(t.renderPass==="translucent"){t.setCustomLayerDefaults(),o.setColorMode(t.colorModeForRenderPass()),o.setStencilMode(pe.disabled);let h=p==="3d"?t.getDepthModeFor3D():t.getDepthModeForSublayer(0,ne.ReadOnly);o.setDepthMode(h),a.render(o.gl,c),o.setDirty(),t.setBaseState(),o.bindFramebuffer.set(null)}}m();function PS(t,e){let r=t.context,n=r.gl,i=t.transform,o=De.unblended,a=new ne(n.LEQUAL,ne.ReadWrite,[0,1]),s=e.sourceCache.getRenderableTiles(),l=t.useProgram("terrainDepth");r.bindFramebuffer.set(e.getFramebuffer("depth").framebuffer),r.viewport.set([0,0,t.width/devicePixelRatio,t.height/devicePixelRatio]),r.clear({color:K.transparent,depth:1});for(let u of s){let c=e.getTerrainMesh(u.tileID),p=e.getTerrainData(u.tileID),h=i.getProjectionData({overscaledTileID:u.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),f=Kw(e.getMeshFrameDelta(i.zoom));l.draw(r,n.TRIANGLES,a,pe.disabled,o,le.backCCW,f,p,h,"terrain",c.vertexBuffer,c.indexBuffer,c.segments)}r.bindFramebuffer.set(null),r.viewport.set([0,0,t.width,t.height])}function wS(t,e){let r=t.context,n=r.gl,i=t.transform,o=De.unblended,a=new ne(n.LEQUAL,ne.ReadWrite,[0,1]),s=e.getCoordsTexture(),l=e.sourceCache.getRenderableTiles(),u=t.useProgram("terrainCoords");r.bindFramebuffer.set(e.getFramebuffer("coords").framebuffer),r.viewport.set([0,0,t.width/devicePixelRatio,t.height/devicePixelRatio]),r.clear({color:K.transparent,depth:1}),e.coordsIndex=[];for(let c of l){let p=e.getTerrainMesh(c.tileID),h=e.getTerrainData(c.tileID);r.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,s.texture);let f=Jw(255-e.coordsIndex.length,e.getMeshFrameDelta(i.zoom)),d=i.getProjectionData({overscaledTileID:c.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});u.draw(r,n.TRIANGLES,a,pe.disabled,o,le.backCCW,f,h,d,"terrain",p.vertexBuffer,p.indexBuffer,p.segments),e.coordsIndex.push(c.tileID.key)}r.bindFramebuffer.set(null),r.viewport.set([0,0,t.width,t.height])}function _g(t,e,r,n){let{isRenderingGlobe:i}=n,o=t.context,a=o.gl,s=t.transform,l=t.colorModeForRenderPass(),u=t.getDepthModeFor3D(),c=t.useProgram("terrain");o.bindFramebuffer.set(null),o.viewport.set([0,0,t.width,t.height]);for(let p of r){let h=e.getTerrainMesh(p.tileID),f=t.renderToTexture.getTexture(p),d=e.getTerrainData(p.tileID);o.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,f.texture);let g=e.getMeshFrameDelta(s.zoom),x=s.calculateFogMatrix(p.tileID.toUnwrapped()),b=$w(g,x,t.style.sky,s.pitch,i),v=s.getProjectionData({overscaledTileID:p.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});c.draw(o,a.TRIANGLES,u,pe.disabled,l,le.backCCW,b,d,v,"terrain",h.vertexBuffer,h.indexBuffer,h.segments)}}m();function TS(t,e){if(!e.mesh){let r=new Dt;r.emplaceBack(-1,-1),r.emplaceBack(1,-1),r.emplaceBack(1,1),r.emplaceBack(-1,1);let n=new et;n.emplaceBack(0,1,2),n.emplaceBack(0,2,3),e.mesh=new sr(t.createVertexBuffer(r,wr.members),t.createIndexBuffer(n),de.simpleSegment(0,0,r.length,n.length))}return e.mesh}function SS(t,e){let r=t.context,n=r.gl,i=WT(e,t.style.map.transform,t.pixelRatio),o=new ne(n.LEQUAL,ne.ReadWrite,[0,1]),a=pe.disabled,s=t.colorModeForRenderPass(),l=t.useProgram("sky"),u=TS(r,e);l.draw(r,n.TRIANGLES,o,a,s,le.disabled,i,null,void 0,"sky",u.vertexBuffer,u.indexBuffer,u.segments)}function wB(t,e){let r=t.properties.get("position"),n=[-r.x,-r.y,-r.z],i=B.identity(new Float64Array(16));return t.properties.get("anchor")==="map"&&(B.rotateZ(i,i,e.rollInRadians),B.rotateX(i,i,-e.pitchInRadians),B.rotateZ(i,i,e.bearingInRadians),B.rotateX(i,i,e.center.lat*Math.PI/180),B.rotateY(i,i,-e.center.lng*Math.PI/180)),V.transformMat4(n,n,i),n}function CS(t,e,r){let n=t.context,i=n.gl,o=t.useProgram("atmosphere"),a=new ne(i.LEQUAL,ne.ReadOnly,[0,1]),s=t.transform,l=wB(r,t.transform),u=s.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),c=e.properties.get("atmosphere-blend")*u.projectionTransition;if(c===0)return;let p=vo(s.worldSize,s.center.lat),h=s.inverseProjectionMatrix,f=new Float64Array(4);f[3]=1,Ne.transformMat4(f,f,s.modelViewProjectionMatrix),f[0]/=f[3],f[1]/=f[3],f[2]/=f[3],f[3]=1,Ne.transformMat4(f,f,h),f[0]/=f[3],f[1]/=f[3],f[2]/=f[3],f[3]=1;let d=[f[0],f[1],f[2]],g=qT(l,c,d,p,h),x=TS(n,e);o.draw(n,i.TRIANGLES,a,pe.disabled,De.alphaBlended,le.disabled,g,null,null,"atmosphere",x.vertexBuffer,x.indexBuffer,x.segments)}var Af=class{constructor(e,r){this.context=new wf(e),this.transform=r,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:B.identity(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Fn.maxUnderzooming+Fn.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Sa}resize(e,r,n){if(this.width=Math.floor(e*n),this.height=Math.floor(r*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,r=new Dt;r.emplaceBack(0,0),r.emplaceBack(8192,0),r.emplaceBack(0,8192),r.emplaceBack(8192,8192),this.tileExtentBuffer=e.createVertexBuffer(r,wr.members),this.tileExtentSegments=de.simpleSegment(0,0,4,2);let n=new Dt;n.emplaceBack(0,0),n.emplaceBack(8192,0),n.emplaceBack(0,8192),n.emplaceBack(8192,8192),this.debugBuffer=e.createVertexBuffer(n,wr.members),this.debugSegments=de.simpleSegment(0,0,4,5);let i=new ip;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,Xw.members),this.rasterBoundsSegments=de.simpleSegment(0,0,4,2);let o=new Dt;o.emplaceBack(0,0),o.emplaceBack(8192,0),o.emplaceBack(0,8192),o.emplaceBack(8192,8192),this.rasterBoundsBufferPosOnly=e.createVertexBuffer(o,wr.members),this.rasterBoundsSegmentsPosOnly=de.simpleSegment(0,0,4,5);let a=new Dt;a.emplaceBack(0,0),a.emplaceBack(1,0),a.emplaceBack(0,1),a.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(a,wr.members),this.viewportSegments=de.simpleSegment(0,0,4,2);let s=new ll;s.emplaceBack(0),s.emplaceBack(1),s.emplaceBack(3),s.emplaceBack(2),s.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(s);let l=new et;l.emplaceBack(1,0,2),l.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(l);let u=this.context.gl;this.stencilClearMode=new pe({func:u.ALWAYS,mask:0},0,255,u.ZERO,u.ZERO,u.ZERO),this.tileExtentMesh=new sr(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){let e=this.context,r=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let n=B.create();B.ortho(n,0,this.width,this.height,0,0,1),B.scale(n,n,[r.drawingBufferWidth,r.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,r.TRIANGLES,ne.disabled,this.stencilClearMode,De.disabled,le.disabled,null,null,i,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(e,r,n){if(this.currentStencilSource===e.source||!e.isTileClipped()||!r||!r.length)return;this.currentStencilSource=e.source,this.nextStencilID+r.length>256&&this.clearStencil();let i=this.context;i.setColorMode(De.disabled),i.setDepthMode(ne.disabled);let o={};for(let a of r)o[a.key]=this.nextStencilID++;this._renderTileMasks(o,r,n,!0),this._renderTileMasks(o,r,n,!1),this._tileClippingMaskIDs=o}_renderTileMasks(e,r,n,i){let o=this.context,a=o.gl,s=this.style.projection,l=this.transform,u=this.useProgram("clippingMask");for(let c of r){let p=e[c.key],h=this.style.map.terrain&&this.style.map.terrain.getTerrainData(c),f=s.getMeshFromTileID(this.context,c.canonical,i,!0,"stencil"),d=l.getProjectionData({overscaledTileID:c,applyGlobeMatrix:!n,applyTerrainMatrix:!0});u.draw(o,a.TRIANGLES,ne.disabled,new pe({func:a.ALWAYS,mask:0},p,255,a.KEEP,a.KEEP,a.REPLACE),De.disabled,n?le.disabled:le.backCCW,null,h,d,"$clipping",f.vertexBuffer,f.indexBuffer,f.segments)}}_renderTilesDepthBuffer(){let e=this.context,r=e.gl,n=this.style.projection,i=this.transform,o=this.useProgram("depth"),a=this.getDepthModeFor3D(),s=vi(i,{tileSize:i.tileSize});for(let l of s){let u=this.style.map.terrain&&this.style.map.terrain.getTerrainData(l),c=n.getMeshFromTileID(this.context,l.canonical,!0,!0,"raster"),p=i.getProjectionData({overscaledTileID:l,applyGlobeMatrix:!0,applyTerrainMatrix:!0});o.draw(e,r.TRIANGLES,a,pe.disabled,De.disabled,le.backCCW,null,u,p,"$clipping",c.vertexBuffer,c.indexBuffer,c.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let e=this.nextStencilID++,r=this.context.gl;return new pe({func:r.NOTEQUAL,mask:255},e,255,r.KEEP,r.KEEP,r.REPLACE)}stencilModeForClipping(e){let r=this.context.gl;return new pe({func:r.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,r.KEEP,r.KEEP,r.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(e){let r=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 pe({func:r.GEQUAL,mask:255},s+this.nextStencilID,255,r.KEEP,r.KEEP,r.REPLACE);return this.nextStencilID+=o,[a,n]}return[{[i]:pe.disabled},n]}stencilConfigForOverlapTwoPass(e){let r=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 l=0;l<o;l++)a[l+i]=new pe({func:r.GREATER,mask:255},o+1+l,255,r.KEEP,r.KEEP,r.REPLACE),s[l+i]=new pe({func:r.GREATER,mask:255},1+l,255,r.KEEP,r.KEEP,r.REPLACE);return this.nextStencilID=o*2+1,[a,s,n]}else return this.nextStencilID=3,[{[i]:new pe({func:r.GREATER,mask:255},2,255,r.KEEP,r.KEEP,r.REPLACE)},{[i]:new pe({func:r.GREATER,mask:255},1,255,r.KEEP,r.KEEP,r.REPLACE)},n]}colorModeForRenderPass(){let e=this.context.gl;return this._showOverdrawInspector?new De([e.CONSTANT_COLOR,e.ONE],new K(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?De.unblended:De.alphaBlended}getDepthModeForSublayer(e,r,n){if(!this.opaquePassEnabledForLayer())return ne.disabled;let i=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new ne(n||this.context.gl.LEQUAL,r,[i,i])}getDepthModeFor3D(){return new ne(this.context.gl.LEQUAL,ne.ReadWrite,this.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(e,r){var c,p;this.style=e,this.options=r,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(ae.now()),this.imageManager.beginFrame();let n=this.style._order,i=this.style.sourceCaches,o={},a={},s={},l={isRenderingToTexture:!1,isRenderingGlobe:((c=e.projection)==null?void 0:c.transitionState)>0};for(let h in i){let f=i[h];f.used&&f.prepare(this.context),o[h]=f.getVisibleCoordinates(!1),a[h]=o[h].slice().reverse(),s[h]=f.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let h=0;h<n.length;h++){let f=n[h];if(this.style._layers[f].is3D()){this.opaquePassCutoff=h;break}}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(let h of n){let f=this.style._layers[h];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,l)}if((p=this.style.projection)==null||p.updateGPUdependent({context:this.context,useProgram:h=>this.useProgram(h)}),this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:r.showOverdrawInspector?K.black:K.transparent,depth:1}),this.clearStencil(),this.style.sky&&SS(this,this.style.sky),this._showOverdrawInspector=r.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 h=this.style._layers[n[this.currentLayer]],f=i[h.source],d=o[h.source];this._renderTileClippingMasks(h,d,!1),this.renderLayer(this,f,h,d,l)}this.renderPass="translucent";let u=!1;for(this.currentLayer=0;this.currentLayer<n.length;this.currentLayer++){let h=this.style._layers[n[this.currentLayer]],f=i[h.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(h,l))continue;!this.opaquePassEnabledForLayer()&&!u&&(u=!0,l.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());let d=(h.type==="symbol"?s:a)[h.source];this._renderTileClippingMasks(h,o[h.source],!!this.renderToTexture),this.renderLayer(this,f,h,d,l)}if(l.isRenderingGlobe&&CS(this,this.style.sky,this.style.light),this.options.showTileBoundaries){let h=_S(this.style,this.transform.zoom);h&&bS(this,h,h.getVisibleCoordinates())}this.options.showPadding&&xS(this),this.context.setDefault()}maybeDrawDepthAndCoords(e){if(!this.style||!this.style.map||!this.style.map.terrain)return;let r=this.terrainFacilitator.matrix,n=this.transform.modelViewProjectionMatrix,i=this.terrainFacilitator.dirty;i||(i=e?!B.exactEquals(r,n):!B.equals(r,n)),i||(i=this.style.map.terrain.sourceCache.anyTilesAfterTime(this.terrainFacilitator.renderTime)),i&&(B.copy(r,n),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,PS(this,this.style.map.terrain),wS(this,this.style.map.terrain))}renderLayer(e,r,n,i,o){n.isHidden(this.transform.zoom)||n.type!=="background"&&n.type!=="custom"&&!(i||[]).length||(this.id=n.id,c1(n)?nS(e,r,n,i,this.style.placement.variableOffsets,o):$v(n)?iS(e,r,n,i,o):t0(n)?oS(e,r,n,i,o):U0(n)?lS(e,r,n,i,o):g0(n)?cS(e,r,n,i,o):E0(n)?pS(e,r,n,i,o):i0(n)?hS(e,r,n,i,o):s0(n)?fS(e,r,n,i,o):y1(n)?mS(e,r,n,i,o):f1(n)?dS(e,r,n,i,o):x1(n)&&vS(e,r,n,o))}saveTileTexture(e){let r=this._tileTextures[e.size[0]];r?r.push(e):this._tileTextures[e.size[0]]=[e]}getTileTexture(e){let r=this._tileTextures[e];return r&&r.length>0?r.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;let r=this.imageManager.getPattern(e.from.toString()),n=this.imageManager.getPattern(e.to.toString());return!r||!n}useProgram(e,r,n=!1,i=[]){this.cache=this.cache||{};let o=!!this.style.map.terrain,a=this.style.projection,s=n?ar.projectionMercator:a.shaderPreludeCode,l=n?Jy:a.shaderDefine,u="/".concat(n?Qy:a.shaderVariantName),c=r?r.cacheKey:"",p=this._showOverdrawInspector?"/overdraw":"",h=o?"/terrain":"",f=i?"/".concat(i.join("/")):"",d=e+c+u+p+h+f;return this.cache[d]||(this.cache[d]=new Oh(this.context,ar[e],r,KT[e],this._showOverdrawInspector,o,s,l,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 Se(this.context,this.debugOverlayCanvas,e.RGBA)}}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){let{drawingBufferWidth:e,drawingBufferHeight:r}=this.context.gl;return this.width!==e||this.height!==r}};m();m();function Ef(t,e){let r=!1,n=null,i=null,o,a=()=>{n=null,r&&(t.apply(i,o),n=setTimeout(a,e),r=!1)};return(...s)=>(r=!0,i=this,o=s,n||a(),n)}var ou=class{constructor(e){this._getCurrentHash=()=>{let e=window.location.hash.replace("#","");if(this._hashName){let r;return e.split("&").map(n=>n.split("=")).forEach(n=>{n[0]===this._hashName&&(r=n)}),(r&&r[1]||"").split("/")}return e.split("/")};this._onHashChange=()=>{let e=this._getCurrentHash();if(!this._isValidHash(e))return!1;let r=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:r,pitch:+(e[4]||0)}),!0};this._updateHashUnthrottled=()=>{let e=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,e)};this._removeHash=()=>{let e=this._getCurrentHash();if(e.length===0)return;let r=e.join("/"),n=r;n.split("&").length>0&&(n=n.split("&")[0]),this._hashName&&(n="".concat(this._hashName,"=").concat(r));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)};this._updateHash=Ef(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 r=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(r.lng*o)/o,s=Math.round(r.lat*o)/o,l=this._map.getBearing(),u=this._map.getPitch(),c="";if(e?c+="/".concat(a,"/").concat(s,"/").concat(n):c+="".concat(n,"/").concat(s,"/").concat(a),(l||u)&&(c+="/".concat(Math.round(l*10)/10)),u&&(c+="/".concat(Math.round(u))),this._hashName){let p=this._hashName,h=!1,f=window.location.hash.slice(1).split("&").map(d=>{let g=d.split("=")[0];return g===p?(h=!0,"".concat(g,"=").concat(c)):d}).filter(d=>d);return h||f.push("".concat(p,"=").concat(c)),"#".concat(f.join("&"))}return"#".concat(c)}_isValidHash(e){if(e.length<3||e.some(isNaN))return!1;try{new J(+e[2],+e[1])}catch(o){return!1}let r=+e[0],n=+(e[3]||0),i=+(e[4]||0);return r>=this._map.getMinZoom()&&r<=this._map.getMaxZoom()&&n>=-180&&n<=180&&i>=this._map.getMinPitch()&&i<=this._map.getMaxPitch()}};m();m();var MS=se(fe(),1),lu={linearity:.3,easing:ss(0,0,.3,1)},TB=Z({deceleration:2500,maxSpeed:1400},lu),SB=Z({deceleration:20,maxSpeed:1400},lu),CB=Z({deceleration:1e3,maxSpeed:360},lu),MB=Z({deceleration:1e3,maxSpeed:90},lu),IB=Z({deceleration:1e3,maxSpeed:360},lu),Lf=class{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:ae.now(),settings:e})}_drainInertiaBuffer(){let e=this._inertiaBuffer,r=ae.now(),n=160;for(;e.length>0&&r-e[0].time>n;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;let r={zoom:0,bearing:0,pitch:0,roll:0,pan:new MS.default(0,0),pinchAround:void 0,around:void 0};for(let{settings:a}of this._inertiaBuffer)r.zoom+=a.zoomDelta||0,r.bearing+=a.bearingDelta||0,r.pitch+=a.pitchDelta||0,r.roll+=a.rollDelta||0,a.panDelta&&r.pan._add(a.panDelta),a.around&&(r.around=a.around),a.pinchAround&&(r.pinchAround=a.pinchAround);let i=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,o={};if(r.pan.mag()){let a=su(r.pan.mag(),i,Z({},TB,e||{})),s=r.pan.mult(a.amount/r.pan.mag()),l=this._map.cameraHelper.handlePanInertia(s,this._map.transform);o.center=l.easingCenter,o.offset=l.easingOffset,au(o,a)}if(r.zoom){let a=su(r.zoom,i,SB);o.zoom=this._map.transform.zoom+a.amount,au(o,a)}if(r.bearing){let a=su(r.bearing,i,CB);o.bearing=this._map.transform.bearing+ce(a.amount,-179,179),au(o,a)}if(r.pitch){let a=su(r.pitch,i,MB);o.pitch=this._map.transform.pitch+a.amount,au(o,a)}if(r.roll){let a=su(r.roll,i,IB);o.roll=this._map.transform.roll+ce(a.amount,-179,179),au(o,a)}if(o.zoom||o.bearing){let a=r.pinchAround===void 0?r.around:r.pinchAround;o.around=a?this._map.unproject(a):this._map.getCenter()}return this.clear(),Z(o,{noMoveStart:!0})}};function au(t,e){(!t.duration||t.duration<e.duration)&&(t.duration=e.duration,t.easing=e.easing)}function su(t,e,r){let{maxSpeed:n,linearity:i,deceleration:o}=r,a=ce(t*i/(e/1e3),-n,n),s=Math.abs(a)/(o*i);return{easing:r.easing,duration:s*1e3,amount:a*(s/2)}}m();m();var IS=se(fe(),1);var Rt=class extends U{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,r,n,i={}){n=n instanceof MouseEvent?n:new MouseEvent(e,n);let o=ie.mousePos(r.getCanvas(),n),a=r.unproject(o);super(e,Z({point:o,lngLat:a,originalEvent:n},i)),this._defaultPrevented=!1,this.target=r}},Si=class extends U{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,r,n){let i=e==="touchend"?n.changedTouches:n.touches,o=ie.touchPos(r.getCanvasContainer(),i),a=o.map(u=>r.unproject(u)),s=o.reduce((u,c,p,h)=>u.add(c.div(h.length)),new IS.default(0,0)),l=r.unproject(s);super(e,{points:o,point:s,lngLats:a,lngLat:l,originalEvent:n}),this._defaultPrevented=!1}},uu=class extends U{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,r,n){super(e,{originalEvent:n}),this._defaultPrevented=!1}};var Df=class{constructor(e,r){this._map=e,this._clickTolerance=r.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new uu(e.type,this._map,e))}mousedown(e,r){return this._mousedownPos=r,this._firePreventable(new Rt(e.type,this._map,e))}mouseup(e){this._map.fire(new Rt(e.type,this._map,e))}click(e,r){this._mousedownPos&&this._mousedownPos.dist(r)>=this._clickTolerance||this._map.fire(new Rt(e.type,this._map,e))}dblclick(e){return this._firePreventable(new Rt(e.type,this._map,e))}mouseover(e){this._map.fire(new Rt(e.type,this._map,e))}mouseout(e){this._map.fire(new Rt(e.type,this._map,e))}touchstart(e){return this._firePreventable(new Si(e.type,this._map,e))}touchmove(e){this._map.fire(new Si(e.type,this._map,e))}touchend(e){this._map.fire(new Si(e.type,this._map,e))}touchcancel(e){this._map.fire(new Si(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}},Rf=class{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new Rt(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Rt("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new Rt(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}};m();m();var AS=se(fe(),1),Ur=class{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(AS.default.convert(e),this._map.terrain)}};var cu=class{constructor(e,r){this._map=e,this._tr=new Ur(e),this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=r.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,r){this.isEnabled()&&e.shiftKey&&e.button===0&&(ie.disableDrag(),this._startPos=this._lastPos=r,this._active=!0)}mousemoveWindow(e,r){if(!this._active)return;let n=r;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=ie.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),l=Math.max(i.y,n.y);ie.setTransform(this._box,"translate(".concat(o,"px,").concat(s,"px)")),this._box.style.width="".concat(a-o,"px"),this._box.style.height="".concat(l-s,"px")}mouseupWindow(e,r){if(!this._active||e.button!==0)return;let n=this._startPos,i=r;if(this.reset(),ie.suppressClick(),n.x===i.x&&n.y===i.y)this._fireEvent("boxzoomcancel",e);else return this._map.fire(new U("boxzoomend",{originalEvent:e})),{cameraAnimation:o=>o.fitScreenCoordinates(n,i,this._tr.bearing,{linear:!0})}}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&&(ie.remove(this._box),this._box=null),ie.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,r){return this._map.fire(new U(e,{originalEvent:r}))}};m();m();var ES=se(fe(),1);m();function pu(t,e){if(t.length!==e.length)throw new Error("The number of touches and points are not equal - touches ".concat(t.length,", points ").concat(e.length));let r={};for(let n=0;n<t.length;n++)r[t[n].identifier]=e[n];return r}function AB(t){let e=new ES.default(0,0);for(let r of t)e._add(r);return e.div(t.length)}var Pg=500,EB=500,kf=30,vg=class{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,r,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=AB(r),this.touches=pu(n,r)))}touchmove(e,r,n){if(this.aborted||!this.centroid)return;let i=pu(n,r);for(let o in this.touches){let a=this.touches[o],s=i[o];(!s||s.dist(a)>kf)&&(this.aborted=!0)}}touchend(e,r,n){if((!this.centroid||e.timeStamp-this.startTime>EB)&&(this.aborted=!0),n.length===0){let i=!this.aborted&&this.centroid;if(this.reset(),i)return i}}},Po=class{constructor(e){this.singleTap=new vg(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,r,n){this.singleTap.touchstart(e,r,n)}touchmove(e,r,n){this.singleTap.touchmove(e,r,n)}touchend(e,r,n){let i=this.singleTap.touchend(e,r,n);if(i){let o=e.timeStamp-this.lastTime<Pg,a=!this.lastTap||this.lastTap.dist(i)<kf;if((!o||!a)&&this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=i,this.count===this.numTaps)return this.reset(),i}}};var Ff=class{constructor(e){this._tr=new Ur(e),this._zoomIn=new Po({numTouches:1,numTaps:2}),this._zoomOut=new Po({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,r,n){this._zoomIn.touchstart(e,r,n),this._zoomOut.touchstart(e,r,n)}touchmove(e,r,n){this._zoomIn.touchmove(e,r,n),this._zoomOut.touchmove(e,r,n)}touchend(e,r,n){let i=this._zoomIn.touchend(e,r,n),o=this._zoomOut.touchend(e,r,n),a=this._tr;if(i)return this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:s=>s.easeTo({duration:300,zoom:a.zoom+1,around:a.unproject(i)},{originalEvent:e})};if(o)return this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:s=>s.easeTo({duration:300,zoom:a.zoom-1,around:a.unproject(o)},{originalEvent:e})}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}};m();var LS=se(fe(),1);m();var Ci=class{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 r=this._moveFunction(...e);if(r.bearingDelta||r.pitchDelta||r.rollDelta||r.around||r.panDelta)return this._active=!0,r}dragStart(e,r){!this.isEnabled()||this._lastPoint||this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=Array.isArray(r)?r[0]:r,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,r){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(r)?r[0]:r;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&&ie.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}};m();var LB=0,DB=2,RB={[LB]:1,[DB]:2};function kB(t,e){let r=RB[e];return t.buttons===void 0||(t.buttons&r)!==r}var wo=class{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){let r=ie.mouseButton(e);this._eventButton=r}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!kB(e,this._eventButton)}isValidEndEvent(e){return ie.mouseButton(e)===this._eventButton}};var wg=0,Tg=2,Of=t=>{t.mousedown=t.dragStart,t.mousemoveWindow=t.dragMove,t.mouseup=t.dragEnd,t.contextmenu=e=>{e.preventDefault()}};function DS({enable:t,clickTolerance:e}){let r=new wo({checkCorrectEvent:n=>ie.mouseButton(n)===wg&&!n.ctrlKey});return new Ci({clickTolerance:e,move:(n,i)=>({around:i,panDelta:i.sub(n)}),activateOnStart:!0,moveStateManager:r,enable:t,assignEvents:Of})}function RS({enable:t,clickTolerance:e,aroundCenter:r=!0,minPixelCenterThreshold:n=100,rotateDegreesPerPixelMoved:i=.8},o){let a=new wo({checkCorrectEvent:s=>ie.mouseButton(s)===wg&&s.ctrlKey||ie.mouseButton(s)===Tg&&!s.ctrlKey});return new Ci({clickTolerance:e,move:(s,l)=>{let u=o();if(r&&Math.abs(u.y-s.y)>n)return{bearingDelta:id(new LS.default(s.x,l.y),l,u)};let c=(l.x-s.x)*i;return r&&l.y<u.y&&(c=-c),{bearingDelta:c}},moveStateManager:a,enable:t,assignEvents:Of})}function kS({enable:t,clickTolerance:e,pitchDegreesPerPixelMoved:r=-.5}){let n=new wo({checkCorrectEvent:i=>ie.mouseButton(i)===wg&&i.ctrlKey||ie.mouseButton(i)===Tg});return new Ci({clickTolerance:e,move:(i,o)=>({pitchDelta:(o.y-i.y)*r}),moveStateManager:n,enable:t,assignEvents:Of})}function FS({enable:t,clickTolerance:e,rollDegreesPerPixelMoved:r=.3},n){let i=new wo({checkCorrectEvent:o=>ie.mouseButton(o)===Tg&&o.ctrlKey});return new Ci({clickTolerance:e,move:(o,a)=>{let s=n(),l=(a.x-o.x)*r;return a.y<s.y&&(l=-l),{rollDelta:l}},moveStateManager:i,enable:t,assignEvents:Of})}m();var Bf=se(fe(),1);var zf=class{constructor(e,r){this._clickTolerance=e.clickTolerance||1,this._map=r,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new Bf.default(0,0)}_shouldBePrevented(e){let r=this._map.cooperativeGestures.isEnabled()?2:1;return e<r}touchstart(e,r,n){return this._calculateTransform(e,r,n)}touchmove(e,r,n){if(this._active){if(this._shouldBePrevented(n.length)){this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",e);return}return e.preventDefault(),this._calculateTransform(e,r,n)}}touchend(e,r,n){this._calculateTransform(e,r,n),this._active&&this._shouldBePrevented(n.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,r,n){n.length>0&&(this._active=!0);let i=pu(n,r),o=new Bf.default(0,0),a=new Bf.default(0,0),s=0;for(let c in i){let p=i[c],h=this._touches[c];h&&(o._add(p),a._add(p.sub(h)),s++,i[c]=p)}if(this._touches=i,this._shouldBePrevented(s)||!a.mag())return;let l=a.div(s);return this._sum._add(l),this._sum.mag()<this._clickTolerance?void 0:{around:o.div(s),panDelta:l}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}};m();var hu=class{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(e,r,n){this._firstTwoTouches||n.length<2||(this._firstTwoTouches=[n[0].identifier,n[1].identifier],this._start([r[0],r[1]]))}touchmove(e,r,n){if(!this._firstTwoTouches)return;e.preventDefault();let[i,o]=this._firstTwoTouches,a=Vf(n,r,i),s=Vf(n,r,o);if(!a||!s)return;let l=this._aroundCenter?null:a.add(s).div(2);return this._move([a,s],l,e)}touchend(e,r,n){if(!this._firstTwoTouches)return;let[i,o]=this._firstTwoTouches,a=Vf(n,r,i),s=Vf(n,r,o);a&&s||(this._active&&ie.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}};function Vf(t,e,r){for(let n=0;n<t.length;n++)if(t[n].identifier===r)return e[n]}var FB=.1;function OS(t,e){return Math.log(t/e)/Math.LN2}var fu=class extends hu{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,r){let n=this._distance;if(this._distance=e[0].dist(e[1]),!(!this._active&&Math.abs(OS(this._distance,this._startDistance))<FB))return this._active=!0,{zoomDelta:OS(this._distance,n),pinchAround:r}}},OB=25;function BS(t,e){return t.angleWith(e)*180/Math.PI}var mu=class extends hu{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,r,n){let i=this._vector;if(this._vector=e[0].sub(e[1]),!(!this._active&&this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:BS(this._vector,i),pinchAround:r}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());let r=Math.PI*this._minDiameter,n=OB/r*360,i=BS(e,this._startVector);return Math.abs(i)<n}};function Sg(t){return Math.abs(t.y)>Math.abs(t.x)}var BB=100,du=class extends hu{constructor(r){super();this._currentTouchCount=0;this._map=r}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(r,n,i){super.touchstart(r,n,i),this._currentTouchCount=i.length}_start(r){this._lastPoints=r,Sg(r[0].sub(r[1]))&&(this._valid=!1)}_move(r,n,i){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;let o=r[0].sub(this._lastPoints[0]),a=r[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(o,a,i.timeStamp),this._valid?(this._lastPoints=r,this._active=!0,{pitchDelta:(o.y+a.y)/2*-.5}):void 0}gestureBeginsVertically(r,n,i){if(this._valid!==void 0)return this._valid;let o=2,a=r.mag()>=o,s=n.mag()>=o;if(!a&&!s)return;if(!a||!s)return this._firstMove===void 0&&(this._firstMove=i),i-this._firstMove<BB?void 0:!1;let l=r.y>0==n.y>0;return Sg(r)&&Sg(n)&&l}};m();var zB={panStep:100,bearingStep:15,pitchStep:10},yu=class{constructor(e){this._tr=new Ur(e);let r=zB;this._panStep=r.panStep,this._bearingStep=r.bearingStep,this._pitchStep=r.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let r=0,n=0,i=0,o=0,a=0;switch(e.keyCode){case 61:case 107:case 171:case 187:r=1;break;case 189:case 109:case 173:r=-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:s=>{let l=this._tr;s.easeTo({duration:300,easeId:"keyboardHandler",easing:VB,zoom:r?Math.round(l.zoom)+r*(e.shiftKey?2:1):l.zoom,bearing:l.bearing+n*this._bearingStep,pitch:l.pitch+i*this._pitchStep,offset:[-o*this._panStep,-a*this._panStep],center:l.center},{originalEvent:e})}}}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}};function VB(t){return t*(2-t)}m();var zS=4.000244140625,UB=1/100,NB=1/450,GB=2,jB=5,gu=class{constructor(e,r){this._onTimeout=e=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(e)};this._map=e,this._tr=new Ur(e),this._triggerRenderFrame=r,this._delta=0,this._defaultZoomRate=UB,this._wheelZoomRate=NB}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 r=e.deltaMode===WheelEvent.DOM_DELTA_LINE?e.deltaY*40:e.deltaY,n=ae.now(),i=n-(this._lastWheelEventTime||0);this._lastWheelEventTime=n,r!==0&&r%zS===0?this._type="wheel":r!==0&&Math.abs(r)<4?this._type="trackpad":i>400?(this._type=null,this._lastValue=r,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(i*r)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,r+=this._lastValue)),e.shiftKey&&r&&(r=r/4),this._type&&(this._lastWheelEvent=e,this._delta-=r,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 r=ie.mousePos(this._map.getCanvas(),e),n=this._tr;this._aroundCenter?this._aroundPoint=n.transform.locationToScreenPoint(J.convert(n.center)):this._aroundPoint=r,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)>zS?this._wheelZoomRate:this._defaultZoomRate,l=GB/(1+Math.exp(-Math.abs(this._delta*s)));this._delta<0&&l!==0&&(l=1/l);let u=typeof this._targetZoom!="number"?e.scale:ct(this._targetZoom);this._targetZoom=e.getConstrained(e.getCameraLngLat(),it(u*l)).zoom,this._type==="wheel"&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let r=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=ae.now()-this._lastWheelEventTime,l=Math.min((s+jB)/200,1),u=i(l);a=Fe.number(n,r,u),l<1?this._frameId||(this._frameId=!0):o=!0}else a=r,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 r=ls;if(this._prevEase){let n=this._prevEase,i=(ae.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);r=ss(a,s,.25,1)}return this._prevEase={start:ae.now(),duration:e,easing:r},r}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}};m();var xu=class{constructor(e,r){this._clickZoom=e,this._tapZoom=r}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()}};m();var Uf=class{constructor(e){this._tr=new Ur(e),this.reset()}reset(){this._active=!1}dblclick(e,r){return e.preventDefault(),{cameraAnimation:n=>{n.easeTo({duration:300,zoom:this._tr.zoom+(e.shiftKey?-1:1),around:this._tr.unproject(r)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}};m();var Nf=class{constructor(){this._tap=new Po({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,r,n){if(!this._swipePoint)if(!this._tapTime)this._tap.touchstart(e,r,n);else{let i=r[0],o=e.timeStamp-this._tapTime<Pg,a=this._tapPoint.dist(i)<kf;!o||!a?this.reset():n.length>0&&(this._swipePoint=i,this._swipeTouch=n[0].identifier)}}touchmove(e,r,n){if(!this._tapTime)this._tap.touchmove(e,r,n);else if(this._swipePoint){if(n[0].identifier!==this._swipeTouch)return;let i=r[0],o=i.y-this._swipePoint.y;return this._swipePoint=i,e.preventDefault(),this._active=!0,{zoomDelta:o/128}}}touchend(e,r,n){if(this._tapTime)this._swipePoint&&n.length===0&&this.reset();else{let i=this._tap.touchend(e,r,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}};m();var bu=class{constructor(e,r,n){this._el=e,this._mousePan=r,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()}};m();var _u=class{constructor(e,r,n,i){this._pitchWithRotate=e.pitchWithRotate,this._rollEnabled=e.rollEnabled,this._mouseRotate=r,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()}};m();var vu=class{constructor(e,r,n,i){this._el=e,this._touchZoom=r,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()}};m();var Pu=class{constructor(e,r){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey";this._map=e,this._options=r,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=ie.create("div","maplibregl-cooperative-gesture-screen",e);let r=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(r=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));let n=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),i=document.createElement("div");i.className="maplibregl-desktop-message",i.textContent=r,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&&(ie.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,r){this._enabled&&(this._map.fire(new U("cooperativegestureprevented",{gestureType:e,originalEvent:r})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}};var VS=se(fe(),1),Gf=t=>t.zoom||t.drag||t.roll||t.pitch||t.rotate,Mg=class extends U{};function Cg(t){return t.panDelta&&t.panDelta.mag()||t.zoomDelta||t.bearingDelta||t.pitchDelta||t.rollDelta}var jf=class{constructor(e,r){this.handleWindowEvent=e=>{this.handleEvent(e,"".concat(e.type,"Window"))};this.handleEvent=(e,r)=>{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:u,handler:c,allowed:p}of this._handlers){if(!c.isEnabled())continue;let h;if(this._blockedByActive(a,p,u))c.reset();else if(c[r||e.type]){if(Qb(e,r||e.type)){let f=ie.mousePos(this._map.getCanvas(),e);h=c[r||e.type](e,f)}else if(Jb(e,r||e.type)){let f=e.touches,d=this._getMapTouches(f),g=ie.touchPos(this._map.getCanvas(),d);h=c[r||e.type](e,g,d)}else e_(r||e.type)||(h=c[r||e.type](e));this.mergeHandlerResult(i,o,h,u,n),h&&h.needsRenderFrame&&this._triggerRenderFrame()}(h||c.isActive())&&(a[u]=c)}let s={};for(let u in this._previousActiveHandlers)a[u]||(s[u]=n);this._previousActiveHandlers=a,(Object.keys(s).length||Cg(i))&&(this._changes.push([i,o,s]),this._triggerRenderFrame()),(Object.keys(a).length||Cg(i))&&this._map._stop(!0),this._updatingCamera=!1;let{cameraAnimation:l}=i;l&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],l(this._map))};this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Lf(e),this._bearingSnap=r.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(r);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)ie.addEventListener(i,o,i===document?this.handleWindowEvent:this.handleEvent,a)}destroy(){for(let[e,r,n]of this._listeners)ie.removeEventListener(e,r,e===document?this.handleWindowEvent:this.handleEvent,n)}_addDefaultHandlers(e){let r=this._map,n=r.getCanvasContainer();this._add("mapEvent",new Df(r,e));let i=r.boxZoom=new cu(r,e);this._add("boxZoom",i),e.interactive&&e.boxZoom&&i.enable();let o=r.cooperativeGestures=new Pu(r,e.cooperativeGestures);this._add("cooperativeGestures",o),e.cooperativeGestures&&o.enable();let a=new Ff(r),s=new Uf(r);r.doubleClickZoom=new xu(s,a),this._add("tapZoom",a),this._add("clickZoom",s),e.interactive&&e.doubleClickZoom&&r.doubleClickZoom.enable();let l=new Nf;this._add("tapDragZoom",l);let u=r.touchPitch=new du(r);this._add("touchPitch",u),e.interactive&&e.touchPitch&&r.touchPitch.enable(e.touchPitch);let c=()=>r.project(r.getCenter()),p=RS(e,c),h=kS(e),f=FS(e,c);r.dragRotate=new _u(e,p,h,f),this._add("mouseRotate",p,["mousePitch"]),this._add("mousePitch",h,["mouseRotate","mouseRoll"]),this._add("mouseRoll",f,["mousePitch"]),e.interactive&&e.dragRotate&&r.dragRotate.enable();let d=DS(e),g=new zf(e,r);r.dragPan=new bu(n,d,g),this._add("mousePan",d),this._add("touchPan",g,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&r.dragPan.enable(e.dragPan);let x=new mu,b=new fu;r.touchZoomRotate=new vu(n,b,x,l),this._add("touchRotate",x,["touchPan","touchZoom"]),this._add("touchZoom",b,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&r.touchZoomRotate.enable(e.touchZoomRotate);let v=r.scrollZoom=new gu(r,()=>this._triggerRenderFrame());this._add("scrollZoom",v,["mousePan"]),e.interactive&&e.scrollZoom&&r.scrollZoom.enable(e.scrollZoom);let P=r.keyboard=new yu(r);this._add("keyboard",P),e.interactive&&e.keyboard&&r.keyboard.enable(),this._add("blockableMapEvent",new Rf(r))}_add(e,r,n){this._handlers.push({handlerName:e,handler:r,allowed:n}),this._handlersById[e]=r}stop(e){if(!this._updatingCamera){for(let{handler:r}of this._handlers)r.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!!Gf(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,r,n){for(let i in e)if(i!==n&&(!r||r.indexOf(i)<0))return!0;return!1}_getMapTouches(e){let r=[];for(let n of e){let i=n.target;this._el.contains(i)&&r.push(n)}return r}mergeHandlerResult(e,r,n,i,o){if(!n)return;Z(e,n);let a={handlerName:i,originalEvent:n.originalEvent||o};n.zoomDelta!==void 0&&(r.zoom=a),n.panDelta!==void 0&&(r.drag=a),n.rollDelta!==void 0&&(r.roll=a),n.pitchDelta!==void 0&&(r.pitch=a),n.bearingDelta!==void 0&&(r.rotate=a)}_applyChanges(){let e={},r={},n={};for(let[i,o,a]of this._changes)i.panDelta&&(e.panDelta=(e.panDelta||new VS.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),Z(r,o),Z(n,a);this._updateMapTransform(e,r,n),this._changes=[]}_updateMapTransform(e,r,n){let i=this._map,o=i._getTransformForUpdate(),a=i.terrain;if(!Cg(e)&&!(a&&this._terrainMovement))return this._fireEvents(r,n,!0);i._stop(!0);let{panDelta:s,zoomDelta:l,bearingDelta:u,pitchDelta:c,rollDelta:p,around:h,pinchAround:f}=e;f!==void 0&&(h=f),h=h||i.transform.centerPoint,a&&!o.isPointOnMapSurface(h)&&(h=o.centerPoint);let d={panDelta:s,zoomDelta:l,rollDelta:p,pitchDelta:c,bearingDelta:u,around:h};this._map.cameraHelper.useGlobeControls&&!o.isPointOnMapSurface(h)&&(h=o.centerPoint);let g=h.distSqr(o.centerPoint)<.01?o.center:o.screenPointToLocation(s?h.sub(s):h);a?(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(d,o),!this._terrainMovement&&(r.drag||r.zoom)?(this._terrainMovement=!0,this._map._elevationFreeze=!0,this._map.cameraHelper.handleMapControlsPan(d,o,g)):r.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(r,n,!0)}_fireEvents(e,r,n){let i=Gf(this._eventsInProgress),o=Gf(e),a={};for(let p in e){let{originalEvent:h}=e[p];this._eventsInProgress[p]||(a["".concat(p,"start")]=h),this._eventsInProgress[p]=e[p]}!i&&o&&this._fireEvent("movestart",o.originalEvent);for(let p in a)this._fireEvent(p,a[p]);o&&this._fireEvent("move",o.originalEvent);for(let p in e){let{originalEvent:h}=e[p];this._fireEvent(p,h)}let s={},l;for(let p in this._eventsInProgress){let{handlerName:h,originalEvent:f}=this._eventsInProgress[p];this._handlersById[h].isActive()||(delete this._eventsInProgress[p],l=r[h]||f,s["".concat(p,"end")]=l)}for(let p in s)this._fireEvent(p,s[p]);let u=Gf(this._eventsInProgress),c=(i||o)&&!u;if(c&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;let p=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&p.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(p)}if(n&&c){this._updatingCamera=!0;let p=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),h=f=>f!==0&&-this._bearingSnap<f&&f<this._bearingSnap;p&&(p.essential||!ae.prefersReducedMotion)?(h(p.bearing||this._map.getBearing())&&(p.bearing=0),p.freezeElevation=!0,this._map.easeTo(p,{originalEvent:l})):(this._map.fire(new U("moveend",{originalEvent:l})),h(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(e,r){this._map.fire(new U(e,r?{originalEvent:r}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{delete this._frameId,this.handleEvent(new Mg("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}};m();var Fa=se(fe(),1);var Hf=class extends Ee{constructor(r,n,i){super();this._renderFrameCallback=()=>{let r=Math.min((ae.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(r)),r<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()};this._moving=!1,this._zooming=!1,this.transform=r,this._bearingSnap=i.bearingSnap,this.cameraHelper=n,this.on("moveend",()=>{delete this._requestedCameraState})}migrateProjection(r,n){r.apply(this.transform),this.transform=r,this.cameraHelper=n}getCenter(){return new J(this.transform.center.lng,this.transform.center.lat)}setCenter(r,n){return this.jumpTo({center:r},n)}getCenterElevation(){return this.transform.elevation}setCenterElevation(r,n){return this.jumpTo({elevation:r},n),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(r){this._centerClampedToGround=r}panBy(r,n,i){return r=Fa.default.convert(r).mult(-1),this.panTo(this.transform.center,Z({offset:r},n),i)}panTo(r,n,i){return this.easeTo(Z({center:r},n),i)}getZoom(){return this.transform.zoom}setZoom(r,n){return this.jumpTo({zoom:r},n),this}zoomTo(r,n,i){return this.easeTo(Z({zoom:r},n),i)}zoomIn(r,n){return this.zoomTo(this.getZoom()+1,r,n),this}zoomOut(r,n){return this.zoomTo(this.getZoom()-1,r,n),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(r,n){return r!=this.transform.fov&&(this.transform.setFov(r),this.fire(new U("movestart",n)).fire(new U("move",n)).fire(new U("moveend",n))),this}getBearing(){return this.transform.bearing}setBearing(r,n){return this.jumpTo({bearing:r},n),this}getPadding(){return this.transform.padding}setPadding(r,n){return this.jumpTo({padding:r},n),this}rotateTo(r,n,i){return this.easeTo(Z({bearing:r},n),i)}resetNorth(r,n){return this.rotateTo(0,Z({duration:1e3},r),n),this}resetNorthPitch(r,n){return this.easeTo(Z({bearing:0,pitch:0,roll:0,duration:1e3},r),n),this}snapToNorth(r,n){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(r,n):this}getPitch(){return this.transform.pitch}setPitch(r,n){return this.jumpTo({pitch:r},n),this}getRoll(){return this.transform.roll}setRoll(r,n){return this.jumpTo({roll:r},n),this}cameraForBounds(r,n){r=yt.convert(r).adjustAntiMeridian();let i=n&&n.bearing||0;return this._cameraForBoxAndBearing(r.getNorthWest(),r.getSouthEast(),i,n)}_cameraForBoxAndBearing(r,n,i,o){let a={top:0,bottom:0,right:0,left:0};if(o=Z({padding:a,offset:[0,0],maxZoom:this.transform.maxZoom},o),typeof o.padding=="number"){let c=o.padding;o.padding={top:c,bottom:c,right:c,left:c}}let s=Z(a,o.padding);o.padding=s;let l=this.transform,u=new yt(r,n);return this.cameraHelper.cameraForBoxAndBearing(o,s,u,i,l)}fitBounds(r,n,i){return this._fitInternal(this.cameraForBounds(r,n),n,i)}fitScreenCoordinates(r,n,i,o,a){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(Fa.default.convert(r)),this.transform.screenPointToLocation(Fa.default.convert(n)),i,o),o,a)}_fitInternal(r,n,i){return r?(n=Z(r,n),delete n.padding,n.linear?this.easeTo(n,i):this.flyTo(n,i)):this}jumpTo(r,n){this.stop();let i=this._getTransformForUpdate(),o=!1,a=!1,s=!1,l=i.zoom;this.cameraHelper.handleJumpToCenterZoom(i,r);let u=i.zoom!==l;return"elevation"in r&&i.elevation!==+r.elevation&&i.setElevation(+r.elevation),"bearing"in r&&i.bearing!==+r.bearing&&(o=!0,i.setBearing(+r.bearing)),"pitch"in r&&i.pitch!==+r.pitch&&(a=!0,i.setPitch(+r.pitch)),"roll"in r&&i.roll!==+r.roll&&(s=!0,i.setRoll(+r.roll)),r.padding!=null&&!i.isPaddingEqual(r.padding)&&i.setPadding(r.padding),this._applyUpdatedTransform(i),this.fire(new U("movestart",n)).fire(new U("move",n)),u&&this.fire(new U("zoomstart",n)).fire(new U("zoom",n)).fire(new U("zoomend",n)),o&&this.fire(new U("rotatestart",n)).fire(new U("rotate",n)).fire(new U("rotateend",n)),a&&this.fire(new U("pitchstart",n)).fire(new U("pitch",n)).fire(new U("pitchend",n)),s&&this.fire(new U("rollstart",n)).fire(new U("roll",n)).fire(new U("rollend",n)),this.fire(new U("moveend",n))}calculateCameraOptionsFromTo(r,n,i,o=0){let a=xe.fromLngLat(r,n),s=xe.fromLngLat(i,o),l=s.x-a.x,u=s.y-a.y,c=s.z-a.z,p=Math.hypot(l,u,c);if(p===0)throw new Error("Can't calculate camera options with same From and To");let h=Math.hypot(l,u),f=it(this.transform.cameraToCenterDistance/p/this.transform.tileSize),d=Math.atan2(l,-u)*180/Math.PI,g=Math.acos(h/p)*180/Math.PI;return g=c<0?90-g:90+g,{center:s.toLngLat(),elevation:o,zoom:f,pitch:g,bearing:d}}calculateCameraOptionsFromCameraLngLatAltRotation(r,n,i,o,a){let s=this.transform.calculateCenterFromCameraLngLatAlt(r,n,i,o);return{center:s.center,elevation:s.elevation,zoom:s.zoom,bearing:i,pitch:o,roll:a}}easeTo(r,n){this._stop(!1,r.easeId),r=Z({offset:[0,0],duration:500,easing:ls},r),(r.animate===!1||!r.essential&&ae.prefersReducedMotion)&&(r.duration=0);let i=this._getTransformForUpdate(),o=this.getBearing(),a=i.pitch,s=i.roll,l="bearing"in r?this._normalizeBearing(r.bearing,o):o,u="pitch"in r?+r.pitch:a,c="roll"in r?this._normalizeBearing(r.roll,s):s,p="padding"in r?r.padding:i.padding,h=Fa.default.convert(r.offset),f,d;r.around&&(f=J.convert(r.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:l,pitch:u,roll:c,padding:p,around:f,aroundPoint:d,offsetAsPoint:h,offset:r.offset,zoom:r.zoom,center:r.center});return this._rotating=this._rotating||o!==l,this._pitching=this._pitching||u!==a,this._rolling=this._rolling||c!==s,this._padding=!i.isPaddingEqual(p),this._zooming=this._zooming||x.isZooming,this._easeId=r.easeId,this._prepareEase(n,r.noMoveStart,g),this.terrain&&this._prepareElevation(x.elevationCenter),this._ease(b=>{x.easeFunc(b),this.terrain&&!r.freezeElevation&&this._updateElevation(b),this._applyUpdatedTransform(i),this._fireMoveEvents(n)},b=>{this.terrain&&r.freezeElevation&&this._finalizeElevation(),this._afterEase(n,b)},r),this}_prepareEase(r,n,i={}){this._moving=!0,!n&&!i.moving&&this.fire(new U("movestart",r)),this._zooming&&!i.zooming&&this.fire(new U("zoomstart",r)),this._rotating&&!i.rotating&&this.fire(new U("rotatestart",r)),this._pitching&&!i.pitching&&this.fire(new U("pitchstart",r)),this._rolling&&!i.rolling&&this.fire(new U("rollstart",r))}_prepareElevation(r){this._elevationCenter=r,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(r,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(r){this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));let n=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(r<1&&n!==this._elevationTarget){let i=this._elevationTarget-this._elevationStart,o=(n-(i*r+this._elevationStart))/(1-r);this._elevationStart+=r*(i-o),this._elevationTarget=n}this.transform.setElevation(Fe.number(this._elevationStart,this._elevationTarget,r))}_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(r){return{}}_applyUpdatedTransform(r){let n=[];if(n.push(o=>this._elevateCameraIfInsideTerrain(o)),this.transformCameraUpdate&&n.push(o=>this.transformCameraUpdate(o)),!n.length)return;let i=r.clone();for(let o of n){let a=i.clone(),{center:s,zoom:l,roll:u,pitch:c,bearing:p,elevation:h}=o(a);s&&a.setCenter(s),h!==void 0&&a.setElevation(h),l!==void 0&&a.setZoom(l),u!==void 0&&a.setRoll(u),c!==void 0&&a.setPitch(c),p!==void 0&&a.setBearing(p),i.apply(a)}this.transform.apply(i)}_fireMoveEvents(r){this.fire(new U("move",r)),this._zooming&&this.fire(new U("zoom",r)),this._rotating&&this.fire(new U("rotate",r)),this._pitching&&this.fire(new U("pitch",r)),this._rolling&&this.fire(new U("roll",r))}_afterEase(r,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 U("zoomend",r)),o&&this.fire(new U("rotateend",r)),a&&this.fire(new U("pitchend",r)),s&&this.fire(new U("rollend",r)),this.fire(new U("moveend",r))}flyTo(r,n){if(!r.essential&&ae.prefersReducedMotion){let A=an(r,["center","zoom","bearing","pitch","roll","elevation"]);return this.jumpTo(A,n)}this.stop(),r=Z({offset:[0,0],speed:1.2,curve:1.42,easing:ls},r);let i=this._getTransformForUpdate(),o=i.bearing,a=i.pitch,s=i.roll,l=i.padding,u="bearing"in r?this._normalizeBearing(r.bearing,o):o,c="pitch"in r?+r.pitch:a,p="roll"in r?this._normalizeBearing(r.roll,s):s,h="padding"in r?r.padding:i.padding,f=Fa.default.convert(r.offset),d=i.centerPoint.add(f),g=i.screenPointToLocation(d),x=this.cameraHelper.handleFlyTo(i,{bearing:u,pitch:c,roll:p,padding:h,locationAtOffset:g,offsetAsPoint:f,center:r.center,minZoom:r.minZoom,zoom:r.zoom}),b=r.curve,v=Math.max(i.width,i.height),P=v/x.scaleOfZoom,w=x.pixelPathLength;if(typeof x.scaleOfMinZoom=="number"){let A=v/x.scaleOfMinZoom;b=Math.sqrt(A/w*2)}let T=b*b;function S(A){let R=(P*P-v*v+(A?-1:1)*T*T*w*w)/(2*(A?P:v)*T*w);return Math.log(Math.sqrt(R*R+1)-R)}function I(A){return(Math.exp(A)-Math.exp(-A))/2}function M(A){return(Math.exp(A)+Math.exp(-A))/2}function E(A){return I(A)/M(A)}let L=S(!1),k=function(A){return M(L)/M(L+b*A)},F=function(A){return v*((M(L)*E(L+b*A)-I(L))/T)/w},z=(S(!0)-L)/b;if(Math.abs(w)<2e-6||!isFinite(z)){if(Math.abs(v-P)<1e-6)return this.easeTo(r,n);let A=P<v?-1:1;z=Math.abs(Math.log(P/v))/b,F=()=>0,k=R=>Math.exp(A*b*R)}if("duration"in r)r.duration=+r.duration;else{let A="screenSpeed"in r?+r.screenSpeed/b:+r.speed;r.duration=1e3*z/A}return r.maxDuration&&r.duration>r.maxDuration&&(r.duration=0),this._zooming=!0,this._rotating=o!==u,this._pitching=c!==a,this._rolling=p!==s,this._padding=!i.isPaddingEqual(h),this._prepareEase(n,!1),this.terrain&&this._prepareElevation(x.targetCenter),this._ease(A=>{let R=A*z,H=1/k(R),W=F(R);this._rotating&&i.setBearing(Fe.number(o,u,A)),this._pitching&&i.setPitch(Fe.number(a,c,A)),this._rolling&&i.setRoll(Fe.number(s,p,A)),this._padding&&(i.interpolatePadding(l,h,A),d=i.centerPoint.add(f)),x.easeFunc(A,H,W,d),this.terrain&&!r.freezeElevation&&this._updateElevation(A),this._applyUpdatedTransform(i),this._fireMoveEvents(n)},()=>{this.terrain&&r.freezeElevation&&this._finalizeElevation(),this._afterEase(n)},r),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(r,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 r||(i=this.handlers)==null||i.stop(!1),this}_ease(r,n,i){i.animate===!1||i.duration===0?(r(1),n()):(this._easeStart=ae.now(),this._easeOptions=i,this._onEaseFrame=r,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(r,n){r=Rr(r,-180,180);let i=Math.abs(r-n);return Math.abs(r-360-n)<i&&(r-=360),Math.abs(r+360-n)<i&&(r+=360),r}queryTerrainElevation(r){return this.terrain?this.terrain.getElevationForLngLatZoom(J.convert(r),this.transform.tileZoom):null}};var Vn=se(fe(),1);m();var Ig={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'},wu=class{constructor(e=Ig){this._toggleAttribution=()=>{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")))};this._updateData=e=>{e&&(e.sourceDataType==="metadata"||e.sourceDataType==="visibility"||e.dataType==="style"||e.type==="terrain")&&this._updateAttributions()};this._updateCompact=()=>{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"))};this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")};this.options=e}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=ie.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=ie.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=ie.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(){ie.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,r){let n=this._map._getUIString("AttributionControl.".concat(r));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 r=this._map.style.sourceCaches;for(let i in r){let o=r[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=ie.sanitize(n),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}};m();var Tu=class{constructor(e={}){this._updateCompact=()=>{let e=this._container.children;if(e.length){let r=e[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&r.classList.add("maplibregl-compact"):r.classList.remove("maplibregl-compact")}};this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){this._map=e,this._compact=this.options&&this.options.compact,this._container=ie.create("div","maplibregl-ctrl");let r=ie.create("a","maplibregl-ctrl-logo");return r.target="_blank",r.rel="noopener nofollow",r.href="https://maplibre.org/",r.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),r.setAttribute("rel","noopener nofollow"),this._container.appendChild(r),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){ie.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}};m();var Xf=class{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){let r=++this._id;return this._queue.push({callback:e,id:r,cancelled:!1}),r}remove(e){let r=this._currentlyRunning,n=r?this._queue.concat(r):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 r=this._currentlyRunning=this._queue;this._queue=[];for(let n of r)if(!n.cancelled&&(n.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}};m();var qf=(n=>(n.create="create",n.load="load",n.fullLoad="fullLoad",n))(qf||{}),Zf=null,Su=[],HB=60,Ag=1e3/HB,Eg="loadTime",Lg="fullLoadTime",Oa={mark(t){performance.mark(t)},frame(t){let e=t;if(Zf!=null){let r=e-Zf;Su.push(r)}Zf=e},clearMetrics(){Zf=null,Su=[],performance.clearMeasures(Eg),performance.clearMeasures(Lg);for(let t in qf)performance.clearMarks(qf[t])},getPerformanceMetrics(){performance.measure(Eg,"create","load"),performance.measure(Lg,"create","fullLoad");let t=performance.getEntriesByName(Eg)[0].duration,e=performance.getEntriesByName(Lg)[0].duration,r=Su.length,i=1/(Su.reduce((s,l)=>s+l,0)/r/1e3),o=Su.filter(s=>s>Ag).reduce((s,l)=>s+(l-Ag)/Ag,0),a=o/(r+o)*100;return{loadTime:t,fullLoadTime:e,fps:i,percentDroppedFrames:a,totalFrames:r}}};m();m();var US=ze([{name:"a_pos3d",type:"Int16",components:3}]);m();var Yf=class extends Ee{constructor(r){super();this._lastTilesetChange=ae.now();this.sourceCache=r,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=r._source.tileSize*2**this.deltaZoom,r.usedForTerrain=!0,r.tileSize=this.tileSize}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(r,n){this.sourceCache.update(r,n),this._renderableTilesKeys=[];let i={};for(let o of vi(r,{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),B.ortho(o.terrainRttPosMatrix32f,0,8192,8192,0,0,1),this._tiles[o.key]=new Pa(o,this.tileSize),this._lastTilesetChange=ae.now());for(let o in this._tiles)i[o]||delete this._tiles[o]}freeRtt(r){for(let n in this._tiles){let i=this._tiles[n];(!r||i.tileID.equals(r)||i.tileID.isChildOf(r)||r.isChildOf(i.tileID))&&(i.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(r=>this.getTileByID(r))}getTileByID(r){return this._tiles[r]}getTerrainCoords(r,n){return n?this._getTerrainCoordsForTileRanges(r,n):this._getTerrainCoordsForRegularTile(r)}_getTerrainCoordsForRegularTile(r){let n={};for(let i of this._renderableTilesKeys){let o=this._tiles[i].tileID,a=r.clone(),s=Zr();if(o.canonical.equals(r.canonical))B.ortho(s,0,8192,8192,0,0,1);else if(o.canonical.isChildOf(r.canonical)){let l=o.canonical.z-r.canonical.z,u=o.canonical.x-(o.canonical.x>>l<<l),c=o.canonical.y-(o.canonical.y>>l<<l),p=8192>>l;B.ortho(s,0,p,p,0,0,1),B.translate(s,s,[-u*p,-c*p,0])}else if(r.canonical.isChildOf(o.canonical)){let l=r.canonical.z-o.canonical.z,u=r.canonical.x-(r.canonical.x>>l<<l),c=r.canonical.y-(r.canonical.y>>l<<l),p=8192>>l;B.ortho(s,0,8192,8192,0,0,1),B.translate(s,s,[u*p,c*p,0]),B.scale(s,s,[1/2**l,1/2**l,0])}else continue;a.terrainRttPosMatrix32f=new Float32Array(s),n[i]=a}return n}_getTerrainCoordsForTileRanges(r,n){let i={};for(let o of this._renderableTilesKeys){let a=this._tiles[o].tileID;if(!this._isWithinTileRanges(a,n))continue;let s=r.clone(),l=Zr();if(a.canonical.z===r.canonical.z){let u=r.canonical.x-a.canonical.x,c=r.canonical.y-a.canonical.y;B.ortho(l,0,8192,8192,0,0,1),B.translate(l,l,[u*8192,c*8192,0])}else if(a.canonical.z>r.canonical.z){let u=a.canonical.z-r.canonical.z,c=a.canonical.x-(a.canonical.x>>u<<u),p=a.canonical.y-(a.canonical.y>>u<<u),h=r.canonical.x-(a.canonical.x>>u),f=r.canonical.y-(a.canonical.y>>u),d=8192>>u;B.ortho(l,0,d,d,0,0,1),B.translate(l,l,[-c*d+h*8192,-p*d+f*8192,0])}else{let u=r.canonical.z-a.canonical.z,c=r.canonical.x-(r.canonical.x>>u<<u),p=r.canonical.y-(r.canonical.y>>u<<u),h=(r.canonical.x>>u)-a.canonical.x,f=(r.canonical.y>>u)-a.canonical.y,d=8192<<u;B.ortho(l,0,d,d,0,0,1),B.translate(l,l,[c*8192+h*d,p*8192+f*d,0])}s.terrainRttPosMatrix32f=new Float32Array(l),i[o]=s}return i}getSourceTile(r,n){let i=this.sourceCache._source,o=r.overscaledZ-this.deltaZoom;if(o>i.maxzoom&&(o=i.maxzoom),o<i.minzoom)return null;this._sourceTileCache[r.key]||(this._sourceTileCache[r.key]=r.scaledTo(o).key);let a=this.sourceCache.getTileByID(this._sourceTileCache[r.key]);if(!(a&&a.dem)&&n)for(;o>=i.minzoom&&!(a&&a.dem);)a=this.sourceCache.getTileByID(r.scaledTo(o--).key);return a}anyTilesAfterTime(r=Date.now()){return this._lastTilesetChange>=r}_isWithinTileRanges(r,n){return n[r.canonical.z]&&r.canonical.x>=n[r.canonical.z].minTileX&&r.canonical.x<=n[r.canonical.z].maxTileX&&r.canonical.y>=n[r.canonical.z].minTileY&&r.canonical.y<=n[r.canonical.z].maxTileY}};var Wf=class{constructor(e,r,n){this._meshCache={};this.painter=e,this.sourceCache=new Yf(r),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,r,n,i=8192){var f;if(!(r>=0&&r<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=Tt.transformMat4([],[r/i*8192,n/i*8192],o.u_terrain_matrix),l=[s[0]*a.dim,s[1]*a.dim],u=Math.floor(l[0]),c=Math.floor(l[1]),p=l[0]-u,h=l[1]-c;return a.get(u,c)*(1-p)*(1-h)+a.get(u+1,c)*p*(1-h)+a.get(u,c+1)*(1-p)*h+a.get(u+1,c+1)*p*h}getElevationForLngLatZoom(e,r){if(!V1(r,e.wrap()))return 0;let{tileID:n,mercatorX:i,mercatorY:o}=this._getOverscaledTileIDFromLngLatZoom(e,r);return this.getElevation(n,i%8192,o%8192,8192)}getElevation(e,r,n,i=8192){return this.getDEMElevation(e,r,n,i)*this.exaggeration}getTerrainData(e){if(!this._emptyDemTexture){let i=this.painter.context,o=new Le({width:1,height:1},new Uint8Array(1*4));this._emptyDepthTexture=new Se(i,o,i.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new Se(i,new Le({width:1,height:1}),i.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(i.gl.NEAREST,i.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=B.identity([])}let r=this.sourceCache.getSourceTile(e,!0);if(r&&r.dem&&(!r.demTexture||r.needsTerrainPrepare)){let i=this.painter.context;r.demTexture=this.painter.getTileTexture(r.dem.stride),r.demTexture?r.demTexture.update(r.dem.getPixels(),{premultiply:!1}):r.demTexture=new Se(i,r.dem.getPixels(),i.gl.RGBA,{premultiply:!1}),r.demTexture.bind(i.gl.NEAREST,i.gl.CLAMP_TO_EDGE),r.needsTerrainPrepare=!1}let n=r&&r+r.tileID.key+e.key;if(n&&!this._demMatrixCache[n]){let i=this.sourceCache.sourceCache._source.maxzoom,o=e.canonical.z-r.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=i?o=e.canonical.z-i:ve("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),l=B.fromScaling(new Float64Array(16),[1/(8192<<o),1/(8192<<o),0]);B.translate(l,l,[a*8192,s*8192,0]),this._demMatrixCache[e.key]={matrix:l,coord:e}}return{u_depth:2,u_terrain:3,u_terrain_dim:r&&r.dem&&r.dem.dim||1,u_terrain_matrix:n?this._demMatrixCache[e.key].matrix:this._emptyDemMatrix,u_terrain_unpack:r&&r.dem&&r.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(r&&r.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:r}}getFramebuffer(e){let r=this.painter,n=r.width/devicePixelRatio,i=r.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 Se(r.context,{width:n,height:i,data:null},r.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(r.context.gl.NEAREST,r.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new Se(r.context,{width:n,height:i,data:null},r.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(r.context.gl.NEAREST,r.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=r.context.createFramebuffer(n,i,!0,!1),this._fbo.depthAttachment.set(r.context.createRenderbuffer(r.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 r=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)r[a+0]=s&255,r[a+1]=o&255,r[a+2]=s>>8<<4|o>>8,r[a+3]=0;let n=new Le({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(r.buffer)),i=new Se(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 r=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,r),n.bindFramebuffer.set(null);let l=r[0]+(r[2]>>4<<8),u=r[1]+((r[2]&15)<<8),c=this.coordsIndex[255-r[3]],p=c&&this.sourceCache.getTileByID(c);if(!p)return null;let h=this._coordsTextureSize,f=(1<<p.tileID.canonical.z)*h;return new xe((p.tileID.canonical.x*h+l)/f+p.tileID.wrap,(p.tileID.canonical.y*h+u)/f,this.getElevation(p.tileID,l,u,h))}depthAtPoint(e){let r=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,r),n.bindFramebuffer.set(null),(r[0]/(256*256*256)+r[1]/(256*256)+r[2]/256+r[3])/256}getTerrainMesh(e){var I;let r=((I=this.painter.style.projection)==null?void 0:I.transitionState)>0,n=r&&e.canonical.y===0,i=r&&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 np,l=new et,u=this.meshSize,c=8192/u,p=u*u;for(let M=0;M<=u;M++)for(let E=0;E<=u;E++)s.emplaceBack(E*c,M*c,0);for(let M=0;M<p;M+=u+1)for(let E=0;E<u;E++)l.emplaceBack(E+M,u+E+M+1,u+E+M+2),l.emplaceBack(E+M,u+E+M+2,E+M+1);let h=s.length,f=0,d=h+(u+1),g=(u+1)*u,x=n?dn:0,b=n?0:1,v=i?Dn:8192,P=i?0:1;for(let M=0;M<=u;M++)s.emplaceBack(M*c,x,b);for(let M=0;M<=u;M++)s.emplaceBack(M*c,v,P);for(let M=0;M<u;M++)l.emplaceBack(g+M,d+M,d+M+1),l.emplaceBack(g+M,d+M+1,g+M+1),l.emplaceBack(f+M,h+M+1,h+M),l.emplaceBack(f+M,f+M+1,h+M+1);let w=s.length,T=w+(u+1)*2;for(let M of[0,1])for(let E=0;E<=u;E++)for(let L of[0,1])s.emplaceBack(M*8192,E*c,L);for(let M=0;M<u*2;M+=2)l.emplaceBack(w+M,w+M+1,w+M+3),l.emplaceBack(w+M,w+M+3,w+M+2),l.emplaceBack(T+M,T+M+3,T+M+1),l.emplaceBack(T+M,T+M+2,T+M+3);let S=new sr(a.createVertexBuffer(s,US.members),a.createIndexBuffer(l),de.simpleSegment(0,0,s.length,l.length));return this._meshCache[o]=S,S}getMeshFrameDelta(e){return 2*Math.PI*or/Math.pow(2,Math.max(e,0))/5}getMinTileElevationForLngLatZoom(e,r){var i;let{tileID:n}=this._getOverscaledTileIDFromLngLatZoom(e,r);return(i=this.getMinMaxElevation(n).minElevation)!=null?i:0}getMinMaxElevation(e){let r=this.getTerrainData(e).tile,n={minElevation:null,maxElevation:null};return r&&r.dem&&(n.minElevation=r.dem.min*this.exaggeration,n.maxElevation=r.dem.max*this.exaggeration),n}_getOverscaledTileIDFromLngLatZoom(e,r){let n=xe.fromLngLat(e.wrap()),i=(1<<r)*8192,o=n.x*i,a=n.y*i,s=Math.floor(o/8192),l=Math.floor(a/8192);return{tileID:new We(r,0,r,s,l),mercatorX:o,mercatorY:a}}};m();m();var $f=class{constructor(e,r,n){this._context=e;this._size=r;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 r=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),n=new Se(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),r.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),r.colorAttachment.set(n.texture),{id:e,fbo:r,texture:n,stamp:-1,inUse:!1}}getObjectForId(e){return this._objects[e]}useObject(e){e.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(r=>e.id!==r),this._recentlyUsed.push(e.id)}stampObject(e){e.stamp=++this._stamp}getOrCreateFreeObject(){for(let r of this._recentlyUsed)if(!this._objects[r].inUse)return this._objects[r];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}};var Ba={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0},Kf=class{constructor(e,r){this.painter=e,this.terrain=r,this.pool=new $f(e.context,30,r.sourceCache.tileSize*r.qualityFactor)}destruct(){this.pool.destruct()}getTexture(e){return this.pool.getObjectForId(e.rtt[this._stacks.length-1].id).texture}prepareForRender(e,r){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=e._order.filter(n=>!e._layers[n].isHidden(r)),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 vr?o.terrainTileRanges:null;for(let s of i){let l=this.terrain.sourceCache.getTerrainCoords(s,a);for(let u in l)this._coordsAscending[n][u]||(this._coordsAscending[n][u]=[]),this._coordsAscending[n][u].push(l[u])}}this._coordsAscendingStr={};for(let n of e._order){let i=e._layers[n],o=i.source;if(Ba[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,r){if(e.isHidden(this.painter.transform.zoom))return!1;let n=wt(Ze({},r),{isRenderingToTexture:!0}),i=e.type,o=this.painter,a=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(Ba[i]&&((!this._prevType||!Ba[this._prevType])&&this._stacks.push([]),this._prevType=i,this._stacks[this._stacks.length-1].push(e.id),!a))return!0;if(Ba[this._prevType]||Ba[i]&&a){this._prevType=i;let s=this._stacks.length-1,l=this._stacks[s]||[];for(let u of this._renderableTiles){if(this.pool.isFull()&&(_g(this.painter,this.terrain,this._rttTiles,n),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(u),u.rtt[s]){let p=this.pool.getObjectForId(u.rtt[s].id);if(p.stamp===u.rtt[s].stamp){this.pool.useObject(p);continue}}let c=this.pool.getOrCreateFreeObject();this.pool.useObject(c),this.pool.stampObject(c),u.rtt[s]={id:c.id,stamp:c.stamp},o.context.bindFramebuffer.set(c.fbo.framebuffer),o.context.clear({color:K.transparent,stencil:0}),o.currentStencilSource=void 0;for(let p=0;p<l.length;p++){let h=o.style._layers[l[p]],f=h.source?this._coordsAscending[h.source][u.tileID.key]:[u.tileID];o.context.viewport.set([0,0,c.fbo.width,c.fbo.height]),o._renderTileClippingMasks(h,f,!0),o.renderLayer(o,o.style.sourceCaches[h.source],h,f,n),h.source&&(u.rttCoords[h.source]=this._coordsAscendingStr[h.source][u.tileID.key])}}return _g(this.painter,this.terrain,this._rttTiles,n),this._rttTiles=[],this.pool.freeAllObjects(),Ba[i]}return!1}};m();var NS={"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 XB=Ju.version,Qf=-2,jS=22,Mi=0,HS=60,Jf=180,GS={hash:!1,interactive:!0,bearingSnap:7,attributionControl:Ig,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 0},scrollZoom:!0,minZoom:Qf,maxZoom:jS,minPitch:Mi,maxPitch:HS,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:Kt.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},Dg=class extends Hf{constructor(r){var l,u;Oa.mark("create");let n=wt(Ze(Ze({},GS),r),{canvasContextAttributes:Ze(Ze({},GS.canvasContextAttributes),r.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<Mi)throw new Error("minPitch must be greater than or equal to ".concat(Mi));if(n.maxPitch!=null&&n.maxPitch>Jf)throw new Error("maxPitch must be less than or equal to ".concat(Jf));let i=new Bn,o=new zn;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 Xf;this._controls=[];this._mapId=uc();this._contextLost=r=>{r.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new U("webglcontextlost",{originalEvent:r}))};this._contextRestored=r=>{this._setupPainter(),this.resize(),this._update(),this.fire(new U("webglcontextrestored",{originalEvent:r}))};this._onMapScroll=r=>{if(r.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1};this._onWindowOnline=()=>{this._update()};if(this._interactive=n.interactive,this._maxTileCacheSize=n.maxTileCacheSize,this._maxTileCacheZoomLevels=n.maxTileCacheZoomLevels,this._canvasContextAttributes=Ze({},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=Ze(Ze({},NS),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=jt.addThrottleControl(()=>this.isMoving()),this._requestManager=new yc(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 c=!1,p=Ef(h=>{this._trackResize&&!this._removed&&(this.resize(h),this.redraw())},50);this._resizeObserver=new ResizeObserver(h=>{if(!c){c=!0;return}p(h)}),this._resizeObserver.observe(this._container)}this.handlers=new jf(this,n);let a=typeof n.hash=="string"&&n.hash||void 0;this._hash=n.hash&&new ou(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,Z({},n.fitBoundsOptions,{duration:0}))));let s=typeof n.style=="string"||((u=(l=n.style)==null?void 0:l.projection)==null?void 0:u.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 wu(typeof n.attributionControl=="boolean"?void 0:n.attributionControl)),n.maplibreLogo&&this.addControl(new Tu,n.logoPosition),this.on("style.load",()=>{if(s||this._resizeTransform(),this.transform.unmodified){let c=an(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(c)}}),this.on("data",c=>{this._update(c.dataType==="style"),this.fire(new U("".concat(c.dataType,"data"),c))}),this.on("dataloading",c=>{this.fire(new U("".concat(c.dataType,"dataloading"),c))}),this.on("dataabort",c=>{this.fire(new U("sourcedataabort",c))})}_getMapId(){return this._mapId}setGlobalStateProperty(r,n){return this.style.setGlobalStateProperty(r,n),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(r,n){if(n===void 0&&(r.getDefaultPosition?n=r.getDefaultPosition():n="top-right"),!r||!r.onAdd)return this.fire(new Q(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let i=r.onAdd(this);this._controls.push(r);let o=this._controlPositions[n];return n.indexOf("bottom")!==-1?o.insertBefore(i,o.firstChild):o.appendChild(i),this}removeControl(r){if(!r||!r.onRemove)return this.fire(new Q(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let n=this._controls.indexOf(r);return n>-1&&this._controls.splice(n,1),r.onRemove(this),this}hasControl(r){return this._controls.indexOf(r)>-1}calculateCameraOptionsFromTo(r,n,i,o){return o==null&&this.terrain&&(o=this.terrain.getElevationForLngLatZoom(i,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(r,n,i,o)}resize(r,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 l=this.painter.context.gl;this._maxCanvasSize=[l.drawingBufferWidth,l.drawingBufferHeight];let u=this._getClampedPixelRatio(i,o);this._resizeCanvas(i,o,u),this.painter.resize(i,o,u)}this._resizeTransform(n);let s=!this._moving;return s&&(this.stop(),this.fire(new U("movestart",r)).fire(new U("move",r))),this.fire(new U("resize",r)),s&&this.fire(new U("moveend",r)),this}_resizeTransform(r=!0){var o;let[n,i]=this._containerDimensions();this.transform.resize(n,i,r),(o=this._requestedCameraState)==null||o.resize(n,i,r)}_getClampedPixelRatio(r,n){let{0:i,1:o}=this._maxCanvasSize,a=this.getPixelRatio(),s=r*a,l=n*a,u=s>i?i/s:1,c=l>o?o/l:1;return Math.min(u,c)*a}getPixelRatio(){var r;return(r=this._overridePixelRatio)!=null?r:devicePixelRatio}setPixelRatio(r){this._overridePixelRatio=r,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(r){return this.transform.setMaxBounds(yt.convert(r)),this._update()}setMinZoom(r){if(r=r==null?Qf:r,r>=Qf&&r<=this.transform.maxZoom)return this.transform.setMinZoom(r),this._update(),this.getZoom()<r&&this.setZoom(r),this;throw new Error("minZoom must be between ".concat(Qf," and the current maxZoom, inclusive"))}getMinZoom(){return this.transform.minZoom}setMaxZoom(r){if(r=r==null?jS:r,r>=this.transform.minZoom)return this.transform.setMaxZoom(r),this._update(),this.getZoom()>r&&this.setZoom(r),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(r){if(r=r==null?Mi:r,r<Mi)throw new Error("minPitch must be greater than or equal to ".concat(Mi));if(r>=Mi&&r<=this.transform.maxPitch)return this.transform.setMinPitch(r),this._update(),this.getPitch()<r&&this.setPitch(r),this;throw new Error("minPitch must be between ".concat(Mi," and the current maxPitch, inclusive"))}getMinPitch(){return this.transform.minPitch}setMaxPitch(r){if(r=r==null?HS:r,r>Jf)throw new Error("maxPitch must be less than or equal to ".concat(Jf));if(r>=this.transform.minPitch)return this.transform.setMaxPitch(r),this._update(),this.getPitch()>r&&this.setPitch(r),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(r){return this.transform.setRenderWorldCopies(r),this._update()}project(r){return this.transform.locationToScreenPoint(J.convert(r),this.style&&this.terrain)}unproject(r){return this.transform.screenPointToLocation(Vn.default.convert(r),this.terrain)}isMoving(){var r;return this._moving||((r=this.handlers)==null?void 0:r.isMoving())}isZooming(){var r;return this._zooming||((r=this.handlers)==null?void 0:r.isZooming())}isRotating(){var r;return this._rotating||((r=this.handlers)==null?void 0:r.isRotating())}_createDelegatedListener(r,n,i){if(r==="mouseenter"||r==="mouseover"){let o=!1;return{layers:n,listener:i,delegates:{mousemove:l=>{let u=n.filter(p=>this.getLayer(p)),c=u.length!==0?this.queryRenderedFeatures(l.point,{layers:u}):[];c.length?o||(o=!0,i.call(this,new Rt(r,this,l.originalEvent,{features:c}))):o=!1},mouseout:()=>{o=!1}}}}else if(r==="mouseleave"||r==="mouseout"){let o=!1;return{layers:n,listener:i,delegates:{mousemove:l=>{let u=n.filter(p=>this.getLayer(p));(u.length!==0?this.queryRenderedFeatures(l.point,{layers:u}):[]).length?o=!0:o&&(o=!1,i.call(this,new Rt(r,this,l.originalEvent)))},mouseout:l=>{o&&(o=!1,i.call(this,new Rt(r,this,l.originalEvent)))}}}}else{let o=a=>{let s=n.filter(u=>this.getLayer(u)),l=s.length!==0?this.queryRenderedFeatures(a.point,{layers:s}):[];l.length&&(a.features=l,i.call(this,a),delete a.features)};return{layers:n,listener:i,delegates:{[r]:o}}}}_saveDelegatedListener(r,n){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[r]=this._delegatedListeners[r]||[],this._delegatedListeners[r].push(n)}_removeDelegatedListener(r,n,i){if(!this._delegatedListeners||!this._delegatedListeners[r])return;let o=this._delegatedListeners[r];for(let a=0;a<o.length;a++){let s=o[a];if(s.listener===i&&s.layers.length===n.length&&s.layers.every(l=>n.includes(l))){for(let l in s.delegates)this.off(l,s.delegates[l]);o.splice(a,1);return}}}on(r,n,i){if(i===void 0)return super.on(r,n);let o=typeof n=="string"?[n]:n,a=this._createDelegatedListener(r,o,i);this._saveDelegatedListener(r,a);for(let s in a.delegates)this.on(s,a.delegates[s]);return{unsubscribe:()=>{this._removeDelegatedListener(r,o,i)}}}once(r,n,i){if(i===void 0)return super.once(r,n);let o=typeof n=="string"?[n]:n,a=this._createDelegatedListener(r,o,i);for(let s in a.delegates){let l=a.delegates[s];a.delegates[s]=(...u)=>{this._removeDelegatedListener(r,o,i),l(...u)}}this._saveDelegatedListener(r,a);for(let s in a.delegates)this.once(s,a.delegates[s]);return this}off(r,n,i){if(i===void 0)return super.off(r,n);let o=typeof n=="string"?[n]:n;return this._removeDelegatedListener(r,o,i),this}queryRenderedFeatures(r,n){if(!this.style)return[];let i,o=r instanceof Vn.default||Array.isArray(r),a=o?r:[[0,0],[this.transform.width,this.transform.height]];if(n=n||(o?{}:r)||{},a instanceof Vn.default||typeof a[0]=="number")i=[Vn.default.convert(a)];else{let s=Vn.default.convert(a[0]),l=Vn.default.convert(a[1]);i=[s,new Vn.default(l.x,s.y),l,new Vn.default(s.x,l.y),s]}return this.style.queryRenderedFeatures(i,n,this.transform)}querySourceFeatures(r,n){return this.style.querySourceFeatures(r,n)}setStyle(r,n){return n=Z({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},n),n.diff!==!1&&n.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&r?(this._diffStyle(r,n),this):(this._localIdeographFontFamily=n.localIdeographFontFamily,this._updateStyle(r,n))}setTransformRequest(r){return this._requestManager.setTransformRequest(r),this}_getUIString(r){let n=this._locale[r];if(n==null)throw new Error("Missing UI string '".concat(r,"'"));return n}_updateStyle(r,n){var o,a;if(n.transformStyle&&this.style&&!this.style._loaded){this.style.once("style.load",()=>this._updateStyle(r,n));return}let i=this.style&&n.transformStyle?this.style.serialize():void 0;if(this.style&&(this.style.setEventedParent(null),this.style._remove(!r)),r)this.style=new ka(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 r=="string"?this.style.loadURL(r,n,i):this.style.loadJSON(r,n,i),this}_lazyInitEmptyStyle(){this.style||(this.style=new ka(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(r,n){if(typeof r=="string"){let i=r,o=this._requestManager.transformRequest(i,"Style");Qn(o,new AbortController).then(a=>{this._updateDiff(a.data,n)}).catch(a=>{a&&this.fire(new Q(a))})}else typeof r=="object"&&this._updateDiff(r,n)}_updateDiff(r,n){try{this.style.setState(r,n)&&this._update(!0)}catch(i){ve("Unable to perform style diff: ".concat(i.message||i.error||i,". Rebuilding the style from scratch.")),this._updateStyle(r,n)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():ve("There is no style added to the map.")}addSource(r,n){return this._lazyInitEmptyStyle(),this.style.addSource(r,n),this._update(!0)}isSourceLoaded(r){let n=this.style&&this.style.sourceCaches[r];if(n===void 0){this.fire(new Q(new Error("There is no source with ID '".concat(r,"'"))));return}return n.loaded()}setTerrain(r){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),!r)this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this._centerClampedToGround&&this.transform.setElevation(0);else{let n=this.style.sourceCaches[r.source];if(!n)throw new Error("cannot load terrain, because there exists no source with ID: ".concat(r.source));this.terrain===null&&n.reload();for(let i in this.style._layers){let o=this.style._layers[i];o.type==="hillshade"&&o.source===r.source&&ve("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===r.source&&ve("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 Wf(this.painter,n,r),this.painter.renderToTexture=new Kf(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===r.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 U("terrain",{terrain:r})),this}getTerrain(){var r,n;return(n=(r=this.terrain)==null?void 0:r.options)!=null?n:null}areTilesLoaded(){let r=this.style&&this.style.sourceCaches;for(let n in r){let o=r[n]._tiles;for(let a in o){let s=o[a];if(!(s.state==="loaded"||s.state==="errored"))return!1}}return!0}removeSource(r){return this.style.removeSource(r),this._update(!0)}getSource(r){return this.style.getSource(r)}setSourceTileLodParams(r,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=ph(Math.max(1,r),Math.max(1,n))}else for(let o in this.style.sourceCaches)this.style.sourceCaches[o].getSource().calculateTileZoom=ph(Math.max(1,r),Math.max(1,n));return this._update(!0),this}refreshTiles(r,n){let i=this.style.sourceCaches[r];if(!i)throw new Error('There is no source cache with ID "'.concat(r,'", cannot refresh tile'));n===void 0?i.reload(!0):i.refreshTiles(n.map(o=>new gi(o.z,o.x,o.y)))}addImage(r,n,i={}){let{pixelRatio:o=1,sdf:a=!1,stretchX:s,stretchY:l,content:u,textFitWidth:c,textFitHeight:p}=i;this._lazyInitEmptyStyle();let h=0;if(n instanceof HTMLImageElement||$t(n)){let{width:f,height:d,data:g}=ae.getImageData(n);this.style.addImage(r,{data:new Le({width:f,height:d},g),pixelRatio:o,stretchX:s,stretchY:l,content:u,textFitWidth:c,textFitHeight:p,sdf:a,version:h})}else{if(n.width===void 0||n.height===void 0)return this.fire(new Q(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(r,{data:new Le({width:f,height:d},new Uint8Array(g)),pixelRatio:o,stretchX:s,stretchY:l,content:u,textFitWidth:c,textFitHeight:p,sdf:a,version:h,userImage:x}),x.onAdd&&x.onAdd(this,r),this}}}updateImage(r,n){let i=this.style.getImage(r);if(!i)return this.fire(new Q(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||$t(n)?ae.getImageData(n):n,{width:a,height:s,data:l}=o;if(a===void 0||s===void 0)return this.fire(new Q(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 Q(new Error("The width and height of the updated image must be that same as the previous version of the image")));let u=!(n instanceof HTMLImageElement||$t(n));return i.data.replace(l,u),this.style.updateImage(r,i),this}getImage(r){return this.style.getImage(r)}hasImage(r){return r?!!this.style.getImage(r):(this.fire(new Q(new Error("Missing required image id"))),!1)}removeImage(r){this.style.removeImage(r)}loadImage(r){return jt.getImage(this._requestManager.transformRequest(r,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(r,n){return this._lazyInitEmptyStyle(),this.style.addLayer(r,n),this._update(!0)}moveLayer(r,n){return this.style.moveLayer(r,n),this._update(!0)}removeLayer(r){return this.style.removeLayer(r),this._update(!0)}getLayer(r){return this.style.getLayer(r)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(r,n,i){return this.style.setLayerZoomRange(r,n,i),this._update(!0)}setFilter(r,n,i={}){return this.style.setFilter(r,n,i),this._update(!0)}getFilter(r){return this.style.getFilter(r)}setPaintProperty(r,n,i,o={}){return this.style.setPaintProperty(r,n,i,o),this._update(!0)}getPaintProperty(r,n){return this.style.getPaintProperty(r,n)}setLayoutProperty(r,n,i,o={}){return this.style.setLayoutProperty(r,n,i,o),this._update(!0)}getLayoutProperty(r,n){return this.style.getLayoutProperty(r,n)}setGlyphs(r,n={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(r,n),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(r,n,i={}){return this._lazyInitEmptyStyle(),this.style.addSprite(r,n,i,o=>{o||this._update(!0)}),this}removeSprite(r){return this._lazyInitEmptyStyle(),this.style.removeSprite(r),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(r,n={}){return this._lazyInitEmptyStyle(),this.style.setSprite(r,n,i=>{i||this._update(!0)}),this}setLight(r,n={}){return this._lazyInitEmptyStyle(),this.style.setLight(r,n),this._update(!0)}getLight(){return this.style.getLight()}setSky(r,n={}){return this._lazyInitEmptyStyle(),this.style.setSky(r,n),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(r,n){return this.style.setFeatureState(r,n),this._update()}removeFeatureState(r,n){return this.style.removeFeatureState(r,n),this._update()}getFeatureState(r){return this.style.getFeatureState(r)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let r=0,n=0;return this._container&&(r=this._container.clientWidth||400,n=this._container.clientHeight||300),[r,n]}_setupContainer(){let r=this._container;r.classList.add("maplibregl-map");let n=this._canvasContainer=ie.create("div","maplibregl-canvas-container",r);this._interactive&&n.classList.add("maplibregl-interactive"),this._canvas=ie.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=ie.create("div","maplibregl-control-container",r),s=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(l=>{s[l]=ie.create("div","maplibregl-ctrl-".concat(l," "),a)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(r,n,i){this._canvas.width=Math.floor(i*r),this._canvas.height=Math.floor(i*n),this._canvas.style.width="".concat(r,"px"),this._canvas.style.height="".concat(n,"px")}_setupPainter(){let r=wt(Ze({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0}),n=null;this._canvas.addEventListener("webglcontextcreationerror",o=>{n={requestedAttributes:r},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,r):i=this._canvas.getContext("webgl2",r)||this._canvas.getContext("webgl",r),!i){let o="Failed to initialize WebGL";throw n?(n.message=o,new Error(JSON.stringify(n))):new Error(o)}this.painter=new Af(i,this.transform),fs.testSupport(i)}migrateProjection(r,n){super.migrateProjection(r,n),this.painter.transform=r,this.fire(new U("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(r){return!this.style||!this.style._loaded?this:(this._styleDirty=this._styleDirty||r,this._sourcesDirty=!0,this.triggerRepaint(),this)}_requestRenderFrame(r){return this._update(),this._renderTaskQueue.add(r)}_cancelRenderFrame(r){this._renderTaskQueue.remove(r)}_render(r){var l,u,c,p,h;let n=this._idleTriggered?this._fadeDuration:0,i=((l=this.style.projection)==null?void 0:l.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(r),this._removed)return;let o=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let f=this.transform.zoom,d=ae.now();this.style.zoomHistory.update(f,d);let g=new Te(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=((u=this.style.projection)==null?void 0:u.transitionState)>0!==i;(c=this.style.projection)==null||c.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState((p=this.style.projection)==null?void 0:p.transitionState,(h=this.style.projection)==null?void 0:h.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._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 U("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,Oa.mark("load"),this.fire(new U("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 U("idle")),this._loaded&&!this._fullyLoaded&&!s&&(this._fullyLoaded=!0,Oa.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),jt.removeThrottleControl(this._imageQueueHandle),(n=this._resizeObserver)==null||n.disconnect();let r=this.painter.context.gl.getExtension("WEBGL_lose_context");r!=null&&r.loseContext&&r.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),ie.remove(this._canvasContainer),ie.remove(this._controlContainer),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),Oa.clearMetrics(),this._removed=!0,this.fire(new U("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,ae.frame(this._frameRequest,r=>{Oa.frame(r),this._frameRequest=null;try{this._render(r)}catch(n){if(!r_(n)&&!QT(n))throw n}},()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(r){this._showTileBoundaries!==r&&(this._showTileBoundaries=r,this._update())}get showPadding(){return!!this._showPadding}set showPadding(r){this._showPadding!==r&&(this._showPadding=r,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(r){this._showCollisionBoxes!==r&&(this._showCollisionBoxes=r,r?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(r){this._showOverdrawInspector!==r&&(this._showOverdrawInspector=r,this._update())}get repaint(){return!!this._repaint}set repaint(r){this._repaint!==r&&(this._repaint=r,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(r){this._vertices=r,this._update()}get version(){return XB}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(r){return this._lazyInitEmptyStyle(),this.style.setProjection(r),this._update(!0)}};m();var ZB=se(fe(),1);m();m();m();var $B=se(fe(),1);m();m();m();m();m();m();m();var JB=se(fe(),1);var lbe=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");var QB=se(fe(),1);var d_e=Ju.version;function y_e(t){Kt.WORKER_URL=t}m();m();m();m();m();m();m();var Xt=63710088e-1,ZS={centimeters:Xt*100,centimetres:Xt*100,degrees:Xt/111325,feet:Xt*3.28084,inches:Xt*39.37,kilometers:Xt/1e3,kilometres:Xt/1e3,meters:Xt,metres:Xt,miles:Xt/1609.344,millimeters:Xt*1e3,millimetres:Xt*1e3,nauticalmiles:Xt/1852,radians:1,yards:Xt*1.0936},b_e={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/Xt,yards:1.0936133};function Ii(t,e,r){r===void 0&&(r={});var n={type:"Feature"};return(r.id===0||r.id)&&(n.id=r.id),r.bbox&&(n.bbox=r.bbox),n.properties=e||{},n.geometry=t,n}function ez(t,e,r){if(r===void 0&&(r={}),!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!XS(t[0])||!XS(t[1]))throw new Error("coordinates must contain numbers");var n={type:"Point",coordinates:t};return Ii(n,e,r)}function __e(t,e,r){r===void 0&&(r={});for(var n=0,i=t;n<i.length;n++){var o=i[n];if(o.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var a=0;a<o[o.length-1].length;a++)if(o[o.length-1][a]!==o[0][a])throw new Error("First and last Position are not equivalent.")}var s={type:"Polygon",coordinates:t};return Ii(s,e,r)}function qS(t,e,r){if(r===void 0&&(r={}),t.length<2)throw new Error("coordinates must be an array of two or more positions");var n={type:"LineString",coordinates:t};return Ii(n,e,r)}function v_e(t,e){e===void 0&&(e={});var r={type:"FeatureCollection"};return e.id&&(r.id=e.id),e.bbox&&(r.bbox=e.bbox),r.features=t,r}function P_e(t,e,r){r===void 0&&(r={});var n={type:"MultiLineString",coordinates:t};return Ii(n,e,r)}function w_e(t,e,r){r===void 0&&(r={});var n={type:"MultiPolygon",coordinates:t};return Ii(n,e,r)}function T_e(t,e){e===void 0&&(e="kilometers");var r=ZS[e];if(!r)throw new Error(e+" units is invalid");return t*r}function S_e(t,e){e===void 0&&(e="kilometers");var r=ZS[e];if(!r)throw new Error(e+" units is invalid");return t/r}function C_e(t){var e=t%(2*Math.PI);return e*180/Math.PI}function M_e(t){var e=t%360;return e*Math.PI/180}function XS(t){return!isNaN(t)&&t!==null&&!Array.isArray(t)}function em(t,e,r){if(t!==null)for(var n,i,o,a,s,l,u,c=0,p=0,h,f=t.type,d=f==="FeatureCollection",g=f==="Feature",x=d?t.features.length:1,b=0;b<x;b++){u=d?t.features[b].geometry:g?t.geometry:t,h=u?u.type==="GeometryCollection":!1,s=h?u.geometries.length:1;for(var v=0;v<s;v++){var P=0,w=0;if(a=h?u.geometries[v]:u,a!==null){l=a.coordinates;var T=a.type;switch(c=r&&(T==="Polygon"||T==="MultiPolygon")?1:0,T){case null:break;case"Point":if(e(l,p,b,P,w)===!1)return!1;p++,P++;break;case"LineString":case"MultiPoint":for(n=0;n<l.length;n++){if(e(l[n],p,b,P,w)===!1)return!1;p++,T==="MultiPoint"&&P++}T==="LineString"&&P++;break;case"Polygon":case"MultiLineString":for(n=0;n<l.length;n++){for(i=0;i<l[n].length-c;i++){if(e(l[n][i],p,b,P,w)===!1)return!1;p++}T==="MultiLineString"&&P++,T==="Polygon"&&w++}T==="Polygon"&&P++;break;case"MultiPolygon":for(n=0;n<l.length;n++){for(w=0,i=0;i<l[n].length;i++){for(o=0;o<l[n][i].length-c;o++){if(e(l[n][i][o],p,b,P,w)===!1)return!1;p++}w++}P++}break;case"GeometryCollection":for(n=0;n<a.geometries.length;n++)if(em(a.geometries[n],e,r)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function D_e(t,e){if(t.type==="Feature")e(t,0);else if(t.type==="FeatureCollection")for(var r=0;r<t.features.length&&e(t.features[r],r)!==!1;r++);}function tz(t,e){var r,n,i,o,a,s,l,u,c,p,h=0,f=t.type==="FeatureCollection",d=t.type==="Feature",g=f?t.features.length:1;for(r=0;r<g;r++){for(s=f?t.features[r].geometry:d?t.geometry:t,u=f?t.features[r].properties:d?t.properties:{},c=f?t.features[r].bbox:d?t.bbox:void 0,p=f?t.features[r].id:d?t.id:void 0,l=s?s.type==="GeometryCollection":!1,a=l?s.geometries.length:1,i=0;i<a;i++){if(o=l?s.geometries[i]:s,o===null){if(e(null,h,u,c,p)===!1)return!1;continue}switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(e(o,h,u,c,p)===!1)return!1;break}case"GeometryCollection":{for(n=0;n<o.geometries.length;n++)if(e(o.geometries[n],h,u,c,p)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}h++}}function rz(t,e){tz(t,function(r,n,i,o,a){var s=r===null?null:r.type;switch(s){case null:case"Point":case"LineString":case"Polygon":return e(Ii(r,i,{bbox:o,id:a}),n,0)===!1?!1:void 0}var l;switch(s){case"MultiPoint":l="Point";break;case"MultiLineString":l="LineString";break;case"MultiPolygon":l="Polygon";break}for(var u=0;u<r.coordinates.length;u++){var c=r.coordinates[u],p={type:l,coordinates:c};if(e(Ii(p,i),n,u)===!1)return!1}})}function nz(t,e){rz(t,function(r,n,i){var o=0;if(r.geometry){var a=r.geometry.type;if(!(a==="Point"||a==="MultiPoint")){var s,l=0,u=0,c=0;if(em(r,function(p,h,f,d,g){if(s===void 0||n>l||d>u||g>c){s=p,l=n,u=d,c=g,o=0;return}var x=qS([s,p],r.properties);if(e(x,n,i,g,o)===!1)return!1;o++,s=p})===!1)return!1}}})}function R_e(t,e,r){var n=r,i=!1;return nz(t,function(o,a,s,l,u){i===!1&&r===void 0?n=o:n=e(n,o,a,s,l,u),i=!0}),n}function Rg(t){var e=[1/0,1/0,-1/0,-1/0];return em(t,function(r){e[0]>r[0]&&(e[0]=r[0]),e[1]>r[1]&&(e[1]=r[1]),e[2]<r[0]&&(e[2]=r[0]),e[3]<r[1]&&(e[3]=r[1])}),e}Rg.default=Rg;var YS=Rg;function WS(t){return YS(t)}m();m();m();m();m();var za=class{constructor(){C(this,"type","interaction");C(this,"hover",!1);C(this,"dirty",!1)}};m();m();import{z as kg}from"zod";var $S=kg.union([kg.enum(["low","medium","high","always-visible"]),kg.number()]),KS=["","","low","medium","high","always-visible"],iz=2,oz=3;var az=5;function JS(t){return Math.min(az,Math.max(iz,t))}function Va(t){if(typeof t=="number")return JS(t);let e=KS.indexOf(t);return e===-1?oz:e}function Z_e(t){let e=JS(t);return KS[e]}m();m();import{z as Re}from"zod";m();import Un from"zod";var sz=Un.enum(Vx),lz=t=>{let e=t[0];for(let r=1;r<t.length;r++){let n=t[r];if(n<=e)return!1;e=n}return!0},uz=t=>{let e=t[0];for(let r=1;r<t.length;r++){let n=t[r];if(n>=e)return!1;e=n}return!0},cz=t=>lz(t)||uz(t),QS=Un.object({on:Un.literal("zoom-level"),input:Un.tuple([Un.number()]).rest(Un.number()).refine(cz,{message:"input array must be strictly increasing or decreasing"}),output:Un.tuple([Un.number()]).rest(Un.number()),easing:sz.default("linear")}).refine(t=>t.input.length===t.output.length,{message:"input and output must have the same length"});m();function tm(t){"@babel/helpers - typeof";return tm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},tm(t)}var pz=/^\s+/,hz=/\s+$/;function oe(t,e){if(t=t||"",e=e||{},t instanceof oe)return t;if(!(this instanceof oe))return new oe(t,e);var r=fz(t);this._originalInput=t,this._r=r.r,this._g=r.g,this._b=r.b,this._a=r.a,this._roundA=Math.round(100*this._a)/100,this._format=e.format||r.format,this._gradientType=e.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=r.ok}oe.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var e=this.toRgb();return(e.r*299+e.g*587+e.b*114)/1e3},getLuminance:function(){var e=this.toRgb(),r,n,i,o,a,s;return r=e.r/255,n=e.g/255,i=e.b/255,r<=.03928?o=r/12.92:o=Math.pow((r+.055)/1.055,2.4),n<=.03928?a=n/12.92:a=Math.pow((n+.055)/1.055,2.4),i<=.03928?s=i/12.92:s=Math.pow((i+.055)/1.055,2.4),.2126*o+.7152*a+.0722*s},setAlpha:function(e){return this._a=aC(e),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var e=tC(this._r,this._g,this._b);return{h:e.h*360,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=tC(this._r,this._g,this._b),r=Math.round(e.h*360),n=Math.round(e.s*100),i=Math.round(e.v*100);return this._a==1?"hsv("+r+", "+n+"%, "+i+"%)":"hsva("+r+", "+n+"%, "+i+"%, "+this._roundA+")"},toHsl:function(){var e=eC(this._r,this._g,this._b);return{h:e.h*360,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=eC(this._r,this._g,this._b),r=Math.round(e.h*360),n=Math.round(e.s*100),i=Math.round(e.l*100);return this._a==1?"hsl("+r+", "+n+"%, "+i+"%)":"hsla("+r+", "+n+"%, "+i+"%, "+this._roundA+")"},toHex:function(e){return rC(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return gz(this._r,this._g,this._b,this._a,e)},toHex8String:function(e){return"#"+this.toHex8(e)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(st(this._r,255)*100)+"%",g:Math.round(st(this._g,255)*100)+"%",b:Math.round(st(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(st(this._r,255)*100)+"%, "+Math.round(st(this._g,255)*100)+"%, "+Math.round(st(this._b,255)*100)+"%)":"rgba("+Math.round(st(this._r,255)*100)+"%, "+Math.round(st(this._g,255)*100)+"%, "+Math.round(st(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:Az[rC(this._r,this._g,this._b,!0)]||!1},toFilter:function(e){var r="#"+nC(this._r,this._g,this._b,this._a),n=r,i=this._gradientType?"GradientType = 1, ":"";if(e){var o=oe(e);n="#"+nC(o._r,o._g,o._b,o._a)}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+r+",endColorstr="+n+")"},toString:function(e){var r=!!e;e=e||this._format;var n=!1,i=this._a<1&&this._a>=0,o=!r&&i&&(e==="hex"||e==="hex6"||e==="hex3"||e==="hex4"||e==="hex8"||e==="name");return o?e==="name"&&this._a===0?this.toName():this.toRgbString():(e==="rgb"&&(n=this.toRgbString()),e==="prgb"&&(n=this.toPercentageRgbString()),(e==="hex"||e==="hex6")&&(n=this.toHexString()),e==="hex3"&&(n=this.toHexString(!0)),e==="hex4"&&(n=this.toHex8String(!0)),e==="hex8"&&(n=this.toHex8String()),e==="name"&&(n=this.toName()),e==="hsl"&&(n=this.toHslString()),e==="hsv"&&(n=this.toHsvString()),n||this.toHexString())},clone:function(){return oe(this.toString())},_applyModification:function(e,r){var n=e.apply(null,[this].concat([].slice.call(r)));return this._r=n._r,this._g=n._g,this._b=n._b,this.setAlpha(n._a),this},lighten:function(){return this._applyModification(vz,arguments)},brighten:function(){return this._applyModification(Pz,arguments)},darken:function(){return this._applyModification(wz,arguments)},desaturate:function(){return this._applyModification(xz,arguments)},saturate:function(){return this._applyModification(bz,arguments)},greyscale:function(){return this._applyModification(_z,arguments)},spin:function(){return this._applyModification(Tz,arguments)},_applyCombination:function(e,r){return e.apply(null,[this].concat([].slice.call(r)))},analogous:function(){return this._applyCombination(Mz,arguments)},complement:function(){return this._applyCombination(Sz,arguments)},monochromatic:function(){return this._applyCombination(Iz,arguments)},splitcomplement:function(){return this._applyCombination(Cz,arguments)},triad:function(){return this._applyCombination(iC,[3])},tetrad:function(){return this._applyCombination(iC,[4])}};oe.fromRatio=function(t,e){if(tm(t)=="object"){var r={};for(var n in t)t.hasOwnProperty(n)&&(n==="a"?r[n]=t[n]:r[n]=Cu(t[n]));t=r}return oe(t,e)};function fz(t){var e={r:0,g:0,b:0},r=1,n=null,i=null,o=null,a=!1,s=!1;return typeof t=="string"&&(t=Rz(t)),tm(t)=="object"&&(Nn(t.r)&&Nn(t.g)&&Nn(t.b)?(e=mz(t.r,t.g,t.b),a=!0,s=String(t.r).substr(-1)==="%"?"prgb":"rgb"):Nn(t.h)&&Nn(t.s)&&Nn(t.v)?(n=Cu(t.s),i=Cu(t.v),e=yz(t.h,n,i),a=!0,s="hsv"):Nn(t.h)&&Nn(t.s)&&Nn(t.l)&&(n=Cu(t.s),o=Cu(t.l),e=dz(t.h,n,o),a=!0,s="hsl"),t.hasOwnProperty("a")&&(r=t.a)),r=aC(r),{ok:a,format:t.format||s,r:Math.min(255,Math.max(e.r,0)),g:Math.min(255,Math.max(e.g,0)),b:Math.min(255,Math.max(e.b,0)),a:r}}function mz(t,e,r){return{r:st(t,255)*255,g:st(e,255)*255,b:st(r,255)*255}}function eC(t,e,r){t=st(t,255),e=st(e,255),r=st(r,255);var n=Math.max(t,e,r),i=Math.min(t,e,r),o,a,s=(n+i)/2;if(n==i)o=a=0;else{var l=n-i;switch(a=s>.5?l/(2-n-i):l/(n+i),n){case t:o=(e-r)/l+(e<r?6:0);break;case e:o=(r-t)/l+2;break;case r:o=(t-e)/l+4;break}o/=6}return{h:o,s:a,l:s}}function dz(t,e,r){var n,i,o;t=st(t,360),e=st(e,100),r=st(r,100);function a(u,c,p){return p<0&&(p+=1),p>1&&(p-=1),p<1/6?u+(c-u)*6*p:p<1/2?c:p<2/3?u+(c-u)*(2/3-p)*6:u}if(e===0)n=i=o=r;else{var s=r<.5?r*(1+e):r+e-r*e,l=2*r-s;n=a(l,s,t+1/3),i=a(l,s,t),o=a(l,s,t-1/3)}return{r:n*255,g:i*255,b:o*255}}function tC(t,e,r){t=st(t,255),e=st(e,255),r=st(r,255);var n=Math.max(t,e,r),i=Math.min(t,e,r),o,a,s=n,l=n-i;if(a=n===0?0:l/n,n==i)o=0;else{switch(n){case t:o=(e-r)/l+(e<r?6:0);break;case e:o=(r-t)/l+2;break;case r:o=(t-e)/l+4;break}o/=6}return{h:o,s:a,v:s}}function yz(t,e,r){t=st(t,360)*6,e=st(e,100),r=st(r,100);var n=Math.floor(t),i=t-n,o=r*(1-e),a=r*(1-i*e),s=r*(1-(1-i)*e),l=n%6,u=[r,a,o,o,s,r][l],c=[s,r,r,a,o,o][l],p=[o,o,s,r,r,a][l];return{r:u*255,g:c*255,b:p*255}}function rC(t,e,r,n){var i=[nn(Math.round(t).toString(16)),nn(Math.round(e).toString(16)),nn(Math.round(r).toString(16))];return n&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0):i.join("")}function gz(t,e,r,n,i){var o=[nn(Math.round(t).toString(16)),nn(Math.round(e).toString(16)),nn(Math.round(r).toString(16)),nn(sC(n))];return i&&o[0].charAt(0)==o[0].charAt(1)&&o[1].charAt(0)==o[1].charAt(1)&&o[2].charAt(0)==o[2].charAt(1)&&o[3].charAt(0)==o[3].charAt(1)?o[0].charAt(0)+o[1].charAt(0)+o[2].charAt(0)+o[3].charAt(0):o.join("")}function nC(t,e,r,n){var i=[nn(sC(n)),nn(Math.round(t).toString(16)),nn(Math.round(e).toString(16)),nn(Math.round(r).toString(16))];return i.join("")}oe.equals=function(t,e){return!t||!e?!1:oe(t).toRgbString()==oe(e).toRgbString()};oe.random=function(){return oe.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function xz(t,e){e=e===0?0:e||10;var r=oe(t).toHsl();return r.s-=e/100,r.s=rm(r.s),oe(r)}function bz(t,e){e=e===0?0:e||10;var r=oe(t).toHsl();return r.s+=e/100,r.s=rm(r.s),oe(r)}function _z(t){return oe(t).desaturate(100)}function vz(t,e){e=e===0?0:e||10;var r=oe(t).toHsl();return r.l+=e/100,r.l=rm(r.l),oe(r)}function Pz(t,e){e=e===0?0:e||10;var r=oe(t).toRgb();return r.r=Math.max(0,Math.min(255,r.r-Math.round(255*-(e/100)))),r.g=Math.max(0,Math.min(255,r.g-Math.round(255*-(e/100)))),r.b=Math.max(0,Math.min(255,r.b-Math.round(255*-(e/100)))),oe(r)}function wz(t,e){e=e===0?0:e||10;var r=oe(t).toHsl();return r.l-=e/100,r.l=rm(r.l),oe(r)}function Tz(t,e){var r=oe(t).toHsl(),n=(r.h+e)%360;return r.h=n<0?360+n:n,oe(r)}function Sz(t){var e=oe(t).toHsl();return e.h=(e.h+180)%360,oe(e)}function iC(t,e){if(isNaN(e)||e<=0)throw new Error("Argument to polyad must be a positive number");for(var r=oe(t).toHsl(),n=[oe(t)],i=360/e,o=1;o<e;o++)n.push(oe({h:(r.h+o*i)%360,s:r.s,l:r.l}));return n}function Cz(t){var e=oe(t).toHsl(),r=e.h;return[oe(t),oe({h:(r+72)%360,s:e.s,l:e.l}),oe({h:(r+216)%360,s:e.s,l:e.l})]}function Mz(t,e,r){e=e||6,r=r||30;var n=oe(t).toHsl(),i=360/r,o=[oe(t)];for(n.h=(n.h-(i*e>>1)+720)%360;--e;)n.h=(n.h+i)%360,o.push(oe(n));return o}function Iz(t,e){e=e||6;for(var r=oe(t).toHsv(),n=r.h,i=r.s,o=r.v,a=[],s=1/e;e--;)a.push(oe({h:n,s:i,v:o})),o=(o+s)%1;return a}oe.mix=function(t,e,r){r=r===0?0:r||50;var n=oe(t).toRgb(),i=oe(e).toRgb(),o=r/100,a={r:(i.r-n.r)*o+n.r,g:(i.g-n.g)*o+n.g,b:(i.b-n.b)*o+n.b,a:(i.a-n.a)*o+n.a};return oe(a)};oe.readability=function(t,e){var r=oe(t),n=oe(e);return(Math.max(r.getLuminance(),n.getLuminance())+.05)/(Math.min(r.getLuminance(),n.getLuminance())+.05)};oe.isReadable=function(t,e,r){var n=oe.readability(t,e),i,o;switch(o=!1,i=kz(r),i.level+i.size){case"AAsmall":case"AAAlarge":o=n>=4.5;break;case"AAlarge":o=n>=3;break;case"AAAsmall":o=n>=7;break}return o};oe.mostReadable=function(t,e,r){var n=null,i=0,o,a,s,l;r=r||{},a=r.includeFallbackColors,s=r.level,l=r.size;for(var u=0;u<e.length;u++)o=oe.readability(t,e[u]),o>i&&(i=o,n=oe(e[u]));return oe.isReadable(t,n,{level:s,size:l})||!a?n:(r.includeFallbackColors=!1,oe.mostReadable(t,["#fff","#000"],r))};var Fg=oe.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},Az=oe.hexNames=Ez(Fg);function Ez(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}function aC(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function st(t,e){Lz(t)&&(t="100%");var r=Dz(t);return t=Math.min(e,Math.max(0,parseFloat(t))),r&&(t=parseInt(t*e,10)/100),Math.abs(t-e)<1e-6?1:t%e/parseFloat(e)}function rm(t){return Math.min(1,Math.max(0,t))}function Sr(t){return parseInt(t,16)}function Lz(t){return typeof t=="string"&&t.indexOf(".")!=-1&&parseFloat(t)===1}function Dz(t){return typeof t=="string"&&t.indexOf("%")!=-1}function nn(t){return t.length==1?"0"+t:""+t}function Cu(t){return t<=1&&(t=t*100+"%"),t}function sC(t){return Math.round(parseFloat(t)*255).toString(16)}function oC(t){return Sr(t)/255}var rn=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",r="(?:"+e+")|(?:"+t+")",n="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?",i="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?";return{CSS_UNIT:new RegExp(r),rgb:new RegExp("rgb"+n),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+n),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+n),hsva:new RegExp("hsva"+i),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function Nn(t){return!!rn.CSS_UNIT.exec(t)}function Rz(t){t=t.replace(pz,"").replace(hz,"").toLowerCase();var e=!1;if(Fg[t])t=Fg[t],e=!0;else if(t=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=rn.rgb.exec(t))?{r:r[1],g:r[2],b:r[3]}:(r=rn.rgba.exec(t))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=rn.hsl.exec(t))?{h:r[1],s:r[2],l:r[3]}:(r=rn.hsla.exec(t))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=rn.hsv.exec(t))?{h:r[1],s:r[2],v:r[3]}:(r=rn.hsva.exec(t))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=rn.hex8.exec(t))?{r:Sr(r[1]),g:Sr(r[2]),b:Sr(r[3]),a:oC(r[4]),format:e?"name":"hex8"}:(r=rn.hex6.exec(t))?{r:Sr(r[1]),g:Sr(r[2]),b:Sr(r[3]),format:e?"name":"hex"}:(r=rn.hex4.exec(t))?{r:Sr(r[1]+""+r[1]),g:Sr(r[2]+""+r[2]),b:Sr(r[3]+""+r[3]),a:oC(r[4]+""+r[4]),format:e?"name":"hex8"}:(r=rn.hex3.exec(t))?{r:Sr(r[1]+""+r[1]),g:Sr(r[2]+""+r[2]),b:Sr(r[3]+""+r[3]),format:e?"name":"hex"}:!1}function kz(t){var e,r;return t=t||{level:"AA",size:"small"},e=(t.level||"AA").toUpperCase(),r=(t.size||"small").toLowerCase(),e!=="AA"&&e!=="AAA"&&(e="AA"),r!=="small"&&r!=="large"&&(r="small"),{level:e,size:r}}var _t={RIGHT:"right",LEFT:"left",TOP:"top",HIDDEN:"hidden",CENTER:"center"},To="low-priority",lC=Object.values(_t),Og=[_t.RIGHT,_t.LEFT,_t.TOP,_t.HIDDEN],uC=Re.object({margin:Re.number().min(6).default(6),maxLines:Re.number().min(1).default(2),textSize:Re.number().min(0).default(11.5),maxWidth:Re.number().min(0).default(150),lineHeight:Re.number().min(0).default(1.2),color:Re.string().default("#333"),outlineColor:Re.string().default("white"),textColor:Re.string().optional(),textOutlineColor:Re.string().optional(),pinColor:Re.string().optional(),pinOutlineColor:Re.string().optional(),pinColorInactive:Re.string().optional(),pinOutlineColorInactive:Re.string().optional(),icon:Re.string().optional(),iconSize:Re.number().min(0).default(20),iconScale:Re.union([Re.number(),QS]).default(1),iconPadding:Re.number().min(0).default(2),iconFit:Re.enum(["fill","contain","cover"]).default("cover"),iconOverflow:Re.enum(["visible","hidden"]).default("hidden"),iconVisible:Re.union([Re.boolean(),Re.number()]).default(!0),opacity:Re.number().min(0).max(1).default(1)}),cC=uC.transform(t=>{var e,r,n,i,o,a,s,l;return wt(Ze({},t),{textColor:(e=t.textColor)!=null?e:t.color,textOutlineColor:(r=t.textOutlineColor)!=null?r:t.outlineColor,pinColor:(n=t.pinColor)!=null?n:t.color,pinOutlineColor:(i=t.pinOutlineColor)!=null?i:t.outlineColor,pinColorInactive:(a=t.pinColorInactive)!=null?a:oe((o=t.pinColor)!=null?o:t.color).toRgbString(),pinOutlineColorInactive:(l=t.pinOutlineColorInactive)!=null?l:oe((s=t.pinOutlineColor)!=null?s:t.outlineColor).toRgbString()})}),sve=Re.strictObject(uC.shape),pC=t=>cC.parse(t),Fz=Re.object({rank:$S.optional(),appearance:cC.optional(),interactive:Re.boolean().default(!1),textPlacement:Re.union([Re.enum(lC),Re.array(Re.enum(lC))]).default(Og)}),Oz=t=>{Fz.parse(t!=null?t:{})},Bz=Re.array(Re.number()).min(2).max(3),zz=Re.string(),lve=(t,e,r)=>{Bz.parse(t),zz.parse(e),Oz(r)},hC=["color","outlineColor","margin"],Vz=[...hC,"maxLines","lineHeight","textSize","maxWidth","textColor","textOutlineColor"],Uz=[...hC,"icon","iconSize","iconScale","iconVisible","iconPadding","pinColor","pinOutlineColor","pinColorInactive","pinOutlineColorInactive"],fC=(t,e)=>Vz.some(r=>e[r]!=null&&t[r]!==e[r]),mC=(t,e)=>Uz.some(r=>e[r]!=null&&t[r]!==e[r]);var dC=4,Gz=6,gC=6.5,nm=gC/2,yC=[nm,nm,nm,nm],Ua=class Ua{constructor(e,r,n){C(this,"lines",0);C(this,"id");C(this,"rank");C(this,"type","label");C(this,"initialRank");C(this,"contextConfigured",!1);C(this,"fillText");C(this,"newStyle",{});C(this,"currentOpacity",0);C(this,"visibilityNeedsUpdate",!1);C(this,"activePlacement",_t.RIGHT);C(this,"text");C(this,"style",{top:0,left:0,textLabelVisible:!0,pinVisibility:1,textAlign:"left"});C(this,"projection",new Pn);C(this,"labelCacheId");C(this,"_cache",{});C(this,"appearance");C(this,"options");C(this,"visible",!0);C(this,"enabled",!0);C(this,"isOccluded",!1);C(this,"offscreen",!1);C(this,"canShow",!1);C(this,"activeBoundingBox",{x:0,y:0,w:0,h:0});C(this,"dimensions",{width:0,height:0});C(this,"currentStrategyIndex",-1);C(this,"totalPinSize",0);C(this,"iconScale",1);C(this,"iconPadding");C(this,"dirty",!0);C(this,"textDirty",!0);C(this,"pinDirty",!0);C(this,"attachedDirty",!0);C(this,"collisionDirty",!0);C(this,"lastTextAlign");C(this,"imageHash");C(this,"pinSize",0);C(this,"iconVisible",!1);C(this,"dp");C(this,"animate",!0);C(this,"onStrategySelected",e=>{var n;if(this.currentStrategyIndex===e)return;this.currentStrategyIndex=e;let r=this.strategies[e];if(this.activePlacement=(n=r==null?void 0:r.name)!=null?n:this.activePlacement,r){r.onStrategySelected();let i=this.style;this.style=this.newStyle,this.newStyle=i}});C(this,"packedMessage",{x:0,y:0,enabled:!1,rank:0,bboxes:[],shouldCollideWithScreenEdges:!1,lockedToStrategyIndex:-1});var o,a,s;if(this.id=(o=r.id)!=null?o:Ut(),this.options=r!=null?r:{},this.text=e,this.dp=(l=1)=>l*n.pixelRatio,typeof r.rank=="string")this.rank=Va(r.rank),this.initialRank=this.rank;else if(r.rank!=null&&r.rank>0)this.rank=r.rank,this.initialRank=r.rank;else{let l=Math.trunc(_.env.NODE_ENV==="test"?Ua.testId:Ua.testId*10)/10;Ua.testId+=.001,this.rank=l,this.initialRank=l}this.options.textPlacement=(a=r.textPlacement)!=null?a:Og;let i=pC((s=r.appearance)!=null?s:{});this.appearance=i,this.iconPadding=i.iconPadding}get scaledPinSize(){return this.totalPinSize*this.iconScale}get scaledIconPadding(){return this.appearance.iconPadding*this.iconScale}calculatePinSize(){let e=this.dp();this.iconVisible&&typeof this.appearance.iconSize<"u"&&this.imageHash?this.pinSize=this.dp(this.appearance.iconSize):this.pinSize=this.dp(gC),this.totalPinSize=Math.ceil((this.pinSize+2.5)/e)}getNoTextBbox(e){let r=this.scaledPinSize/2+e;return[r,r,r,r]}getHiddenTextPlacementBbox(e){return this.iconVisible?this.getNoTextBbox(e):yC}getBoundingBoxForPlacement(e){let{width:r,height:n}=this.dimensions,{margin:i}=this.appearance,o=Math.max(Gz,i);if(this.text==="")return this.getNoTextBbox(o);let a=Math.max(this.scaledPinSize,n);switch(e){case _t.RIGHT:return[a/2+o,a/2+o,this.scaledPinSize/2+o,this.scaledPinSize/2+r+o];case _t.LEFT:return[a/2+o,a/2+o,this.scaledPinSize/2+r+o,this.scaledPinSize/2+o];case _t.TOP:{let s=this.dp();return[n+this.scaledPinSize/2/s+o,this.scaledPinSize/2+o,r/2+o,r/2+o]}case _t.CENTER:return[n/2+o,n/2+o,r/2+o,r/2+o];case _t.HIDDEN:return this.getHiddenTextPlacementBbox(o);case To:return yC;default:return this.getNoTextBbox(o)}}getStrategyStyleForPlacement(e){let{width:r,height:n}=this.dimensions;switch(e){case _t.TOP:this.newStyle.pinVisibility=1,this.newStyle.textAlign="center",this.newStyle.textLabelVisible=!0,this.newStyle.top=-n-this.scaledPinSize/2,this.newStyle.left=-r/2;return;case _t.LEFT:this.newStyle.textAlign="right",this.newStyle.pinVisibility=1,this.newStyle.top=-n/2,this.newStyle.left=-r-this.scaledPinSize/2-dC,this.newStyle.textLabelVisible=!0;return;case _t.RIGHT:this.newStyle.textAlign="left",this.newStyle.pinVisibility=1,this.newStyle.top=-n/2,this.newStyle.left=this.scaledPinSize/2+dC,this.newStyle.textLabelVisible=!0;return;case _t.CENTER:this.newStyle.pinVisibility=0,this.newStyle.textAlign="center",this.newStyle.textLabelVisible=!0,this.newStyle.top=-n/2,this.newStyle.left=-r/2;return;case _t.HIDDEN:this.newStyle.pinVisibility=this.iconVisible?1:.5,this.newStyle.textLabelVisible=!1,this.newStyle.top=0,this.newStyle.left=0;return;case To:default:this.newStyle.pinVisibility=.5,this.newStyle.textLabelVisible=!1,this.newStyle.top=0,this.newStyle.left=0;return}}get strategies(){let e=Array.isArray(this.options.textPlacement)?this.options.textPlacement:[this.options.textPlacement],r=[],n=!1;for(let i of e)this.options.rank==="always-visible"&&i===_t.HIDDEN&&e.length>1||(r.push({name:i,getBoundingBox:()=>this.getBoundingBoxForPlacement(i),onStrategySelected:()=>this.getStrategyStyleForPlacement(i)}),i===_t.HIDDEN&&(n=!0));return n&&r.push({name:To,getBoundingBox:()=>this.getBoundingBoxForPlacement(To),onStrategySelected:()=>this.getStrategyStyleForPlacement(To)}),r}recomputeCurrentStrategy(e=this.iconScale){let r=this.iconScale!==e;if(r||this.dirty){let n=this.pinDirty,i=this.strategies[this.currentStrategyIndex];if(this.iconScale=e,this.collisionDirty=!0,r&&!n&&this.calculatePinSize(),i){i.onStrategySelected();let o=this.style;this.style=this.newStyle,this.newStyle=o}this.dirty=!1}}toPackedMessage(e=!1){var i;let r=this.strategies[this.currentStrategyIndex],n=this.currentStrategyIndex!=null&&this.currentStrategyIndex!==-1&&this.text!==""&&r!=null&&r.name!==_t.HIDDEN&&r.name!==To;if(this.visible&&e&&this.collisionDirty===!1&&n?this.packedMessage.lockedToStrategyIndex=this.currentStrategyIndex:this.packedMessage.lockedToStrategyIndex=-1,this.packedMessage.x=this.projection.x,this.packedMessage.y=this.projection.y,this.packedMessage.enabled=this.enabled,this.packedMessage.rank=this.rank,n&&this.currentStrategyIndex!==((i=this.packedMessage.bboxes[0])==null?void 0:i[4])){let o=this.packedMessage.bboxes.findIndex(a=>a[4]===this.currentStrategyIndex);if(o!==-1){let a=this.packedMessage.bboxes.splice(o,1)[0];this.packedMessage.bboxes.unshift(a)}}if(!this.collisionDirty)return this.packedMessage;this.packedMessage.bboxes=[];for(let o=0;o<this.strategies.length;o++){let s=this.strategies[o].getBoundingBox(),l=[s[0],s[1],s[2],s[3],o];n&&o===this.currentStrategyIndex?this.packedMessage.bboxes.unshift(l):this.packedMessage.bboxes.push(l)}return this.packedMessage.shouldCollideWithScreenEdges=!1,this.collisionDirty=!1,this.packedMessage}destroy(){}};C(Ua,"testId",0);var Bg=Ua,xC=Bg;m();var JC=se(qC());import{z as vt}from"zod";m();var YC="0.6",$e={TOP:"top",BOTTOM:"bottom",LEFT:"left",RIGHT:"right",CENTER:"center",TOP_LEFT:"top-left",TOP_RIGHT:"top-right",BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",HIDDEN:"hidden"},Yg=Object.values($e),WC=[$e.CENTER,$e.HIDDEN],$C=Object.freeze({size:8,color:"#666"});var Wg=vt.object({rank:vt.union([vt.enum(["low","medium","high","always-visible"]),vt.number()]).optional(),interactive:vt.union([vt.boolean(),vt.literal("pointer-events-auto")]).optional(),id:vt.string().optional(),placement:vt.union([vt.enum(Yg),vt.array(vt.enum(Yg))]).optional(),dynamicResize:vt.boolean().optional(),zIndex:vt.number().optional(),lowPriorityPin:vt.object({size:vt.number().positive().optional(),color:vt.string().optional()}).optional()});function Rve(t,e,r){vt.array(vt.number()).min(2).max(3).parse(t),vt.string().parse(e),Wg.parse(r)}var Ha=class Ha{constructor(e,r={}){C(this,"id");C(this,"type","marker");C(this,"rank",0);C(this,"initialRank",0);C(this,"activePlacement","center");C(this,"pointerEvents","none");C(this,"options",{rank:"low",interactive:!1,id:"",placement:WC,dynamicResize:!1,occluderId:0,zIndex:void 0,verticalOffset:0,lowPriorityPin:Ze({},$C)});C(this,"projection",new Pn);C(this,"enabled",!0);C(this,"canShow",!1);C(this,"visible",!0);C(this,"isOccluded",!1);C(this,"offscreen",!1);C(this,"strategyIndex",-1);C(this,"activeBoundingBox",{x:0,y:0,w:0,h:0});C(this,"dimensions",{width:0,height:0});C(this,"markerContainer");C(this,"containerEl");C(this,"contentEl",null);C(this,"contentHtml","");C(this,"style",{top:"0px",left:"0px"});C(this,"dirty",!1);C(this,"attachedDirty",!0);C(this,"collisionDirty",!0);C(this,"visibilityNeedsUpdate","show");C(this,"animation",null);C(this,"currentStrategyIndex",-1);C(this,"onStrategySelected",(e,r=!1)=>{var i;if(this.currentStrategyIndex===e&&!r)return;this.currentStrategyIndex=e;let n=this.strategies[e];if(this.activePlacement=(i=n==null?void 0:n.name)!=null?i:"center",this.activePlacement===$e.HIDDEN){this.markerContainer.setAttribute("data-placement",$e.HIDDEN);let o=this.options.lowPriorityPin,a=o.size,s=o.color;this.markerContainer.style.setProperty("--mappedin-pin-size","".concat(a,"px")),this.markerContainer.style.setProperty("--pin-color",s),this.markerContainer.style.opacity=YC,this.style.top=-a/2+"px",this.style.left=-a/2+"px"}else{this.markerContainer.setAttribute("data-placement",this.activePlacement),this.markerContainer.style.removeProperty("--mappedin-pin-size"),this.markerContainer.style.removeProperty("--pin-color"),this.markerContainer.style.opacity="1";let{width:o,height:a}=this.dimensions,s=-a/2+"px",l=-o/2+"px";switch(this.style.top=s,this.style.left=l,this.activePlacement){case $e.TOP:{this.style.top=-a+"px";break}case $e.BOTTOM:{this.style.top="0px";break}case $e.LEFT:{this.style.left=-o+"px";break}case $e.RIGHT:{this.style.left="0px";break}case $e.TOP_LEFT:{this.style.top=-a+"px",this.style.left=-o+"px";break}case $e.TOP_RIGHT:{this.style.top=-a+"px",this.style.left="0px";break}case $e.BOTTOM_LEFT:{this.style.top="0px",this.style.left=-o+"px";break}case $e.BOTTOM_RIGHT:{this.style.top="0px",this.style.left="0px";break}case $e.CENTER:default:this.style.top=s,this.style.left=l}}this.markerContainer.style.top=this.style.top,this.markerContainer.style.left=this.style.left});C(this,"packedMessage",{x:0,y:0,enabled:!1,rank:0,bboxes:[],lockedToStrategyIndex:-1,shouldCollideWithScreenEdges:!1});var n,i,o,a;if(this.id=(r==null?void 0:r.id)||Ut(),this.options=(0,JC.default)(this.options,r),this.options.placement=(n=r.placement)!=null?n:this.options.placement,typeof r.rank=="string")this.rank=Va(r.rank);else if(r.rank!=null&&r.rank>0)this.rank=r.rank;else{let s=Math.trunc(_.env.NODE_ENV==="test"?Ha.testId:Ha.testId*10)/10;Ha.testId+=.001,this.rank=s}typeof r.interactive=="string"&&(this.pointerEvents=r.interactive==="pointer-events-auto"?"auto":"none"),this.contentHtml=e,this.initialRank=this.rank,this.markerContainer=document.createElement("div"),this.markerContainer.className="mappedin-marker",this.markerContainer.style.opacity="0",this.markerContainer.innerHTML='<div class="mappedin-marker-content">'.concat(this.contentHtml,"</div>"),this.markerContainer.setAttribute("data-marker-id",this.id.toString()),this.containerEl=(i=this.markerContainer.firstElementChild)!=null?i:null,this.contentEl=(a=(o=this.markerContainer.firstElementChild)==null?void 0:o.firstElementChild)!=null?a:null}updateDimensionsIfZeroWidthHeight(e,r){this.dimensions.width===0&&this.dimensions.height===0&&this.updateDimensions(e,r)}updateDimensions(e,r){if(e!=null&&r!=null)this.dimensions={width:e,height:r};else{let{width:n,height:i}=this.markerContainer.getBoundingClientRect();this.dimensions={width:n,height:i}}Object.assign(this.markerContainer,{width:this.dimensions.width+"px",height:this.dimensions.height+"px"}),this.currentStrategyIndex=-1}get strategies(){let{width:e,height:r}=this.dimensions;if(e===0||r===0)return[];let n=Array.isArray(this.options.placement)?this.options.placement:[this.options.placement],i=[];for(let o of n)this.options.rank==="always-visible"&&o===$e.HIDDEN&&n.length>1||i.push({name:o,getBoundingBox:()=>{let a=r/2,s=r/2,l=e/2,u=e/2;switch(o){case $e.TOP:{a=r,s=0;break}case $e.BOTTOM:{a=0,s=r;break}case $e.LEFT:{l=e,u=0;break}case $e.RIGHT:{l=0,u=e;break}case $e.TOP_LEFT:{a=r,l=e,s=0,u=0;break}case $e.TOP_RIGHT:{a=r,u=e,s=0,l=0;break}case $e.BOTTOM_LEFT:{s=r,l=e,a=0,u=0;break}case $e.BOTTOM_RIGHT:{s=r,u=e,a=0,l=0;break}case $e.HIDDEN:let c=Math.max(2,4/2);return[this.options.lowPriorityPin.size/2+c,this.options.lowPriorityPin.size/2+c,this.options.lowPriorityPin.size/2+c,this.options.lowPriorityPin.size/2+c]}return[a+4,s+4,l+4,u+4]}});return i}toPackedMessage(e=!1){var n;this.packedMessage.x=this.projection.x,this.packedMessage.y=this.projection.y,this.packedMessage.enabled=this.enabled,this.packedMessage.rank=this.rank,this.packedMessage.shouldCollideWithScreenEdges=!0;let r=this.currentStrategyIndex!==-1&&this.currentStrategyIndex!==this.lowPriorityPinStrategyIndex;if(this.visible&&e&&r&&this.collisionDirty===!1?this.packedMessage.lockedToStrategyIndex=this.currentStrategyIndex:this.packedMessage.lockedToStrategyIndex=-1,r&&this.currentStrategyIndex!==((n=this.packedMessage.bboxes[0])==null?void 0:n[4])){let i=this.packedMessage.bboxes.findIndex(o=>o[4]===this.currentStrategyIndex);if(i!==-1){let o=this.packedMessage.bboxes.splice(i,1)[0];this.packedMessage.bboxes.unshift(o)}}if(!this.collisionDirty)return this.packedMessage;this.packedMessage.bboxes=[];for(let i=0;i<this.strategies.length;i++){let o=this.strategies[i];i===this.currentStrategyIndex&&r?this.packedMessage.bboxes.unshift([...o.getBoundingBox(),i]):this.packedMessage.bboxes.push([...o.getBoundingBox(),i])}return this.collisionDirty=!1,this.packedMessage}get lowPriorityPinStrategyIndex(){return this.options.rank==="always-visible"?-1:this.strategies.findIndex(e=>e.name===$e.HIDDEN)}destroy(){}};C(Ha,"testId",0);var KC=Ha;m();var Io=class extends Er{constructor(){super(...arguments);C(this,"type","geometry");C(this,"userData",{entityId:"",type:"geometry"})}raycast(r,n){this.userData.type==="model"&&this.children[0]&&r.intersectObject(this.children[0],!0).forEach(i=>{n.push(i)})}},Cr=class{constructor(e,r){C(this,"id",Ut());C(this,"components");C(this,"parentId");C(this,"entities2D",new Map);this.components=[e,r]}getComponent(e){return this.components.find(r=>(r==null?void 0:r.type)===e)}get object3d(){return this.components[0].mesh}get parentObject3D(){var e;return(e=this.components[0].mesh)==null?void 0:e.parent}get type(){return this.components[0].type}attach(e){this.parentObject3D instanceof ur?e.object3d.userData.attachedEntityId=this.id:this.entities2D.set(e.id,e)}detach(e){this.parentObject3D instanceof ur&&(e.object3d.userData.parentEntityId=void 0),this.entities2D.delete(e.id)}removeAllEntities(){for(let e of this.entities2D.values())this.detach(e)}};m();var bn=class extends Er{},Hn=class{constructor(e,r,n=0){C(this,"id");C(this,"verticalOffset");C(this,"occluderId");C(this,"object3d",new bn);C(this,"components");C(this,"disposed",!1);C(this,"worldPosition",new ft);this.id=e.id||Ut(),this.components=[e],this.verticalOffset=n,this.object3d=new bn,this.object3d.position.set(r.x,r.y,r.z+n),this.object3d.userData.entityId=this.id,this.object3d.userData.type=this.type,this.positionDirty=!0}get type(){return this.components[0].type}get parentObject3D(){return this.object3d.parent}get attachedTo(){return this.object3d.userData.attachedEntityId}getComponent(e){return this.components.find(r=>(r==null?void 0:r.type)===e)}get position(){return this.positionDirty&&(this.object3d.matrixAutoUpdate=!0,this.object3d.getWorldPosition(this.worldPosition),this.positionDirty=!1,this.object3d.matrixAutoUpdate=!1),this.worldPosition}get positionDirty(){return this.object3d.userData.worldPositionDirty}set positionDirty(e){this.object3d.userData.worldPositionDirty=e}updatePosition(e){this.object3d.position.copy(e),this.positionDirty=!0}setAltitude(e){this.object3d.position.z=e,this.positionDirty=!0}};m();import{z as _e}from"zod";m();var QC=class extends es{constructor(r,n,i=!0){super();C(this,"rendererState");C(this,"convertTo3DMapPosition");C(this,"textSet",new Set);C(this,"batchedTextMap",new Map);C(this,"useWorker",!0);C(this,"debugTextAreaMesh",new Map);i===!1&&(this.useWorker=!1,FV(!1)),this.rendererState=r,this.convertTo3DMapPosition=n}remove(r){this.textSet.delete(r)}update(r){var s,l,u;let n,i,o,a=[];for(let c of this.rendererState.geometry3DIdsInScene)if(n=this.rendererState.geometry3DMap.get(c),(n==null?void 0:n.type)==="text3d"){i=n.components[0],o=n.components[1];let p=(s=i.mesh)==null?void 0:s.parent;if(!p||!(p instanceof cr)||!(i instanceof fm))continue;if("textArea"in i.feature.properties&&i.mesh!=null&&i.polygonEntityId!=null&&i.textMesh==null&&i.mesh.parent!=null&&((u=(l=i.feature.properties)==null?void 0:l.textArea)==null?void 0:u.position)!=null){if(this.textSet.has(i.polygonEntityId))continue;this.textSet.add(i.polygonEntityId),this.batchedTextMap.has(p)||this.batchedTextMap.set(p,Xa().then(({BatchedText:d})=>{let g=new d;return g.type="batchedtext",p.add(g),g}));let f=this.batchedTextMap.get(p);if(!f)throw new Error("batched text required");a.push(eM({entityId:c,textComponent:i,styleComponent:o,convertTo3DMapPosition:this.convertTo3DMapPosition,batchedMeshPromise:f,rendererState:this.rendererState,type:"text-area"}).then(()=>{this.publish("render")}))}else if(i.mesh!=null&&i.textMesh==null&&i.mesh.parent!=null){if(this.textSet.has(c.toString()))continue;this.textSet.add(c.toString()),this.batchedTextMap.has(p)||this.batchedTextMap.set(p,Xa().then(({BatchedText:d})=>{let g=new d;return g.type="batchedtext",p.add(g),g}));let f=this.batchedTextMap.get(p);if(!f)throw new Error("batched text required");a.push(eM({entityId:c,textComponent:i,styleComponent:o,convertTo3DMapPosition:this.convertTo3DMapPosition,batchedMeshPromise:f,rendererState:this.rendererState,type:"point"}).then(()=>{this.publish("render")}))}let h=this.batchedTextMap.get(p);i.textMesh&&h&&i.polygonEntityId!=null&&Promise.all([h,Promise.resolve({meshComponent:i,styleComponent:o})]).then(([f,{meshComponent:d,styleComponent:g}])=>{let{textMesh:x}=d;if(f&&x){let b=Jg(f,x);d.visible&&!b?f.add(x):!d.visible&&b&&f.remove(x)}g.flipToFaceCamera&&this.flipIfNeeded(d,r)})}return Promise.all(a)}flipIfNeeded(r,n){let i=r.textMesh;if(!i)return!1;let o=i.rotation.z,a=Ku(o+n);a>Math.PI/2&&a<3*Math.PI/2&&(i.rotation.z=Ku(o+Math.PI))}showTextAreaMesh(){let r,n;for(let i of this.rendererState.geometry3DIdsInScene)if(r=this.rendererState.geometry3DMap.get(i),(r==null?void 0:r.type)==="text3d"&&(n=r.components[0],"textArea"in n.feature.properties)){let o=n.feature.properties.textArea;if(!o)continue;let a=new Ax(o.maxWidth,o.maxHeight),s=new qn(a,new zi({color:"pink"})),{textMesh:l}=n;if(!l)continue;let u=this.convertTo3DMapPosition(o.position,Ru);s.position.copy(u),s.position.z=l.position.z-.1,s.rotation.z=l.rotation.z,$g.identity(),$g.makeRotationAxis(new ft(0,0,1),l.userData.rotationZ),Ru.set(o.maxWidth/2,0,0),Ru.applyMatrix4($g),s.position.x-=Ru.x,s.position.y-=Ru.y,this.rendererState.geometryScene.add(s),this.debugTextAreaMesh.set(i,s)}this.publish("render")}hideTextAreaMesh(){this.debugTextAreaMesh.forEach(r=>{this.rendererState.geometryScene.remove(r)}),this.debugTextAreaMesh.clear(),this.publish("render")}};function FV(t){Xa().then(({configureTroikaTextBuilder:e})=>{e({useWorker:t})})}var $g=new Bi,Ru=new ft,Kg;async function e0e(t){let{preloadFont:e}=await Xa();return e(t)}function Xa(){return Kg||(Kg=import("./text3d-DIUCQLOC.js").then(t=>t)),Kg}async function eM({entityId:t,textComponent:e,styleComponent:r,convertTo3DMapPosition:n,batchedMeshPromise:i,rendererState:o,type:a="text-area"}){return Promise.all([Xa(),Promise.resolve({entityId:t,meshComponent:e,styleComponent:r})]).then(([{createTroikaTextPoint:s,createTroikaTextArea:l},u])=>a==="text-area"?l(u.entityId,u.meshComponent,u.styleComponent,n):s(u.entityId,u.meshComponent,u.styleComponent,n)).catch(s=>{Et.warn("Trouble creating text: ",s)}).then(s=>{if(!(s!=null&&s.text))return;let l=[Promise.resolve(s.text),i,Promise.resolve()];if(e.polygonEntityId){let u=o.geometry3DMap.get(e.polygonEntityId);if((u==null?void 0:u.type)==="geometry"){let c=u.components[0],p=u.components[1];c.textMesh=s.text,s.text.position.z=p.altitude+p.height+OV}}else l[2]=Xa().then(({syncText:u})=>u(s.text));return Promise.all(l)}).then(s=>{if(!s)return;let[l,u]=s;u.add(l),e.batchedText||(e.batchedText=u)})}function Jg(t,e){return t._members.has(e)}var OV=.5;var BV=_e.object({visible:_e.boolean(),color:_e.string(),flipToFaceCamera:_e.boolean(),font:_e.string().optional(),fontSize:_e.number(),margin:_e.union([_e.number(),_e.tuple([_e.number(),_e.number(),_e.number(),_e.number()])]),outlineColor:_e.string(),outlineOpacity:_e.number(),outlineBlur:_e.union([_e.number(),_e.string()]),outlineWidth:_e.number(),outlineOffsetX:_e.number(),outlineOffsetY:_e.number(),strokeWidth:_e.number(),maxWidth:_e.number().optional(),maxHeight:_e.number().optional(),strokeOpacity:_e.number(),strokeColor:_e.string(),fillOpacity:_e.number(),hoverColor:_e.string().optional(),id:_e.union([_e.string(),_e.number()]),type:_e.literal("text3d"),position:_e.tuple([_e.number(),_e.number(),_e.number()]),content:_e.string()}),tM=_e.strictObject(BV.partial().omit({id:!0,type:!0}).shape),rM=_e.strictObject(tM.omit({margin:!0,position:!0,maxWidth:!0,maxHeight:!0,content:!0}).shape),s0e=_e.strictObject({appearance:tM.optional(),parentId:_e.string().optional()}),fm=class{constructor(e){C(this,"mesh",new Io);C(this,"textMesh");C(this,"type","text3d");C(this,"feature");C(this,"parent");C(this,"batchedText");C(this,"polygonEntityId");this.feature=e}get visible(){return this.batchedText&&this.textMesh?Jg(this.batchedText,this.textMesh):this.textMesh?this.textMesh.visible:!1}set visible(e){this.batchedText&&this.textMesh?e?this.batchedText.addText(this.textMesh):this.batchedText.removeText(this.textMesh):this.textMesh&&(this.textMesh.visible=e),this.mesh.visible=e}};m();var Za,mm=class{constructor(e){C(this,"type","outline");C(this,"color");C(this,"dirty",!0);C(this,"enabled",!0);mr(this,Za,!1);C(this,"edgeColors");C(this,"edgeVisibility");C(this,"geometry");C(this,"ranges");C(this,"topFaceVerticesIndices");this.color=e}get currentOpacity(){return this.edgeColors&&this.ranges?this.edgeColors.array[this.ranges.start*4+3]:0}set visible(e){if(!this.edgeVisibility||!this.ranges||Ke(this,Za)===e)return;At(this,Za,e);let r=this.edgeVisibility.array,n=e?1:0;for(let i=0;i<this.ranges.count;i++){let o=this.ranges.start+i;r[o]=n}this.edgeVisibility.needsUpdate=!0}get visible(){return Ke(this,Za)}get currentColor(){return this.edgeColors&&this.ranges?[this.edgeColors.array[this.ranges.start*4],this.edgeColors.array[this.ranges.start*4+1],this.edgeColors.array[this.ranges.start*4+2]]:[0,0,0]}};Za=new WeakMap;m();m();m();var dm=class extends Tx{constructor(r){let n=r,i=3,o=i*4;super(new Uint8Array(r*o),i,r,vx,_x);C(this,"_width");C(this,"_height");C(this,"_propertiesLength");this._width=o,this._height=n,this._propertiesLength=i}setColor(r,n,i){let o=this.image.data,a=r*this._width;o[a]=Math.round(n.r*255),o[a+1]=Math.round(n.g*255),o[a+2]=Math.round(n.b*255),o[a+3]=0,o[a+4]=Math.round(i.r*255),o[a+5]=Math.round(i.g*255),o[a+6]=Math.round(i.b*255),o[a+7]=0,this.needsUpdate=!0}getColor(r){let n=this.image.data,i=r*this._width,o=new Lr(n[i]/255,n[i+1]/255,n[i+2]/255),a=new Lr(n[i+4]/255,n[i+5]/255,n[i+6]/255);return{color:o,topColor:a}}setTexture(r,n,i){let o=this.image.data,a=r*this._width;o[a+8]=n?255:0,o[a+9]=i?255:0,o[a+10]=0,o[a+11]=0,this.needsUpdate=!0}getTexture(r){let n=this.image.data,i=r*this._width,o=n[i+8]===255,a=n[i+9]===255;return{texture:o,topTexture:a}}};m();var nM="#define LAMBERT\nvarying vec3 vViewPosition;\nvarying vec4 vPosition;\nvarying vec2 vUv;\nvarying vec4 finalPosition;\nvarying float vVerticalOffset;\nvarying vec3 worldNormal;\nvarying float vBatchId;\n\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nvoid main() {\n\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n\n vViewPosition = - mvPosition.xyz;\n\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n \n // To mitigate visual defects on machines such as windows and iOS\n vBatchId = getIndirectIndex(gl_DrawID) + 0.5;\n vViewPosition = - mvPosition.xyz;\n worldNormal = normal;\n vUv = uv;\n vVerticalOffset = position.z;\n}\n";m();var iM="#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nuniform float uGradientEnd;\nuniform float uGradientIntensity;\nuniform float uMinSideAlpha;\nuniform float uMaxSideAlpha;\nuniform float uGradientStart;\nuniform highp sampler2D uPropertiesTexture;\nuniform highp sampler2D uTopTexture;\nuniform highp sampler2D uTexture;\nuniform float uRepeatYFactor;\nuniform bool uBlendTexture;\nvarying float vBatchId;\n\nvarying vec2 vUv;\nvarying float vVerticalOffset;\nvarying vec3 worldNormal;\n\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvec3 blendTextureColor(vec3 diffuseColor, vec4 texColor) {\n vec3 texturedColor = diffuseColor * texColor.rgb;\n return mix(diffuseColor, texturedColor, texColor.a);\n}\n\nvoid main() {\n #include <clipping_planes_fragment>\n\n // get the normalized world normal of vertex fragment\n vec3 surfaceNormal = normalize(worldNormal);\n\n // get angle relative to Z up\n float angle = degrees(acos(abs(dot(surfaceNormal, vec3(0.0, 0.0, 1.0)))));\n\n int idx = int(vBatchId) * 1;\n vec3 diffuse = vec3(texelFetch(uPropertiesTexture, ivec2(0, idx), 0).rgb);\n bool shouldShowTexture = texelFetch(uPropertiesTexture, ivec2(2, idx), 0).r > 0.99;\n\n if(shouldShowTexture) {\n vec4 tex2d = texture2D(uTexture, vec2(vUv.x, vUv.y * uRepeatYFactor));\n diffuse = uBlendTexture ? blendTextureColor(diffuse, tex2d) : tex2d.rgb;\n }\n\n // if this is a fragment facing upwards, use topColor. Avoid any sort of '==' comparison, due to floating point precision issue\n if(angle < 0.02) {\n bool shouldShowTopTexture = texelFetch(uPropertiesTexture, ivec2(2, idx), 0).g > 0.99;\n\n if(shouldShowTopTexture) {\n vec4 topTex2d = texture2D(uTopTexture, vUv);\n diffuse = uBlendTexture ? blendTextureColor(diffuse, topTex2d) : topTex2d.rgb;\n } else {\n diffuse = vec3(texelFetch(uPropertiesTexture, ivec2(1, idx), 0).rgb);\n }\n }\n\n vec4 diffuseColor = vec4(diffuse, opacity);\n\n // only for vertical surfaces\n if(angle > 89.0 && angle < 91.0) {\n\n // get the percentage of the z position from the ground, up\n float percentFromZeroZ = max((abs(vVerticalOffset) - uGradientStart) / uGradientEnd, 0.0);\n\n // gradient based on percentage\n float alpha = smoothstep(uMinSideAlpha, uMaxSideAlpha, percentFromZeroZ);\n\n // mix the shadow color with the diffuse color based on the alpha and opacity\n diffuseColor = vec4(mix(diffuseColor.rgb, diffuseColor.rgb * (1.0 - uGradientIntensity), 1.0 - alpha), opacity);\n }\n\n ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n vec3 totalEmissiveRadiance = emissive;\n\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <specularmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n\n // accumulation\n #include <lights_lambert_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n\n // modulation\n #include <aomap_fragment>\n\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\n #include <envmap_fragment>\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n\n}\n";var zV=-.05,VV=1,ku=class extends Ex{constructor(r,n,i=1){super(r);C(this,"propertiesTexture");C(this,"texturesVisible",!1);C(this,"uniforms",{uGradientIntensity:{value:0},uGradientEnd:{value:0},uGradientStart:{value:0},uTopTexture:{value:void 0},uTexture:{value:void 0},uRepeatYFactor:{value:1},uBlendTexture:{value:!1}});C(this,"colorSpace",Lm);C(this,"showTextures",r=>{this.texturesVisible=!0;let n=!!this.uniforms.uTexture.value,i=!!this.uniforms.uTopTexture.value;(n||i)&&(this.propertiesTexture.setTexture(r,n,i),this.needsUpdate=!0)});this.alphaTest=.01,this.propertiesTexture=new dm(n),this.uniforms.uRepeatYFactor.value=i,this.onBeforeCompile=o=>{let a=this.uniforms.uGradientIntensity,s=this.uniforms.uGradientEnd,l=this.uniforms.uGradientStart,u=this.uniforms.uTopTexture,c=this.uniforms.uTexture,p=this.uniforms.uRepeatYFactor,h=this.uniforms.uBlendTexture;this.uniforms=o.uniforms,o.vertexShader=nM,o.fragmentShader=iM,Object.assign(this.uniforms,{uGradientIntensity:a,uGradientEnd:s,uGradientStart:l,uMinSideAlpha:{value:zV},uMaxSideAlpha:{value:VV},uPropertiesTexture:{value:this.propertiesTexture},uTopTexture:u,uTexture:c,uRepeatYFactor:p,uBlendTexture:h})}}get repeatYFactor(){return this.uniforms.uRepeatYFactor.value}set repeatYFactor(r){r!==this.uniforms.uRepeatYFactor.value&&(this.uniforms.uRepeatYFactor.value=r,this.needsUpdate=!0)}get texture(){return this.uniforms.uTexture.value}set texture(r){if(r==null){this.uniforms.uTexture.value=null;return}r.wrapS=Ja,r.wrapT=Ja,r.colorSpace=this.colorSpace,this.uniforms.uTexture.value=r}get topTexture(){return this.uniforms.uTopTexture.value}set topTexture(r){if(r==null){this.uniforms.uTopTexture.value=null;return}r.wrapS=Ja,r.wrapT=Ja,r.colorSpace=this.colorSpace,this.uniforms.uTopTexture.value=r}get blendTexture(){return this.uniforms.uBlendTexture.value}set blendTexture(r){r!==this.uniforms.uBlendTexture.value&&(this.uniforms.uBlendTexture.value=r,this.colorSpace=r?Px:Lm,this.texture&&(this.texture.colorSpace=this.colorSpace),this.topTexture&&(this.topTexture.colorSpace=this.colorSpace),this.needsUpdate=!0)}setGradientShading(r,n,i){this.uniforms.uGradientStart.value=r,this.uniforms.uGradientEnd.value=n,this.uniforms.uGradientIntensity.value=i}getGradientShading(){return{start:this.uniforms.uGradientStart.value,end:this.uniforms.uGradientEnd.value,intensity:this.uniforms.uGradientIntensity.value}}setColor(r,n,i){this.propertiesTexture.setColor(r,n,i)}getColor(r){return this.propertiesTexture.getColor(r)}hideTextures(r){this.texturesVisible=!1;let n=!!this.uniforms.uTexture.value,i=!!this.uniforms.uTopTexture.value;(n||i)&&(this.propertiesTexture.setTexture(r,!1,!1),this.needsUpdate=!0)}removeSideTexture(r){if(this.texture){this.texture.dispose(),this.uniforms.uTexture.value=null;let n=!!this.uniforms.uTopTexture.value;this.propertiesTexture.setTexture(r,!1,n),this.needsUpdate=!0}}removeTopTexture(r){if(this.topTexture){this.topTexture.dispose(),this.uniforms.uTopTexture.value=null;let n=!!this.uniforms.uTexture.value;this.propertiesTexture.setTexture(r,n,!1),this.needsUpdate=!0}}dispose(){super.dispose(),this.propertiesTexture.dispose()}};m();var A0e={top:0,bottom:0,left:0,right:0,type:"pixel"},Fu={enabled:!1,thickness:0,size:0,offset:0,segments:3};function E0e(t,e){var r,n,i,o,a;return{bevelEnabled:(r=t==null?void 0:t.enabled)!=null?r:Fu.enabled,bevelThickness:(n=t==null?void 0:t.thickness)!=null?n:Fu.thickness,bevelSize:(i=t==null?void 0:t.size)!=null?i:(t==null?void 0:t.thickness)||Fu.size,bevelOffset:(o=t==null?void 0:t.offset)!=null?o:Fu.offset,bevelSegments:(a=t==null?void 0:t.segments)!=null?a:Fu.segments,depth:e}}var oM="mappedin";var aM={GEOMETRY:0,IMAGE_MESH:1,ALWAYS_ON_TOP_PATHS:10,ALWAYS_ON_TOP_MODELS:11},L0e=250,D0e="collision-worker.csp.js",R0e="maplibre-worker.csp.js";m();function W0e(t,e){var u,c,p;let r=0;for(let h of t)r+=((c=(u=h.components[0])==null?void 0:u.geometry)==null?void 0:c.attributes.position.count)||0;let n=new Lr(e.color),i;i=new ku({color:n,side:e.side==="back"?xx:e.side==="front"?gx:bx,opacity:(p=e.opacity)!=null?p:1,transparent:e.opacity!==void 0?e.opacity<1:!1,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1},t.length);let o=new qa(t.length,r,0,i);o.renderOrder=aM.GEOMETRY;let a,s,l;for(let h of t)a=h.components[0],!(!(a instanceof Ai)||!a.geometry)&&(a.mesh=o,a.material=i,a.instanceIndex=o.addGeometry(a.geometry),o.addInstance(a.instanceIndex),o.userData.entities[a.instanceIndex]=h.id,i instanceof ku&&i.setColor(a.instanceIndex,n,e.topColor?new Lr(e.topColor):n),s=o.getGeometryIdAt(a.instanceIndex),a.batchedProps&&(l=o.getGeometryRangeAt(s),l&&(a.batchedProps.range=l),a.batchedProps.geometryId=s));return o.perObjectFrustumCulled=!0,o.matrixAutoUpdate=!1,o}function Qg(t){return oe(t).darken(30).toRgbString()}function $0e(t,e,r,n){if(e.length<1)return;t.boundingBox||t.computeBoundingBox();let i=t.boundingBox,o=t.getAttribute("position"),a=t.getAttribute("normal"),s=t.getAttribute("uv"),l,u;t.index?(l=t.index.count/3,u=function(P,w){return t.index.getX(P*3+w)}):(l=o.count/3,u=function(P,w){return P*3+w});let c=new Bi;c.makeRotationFromQuaternion(new Dm().setFromEuler(new km(0,0,r/180*Math.PI)));let p=e.find(P=>P.face==="top"),h;p&&(h={min:n(p.bounds[1],p.bounds[0],0),max:n(p.bounds[3],p.bounds[2],i.max.z)});let f=e.find(P=>P.face==="side"),d;if(f&&(d={min:n(f.bounds[1],f.bounds[0],0),max:n(f.bounds[3],f.bounds[2],i.max.z)}),!(!d&&!h))for(let P=0;P<l;++P){let w=a.getX(u(P,0))+a.getX(u(P,1))+a.getX(u(P,2)),T=a.getY(u(P,0))+a.getY(u(P,1))+a.getY(u(P,2)),S=a.getZ(u(P,0))+a.getZ(u(P,1))+a.getZ(u(P,2)),I=Math.abs(w),M=Math.abs(T),E=Math.abs(S);var g,x;I<=M&&I<=E?(g="x",M<=E?x="y":x="z"):M<=I&&M<=E?(g="y",I<=E?x="x":x="z"):(g="z",I<=M?x="x":x="y"),g==="z"&&(g=x,x="z");let L,k,F,z,A,R;if(x==="z"||g==="z"){if(!f||!d)continue;L=f.repeat.u,k=f.repeat.v,F=f.offset.u,z=f.offset.v,A=f.rotation,R=d}else{if(!p||!h)continue;L=p.repeat.u,k=p.repeat.v,F=p.offset.u,z=p.offset.v,A=(360-r+p.rotation)%360,R=h}let{min:H,max:W}=R,$=new Er;$.position.set(H.x,H.y,0),$.updateMatrix(),$.updateMatrixWorld();let he=H.clone().applyMatrix4(c),Xe=W.clone().applyMatrix4(c),be=Math.abs(Xe.x-he.x),ye=Math.abs(Xe.y-he.y),qe=new ft(be,ye,W.z).applyMatrix4($.matrixWorld),rt=Math.abs(qe[g]-H[g]),Pt=Math.abs(qe[x]-H[x]),ut=A*Math.PI/180||0,Vt=Math.cos(ut),pr=Math.sin(ut),on=$.matrixWorld.clone().invert(),hr=new Dm().setFromEuler(new km(0,0,r/180*Math.PI));for(let Mt=0;Mt<3;Mt++){let Ro=new ft(o.getX(u(P,Mt)),o.getY(u(P,Mt)),o.getZ(u(P,Mt))).applyMatrix4(on);Ro.applyQuaternion(hr);let Ri=Ro.applyMatrix4($.matrixWorld),_n=Ri.x,ko=Ri.y,Fo=Ri.z;var b,v;g==="x"?b=L*(_n-H[g])/rt+F:g==="y"?b=L*(ko-H[g])/rt+F:b=L*(Fo-H[g])/rt+F,x==="x"?v=k*(_n-H[x])/Pt+z:x==="y"?v=k*(ko-H[x])/Pt+z:v=k*(Fo-H[x])/Pt+z,b-=.5,v-=.5;let Zn=b*Vt-v*pr+.5,Ir=b*pr+v*Vt+.5;s.setX(u(P,Mt),Zn),s.setY(u(P,Mt),Ir)}}}m();var ym=class{constructor(){C(this,"type","focusable");C(this,"focusMesh");C(this,"dirty",!0)}};m();var gm=class{constructor(e,r){C(this,"type","texture");C(this,"texture");C(this,"topTexture");C(this,"showTexture",!0);C(this,"showTopTexture",!0);C(this,"textureInstance");C(this,"topTextureInstance");C(this,"dirty",!0);this.texture=typeof e=="string"?{path:e}:e,this.topTexture=typeof r=="string"?{path:r}:r}};m();var xm=class{constructor(){C(this,"type","border");C(this,"dirty",!0);C(this,"needsRebuild",!1);C(this,"mesh")}set visible(e){this.mesh&&(this.mesh.visible=e)}get visible(){return this.mesh?this.mesh.visible:!1}};m();var bm=class{constructor(){C(this,"type","clippingPlane");C(this,"dirty",!0);C(this,"needsRebuild",!1);C(this,"verticalOffset",1/0);C(this,"plane");C(this,"holeFillMesh");C(this,"topColor");C(this,"topVisible",!0)}};function Ou(t,e,r){if(e!==void 0){if(t.type==="model"||t.type==="path"||t.type==="marker"||t.type==="label"||t.type==="geometry"||t.type==="group-container"||t.type==="custom-geometry")return e===!0?(t instanceof Hn&&t.components[1]===void 0?(t.components[1]=new za,t.components[1].dirty=!0):t instanceof Cr&&t.components[2]===void 0?(t.components[2]=new za,t.components[2].dirty=!0):t instanceof cr&&t.components[0]===void 0&&(t.components[0]=new za,t.components[0].dirty=!0),!0):(t instanceof Hn?t.components[1]=void 0:t instanceof Cr?t.components[2]=void 0:t instanceof cr&&(t.components[0]=void 0),!0);if(t.type==="geometry-group"){let n;for(let i of t.userData.entities3D.values())n=r.geometry3DMap.get(i),Ou(n,e,r);return!0}}return!1}function E1e(t,e,r){if(!(!(r!=null&&r.color)&&!("topColor"in r))){if(r!==void 0&&t.type==="geometry-group"){let n;for(let i of t.userData.entities3D.values())n=e.geometry3DMap.get(i),n&&sM(n,r);return!0}return!1}}function GV(t,e){e!==void 0&&t.type==="geometry"&&(t.components[1].shading=e,t.components[1].dirty=!0)}function L1e(t,e,r){if(r!==void 0&&t.type==="geometry-group"){for(let n of t.userData.entities3D.values()){let i=e.geometry3DMap.get(n);i&&GV(i,r)}return!0}return!1}function D1e(t,e){e!==void 0&&t.type==="geometry"&&(e.showImage!==void 0&&(t.components[1].showImage=e.showImage),e.flipImageToFaceCamera!==void 0&&(t.components[1].flipImageToFaceCamera=e.flipImageToFaceCamera))}function jV(t,e,r){if(r!==void 0){if(t.type==="geometry"){let n=t.components[1];if(n.height!==r)return n.height=r,n.dirty=!0,t.components[3]&&(t.components[3].dirty=!0),t.components[5]&&(t.components[5].needsRebuild=!0,t.components[5].dirty=!0),!0}else if(t.type==="geometry-group"){for(let n of t.userData.entities3D.values()){let i=e.geometry3DMap.get(n);((i==null?void 0:i.type)==="geometry"||(i==null?void 0:i.type)==="model")&&jV(i,e,r)}return!0}}return!1}function sM(t,e){if(e!==void 0){let r=!1;(t.type==="path"||t.type==="geometry")&&(e.initialColor!==void 0&&e.initialColor!==t.components[1].initialColor&&(t.components[1].initialColor=e.initialColor,r=!0),e.color!==void 0&&e.color!==t.components[1].color&&(t.components[1].color=e.color,r=!0,t.components[3]&&(t.components[3].color=Qg(e.color),t.components[3].dirty=!0)),"topColor"in e&&(t.components[1].topColor=e.topColor,r=!0),r&&(t.components[1].dirty=!0))}}function R1e(t,e,r){e!==void 0&&(t.type==="label"||t.type==="marker"?t.updatePosition(r(e[1],e[0],e[2]||0)):t.type==="custom-geometry"&&t.components[0].position.copy(r(e[1],e[0],e[2]||0)))}function k1e(t,e){var r;return e!==void 0&&(t.type==="marker"||t.type==="label"||t.type==="custom-geometry")&&t.parentObject3D!==e&&t.parentObject3D instanceof cr?((r=t.parentObject3D)==null||r.removeEntity(t),e.addEntity(t),!0):!1}function F1e(t,e){e!==void 0&&(t.type==="marker"||t.type==="label")&&t.components[0].enabled!==e&&(t.components[0].enabled=e)}function O1e(t,e,r){if(e!==void 0&&t.type==="marker"){let n=t.components[0];if(e.contentHTML!==void 0)return n.containerEl.innerHTML=e.contentHTML,n.contentHtml=e.contentHTML,!0;if(uM(t,e.placement)&&(n.collisionDirty=!0),e.dynamicResize!==void 0)return n.options.dynamicResize=e.dynamicResize,!0;if(e.options!=null){try{Wg.parse(e.options||{})}catch(i){return Et.error(i),!1}return e.options.interactive!=null&&(e.options.interactive==="pointer-events-auto"?(n.pointerEvents="auto",Ou(t,!1,r)):(n.pointerEvents="none",Ou(t,e.options.interactive,r))),lM(t,e.options.rank),!0}}return!1}function lM(t,e){return e!==void 0&&(t.type==="marker"||t.type==="label")?(t.components[0].rank=Va(e),!0):!1}function HV(t,e){var a;if(((a=e==null?void 0:e.options)==null?void 0:a.appearance)==null)return;let r=e.options.appearance||{},n=r.opacity!=null&&r.opacity!==t.appearance.opacity,o=r.iconScale!=null&&r.iconScale!==t.appearance.iconScale&&typeof r.iconScale=="number"&&Number.isFinite(r.iconScale);n&&(r.opacity=ex(r.opacity)),o&&(r.iconScale=ex(r.iconScale)),rx(t.appearance,r),n&&t.canShow&&t.visibilityNeedsUpdate!=="hide"&&(t.visibilityNeedsUpdate="show")}function B1e(t,e,r){var n,i,o,a,s;if(e!==void 0&&t.type==="label"){let l=t.components[0];e.text!==void 0&&e.text!==l.text&&(l.text=e.text,l.textDirty=!0),fC(l.appearance,((n=e.options)==null?void 0:n.appearance)||{})&&(l.textDirty=!0),mC(l.appearance,((i=e.options)==null?void 0:i.appearance)||{})&&(l.pinDirty=!0),HV(l,e),uM(t,(o=e.options)==null?void 0:o.textPlacement)&&(l.currentStrategyIndex=-1,l.collisionDirty=!0),Ou(t,(a=e.options)==null?void 0:a.interactive,r),lM(t,(s=e.options)==null?void 0:s.rank)}}function uM(t,e){if(e!==void 0){if(t.type==="label"){let r=t.components[0];return r.options.textPlacement=e,!0}else if(t.type==="marker"){let r=t.components[0];return r.options.placement=e,!0}}return!1}function z1e(t,e){e!==void 0&&t.type==="geometry"&&(t.components[1].hoverColor=e,t.components[1].dirty=!0)}function V1e(t,e){if(e!==void 0){let r=t.components[2];if(t.type==="geometry"&&r!=null)return r.hover=e,r.dirty=!0,!0}return!1}function U1e(t,e){e!==void 0&&t.type==="image"&&(t.components[1].flipImageToFaceCamera=e)}function N1e(t,e){e!==void 0&&t.type==="geometry"&&(t.components[1].enableImageCollisions=e)}function cM(t,e,r){if(r!==void 0)if(t.type==="model"||t.type==="path"||t.type==="geometry"||t.type==="custom-geometry"||t.type==="image"||t.type==="text3d"){r!==t.components[1].visible&&(t.components[1].visible=r,t.components[1].dirty=!0);let n=t.components[3];return n&&(n.dirty=!0),!0}else{if(t.type==="geometry-group")return t.setVisible(r),!0;if(t.type==="group-container"){if(t.visible!==r)return t.setVisible(r),r===!1&&t.traverse(n=>{if(n instanceof bn){let i=e.geometry2DMap.get(n.userData.entityId);if(i){let o=i.components[0];o instanceof xC&&(o.canShow=r)}}}),!0}else if(t.type==="label")return t.components[0].visible=r,!0}return!1}function XV(t,e,r){if(r!==void 0)if(t.type==="geometry-group"){for(let n of t.userData.entities3D.values()){let i=e.geometry3DMap.get(n);((i==null?void 0:i.type)==="geometry"||(i==null?void 0:i.type)==="model")&&XV(i,e,r)}return!0}else if(t.type==="group-container"){if(t.opacity!==r){t.setOpacity(r);let n=1;return t.parent instanceof cr&&(n=t.parent.opacity),pM(t,e,n),!0}}else t instanceof Cr&&t.components[1].opacity!==r&&(t.components[1].opacity=r,t.components[1].dirty=!0);return!1}function pM(t,e,r=1){if(t.type==="group-container"&&"children"in t&&t.children.length>0){let n=r*t.opacity;t.userData.computedOpacity=n;for(let i of t.children)(i instanceof ur&&i.type==="geometry-group"||i instanceof cr&&i.type==="group-container")&&pM(i,e,n)}else if(t.type==="geometry-group")for(let n of t.userData.entities3D.values()){let i=e.geometry3DMap.get(n),o;((i==null?void 0:i.type)==="geometry"||(i==null?void 0:i.type)==="model")&&(o=i.components[1],o.dirty=!0)}}function G1e(t,e,r){let n=!1;if(r!==void 0){if(t.type==="geometry-group")for(let i of t.userData.entities3D.values()){let o=e.geometry3DMap.get(i);o&&ZV(o,r)}return!0}return n}function ZV(t,e){if(t.type==="geometry"&&((e==null?void 0:e.texture)!=null||(e==null?void 0:e.topTexture)!=null)){let r=!1,n=t.components[6];if(n==null?(t.components[6]=new gm(e==null?void 0:e.texture,e==null?void 0:e.topTexture),r=!0):((e==null?void 0:e.texture)!=null&&(n==null?void 0:n.texture)!==(e==null?void 0:e.texture)&&(n.texture=typeof e.texture=="string"?{path:e.texture}:e.texture,r=!0,n.dirty=!0),(e==null?void 0:e.topTexture)!=null&&(n==null?void 0:n.topTexture)!==(e==null?void 0:e.topTexture)&&(n.topTexture=typeof e.topTexture=="string"?{path:e.topTexture}:e.topTexture,r=!0,n.dirty=!0)),r&&t.components[0]instanceof Ai){let i=t.components[0];return i.detached===!1&&(i.shouldDetach=!0,i.dirty=!0),!0}}return!1}function j1e(t,e){if(e!==void 0&&t.type==="geometry"){let r=t.components[1];if(r.opacity!==e){r.opacity=e;let n=t.components[0],i=t.components[3];i&&(i.dirty=!0),n.detached===!1&&(n.shouldDetach=!0,n.dirty=!0),r.dirty=!0;let o=t.parentObject3D;return(o==null?void 0:o.type)==="geometry-group"&&(o.userData.shadingDirty=!0),!0}}return!1}function qV(t,e,r){if(r!==void 0)if(t.type==="geometry"||t.type==="path"||t.type==="custom-geometry"){let n=t.components[1];if(n.altitude!==r)return n.altitude=r,n.dirty=!0,t.components[3]&&(t.components[3].dirty=!0),t.components[5]&&(t.components[5].needsRebuild=!0,t.components[5].dirty=!0),!0}else{if(t.type==="group-container"&&t.altitude!==r)return t.setAltitude(r),!0;if(t.type==="geometry-group"){let n;for(let i of t.userData.entities3D.values())n=e.geometry3DMap.get(i),n&&qV(n,e,r)}}return!1}function YV(t,e,r){if(r!==void 0){if(t.type==="geometry-group")for(let n of t.userData.entities3D.values()){let i=e.geometry3DMap.get(n);i instanceof Cr&&YV(i,e,r)}else if(t.type==="geometry"){let n=t.components[3],i=t.components[1];!n&&r===!0?t.components[3]=new mm(Qg(i.color)):n&&(n.enabled=r,n.dirty=!0)}return!0}return!1}function H1e(t,e){if(e!==void 0){let r,n=4;if(t.type==="geometry"?(r=t.components[4],n=4):t.type==="group-container"&&(r=t.components[1],n=1),e===!0&&r==null)return t.components[n]=new ym,!0;if(e===!1&&r!=null)return t.components[n]=void 0,!0}return!1}function X1e(t,e){if(e!==void 0&&t.type==="geometry"){let r=t.components[1];if(r.renderOrder!==e){r.renderOrder=e;let n=t.components[0];return n.detached===!1&&(n.shouldDetach=!0,n.dirty=!0),n.imageMesh&&(n.imageMesh.renderOrder=e+1),r.dirty=!0,!0}}return!1}function WV(t,e,r){if(r!=null){if(t.type==="geometry"){let n=t.components[1];n.side!==r&&(n.side=r,n.dirty=!0)}else if(t.type==="geometry-group")for(let n of t.userData.entities3D.values()){let i=e.geometry3DMap.get(n);i instanceof Cr&&WV(i,e,r)}}}function Z1e(t,e){if(e!==void 0&&t.type==="geometry"){let r=t.components[1],n;if(n=t.components[5],e.borderVisible!==r.borderVisible&&e.borderVisible!=null){if(e.borderVisible===!0){if(n==null){let i=new xm;t.components[5]=i,n=t.components[5]}n.visible=!0,n.dirty=!0}else e.borderVisible===!1&&n!=null&&(n.visible=!1,n.dirty=!0);r.borderVisible=e.borderVisible}r.borderColor!==e.borderColor&&e.borderColor!=null&&(r.borderColor=e.borderColor,n&&(n.dirty=!0)),r.borderWidth!==e.borderWidth&&e.borderWidth!=null&&(r.borderWidth=e.borderWidth,n&&(n.needsRebuild=!0))}}function q1e(t,e,r){let{visible:n,color:i}=r;if(t.type!=="path")return;let o=t.components[0];n!=null&&cM(t,e,n),i!=null&&sM(t,{color:i}),Object.assign(o,$V(r)),tx(r)||(o.materialDirty=!0,r.width!=null&&(o.dirty=!0))}function $V(t){return Bu(t,KV)}var KV=["animateArrowsOnPath","displayArrowsOnPath","width","accentColor","completeFraction","highlightCompleteFraction","highlightStartFraction","highlightEndFraction","highlightColor","highlightWidthMultiplier","dashed","visibleThroughGeometry"];function Y1e(t){if(!(t instanceof Cr&&t.type==="text3d"))throw new Error("expect target is TextGeometry3D")}var JV=["visible","color","strokeWidth","outlineOffsetX","outlineOffsetY","outlineWidth","outlineBlur","outlineOpacity","outlineColor","strokeWidth","strokeColor","strokeOpacity","maxWidth","maxHeight","font","hoverColor","fillOpacity","fontSize","flipToFaceCamera"];function W1e(t,e,r){cM(t,e,r.visible);let n=t.components[1],i=Bu(r,JV);"margin"in r&&Et.warn("update to margin is not supported atm"),"content"in r&&Et.warn("content update is not supported atm");try{rM.parse(i)}catch(o){Et.error(o);return}Object.keys(i).length>0&&(Object.assign(n,i),n.dirty=!0)}var QV=["color","material","opacity","verticalOffset","rotation","position","scale"];function $1e(t,e){let r=Bu(e,QV),n=t.components[1],i=t.components[0];Object.keys(r).length>0&&(r.material&&(n.material=r.material),r.opacity!=null&&(n.opacity=r.opacity),r.verticalOffset!=null&&(n.verticalOffset=r.verticalOffset),r.color!=null&&(n.color=r.color),r.position!=null&&(i.feature.geometry.coordinates=r.position,i.positionDirty=!0),r.rotation!=null&&(n.rotation=r.rotation),r.scale!=null&&(n.scale=r.scale),r.visibleThroughGeometry!=null&&(i.visibleThroughGeometry=r.visibleThroughGeometry),n.dirty=!0)}function K1e(t,e){if(e!==void 0&&t.type==="model"){let r=t.components[7];r==null&&(t.components[7]=new bm,r=t.components[7]),r=t.components[7],e.clippingPlaneZOffset!=null&&r.verticalOffset!==e.clippingPlaneZOffset&&(r.verticalOffset=e.clippingPlaneZOffset,r.dirty=!0),e.clippingPlaneTopColor!=null&&r.topColor!==e.clippingPlaneTopColor&&(r.topColor=e.clippingPlaneTopColor,r.dirty=!0),e.clippingPlaneTopVisible!=null&&r.topVisible!==e.clippingPlaneTopVisible&&(r.topVisible=e.clippingPlaneTopVisible,r.dirty=!0)}}m();m();var ox=se(vM());function PM(t){this.name="JSClipperError",this.message=t,this.stack=new Error().stack}PM.prototype=Error.prototype;ox.default.Error=function(t){throw new PM(t)};var Xn=ox.default;var q4="gray",ax=new Xn.ClipperOffset,qt=100;function sx(t,e,r){let{color:n=q4,opacity:i=1,width:o=1,join:a="round",cap:s="round",height:l=.01,altitude:u=0}=r||{};Array.isArray(i)&&(i=0);let c=[],p=t.geometry.coordinates.every(b=>b[2]!=null);for(let b=0;b<t.geometry.coordinates.length-1;b++){let v=e(t.geometry.coordinates[b][1],t.geometry.coordinates[b][0],t.geometry.coordinates[b][2]),P=e(t.geometry.coordinates[b+1][1],t.geometry.coordinates[b+1][0],t.geometry.coordinates[b+1][2]);c.push([v,P])}let h=c[0][0].y;ax.AddPaths(c.map(b=>b.map(v=>({X:v.x*qt,Y:(p?v.z:v.y)*qt}))),a==="round"?Xn.JoinType.jsRound:a==="miter"?Xn.JoinType.jsMiter:Xn.JoinType.jsSquare,s==="round"?Xn.EndType.etOpenRound:s==="butt"?Xn.EndType.etOpenButt:Xn.EndType.etOpenSquare);let f=new Xn.PolyTree;ax.Execute(f,o/2*qt);let d=[],g={bevelEnabled:!1,depth:l};for(let b of f.m_AllPolys){let v=new Mx;if(b.IsHole())continue;let P=b.m_polygon;v.moveTo(P[0].X/qt,P[0].Y/qt),P.slice(1).forEach(w=>v.lineTo(w.X/qt,w.Y/qt)),v.lineTo(P[0].X/qt,P[0].Y/qt),v.holes=b.m_Childs.map(w=>{let T=new Cx,S=w.m_polygon;return T.moveTo(S[0].X/qt,S[0].Y/qt),S.slice(1).forEach(I=>T.lineTo(I.X/qt,I.Y/qt)),T.lineTo(S[0].X/qt,S[0].Y/qt),T}),d.push(new Ix(v,g))}let x=Zu(d);return p&&(x.rotateX(Math.PI/2),x.translate(0,h+l/2,u||0)),x.userData={style:{color:n,opacity:i}},ax.Clear(),x}m();m();var Mr=63710088e-1,mPe={centimeters:Mr*100,centimetres:Mr*100,degrees:360/(2*Math.PI),feet:Mr*3.28084,inches:Mr*39.37,kilometers:Mr/1e3,kilometres:Mr/1e3,meters:Mr,metres:Mr,miles:Mr/1609.344,millimeters:Mr*1e3,millimetres:Mr*1e3,nauticalmiles:Mr/1852,radians:1,yards:Mr*1.0936};function wM(t,e,r={}){let n={type:"Feature"};return(r.id===0||r.id)&&(n.id=r.id),r.bbox&&(n.bbox=r.bbox),n.properties=e||{},n.geometry=t,n}function TM(t,e,r={}){if(t.length<2)throw new Error("coordinates must be an array of two or more positions");return wM({type:"LineString",coordinates:t},e,r)}function SM(t,e={}){let r={type:"FeatureCollection"};return e.id&&(r.id=e.id),e.bbox&&(r.bbox=e.bbox),r.features=t,r}function CM(t,e,r={}){return wM({type:"MultiLineString",coordinates:t},e,r)}m();function Tm(t){return t.type==="Feature"?t.geometry:t}function Y4(t,e={}){let r=Tm(t);switch(!e.properties&&t.type==="Feature"&&(e.properties=t.properties),r.type){case"Polygon":return W4(r,e);case"MultiPolygon":return $4(r,e);default:throw new Error("invalid poly")}}function W4(t,e={}){let n=Tm(t).coordinates,i=e.properties?e.properties:t.type==="Feature"?t.properties:{};return MM(n,i)}function $4(t,e={}){let n=Tm(t).coordinates,i=e.properties?e.properties:t.type==="Feature"?t.properties:{},o=[];return n.forEach(a=>{o.push(MM(a,i))}),SM(o)}function MM(t,e){return t.length>1?CM(t,e):TM(t[0],e)}var lx=Y4;m();function IM(t){t&&(t.map&&(t.map.dispose(),t.map=void 0),t.dispose())}function ux(t){for(;t.children.length>0;)ux(t.children[0]);"geometry"in t&&t.geometry&&t.geometry.dispose(),"material"in t&&Array.isArray(t.material)?t.material.forEach(function(e){IM(e)}):"material"in t&&typeof t.material<"u"&&IM(t.material),t.parent&&t.parent.remove(t)}m();function AM(t){return t!=null&&t.geometry.type==="Polygon"&&t.geometry.coordinates[0].length>2}function K4(t,e){let r=t[0]*e[0]+t[1]*e[1],n=Math.sqrt(t[0]*t[0]+t[1]*t[1]),i=Math.sqrt(e[0]*e[0]+e[1]*e[1]);if(n===0||i===0)return 0;let o=r/(n*i),a=Math.max(-1,Math.min(1,o));return Math.acos(a)*(180/Math.PI)}function J4(t,e=5){if(t.length<3)return t;let r=t.length>3&&t[0][0]===t[t.length-1][0]&&t[0][1]===t[t.length-1][1],n=[],i=r?t.length-1:t.length;for(let o=0;o<i;o++){let a=r&&o===0?t[t.length-2]:t[o-1],s=t[o],l=r&&o===t.length-1?t[1]:t[o+1];if(a==null||l==null){n.push(s);continue}let u=[s[0]-a[0],s[1]-a[1]],c=[l[0]-s[0],l[1]-s[1]];K4(u,c)>e&&n.push(s)}if(r&&n.length>0){let o=n[0],a=n[n.length-1];(o[0]!==a[0]||o[1]!==a[1])&&n.push([o[0],o[1]])}return n}function EM(t,e=5){return wt(Ze({},t),{geometry:wt(Ze({},t.geometry),{coordinates:t.geometry.coordinates.map(r=>J4(r,e))})})}var DM=.1,Q4=15,e5=.25,LM=class{constructor(e,r){C(this,"rendererState");C(this,"dirty",!1);C(this,"convertTo3DMapPosition");C(this,"colorToMaterialCache",{});this.rendererState=e,this.convertTo3DMapPosition=r}update(){var o,a,s;let e,r,n,i;for(let l of this.rendererState.geometry3DIdsInScene)if(e=this.rendererState.geometry3DMap.get(l),e!=null&&(i=e.components[0],r=e.components[1],n=e.components[5],e.type==="geometry"&&i instanceof Ai&&n!=null)){if(n!=null&&n.dirty){if(n.mesh==null)try{if(!AM(i.feature))continue;let u=this.buildBorder(i.feature,r,n);(o=i.mesh)==null||o.add(u)}catch(u){Et.error(u),n.dirty=!1}(a=n.mesh)==null||a.children.forEach(u=>{n&&u.material.color.set(r.borderColor)}),n.dirty=!1,n.visible=r.borderVisible}if(n!=null&&n.needsRebuild){ux(n.mesh);try{let u=this.buildBorder(i.feature,r,n);(s=i.mesh)==null||s.add(u)}catch(u){Et.error(u)}n.needsRebuild=!1,n.visible=r.borderVisible}}}buildBorder(e,r,n){var P,w,T;let i=lx(e),o=EM(e,Q4),a=lx(o),s=r.borderWidth/2,l=r.borderColor,u=sx(i,this.convertTo3DMapPosition,{width:s,height:s,color:l,cap:"square"}),c=u.clone();c.translate(0,0,r.height);let p;a.geometry.type==="LineString"?p=a.geometry.coordinates:p=a.geometry.coordinates.flat();let h=[];p.pop();for(let S of p||[])try{let I=sx({type:"Feature",geometry:{type:"LineString",coordinates:[[S[0],S[1],0],[S[0],S[1],r.height]]},properties:{}},this.convertTo3DMapPosition,{width:s,height:s,color:l,cap:"butt"});h.push(I)}catch(I){Et.warn(I)}let f=Zu([u,c,...h]),d=(P=this.colorToMaterialCache[l])==null?void 0:P[0];d==null&&(d=new zi({color:l}));let g=(w=this.colorToMaterialCache[l])==null?void 0:w[1];g==null&&(g=new zi({color:l})),this.colorToMaterialCache[l]=[d,g];let x=new Er,b=new qn(f,d),v=new qn(f,g);return x.add(b),x.add(v),v.material.depthWrite=!1,v.material.depthTest=!1,v.material.opacity=e5,v.material.transparent=!0,x.position.z=(T=r.altitude)!=null?T:0,n.mesh=x,x}destroy(){for(let[e,[r,n]]of Object.entries(this.colorToMaterialCache))r.dispose(),n.dispose();this.colorToMaterialCache={}}};var cx="#ffffff",t5=.1,Sm=.1,r5="#333333",Uu,Nu,Gu,px=class{constructor(e={}){C(this,"type","style");C(this,"initialColor",cx);mr(this,Uu,cx);C(this,"initialTopColor");mr(this,Nu);mr(this,Gu);C(this,"dirty",!0);C(this,"visible",!0);C(this,"opacity",1);C(this,"width",t5);C(this,"height",Sm);C(this,"initialHeight",Sm);C(this,"altitude",0);C(this,"join","round");C(this,"cap","round");C(this,"showImage",!0);C(this,"flipImageToFaceCamera",!0);C(this,"enableImageCollisions",!1);C(this,"url");C(this,"side","double");C(this,"renderOrder",0);C(this,"shading");C(this,"bevel");C(this,"borderVisible",!1);C(this,"borderColor",r5);C(this,"borderWidth");this.color=(e==null?void 0:e.color)!==void 0?e.color:this.color,this.initialColor=this.color,this.width=(e==null?void 0:e.width)!==void 0?e.width:this.width,this.opacity=(e==null?void 0:e.opacity)!==void 0?e.opacity:this.opacity,this.visible=(e==null?void 0:e.visible)!==void 0?e.visible:this.visible,this.height=(e==null?void 0:e.height)!==void 0?e.height:this.height,this.initialHeight=this.height,this.altitude=(e==null?void 0:e.altitude)!==void 0?e.altitude:this.altitude,this.join=(e==null?void 0:e.join)!==void 0?e.join:this.join,this.cap=(e==null?void 0:e.cap)!==void 0?e.cap:this.cap,this.topColor=e==null?void 0:e.topColor,this.initialTopColor=this.topColor,this.showImage=(e==null?void 0:e.showImage)!==void 0?e.showImage:this.showImage,this.flipImageToFaceCamera=(e==null?void 0:e.flipImageToFaceCamera)!==void 0?e.flipImageToFaceCamera:this.flipImageToFaceCamera,this.url=e==null?void 0:e.url,this.side=(e==null?void 0:e.side)!==void 0?e.side:this.side,this.renderOrder=(e==null?void 0:e.renderOrder)!==void 0?e.renderOrder:this.renderOrder,this.shading=e==null?void 0:e.shading,this.bevel=e==null?void 0:e.bevel,this.borderVisible=(e==null?void 0:e.borderVisible)!==void 0?e.borderVisible:this.borderVisible,this.borderColor=(e==null?void 0:e.borderColor)!==void 0?e.borderColor:this.borderColor,this.borderWidth=(e==null?void 0:e.borderWidth)!==void 0?e.borderWidth:DM,this.enableImageCollisions=(e==null?void 0:e.enableImageCollisions)!==void 0?e.enableImageCollisions:this.enableImageCollisions}set color(e){$u(e)?At(this,Uu,e):Et.warn('Failed to update color. Invalid color "'.concat(e,'".'))}get color(){return Ke(this,Uu)}set topColor(e){e===void 0||$u(e)?At(this,Nu,e):Et.warn('Failed to update top color. Invalid color "'.concat(e,'".'))}get topColor(){return Ke(this,Nu)}set hoverColor(e){$u(e)?At(this,Gu,e):Et.warn('Failed to update hover color. Invalid color "'.concat(e,'".'))}get hoverColor(){return Ke(this,Gu)}};Uu=new WeakMap,Nu=new WeakMap,Gu=new WeakMap;var qa=class extends Sx{constructor(){super(...arguments);C(this,"type","entityBatchedMesh");C(this,"userData",{entities:{}})}},ju,Do,Ai=class{constructor(e){C(this,"mesh");C(this,"imageMesh");C(this,"textMesh");C(this,"textEntityId");C(this,"type","geometry");C(this,"dirty",!0);C(this,"shouldDetach",!1);C(this,"detached",!1);C(this,"instanceIndex",-1);C(this,"geometry");C(this,"batchedProps");C(this,"material");C(this,"feature");C(this,"currentHeight",Sm);C(this,"color",new Lr);C(this,"topColor",new Lr);C(this,"position",new ft);C(this,"altitude",0);mr(this,ju,1);mr(this,Do);this.feature=e}get visible(){return this.mesh&&this.instanceIndex!==-1?this.mesh.getVisibleAt(this.instanceIndex):!1}set visible(e){this.mesh&&this.instanceIndex!==-1&&this.mesh.setVisibleAt(this.instanceIndex,e)}get renderOrder(){return this.mesh?this.mesh.renderOrder:0}set renderOrder(e){this.mesh&&(this.mesh.renderOrder=e)}setColor(e,r){this.color.set(e),this.topColor.set(r),this.material&&this.material.setColor(this.instanceIndex,this.color,this.topColor)}getColor(){var e;return(e=this.material)==null?void 0:e.getColor(this.instanceIndex)}get opacity(){return Ke(this,ju)}set opacity(e){if(this.material&&(this.material.opacity=e,this.material.transparent=e<1,this.material.needsUpdate=!0),this.imageMesh){let r=Array.isArray(this.imageMesh.material)?this.imageMesh.material:[this.imageMesh.material];for(let n of r)n.opacity=e,n.needsUpdate=!0}At(this,ju,e)}get featureBbox(){return Ke(this,Do)?Ke(this,Do):(At(this,Do,WS(this.feature)),Ke(this,Do))}};ju=new WeakMap,Do=new WeakMap;var ur=class extends Er{constructor(r){super();C(this,"visible",!0);C(this,"type","geometry-group");C(this,"components",[]);C(this,"userData",{entityId:"",entities3D:new Set,dirty:!0,shadingDirty:!0});this.userData.entityId=r}getComponent(){}setVisible(r){this.visible!==r&&(this.visible=r,this.dispatchEvent({type:"childremoved",child:this}))}removeEntity(){this.dispatchEvent({type:"childremoved",child:this})}getfirstChildEntityId(){let r;for(let i of this.children)if(!i.userData.detached){r=i;break}return r instanceof qa?Object.values(r.userData.entities)[0]:void 0}};var cr=class t extends Er{constructor(r){super();C(this,"childrenIds",new Set);C(this,"children",[]);C(this,"type","group-container");C(this,"userData",{entityId:"",entities2D:new Set,dirty:!0,occluderDirty:!1,opacity:1,computedOpacity:1,preloadGeometry:!1});C(this,"components",[]);this.userData.entityId=r}getComponent(){}addOccluderFeature(r,n){this.userData.occluderFeature=r,this.userData.occluderId=n,this.userData.occluderDirty=!0}addEntity(r){r instanceof t?(this.childrenIds.add(r.userData.entityId),this.add(r)):r instanceof Hn?(this.childrenIds.add(r.id),this.add(r.object3d),this.userData.entities2D.add(r.id),r.positionDirty=!0):r instanceof ur?(this.childrenIds.add(r.userData.entityId),this.add(r)):r instanceof Cr&&r.object3d&&(this.childrenIds.add(r.id),this.add(r.object3d)),this.dispatchEvent({type:"childadded",child:this})}removeEntity(r){r instanceof t?(this.childrenIds.delete(r.userData.entityId),this.remove(r)):r instanceof Hn?(this.childrenIds.delete(r.id),this.userData.entities2D.delete(r.id),this.remove(r.object3d)):r instanceof ur?(this.childrenIds.delete(r.userData.entityId),this.remove(r)):r instanceof Cr&&r.object3d&&(this.childrenIds.delete(r.id),this.add(r.object3d)),this.dispatchEvent({type:"childremoved",child:this})}setVisible(r){this.visible!==r&&(this.visible=r,this.dispatchEvent({type:"childremoved",child:this}))}setAltitude(r){this.position.z!==r&&(this.position.z=r,this.dispatchEvent({type:"childremoved",child:this}),this.set2DGeometryChildrenPositionDirty())}set2DGeometryChildrenPositionDirty(){this.children.forEach(r=>{r instanceof bn?r.userData.worldPositionDirty=!0:r instanceof t&&r.set2DGeometryChildrenPositionDirty()})}get altitude(){return this.position.z}setOpacity(r){this.userData.opacity=r}get opacity(){return this.userData.opacity}};m();function n5(t){let e=t.min,r=t.max,n=new ft(e.x,e.y,e.z),i=new ft(r.x,e.y,e.z),o=new ft(e.x,r.y,e.z),a=new ft(r.x,r.y,e.z);return[n,i,o,a]}m();function RM(t,e){let r;return typeof e=="string"||typeof e=="number"?(r=t.geometry2DMap.get(e),r==null&&(r=t.geometry3DMap.get(e))):typeof(e==null?void 0:e.id)=="string"||typeof(e==null?void 0:e.id)=="number"?(r=t.geometry2DMap.get(e.id),r==null&&(r=t.geometry3DMap.get(e.id))):r=e,r}function hwe(t,e,r=[],n=new Rm,i){(t.getSystems().renderSystem.threeDdirty||t.getSystems().renderSystem.twoDdirty)&&t.renderSync();let o=RM(t.getInternalState(),e);return kM(o,r,n,i),r}var Cm=new ft;function kM(t,e=[],r=new Rm,n){if(t.visible){if(t.isMesh||t.isLine||t.isPoints){let i=t.geometry;if(i.isBufferGeometry){let o=i.attributes.position;for(let a=0;a<o.count;a++)Cm.fromBufferAttribute(o,a),n!==void 0&&(Cm.z=n),e.push(Cm.clone()),r.expandByPoint(Cm)}}for(let i of t.children)kM(i,e,r,n)}}m();function i5(){return typeof window>"u"?1:Math.min(window.devicePixelRatio,2)}m();function gwe(t,e,r){let n,i,o,a=null,s=0;r||(r={});let l=function(){s=r.leading===!1?0:Date.now(),a=null,o=t.apply(n,i),a||(n=i=null)};return function(...u){let c=Date.now();!s&&r.leading===!1&&(s=c);let p=e-(c-s);return p<=0||p>e?(a&&(clearTimeout(a),a=null),s=c,o=t.apply(this,u),a||(n=u=null)):!a&&r.trailing!==!1&&(a=setTimeout(l,p)),o}}function o5(t,e,r=!1){let n=null,i=0;return function(...o){i++,i===1&&r===!0&&t(...o);let a=()=>{(!r||i>1)&&t(...o),n=null,i=0};clearTimeout(n),n=setTimeout(a,e)}}m();var a5=(()=>{let t;return{getDeviceType(){if(t)return t;let{userAgent:e,platform:r,maxTouchPoints:n}=window.navigator,i=/(iphone|ipod|ipad)/i.test(e),o=r==="iPad"||r.indexOf("Mac")===0&&n>0&&!window.MSStream,a=/android/i.test(e);return t={isIpad:o,isMobile:a||i||o,isSafari12:/Version\/12.+Safari/.test(e),isFirefox:/Firefox/.test(e),isWindows:/windows/i.test(e)},t},_reset(){t=void 0}}})(),FM=a5.getDeviceType,OM=(()=>{let t,e,r;function n(){if(e!==void 0)return e;t||(t=document.createElement("canvas"));let o=t.getContext("webgl")||t.getContext("experimental-webgl");if(!o)return e;try{let a=FM().isFirefox?null:o.getExtension("WEBGL_debug_renderer_info");return e=a?o.getParameter(a.UNMASKED_RENDERER_WEBGL):o.getParameter(o.RENDERER),e}catch(a){let s=new Error("Failed getting device info");throw s.name="FailedGettingDeviceInfo",s}}function i(){var a,s;if(!FM().isWindows)return!1;if(r!==void 0)return r;let o=(s=(a=s5())==null?void 0:a.toLowerCase())!=null?s:"";return r=o.includes("intel")&&(o.includes("uhd")||o.includes("iris")),r}return{getInfo:n,shouldDisableOffscreenCanvas:i,_setCanvas(o){t=o,e=void 0,r=void 0}}})(),s5=OM.getInfo,l5=OM.shouldDisableOffscreenCanvas;m();function Bu(t,e){let r={};for(let n=0;n<e.length;n++){let i=e[n];i in t&&(r[i]=t[i])}return r}function tx(t){return Object.keys(t).length===0}m();var u5=t=>e=>{if(!e.includes("mappedin")){let r={};for(let n in t){let i=t[n];e.includes("mappedin")||(t[n]=i)}return{url:e,headers:r}}return{url:e,headers:t}};function Fwe(t,e,r,n){let i=t*(Math.PI/180),o=n/Yn,a=t+o*180/Math.PI,s=r/Yn/Math.cos(i),l=e+s*180/Math.PI;return{lat:a,lon:l}}function Owe(t,e,r,n){let i=r*(Math.PI/180),o=n*(Math.PI/180),a=t*(Math.PI/180),s=e*(Math.PI/180),l=i-a,u=o-s,c=Yn*u*Math.cos(a),p=Yn*l;return{x:c,y:p}}var c5=(t,e,r,n=!1)=>{var a;let i=t instanceof cr&&t.userData.preloadGeometry,o=n||i&&!t.visible;if(t.children&&(t.visible||i))for(let s of t.children){if(s.visible&&s.type&&!o)if("entities3D"in s.userData&&((a=s.userData)!=null&&a.entities3D)&&s instanceof ur){e.add(s.userData.entityId);for(let l of s.userData.entities3D.values())e.add(l)}else(s.type==="group-container"||s.type==="custom-geometry"||s instanceof Io)&&e.add(s.userData.entityId);s instanceof ur&&s.userData.dirty&&r.add(s.userData.entityId),c5(s,e,r,o)}return e},p5=(t,e)=>{var r;if(t.children&&t.visible&&!((r=t.userData)!=null&&r.hidden))for(let n of t.children)n.visible&&n instanceof bn&&e.add(n.userData.entityId),p5(n,e);return e};function rx(t,e){for(let r in e)if(!(r==="__proto__"||r==="constructor"||r==="prototype")){if(e[r]==null){t[r]=void 0;continue}Array.isArray(e[r])?t[r]=e[r]:typeof e[r]=="object"&&typeof t[r]=="object"&&t[r]!==null&&!Array.isArray(t[r])?rx(t[r],e[r]):t[r]=e[r]}return t}function Bwe(t,e,r){let n={translateX:t.x,translateY:t.y,translateZ:t.z,scale:t.meterInMercatorCoordinateUnits()},i=new Bi,o=new ft(n.scale,-n.scale,n.scale),a=new Bi().makeTranslation(n.translateX,n.translateY,n.translateZ).scale(o);return{id:oM,type:"custom",renderingMode:"3d",render:(s,l)=>{i.fromArray(l.defaultProjectionData.mainMatrix),e.projectionMatrix=i.multiply(a),r()}}}function h5(t){return fetch(t,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({grant_type:"client_credentials"})})}async function zwe(t){let e=await h5(t),{access_token:r}=await e.json();return{"x-mappedin-tiles-key":r}}function Vwe(t,e=0){let r=3735928559^e,n=1103547991^e;for(let i=0,o;i<t.length;i++)o=t.charCodeAt(i),r=Math.imul(r^o,2654435761),n=Math.imul(n^o,1597334677);return r=Math.imul(r^r>>>16,2246822507)^Math.imul(n^n>>>13,3266489909),n=Math.imul(n^n>>>16,2246822507)^Math.imul(r^r>>>13,3266489909),4294967296*(2097151&n)+(r>>>0)}function Uwe(t,e,r){let n=t*(Math.PI/180)/2,i=e/2;return r*Math.tan(n)/i}function Nwe(t){return new yt(new J(t[0][0],t[0][1]),new J(t[1][0],t[1][1])).getCenter().toArray()}function Gwe(t,e){return t<e||e<=12}function jwe(t){let e=1;return t.type==="geometry-group"&&t.parent!=null&&t.parent instanceof cr?e=t.parent.userData.computedOpacity:(t.type==="geometry"||t.type==="custom-geometry"||t.type==="model")&&t.parentObject3D!=null&&t.parentObject3D instanceof ur&&t.parentObject3D.parent!=null&&t.parentObject3D.parent instanceof cr&&(e=t.parentObject3D.parent.userData.computedOpacity),e}function Hwe(t,e,r=1e-10){if(t.length!==e.length)return!1;let n=Math.abs(t[0]-e[0])<r,i=Math.abs(t[1]-e[1])<r;if(t.length===3&&e.length===3){let o=Math.abs(t[2]-e[2])<r;return n&&i&&o}return n&&i}var f5="maplibre-frustum-culling-hack";function Xwe(){let t=new wx(.01,.01,.01),e=new zi({opacity:0,depthWrite:!1,transparent:!0}),r=new qn(t,e);return r.position.copy(new ft(0,50,0)),r.frustumCulled=!1,r.name=f5,r}var Di=new ft,BM=new Pn;function Zwe(t,e,r=new Xu){return t.traverse(n=>{if(n instanceof qn){let o=n.geometry.attributes.position;if(e.position.distanceTo(n.position)<e.near)return;for(let s=0;s<o.count;s++)Di.fromBufferAttribute(o,s),Di.applyMatrix4(n.matrixWorld),Di.applyMatrix4(e.matrixWorldInverse),Di.applyMatrix4(e.projectionMatrix),Di.z<1&&Di.z>0&&(BM.set(Di.x,Di.y),r.expandByPoint(BM))}}),r}function zM(t,e){let r=e.clientWidth,n=e.clientHeight;return new Pn((t.x+1)*r/2,(1-t.y)*n/2)}function qwe(t,e,r){let n=document.createElement("div");n.style.position="absolute",n.style.border="2px solid ".concat(e),n.style.pointerEvents="none";let i=zM(new Pn(t.min.x,t.min.y),r),o=zM(new Pn(t.max.x,t.max.y),r);n.style.left="".concat(i.x,"px"),n.style.top="".concat(o.y,"px");let a=Math.abs(o.x-i.x),s=Math.abs(o.y-i.y);return n.style.width="".concat(a,"px"),n.style.height="".concat(s,"px"),r.appendChild(n),n}function Ywe(t,e){let r=0,n=0,i=t.clientWidth,o=t.clientHeight;if(e){let{left:a,top:s,right:l,bottom:u,type:c}=e,p=a!=null?a:0,h=s!=null?s:0,f=l!=null?l:0,d=u!=null?u:0;c==="portion"?(r=p*i,n=h*o,i=i-r-f*i,o=o-n-d*o):(r=p,n=h,i=i-r-f,o=o-n-d)}return[r,n,i,o].map(a=>Math.max(a,0))}function ex(t){return(t*100|0)/100}m();var hx=class{constructor(e){C(this,"type","text3dStyle");C(this,"visible");C(this,"altitude");C(this,"color");C(this,"dirty",!0);C(this,"maxWidth");C(this,"maxHeight");C(this,"hoverByPolygon");C(this,"flipToFaceCamera",VM.flipToFaceCamera);C(this,"font");C(this,"fillOpacity");C(this,"fontSize");C(this,"margin");C(this,"outlineWidth");C(this,"outlineBlur");C(this,"outlineOffsetX");C(this,"strokeColor");C(this,"strokeOpacity");C(this,"strokeWidth");C(this,"hoverColor");C(this,"outlineOffsetY");C(this,"outlineColor");C(this,"outlineOpacity");e&&Object.assign(this,e)}getState(e=!1){let r={};for(let n in this)!e&&n==="dirty"||this[n]!==void 0&&(r[n]=this[n]);return r}},VM=Object.freeze({visible:!0,color:"black",flipToFaceCamera:!0,fillOpacity:1,font:void 0,fontSize:2,margin:[.2,1,.2,1.5],outlineColor:"black",outlineOpacity:1,outlineWidth:0,outlineOffsetX:0,outlineOffsetY:0,outlineBlur:0,strokeOpacity:1,strokeWidth:0,maxWidth:void 0,maxHeight:void 0,strokeColor:"black",hoverColor:void 0});m();m();var fx=class{constructor(e){C(this,"type","modelStyle");C(this,"dirty",!0);C(this,"visible",!0);C(this,"opacity",1);C(this,"verticalOffset",0);C(this,"interactive",!1);C(this,"color");C(this,"material");C(this,"rotation");C(this,"scale");C(this,"visibleThroughGeometry",!1);C(this,"clippingPlaneZOffset",1/0);C(this,"clippingPlaneTopColor");C(this,"clippingPlaneTopVisible",!0);e&&Object.assign(this,e)}};m();var m5=[1,1,1],d5=[0,0,0];export{XM as a,y5 as b,Et as c,Qa as d,kx as e,Yn as f,WM as g,$M as h,L5 as i,Yu as j,D5 as k,R5 as l,KM as m,k5 as n,F5 as o,O5 as p,N5 as q,q5 as r,Ut as s,K5 as t,es as u,Bm as v,$u as w,lN as x,uN as y,Ux as z,oI as A,fN as B,sI as C,mN as D,Ii as E,ez as F,__e as G,qS as H,v_e as I,P_e as J,w_e as K,T_e as L,S_e as M,C_e as N,M_e as O,em as P,D_e as Q,rz as R,R_e as S,YS as T,$S as U,az as V,Z_e as W,oe as X,lC as Y,Og as Z,uC as _,pC as $,lve as aa,xC as ba,qC as ca,Yg as da,Rve as ea,KC as fa,xe as ga,Ef as ha,Dg as ia,QB as ja,y_e as ka,Hn as la,Io as ma,Cr as na,A0e as oa,E0e as pa,oM as qa,aM as ra,L0e as sa,D0e as ta,R0e as ua,n5 as va,RM as wa,hwe as xa,i5 as ya,gwe as za,o5 as Aa,l5 as Ba,u5 as Ca,Ku as Da,Fwe as Ea,Owe as Fa,c5 as Ga,p5 as Ha,Bwe as Ia,zwe as Ja,Vwe as Ka,Uwe as La,Nwe as Ma,Gwe as Na,jwe as Oa,Hwe as Pa,Xwe as Qa,Zwe as Ra,qwe as Sa,Ywe as Ta,ex as Ua,hx as Va,VM as Wa,fx as Xa,m5 as Ya,d5 as Za,QC as _a,FV as $a,e0e as ab,BV as bb,rM as cb,s0e as db,fm as eb,mm as fb,ku as gb,W0e as hb,Qg as ib,$0e as jb,ym as kb,gm as lb,bm as mb,Ou as nb,E1e as ob,L1e as pb,D1e as qb,jV as rb,sM as sb,R1e as tb,k1e as ub,F1e as vb,O1e as wb,B1e as xb,z1e as yb,V1e as zb,U1e as Ab,N1e as Bb,cM as Cb,XV as Db,G1e as Eb,ZV as Fb,j1e as Gb,qV as Hb,YV as Ib,H1e as Jb,X1e as Kb,WV as Lb,Z1e as Mb,q1e as Nb,$V as Ob,Y1e as Pb,W1e as Qb,$1e as Rb,K1e as Sb,Xn as Tb,sx as Ub,ux as Vb,LM as Wb,cx as Xb,px as Yb,qa as Zb,Ai as _b,ur as $b,cr as ac};
|