@mappedin/mappedin-js 6.1.2 → 6.3.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.
Files changed (49) hide show
  1. package/THIRD_PARTY_LICENSES.txt +19 -17
  2. package/lib/esm/GLTFExporter-ZVF3Y5DX.js +1 -0
  3. package/lib/esm/{GLTFLoader-TLLNLQ5Y.js → GLTFLoader-3QTALUTA.js} +1 -2
  4. package/lib/esm/chunk-2DEFE4C2.js +1 -0
  5. package/lib/esm/chunk-5W2UDR4H.js +1 -0
  6. package/lib/esm/chunk-66DYOCZO.js +1 -0
  7. package/lib/esm/chunk-Q56Y72HB.js +1 -0
  8. package/lib/esm/{chunk-MLCPE7I2.js → chunk-YB4VFXKF.js} +1 -2
  9. package/lib/esm/index.css +1 -2
  10. package/lib/esm/index.d.ts +180 -54
  11. package/lib/esm/index.js +1 -2
  12. package/lib/esm/inspector-B32KFAD4.js +1 -0
  13. package/lib/esm/inspector-Z5ATF4CD.css +1 -0
  14. package/lib/esm/internal-OFWBS2NI.css +1 -0
  15. package/lib/esm/internal-RK6SZERV.js +1 -0
  16. package/lib/esm/{roboto-regular-R5KXKW73.js → roboto-regular-ERMR6E6W.js} +1 -2
  17. package/lib/esm/text3d-DIUCQLOC.js +1 -0
  18. package/lib/esm/{text3d-AXM5ZHCS.css → text3d-M57DIX3E.css} +0 -1
  19. package/lib/esm/workers/collision-worker.csp.js +1 -23
  20. package/lib/esm/workers/maplibre-worker.csp.js +1 -2
  21. package/lib/index.css +1 -2
  22. package/package.json +6 -4
  23. package/lib/esm/GLTFExporter-O4OUZTHE.js +0 -2
  24. package/lib/esm/GLTFExporter-O4OUZTHE.js.map +0 -7
  25. package/lib/esm/GLTFLoader-TLLNLQ5Y.js.map +0 -7
  26. package/lib/esm/chunk-3PM6GKGK.js +0 -2048
  27. package/lib/esm/chunk-3PM6GKGK.js.map +0 -7
  28. package/lib/esm/chunk-3U5JJXJA.js +0 -3820
  29. package/lib/esm/chunk-3U5JJXJA.js.map +0 -7
  30. package/lib/esm/chunk-MLCPE7I2.js.map +0 -7
  31. package/lib/esm/chunk-ROCNZJLL.js +0 -2
  32. package/lib/esm/chunk-ROCNZJLL.js.map +0 -7
  33. package/lib/esm/chunk-UOCWYBVK.js +0 -938
  34. package/lib/esm/chunk-UOCWYBVK.js.map +0 -7
  35. package/lib/esm/index.css.map +0 -7
  36. package/lib/esm/index.js.map +0 -7
  37. package/lib/esm/inspector-2XETNHYZ.css +0 -2
  38. package/lib/esm/inspector-2XETNHYZ.css.map +0 -7
  39. package/lib/esm/inspector-66PSYVJU.js +0 -483
  40. package/lib/esm/inspector-66PSYVJU.js.map +0 -7
  41. package/lib/esm/internal-R5XTRV7Q.css +0 -2
  42. package/lib/esm/internal-R5XTRV7Q.css.map +0 -7
  43. package/lib/esm/internal-WJZVXVL6.js +0 -2
  44. package/lib/esm/internal-WJZVXVL6.js.map +0 -7
  45. package/lib/esm/roboto-regular-R5KXKW73.js.map +0 -7
  46. package/lib/esm/text3d-AXM5ZHCS.css.map +0 -7
  47. package/lib/esm/text3d-EZBY7L7A.js +0 -253
  48. package/lib/esm/text3d-EZBY7L7A.js.map +0 -7
  49. package/lib/index-rn.js +0 -4306
@@ -1,938 +0,0 @@
1
- import{a as Gu}from"./chunk-MLCPE7I2.js";import{B as Mm,C as xx,Ea as Px,Ga as wx,Ha as Tx,Ia as Sx,M as _n,Na as Cx,T as Im,U as pt,V as Am,X as Fi,Y as Em,Z as Er,_ as Lr,a as m,aa as Oi,b as _,da as Xn,e as fx,ea as bx,f as mx,g as dx,hb as Nu,i as Wa,pa as _x,r as yx,t as gx,va as vx}from"./chunk-3U5JJXJA.js";import{b as hr,c as ki,d as se,e as M,f as $e,g as fr,h as Mt}from"./chunk-ROCNZJLL.js";var fe=hr((SN,zx)=>{"use strict";m();zx.exports=ko;function ko(t,e){this.x=t,this.y=e}ko.prototype={clone:function(){return new ko(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}};ko.convert=function(t){return t instanceof ko?t:Array.isArray(t)?new ko(t[0],t[1]):t}});var Nx=hr((MN,Ux)=>{"use strict";m();Ux.exports=Vx;function Vx(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}Vx.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 Iv=hr((WG,Yd)=>{m();function ek(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 Yd<"u"&&(Yd.exports=ek)});var Av=hr((KG,Wd)=>{m();function tk(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 Wd!==void 0&&(Wd.exports=tk)});var $d=hr((QG,hp)=>{m();var Ev=Iv(),rk=Av();hp.exports=Ev;hp.exports.murmur3=Ev;hp.exports.murmur2=rk});var cy=hr((_X,y0)=>{"use strict";m();var Hk=fe();y0.exports=la;function la(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(Xk,this,e)}function Xk(t,e,r){t==1?e.id=r.readVarint():t==2?Zk(r,e):t==3?e.type=r.readVarint():t==4&&(e._geometry=r.pos)}function Zk(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}}la.types=["Unknown","Point","LineString","Polygon"];la.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 Hk(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};la.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]};la.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=la.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=qk(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 qk(t){var e=t.length;if(e<=1)return[t];for(var r=[],n,i,o=0;o<e;o++){var a=Yk(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 Yk(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 py=hr((PX,x0)=>{"use strict";m();var Wk=cy();x0.exports=g0;function g0(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($k,this,e),this.length=this._features.length}function $k(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(Kk(r))}function Kk(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}g0.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 Wk(this._pbf,e,this.extent,this._keys,this._values)}});var _0=hr((TX,b0)=>{"use strict";m();var Jk=py();b0.exports=Qk;function Qk(t,e){this.layers=t.readFields(eF,{},e)}function eF(t,e,r){if(t===3){var n=new Jk(r,r.readVarint()+r.pos);n.length&&(e[n.name]=n)}}});var bl=hr((CX,Ap)=>{m();Ap.exports.VectorTile=_0();Ap.exports.VectorTileFeature=cy();Ap.exports.VectorTileLayer=py()});var H0=hr(yy=>{m();yy.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)};yy.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 xy=hr((xq,W0)=>{"use strict";m();W0.exports=je;var kp=H0();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 gy=65536*65536,X0=1/gy,bF=12,Y0=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=Fp(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=q0(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=Fp(this.buf,this.pos)+Fp(this.buf,this.pos+4)*gy;return this.pos+=8,t},readSFixed64:function(){var t=Fp(this.buf,this.pos)+q0(this.buf,this.pos+4)*gy;return this.pos+=8,t},readFloat:function(){var t=kp.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=kp.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,_F(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>=bF&&Y0?kF(this.buf,e,t):RF(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=Ln(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=Ln(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=Ln(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=Ln(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=Ln(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=Ln(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=Ln(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=Ln(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=Ln(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),ca(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),ca(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),ca(this.buf,t&-1,this.pos),ca(this.buf,Math.floor(t*X0),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),ca(this.buf,t&-1,this.pos),ca(this.buf,Math.floor(t*X0),this.pos+4),this.pos+=8},writeVarint:function(t){if(t=+t||0,t>268435455||t<0){vF(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=FF(this.buf,t,this.pos);var r=this.pos-e;r>=128&&Z0(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),kp.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),kp.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&&Z0(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,TF,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,SF,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,IF,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,CF,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,MF,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,AF,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,EF,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,LF,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,DF,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 _F(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 ua(t,i,e);throw new Error("Expected varint not more than 10 bytes")}function Ln(t){return t.type===je.Bytes?t.readVarint()+t.pos:t.pos+1}function ua(t,e,r){return r?e*4294967296+(t>>>0):(e>>>0)*4294967296+(t>>>0)}function vF(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),PF(r,n,e),wF(n,e)}function PF(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 wF(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 Z0(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 TF(t,e){for(var r=0;r<t.length;r++)e.writeVarint(t[r])}function SF(t,e){for(var r=0;r<t.length;r++)e.writeSVarint(t[r])}function CF(t,e){for(var r=0;r<t.length;r++)e.writeFloat(t[r])}function MF(t,e){for(var r=0;r<t.length;r++)e.writeDouble(t[r])}function IF(t,e){for(var r=0;r<t.length;r++)e.writeBoolean(t[r])}function AF(t,e){for(var r=0;r<t.length;r++)e.writeFixed32(t[r])}function EF(t,e){for(var r=0;r<t.length;r++)e.writeSFixed32(t[r])}function LF(t,e){for(var r=0;r<t.length;r++)e.writeFixed64(t[r])}function DF(t,e){for(var r=0;r<t.length;r++)e.writeSFixed64(t[r])}function Fp(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+t[e+3]*16777216}function ca(t,e,r){t[r]=e,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function q0(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function RF(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 kF(t,e,r){return Y0.decode(t.subarray(e,r))}function FF(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 jC=hr((Tu,Va)=>{m();var Oz=200,TC="__lodash_hash_undefined__",Bz=800,zz=16,SC=9007199254740991,CC="[object Arguments]",Vz="[object Array]",Uz="[object AsyncFunction]",Nz="[object Boolean]",Gz="[object Date]",jz="[object Error]",MC="[object Function]",Hz="[object GeneratorFunction]",Xz="[object Map]",Zz="[object Number]",qz="[object Null]",IC="[object Object]",Yz="[object Proxy]",Wz="[object RegExp]",$z="[object Set]",Kz="[object String]",Jz="[object Undefined]",Qz="[object WeakMap]",e3="[object ArrayBuffer]",t3="[object DataView]",r3="[object Float32Array]",n3="[object Float64Array]",i3="[object Int8Array]",o3="[object Int16Array]",a3="[object Int32Array]",s3="[object Uint8Array]",l3="[object Uint8ClampedArray]",u3="[object Uint16Array]",c3="[object Uint32Array]",p3=/[\\^$.*+?()[\]{}|]/g,h3=/^\[object .+?Constructor\]$/,f3=/^(?:0|[1-9]\d*)$/,et={};et[r3]=et[n3]=et[i3]=et[o3]=et[a3]=et[s3]=et[l3]=et[u3]=et[c3]=!0;et[CC]=et[Vz]=et[e3]=et[Nz]=et[t3]=et[Gz]=et[jz]=et[MC]=et[Xz]=et[Zz]=et[IC]=et[Wz]=et[$z]=et[Kz]=et[Qz]=!1;var AC=typeof global=="object"&&global&&global.Object===Object&&global,m3=typeof self=="object"&&self&&self.Object===Object&&self,Mu=AC||m3||Function("return this")(),EC=typeof Tu=="object"&&Tu&&!Tu.nodeType&&Tu,Su=EC&&typeof Va=="object"&&Va&&!Va.nodeType&&Va,LC=Su&&Su.exports===EC,Fg=LC&&AC.process,dC=function(){try{var t=Su&&Su.require&&Su.require("util").types;return t||Fg&&Fg.binding&&Fg.binding("util")}catch{}}(),yC=dC&&dC.isTypedArray;function d3(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 y3(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}function g3(t){return function(e){return t(e)}}function x3(t,e){return t?.[e]}function b3(t,e){return function(r){return t(e(r))}}var _3=Array.prototype,v3=Function.prototype,rm=Object.prototype,Og=Mu["__core-js_shared__"],nm=v3.toString,Un=rm.hasOwnProperty,gC=function(){var t=/[^.]+$/.exec(Og&&Og.keys&&Og.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),DC=rm.toString,P3=nm.call(Object),w3=RegExp("^"+nm.call(Un).replace(p3,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),em=LC?Mu.Buffer:void 0,xC=Mu.Symbol,bC=Mu.Uint8Array,_C=em?em.allocUnsafe:void 0,RC=b3(Object.getPrototypeOf,Object),vC=Object.create,T3=rm.propertyIsEnumerable,S3=_3.splice,wo=xC?xC.toStringTag:void 0,tm=function(){try{var t=Gg(Object,"defineProperty");return t({},"",{}),t}catch{}}(),C3=em?em.isBuffer:void 0,PC=Math.max,M3=Date.now,kC=Gg(Mu,"Map"),Cu=Gg(Object,"create"),I3=function(){function t(){}return function(e){if(!So(e))return{};if(vC)return vC(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}();function To(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 A3(){this.__data__=Cu?Cu(null):{},this.size=0}function E3(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}function L3(t){var e=this.__data__;if(Cu){var r=e[t];return r===TC?void 0:r}return Un.call(e,t)?e[t]:void 0}function D3(t){var e=this.__data__;return Cu?e[t]!==void 0:Un.call(e,t)}function R3(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=Cu&&e===void 0?TC:e,this}To.prototype.clear=A3;To.prototype.delete=E3;To.prototype.get=L3;To.prototype.has=D3;To.prototype.set=R3;function Nn(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 k3(){this.__data__=[],this.size=0}function F3(t){var e=this.__data__,r=im(e,t);if(r<0)return!1;var n=e.length-1;return r==n?e.pop():S3.call(e,r,1),--this.size,!0}function O3(t){var e=this.__data__,r=im(e,t);return r<0?void 0:e[r][1]}function B3(t){return im(this.__data__,t)>-1}function z3(t,e){var r=this.__data__,n=im(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this}Nn.prototype.clear=k3;Nn.prototype.delete=F3;Nn.prototype.get=O3;Nn.prototype.has=B3;Nn.prototype.set=z3;function Ua(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 V3(){this.size=0,this.__data__={hash:new To,map:new(kC||Nn),string:new To}}function U3(t){var e=am(this,t).delete(t);return this.size-=e?1:0,e}function N3(t){return am(this,t).get(t)}function G3(t){return am(this,t).has(t)}function j3(t,e){var r=am(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this}Ua.prototype.clear=V3;Ua.prototype.delete=U3;Ua.prototype.get=N3;Ua.prototype.has=G3;Ua.prototype.set=j3;function Na(t){var e=this.__data__=new Nn(t);this.size=e.size}function H3(){this.__data__=new Nn,this.size=0}function X3(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}function Z3(t){return this.__data__.get(t)}function q3(t){return this.__data__.has(t)}function Y3(t,e){var r=this.__data__;if(r instanceof Nn){var n=r.__data__;if(!kC||n.length<Oz-1)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new Ua(n)}return r.set(t,e),this.size=r.size,this}Na.prototype.clear=H3;Na.prototype.delete=X3;Na.prototype.get=Z3;Na.prototype.has=q3;Na.prototype.set=Y3;function W3(t,e){var r=Ug(t),n=!r&&Vg(t),i=!r&&!n&&zC(t),o=!r&&!n&&!i&&UC(t),a=r||n||i||o,s=a?y3(t.length,String):[],l=s.length;for(var u in t)(e||Un.call(t,u))&&!(a&&(u=="length"||i&&(u=="offset"||u=="parent")||o&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||OC(u,l)))&&s.push(u);return s}function Bg(t,e,r){(r!==void 0&&!sm(t[e],r)||r===void 0&&!(e in t))&&Ng(t,e,r)}function $3(t,e,r){var n=t[e];(!(Un.call(t,e)&&sm(n,r))||r===void 0&&!(e in t))&&Ng(t,e,r)}function im(t,e){for(var r=t.length;r--;)if(sm(t[r][0],e))return r;return-1}function Ng(t,e,r){e=="__proto__"&&tm?tm(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var K3=cV();function om(t){return t==null?t===void 0?Jz:qz:wo&&wo in Object(t)?pV(t):gV(t)}function wC(t){return Iu(t)&&om(t)==CC}function J3(t){if(!So(t)||dV(t))return!1;var e=Hg(t)?w3:h3;return e.test(vV(t))}function Q3(t){return Iu(t)&&VC(t.length)&&!!et[om(t)]}function eV(t){if(!So(t))return yV(t);var e=BC(t),r=[];for(var n in t)n=="constructor"&&(e||!Un.call(t,n))||r.push(n);return r}function FC(t,e,r,n,i){t!==e&&K3(e,function(o,a){if(i||(i=new Na),So(o))tV(t,e,a,r,FC,n,i);else{var s=n?n(zg(t,a),o,a+"",t,e,i):void 0;s===void 0&&(s=o),Bg(t,a,s)}},NC)}function tV(t,e,r,n,i,o,a){var s=zg(t,r),l=zg(e,r),u=a.get(l);if(u){Bg(t,r,u);return}var c=o?o(s,l,r+"",t,e,a):void 0,p=c===void 0;if(p){var h=Ug(l),f=!h&&zC(l),d=!h&&!f&&UC(l);c=l,h||f||d?Ug(s)?c=s:PV(s)?c=sV(s):f?(p=!1,c=iV(l,!0)):d?(p=!1,c=aV(l,!0)):c=[]:wV(l)||Vg(l)?(c=s,Vg(s)?c=TV(s):(!So(s)||Hg(s))&&(c=hV(l))):p=!1}p&&(a.set(l,c),i(c,l,n,o,a),a.delete(l)),Bg(t,r,c)}function rV(t,e){return bV(xV(t,e,GC),t+"")}var nV=tm?function(t,e){return tm(t,"toString",{configurable:!0,enumerable:!1,value:CV(e),writable:!0})}:GC;function iV(t,e){if(e)return t.slice();var r=t.length,n=_C?_C(r):new t.constructor(r);return t.copy(n),n}function oV(t){var e=new t.constructor(t.byteLength);return new bC(e).set(new bC(t)),e}function aV(t,e){var r=e?oV(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}function sV(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}function lV(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?Ng(r,s,l):$3(r,s,l)}return r}function uV(t){return rV(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&&fV(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 cV(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 am(t,e){var r=t.__data__;return mV(e)?r[typeof e=="string"?"string":"hash"]:r.map}function Gg(t,e){var r=x3(t,e);return J3(r)?r:void 0}function pV(t){var e=Un.call(t,wo),r=t[wo];try{t[wo]=void 0;var n=!0}catch{}var i=DC.call(t);return n&&(e?t[wo]=r:delete t[wo]),i}function hV(t){return typeof t.constructor=="function"&&!BC(t)?I3(RC(t)):{}}function OC(t,e){var r=typeof t;return e=e??SC,!!e&&(r=="number"||r!="symbol"&&f3.test(t))&&t>-1&&t%1==0&&t<e}function fV(t,e,r){if(!So(r))return!1;var n=typeof e;return(n=="number"?jg(r)&&OC(e,r.length):n=="string"&&e in r)?sm(r[e],t):!1}function mV(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function dV(t){return!!gC&&gC in t}function BC(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||rm;return t===r}function yV(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}function gV(t){return DC.call(t)}function xV(t,e,r){return e=PC(e===void 0?t.length-1:e,0),function(){for(var n=arguments,i=-1,o=PC(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),d3(t,this,s)}}function zg(t,e){if(!(e==="constructor"&&typeof t[e]=="function")&&e!="__proto__")return t[e]}var bV=_V(nV);function _V(t){var e=0,r=0;return function(){var n=M3(),i=zz-(n-r);if(r=n,i>0){if(++e>=Bz)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}function vV(t){if(t!=null){try{return nm.call(t)}catch{}try{return t+""}catch{}}return""}function sm(t,e){return t===e||t!==t&&e!==e}var Vg=wC(function(){return arguments}())?wC:function(t){return Iu(t)&&Un.call(t,"callee")&&!T3.call(t,"callee")},Ug=Array.isArray;function jg(t){return t!=null&&VC(t.length)&&!Hg(t)}function PV(t){return Iu(t)&&jg(t)}var zC=C3||MV;function Hg(t){if(!So(t))return!1;var e=om(t);return e==MC||e==Hz||e==Uz||e==Yz}function VC(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=SC}function So(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}function Iu(t){return t!=null&&typeof t=="object"}function wV(t){if(!Iu(t)||om(t)!=IC)return!1;var e=RC(t);if(e===null)return!0;var r=Un.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&nm.call(r)==P3}var UC=yC?g3(yC):Q3;function TV(t){return lV(t,NC(t))}function NC(t){return jg(t)?W3(t,!0):eV(t)}var SV=uV(function(t,e,r){FC(t,e,r)});function CV(t){return function(){return t}}function GC(t){return t}function MV(){return!1}Va.exports=SV});var gM=hr((X1e,Fu)=>{"use strict";m();var qV=!1,Mo=!1,cM=!0,pM=!1,y={},hM=!1;typeof Fu<"u"&&Fu.exports?(Fu.exports=y,hM=!0):typeof document<"u"?window.ClipperLib=y:self.ClipperLib=y;var ym;hM?(St="chrome",ym="Netscape"):(St=navigator.userAgent.toString().toLowerCase(),ym=navigator.appName);var St,Me={};St.indexOf("chrome")!=-1&&St.indexOf("chromium")==-1?Me.chrome=1:Me.chrome=0;St.indexOf("chromium")!=-1?Me.chromium=1:Me.chromium=0;St.indexOf("safari")!=-1&&St.indexOf("chrome")==-1&&St.indexOf("chromium")==-1?Me.safari=1:Me.safari=0;St.indexOf("firefox")!=-1?Me.firefox=1:Me.firefox=0;St.indexOf("firefox/17")!=-1?Me.firefox17=1:Me.firefox17=0;St.indexOf("firefox/15")!=-1?Me.firefox15=1:Me.firefox15=0;St.indexOf("firefox/3")!=-1?Me.firefox3=1:Me.firefox3=0;St.indexOf("opera")!=-1?Me.opera=1:Me.opera=0;St.indexOf("msie 10")!=-1?Me.msie10=1:Me.msie10=0;St.indexOf("msie 9")!=-1?Me.msie9=1:Me.msie9=0;St.indexOf("msie 8")!=-1?Me.msie8=1:Me.msie8=0;St.indexOf("msie 7")!=-1?Me.msie7=1:Me.msie7=0;St.indexOf("msie ")!=-1?Me.msie=1:Me.msie=0;y.biginteger_used=null;var Ai,YV=0xdeadbeefcafe,lM=(YV&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 WV(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 $V(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 KV(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}lM&&ym=="Microsoft Internet Explorer"?(j.prototype.am=$V,Ai=30):lM&&ym!="Netscape"?(j.prototype.am=WV,Ai=26):(j.prototype.am=KV,Ai=28);j.prototype.DB=Ai;j.prototype.DM=(1<<Ai)-1;j.prototype.DV=1<<Ai;var Qg=52;j.prototype.FV=Math.pow(2,Qg);j.prototype.F1=Qg-Ai;j.prototype.F2=2*Ai-Qg;var JV="0123456789abcdefghijklmnopqrstuvwxyz",xm=new Array,Za,Nr;Za=48;for(Nr=0;Nr<=9;++Nr)xm[Za++]=Nr;Za=97;for(Nr=10;Nr<36;++Nr)xm[Za++]=Nr;Za=65;for(Nr=10;Nr<36;++Nr)xm[Za++]=Nr;function uM(t){return JV.charAt(t)}function fM(t,e){var r=xm[t.charCodeAt(e)];return r??-1}function QV(t){for(var e=this.t-1;e>=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s}function eU(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 Ii(t){var e=ke();return e.fromInt(t),e}function tU(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:fM(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 rU(){for(var t=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t}function nU(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=uM(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+=uM(n));return i?o:"0"}function iU(){var t=ke();return j.ZERO.subTo(this,t),t}function oU(){return this.s<0?this.negate():this}function aU(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 bm(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 sU(){return this.t<=0?0:this.DB*(this.t-1)+bm(this[this.t-1]^this.s&this.DM)}function lU(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 uU(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 cU(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 pU(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 hU(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 fU(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 mU(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 dU(t,e,r){var n=t.abs();if(!(n.t<=0)){var i=this.abs();if(i.t<n.t){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-bm(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??ke();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 yU(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 Io(t){this.m=t}function gU(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t}function xU(t){return t}function bU(t){t.divRemTo(this.m,null,t)}function _U(t,e,r){t.multiplyTo(e,r),this.reduce(r)}function vU(t,e){t.squareTo(e),this.reduce(e)}Io.prototype.convert=gU;Io.prototype.revert=xU;Io.prototype.reduce=bU;Io.prototype.mulTo=_U;Io.prototype.sqrTo=vU;function PU(){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 Ao(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 wU(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 TU(t){var e=ke();return t.copyTo(e),this.reduce(e),e}function SU(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 CU(t,e){t.squareTo(e),this.reduce(e)}function MU(t,e,r){t.multiplyTo(e,r),this.reduce(r)}Ao.prototype.convert=wU;Ao.prototype.revert=TU;Ao.prototype.reduce=SU;Ao.prototype.mulTo=MU;Ao.prototype.sqrTo=CU;function IU(){return(this.t>0?this[0]&1:this.s)==0}function AU(t,e){if(t>4294967295||t<1)return j.ONE;var r=ke(),n=ke(),i=e.convert(this),o=bm(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 EU(t,e){var r;return t<256||e.isEven()?r=new Io(e):r=new Ao(e),this.exp(t,r)}j.prototype.copyTo=QV;j.prototype.fromInt=eU;j.prototype.fromString=tU;j.prototype.clamp=rU;j.prototype.dlShiftTo=lU;j.prototype.drShiftTo=uU;j.prototype.lShiftTo=cU;j.prototype.rShiftTo=pU;j.prototype.subTo=hU;j.prototype.multiplyTo=fU;j.prototype.squareTo=mU;j.prototype.divRemTo=dU;j.prototype.invDigit=PU;j.prototype.isEven=IU;j.prototype.exp=AU;j.prototype.toString=nU;j.prototype.negate=iU;j.prototype.abs=oU;j.prototype.compareTo=aU;j.prototype.bitLength=sU;j.prototype.mod=yU;j.prototype.modPowInt=EU;j.ZERO=Ii(0);j.ONE=Ii(1);function LU(){var t=ke();return this.copyTo(t),t}function DU(){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 RU(){return this.t==0?this.s:this[0]<<24>>24}function kU(){return this.t==0?this.s:this[0]<<16>>16}function FU(t){return Math.floor(Math.LN2*this.DB/Math.log(t))}function OU(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function BU(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=Ii(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 zU(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=fM(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 VU(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),ex,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 UU(){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 NU(t){return this.compareTo(t)==0}function GU(t){return this.compareTo(t)<0?this:t}function jU(t){return this.compareTo(t)>0?this:t}function HU(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 XU(t,e){return t&e}function ZU(t){var e=ke();return this.bitwiseTo(t,XU,e),e}function ex(t,e){return t|e}function qU(t){var e=ke();return this.bitwiseTo(t,ex,e),e}function mM(t,e){return t^e}function YU(t){var e=ke();return this.bitwiseTo(t,mM,e),e}function dM(t,e){return t&~e}function WU(t){var e=ke();return this.bitwiseTo(t,dM,e),e}function $U(){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 KU(t){var e=ke();return t<0?this.rShiftTo(-t,e):this.lShiftTo(t,e),e}function JU(t){var e=ke();return t<0?this.lShiftTo(-t,e):this.rShiftTo(t,e),e}function QU(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 e4(){for(var t=0;t<this.t;++t)if(this[t]!=0)return t*this.DB+QU(this[t]);return this.s<0?this.t*this.DB:-1}function t4(t){for(var e=0;t!=0;)t&=t-1,++e;return e}function r4(){for(var t=0,e=this.s&this.DM,r=0;r<this.t;++r)t+=t4(this[r]^e);return t}function n4(t){var e=Math.floor(t/this.DB);return e>=this.t?this.s!=0:(this[e]&1<<t%this.DB)!=0}function i4(t,e){var r=j.ONE.shiftLeft(t);return this.bitwiseTo(r,e,r),r}function o4(t){return this.changeBit(t,ex)}function a4(t){return this.changeBit(t,dM)}function s4(t){return this.changeBit(t,mM)}function l4(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 u4(t){var e=ke();return this.addTo(t,e),e}function c4(t){var e=ke();return this.subTo(t,e),e}function p4(t){var e=ke();return this.multiplyTo(t,e),e}function h4(){var t=ke();return this.squareTo(t),t}function f4(t){var e=ke();return this.divRemTo(t,e,null),e}function m4(t){var e=ke();return this.divRemTo(t,null,e),e}function d4(t){var e=ke(),r=ke();return this.divRemTo(t,e,r),new Array(e,r)}function y4(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()}function g4(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 Ou(){}function yM(t){return t}function x4(t,e,r){t.multiplyTo(e,r)}function b4(t,e){t.squareTo(e)}Ou.prototype.convert=yM;Ou.prototype.revert=yM;Ou.prototype.mulTo=x4;Ou.prototype.sqrTo=b4;function _4(t){return this.exp(t,new Ou)}function v4(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 P4(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 qa(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 w4(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 T4(t){return t}function S4(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 C4(t,e){t.squareTo(e),this.reduce(e)}function M4(t,e,r){t.multiplyTo(e,r),this.reduce(r)}qa.prototype.convert=w4;qa.prototype.revert=T4;qa.prototype.reduce=S4;qa.prototype.mulTo=M4;qa.prototype.sqrTo=C4;function I4(t,e){var r=t.bitLength(),n,i=Ii(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 Io(e):e.isEven()?o=new qa(e):o=new Ao(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=bm(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 A4(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 E4(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 L4(t){var e=t.isEven();if(this.isEven()&&e||t.signum()==0)return j.ZERO;for(var r=t.clone(),n=this.clone(),i=Ii(1),o=Ii(0),a=Ii(0),s=Ii(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 Xt=[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],D4=(1<<26)/Xt[Xt.length-1];function R4(t){var e,r=this.abs();if(r.t==1&&r[0]<=Xt[Xt.length-1]){for(e=0;e<Xt.length;++e)if(r[0]==Xt[e])return!0;return!1}if(r.isEven())return!1;for(e=1;e<Xt.length;){for(var n=Xt[e],i=e+1;i<Xt.length&&n<D4;)n*=Xt[i++];for(n=r.modInt(n);e<i;)if(n%Xt[e++]==0)return!1}return r.millerRabin(t)}function k4(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>Xt.length&&(t=Xt.length);for(var i=ke(),o=0;o<t;++o){i.fromInt(Xt[Math.floor(Math.random()*Xt.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=FU;j.prototype.toRadix=BU;j.prototype.fromRadix=zU;j.prototype.fromNumber=VU;j.prototype.bitwiseTo=HU;j.prototype.changeBit=i4;j.prototype.addTo=l4;j.prototype.dMultiply=y4;j.prototype.dAddOffset=g4;j.prototype.multiplyLowerTo=v4;j.prototype.multiplyUpperTo=P4;j.prototype.modInt=E4;j.prototype.millerRabin=k4;j.prototype.clone=LU;j.prototype.intValue=DU;j.prototype.byteValue=RU;j.prototype.shortValue=kU;j.prototype.signum=OU;j.prototype.toByteArray=UU;j.prototype.equals=NU;j.prototype.min=GU;j.prototype.max=jU;j.prototype.and=ZU;j.prototype.or=qU;j.prototype.xor=YU;j.prototype.andNot=WU;j.prototype.not=$U;j.prototype.shiftLeft=KU;j.prototype.shiftRight=JU;j.prototype.getLowestSetBit=e4;j.prototype.bitCount=r4;j.prototype.testBit=n4;j.prototype.setBit=o4;j.prototype.clearBit=a4;j.prototype.flipBit=s4;j.prototype.add=u4;j.prototype.subtract=c4;j.prototype.multiply=p4;j.prototype.divide=f4;j.prototype.remainder=m4;j.prototype.divideAndRemainder=d4;j.prototype.modPow=I4;j.prototype.modInverse=L4;j.prototype.pow=_4;j.prototype.gcd=A4;j.prototype.isProbablePrime=R4;j.prototype.square=h4;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 gm>"u"&&(gm=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 gm;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};gm(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,Mo)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};Mo?(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};pM&&(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;qV?(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){cM?!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,Mo&&(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,Mo&&(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)};Mo&&(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),Mo&&(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),Mo&&(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(cM&&(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{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 F4=function(t){return t<0?Math.ceil(t-.5):Math.round(t)},O4=function(t){return t<0?Math.ceil(t-.5):Math.floor(t+.5)},B4=function(t){return t<0?-Math.round(Math.abs(t)):Math.round(t)},z4=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=F4:Me.chromium?y.Clipper.Round=B4:Me.safari?y.Clipper.Round=z4:y.Clipper.Round=O4;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};pM&&(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};gm(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};Fu.exports=y});m();var ju="[MappedinJS]",NM=(i=>(i[i.LOG=0]="LOG",i[i.WARN=1]="WARN",i[i.ERROR=2]="ERROR",i[i.SILENT=3]="SILENT",i))(NM||{});function GM(t="",{prefix:e=ju}={}){let r=`${e}${t?`-${t}`:""}`,n=(i,o)=>{if(typeof window<"u"&&window.rnDebug){let a=o.map(s=>s instanceof Error&&s.stack?`${s.message}
2
- ${s.stack}`:s);window.rnDebug(`${t} ${i}: ${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 Mx=GM();function u5(t){0<=t&&t<=3&&(Mx.logState=t)}var Pt=Mx;m();m();var Bi=class extends Error{};Bi.prototype.name="InvalidTokenError";function jM(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 HM(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 jM(e)}catch{return atob(e)}}function Ix(t,e){if(typeof t!="string")throw new Bi("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 Bi(`Invalid token specified: missing part #${r+1}`);let i;try{i=HM(n)}catch(o){throw new Bi(`Invalid token specified: invalid base64 for part #${r+1} (${o.message})`)}try{return JSON.parse(i)}catch(o){throw new Bi(`Invalid token specified: invalid json for part #${r+1} (${o.message})`)}}m();var Zn=63710088e-1;m();function XM(t,e,r,n){return(t<e||t>r)&&Pt.warn(n),Math.min(r,Math.max(e,t))}m();function ZM(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 T5(t){let e=Ix(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]:e.aud??[],capabilities:e.capabilities??{}}}function Hu(t){return t*(Math.PI/180)}function S5(t,e){let r=Math.pow(10,e);return Math.sign(t)*Math.round(Math.abs(t)*r)/r}function Ax(t,e){return(t%e+e)%e}function C5(t,e){let r=Ax(t,Math.PI*2),n=Ax(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 qM(t){return t instanceof Nu?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 M5(){return typeof window<"u"&&window!==null}function I5(t,e){let[r,n]=t,[i,o]=e,a=Hu(i-r),s=Hu(o-n);return Math.sqrt(a*a+s*s)*Zn}function A5(t,e){let[r,n]=t.map(c=>Hu(c)),[i,o]=e.map(c=>Hu(c)),a=o-n,l=(i-r)*Math.cos((n+o)/2),u=a;return Math.sqrt(l*l+u*u)*Zn}m();function k5(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 YM(t,e){return`${e} ${t}`}var $a=class extends Error{constructor(e,r=ju){super(YM(e,r)),this.name="MappedinError"}},Ex=class extends $a{constructor(e,r=ju){super(e,r),this.name="MappedinRenderError"}};m();var Lm=class t extends Error{constructor(r){super(r);M(this,"name","AssertionError");Error.captureStackTrace&&Error.captureStackTrace(this,t)}};function Lx(t,e){if(t==null){let r;e?.customMessage?r=e.customMessage:r=`Expected ${e?.valueName?`'${e.valueName}'`:"value"} to be defined, but received ${t}`;let n=e?.errorClass||Lm,i=new n(r);throw e?.captureStackTrace!==!1&&Error.captureStackTrace&&Error.captureStackTrace(i,Lx),i}}function U5(t,e,r){if(Lx(t),t?.type!==e){let n=`Expected type ${e} but got ${t?.type}`;throw new Error(r??n)}}m();var Dm=[0,4,6,8,10],Vt=()=>{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],Dm.map((n,i)=>r.slice(n,i===Dm.length-1?void 0:Dm[i+1]).join("")).join("-")};function H5(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 Ka=class{constructor(){M(this,"_subscribers",{});M(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 Dx="mi-session-data",Rx="mi-local-data",Ja="id",Qa="deviceId",zi,Gr,jr,Xu=class Xu{constructor(){fr(this,Gr);fr(this,jr);try{let e=sessionStorage.getItem(Dx);e?Mt(this,Gr,JSON.parse(e)):Mt(this,Gr,{[Ja]:Vt()})}catch{Mt(this,Gr,{[Ja]:Vt()})}try{let e=localStorage.getItem(Rx);e?Mt(this,jr,JSON.parse(e)):Mt(this,jr,{[Qa]:Vt()})}catch{Mt(this,jr,{[Qa]:Vt()})}$e(this,Gr)[Ja]||($e(this,Gr)[Ja]=Vt()),$e(this,jr)[Qa]||($e(this,jr)[Qa]=Vt())}static getInstance(){return $e(this,zi)||Mt(this,zi,new Xu),$e(this,zi)}static ___clearInstance(){Mt(this,zi,void 0)}saveSessionData(e,r){$e(this,Gr)[e]=r;try{return sessionStorage.setItem(Dx,JSON.stringify($e(this,Gr))),!0}catch{return!1}}loadSessionData(e){let r=$e(this,Gr)[e];if(r!=null)return r}saveLocalData(e,r){$e(this,jr)[e]=r;try{return localStorage.setItem(Rx,JSON.stringify($e(this,jr))),!0}catch{return!1}}loadLocalData(e){let r=$e(this,jr)[e];if(r!=null)return r}};zi=new WeakMap,Gr=new WeakMap,jr=new WeakMap,fr(Xu,zi);var Rm=Xu;m();var WM=new Set(Object.keys(Lr.NAMES)),km;function kx(){return km==null&&(km=new Lr),km}var $M=t=>WM.has(t.toLowerCase()),KM=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},JM=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},QM=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},Zu=t=>t==null||typeof t!="string"?!1:!!(KM(t)||JM(t)||QM(t)||$M(t)),tN=t=>{let e=kx();return e.set(t),[e.r,e.g,e.b]},rN=t=>{let e=kx();return e.set(t[0],t[1],t[2]),"#"+e.getHexString()};m();var Fx=["ease-in","ease-out","ease-in-out","linear"];var Ox=t=>t,eI=t=>t*t,tI=t=>1-Math.cos(t*Math.PI/2),rI=t=>1-(1-t)*(1-t),Bx={linear:Ox,"ease-in":eI,"ease-out":rI,"ease-in-out":tI};function aN(t,e,r,n,i,o=Ox){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):Bx[o](a);return n+s*(i-n)}function nI(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 sN(t,e,r,n="ease-in"){if(e.length!==r.length)throw new $a("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=nI(t,e),o=(t-e[i])/(e[i+1]-e[i]),a=typeof n=="function"?n(o):Bx[n](o);return r[i]+a*(r[i+1]-r[i])}m();function qu(t){return(t%(2*Math.PI)+2*Math.PI)%(2*Math.PI)}m();m();var Yu={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 Lb=se(fe(),1),Db=se(Nx(),1);m();m();var Fm;function Wu(){return Fm==null&&(Fm=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Fm}var $u;function Om(){if($u==null&&($u=!1,Wu())){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(${o},${o+1},${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){$u=!0;break}}}return $u||!1}m();m();var ue=1e-6,Ae=typeof Float32Array<"u"?Float32Array:Array,qt=Math.random;var kN=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 qn={};ki(qn,{LDU:()=>vI,add:()=>PI,adjoint:()=>fI,clone:()=>aI,copy:()=>sI,create:()=>oI,determinant:()=>mI,equals:()=>TI,exactEquals:()=>wI,frob:()=>_I,fromRotation:()=>gI,fromScaling:()=>xI,fromValues:()=>uI,identity:()=>lI,invert:()=>hI,mul:()=>MI,multiply:()=>Gx,multiplyScalar:()=>SI,multiplyScalarAndAdd:()=>CI,rotate:()=>dI,scale:()=>yI,set:()=>cI,str:()=>bI,sub:()=>II,subtract:()=>jx,transpose:()=>pI});m();function oI(){var t=new Ae(4);return Ae!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t}function aI(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 sI(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function lI(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t}function uI(t,e,r,n){var i=new Ae(4);return i[0]=t,i[1]=e,i[2]=r,i[3]=n,i}function cI(t,e,r,n,i){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t}function pI(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 hI(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 fI(t,e){var r=e[0];return t[0]=e[3],t[1]=-e[1],t[2]=-e[2],t[3]=r,t}function mI(t){return t[0]*t[3]-t[2]*t[1]}function Gx(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 dI(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 yI(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 gI(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 xI(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t}function bI(t){return"mat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}function _I(t){return Math.hypot(t[0],t[1],t[2],t[3])}function vI(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 PI(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 jx(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 wI(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]}function TI(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 SI(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 CI(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 MI=Gx,II=jx;var vn={};ki(vn,{add:()=>KI,adjoint:()=>BI,clone:()=>EI,copy:()=>LI,create:()=>Bm,determinant:()=>zI,equals:()=>t2,exactEquals:()=>e2,frob:()=>$I,fromMat2d:()=>XI,fromMat4:()=>AI,fromQuat:()=>ZI,fromRotation:()=>jI,fromScaling:()=>HI,fromTranslation:()=>GI,fromValues:()=>DI,identity:()=>kI,invert:()=>OI,mul:()=>r2,multiply:()=>Hx,multiplyScalar:()=>JI,multiplyScalarAndAdd:()=>QI,normalFromMat4:()=>qI,projection:()=>YI,rotate:()=>UI,scale:()=>NI,set:()=>RI,str:()=>WI,sub:()=>n2,subtract:()=>Xx,translate:()=>VI,transpose:()=>FI});m();function Bm(){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 AI(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 EI(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 LI(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 DI(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 RI(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 kI(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 FI(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 OI(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 BI(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 zI(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 Hx(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 VI(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 UI(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 NI(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 GI(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 jI(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 HI(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 XI(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 ZI(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 qI(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,C=i*u-o*l,A=c*g-p*d,E=c*x-h*d,L=c*b-f*d,F=p*x-h*g,O=p*b-f*g,z=h*b-f*x,I=v*z-P*O+w*F+T*L-S*E+C*A;return I?(I=1/I,t[0]=(s*z-l*O+u*F)*I,t[1]=(l*L-a*z-u*E)*I,t[2]=(a*O-s*L+u*A)*I,t[3]=(i*O-n*z-o*F)*I,t[4]=(r*z-i*L+o*E)*I,t[5]=(n*L-r*O-o*A)*I,t[6]=(g*C-x*S+b*T)*I,t[7]=(x*w-d*C-b*P)*I,t[8]=(d*S-g*w+b*v)*I,t):null}function YI(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 WI(t){return"mat3("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+")"}function $I(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])}function KI(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 Xx(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 JI(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 QI(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 e2(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 t2(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 r2=Hx,n2=Xx;var B={};ki(B,{add:()=>N2,adjoint:()=>p2,clone:()=>o2,copy:()=>a2,create:()=>i2,determinant:()=>h2,equals:()=>X2,exactEquals:()=>H2,frob:()=>U2,fromQuat:()=>E2,fromQuat2:()=>S2,fromRotation:()=>v2,fromRotationTranslation:()=>Yx,fromRotationTranslationScale:()=>I2,fromRotationTranslationScaleOrigin:()=>A2,fromScaling:()=>_2,fromTranslation:()=>b2,fromValues:()=>s2,fromXRotation:()=>P2,fromYRotation:()=>w2,fromZRotation:()=>T2,frustum:()=>L2,getRotation:()=>M2,getScaling:()=>Wx,getTranslation:()=>C2,identity:()=>Zx,invert:()=>c2,lookAt:()=>B2,mul:()=>Z2,multiply:()=>qx,multiplyScalar:()=>G2,multiplyScalarAndAdd:()=>j2,ortho:()=>F2,orthoNO:()=>Kx,orthoZO:()=>O2,perspective:()=>D2,perspectiveFromFieldOfView:()=>k2,perspectiveNO:()=>$x,perspectiveZO:()=>R2,rotate:()=>d2,rotateX:()=>y2,rotateY:()=>g2,rotateZ:()=>x2,scale:()=>m2,set:()=>l2,str:()=>V2,sub:()=>q2,subtract:()=>Jx,targetTo:()=>z2,translate:()=>f2,transpose:()=>u2});m();function i2(){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 o2(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 a2(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 s2(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 l2(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 Zx(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 u2(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 c2(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,C=i*u-o*l,A=c*g-p*d,E=c*x-h*d,L=c*b-f*d,F=p*x-h*g,O=p*b-f*g,z=h*b-f*x,I=v*z-P*O+w*F+T*L-S*E+C*A;return I?(I=1/I,t[0]=(s*z-l*O+u*F)*I,t[1]=(i*O-n*z-o*F)*I,t[2]=(g*C-x*S+b*T)*I,t[3]=(h*S-p*C-f*T)*I,t[4]=(l*L-a*z-u*E)*I,t[5]=(r*z-i*L+o*E)*I,t[6]=(x*w-d*C-b*P)*I,t[7]=(c*C-h*w+f*P)*I,t[8]=(a*O-s*L+u*A)*I,t[9]=(n*L-r*O-o*A)*I,t[10]=(d*S-g*w+b*v)*I,t[11]=(p*w-c*S-f*v)*I,t[12]=(s*E-a*F-l*A)*I,t[13]=(r*F-n*E+i*A)*I,t[14]=(g*P-d*T-x*v)*I,t[15]=(c*T-p*P+h*v)*I,t):null}function p2(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 h2(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,C=u*d-c*f,A=u*g-p*f,E=u*x-h*f,L=c*g-p*d,F=c*x-h*d,O=p*x-h*g;return b*O-v*F+P*L+w*E-T*A+S*C}function qx(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 f2(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 m2(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 d2(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,C,A,E,L,F,O,z,I,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],C=i*i*c+u,A=o*i*c+a*l,E=a*i*c-o*l,L=i*o*c-a*l,F=o*o*c+u,O=a*o*c+i*l,z=i*a*c+o*l,I=o*a*c-i*l,R=a*a*c+u,t[0]=p*C+g*A+P*E,t[1]=h*C+x*A+w*E,t[2]=f*C+b*A+T*E,t[3]=d*C+v*A+S*E,t[4]=p*L+g*F+P*O,t[5]=h*L+x*F+w*O,t[6]=f*L+b*F+T*O,t[7]=d*L+v*F+S*O,t[8]=p*z+g*I+P*R,t[9]=h*z+x*I+w*R,t[10]=f*z+b*I+T*R,t[11]=d*z+v*I+S*R,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)}function y2(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 g2(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 x2(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 b2(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 _2(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 v2(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 P2(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 w2(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 T2(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 Yx(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 S2(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),Yx(t,e,r),t}function C2(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t}function Wx(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 M2(t,e){var r=new Ae(3);Wx(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 I2(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 A2(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],C=n[2],A=i[0],E=i[1],L=i[2],F=(1-(g+b))*T,O=(f+w)*T,z=(d-P)*T,I=(f-w)*S,R=(1-(h+b))*S,H=(x+v)*S,W=(d+P)*C,$=(x-v)*C,he=(1-(h+g))*C;return t[0]=F,t[1]=O,t[2]=z,t[3]=0,t[4]=I,t[5]=R,t[6]=H,t[7]=0,t[8]=W,t[9]=$,t[10]=he,t[11]=0,t[12]=r[0]+A-(F*A+I*E+W*L),t[13]=r[1]+E-(O*A+R*E+$*L),t[14]=r[2]+L-(z*A+H*E+he*L),t[15]=1,t}function E2(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 L2(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 $x(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 D2=$x;function R2(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 k2(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 Kx(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 F2=Kx;function O2(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 B2(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?Zx(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 z2(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 V2(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 U2(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 N2(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 Jx(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 G2(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 j2(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 H2(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 X2(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],C=e[5],A=e[6],E=e[7],L=e[8],F=e[9],O=e[10],z=e[11],I=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-C)<=ue*Math.max(1,Math.abs(s),Math.abs(C))&&Math.abs(l-A)<=ue*Math.max(1,Math.abs(l),Math.abs(A))&&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-F)<=ue*Math.max(1,Math.abs(p),Math.abs(F))&&Math.abs(h-O)<=ue*Math.max(1,Math.abs(h),Math.abs(O))&&Math.abs(f-z)<=ue*Math.max(1,Math.abs(f),Math.abs(z))&&Math.abs(d-I)<=ue*Math.max(1,Math.abs(d),Math.abs(I))&&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 Z2=qx,q2=Jx;var Yn={};ki(Yn,{add:()=>mE,calculateW:()=>nE,clone:()=>cE,conjugate:()=>sE,copy:()=>hE,create:()=>Km,dot:()=>xb,equals:()=>_E,exactEquals:()=>bE,exp:()=>mb,fromEuler:()=>lE,fromMat3:()=>yb,fromValues:()=>pE,getAngle:()=>QA,getAxisAngle:()=>JA,identity:()=>KA,invert:()=>aE,len:()=>gE,length:()=>bb,lerp:()=>yE,ln:()=>db,mul:()=>dE,multiply:()=>fb,normalize:()=>Jm,pow:()=>iE,random:()=>oE,rotateX:()=>eE,rotateY:()=>tE,rotateZ:()=>rE,rotationTo:()=>vE,scale:()=>gb,set:()=>fE,setAxes:()=>wE,setAxisAngle:()=>hb,slerp:()=>rc,sqlerp:()=>PE,sqrLen:()=>xE,squaredLength:()=>_b,str:()=>uE});m();var V={};ki(V,{add:()=>K2,angle:()=>gA,bezier:()=>uA,ceil:()=>J2,clone:()=>Y2,copy:()=>W2,create:()=>Ku,cross:()=>es,dist:()=>SA,distance:()=>nb,div:()=>TA,divide:()=>rb,dot:()=>Qu,equals:()=>vA,exactEquals:()=>_A,floor:()=>Q2,forEach:()=>IA,fromValues:()=>Ju,hermite:()=>lA,inverse:()=>aA,len:()=>Vm,length:()=>Qx,lerp:()=>sA,max:()=>tA,min:()=>eA,mul:()=>wA,multiply:()=>tb,negate:()=>oA,normalize:()=>zm,random:()=>cA,rotateX:()=>mA,rotateY:()=>dA,rotateZ:()=>yA,round:()=>rA,scale:()=>nA,scaleAndAdd:()=>iA,set:()=>$2,sqrDist:()=>CA,sqrLen:()=>MA,squaredDistance:()=>ib,squaredLength:()=>ob,str:()=>bA,sub:()=>PA,subtract:()=>eb,transformMat3:()=>hA,transformMat4:()=>pA,transformQuat:()=>fA,zero:()=>xA});m();function Ku(){var t=new Ae(3);return Ae!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function Y2(t){var e=new Ae(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function Qx(t){var e=t[0],r=t[1],n=t[2];return Math.hypot(e,r,n)}function Ju(t,e,r){var n=new Ae(3);return n[0]=t,n[1]=e,n[2]=r,n}function W2(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function $2(t,e,r,n){return t[0]=e,t[1]=r,t[2]=n,t}function K2(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t}function eb(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t}function tb(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],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}function J2(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t}function Q2(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t}function eA(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 tA(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 rA(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t}function nA(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t}function iA(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 nb(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 ib(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 ob(t){var e=t[0],r=t[1],n=t[2];return e*e+r*r+n*n}function oA(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t}function aA(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t}function zm(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 Qu(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function es(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 sA(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 lA(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 uA(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 cA(t,e){e=e||1;var r=qt()*2*Math.PI,n=qt()*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 pA(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 hA(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 fA(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 mA(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 dA(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 yA(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 gA(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&&Qu(t,e)/c;return Math.acos(Math.min(Math.max(p,-1),1))}function xA(t){return t[0]=0,t[1]=0,t[2]=0,t}function bA(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"}function _A(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]}function vA(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 PA=eb,wA=tb,TA=rb,SA=nb,CA=ib,Vm=Qx,MA=ob,IA=function(){var t=Ku();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={};ki(Ne,{add:()=>Hm,ceil:()=>AA,clone:()=>Um,copy:()=>Gm,create:()=>ab,cross:()=>BA,dist:()=>ZA,distance:()=>cb,div:()=>XA,divide:()=>ub,dot:()=>qm,equals:()=>$m,exactEquals:()=>Wm,floor:()=>EA,forEach:()=>$A,fromValues:()=>Nm,inverse:()=>OA,len:()=>YA,length:()=>ec,lerp:()=>Ym,max:()=>DA,min:()=>LA,mul:()=>HA,multiply:()=>lb,negate:()=>FA,normalize:()=>Zm,random:()=>zA,round:()=>RA,scale:()=>Xm,scaleAndAdd:()=>kA,set:()=>jm,sqrDist:()=>qA,sqrLen:()=>WA,squaredDistance:()=>pb,squaredLength:()=>tc,str:()=>GA,sub:()=>jA,subtract:()=>sb,transformMat4:()=>VA,transformQuat:()=>UA,zero:()=>NA});m();function ab(){var t=new Ae(4);return Ae!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function Um(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 Nm(t,e,r,n){var i=new Ae(4);return i[0]=t,i[1]=e,i[2]=r,i[3]=n,i}function Gm(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function jm(t,e,r,n,i){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t}function Hm(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 sb(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 lb(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 ub(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 AA(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 EA(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 LA(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 DA(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 RA(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 Xm(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 kA(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 cb(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 pb(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 ec(t){var e=t[0],r=t[1],n=t[2],i=t[3];return Math.hypot(e,r,n,i)}function tc(t){var e=t[0],r=t[1],n=t[2],i=t[3];return e*e+r*r+n*n+i*i}function FA(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t}function OA(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 Zm(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 qm(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}function BA(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 Ym(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 zA(t,e){e=e||1;var r,n,i,o,a,s;do r=qt()*2-1,n=qt()*2-1,a=r*r+n*n;while(a>=1);do i=qt()*2-1,o=qt()*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 VA(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 UA(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 NA(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t}function GA(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}function Wm(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]}function $m(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 jA=sb,HA=lb,XA=ub,ZA=cb,qA=pb,YA=ec,WA=tc,$A=function(){var t=ab();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 Km(){var t=new Ae(4);return Ae!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function KA(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t}function hb(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 JA(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 QA(t,e){var r=xb(t,e);return Math.acos(2*r*r-1)}function fb(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 eE(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 tE(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 rE(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 nE(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 mb(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 db(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 iE(t,e,r){return db(t,e),gb(t,t,r),mb(t,t),t}function rc(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 oE(t){var e=qt(),r=qt(),n=qt(),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 aE(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 sE(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t}function yb(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 lE(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 uE(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}var cE=Um,pE=Nm,hE=Gm,fE=jm,mE=Hm,dE=fb,gb=Xm,xb=qm,yE=Ym,bb=ec,gE=bb,_b=tc,xE=_b,Jm=Zm,bE=Wm,_E=$m,vE=function(){var t=Ku(),e=Ju(1,0,0),r=Ju(0,1,0);return function(n,i,o){var a=Qu(i,o);return a<-.999999?(es(t,e,i),Vm(t)<1e-6&&es(t,r,i),zm(t,t),hb(n,t,Math.PI),n):a>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(es(t,i,o),n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=1+a,Jm(n,n))}}(),PE=function(){var t=Km(),e=Km();return function(r,n,i,o,a,s){return rc(t,n,a,s),rc(e,i,o,s),rc(r,t,e,2*s*(1-s)),r}}(),wE=function(){var t=Bm();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],Jm(e,yb(e,t))}}();var wt={};ki(wt,{add:()=>IE,angle:()=>YE,ceil:()=>AE,clone:()=>TE,copy:()=>CE,create:()=>vb,cross:()=>UE,dist:()=>nL,distance:()=>Sb,div:()=>rL,divide:()=>Tb,dot:()=>VE,equals:()=>JE,exactEquals:()=>KE,floor:()=>EE,forEach:()=>aL,fromValues:()=>SE,inverse:()=>BE,len:()=>QE,length:()=>Mb,lerp:()=>NE,max:()=>DE,min:()=>LE,mul:()=>tL,multiply:()=>wb,negate:()=>OE,normalize:()=>zE,random:()=>GE,rotate:()=>qE,round:()=>RE,scale:()=>kE,scaleAndAdd:()=>FE,set:()=>ME,sqrDist:()=>iL,sqrLen:()=>oL,squaredDistance:()=>Cb,squaredLength:()=>Ib,str:()=>$E,sub:()=>eL,subtract:()=>Pb,transformMat2:()=>jE,transformMat2d:()=>HE,transformMat3:()=>XE,transformMat4:()=>ZE,zero:()=>WE});m();function vb(){var t=new Ae(2);return Ae!=Float32Array&&(t[0]=0,t[1]=0),t}function TE(t){var e=new Ae(2);return e[0]=t[0],e[1]=t[1],e}function SE(t,e){var r=new Ae(2);return r[0]=t,r[1]=e,r}function CE(t,e){return t[0]=e[0],t[1]=e[1],t}function ME(t,e,r){return t[0]=e,t[1]=r,t}function IE(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t}function Pb(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t}function wb(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t}function Tb(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t}function AE(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t}function EE(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t}function LE(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t}function DE(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t}function RE(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t}function kE(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t}function FE(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t}function Sb(t,e){var r=e[0]-t[0],n=e[1]-t[1];return Math.hypot(r,n)}function Cb(t,e){var r=e[0]-t[0],n=e[1]-t[1];return r*r+n*n}function Mb(t){var e=t[0],r=t[1];return Math.hypot(e,r)}function Ib(t){var e=t[0],r=t[1];return e*e+r*r}function OE(t,e){return t[0]=-e[0],t[1]=-e[1],t}function BE(t,e){return t[0]=1/e[0],t[1]=1/e[1],t}function zE(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 VE(t,e){return t[0]*e[0]+t[1]*e[1]}function UE(t,e,r){var n=e[0]*r[1]-e[1]*r[0];return t[0]=t[1]=0,t[2]=n,t}function NE(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 GE(t,e){e=e||1;var r=qt()*2*Math.PI;return t[0]=Math.cos(r)*e,t[1]=Math.sin(r)*e,t}function jE(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 HE(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 XE(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 ZE(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 qE(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 YE(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 WE(t){return t[0]=0,t[1]=0,t}function $E(t){return"vec2("+t[0]+", "+t[1]+")"}function KE(t,e){return t[0]===e[0]&&t[1]===e[1]}function JE(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 QE=Mb,eL=Pb,tL=wb,rL=Tb,nL=Sb,iL=Cb,oL=Ib,aL=function(){var t=vb();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 yt(t,e,r){return e*(8192/(t.tileSize*Math.pow(2,r-t.tileID.overscaledZ)))}function Fo(){return new Float64Array(4)}function tt(){return new Float64Array(3)}function Hr(){return new Float64Array(16)}function Wn(){let t=new Float64Array(16);return B.identity(t),t}function nc(){let t=new Float32Array(16);return B.identity(t),t}function Yt(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]:yt(e,r[0],t.zoom),i?r[1]:yt(e,r[1],t.zoom)]}function ts(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]}function mr(t,e,r){let n=vn.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 Rb(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 rs(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 Ut(t,e){let r=Ni(t,360),n=Ni(e,360),i=n-r,o=n>r?i-360:i+360;return Math.abs(i)<Math.abs(o)?i:o}function ns(t,e){let r=Ni(t,Math.PI*2),n=Ni(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 Ni(t,e){return(t%e+e)%e}function Oo(t,e,r,n,i){let o=ce((t-e)/(r-e),0,1);return Pn(n,i,o)}function Pn(t,e,r){return t*(1-r)+e*r}function kb(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 ic(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 is(t,e,r,n){let i=new Db.default(t,e,r,n);return o=>i.solve(o)}var os=is(.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 Fb(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 nn(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 sL=1;function oc(){return sL++}function Ob(t){return Math.log(t)/Math.LN2%1===0}function Bb(t){return t<=1?1:Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function lt(t){return Math.pow(2,t)}function rt(t){return Math.log(t)/Math.LN2}function as(t,e,r){let n={};for(let i in t)n[i]=e.call(r||this,t[i],i,t);return n}function ac(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 kt(t){return Array.isArray(t)?t.map(kt):typeof t=="object"&&t?as(t,kt):t}var Ab={};function ve(t){Ab[t]||(typeof console<"u"&&console.warn(t),Ab[t]=!0)}function wn(t,e,r){return(r.y-t.y)*(e.x-t.x)>(e.y-t.y)*(r.x-t.x)}function zb(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 Lb.default(t.x+p*o,t.y+p*i)}function Vb([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 Tn(t){return typeof WorkerGlobalScope<"u"&&typeof t<"u"&&t instanceof WorkerGlobalScope}function Ub(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 Qm=null;function Nb(t){if(Qm==null){let e=t.navigator?t.navigator.userAgent:null;Qm=!!t.safari||!!(e&&(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return Qm}function Wt(t){return typeof ImageBitmap<"u"&&t instanceof ImageBitmap}var Gb=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 ${r.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}},Eb="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=",jb=t=>new Promise((e,r)=>{let n=new Image;n.onload=()=>{e(n),URL.revokeObjectURL(n.src),n.onload=null,window.requestAnimationFrame(()=>{n.src=Eb})},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):Eb});function lL(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 Hb(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?.format;if(!a||!(a.startsWith("BGR")||a.startsWith("RGB")))throw new Error(`Unrecognized format ${a}`);let s=a.startsWith("BGR"),l=new Uint8ClampedArray(n*i*4);if(await o.copyTo(l,lL(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 ss(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 Ui(t){return t/Math.PI*180}function sc(t,e){return t.roll==e.roll&&t.pitch==e.pitch&&t.bearing==e.bearing}function Xb(t){let e=new Float64Array(9);vn.fromQuat(e,t);let r=Ui(-Math.asin(ce(e[2],-1,1))),n,i;return Math.hypot(e[5],e[8])<.001?(n=0,i=-Ui(Math.atan2(e[3],e[4]))):(n=Ui(e[5]===0&&e[8]===0?0:Math.atan2(e[5],e[8])),i=Ui(e[1]===0&&e[0]===0?0:Math.atan2(e[1],e[0]))),{roll:n,pitch:r+90,bearing:i}}function ed(t,e,r){let n=wt.fromValues(e.x-r.x,e.y-r.y),i=wt.fromValues(t.x-r.x,t.y-r.y),o=n[0]*i[1]-n[1]*i[0],a=Math.atan2(o,wt.dot(n,i));return Ui(a)}function td(t,e,r){let n=new Float64Array(4);return Yn.fromEuler(n,t,e-90,r),n}var Gi=25,ls=0,Nt=85.051129,Zb={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},qb={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0};function Yb(t,e){return Zb[e]&&"touches"in t}function Wb(t,e){return qb[e]&&(t instanceof MouseEvent||t instanceof WheelEvent)}function $b(t){return Zb[t]||qb[t]}m();m();var Kb="AbortError";function Jb(t){return t.message===Kb}function ji(){return new Error(Kb)}var uL=typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),lc,rd,ae={now:uL,frame(t,e,r){let n=requestAnimationFrame(o=>{i(),e(o)}),{unsubscribe:i}=ss(t.signal,"abort",()=>{i(),cancelAnimationFrame(n),r(ji())},!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 lc||(lc=document.createElement("a")),lc.href=t,lc.href},hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return matchMedia?(rd==null&&(rd=matchMedia("(prefers-reduced-motion: reduce)")),rd.matches):!1}};m();var Qb=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 Qb.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 $t={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function uc(t){return $t.REGISTERED_PROTOCOLS[t.substring(0,t.indexOf("://"))]}m();var cc="global-dispatcher",$n=class extends Error{constructor(e,r,n,i){super(`AJAXError: ${r} (${e}): ${n}`),this.status=e,this.statusText=r,this.url=n,this.body=i}},pc=()=>Tn(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,cL=t=>/^file:/.test(t)||/^file:/.test(pc())&&!/^\w+:/.test(t);async function pL(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:pc(),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 $n(0,a.message,t.url,new Blob)}if(!n.ok){let a=await n.blob();throw new $n(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 ji();return{data:o,cacheControl:n.headers.get("Cache-Control"),expires:n.headers.get("Expires")}}function hL(t,e){return new Promise((r,n)=>{let i=new XMLHttpRequest;i.open(t.method||"GET",t.url,!0),(t.type==="arrayBuffer"||t.type==="image")&&(i.responseType="arraybuffer");for(let o in t.headers)i.setRequestHeader(o,t.headers[o]);t.type==="json"&&(i.responseType="text",t.headers?.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 o=i.response;if(t.type==="json")try{o=JSON.parse(i.response)}catch(a){n(a);return}r({data:o,cacheControl:i.getResponseHeader("Cache-Control"),expires:i.getResponseHeader("Expires")})}else{let o=new Blob([i.response],{type:i.getResponseHeader("Content-Type")});n(new $n(i.status,i.statusText,t.url,o))}},e.signal.addEventListener("abort",()=>{i.abort(),n(ji())}),i.send(t.body)})}var Bo=function(t,e){if(/:\/\//.test(t.url)&&!/^https?:|^file:/.test(t.url)){let r=uc(t.url);if(r)return r(t,e);if(Tn(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:t,targetMapId:cc},e)}if(!cL(t.url)){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return pL(t,e);if(Tn(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:t,mustQueue:!0,targetMapId:cc},e)}return hL(t,e)},Kn=(t,e)=>Bo(Z(t,{type:"json"}),e),e_=(t,e)=>Bo(Z(t,{type:"arrayBuffer"}),e);function nd(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 t_=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");nd(n)||(e.crossOrigin="Anonymous"),i.src=n,e.appendChild(i)}})};m();m();var cs={supported:!1,testSupport:fL},us,id=!1,zo,r_=!1;typeof document<"u"&&(zo=document.createElement("img"),zo.onload=()=>{us&&n_(us),us=null,r_=!0},zo.onerror=()=>{id=!0,us=null},zo.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");function fL(t){id||!zo||(r_?n_(t):us=t)}function n_(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,zo),t.isContextLost())return;cs.supported=!0}catch{}t.deleteTexture(e),id=!0}var Gt;(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)=>{cs.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"?Gb(d):jb(d),c=async d=>{d.state="running";let{requestParameters:g,supportImageRefresh:x,onError:b,onSuccess:v,abortController:P}=d,w=x===!1&&!Tn(self)&&!uc(g.url)&&(!g.headers||Object.keys(g.headers).reduce((S,C)=>S&&C==="accept",!0));e++;let T=w?h(g,P):Bo(g,P);try{let S=await T;if(delete d.abortController,d.state="completed",S.data instanceof HTMLImageElement||Wt(S.data))v(S);else if(S.data){let C=await u(S.data);v({data:C,cacheControl:S.cacheControl,expires:S.expires})}}catch(S){delete d.abortController,b(S)}finally{e--,p()}},p=()=>{let d=s()?$t.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:$t.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"||!nd(P))&&(v.crossOrigin="anonymous"),g.signal.addEventListener("abort",()=>{v.src="",b(ji())}),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})})(Gt||(Gt={}));Gt.resetRequestQueue();m();var hc=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 i_(t,e,r){r[t]&&r[t].indexOf(e)!==-1||(r[t]=r[t]||[],r[t].push(e))}function od(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||{},i_(e,r,this._listeners),{unsubscribe:()=>{this.off(e,r)}}}off(e,r){return od(e,r,this._listeners),od(e,r,this._oneTimeListeners),this}once(e,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},i_(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)od(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 mL=8,dL={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"}},yL={"*":{type:"source"}},gL=["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],xL={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:"*"}},bL={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:"*"}},_L={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:"*"}},vL={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"}},PL={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"}}},wL={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"}}},TL={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"}},SL=["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],CL={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},ML={"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"}},IL={"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"}},AL={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},EL={"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"}},LL={"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"}},DL={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},RL={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},kL={type:"array",value:"*"},FL={type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},OL={type:"enum",values:{Point:{},LineString:{},Polygon:{}}},BL={type:"array",minimum:0,maximum:24,value:["number","color"],length:2},zL={type:"array",value:"*",minimum:1},VL={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}},UL={"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}},NL={source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},GL={type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},jL=["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],HL={"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"}},XL={"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"}},ZL={"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"}},qL={"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"}},YL={"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"}},WL={"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"}},$L={"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"}},KL={"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"}},JL={duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},QL={"*":{type:"string"}},D={$version:mL,$root:dL,sources:yL,source:gL,source_vector:xL,source_raster:bL,source_raster_dem:_L,source_geojson:vL,source_video:PL,source_image:wL,layer:TL,layout:SL,layout_background:CL,layout_fill:ML,layout_circle:IL,layout_heatmap:AL,"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:EL,layout_symbol:LL,layout_raster:DL,layout_hillshade:RL,"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:kL,filter_operator:FL,geometry_type:OL,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:BL,expression:zL,light:VL,sky:UL,terrain:NL,projection:GL,paint:jL,paint_fill:HL,"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:XL,paint_circle:ZL,paint_heatmap:qL,paint_symbol:YL,paint_raster:WL,paint_hillshade:$L,"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:KL,transition:JL,"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:QL},eD=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function tD(t,e){let r={};for(let n in t)n!=="ref"&&(r[n]=t[n]);return eD.forEach(n=>{n in e&&(r[n]=e[n])}),r}function Dd(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]=tD(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 M_(t,e,r){kr(r,{command:"addSource",args:[t,e[t]]})}function I_(t,e,r){kr(e,{command:"removeSource",args:[t]}),r[t]=!0}function rD(t,e,r,n){I_(t,r,n),M_(t,e,r)}function nD(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 iD(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)||I_(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"&&nD(t,e,i)?kr(r,{command:"setGeoJSONSourceData",args:[i,e[i].data]}):rD(i,e,r,n)):M_(i,e,r))}function fc(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 o_(t){return t.id}function a_(t,e){return t[e.id]=e,t}function oD(t,e,r){t=t||[],e=e||[];let n=t.map(o_),i=e.map(o_),o=t.reduce(a_,{}),a=e.reduce(a_,{}),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}fc(c.layout,p.layout,r,u,null,"setLayoutProperty"),fc(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?fc(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?fc(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 A_(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=[];iD(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),oD(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?`${e}: `:"")+n,i&&(this.identifier=i),r!=null&&r.__line__&&(this.line=r.__line__)}};function Go(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}},dd=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(`${e} not found in scope.`)}has(e){return this.bindings[e]?!0:this.parent?this.parent.has(e):!1}},Zo={kind:"null"},Y={kind:"number"},Pe={kind:"string"},ge={kind:"boolean"},Br={kind:"color"},Dc={kind:"projectionDefinition"},qi={kind:"object"},me={kind:"value"},aD={kind:"error"},Rc={kind:"collator"},qo={kind:"formatted"},kc={kind:"padding"},ms={kind:"colorArray"},Fc={kind:"numberArray"},Is={kind:"resolvedImage"},Oc={kind:"variableAnchorOffsetCollection"};function dr(t,e){return{kind:"array",itemType:t,N:e}}function nt(t){if(t.kind==="array"){let e=nt(t.itemType);return typeof t.N=="number"?`array<${e}, ${t.N}>`:t.itemType.kind==="value"?"array":`array<${e}>`}else return t.kind}var sD=[Zo,Y,Pe,ge,Br,Dc,qo,qi,dr(me),kc,Fc,ms,Is,Oc];function ds(t,e){if(e.kind==="error")return null;if(t.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!ds(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 sD)if(!ds(r,e))return null}}return`Expected ${nt(t)} but found ${nt(e)} instead.`}function Rd(t,e){return e.some(r=>r.kind===t.kind)}function Yi(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 Jn(t,e){return t.kind==="array"&&e.kind==="array"?t.itemType.kind===e.itemType.kind&&typeof t.N=="number":t.kind===e.kind}var E_=.96422,L_=1,D_=.82521,R_=4/29,No=6/29,k_=3*No*No,lD=No*No*No,uD=Math.PI/180,cD=180/Math.PI;function F_(t){return t=t%360,t<0&&(t+=360),t}function O_([t,e,r,n]){t=ad(t),e=ad(e),r=ad(r);let i,o,a=sd((.2225045*t+.7168786*e+.0606169*r)/L_);t===e&&e===r?i=o=a:(i=sd((.4360747*t+.3850649*e+.1430804*r)/E_),o=sd((.0139322*t+.0971045*e+.7141733*r)/D_));let s=116*a-16;return[s<0?0:s,500*(i-a),200*(a-o),n]}function ad(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function sd(t){return t>lD?Math.pow(t,1/3):t/k_+R_}function B_([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=L_*ud(i),o=E_*ud(o),a=D_*ud(a),[ld(3.1338561*o-1.6168667*i-.4906146*a),ld(-.9787684*o+1.9161415*i+.033454*a),ld(.0719453*o-.2289914*i+1.4052427*a),n]}function ld(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 ud(t){return t>No?t*t*t:k_*(t-R_)}function pD(t){let[e,r,n,i]=O_(t),o=Math.sqrt(r*r+n*n);return[Math.round(o*1e4)?F_(Math.atan2(n,r)*cD):NaN,o,e,i]}function hD([t,e,r,n]){return t=isNaN(t)?0:t*uD,B_([r,Math.cos(t)*e,Math.sin(t)*e,n])}function fD([t,e,r,n]){t=F_(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 mD=Object.hasOwn||function(e,r){return Object.prototype.hasOwnProperty.call(e,r)};function hs(t,e){return mD(t,e)?t[e]:void 0}function dD(t){if(t=t.toLowerCase().trim(),t==="transparent")return[0,0,0,0];let e=hs(yD,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[mc(t.slice(a,a+=o)),mc(t.slice(a,a+=o)),mc(t.slice(a,a+=o)),mc(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=[Vo(+s/w,0,1),Vo(+c/w,0,1),Vo(+f/w,0,1),x?s_(+x,b):1];if(l_(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,Vo(+s,0,100),Vo(+u,0,100),p?s_(+p,h):1];if(l_(d))return fD(d)}}}function mc(t){return parseInt(t.padEnd(2,t),16)/255}function s_(t,e){return Vo(e?t/100:t,0,1)}function Vo(t,e,r){return Math.min(Math.max(e,t),r)}function l_(t){return!t.some(Number.isNaN)}var yD={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 ei(t,e,r){return t+r*(e-t)}function jo(t,e,r){return t.map((n,i)=>ei(n,e[i],r))}function gD(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=dD(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",pD(this.rgb))}get lab(){return this.overwriteGetter("lab",O_(this.rgb))}overwriteGetter(e,r){return Object.defineProperty(this,e,{value:r}),r}toString(){let[e,r,n,i]=this.rgb;return`rgba(${[e,r,n].map(o=>Math.round(o*255)).join(",")},${i})`}static interpolate(e,r,n,i="rgb"){switch(i){case"rgb":{let[o,a,s,l]=jo(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]=hD([f,d??ei(a,c,n),ei(s,p,n),ei(l,h,n)]);return new t(g,x,b,v,!1)}case"lab":{let[o,a,s,l]=B_(jo(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 ys=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}},xD=["bottom","center","top"],gs=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}},yr=class t{constructor(e){this.sections=e}static fromString(e){return new t([new gs(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(jo(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(jo(e.values,r.values,n))}},Kt=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 (${e.values.length} vs. ${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)}},Ke=class extends Error{constructor(e){super(e),this.name="RuntimeError"}toJSON(){return this.message}},bD=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]),an=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"||!bD.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 Ke(`Cannot interpolate values of different length. from: ${e.toString()}, to: ${r.toString()}`);let a=[];for(let s=0;s<i.length;s+=2){if(i[s]!==o[s])throw new Ke(`Cannot interpolate values containing mismatched anchors. from[${s}]: ${i[s]}, to[${s}]: ${o[s]}`);a.push(i[s]);let[l,u]=i[s+1],[c,p]=o[s+1];a.push([ei(l,c,n),ei(u,p,n)])}return new t(a)}},Jt=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}},sn=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 z_(t,e,r,n){return typeof t=="number"&&t>=0&&t<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof r=="number"&&r>=0&&r<=255?typeof n>"u"||typeof n=="number"&&n>=0&&n<=1?null:`Invalid rgba value [${[t,e,r,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof n=="number"?[t,e,r,n]:[t,e,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function xs(t){if(t===null||typeof t=="string"||typeof t=="boolean"||typeof t=="number"||t instanceof sn||t instanceof K||t instanceof ys||t instanceof yr||t instanceof zr||t instanceof Vr||t instanceof Kt||t instanceof an||t instanceof Jt)return!0;if(Array.isArray(t)){for(let e of t)if(!xs(e))return!1;return!0}else if(typeof t=="object"){for(let e in t)if(!xs(t[e]))return!1;return!0}else return!1}function ct(t){if(t===null)return Zo;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 sn)return Dc;if(t instanceof ys)return Rc;if(t instanceof yr)return qo;if(t instanceof zr)return kc;if(t instanceof Vr)return Fc;if(t instanceof Kt)return ms;if(t instanceof an)return Oc;if(t instanceof Jt)return Is;if(Array.isArray(t)){let e=t.length,r;for(let n of t){let i=ct(n);if(!r)r=i;else{if(r===i)continue;r=me;break}}return dr(r||me,e)}else return qi}function fs(t){let e=typeof t;return t===null?"":e==="string"||e==="number"||e==="boolean"?String(t):t instanceof K||t instanceof sn||t instanceof yr||t instanceof zr||t instanceof Vr||t instanceof Kt||t instanceof an||t instanceof Jt?t.toString():JSON.stringify(t)}var ti=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 ${e.length-1} instead.`);if(!xs(e[1]))return r.error("invalid value");let n=e[1],i=ct(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}},dc={string:Pe,number:Y,boolean:ge,object:qi},Xr=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 dc)||u==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);s=dc[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=dr(s,l)}else{if(!dc[o])throw new Error(`Types doesn't contain name = ${o}`);i=dc[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(ds(this.type,ct(n))){if(r===this.args.length-1)throw new Ke(`Expected value to be of type ${nt(this.type)}, but found ${nt(ct(n))} instead.`)}else return n}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},u_={"to-boolean":ge,"to-color":Br,"to-number":Y,"to-string":Pe},Qn=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(!u_[n])throw new Error(`Can't parse ${n} as it is not part of the known types`);if((n==="to-boolean"||n==="to-string")&&e.length!==2)return r.error("Expected one argument.");let i=u_[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 ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:n=z_(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 Ke(n||`Could not parse color from value '${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 Ke(`Could not parse padding from value '${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 Ke(`Could not parse numberArray from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"colorArray":{let r;for(let n of this.args){r=n.evaluate(e);let i=Kt.parse(r);if(i)return i}throw new Ke(`Could not parse colorArray from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"variableAnchorOffsetCollection":{let r;for(let n of this.args){r=n.evaluate(e);let i=an.parse(r);if(i)return i}throw new Ke(`Could not parse variableAnchorOffsetCollection from value '${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 Ke(`Could not convert ${JSON.stringify(r)} to number.`)}case"formatted":return yr.fromString(fs(this.args[0].evaluate(e)));case"resolvedImage":return Jt.fromString(fs(this.args[0].evaluate(e)));case"projectionDefinition":return this.args[0].evaluate(e);default:return fs(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},_D=["Unknown","Point","LineString","Polygon"],bc=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"?_D[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}},_c=class t{constructor(e,r,n=[],i,o=new dd,a=[]){this.registry=e,this.path=n,this.key=n.map(s=>`[${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 Xr(o,[i]):a==="coerce"?new Qn(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 ${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 ti)&&a.type.kind!=="resolvedImage"&&this._isConstant(a)){let s=new bc;try{a=new ti(a.type,a.evaluate(s))}catch(l){return this.error(l.message),null}}return a}return this.error(`Unknown expression "${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 ${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=`${this.key}${r.map(i=>`[${i}]`).join("")}`;this.errors.push(new Fr(n,e))}checkSubtype(e,r){let n=ds(e,r);return n&&this.error(n),n}},vc=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 ${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 ${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()}},Pc=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 "${n}". Make sure "${n}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}},yd=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 ${e.length-1} instead.`);let n=r.parse(e[1],1,Y),i=r.parse(e[2],2,dr(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 Ke(`Array index out of bounds: ${r} < 0.`);if(r>=n.length)throw new Ke(`Array index out of bounds: ${r} > ${n.length-1}.`);if(r!==Math.floor(r))throw new Ke(`Array index must be an integer, but found ${r} instead.`);return n[r]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}},gd=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 ${e.length-1} instead.`);let n=r.parse(e[1],1,me),i=r.parse(e[2],2,me);return!n||!i?null:Rd(n.type,[ge,Pe,Y,Zo,me])?new t(n,i):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${nt(n.type)} instead`)}evaluate(e){let r=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!n)return!1;if(!Yi(r,["boolean","string","number","null"]))throw new Ke(`Expected first argument to be of type boolean, string, number or null, but found ${nt(ct(r))} instead.`);if(!Yi(n,["string","array"]))throw new Ke(`Expected second argument to be of type array or string, but found ${nt(ct(n))} instead.`);return n.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}},xd=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 ${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(!Rd(n.type,[ge,Pe,Y,Zo,me]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${nt(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(!Yi(r,["boolean","string","number","null"]))throw new Ke(`Expected first argument to be of type boolean, string, number or null, but found ${nt(ct(r))} instead.`);let i;if(this.fromIndex&&(i=this.fromIndex.evaluate(e)),Yi(n,["string"])){let o=n.indexOf(r,i);return o===-1?-1:[...n.slice(0,o)].length}else{if(Yi(n,["array"]))return n.indexOf(r,i);throw new Ke(`Expected second argument to be of type array or string, but found ${nt(ct(n))} instead.`)}}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}},bd=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 ${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 ${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=ct(d);else if(h.checkSubtype(n,ct(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(ct(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()}},_d=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 ${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()}},vd=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 ${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(!Rd(n.type,[dr(me),Pe,me]))return r.error(`Expected first argument to be of type array or string, but found ${nt(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)),Yi(r,["string"]))return[...r].slice(n,i).join("");if(Yi(r,["array"]))return r.slice(n,i);throw new Ke(`Expected first argument to be of type array or string, but found ${nt(ct(r))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}};function Bc(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 Ke("Input is not a number.");return 0}var Ho=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 ${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=Bc(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 vD(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var cd,c_;function PD(){if(c_)return cd;c_=1,cd=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))}},cd}var wD=PD(),TD=vD(wD),jt=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=pd(r,e.base,n,i);else if(e.name==="linear")o=pd(r,1,n,i);else if(e.name==="cubic-bezier"){let a=e.controlPoints;o=new TD(a[0],a[1],a[2],a[3]).solve(pd(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 ${String(i[0])}`,1,0);if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${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!=ms?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!Jn(l,Y)&&!Jn(l,Dc)&&!Jn(l,Br)&&!Jn(l,kc)&&!Jn(l,Fc)&&!Jn(l,ms)&&!Jn(l,Oc)&&!Jn(l,dr(Y))?r.error(`Type ${nt(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=Bc(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 ei(c,p,u);case"color":return K.interpolate(c,p,u);case"padding":return zr.interpolate(c,p,u);case"colorArray":return Kt.interpolate(c,p,u);case"numberArray":return Vr.interpolate(c,p,u);case"variableAnchorOffsetCollection":return an.interpolate(c,p,u);case"array":return jo(c,p,u);case"projectionDefinition":return sn.interpolate(c,p,u)}case"interpolate-hcl":switch(this.type.kind){case"color":return K.interpolate(c,p,u,"hcl");case"colorArray":return Kt.interpolate(c,p,u,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return K.interpolate(c,p,u,"lab");case"colorArray":return Kt.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 pd(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:ei,padding:zr.interpolate,numberArray:Vr.interpolate,colorArray:Kt.interpolate,variableAnchorOffsetCollection:an.interpolate,array:jo},wc=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=>ds(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 Jt&&!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 p_(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 SD(t,e,r){return e===r}function CD(t,e,r){return e!==r}function MD(t,e,r){return e<r}function ID(t,e,r){return e>r}function AD(t,e,r){return e<=r}function ED(t,e,r){return e>=r}function V_(t,e,r,n){return n.compare(e,r)===0}function LD(t,e,r,n){return!V_(t,e,r,n)}function DD(t,e,r,n){return n.compare(e,r)<0}function RD(t,e,r,n){return n.compare(e,r)>0}function kD(t,e,r,n){return n.compare(e,r)<=0}function FD(t,e,r,n){return n.compare(e,r)>=0}function Yo(t,e,r){let n=t!=="=="&&t!=="!=";return class U_{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(!p_(s,l.type))return a.concat(1).error(`"${s}" comparisons are not supported for type '${nt(l.type)}'.`);let u=a.parse(o[2],2,me);if(!u)return null;if(!p_(s,u.type))return a.concat(2).error(`"${s}" comparisons are not supported for type '${nt(u.type)}'.`);if(l.type.kind!==u.type.kind&&l.type.kind!=="value"&&u.type.kind!=="value")return a.error(`Cannot compare types '${nt(l.type)}' and '${nt(u.type)}'.`);n&&(l.type.kind==="value"&&u.type.kind!=="value"?l=new Xr(u.type,[l]):l.type.kind!=="value"&&u.type.kind==="value"&&(u=new Xr(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,Rc),!c)return null}return new U_(l,u,c)}evaluate(o){let a=this.lhs.evaluate(o),s=this.rhs.evaluate(o);if(n&&this.hasUntypedArgument){let l=ct(a),u=ct(s);if(l.kind!==u.kind||!(l.kind==="string"||l.kind==="number"))throw new Ke(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${l.kind}, ${u.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){let l=ct(a),u=ct(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 OD=Yo("==",SD,V_),BD=Yo("!=",CD,LD),zD=Yo("<",MD,DD),VD=Yo(">",ID,RD),UD=Yo("<=",AD,kD),ND=Yo(">=",ED,FD),Tc=class t{constructor(e,r,n){this.type=Rc,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 ys(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}},Pd=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}},bs=class t{constructor(e){this.type=qo,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,dr(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"&&!xD.includes(s["vertical-align"]))return r.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${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 ct(i)===Is?new gs("",i,null,null,null,n.verticalAlign?n.verticalAlign.evaluate(e):null):new gs(fs(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 yr(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}},wd=class t{constructor(e){this.type=Is,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=Jt.fromString(r);return n&&e.availableImages&&(n.available=e.availableImages.indexOf(r)>-1),n}eachChild(e){e(this.input)}outputDefined(){return!1}},Td=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 ${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 ${nt(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 Ke(`Expected value to be of type string or array, but found ${nt(ct(r))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}},on=8192;function GD(t,e){let r=jD(t[0]),n=XD(t[1]),i=Math.pow(2,e.z);return[Math.round(r*i*on),Math.round(n*i*on)]}function kd(t,e){let r=Math.pow(2,e.z),n=(t[0]/on+e.x)/r,i=(t[1]/on+e.y)/r;return[HD(n),ZD(i)]}function jD(t){return(180+t)/360}function HD(t){return t*360-180}function XD(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function ZD(t){return 360/Math.PI*Math.atan(Math.exp((180-t*360)*Math.PI/180))-90}function As(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 _s(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function qD(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 YD(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 zc(t,e,r,n){let i=[e[0]-t[0],e[1]-t[1]],o=[n[0]-r[0],n[1]-r[1]];return JD(o,i)===0?!1:!!(h_(t,e,r,n)&&h_(r,n,t,e))}function WD(t,e,r){for(let n of r)for(let i=0;i<n.length-1;++i)if(zc(t,e,n[i],n[i+1]))return!0;return!1}function Wo(t,e,r=!1){let n=!1;for(let i of e)for(let o=0;o<i.length-1;o++){if(YD(t,i[o],i[o+1]))return r;qD(t,i[o],i[o+1])&&(n=!n)}return n}function $D(t,e){for(let r of e)if(Wo(t,r))return!0;return!1}function N_(t,e){for(let r of t)if(!Wo(r,e))return!1;for(let r=0;r<t.length-1;++r)if(WD(t[r],t[r+1],e))return!1;return!0}function KD(t,e){for(let r of e)if(N_(t,r))return!0;return!1}function JD(t,e){return t[0]*e[1]-t[1]*e[0]}function h_(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 Fd(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=GD(t[i][a],r);As(e,s),o.push(s)}n.push(o)}return n}function G_(t,e,r){let n=[];for(let i=0;i<t.length;i++){let o=Fd(t[i],e,r);n.push(o)}return n}function j_(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}As(e,t)}function QD(t){t[0]=t[1]=1/0,t[2]=t[3]=-1/0}function f_(t,e,r,n){let i=Math.pow(2,n.z)*on,o=[n.x*on,n.y*on],a=[];for(let s of t)for(let l of s){let u=[l.x+o[0],l.y+o[1]];j_(u,e,r,i),a.push(u)}return a}function m_(t,e,r,n){let i=Math.pow(2,n.z)*on,o=[n.x*on,n.y*on],a=[];for(let s of t){let l=[];for(let u of s){let c=[u.x+o[0],u.y+o[1]];As(e,c),l.push(c)}a.push(l)}if(e[2]-e[0]<=i/2){QD(e);for(let s of a)for(let l of s)j_(l,e,r,i)}return a}function eR(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=Fd(e.coordinates,n,i),a=f_(t.geometry(),r,n,i);if(!_s(r,n))return!1;for(let s of a)if(!Wo(s,o))return!1}if(e.type==="MultiPolygon"){let o=G_(e.coordinates,n,i),a=f_(t.geometry(),r,n,i);if(!_s(r,n))return!1;for(let s of a)if(!$D(s,o))return!1}return!0}function tR(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=Fd(e.coordinates,n,i),a=m_(t.geometry(),r,n,i);if(!_s(r,n))return!1;for(let s of a)if(!N_(s,o))return!1}if(e.type==="MultiPolygon"){let o=G_(e.coordinates,n,i),a=m_(t.geometry(),r,n,i);if(!_s(r,n))return!1;for(let s of a)if(!KD(s,o))return!1}return!0}var vs=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 ${e.length-1} instead.`);if(xs(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 eR(e,this.geometries);if(e.geometryType()==="LineString")return tR(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}},Sc=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 H_(t,e,r=0,n=t.length-1,i=rR){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));H_(t,e,f,d,i)}let o=t[e],a=r,s=n;for(ps(t,r,e),i(t[n],o)>0&&ps(t,r,n);a<s;){for(ps(t,a,s),a++,s--;i(t[a],o)<0;)a++;for(;i(t[s],o)>0;)s--}i(t[r],o)===0?ps(t,r,s):(s++,ps(t,s,n)),s<=e&&(r=s+1),e<=s&&(n=s-1)}}function ps(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}function rR(t,e){return t<e?-1:t>e?1:0}function Es(t,e){if(t.length<=1)return[t];let n=[],i,o;for(let a of t){let s=iR(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||(H_(n[a],e,1,n[a].length-1,nR),n[a]=n[a].slice(0,e));return n}function nR(t,e){return e.area-t.area}function iR(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 oR=6378.137,d_=1/298.257223563,y_=d_*(2-d_),g_=Math.PI/180,Ps=class{constructor(e){let r=g_*oR*1e3,n=Math.cos(e*g_),i=1/(1-y_*(1-n*n)),o=Math.sqrt(i);this.kx=r*o*n,this.ky=r*o*i*(1-y_)}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}},Sd=100,Cd=50;function X_(t,e){return e[0]-t[0]}function Cc(t){return t[1]-t[0]+1}function Sn(t,e){return t[1]>=t[0]&&t[1]<e}function Md(t,e){if(t[0]>t[1])return[null,null];let r=Cc(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 Id(t,e){if(!Sn(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)As(r,t[n]);return r}function Ad(t){let e=[1/0,1/0,-1/0,-1/0];for(let r of t)for(let n of r)As(e,n);return e}function x_(t){return t[0]!==-1/0&&t[1]!==-1/0&&t[2]!==1/0&&t[3]!==1/0}function Od(t,e,r){if(!x_(t)||!x_(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 Zi(t,e,r){let n=r.pointOnLine(e,t);return r.distance(t,n.point)}function Bd(t,e,r,n,i){let o=Math.min(Zi(t,[r,n],i),Zi(e,[r,n],i)),a=Math.min(Zi(r,[t,e],i),Zi(n,[t,e],i));return Math.min(o,a)}function aR(t,e,r,n,i){if(!(Sn(e,t.length)&&Sn(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(zc(l,u,p,h))return 0;a=Math.min(a,Bd(l,u,p,h,i))}}return a}function sR(t,e,r,n,i){if(!(Sn(e,t.length)&&Sn(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 lR(t,e,r){if(Wo(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,Zi(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 uR(t,e,r,n){if(!Sn(e,t.length))return NaN;for(let o=e[0];o<=e[1];++o)if(Wo(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(zc(a,s,h,f))return 0;i=Math.min(i,Bd(a,s,h,f,n))}}return i}function b_(t,e){for(let r of t)for(let n of r)if(Wo(n,e,!0))return!0;return!1}function cR(t,e,r,n=1/0){let i=Ad(t),o=Ad(e);if(n!==1/0&&Od(i,o,r)>=n)return n;if(_s(i,o)){if(b_(t,e))return 0}else if(b_(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(zc(p,h,b,v))return 0;a=Math.min(a,Bd(p,h,b,v,r))}}return a}function __(t,e,r,n,i,o){if(!o)return;let a=Od(Id(n,o),i,r);a<e&&t.push([a,o,[0,0]])}function yc(t,e,r,n,i,o,a){if(!o||!a)return;let s=Od(Id(n,o),Id(i,a),r);s<e&&t.push([s,o,a])}function Mc(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 Sc([[0,[0,t.length-1],[0,0]]],X_),s=Ad(r);for(;a.length>0;){let l=a.pop();if(l[0]>=o)continue;let u=l[1],c=e?Cd:Sd;if(Cc(u)<=c){if(!Sn(u,t.length))return NaN;if(e){let p=uR(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=lR(t[p],r,n);if(o=Math.min(o,h),o===0)return 0}}else{let p=Md(u,e);__(a,o,n,t,s,p[0]),__(a,o,n,t,s,p[1])}}return o}function Ic(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 Sc([[0,[0,t.length-1],[0,r.length-1]]],X_);for(;s.length>0;){let l=s.pop();if(l[0]>=a)continue;let u=l[1],c=l[2],p=e?Cd:Sd,h=n?Cd:Sd;if(Cc(u)<=p&&Cc(c)<=h){if(!Sn(u,t.length)&&Sn(c,r.length))return NaN;let f;if(e&&n)f=aR(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=Zi(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=Zi(t[g],d,i),a=Math.min(a,f),a===0)return a}else f=sR(t,u,r,c,i),a=Math.min(a,f)}else{let f=Md(u,e),d=Md(c,n);yc(s,a,i,t,r,f[0],d[0]),yc(s,a,i,t,r,f[0],d[1]),yc(s,a,i,t,r,f[1],d[0]),yc(s,a,i,t,r,f[1],d[1])}}return a}function pR(t,e){let r=t.geometry(),n=r.flat().map(a=>kd([a.x,a.y],t.canonical));if(r.length===0)return NaN;let i=new Ps(n[0][1]),o=1/0;for(let a of e){switch(a.type){case"Point":o=Math.min(o,Ic(n,!1,[a.coordinates],!1,i,o));break;case"LineString":o=Math.min(o,Ic(n,!1,a.coordinates,!0,i,o));break;case"Polygon":o=Math.min(o,Mc(n,!1,a.coordinates,i,o));break}if(o===0)return o}return o}function hR(t,e){let r=t.geometry(),n=r.flat().map(a=>kd([a.x,a.y],t.canonical));if(r.length===0)return NaN;let i=new Ps(n[0][1]),o=1/0;for(let a of e){switch(a.type){case"Point":o=Math.min(o,Ic(n,!0,[a.coordinates],!1,i,o));break;case"LineString":o=Math.min(o,Ic(n,!0,a.coordinates,!0,i,o));break;case"Polygon":o=Math.min(o,Mc(n,!0,a.coordinates,i,o));break}if(o===0)return o}return o}function fR(t,e){let r=t.geometry();if(r.length===0||r[0].length===0)return NaN;let n=Es(r,0).map(a=>a.map(s=>s.map(l=>kd([l.x,l.y],t.canonical)))),i=new Ps(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,Mc([a.coordinates],!1,s,i,o));break;case"LineString":o=Math.min(o,Mc(a.coordinates,!0,s,i,o));break;case"Polygon":o=Math.min(o,cR(s,a.coordinates,i,o));break}if(o===0)return o}return o}function hd(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 ws=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 ${e.length-1} instead.`);if(xs(e[1])){let n=e[1];if(n.type==="FeatureCollection")return new t(n,n.features.map(i=>hd(i.geometry)).flat());if(n.type==="Feature")return new t(n,hd(n.geometry));if("type"in n&&"coordinates"in n)return new t(n,hd(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 pR(e,this.geometries);if(e.geometryType()==="LineString")return hR(e,this.geometries);if(e.geometryType()==="Polygon")return fR(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}},Ts=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 ${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 ${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:hs(n,this.key)}eachChild(){}outputDefined(){return!1}},Ji={"==":OD,"!=":BD,">":VD,"<":zD,">=":ND,"<=":UD,array:Xr,at:yd,boolean:Xr,case:_d,coalesce:wc,collator:Tc,format:bs,image:wd,in:gd,"index-of":xd,interpolate:jt,"interpolate-hcl":jt,"interpolate-lab":jt,length:Td,let:vc,literal:ti,match:bd,number:Xr,"number-format":Pd,object:Xr,slice:vd,step:Ho,string:Xr,"to-boolean":Qn,"to-color":Qn,"to-number":Qn,"to-string":Qn,var:Pc,within:vs,distance:ws,"global-state":Ts},ln=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 "${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 _c(r.registry,Ac,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 ${u.length} arguments, but found ${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])=>dR(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(nt(f.type))}r.error(`Expected arguments of type ${c}, but found (${p.join(", ")}) instead.`)}return null}static register(e,r){t.definitions=r;for(let n in r)e[n]=t}};function v_(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=z_(e,r,n,o);if(a)throw new Ke(a);return new K(e/255,r/255,n/255,o,!1)}function P_(t,e){return t in e}function fd(t,e){let r=e[t];return typeof r>"u"?null:r}function mR(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 Xi(t){return{type:t}}ln.register(Ji,{error:[aD,[Pe],(t,[e])=>{throw new Ke(e.evaluate(t))}],typeof:[Pe,[me],(t,[e])=>nt(ct(e.evaluate(t)))],"to-rgba":[dr(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],v_],rgba:[Br,[Y,Y,Y,Y],v_],has:{type:ge,overloads:[[[Pe],(t,[e])=>P_(e.evaluate(t),t.properties())],[[Pe,qi],(t,[e,r])=>P_(e.evaluate(t),r.evaluate(t))]]},get:{type:me,overloads:[[[Pe],(t,[e])=>fd(e.evaluate(t),t.properties())],[[Pe,qi],(t,[e,r])=>fd(e.evaluate(t),r.evaluate(t))]]},"feature-state":[me,[Pe],(t,[e])=>fd(e.evaluate(t),t.featureState||{})],properties:[qi,[],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,Xi(Y),(t,e)=>{let r=0;for(let n of e)r+=n.evaluate(t);return r}],"*":[Y,Xi(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,Xi(Y),(t,e)=>Math.min(...e.map(r=>r.evaluate(t)))],max:[Y,Xi(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,[dr(Pe)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[ge,[dr(me)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[ge,[Pe,dr(me)],(t,[e,r])=>r.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[ge,[Pe,dr(me)],(t,[e,r])=>mR(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)],[Xi(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)],[Xi(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,Xi(me),(t,e)=>e.map(r=>fs(r.evaluate(t))).join("")],"resolved-locale":[Pe,[Rc],(t,[e])=>e.evaluate(t).resolvedLocale()]});function dR(t){return Array.isArray(t)?`(${t.map(nt).join(", ")})`:`(${nt(t.type)}...)`}function Ac(t){if(t instanceof Pc)return Ac(t.boundExpression);if(t instanceof ln&&t.name==="error")return!1;if(t instanceof Tc)return!1;if(t instanceof vs)return!1;if(t instanceof ws)return!1;if(t instanceof Ts)return!1;let e=t instanceof Qn||t instanceof Xr,r=!0;return t.eachChild(n=>{e?r=r&&Ac(n):r=r&&n instanceof ti}),r?Vc(t)&&Uc(t,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"]):!1}function Vc(t){if(t instanceof ln){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 vs||t instanceof ws)return!1;let e=!0;return t.eachChild(r=>{e&&!Vc(r)&&(e=!1)}),e}function Ss(t){if(t instanceof ln&&t.name==="feature-state")return!1;let e=!0;return t.eachChild(r=>{e&&!Ss(r)&&(e=!1)}),e}function Uc(t,e){if(t instanceof ln&&e.indexOf(t.name)>=0)return!1;let r=!0;return t.eachChild(n=>{r&&!Uc(n,e)&&(r=!1)}),r}function Ed(t){return{result:"success",value:t}}function Uo(t){return{result:"error",value:t}}function ri(t){return t["property-type"]==="data-driven"||t["property-type"]==="cross-faded-data-driven"}function Z_(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function zd(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 Nc(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)&&ct(t)===qi}function yR(t){return t}function gR(t){switch(t.type){case"color":return K.parse;case"padding":return zr.parse;case"numberArray":return Vr.parse;case"colorArray":return Kt.parse;default:return null}}function xR(t){switch(t){case"exponential":return Y_;case"interval":return _R;case"categorical":return bR;case"identity":return vR;default:throw new Error(`Unknown function type "${t}"`)}}function q_(t,e){let r=t.stops&&typeof t.stops[0][0]=="object",n=r||t.property!==void 0,i=r||!n,o=t.type||(zd(e)?"exponential":"interval"),a=gR(e);if(a&&(t=Go({},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&&!gD(t.colorSpace))throw new Error(`Unknown color space: "${t.colorSpace}"`);let s=xR(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,q_(c[d],e)]);let f={name:"linear"};return{kind:"composite",interpolationType:f,interpolationFactor:jt.interpolationFactor.bind(void 0,f),zoomStops:h.map(d=>d[0]),evaluate({zoom:d},g){return Y_({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:jt.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?Ls(t.default,e.default):s(t,e,h,l,u)}}}function Ls(t,e,r){if(t!==void 0)return t;if(e!==void 0)return e;if(r!==void 0)return r}function bR(t,e,r,n,i){let o=typeof r===i?n[r]:void 0;return Ls(o,t.default,e.default)}function _R(t,e,r){if(we(r)!=="number")return Ls(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=Bc(t.stops.map(o=>o[0]),r);return t.stops[i][1]}function Y_(t,e,r){let n=t.base!==void 0?t.base:1;if(we(r)!=="number")return Ls(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=Bc(t.stops.map(c=>c[0]),r),a=PR(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]||yR;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 vR(t,e,r){switch(e.type){case"color":r=K.parse(r);break;case"formatted":r=yr.fromString(r.toString());break;case"resolvedImage":r=Jt.fromString(r.toString());break;case"padding":r=zr.parse(r);break;case"colorArray":r=Kt.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 Ls(r,t.default,e.default)}function PR(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 Wi=class{constructor(e,r){this.expression=e,this._warningHistory={},this._evaluator=new bc,this._defaultValue=r?TR(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 Ke(`Expected value to be one of ${Object.keys(this._enumValues).map(l=>JSON.stringify(l)).join(", ")}, but found ${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 Ds(t){return Array.isArray(t)&&t.length>0&&typeof t[0]=="string"&&t[0]in Ji}function Vd(t,e){let r=new _c(Ji,Ac,[],e?wR(e):void 0),n=r.parse(t,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return n?Ed(new Wi(n,e)):Uo(r.errors)}var un=class{constructor(e,r){this.kind=e,this._styleExpression=r,this.isStateDependent=e!=="constant"&&!Ss(r.expression),this.globalStateRefs=Gc(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)}},ni=class{constructor(e,r,n,i){this.kind=e,this.zoomStops=n,this._styleExpression=r,this.isStateDependent=e!=="camera"&&!Ss(r.expression),this.globalStateRefs=Gc(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?jt.interpolationFactor(this.interpolationType,e,r,n):0}};function W_(t){return t._styleExpression!==void 0}function $_(t,e){let r=Vd(t,e);if(r.result==="error")return r;let n=r.value.expression,i=Vc(n);if(!i&&!ri(e))return Uo([new Fr("","data expressions not supported")]);let o=Uc(n,["zoom"]);if(!o&&!Z_(e))return Uo([new Fr("","zoom expressions not supported")]);let a=xc(n);if(!a&&!o)return Uo([new Fr("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(a instanceof Fr)return Uo([a]);if(a instanceof jt&&!zd(e))return Uo([new Fr("",'"interpolate" expressions cannot be used with this property')]);if(!a)return Ed(i?new un("constant",r.value):new un("source",r.value));let s=a instanceof jt?a.interpolation:void 0;return Ed(i?new ni("camera",r.value,a.labels,s):new ni("composite",r.value,a.labels,s))}var Cs=class t{constructor(e,r){this._parameters=e,this._specification=r,Go(this,q_(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 K_(t,e){if(Nc(t))return new Cs(t,e);if(Ds(t)){let r=$_(t,e);if(r.result==="error")throw new Error(r.value.map(n=>`${n.key}: ${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=Kt.parse(t):e.type==="variableAnchorOffsetCollection"&&Array.isArray(t)?r=an.parse(t):e.type==="projectionDefinition"&&typeof t=="string"&&(r=sn.parse(t)),{globalStateRefs:new Set,kind:"constant",evaluate:()=>r}}}function xc(t){let e=null;if(t instanceof vc)e=xc(t.result);else if(t instanceof wc){for(let r of t.args)if(e=xc(r),e)break}else(t instanceof Ho||t instanceof jt)&&t.input instanceof ln&&t.input.name==="zoom"&&(e=t);return e instanceof Fr||t.eachChild(r=>{let n=xc(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 Gc(t,e=new Set){return t instanceof Ts&&e.add(t.key),t.eachChild(r=>{Gc(r,e)}),e}function wR(t){let e={color:Br,string:Pe,number:Y,enum:Pe,boolean:ge,formatted:qo,padding:kc,numberArray:Fc,colorArray:ms,projectionDefinition:Dc,resolvedImage:Is,variableAnchorOffsetCollection:Oc};return t.type==="array"?dr(e[t.value]||me,t.length):e[t.type]}function TR(t){if(t.type==="color"&&Nc(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 Kt.parse(t.default)||null;case"variableAnchorOffsetCollection":return an.parse(t.default)||null;case"projectionDefinition":return sn.parse(t.default)||null;default:return t.default===void 0?null:t.default}}function Ud(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(!Ud(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}var SR={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function ii(t){if(t==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};Ud(t)||(t=Ec(t));let e=Vd(t,SR);if(e.result==="error")throw new Error(e.value.map(r=>`${r.key}: ${r.message}`).join(", "));{let r=J_(t);return{filter:(n,i,o)=>e.value.evaluate(n,i,{},o),needGeometry:r,getGlobalStateRefs:()=>Gc(e.value.expression)}}}function CR(t,e){return t<e?-1:t>e?1:0}function J_(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(J_(t[e]))return!0;return!1}function Ec(t){if(!t)return!0;let e=t[0];return t.length<=1?e!=="any":e==="=="?md(t[1],t[2],"=="):e==="!="?gc(md(t[1],t[2],"==")):e==="<"||e===">"||e==="<="||e===">="?md(t[1],t[2],e):e==="any"?MR(t.slice(1)):e==="all"?["all"].concat(t.slice(1).map(Ec)):e==="none"?["all"].concat(t.slice(1).map(Ec).map(gc)):e==="in"?w_(t[1],t.slice(2)):e==="!in"?gc(w_(t[1],t.slice(2))):e==="has"?T_(t[1]):e==="!has"?gc(T_(t[1])):!0}function md(t,e,r){switch(t){case"$type":return[`filter-type-${r}`,e];case"$id":return[`filter-id-${r}`,e];default:return[`filter-${r}`,t,e]}}function MR(t){return["any"].concat(t.map(Ec))}function w_(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(CR)]]:["filter-in-small",t,["literal",e]]}}function T_(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function gc(t){return["!",t]}function Q_(){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 ev(t){let e=t.key,r=t.value;return r?[new G(e,r,"constants have been deprecated as of v8")]:[]}function ut(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function $i(t){if(Array.isArray(t))return t.map($i);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){let e={};for(let r in t)e[r]=$i(t[r]);return e}return ut(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, ${u} found`)];for(let c in r){let p=c.split(".")[0],h=hs(n,p)||n["*"],f;if(hs(i,p))f=i[p];else if(hs(n,p))f=s;else if(i["*"])f=i["*"];else if(n["*"])f=s;else{l.push(new G(e,r[c],`unknown property "${c}"`));continue}l=l.concat(f({key:(e&&`${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 "${c}"`));return l}function Nd(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, ${we(e)} found`)];if(r.length&&e.length!==r.length)return[new G(a,e,`array length ${r.length} expected, length ${e.length} found`)];if(r["min-length"]&&e.length<r["min-length"])return[new G(a,e,`array length at least ${r["min-length"]} expected, length ${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:`${a}[${c}]`}));return u}function jc(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, ${i} found`)]:"minimum"in n&&r<n.minimum?[new G(e,r,`${r} is less than the minimum value ${n.minimum}`)]:"maximum"in n&&r>n.maximum?[new G(e,r,`${r} is greater than the maximum value ${n.maximum}`)]:[]}function tv(t){let e=t.valueSpec,r=ut(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&&!zd(t.valueSpec)&&c.push(new G(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!ri(t.valueSpec)?c.push(new G(t.key,t.value,"property functions not supported")):s&&!Z_(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(Nd({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, ${we(b)} found`)];if(b.length!==2)return[new G(v,b,`array length 2 expected, length ${b.length} found`)];if(u){if(we(b[0])!=="object")return[new G(v,b,`object expected, ${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>ut(b[0].zoom))return[new G(v,b[0].zoom,"stop zoom values must appear in ascending order")];ut(b[0].zoom)!==a&&(a=ut(b[0].zoom),o=void 0,i={}),x=x.concat(Or({key:`${v}[0]`,value:b[0],valueSpec:{zoom:{}},validateSpec:g.validateSpec,style:g.style,styleSpec:g.styleSpec,objectElementValidators:{zoom:jc,value:f}}))}else x=x.concat(f({key:`${v}[0]`,value:b[0],validateSpec:g.validateSpec,style:g.style,styleSpec:g.styleSpec},b));return Ds($i(b[1]))?x.concat([new G(`${v}[1]`,b[1],"expressions are not allowed in function stops.")]):x.concat(g.validateSpec({key:`${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=ut(g.value),P=g.value!==null?g.value:x;if(!n)n=b;else if(b!==n)return[new G(g.key,P,`${b} stop domain type must match previous stop domain type ${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, ${b} found`;return ri(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 ${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 Xo(t){let e=(t.expressionContext==="property"?$_:Vd)($i(t.value),t.valueSpec);if(e.result==="error")return e.value.map(n=>new G(`${t.key}${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 "${t.propertyKey}". Output values must be contained as literals within the expression.`)];if(t.expressionContext==="property"&&t.propertyType==="layout"&&!Ss(r))return[new G(t.key,t.value,'"feature-state" data expressions are not supported with layout properties.')];if(t.expressionContext==="filter"&&!Ss(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(!Uc(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"&&!Vc(r))return[new G(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function IR(t){let e=t.value,r=t.key,n=we(e);return n!=="boolean"?[new G(r,e,`boolean expected, ${n} found`)]:[]}function Ld(t){let e=t.key,r=t.value,n=we(r);return n!=="string"?[new G(e,r,`color expected, ${n} found`)]:K.parse(String(r))?[]:[new G(e,r,`color expected, "${r}" found`)]}function Ms(t){let e=t.key,r=t.value,n=t.valueSpec,i=[];return Array.isArray(n.values)?n.values.indexOf(ut(r))===-1&&i.push(new G(e,r,`expected one of [${n.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(n.values).indexOf(ut(r))===-1&&i.push(new G(e,r,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(r)} found`)),i}function Gd(t){return Ud($i(t.value))?Xo(Go({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):rv(t)}function rv(t){let e=t.value,r=t.key;if(we(e)!=="array")return[new G(r,e,`array expected, ${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(Ms({key:`${r}[0]`,value:e[0],valueSpec:n.filter_operator,style:t.style,styleSpec:t.styleSpec})),ut(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&ut(e[1])==="$type"&&o.push(new G(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&o.push(new G(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(i=we(e[1]),i!=="string"&&o.push(new G(`${r}[1]`,e[1],`string expected, ${i} found`)));for(let a=2;a<e.length;a++)i=we(e[a]),ut(e[1])==="$type"?o=o.concat(Ms({key:`${r}[${a}]`,value:e[a],valueSpec:n.geometry_type,style:t.style,styleSpec:t.styleSpec})):i!=="string"&&i!=="number"&&i!=="boolean"&&o.push(new G(`${r}[${a}]`,e[a],`string, number, or boolean expected, ${i} found`));break;case"any":case"all":case"none":for(let a=1;a<e.length;a++)o=o.concat(rv({key:`${r}[${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 "${e[0]}" operator must have 2 elements`)):i!=="string"&&o.push(new G(`${r}[1]`,e[1],`string expected, ${i} found`));break}return o}function nv(t,e){let r=t.key,n=t.validateSpec,i=t.style,o=t.styleSpec,a=t.value,s=t.objectKey,l=o[`${e}_${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 "${s}"`)];let p;if(we(a)==="string"&&ri(c)&&!c.tokens&&(p=/^{([^}]+)}$/.exec(a)))return[new G(r,a,`"${s}" does not support interpolation syntax
3
- Use an identity property function instead: \`{ "type": "identity", "property": ${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"&&Nc($i(a))&&ut(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 iv(t){return nv(t,"paint")}function ov(t){return nv(t,"layout")}function av(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, ${we(r)} found`)];!r.type&&!r.ref&&e.push(new G(n,r,'either "type" or "ref" is required'));let a=ut(r.type),s=ut(r.ref);if(r.id){let l=ut(r.id);for(let u=0;u<t.arrayIndex;u++){let c=i.layers[u];ut(c.id)===l&&e.push(new G(n,r.id,`duplicate layer id "${r.id}", previously used at line ${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],`"${u}" is prohibited for ref layers`))});let l;i.layers.forEach(u=>{ut(u.id)===s&&(l=u)}),l?l.ref?e.push(new G(n,r.ref,"ref cannot reference another ref layer")):a=ut(l.type):e.push(new G(n,r.ref,`ref layer "${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&&ut(l.type);l?u==="vector"&&a==="raster"?e.push(new G(n,r.source,`layer "${r.id}" requires a raster source`)):u!=="raster-dem"&&a==="hillshade"?e.push(new G(n,r.source,`layer "${r.id}" requires a raster-dem source`)):u!=="raster-dem"&&a==="color-relief"?e.push(new G(n,r.source,`layer "${r.id}" requires a raster-dem source`)):u==="raster"&&a!=="raster"?e.push(new G(n,r.source,`layer "${r.id}" requires a vector source`)):u==="vector"&&!r["source-layer"]?e.push(new G(n,r,`layer "${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 "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new G(n,r.source,`source "${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:`${n}.type`,value:r.type,valueSpec:o.layer.type,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,object:r,objectKey:"type"})},filter:Gd,layout(l){return Or({layer:r,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return ov(Go({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 iv(Go({layerType:a},u))}}})}}})),e}function Ki(t){let e=t.value,r=t.key,n=we(e);return n!=="string"?[new G(r,e,`string expected, ${n} found`)]:[]}function AR(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, ${l} found`)),s;let c=ut(n.encoding)==="custom",p=["redFactor","greenFactor","blueFactor","baseShift"],h=t.value.encoding?`"${t.value.encoding}"`:"Default";for(let f in n)!c&&p.includes(f)?s.push(new G(f,n[f],`In "${r}": "${f}" is only valid when "encoding" is set to "custom". ${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 "${f}"`));return s}var S_={promoteId:ER};function sv(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=ut(e.type),s;switch(a){case"vector":case"raster":return s=Or({key:r,value:e,valueSpec:n[`source_${a.replace("-","_")}`],style:t.style,styleSpec:n,objectElementValidators:S_,validateSpec:o}),s;case"raster-dem":return s=AR({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:S_}),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(...Xo({key:`${r}.${l}.map`,value:c,expressionContext:"cluster-map"})),s.push(...Xo({key:`${r}.${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 Ms({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function ER({key:t,value:e}){if(we(e)==="string")return Ki({key:t,value:e});{let r=[];for(let n in e)r.push(...Ki({key:`${t}.${n}`,value:e[n]}));return r}}function lv(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, ${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 "${s}"`)])}return o}function uv(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, ${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 "${s}"`)]);return a}function cv(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, ${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 "${s}"`)]);return o}function LR(t){return Ki(t).length===0?[]:Xo(t)}function DR(t){return Ki(t).length===0?[]:Xo(t)}function RR(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; ${r.length} values found`)];let i={type:"number"},o=[];for(let a=0;a<r.length;a++)o=o.concat(t.validateSpec({key:`${e}[${a}]`,value:r[a],validateSpec:t.validateSpec,valueSpec:i}));return o}else return jc({key:e,value:r,valueSpec:{}})}function kR(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:`${e}[${a}]`,value:r[a],validateSpec:t.validateSpec,valueSpec:i}));return o}else return jc({key:e,value:r,valueSpec:{}})}function FR(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(Ld({key:`${e}[${o}]`,value:r[o]}));return i}else return Ld({key:e,value:r})}function OR(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(Ms({key:`${e}[${a}]`,value:r[a],valueSpec:i.layout_symbol["text-anchor"]})),o=o.concat(Nd({key:`${e}[${a+1}]`,value:r[a+1],valueSpec:{length:2,value:"number"},validateSpec:t.validateSpec,style:t.style,styleSpec:i}));return o}function pv(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 ${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 ${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:`${n}[${a}]`,value:r[a],valueSpec:s,validateSpec:t.validateSpec}))}return e}else return Ki({key:n,value:r})}function BR(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, ${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 "${s}"`)]);return a}function zR(t){let e=t.key,r=t.value;r=r instanceof String?r.valueOf():r;let n=we(r);return n==="array"&&!UR(r)&&!VR(r)?[new G(e,r,`projection expected, invalid array ${JSON.stringify(r)} found`)]:["array","string"].includes(n)?[]:[new G(e,r,`projection expected, invalid type "${n}" found`)]}function VR(t){return!!["interpolate","step","literal"].includes(t[0])}function UR(t){return Array.isArray(t)&&t.length===3&&typeof t[0]=="string"&&typeof t[1]=="string"&&typeof t[2]=="number"}function NR(t){return!!t&&t.constructor===Object}function hv(t){return NR(t.value)?[]:[new G(t.key,t.value,`object expected, ${we(t.value)} found`)]}var C_={"*"(){return[]},array:Nd,boolean:IR,number:jc,color:Ld,constants:ev,enum:Ms,filter:Gd,function:tv,layer:av,object:Or,source:sv,light:lv,sky:uv,terrain:cv,projection:BR,projectionDefinition:zR,string:Ki,formatted:LR,resolvedImage:DR,padding:RR,numberArray:kR,colorArray:FR,variableAnchorOffsetCollection:OR,sprite:pv,state:hv};function Lc(t){let e=t.value,r=t.valueSpec,n=t.styleSpec;return t.validateSpec=Lc,r.expression&&Nc(ut(e))?tv(t):r.expression&&Ds($i(e))?Xo(t):r.type&&C_[r.type]?C_[r.type](t):Or(Go({},t,{valueSpec:r.type?n[r.type]:r}))}function fv(t){let e=t.value,r=t.key,n=Ki(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 gr(t,e=D){let r=[];return r=r.concat(Lc({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,validateSpec:Lc,objectElementValidators:{glyphs:fv,"*"(){return[]}}})),t.constants&&(r=r.concat(ev({key:"constants",value:t.constants}))),mv(r)}gr.source=qr(Zr(sv));gr.sprite=qr(Zr(pv));gr.glyphs=qr(Zr(fv));gr.light=qr(Zr(lv));gr.sky=qr(Zr(uv));gr.terrain=qr(Zr(cv));gr.state=qr(Zr(hv));gr.layer=qr(Zr(av));gr.filter=qr(Zr(Gd));gr.paintProperty=qr(Zr(iv));gr.layoutProperty=qr(Zr(ov));function Zr(t){return function(e){return t({...e,validateSpec:Lc})}}function mv(t){return[].concat(t).sort((e,r)=>e.line-r.line)}function qr(t){return function(...e){return mv(t.apply(this,e))}}m();var Je=gr,N6=Je.source,dv=Je.light,yv=Je.sky,G6=Je.terrain,j6=Je.filter,gv=Je.paintProperty,xv=Je.layoutProperty;function oi(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 Qi=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 Cn={};function X(t,e,r={}){if(Cn[t])throw new Error(`${t} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),Cn[t]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}X("Object",Object);X("Set",Set);X("TransferableGridIndex",Qi);X("Color",K);X("Error",Error);X("AJAXError",$n);X("ResolvedImage",Jt);X("StylePropertyFunction",Cs);X("StyleExpression",Wi,{omit:["_evaluator"]});X("ZoomDependentExpression",ni);X("ZoomConstantExpression",un);X("CompoundExpression",ln,{omit:["_evaluate"]});for(let t in Ji)Ji[t]._classRegistryKey||X(`Expression_${t}`,Ji[t]);function bv(t){return t&&typeof ArrayBuffer<"u"&&(t instanceof ArrayBuffer||t.constructor&&t.constructor.name==="ArrayBuffer")}function jd(t){let e=t.constructor;return t.$name||e._classRegistryKey}function GR(t){if(t===null||typeof t!="object")return!1;let e=jd(t);return!!(e&&e!=="Object")}function _v(t){return!GR(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||bv(t)||Wt(t)||ArrayBuffer.isView(t)||t instanceof ImageData)}function $o(t,e){if(_v(t)){if((bv(t)||Wt(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($o(a,e));return o}if(typeof t!="object")throw new Error(`can't serialize object of type ${typeof t}`);let r=jd(t);if(!r)throw new Error(`can't serialize object of unregistered class ${t.constructor.name}`);if(!Cn[r])throw new Error(`${r} is not registered.`);let{klass:n}=Cn[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)||Cn[r].omit.indexOf(o)>=0)continue;let a=t[o];i[o]=Cn[r].shallow.indexOf(o)>=0?a:$o(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 Ko(t){if(_v(t))return t;if(Array.isArray(t))return t.map(Ko);if(typeof t!="object")throw new Error(`can't deserialize object of type ${typeof t}`);let e=jd(t)||"Object";if(!Cn[e])throw new Error(`can't deserialize unregistered class ${e}`);let{klass:r}=Cn[e];if(!r)throw new Error(`can't deserialize unregistered class ${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]=Cn[e].shallow.indexOf(i)>=0?o:Ko(o)}return n}m();m();var eo=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 ht={"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 Hd(t){for(let e of t)if(vv(e.charCodeAt(0)))return!0;return!1}function Xd(t){let e=t.map(r=>{try{return new RegExp(`\\p{sc=${r}}`,"u").source}catch{return null}}).filter(r=>r);return new RegExp(e.join("|"),"u")}var jR=["Arab","Dupl","Mong","Ougr","Syrc"],oG=Xd(jR);var HR=["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"],XR=Xd(HR);function vv(t){return t===746||t===747?!0:t<4352?!1:!!(ht["CJK Compatibility Forms"](t)&&!(t>=65097&&t<=65103)||ht["CJK Compatibility"](t)||ht["CJK Strokes"](t)||ht["CJK Symbols and Punctuation"](t)&&!(t>=12296&&t<=12305)&&!(t>=12308&&t<=12319)&&t!==12336||ht["Enclosed CJK Letters and Months"](t)||ht["Ideographic Description Characters"](t)||ht.Kanbun(t)||ht.Katakana(t)&&t!==12540||ht["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)||ht["Small Form Variants"](t)&&!(t>=65112&&t<=65118)&&!(t>=65123&&t<=65126)||ht["Vertical Forms"](t)||ht["Yijing Hexagram Symbols"](t)||/\p{sc=Cans}/u.test(String.fromCodePoint(t))||/\p{sc=Hang}/u.test(String.fromCodePoint(t))||XR.test(String.fromCodePoint(t)))}var ZR=["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"],qR=Xd(ZR);function Pv(t){return qR.test(String.fromCodePoint(t))}function YR(t,e){return!(!e&&Pv(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||ht.Khmer(t))}function wv(t){for(let e of t)if(Pv(e.charCodeAt(0)))return!0;return!1}function Tv(t,e){for(let r of t)if(!YR(r.charCodeAt(0),e))return!1;return!0}m();var Zd=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(cn.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 ${n}`)}},cn=new Zd;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 eo,this.transition=r.transition||{},this.globalState=r.globalState||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new eo,this.transition={},this.globalState={})}isSupportedScript(e){return Tv(e,cn.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 Jo=class{constructor(e,r){this.property=e,this.value=r,this.expression=K_(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)}},Rs=class{constructor(e){this.property=e,this.value=new Jo(e,void 0)}transitioned(e,r){return new Hc(this.property,this.value,r,Z({},e.transition,this.transition),e.now)}untransitioned(){return new Hc(this.property,this.value,null,{},0)}},pn=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return kt(this._values[e].value.value)}setValue(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Rs(this._values[e].property)),this._values[e].value=new Jo(this._values[e].property,r===null?void 0:kt(r))}getTransition(e){return kt(this._values[e].transition)}setTransition(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new Rs(this._values[e].property)),this._values[e].transition=kt(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[`${r}-transition`]=i)}return e}transitioned(e,r){let n=new Xc(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 Xc(this._properties);for(let r of Object.keys(this._values))e._values[r]=this._values[r].untransitioned();return e}},Hc=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,ic(s))}}else return o}},Xc=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,r,n){let i=new ai(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}},Zc=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}hasValue(e){return this._values[e].value!==void 0}getValue(e){return kt(this._values[e].value)}setValue(e,r){this._values[e]=new Jo(this._values[e].property,r===null?void 0:kt(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 ai(this._properties);for(let o of Object.keys(this._values))i._values[o]=this._values[o].possiblyEvaluate(e,r,n);return i}},Ft=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)}},ai=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 Ft(this,{kind:"constant",value:e.expression.evaluate(r,null,{},n,i)},r):new Ft(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 Ft(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 Ft(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)}},Mn=class extends te{possiblyEvaluate(e,r,n,i){if(e.value===void 0)return new Ft(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 Ft(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 Ft(this,{kind:"constant",value:o},r)}else return new Ft(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}},to=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}},In=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 Jo(n,void 0),o=this.defaultTransitionablePropertyValues[r]=new Rs(n);this.defaultTransitioningPropertyValues[r]=o.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=i.possiblyEvaluate({})}}};X("DataDrivenProperty",te);X("DataConstantProperty",q);X("CrossFadedDataDrivenProperty",Mn);X("CrossFadedProperty",to);X("ColorRampProperty",In);var qc="-transition",it=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=ii(e.filter)),r.layout&&(this._unevaluatedLayout=new Zc(r.layout)),r.paint)){this._transitionablePaint=new pn(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 ai(r.paint)}}setFilter(e){this.filter=e,this._featureFilter=ii(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.${this.id}.layout.${e}`;if(this._validate(xv,i,e,r,n))return}if(e==="visibility"){this.visibility=r;return}this._unevaluatedLayout.setValue(e,r)}getPaintProperty(e){return e.endsWith(qc)?this._transitionablePaint.getTransition(e.slice(0,-qc.length)):this._transitionablePaint.getValue(e)}setPaintProperty(e,r,n={}){if(r!=null){let i=`layers.${this.id}.paint.${e}`;if(this._validate(gv,i,e,r,n))return!1}if(e.endsWith(qc))return this._transitionablePaint.setTransition(e.slice(0,-qc.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),ac(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:oi(this,e.call(Je,{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 Ft)||!ri(r.property.specification))&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}};m();m();m();var WR={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},si=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}},$R=128,KR=5,qe=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*KR),$R),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=JR(a.type),l=r=Sv(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=Sv(r,Math.max(n,e));return{members:i,size:o,alignment:e}}function JR(t){return WR[t].BYTES_PER_ELEMENT}function Sv(t,e){return Math.ceil(t/e)*e}var Cv=se(fe(),1),ro=class extends qe{_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}};ro.prototype.bytesPerElement=4;X("StructArrayLayout2i4",ro);var Qo=class extends qe{_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}};Qo.prototype.bytesPerElement=6;X("StructArrayLayout3i6",Qo);var ks=class extends qe{_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}};ks.prototype.bytesPerElement=8;X("StructArrayLayout4i8",ks);var Fs=class extends qe{_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}};Fs.prototype.bytesPerElement=12;X("StructArrayLayout2i4i12",Fs);var Os=class extends qe{_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}};Os.prototype.bytesPerElement=8;X("StructArrayLayout2i4ub8",Os);var li=class extends qe{_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}};li.prototype.bytesPerElement=8;X("StructArrayLayout2f8",li);var Bs=class extends qe{_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}};Bs.prototype.bytesPerElement=20;X("StructArrayLayout10ui20",Bs);var zs=class extends qe{_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}};zs.prototype.bytesPerElement=24;X("StructArrayLayout4i4ui4i24",zs);var Vs=class extends qe{_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}};Vs.prototype.bytesPerElement=12;X("StructArrayLayout3f12",Vs);var Us=class extends qe{_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}};Us.prototype.bytesPerElement=4;X("StructArrayLayout1ul4",Us);var Ns=class extends qe{_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}};Ns.prototype.bytesPerElement=20;X("StructArrayLayout6i1ul2ui20",Ns);var Gs=class extends qe{_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}};Gs.prototype.bytesPerElement=12;X("StructArrayLayout2i2i2i12",Gs);var js=class extends qe{_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}};js.prototype.bytesPerElement=16;X("StructArrayLayout2f1f2i16",js);var Hs=class extends qe{_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}};Hs.prototype.bytesPerElement=16;X("StructArrayLayout2ub2f2i16",Hs);var ea=class extends qe{_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}};ea.prototype.bytesPerElement=6;X("StructArrayLayout3ui6",ea);var Xs=class extends qe{_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}};Xs.prototype.bytesPerElement=48;X("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Xs);var Zs=class extends qe{_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,C,A,E,L,F,O){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,C,A,E,L,F,O)}emplace(e,r,n,i,o,a,s,l,u,c,p,h,f,d,g,x,b,v,P,w,T,S,C,A,E,L,F,O,z){let I=e*32,R=e*16;return this.int16[I+0]=r,this.int16[I+1]=n,this.int16[I+2]=i,this.int16[I+3]=o,this.int16[I+4]=a,this.int16[I+5]=s,this.int16[I+6]=l,this.int16[I+7]=u,this.uint16[I+8]=c,this.uint16[I+9]=p,this.uint16[I+10]=h,this.uint16[I+11]=f,this.uint16[I+12]=d,this.uint16[I+13]=g,this.uint16[I+14]=x,this.uint16[I+15]=b,this.uint16[I+16]=v,this.uint16[I+17]=P,this.uint16[I+18]=w,this.uint16[I+19]=T,this.uint16[I+20]=S,this.uint16[I+21]=C,this.uint16[I+22]=A,this.uint32[R+12]=E,this.float32[R+13]=L,this.float32[R+14]=F,this.uint16[I+30]=O,this.uint16[I+31]=z,e}};Zs.prototype.bytesPerElement=64;X("StructArrayLayout8i15ui1ul2f2ui64",Zs);var no=class extends qe{_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}};no.prototype.bytesPerElement=4;X("StructArrayLayout1f4",no);var qs=class extends qe{_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}};qs.prototype.bytesPerElement=12;X("StructArrayLayout1ui2f12",qs);var Ys=class extends qe{_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}};Ys.prototype.bytesPerElement=8;X("StructArrayLayout1ul2ui8",Ys);var Ws=class extends qe{_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}};Ws.prototype.bytesPerElement=4;X("StructArrayLayout2ui4",Ws);var $s=class extends qe{_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}};$s.prototype.bytesPerElement=2;X("StructArrayLayout1ui2",$s);var ta=class extends qe{_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}};ta.prototype.bytesPerElement=16;X("StructArrayLayout4f16",ta);var Yc=class extends si{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 Cv.default(this.anchorPointX,this.anchorPointY)}};Yc.prototype.size=20;var Ks=class extends Ns{get(e){return new Yc(this,e)}};X("CollisionBoxArray",Ks);var Wc=class extends si{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]}};Wc.prototype.size=48;var Js=class extends Xs{get(e){return new Wc(this,e)}};X("PlacedSymbolArray",Js);var $c=class extends si{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]}};$c.prototype.size=64;var Qs=class extends Zs{get(e){return new $c(this,e)}};X("SymbolInstanceArray",Qs);var el=class extends no{getoffsetX(e){return this.float32[e*1+0]}};X("GlyphOffsetArray",el);var tl=class extends Qo{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",tl);var Kc=class extends si{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]}};Kc.prototype.size=12;var rl=class extends qs{get(e){return new Kc(this,e)}};X("TextAnchorOffsetArray",rl);var Jc=class extends si{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]}};Jc.prototype.size=8;var nl=class extends Ys{get(e){return new Jc(this,e)}};X("FeatureIndexArray",nl);var Et=class extends ro{},Qc=class extends Qo{},ep=class extends ks{},tp=class extends ro{},rp=class extends ro{},np=class extends Fs{};var ip=class extends Os{},op=class extends li{},An=class extends Bs{},ap=class extends zs{},sp=class extends Vs{},lp=class extends Us{},il=class extends Gs{},up=class extends js{},cp=class extends Hs{},pp=class extends ea{},Qe=class extends ea{},ui=class extends Ws{},ol=class extends $s{};m();var QR=ze([{name:"a_pos",components:2,type:"Int16"}],4);var{members:Mv,size:FG,alignment:OG}=QR;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 ${t.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${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 qd(t,e){return t=ce(Math.floor(t),0,255),e=ce(Math.floor(e),0,255),256*t+e}m();var al=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 Dv=se($d(),1);var sl=class t{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,n,i){this.ids.push(Lv(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=Lv(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 Kd(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 Lv(t){let e=+t;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:(0,Dv.default)(String(t))}function Kd(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;fp(t,o,a),fp(e,3*o,3*a),fp(e,3*o+1,3*a+1),fp(e,3*o+2,3*a+2)}a-r<n-a?(Kd(t,e,r,a),r=a+1):(Kd(t,e,a+1,n),n=a)}}function fp(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}X("FeaturePositionMap",sl);m();var Yr=class{constructor(e,r){this.gl=e.gl,this.location=r}},re=class extends Yr{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 Yr{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 Yr{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]))}},gt=class extends Yr{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]))}},Ot=class extends Yr{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]))}},Bt=class extends Yr{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))}},ll=class extends Yr{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)}}},ul=class extends Yr{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)}}},nk=new Float32Array(16),ft=class extends Yr{constructor(e,r){super(e,r),this.current=nk}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 Jd(t){return[qd(255*t.r,255*t.g),qd(255*t.b,255*t.a)]}var io=class{constructor(e,r,n){this.value=e,this.uniformNames=r.map(i=>`u_${i}`),this.type=n}setUniform(e,r,n){e.set(n.constantOr(this.value))}getBinding(e,r,n){return this.type==="color"?new Bt(e,r):new N(e,r)}},ci=class{constructor(e,r){this.uniformNames=r.map(n=>`u_${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 Ot(e,r):new N(e,r)}},Wr=class{constructor(e,r,n,i){this.expression=e,this.type=n,this.maxValue=0,this.paintVertexAttributes=r.map(o=>({name:`a_${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=Jd(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()}},xr=class{constructor(e,r,n,i,o,a){this.expression=e,this.uniformNames=r.map(s=>`u_${s}_t`),this.type=n,this.useIntegerZoom=i,this.zoom=o,this.maxValue=0,this.paintVertexAttributes=r.map(s=>({name:`a_${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=Jd(n),a=Jd(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)}},hn=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,al.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,al.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}},mp=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 Ft)||!ri(a.property.specification))continue;let s=ik(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 ci(l.value,s):new io(l.value,s,u),i.push(`/u_${o}`);else if(l.kind==="source"||h){let f=Rv(o,u,"source");this.binders[o]=h?new hn(l,u,c,r,f,e.id):new Wr(l,s,u,f),i.push(`/a_${o}`)}else{let f=Rv(o,u,"composite");this.binders[o]=new xr(l,s,u,c,r,f),i.push(`/z_${o}`)}}this.cacheKey=i.sort().join("")}getMaxValue(e){let r=this.binders[e];return r instanceof Wr||r instanceof xr?r.maxValue:0}populatePaintArrays(e,r,n,i,o){for(let a in this.binders){let s=this.binders[a];(s instanceof Wr||s instanceof xr||s instanceof hn)&&s.populatePaintArray(e,r,n,i,o)}}setConstantPatternPositions(e,r){for(let n in this.binders){let i=this.binders[n];i instanceof ci&&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 Wr||h instanceof xr||h instanceof hn)&&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 io||n instanceof ci)&&e.push(...n.uniformNames.map(i=>`#define HAS_UNIFORM_${i}`))}return e}getBinderAttributes(){let e=[];for(let r in this.binders){let n=this.binders[r];if(n instanceof Wr||n instanceof xr)for(let i=0;i<n.paintVertexAttributes.length;i++)e.push(n.paintVertexAttributes[i].name);else if(n instanceof hn)for(let i=0;i<al.members.length;i++)e.push(al.members[i].name)}return e}getBinderUniforms(){let e=[];for(let r in this.binders){let n=this.binders[r];if(n instanceof io||n instanceof ci||n instanceof xr)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 io||o instanceof ci||o instanceof xr){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 hn){let i=e.fromScale===2?n.zoomInPaintVertexBuffer:n.zoomOutPaintVertexBuffer;i&&this._buffers.push(i)}else(n instanceof Wr||n instanceof xr)&&n.paintVertexBuffer&&this._buffers.push(n.paintVertexBuffer)}}upload(e){for(let r in this.binders){let n=this.binders[r];(n instanceof Wr||n instanceof xr||n instanceof hn)&&n.upload(e)}this.updatePaintBuffers()}destroy(){for(let e in this.binders){let r=this.binders[e];(r instanceof Wr||r instanceof xr||r instanceof hn)&&r.destroy()}}},Qt=class{constructor(e,r,n=()=>!0){this.programConfigurations={};for(let i of e)this.programConfigurations[i.id]=new mp(i,r,n);this.needsUpload=!1,this._featureMap=new sl,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 ik(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(`${e}-`,"").replace(/-/g,"_")]}function ok(t){return{"line-pattern":{source:An,composite:An},"fill-pattern":{source:An,composite:An},"fill-extrusion-pattern":{source:An,composite:An}}[t]}function Rv(t,e,r){let n={color:{source:li,composite:ta},number:{source:no,composite:li}},i=ok(t);return i&&i[r]||n[e][r]}X("ConstantBinder",io);X("CrossFadedConstantBinder",ci);X("SourceExpressionBinder",Wr);X("CrossFadedCompositeBinder",hn);X("CompositeExpressionBinder",xr);X("ProgramConfiguration",mp,{omit:["_buffers"]});X("ProgramConfigurationSet",Qt);m();m();var ak=15,Qd=Math.pow(2,ak-1)-1,kv=-Qd-1;function er(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,kv,Qd),a.y=ce(l,kv,Qd),(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 tr(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?er(t):[]}}var Fv=-32768;function sk(t,e,r,n,i){t.emplaceBack(Fv+e*8+n,Fv+r*8+i)}var oo=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 tp,this.indexArray=new Qe,this.segments=new de,this.programConfigurations=new Qt(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=tr(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:er(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,Mv),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: ${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++)sk(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",oo,{omit:["layers"]});m();var cl=se(fe(),1);function dp(t,e){for(let r=0;r<t.length;r++)if(ra(e,t[r]))return!0;for(let r=0;r<e.length;r++)if(ra(t,e[r]))return!0;return!!ty(t,e)}function Bv(t,e,r){return!!(ra(t,e)||ey(e,t,r))}function yp(t,e){if(t.length===1)return Ov(e,t[0]);for(let r=0;r<e.length;r++){let n=e[r];for(let i=0;i<n.length;i++)if(ra(t,n[i]))return!0}for(let r=0;r<t.length;r++)if(Ov(e,t[r]))return!0;for(let r=0;r<e.length;r++)if(ty(t,e[r]))return!0;return!1}function zv(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(ra(t,i[o]))return!0}if(lk(t,i,r))return!0}return!1}function lk(t,e,r){if(t.length>1){if(ty(t,e))return!0;for(let n=0;n<e.length;n++)if(ey(e[n],t,r))return!0}for(let n=0;n<t.length;n++)if(ey(t[n],e,r))return!0;return!1}function ty(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(uk(n,i,a,s))return!0}}return!1}function uk(t,e,r,n){return wn(t,r,n)!==wn(e,r,n)&&wn(t,e,r)!==wn(t,e,n)}function ey(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(Vv(t,o,a)<n)return!0}return!1}function Vv(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 Ov(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 ra(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 Uv(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 cl.default(e,r),new cl.default(e,i),new cl.default(n,i),new cl.default(n,r)];if(t.length>2){for(let a of o)if(ra(t,a))return!0}for(let a=0;a<t.length-1;a++){let s=t[a],l=t[a+1];if(ck(s,l,o))return!0}return!1}function ck(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=wn(t,e,r[0]);return o!==wn(t,e,r[1])||o!==wn(t,e,r[2])||o!==wn(t,e,r[3])}m();var gp=se(fe(),1);function ao(t,e,r){let n=e.paint.get(t).value;return n.kind==="constant"?n.value:r.programConfigurations.get(e.id).getMaxValue(t)}function pi(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function hi(t,e,r,n,i){if(!e[0]&&!e[1])return t;let o=gp.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 Nv(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 gp.default(0,0):l.sub(s)._unit()._perp(),p=a===i.length-1?new gp.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 Gv,hk=()=>Gv=Gv||new Ue({"circle-sort-key":new te(D.layout_circle["circle-sort-key"])}),jv,fk=()=>jv=jv||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"])}),Hv={get paint(){return fk()},get layout(){return hk()}};var Xv=se(fe(),1),Zv=t=>t.type==="circle",xp=class extends it{constructor(e){super(e,Hv)}createBucket(e){return new oo(e)}queryRadius(e){let r=e;return ao("circle-radius",this,r)+ao("circle-stroke-width",this,r)+pi(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:e,feature:r,featureState:n,geometry:i,transform:o,pixelsToTileUnits:a,unwrappedTileID:s,getElevation:l}){let u=hi(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:mk(u,o,s,l),g=f?h*a:h;for(let x of i)for(let b of x){let v=f?b:qv(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),Bv(d,v,P))return!0}return!1}};function qv(t,e,r,n){let i=e.projectTileCoordinates(t.x,t.y,r,n).point;return new Xv.default((i.x*.5+.5)*e.width,(-i.y*.5+.5)*e.height)}function mk(t,e,r,n){return t.map(i=>qv(i,e,r,n))}m();m();var pl=class extends oo{};X("HeatmapBucket",pl,{omit:["layers"]});m();var Yv,dk=()=>Yv=Yv||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 In(D.paint_heatmap["heatmap-color"]),"heatmap-opacity":new q(D.paint_heatmap["heatmap-opacity"])}),Wv={get paint(){return dk()}};m();m();function ry(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: ${i.length} but got: ${e*r*n}`);return t.width=e,t.height=r,t.data=i,t}function $v(t,{width:e,height:r},n){if(e===t.width&&r===t.height)return;let i=ry({},{width:e,height:r},n);ny(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 ny(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 so=class t{constructor(e,r){ry(this,e,1,r)}resize(e){$v(this,e,1)}clone(){return new t({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,n,i,o){ny(e,r,n,i,o,1)}},Le=class t{constructor(e,r){ry(this,e,4,r)}resize(e){$v(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){ny(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",so);X("RGBAImage",Le);function bp(t){let e={},r=t.resolution||256,n=t.clips?t.clips.length:1,i=t.image||new Le({width:r,height:n});if(!Ob(r))throw new Error(`width is not a power of 2 - ${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 na="big-fb",Kv=t=>t.type==="heatmap",_p=class extends it{createBucket(e){return new pl(e)}constructor(e){super(e,Wv),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=bp({expression:e,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(na)&&this.heatmapFbos.delete(na)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}};m();m();var Jv,yk=()=>Jv=Jv||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"])}),Qv={get paint(){return yk()}};var e0=t=>t.type==="hillshade",vp=class extends it{constructor(e){super(e,Qv),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 t0,gk=()=>t0=t0||new Ue({"color-relief-opacity":new q(D["paint_color-relief"]["color-relief-opacity"]),"color-relief-color":new In(D["paint_color-relief"]["color-relief-color"])}),r0={get paint(){return gk()}};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||Wt(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||Wt(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 iy=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(`"${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 oy(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 oy(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",iy);var n0=t=>t.type==="color-relief",Pp=class extends it{constructor(e){super(e,r0)}_createColorRamp(e){let r={elevationStops:[],colorStops:[]},n=this._transitionablePaint._values["color-relief-color"].value.expression;if(n instanceof un&&n._styleExpression.expression instanceof jt){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 ${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=oy(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 xk=ze([{name:"a_pos",components:2,type:"Int16"}],4);var{members:i0,size:_H,alignment:vH}=xk;m();function ia(t,e,r){let n=r.patternDependencies,i=!1;for(let o of e){let a=o.paint.get(`${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 oa(t,e,r,n,i){let o=i.patternDependencies;for(let a of e){let l=a.paint.get(`${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 yl=se(fe(),1);m();function ly(t,e,r=2){let n=e&&e.length,i=n?e[0]*r:t.length,o=a0(t,0,i,r,!0),a=[];if(!o||o.next===o.prev)return a;let s,l,u;if(n&&(o=wk(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 fl(o,a,r,s,l,u,0),a}function a0(t,e,r,n,i){let o;if(i===kk(t,e,r,n)>0)for(let a=e;a<r;a+=n)o=o0(a/n|0,t[a],t[a+1],o);else for(let a=r-n;a>=e;a-=n)o=o0(a/n|0,t[a],t[a+1],o);return o&&aa(o,o.next)&&(dl(o),o=o.next),o}function lo(t,e){if(!t)return t;e||(e=t);let r=t,n;do if(n=!1,!r.steiner&&(aa(r,r.next)||at(r.prev,r,r.next)===0)){if(dl(r),r=e=r.prev,r===r.next)break;n=!0}else r=r.next;while(n||r!==e);return e}function fl(t,e,r,n,i,o,a){if(!t)return;!a&&o&&Ik(t,n,i,o);let s=t;for(;t.prev!==t.next;){let l=t.prev,u=t.next;if(o?_k(t,n,i,o):bk(t)){e.push(l.i,t.i,u.i),dl(t),t=u.next,s=u.next;continue}if(t=u,t===s){a?a===1?(t=vk(lo(t),e),fl(t,e,r,n,i,o,2)):a===2&&Pk(t,e,r,n,i,o):fl(lo(t),e,r,n,i,o,1);break}}}function bk(t){let e=t.prev,r=t,n=t.next;if(at(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&&hl(i,s,o,l,a,u,d.x,d.y)&&at(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function _k(t,e,r,n){let i=t.prev,o=t,a=t.next;if(at(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=ay(f,d,e,r,n),v=ay(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&&hl(s,c,l,p,u,h,P.x,P.y)&&at(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&&hl(s,c,l,p,u,h,w.x,w.y)&&at(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&&hl(s,c,l,p,u,h,P.x,P.y)&&at(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&&hl(s,c,l,p,u,h,w.x,w.y)&&at(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function vk(t,e){let r=t;do{let n=r.prev,i=r.next.next;!aa(n,i)&&l0(n,r,r.next,i)&&ml(n,i)&&ml(i,n)&&(e.push(n.i,r.i,i.i),dl(r),dl(r.next),r=t=i),r=r.next}while(r!==t);return lo(r)}function Pk(t,e,r,n,i,o){let a=t;do{let s=a.next.next;for(;s!==a.prev;){if(a.i!==s.i&&Lk(a,s)){let l=u0(a,s);a=lo(a,a.next),l=lo(l,l.next),fl(a,e,r,n,i,o,0),fl(l,e,r,n,i,o,0);return}s=s.next}a=a.next}while(a!==t)}function wk(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=a0(t,s,l,n,!1);u===u.next&&(u.steiner=!0),i.push(Ek(u))}i.sort(Tk);for(let o=0;o<i.length;o++)r=Sk(i[o],r);return r}function Tk(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 Sk(t,e){let r=Ck(t,e);if(!r)return e;let n=u0(r,t);return lo(n,n.next),lo(r,r.next)}function Ck(t,e){let r=e,n=t.x,i=t.y,o=-1/0,a;if(aa(t,r))return r;do{if(aa(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&&s0(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);ml(r,t)&&(p<c||p===c&&(r.x>a.x||r.x===a.x&&Mk(a,r)))&&(a=r,c=p)}r=r.next}while(r!==s);return a}function Mk(t,e){return at(t.prev,t,e.prev)<0&&at(e.next,t,t.next)<0}function Ik(t,e,r,n){let i=t;do i.z===0&&(i.z=ay(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,Ak(i)}function Ak(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 ay(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 Ek(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 s0(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 hl(t,e,r,n,i,o,a,s){return!(t===a&&e===s)&&s0(t,e,r,n,i,o,a,s)}function Lk(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!Dk(t,e)&&(ml(t,e)&&ml(e,t)&&Rk(t,e)&&(at(t.prev,t,e.prev)||at(t,e.prev,e))||aa(t,e)&&at(t.prev,t,t.next)>0&&at(e.prev,e,e.next)>0)}function at(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function aa(t,e){return t.x===e.x&&t.y===e.y}function l0(t,e,r,n){let i=Tp(at(t,e,r)),o=Tp(at(t,e,n)),a=Tp(at(r,n,t)),s=Tp(at(r,n,e));return!!(i!==o&&a!==s||i===0&&wp(t,r,e)||o===0&&wp(t,n,e)||a===0&&wp(r,t,n)||s===0&&wp(r,e,n))}function wp(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 Tp(t){return t>0?1:t<0?-1:0}function Dk(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&&l0(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}function ml(t,e){return at(t.prev,t,t.next)<0?at(t,e,t.next)>=0&&at(t,t.prev,e)>=0:at(t,e,t.prev)<0||at(t,t.next,e)<0}function Rk(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 u0(t,e){let r=sy(t.i,t.x,t.y),n=sy(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 o0(t,e,r,n){let i=sy(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 dl(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 sy(t,e,r){return{i:t,x:e,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function kk(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 br=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)}},Sp=class Sp{constructor(e){this.fill=e.fill,this.line=e.line,this.tile=e.tile,this.stencil=e.stencil,this.circle=e.circle}};Sp.noSubdivision=new Sp({fill:new br(0,0),line:new br(0,0),tile:new br(0,0),stencil:new br(0,0),circle:1});var fi=Sp;X("SubdivisionGranularityExpression",br);X("SubdivisionGranularitySetting",fi);var fn=-32768,En=32767,uy=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 Ok(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);Bk(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 A=l+d*w,E=u+g*w;a.push(this._vertexToIndex(A,E))}let S=l+d*Math.max(w,0),C=l+d*Math.min(T,1);if(x||this._generateIntraEdgeVertices(a,l,u,c,p,S,C),!b&&T<1){let A=l+d*T,E=u+g*T;a.push(this._vertexToIndex(A,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,C,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 A=r-a,E=n-s,L=(u-s)/E,F=(c-s)/E,O=Math.min(L,F),z=a+A*O;P=Math.floor(Math.min(z,l)/this._granularityCellSize)+1,w=Math.ceil(Math.max(z,l)/this._granularityCellSize)-1,T=l<z}let C=p>0?c:u;if(T)for(let A=P;A<=w;A++){let E=A*this._granularityCellSize;e.push(this._vertexToIndex(E,C))}else for(let A=w;A>=P;A--){let E=A*this._granularityCellSize;e.push(this._vertexToIndex(E,C))}}_generateOutline(e){let r=[];for(let n of e){let i=sa(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===fn&&(e[r+1]=fn+1),n===En&&(e[r+1]=En-1)}}_generatePoleQuad(e,r,n,i,o,a){i>o!=(a===fn)?(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,fn),g===o&&b===o&&this._generatePoleQuad(e,c,p,d,x,fn),b===o&&f===o&&this._generatePoleQuad(e,p,u,x,h,fn)),n&&(f===a&&g===a&&this._generatePoleQuad(e,u,c,h,d,En),g===a&&b===a&&this._generatePoleQuad(e,c,p,d,x,En),b===a&&f===a&&this._generatePoleQuad(e,p,u,x,h,En))}}_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}=Fk(e);this._initializeVertices(n);let o;try{let s=ly(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 Cp(t,e,r,n=!0){return new uy(r,e).subdividePolygonInternal(t,n)}function sa(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 yl.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),C=f,A=d;for(;;){let L=P>0?(Math.floor(C/a)+1)*a:(Math.ceil(C/a)-1)*a,F=w>0?(Math.floor(A/a)+1)*a:(Math.ceil(A/a)-1)*a,O=Math.abs(C-L),z=Math.abs(A-F),I=Math.abs(C-g),R=Math.abs(A-x),H=b?O/T:Number.POSITIVE_INFINITY,W=v?z/S:Number.POSITIVE_INFINITY;if((I<=O||!b)&&(R<=z||!v))break;if(H<W&&b||!v){C=L,A=A+w*H;let $=new yl.default(C,Math.round(A));(s[s.length-1].x!==$.x||s[s.length-1].y!==$.y)&&s.push($)}else{C=C+P*W,A=F;let $=new yl.default(Math.round(C),A);(s[s.length-1].x!==$.x||s[s.length-1].y!==$.y)&&s.push($)}}let E=new yl.default(g,x);(s[s.length-1].x!==E.x||s[s.length-1].y!==E.y)&&s.push(E)}return s}function Fk(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 Ok(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 Bk(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,C=g<b?1:-1,A=((c-d)*T+(p-g)*S)*C,E=((h-d)*T+(f-g)*S)*C;A>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 Mp(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 zk(e,r,n,i,o,t),c&&Vk(a,r,s,i,l,t),e.forceNewSegmentOnNextPrepare(),a?.forceNewSegmentOnNextPrepare()}function gl(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 zk(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=gl(a,n,o,s,h,g,u),w=gl(a,n,o,s,f,x,u),T=gl(a,n,o,s,d,b,u);r.emplaceBack(c+P-l,c+w-l,c+T-l),u.primitiveLength++}}function Vk(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=gl(a,n,o,s,d,x,u),w=gl(a,n,o,s,g,b,u);r.emplaceBack(c+P-l,c+w-l),u.primitiveLength++}}}var Uk=500,xl=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 rp,this.indexArray=new Qe,this.indexArray2=new ui,this.programConfigurations=new Qt(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=ia("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=tr(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:er(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=oa("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,i0),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 Es(r,Uk)){let l=Cp(s,i,a.fill.getGranularityForZoomLevel(i.z)),u=this.layoutVertexArray;Mp((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",xl,{omit:["layers","patternFeatures"]});m();var c0,Nk=()=>c0=c0||new Ue({"fill-sort-key":new te(D.layout_fill["fill-sort-key"])}),p0,Gk=()=>p0=p0||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 Mn(D.paint_fill["fill-pattern"])}),h0={get paint(){return Gk()},get layout(){return Nk()}};var f0=t=>t.type==="fill",Ip=class extends it{constructor(e){super(e,h0)}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 xl(e)}queryRadius(){return pi(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:e,geometry:r,transform:n,pixelsToTileUnits:i}){let o=hi(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-n.bearingInRadians,i);return yp(o,r)}isTileClipped(){return!0}};m();m();m();var jk=ze([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),m0=ze([{name:"a_centroid",components:2,type:"Int16"}],4);var{members:d0,size:yX,alignment:gX}=jk;var P0=se(bl(),1);var tF=P0.default.VectorTileFeature.types,rF=500,hy=Math.pow(2,13);function _l(t,e,r,n,i,o,a,s){t.emplaceBack(e,r,Math.floor(n*hy)*2+a,i*hy*2,o*hy*2,Math.round(s))}var 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.layoutVertexArray=new np,this.centroidVertexArray=new Et,this.indexArray=new Qe,this.programConfigurations=new Qt(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=ia("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=tr(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:er(i),properties:i.properties,type:i.type,patterns:{}};this.hasPattern?this.features.push(oa("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,d0),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,m0.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 Es(r,rF)){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||v0(i[0]))return;for(let p of i)p.length!==0&&nF(e,p);let a={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},s=o.fill.getGranularityForZoomLevel(r.z),l=tF[n.type]==="Polygon";for(let p of i){if(p.length===0||v0(p))continue;let h=sa(p,s,l);this._generateSideFaces(h,a)}if(!l)return;let u=Cp(i,r,s,!1),c=this.layoutVertexArray;Mp((p,h)=>{_l(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(iF(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),_l(this.layoutVertexArray,o.x,o.y,s.x,s.y,0,0,n),_l(this.layoutVertexArray,o.x,o.y,s.x,s.y,0,1,n),n+=l,_l(this.layoutVertexArray,a.x,a.y,s.x,s.y,0,0,n),_l(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 nF(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",vl,{omit:["layers","features"]});function iF(t,e){return t.x===e.x&&(t.x<0||t.x>8192)||t.y===e.y&&(t.y<0||t.y>8192)}function v0(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 w0,oF=()=>w0=w0||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 Mn(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"])}),T0={get paint(){return oF()}};var Ep=se(fe(),1);var C0=t=>t.type==="fill-extrusion",Lp=class extends it{constructor(e){super(e,T0)}createBucket(e){return new vl(e)}queryRadius(){return pi(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=hi(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=lF(l,s,0),h=sF(i,c,u,s),f=h[0],d=h[1];return aF(f,d,p)}};function Pl(t,e){return t.x*e.x+t.y*e.y}function S0(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=Pl(s,s),p=Pl(s,l),h=Pl(l,l),f=Pl(u,s),d=Pl(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 aF(t,e,r){let n=1/0;yp(r,e)&&(n=S0(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];dp(r,h)&&(n=Math.min(n,S0(r,h)))}}return n===1/0?!1:n}function sF(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],C=n[3]*v+n[7]*P+n[15],A=w+a,E=T+s,L=S+l,F=C+u,O=w+c,z=T+p,I=S+h,R=C+f,H=new Ep.default(A/F,E/F);H.z=L/F,g.push(H);let W=new Ep.default(O/R,z/R);W.z=I/R,x.push(W)}i.push(g),o.push(x)}return[i,o]}function lF(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 Ep.default(o[0]/o[3],o[1]/o[3]))}return n}m();m();m();var uF=ze([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:M0,size:sZ,alignment:lZ}=uF;m();var cF=ze([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:I0,size:hZ,alignment:fZ}=cF;var L0=se(bl(),1);var pF=L0.default.VectorTileFeature.types,A0=63,hF=Math.cos(75/2*(Math.PI/180)),fF=15,mF=20,dF=15,D0=1/2,E0=Math.pow(2,dF-1)/D0,wl=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 ip,this.layoutVertexArray2=new op,this.indexArray=new Qe,this.programConfigurations=new Qt(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=ia("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=tr(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:er(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=oa("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,I0)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,M0),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=sa(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=pF[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?fF*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,C=T.x*P.x+T.y*P.y,A=C!==0?1/C:1/0,E=2*Math.sqrt(2-2*C),L=C<hF&&x&&b,F=v.x*P.y-v.y*P.x>0;if(L&&w>h){let I=g.dist(x);if(I>2*f){let R=g.sub(g.sub(x)._mult(f/I)._round());this.updateDistance(x,R),this.addCurrentVertex(R,v,0,0,d),x=R}}let O=x&&b,z=O?n:c?"butt":i;if(O&&z==="round"&&(A<a?z="miter":A<=2&&(z="fakeround")),z==="miter"&&A>o&&(z="bevel"),z==="bevel"&&(A>2&&(z="flipbevel"),A<o&&(z="miter")),x&&this.updateDistance(x,g),z==="miter")T._mult(A),this.addCurrentVertex(g,T,0,0,d);else if(z==="flipbevel"){if(A>100)T=P.mult(-1);else{let I=A*v.add(P).mag()/v.sub(P).mag();T._perp()._mult(I*(F?-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 I=-Math.sqrt(A*A-1),R=F?I:0,H=F?0:I;if(x&&this.addCurrentVertex(g,v,R,H,d),z==="fakeround"){let W=Math.round(E*180/Math.PI/mF);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)),Ze=.848013+S*(-1.06021+S*.215638);he=he+he*be*(he-1)*(ye*be*be+Ze)}let Xe=P.sub(v)._mult(he)._add(v)._unit()._mult(F?-1:1);this.addHalfVertex(g,Xe.x,Xe.y,!1,F,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 I=x?1:-1;this.addCurrentVertex(g,T,I,I,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 I=g.dist(b);if(I>2*f){let R=g.add(b.sub(g)._mult(f/I)._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>E0/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*(E0-1):this.scaledDistance)*D0;if(this.layoutVertexArray.emplaceBack((e<<1)+(o?1:0),(r<<1)+(a?1:0),Math.round(A0*n)+128,Math.round(A0*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",wl,{omit:["layers","patternFeatures"]});m();var R0,yF=()=>R0=R0||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"])}),k0,gF=()=>k0=k0||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 to(D.paint_line["line-dasharray"]),"line-pattern":new Mn(D.paint_line["line-pattern"]),"line-gradient":new In(D.paint_line["line-gradient"])}),fy={get paint(){return gF()},get layout(){return yF()}};var my=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)}},Dp,O0=t=>t.type==="line",Rp=class extends it{constructor(e){super(e,fy),this.gradientVersion=0,Dp||(Dp=new my(fy.paint.properties["line-width"].specification),Dp.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){let r=this.gradientExpression();W_(r)?this.stepInterpolant=r._styleExpression.expression instanceof Ho: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"]=Dp.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new wl(e)}queryRadius(e){let r=e,n=F0(ao("line-width",this,r),ao("line-gap-width",this,r)),i=ao("line-offset",this,r);return n/2+Math.abs(i)+pi(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:e,feature:r,featureState:n,geometry:i,transform:o,pixelsToTileUnits:a}){let s=hi(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-o.bearingInRadians,a),l=a/2*F0(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=Nv(i,u*a)),zv(s,i,l)}isTileClipped(){return!0}};function F0(t,e){return e>0?e+2*t:t}m();m();m();var B0=ze([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),z0=ze([{name:"a_projected_pos",components:3,type:"Float32"}],4),WZ=ze([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),V0=ze([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]),$Z=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"}]),dy=ze([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),U0=ze([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4),KZ=ze([{name:"triangle",components:3,type:"Uint16"}]),JZ=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"}]),QZ=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"}]),eq=ze([{type:"Float32",name:"offsetX"}]),tq=ze([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),rq=ze([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);var Cl=se(fe(),1);m();function xF(t,e,r){let n=e.layout.get("text-transform").evaluate(r,{});return n==="uppercase"?t=t.toLocaleUpperCase():n==="lowercase"&&(t=t.toLocaleLowerCase()),cn.applyArabicShaping&&(t=cn.applyArabicShaping(t)),t}function N0(t,e,r){return t.sections.forEach(n=>{n.text=xF(n.text,e,r)}),t}m();function G0(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`${u}:${h.x}:${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 j0={"!":"\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 mi=24;m();var K0=se(xy(),1),$0=3;function OF(t,e,r){t===1&&r.readMessage(BF,e)}function BF(t,e,r){if(t===3){let{id:n,bitmap:i,width:o,height:a,left:s,top:l,advance:u}=r.readMessage(zF,{});e.push({id:n,bitmap:new so({width:o+2*$0,height:a+2*$0},i),metrics:{width:o,height:a,left:s,top:l,advance:u}})}}function zF(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 J0(t){return new K0.default(t).readFields(OF,[])}m();function Q0(t){let{userImage:e}=t;return e&&e.render&&e.render()?(t.data.replace(new Uint8Array(e.data.buffer)),!0):!1}m();m();function Tl(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 rr=1;var pa=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+rr,this.paddedRect.y+rr]}get br(){return[this.paddedRect.x+this.paddedRect.w-rr,this.paddedRect.y+this.paddedRect.h-rr]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-rr*2)/this.pixelRatio,(this.paddedRect.h-rr*2)/this.pixelRatio]}},by=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}=Tl(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+rr,y:p.y+rr},c.data)}for(let u in r){let c=r[u],p=i[u].paddedRect,h=p.x+rr,f=p.y+rr,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*rr,h:o.data.height+2*rr};n.push(a),r[i]=new pa(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",pa);X("ImageAtlas",by);var uo=(i=>(i[i.none=0]="none",i[i.horizontal=1]="horizontal",i[i.vertical=2]="vertical",i[i.horizontalOnly=3]="horizontalOnly",i))(uo||{});function Op(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 r1=se(bl(),1);m();var e1=255,Sl=128,Bp=e1*Sl;function _y(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 ha(t,{uSize:e,uSizeT:r},{lowerSize:n,upperSize:i}){return t.kind==="source"?n/Sl:t.kind==="composite"?Fe.number(n/Sl,i/Sl,r):e}function co(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(jt.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 fa(t,e,r){let n="never",i=t.get(e);return i?n=i:t.get(r)&&(n="always"),n}var UF=r1.default.VectorTileFeature.types,NF=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function zp(t,e,r,n,i,o,a,s,l,u,c,p,h){let f=s?Math.min(Bp,Math.round(s[0])):0,d=s?Math.min(Bp,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 po(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 GF(t){for(let e of t.sections)if(wv(e.text))return!0;return!1}var Ml=class{constructor(e){this.layoutVertexArray=new ap,this.indexArray=new Qe,this.programConfigurations=e,this.segments=new de,this.dynamicLayoutVertexArray=new sp,this.opacityVertexArray=new lp,this.hasVisibleVertices=!1,this.placedSymbolArray=new Js}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,B0.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,z0.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,NF,!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",Ml);var Il=class{constructor(e,r,n){this.layoutVertexArray=new e,this.layoutAttributes=r,this.indexArray=new n,this.segments=new de,this.collisionVertexArray=new cp}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,V0.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}};X("CollisionBuffers",Il);var $r=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=_y(this.zoom,n["text-size"]),this.iconSizeData=_y(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=fa(i,"text-overlap","text-allow-overlap")!=="never"||fa(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=>uo[l])),this.stateDependentLayerIds=this.layers.filter(l=>l.isStateDependent()).map(l=>l.id),this.sourceID=e.sourceID}createArrays(){this.text=new Ml(new Qt(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new Ml(new Qt(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new el,this.lineVertexArray=new tl,this.symbolInstances=new Qs,this.textAnchorOffsets=new rl}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=j0[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 yr&&!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=tr(x,w);if(!i._featureFilter.filter(g,T,n))continue;w||(T.geometry=er(x));let S;if(u){let L=i.getValueAndResolveTokens("text-field",T,n,d),F=yr.factory(L),O=this.hasRTLText=this.hasRTLText||GF(F);(!O||cn.getRTLTextPluginStatus()==="unavailable"||O&&cn.isParsed())&&(S=N0(F,i,T))}let C;if(c){let L=i.getValueAndResolveTokens("icon-image",T,n,d);L instanceof Jt?C=L:C=Jt.fromString(L)}if(!S&&!C)continue;let A=this.sortFeaturesByKey?p.evaluate(T,{},n):void 0,E={id:b,text:S,icon:C,index:v,sourceLayerIndex:P,geometry:T.geometry,properties:x.properties,type:UF[x.type],sortKey:A};if(this.features.push(E),C&&(h[C.name]=!0),S){let L=a.evaluate(T,{},n).join(","),F=o.get("text-rotation-alignment")!=="viewport"&&o.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(2)>=0;for(let O of S.sections)if(O.image)h[O.image.name]=!0;else{let z=Hd(S.toString()),I=O.fontStack||L,R=f[I]=f[I]||{};this.calculateGlyphDependencies(O.text,R,F,this.allowVerticalPlacement,z)}}}o.get("symbol-placement")==="line"&&(this.features=G0(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:C,br:A,tex:E,pixelOffsetTL:L,pixelOffsetBR:F,minFontScaleX:O,minFontScaleY:z,glyphOffset:I,isSDF:R,sectionIndex:H}=r[w],W=g.vertexLength,$=I[1];zp(d,l.x,l.y,T.x,$+T.y,E.x,E.y,n,R,L.x,L.y,O,z),zp(d,l.x,l.y,S.x,$+S.y,E.x+E.w,E.y,n,R,F.x,L.y,O,z),zp(d,l.x,l.y,C.x,$+C.y,E.x,E.y+E.h,n,R,L.x,F.y,O,z),zp(d,l.x,l.y,A.x,$+A.y,E.x+E.w,E.y+E.h,n,R,F.x,F.y,O,z),po(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(I[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 Cl.default(e,r)),this._addCollisionDebugVertex(c,p,a,h,f,new Cl.default(n,r)),this._addCollisionDebugVertex(c,p,a,h,f,new Cl.default(n,i)),this._addCollisionDebugVertex(c,p,a,h,f,new Cl.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 Il(il,dy.members,ui),this.iconCollisionBox=new Il(il,dy.members,ui);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",$r,{omit:["layers","collisionBoxArray","features","compareText"]});$r.MAX_GLYPHS=65535;$r.addDynamicAttributes=po;m();function n1(t,e){return e.replace(/{([^{}]+)}/g,(r,n)=>t&&n in t?String(t[n]):"")}m();var i1,jF=()=>i1=i1||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"])}),o1,HF=()=>o1=o1||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"])}),Vp={get paint(){return HF()},get layout(){return jF()}};m();var Al=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:Zo,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",Al,{omit:["defaultValue"]});var a1=t=>t.type==="symbol",Up=class t extends it{constructor(e){super(e,Vp)}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()&&!Ds(a.value)&&o?n1(r.properties,o):o}createBucket(e){return new $r(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let e of Vp.paint.overridableProperties){if(!t.hasPaintOverride(this.layout,e))continue;let r=this.paint.get(e),n=new Al(r),i=new Wi(n,r.property.specification),o=null;r.value.kind==="constant"||r.value.kind==="source"?o=new un("source",i):o=new ni("composite",i,r.value.zoomStops),this.paint._values[e]=new Ft(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=Vp.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 yr)a(n.value.value.sections);else if(n.value.kind==="source"){let s=u=>{if(!o)if(u instanceof ti&&ct(u.value)===qo){let c=u.value;a(c.sections)}else u instanceof bs?a(u.sections):u.eachChild(s)},l=n.value;l._styleExpression&&s(l._styleExpression.expression)}return o}};m();m();var s1,XF=()=>s1=s1||new Ue({"background-color":new q(D.paint_background["background-color"]),"background-pattern":new to(D.paint_background["background-pattern"]),"background-opacity":new q(D.paint_background["background-opacity"])}),l1={get paint(){return XF()}};var u1=t=>t.type==="background",Np=class extends it{constructor(e){super(e,l1)}};m();m();var c1,ZF=()=>c1=c1||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"])}),p1={get paint(){return ZF()}};var h1=t=>t.type==="raster",Gp=class extends it{constructor(e){super(e,p1)}};m();function f1(t){let e=[],r=t.id;return r===void 0&&e.push({message:`layers.${r}: missing required property "id"`}),t.render===void 0&&e.push({message:`layers.${r}: missing required method "render"`}),t.renderingMode&&t.renderingMode!=="2d"&&t.renderingMode!=="3d"&&e.push({message:`layers.${r}: property "renderingMode" must be either "2d" or "3d"`}),e}var m1=t=>t.type==="custom",jp=class extends it{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 Hp(t){if(t.type==="custom")return new jp(t);switch(t.type){case"background":return new Np(t);case"circle":return new xp(t);case"color-relief":return new Pp(t);case"fill":return new Ip(t);case"fill-extrusion":return new Lp(t);case"heatmap":return new _p(t);case"hillshade":return new vp(t);case"line":return new Rp(t);case"raster":return new Gp(t);case"symbol":return new Up(t)}}m();m();function ma(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=`${n}${i}`;r.indexOf(o)===-1&&(r.push(o),e.push({id:n,url:i}))}}return e}function d1(t,e,r){try{let n=new URL(t);return n.pathname+=`${e}${r}`,n.toString()}catch{throw new Error(`Invalid sprite URL "${t}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}async function y1(t,e,r,n){let i=ma(t),o=r>1?"@2x":"",a={},s={};for(let{id:l,url:u}of i){let c=e.transformRequest(d1(u,o,".json"),"SpriteJSON");a[l]=Kn(c,n);let p=e.transformRequest(d1(u,o,".png"),"SpriteImage");s[l]=Gt.getImage(p,n)}return await Promise.all([...Object.values(a),...Object.values(s)]),qF(a,s)}async function qF(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 Xp=1,Zp=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 ${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 "${e}" has invalid "stretchX" value`))),n=!1),this._validateStretch(r.stretchY,i&&i.height)||(this.fire(new Q(new Error(`Image "${e}" has invalid "stretchY" value`))),n=!1),this._validateContent(r.content,r)||(this.fire(new Q(new Error(`Image "${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 (${i.data.width}x${i.data.height}) and new image (${r.data.width}x${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 "${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+Xp*2,o=n.data.height+Xp*2,a={w:i,h:o,x:0,y:0},s=new pa(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}=Tl(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+Xp,l=a.y+Xp,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: "${r}" was not found`),Q0(n)&&this.updateImage(r,n)}}};m();m();async function g1(t,e,r,n){let i=e*256,o=i+255,a=n.transformRequest(r.replace("{fontstack}",t).replace("{range}",`${i}-${o}`),"Glyphs"),s=await e_(a,new AbortController);if(!s||!s.data)throw new Error(`Could not load glyph range. range: ${e}, ${i}-${o}`);let l={};for(let u of J0(s.data))l[u.id]=u;return l}m();var El=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=`${s} ${a} ${e}px ${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 C=w.data[4*(T*u+S)+3]/255;if(C===0)continue;let A=(T+b)*p+S+b;if(C===1)P[A]=0,v[A]=1e20;else{let E=.5-C;P[A]=E>0?E*E:0,v[A]=E<0?E*E:0}}x1(P,0,0,p,h,p,this.f,this.v,this.z),x1(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 x1(t,e,r,n,i,o,a,s,l){for(let u=e;u<e+n;u++)b1(t,r*o+u,o,i,a,s,l);for(let u=r;u<r+i;u++)b1(t,u*o+e,1,n,a,s,l)}function b1(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 da=class da{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=da.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&&(/\p{Ideo}|\p{sc=Hang}|\p{sc=Hira}|\p{sc=Kana}/u.test(String.fromCodePoint(e))||ht["CJK Unified Ideographs"](e)||ht["Hangul Syllables"](e)||ht.Hiragana(e)||ht.Katakana(e)||ht["CJK Symbols and Punctuation"](e)||ht["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 da.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 so({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}}}};da.loadGlyphRange=g1,da.TinySDF=El;var qp=da;m();var Py=class{constructor(){this.specification=D.light.position}possiblyEvaluate(e,r){return Vb(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)}}},_1="-transition",vy,Yp=class extends Ee{constructor(e){super(),vy=vy||new Ue({anchor:new q(D.light.anchor),position:new Py,color:new q(D.light.color),intensity:new q(D.light.intensity)}),this._transitionable=new pn(vy),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,r={}){if(!this._validate(dv,e,r))for(let n in e){let i=e[n];n.endsWith(_1)?this._transitionable.setTransition(n.slice(0,-_1.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:oi(this,e.call(Je,{value:r,style:{glyphs:!0,sprite:!0},styleSpec:D}))}};m();var YF=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"])}),v1="-transition",Wp=class extends Ee{constructor(e){super(),this._transitionable=new pn(YF),this.setSky(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new Te(0))}setSky(e,r={}){if(!this._validate(yv,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(v1)?this._transitionable.setTransition(n.slice(0,-v1.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?.validate===!1?!1:oi(this,e.call(Je,Z({value:r,style:{glyphs:!0,sprite:!0},styleSpec:D})))}calculateFogBlendOpacity(e){return e<60?0:e<70?(e-60)/10:1}};m();var $p=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 Kp=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 WF={once:!0},Jp=class{constructor(e,r){this.target=e,this.mapId=r,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Kp(()=>this.process()),this.subscription=ss(this.target,"message",n=>this.receive(n),!1),this.globalScope=Tn(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?ss(r.signal,"abort",()=>{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)},WF):null;this.resolveRejects[o]={resolve:u=>{a?.unsubscribe(),n(u)},reject:u=>{a?.unsubscribe(),i(u)}};let s=[],l={...e,id:o,sourceMapId:this.mapId,origin:location.origin,data:$o(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(Tn(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(Ko(r.error)):o.resolve(Ko(r.data));return}if(!this.messageHandlers[r.type]){this.completeTask(e,new Error(`Could not find a registered handler for ${r.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));return}let n=Ko(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?$o(r):null,data:$o(n,i)};this.target.postMessage(o,{transfer:i})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}};m();m();m();m();var P1='(()=>{var Uy=Object.create;var ss=Object.defineProperty;var $y=Object.getOwnPropertyDescriptor;var jy=Object.getOwnPropertyNames;var qy=Object.getPrototypeOf,Wy=Object.prototype.hasOwnProperty;var ve=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Xy=(t,e)=>{for(var r in e)ss(t,r,{get:e[r],enumerable:!0})},Hy=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of jy(e))!Wy.call(t,i)&&i!==r&&ss(t,i,{get:()=>e[i],enumerable:!(n=$y(e,i))||n.enumerable});return t};var Y=(t,e,r)=>(r=t!=null?Uy(qy(t)):{},Hy(e||!t||!t.__esModule?ss(r,"default",{value:t,enumerable:!0}):r,t));var ye=ve((p0,au)=>{"use strict";au.exports=hr;function hr(t,e){this.x=t,this.y=e}hr.prototype={clone:function(){return new hr(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}};hr.convert=function(t){return t instanceof hr?t:Array.isArray(t)?new hr(t[0],t[1]):t}});var uu=ve((f0,lu)=>{"use strict";lu.exports=su;function su(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}su.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 op=ve((Ov,el)=>{function Sg(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 el<"u"&&(el.exports=Sg)});var ap=ve((Gv,tl)=>{function wg(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 tl!==void 0&&(tl.exports=wg)});var rl=ve((Nv,ta)=>{var sp=op(),Ag=ap();ta.exports=sp;ta.exports.murmur3=sp;ta.exports.murmur2=Ag});var dl=ve((MS,jp)=>{"use strict";var cb=ye();jp.exports=Rr;function Rr(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(pb,this,e)}function pb(t,e,r){t==1?e.id=r.readVarint():t==2?fb(r,e):t==3?e.type=r.readVarint():t==4&&(e._geometry=r.pos)}function fb(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}}Rr.types=["Unknown","Point","LineString","Polygon"];Rr.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 cb(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};Rr.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]};Rr.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=Rr.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=yb(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 yb(t){var e=t.length;if(e<=1)return[t];for(var r=[],n,i,o=0;o<e;o++){var a=mb(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 mb(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 gl=ve((LS,Wp)=>{"use strict";var hb=dl();Wp.exports=qp;function qp(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(db,this,e),this.length=this._features.length}function db(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(gb(r))}function gb(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}qp.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 hb(this._pbf,e,this.extent,this._keys,this._values)}});var Hp=ve((DS,Xp)=>{"use strict";var bb=gl();Xp.exports=xb;function xb(t,e){this.layers=t.readFields(vb,{},e)}function vb(t,e,r){if(t===3){var n=new bb(r,r.readVarint()+r.pos);n.length&&(e[n.name]=n)}}});var Rt=ve((BS,xa)=>{xa.exports.VectorTile=Hp();xa.exports.VectorTileFeature=dl();xa.exports.VectorTileLayer=gl()});var df=ve(Sl=>{Sl.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)};Sl.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 mi=ve((fA,Pf)=>{"use strict";Pf.exports=J;var Aa=df();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 wl=65536*65536,gf=1/wl,Ob=12,vf=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=_a(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=xf(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=_a(this.buf,this.pos)+_a(this.buf,this.pos+4)*wl;return this.pos+=8,t},readSFixed64:function(){var t=_a(this.buf,this.pos)+xf(this.buf,this.pos+4)*wl;return this.pos+=8,t},readFloat:function(){var t=Aa.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=Aa.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,Gb(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>=Ob&&vf?ex(this.buf,e,t):Qb(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),Gr(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),Gr(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),Gr(this.buf,t&-1,this.pos),Gr(this.buf,Math.floor(t*gf),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),Gr(this.buf,t&-1,this.pos),Gr(this.buf,Math.floor(t*gf),this.pos+4),this.pos+=8},writeVarint:function(t){if(t=+t||0,t>268435455||t<0){Nb(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=tx(this.buf,t,this.pos);var r=this.pos-e;r>=128&&bf(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),Aa.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),Aa.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&&bf(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,jb,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,qb,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,Hb,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,Wb,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,Xb,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,Zb,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,Jb,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,Yb,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,Kb,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 Gb(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 Or(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 Or(t,e,r){return r?e*4294967296+(t>>>0):(e>>>0)*4294967296+(t>>>0)}function Nb(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),Ub(r,n,e),$b(n,e)}function Ub(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 $b(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 bf(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 jb(t,e){for(var r=0;r<t.length;r++)e.writeVarint(t[r])}function qb(t,e){for(var r=0;r<t.length;r++)e.writeSVarint(t[r])}function Wb(t,e){for(var r=0;r<t.length;r++)e.writeFloat(t[r])}function Xb(t,e){for(var r=0;r<t.length;r++)e.writeDouble(t[r])}function Hb(t,e){for(var r=0;r<t.length;r++)e.writeBoolean(t[r])}function Zb(t,e){for(var r=0;r<t.length;r++)e.writeFixed32(t[r])}function Jb(t,e){for(var r=0;r<t.length;r++)e.writeSFixed32(t[r])}function Yb(t,e){for(var r=0;r<t.length;r++)e.writeFixed64(t[r])}function Kb(t,e){for(var r=0;r<t.length;r++)e.writeSFixed64(t[r])}function _a(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+t[e+3]*16777216}function Gr(t,e,r){t[r]=e,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function xf(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function Qb(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 ex(t,e,r){return vf.decode(t.subarray(e,r))}function tx(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 gy=ve((iT,dy)=>{dy.exports=Ha;function Ha(t,e){var r=t&&t.type,n;if(r==="FeatureCollection")for(n=0;n<t.features.length;n++)Ha(t.features[n],e);else if(r==="GeometryCollection")for(n=0;n<t.geometries.length;n++)Ha(t.geometries[n],e);else if(r==="Feature")Ha(t.geometry,e);else if(r==="Polygon")my(t.coordinates,e);else if(r==="MultiPolygon")for(n=0;n<t.coordinates.length;n++)my(t.coordinates[n],e);return t}function my(t,e){if(t.length!==0){hy(t[0],e);for(var r=1;r<t.length;r++)hy(t[r],!e)}}function hy(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 Py=ve((sT,vy)=>{"use strict";var Ux=ye(),$x=Rt().VectorTileFeature;vy.exports=xy;function xy(t,e){this.options=e||{},this.features=t,this.length=t.length}xy.prototype.feature=function(t){return new Ja(this.features[t],this.options.extent)};function Ja(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}Ja.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 Ux(r[i][0],r[i][1]));this.geometry.push(n)}return this.geometry};Ja.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]};Ja.prototype.toGeoJSON=$x.prototype.toGeoJSON});var Ay=ve((lT,Li)=>{var jx=mi(),wy=Py();Li.exports=Ul;Li.exports.fromVectorTileJs=Ul;Li.exports.fromGeojsonVt=qx;Li.exports.GeoJSONWrapper=wy;function Ul(t){var e=new jx;return Wx(t,e),e.finish()}function qx(t,e){e=e||{};var r={};for(var n in t)r[n]=new wy(t[n].features,e),r[n].name=n,r[n].version=e.version,r[n].extent=e.extent;return Ul({layers:r})}function Wx(t,e){for(var r in t.layers)e.writeMessage(3,Xx,t.layers[r])}function Xx(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,Hx,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,Yx,o[r])}function Hx(t,e){var r=t.feature;r.id!==void 0&&e.writeVarintField(1,r.id),e.writeMessage(2,Zx,t),e.writeVarintField(3,r.type),e.writeMessage(4,Jx,r)}function Zx(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 Nl(t,e){return(e<<3)+(t&7)}function Sy(t){return t<<1^t>>31}function Jx(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(Nl(1,u));for(var c=n===3?l.length-1:l.length,p=0;p<c;p++){p===1&&n!==1&&e.writeVarint(Nl(2,c-1));var f=l[p].x-i,y=l[p].y-o;e.writeVarint(Sy(f)),e.writeVarint(Sy(y)),i+=f,o+=y}n===3&&e.writeVarint(Nl(7,1))}}function Yx(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 km=Y(ye(),1),Pu=Y(uu(),1);var ls;function cu(){return ls==null&&(ls=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),ls}var qi;function pu(){if(qi==null&&(qi=!1,cu())){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(${o},${o+1},${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){qi=!0;break}}}return qi||!1}var Jr=1e-6,Yr=typeof Float32Array<"u"?Float32Array:Array,Kr=Math.random;var d0=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 Wi={};Xy(Wi,{add:()=>em,ceil:()=>tm,clone:()=>Jy,copy:()=>Ky,create:()=>fu,cross:()=>fm,dist:()=>Am,distance:()=>du,div:()=>wm,divide:()=>hu,dot:()=>pm,equals:()=>vm,exactEquals:()=>xm,floor:()=>rm,forEach:()=>Cm,fromValues:()=>Yy,inverse:()=>um,len:()=>Im,length:()=>bu,lerp:()=>ym,max:()=>im,min:()=>nm,mul:()=>Sm,multiply:()=>mu,negate:()=>lm,normalize:()=>cm,random:()=>mm,round:()=>om,scale:()=>am,scaleAndAdd:()=>sm,set:()=>Qy,sqrDist:()=>_m,sqrLen:()=>Tm,squaredDistance:()=>gu,squaredLength:()=>xu,str:()=>bm,sub:()=>Pm,subtract:()=>yu,transformMat4:()=>hm,transformQuat:()=>dm,zero:()=>gm});function fu(){var t=new Yr(4);return Yr!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function Jy(t){var e=new Yr(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function Yy(t,e,r,n){var i=new Yr(4);return i[0]=t,i[1]=e,i[2]=r,i[3]=n,i}function Ky(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function Qy(t,e,r,n,i){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t}function em(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 yu(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 mu(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 hu(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 tm(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 rm(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 nm(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 im(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 om(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 am(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 sm(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 du(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 gu(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 bu(t){var e=t[0],r=t[1],n=t[2],i=t[3];return Math.hypot(e,r,n,i)}function xu(t){var e=t[0],r=t[1],n=t[2],i=t[3];return e*e+r*r+n*n+i*i}function lm(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t}function um(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 cm(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 pm(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}function fm(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 ym(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 mm(t,e){e=e||1;var r,n,i,o,a,s;do r=Kr()*2-1,n=Kr()*2-1,a=r*r+n*n;while(a>=1);do i=Kr()*2-1,o=Kr()*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 hm(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 dm(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 gm(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t}function bm(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}function xm(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]}function vm(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)<=Jr*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(n-s)<=Jr*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-l)<=Jr*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(o-u)<=Jr*Math.max(1,Math.abs(o),Math.abs(u))}var Pm=yu,Sm=mu,wm=hu,Am=du,_m=gu,Im=bu,Tm=xu,Cm=function(){var t=fu();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 Su(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 Fm(t,e,r,n){let i=new Pu.default(t,e,r,n);return o=>i.solve(o)}var A0=Fm(.25,.1,.25,1);function it(t,e,r){return Math.min(r,Math.max(e,t))}function wu(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 Au(t){return Math.log(t)/Math.LN2%1===0}function tn(t,e,r){let n={};for(let i in t)n[i]=e.call(r||this,t[i],i,t);return n}function _u(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?tn(t,nt):t}var vu={};function ce(t){vu[t]||(typeof console<"u"&&console.warn(t),vu[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 Em(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 Mm(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?.format;if(!a||!(a.startsWith("BGR")||a.startsWith("RGB")))throw new Error(`Unrecognized format ${a}`);let s=a.startsWith("BGR"),l=new Uint8ClampedArray(n*i*4);if(await o.copyTo(l,Em(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 Qr,en;function Lm(t,e,r,n,i){let o=t.width,a=t.height;(!Qr||!en)&&(Qr=new OffscreenCanvas(o,a),en=Qr.getContext("2d",{willReadFrequently:!0})),Qr.width=o,Qr.height=a,en.drawImage(t,0,0,o,a);let s=en.getImageData(e,r,n,i);return en.clearRect(0,0,o,a),s.data}async function Iu(t,e,r,n,i){if(pu())try{return await Mm(t,e,r,n,i)}catch{}return Lm(t,e,r,n,i)}function us(t,e,r,n){return t.addEventListener(e,r,n),{unsubscribe:()=>{t.removeEventListener(e,r,n)}}}function cs(t){return t*Math.PI/180}var Xi=25,Hi=0;var $t=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 Dm=8,Bm={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"}},Vm={"*":{type:"source"}},Rm=["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],zm={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:"*"}},Om={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:"*"}},Gm={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:"*"}},Nm={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"}},Um={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"}}},$m={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"}}},jm={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"}},qm=["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],Wm={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Xm={"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"}},Hm={"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"}},Zm={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Jm={"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"}},Ym={"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"}},Km={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Qm={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},eh={type:"array",value:"*"},th={type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},rh={type:"enum",values:{Point:{},LineString:{},Polygon:{}}},nh={type:"array",minimum:0,maximum:24,value:["number","color"],length:2},ih={type:"array",value:"*",minimum:1},oh={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}},ah={"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}},sh={source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},lh={type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},uh=["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],ch={"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"}},ph={"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"}},fh={"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"}},yh={"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"}},mh={"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"}},hh={"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"}},dh={"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"}},gh={"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"}},bh={duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},xh={"*":{type:"string"}},P={$version:Dm,$root:Bm,sources:Vm,source:Rm,source_vector:zm,source_raster:Om,source_raster_dem:Gm,source_geojson:Nm,source_video:Um,source_image:$m,layer:jm,layout:qm,layout_background:Wm,layout_fill:Xm,layout_circle:Hm,layout_heatmap:Zm,"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:Jm,layout_symbol:Ym,layout_raster:Km,layout_hillshade:Qm,"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:eh,filter_operator:th,geometry_type:rh,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:nh,expression:ih,light:oh,sky:ah,terrain:sh,projection:lh,paint:uh,paint_fill:ch,"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:ph,paint_circle:fh,paint_heatmap:yh,paint_symbol:mh,paint_raster:hh,paint_hillshade:dh,"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:gh,transition:bh,"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:xh},vh=["type","source","source-layer","minzoom","maxzoom","filter","layout"];var C=class{constructor(e,r,n,i){this.message=(e?`${e}: `:"")+n,i&&(this.identifier=i),r!=null&&r.__line__&&(this.line=r.__line__)}};function xr(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}},vs=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(`${e} not found in scope.`)}has(e){return this.bindings[e]?!0:this.parent?this.parent.has(e):!1}},wr={kind:"null"},k={kind:"number"},$={kind:"string"},U={kind:"boolean"},ze={kind:"color"},yo={kind:"projectionDefinition"},Wt={kind:"object"},N={kind:"value"},Ph={kind:"error"},mo={kind:"collator"},Ar={kind:"formatted"},ho={kind:"padding"},an={kind:"colorArray"},go={kind:"numberArray"},vn={kind:"resolvedImage"},bo={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<${e}, ${t.N}>`:t.itemType.kind==="value"?"array":`array<${e}>`}else return t.kind}var Sh=[wr,k,$,U,ze,yo,Ar,Wt,Ce(N),ho,go,an,vn,bo];function sn(t,e){if(e.kind==="error")return null;if(t.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!sn(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 Sh)if(!sn(r,e))return null}}return`Expected ${ie(t)} but found ${ie(e)} instead.`}function zs(t,e){return e.some(r=>r.kind===t.kind)}function Xt(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 Xu=.96422,Hu=1,Zu=.82521,Ju=4/29,br=6/29,Yu=3*br*br,wh=br*br*br,Ah=Math.PI/180,_h=180/Math.PI;function Ku(t){return t=t%360,t<0&&(t+=360),t}function Qu([t,e,r,n]){t=ps(t),e=ps(e),r=ps(r);let i,o,a=fs((.2225045*t+.7168786*e+.0606169*r)/Hu);t===e&&e===r?i=o=a:(i=fs((.4360747*t+.3850649*e+.1430804*r)/Xu),o=fs((.0139322*t+.0971045*e+.7141733*r)/Zu));let s=116*a-16;return[s<0?0:s,500*(i-a),200*(a-o),n]}function ps(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function fs(t){return t>wh?Math.pow(t,1/3):t/Yu+Ju}function ec([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=Hu*ms(i),o=Xu*ms(o),a=Zu*ms(a),[ys(3.1338561*o-1.6168667*i-.4906146*a),ys(-.9787684*o+1.9161415*i+.033454*a),ys(.0719453*o-.2289914*i+1.4052427*a),n]}function ys(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 ms(t){return t>br?t*t*t:Yu*(t-Ju)}function Ih(t){let[e,r,n,i]=Qu(t),o=Math.sqrt(r*r+n*n);return[Math.round(o*1e4)?Ku(Math.atan2(n,r)*_h):NaN,o,e,i]}function Th([t,e,r,n]){return t=isNaN(t)?0:t*Ah,ec([r,Math.cos(t)*e,Math.sin(t)*e,n])}function Ch([t,e,r,n]){t=Ku(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 kh=Object.hasOwn||function(e,r){return Object.prototype.hasOwnProperty.call(e,r)};function nn(t,e){return kh(t,e)?t[e]:void 0}function Fh(t){if(t=t.toLowerCase().trim(),t==="transparent")return[0,0,0,0];let e=nn(Eh,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[Zi(t.slice(a,a+=o)),Zi(t.slice(a,a+=o)),Zi(t.slice(a,a+=o)),Zi(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,x=[u||" ",f||" ",h].join("");if(x===" "||x===" /"||x===",,"||x===",,,"){let b=[l,p,m].join(""),v=b==="%%%"?100:b===""?255:0;if(v){let S=[dr(+s/v,0,1),dr(+c/v,0,1),dr(+y/v,0,1),g?Tu(+g,d):1];if(Cu(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,dr(+s,0,100),dr(+u,0,100),p?Tu(+p,f):1];if(Cu(m))return Ch(m)}}}function Zi(t){return parseInt(t.padEnd(2,t),16)/255}function Tu(t,e){return dr(e?t/100:t,0,1)}function dr(t,e,r){return Math.min(Math.max(e,t),r)}function Cu(t){return!t.some(Number.isNaN)}var Eh={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 vr(t,e,r){return t.map((n,i)=>wt(n,e[i],r))}function Mh(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=Fh(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",Ih(this.rgb))}get lab(){return this.overwriteGetter("lab",Qu(this.rgb))}overwriteGetter(e,r){return Object.defineProperty(this,e,{value:r}),r}toString(){let[e,r,n,i]=this.rgb;return`rgba(${[e,r,n].map(o=>Math.round(o*255)).join(",")},${i})`}static interpolate(e,r,n,i="rgb"){switch(i){case"rgb":{let[o,a,s,l]=vr(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 b=u-o;u>o&&b>180?b-=360:u<o&&o-u>180&&(b+=360),y=o+n*b}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,x]=Th([y,m??wt(a,c,n),wt(s,p,n),wt(l,f,n)]);return new t(h,g,d,x,!1)}case"lab":{let[o,a,s,l]=ec(vr(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 ln=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}},Lh=["bottom","center","top"],un=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 un(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(vr(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(vr(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 (${e.values.length} vs. ${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}},Dh=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"||!Dh.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: ${e.toString()}, to: ${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[${s}]: ${i[s]}, to[${s}]: ${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 tc(t,e,r,n){return typeof t=="number"&&t>=0&&t<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof r=="number"&&r>=0&&r<=255?typeof n>"u"||typeof n=="number"&&n>=0&&n<=1?null:`Invalid rgba value [${[t,e,r,n].join(", ")}]: \'a\' must be between 0 and 1.`:`Invalid rgba value [${(typeof n=="number"?[t,e,r,n]:[t,e,r]).join(", ")}]: \'r\', \'g\', and \'b\' must be between 0 and 255.`}function cn(t){if(t===null||typeof t=="string"||typeof t=="boolean"||typeof t=="number"||t instanceof At||t instanceof H||t instanceof ln||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(!cn(e))return!1;return!0}else if(typeof t=="object"){for(let e in t)if(!cn(t[e]))return!1;return!0}else return!1}function ue(t){if(t===null)return wr;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 yo;if(t instanceof ln)return mo;if(t instanceof Fe)return Ar;if(t instanceof Oe)return ho;if(t instanceof Ge)return go;if(t instanceof Pe)return an;if(t instanceof Ee)return bo;if(t instanceof Se)return vn;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 Wt}function on(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 ${e.length-1} instead.`);if(!cn(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}},Ji={string:$,number:k,boolean:U,object:Wt},$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 Ji)||u==="object")return r.error(\'The item type argument of "array" must be one of string, number, boolean\',1);s=Ji[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(!Ji[o])throw new Error(`Types doesn\'t contain name = ${o}`);i=Ji[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(sn(this.type,ue(n))){if(r===this.args.length-1)throw new ne(`Expected value to be of type ${ie(this.type)}, but found ${ie(ue(n))} instead.`)}else return n}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},ku={"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(!ku[n])throw new Error(`Can\'t parse ${n} as it is not part of the known types`);if((n==="to-boolean"||n==="to-string")&&e.length!==2)return r.error("Expected one argument.");let i=ku[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 ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:n=tc(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 \'${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 \'${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 \'${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 \'${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 \'${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 ${JSON.stringify(r)} to number.`)}case"formatted":return Fe.fromString(on(this.args[0].evaluate(e)));case"resolvedImage":return Se.fromString(on(this.args[0].evaluate(e)));case"projectionDefinition":return this.args[0].evaluate(e);default:return on(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},Bh=["Unknown","Point","LineString","Polygon"],eo=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"?Bh[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}},to=class t{constructor(e,r,n=[],i,o=new vs,a=[]){this.registry=e,this.path=n,this.key=n.map(s=>`[${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 ${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 eo;try{a=new _t(a.type,a.evaluate(s))}catch(l){return this.error(l.message),null}}return a}return this.error(`Unknown expression "${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 ${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=`${this.key}${r.map(i=>`[${i}]`).join("")}`;this.errors.push(new Ve(n,e))}checkSubtype(e,r){let n=sn(e,r);return n&&this.error(n),n}},ro=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 ${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 ${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()}},no=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 "${n}". Make sure "${n}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}},Ps=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 ${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: ${r} < 0.`);if(r>=n.length)throw new ne(`Array index out of bounds: ${r} > ${n.length-1}.`);if(r!==Math.floor(r))throw new ne(`Array index must be an integer, but found ${r} instead.`);return n[r]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}},Ss=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 ${e.length-1} instead.`);let n=r.parse(e[1],1,N),i=r.parse(e[2],2,N);return!n||!i?null:zs(n.type,[U,$,k,wr,N])?new t(n,i):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${ie(n.type)} instead`)}evaluate(e){let r=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!n)return!1;if(!Xt(r,["boolean","string","number","null"]))throw new ne(`Expected first argument to be of type boolean, string, number or null, but found ${ie(ue(r))} instead.`);if(!Xt(n,["string","array"]))throw new ne(`Expected second argument to be of type array or string, but found ${ie(ue(n))} instead.`);return n.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}},ws=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 ${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(!zs(n.type,[U,$,k,wr,N]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${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(!Xt(r,["boolean","string","number","null"]))throw new ne(`Expected first argument to be of type boolean, string, number or null, but found ${ie(ue(r))} instead.`);let i;if(this.fromIndex&&(i=this.fromIndex.evaluate(e)),Xt(n,["string"])){let o=n.indexOf(r,i);return o===-1?-1:[...n.slice(0,o)].length}else{if(Xt(n,["array"]))return n.indexOf(r,i);throw new ne(`Expected second argument to be of type array or string, but found ${ie(ue(n))} instead.`)}}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}},As=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 ${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 ${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()}},_s=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 ${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()}},Is=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 ${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(!zs(n.type,[Ce(N),$,N]))return r.error(`Expected first argument to be of type array or string, but found ${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)),Xt(r,["string"]))return[...r].slice(n,i).join("");if(Xt(r,["array"]))return r.slice(n,i);throw new ne(`Expected first argument to be of type array or string, but found ${ie(ue(r))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}};function xo(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 Pr=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 ${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=xo(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 Vh(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var hs,Fu;function Rh(){if(Fu)return hs;Fu=1,hs=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))}},hs}var zh=Rh(),Oh=Vh(zh),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=ds(r,e.base,n,i);else if(e.name==="linear")o=ds(r,1,n,i);else if(e.name==="cubic-bezier"){let a=e.controlPoints;o=new Oh(a[0],a[1],a[2],a[3]).solve(ds(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 ${String(i[0])}`,1,0);if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${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!=an?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,yo)&&!Pt(l,ze)&&!Pt(l,ho)&&!Pt(l,go)&&!Pt(l,an)&&!Pt(l,bo)&&!Pt(l,Ce(k))?r.error(`Type ${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=xo(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 vr(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 ds(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:vr},io=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=>sn(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 Eu(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 Gh(t,e,r){return e===r}function Nh(t,e,r){return e!==r}function Uh(t,e,r){return e<r}function $h(t,e,r){return e>r}function jh(t,e,r){return e<=r}function qh(t,e,r){return e>=r}function rc(t,e,r,n){return n.compare(e,r)===0}function Wh(t,e,r,n){return!rc(t,e,r,n)}function Xh(t,e,r,n){return n.compare(e,r)<0}function Hh(t,e,r,n){return n.compare(e,r)>0}function Zh(t,e,r,n){return n.compare(e,r)<=0}function Jh(t,e,r,n){return n.compare(e,r)>=0}function _r(t,e,r){let n=t!=="=="&&t!=="!=";return class nc{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(!Eu(s,l.type))return a.concat(1).error(`"${s}" comparisons are not supported for type \'${ie(l.type)}\'.`);let u=a.parse(o[2],2,N);if(!u)return null;if(!Eu(s,u.type))return a.concat(2).error(`"${s}" comparisons are not supported for type \'${ie(u.type)}\'.`);if(l.type.kind!==u.type.kind&&l.type.kind!=="value"&&u.type.kind!=="value")return a.error(`Cannot compare types \'${ie(l.type)}\' and \'${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,mo),!c)return null}return new nc(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 "${t}" to be (string, string) or (number, number), but found (${l.kind}, ${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 Yh=_r("==",Gh,rc),Kh=_r("!=",Nh,Wh),Qh=_r("<",Uh,Xh),ed=_r(">",$h,Hh),td=_r("<=",jh,Zh),rd=_r(">=",qh,Jh),oo=class t{constructor(e,r,n){this.type=mo,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 ln(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}},Ts=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}},pn=class t{constructor(e){this.type=Ar,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"&&!Lh.includes(s["vertical-align"]))return r.error(`\'vertical-align\' must be one of: \'bottom\', \'center\', \'top\' but found \'${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)===vn?new un("",i,null,null,null,n.verticalAlign?n.verticalAlign.evaluate(e):null):new un(on(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}},Cs=class t{constructor(e){this.type=vn,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}},ks=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 ${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 ${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 ${ie(ue(r))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}},He=8192;function nd(t,e){let r=id(t[0]),n=ad(t[1]),i=Math.pow(2,e.z);return[Math.round(r*i*He),Math.round(n*i*He)]}function Os(t,e){let r=Math.pow(2,e.z),n=(t[0]/He+e.x)/r,i=(t[1]/He+e.y)/r;return[od(n),sd(i)]}function id(t){return(180+t)/360}function od(t){return t*360-180}function ad(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function sd(t){return 360/Math.PI*Math.atan(Math.exp((180-t*360)*Math.PI/180))-90}function Pn(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 fn(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function ld(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 ud(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 vo(t,e,r,n){let i=[e[0]-t[0],e[1]-t[1]],o=[n[0]-r[0],n[1]-r[1]];return yd(o,i)===0?!1:!!(Mu(t,e,r,n)&&Mu(r,n,t,e))}function cd(t,e,r){for(let n of r)for(let i=0;i<n.length-1;++i)if(vo(t,e,n[i],n[i+1]))return!0;return!1}function Ir(t,e,r=!1){let n=!1;for(let i of e)for(let o=0;o<i.length-1;o++){if(ud(t,i[o],i[o+1]))return r;ld(t,i[o],i[o+1])&&(n=!n)}return n}function pd(t,e){for(let r of e)if(Ir(t,r))return!0;return!1}function ic(t,e){for(let r of t)if(!Ir(r,e))return!1;for(let r=0;r<t.length-1;++r)if(cd(t[r],t[r+1],e))return!1;return!0}function fd(t,e){for(let r of e)if(ic(t,r))return!0;return!1}function yd(t,e){return t[0]*e[1]-t[1]*e[0]}function Mu(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 Gs(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=nd(t[i][a],r);Pn(e,s),o.push(s)}n.push(o)}return n}function oc(t,e,r){let n=[];for(let i=0;i<t.length;i++){let o=Gs(t[i],e,r);n.push(o)}return n}function ac(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}Pn(e,t)}function md(t){t[0]=t[1]=1/0,t[2]=t[3]=-1/0}function Lu(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]];ac(u,e,r,i),a.push(u)}return a}function Du(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]];Pn(e,c),l.push(c)}a.push(l)}if(e[2]-e[0]<=i/2){md(e);for(let s of a)for(let l of s)ac(l,e,r,i)}return a}function hd(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=Gs(e.coordinates,n,i),a=Lu(t.geometry(),r,n,i);if(!fn(r,n))return!1;for(let s of a)if(!Ir(s,o))return!1}if(e.type==="MultiPolygon"){let o=oc(e.coordinates,n,i),a=Lu(t.geometry(),r,n,i);if(!fn(r,n))return!1;for(let s of a)if(!pd(s,o))return!1}return!0}function dd(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=Gs(e.coordinates,n,i),a=Du(t.geometry(),r,n,i);if(!fn(r,n))return!1;for(let s of a)if(!ic(s,o))return!1}if(e.type==="MultiPolygon"){let o=oc(e.coordinates,n,i),a=Du(t.geometry(),r,n,i);if(!fn(r,n))return!1;for(let s of a)if(!fd(s,o))return!1}return!0}var yn=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 ${e.length-1} instead.`);if(cn(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 hd(e,this.geometries);if(e.geometryType()==="LineString")return dd(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}},ao=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 sc(t,e,r=0,n=t.length-1,i=gd){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));sc(t,e,y,m,i)}let o=t[e],a=r,s=n;for(rn(t,r,e),i(t[n],o)>0&&rn(t,r,n);a<s;){for(rn(t,a,s),a++,s--;i(t[a],o)<0;)a++;for(;i(t[s],o)>0;)s--}i(t[r],o)===0?rn(t,r,s):(s++,rn(t,s,n)),s<=e&&(r=s+1),e<=s&&(n=s-1)}}function rn(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}function gd(t,e){return t<e?-1:t>e?1:0}function Yt(t,e){if(t.length<=1)return[t];let n=[],i,o;for(let a of t){let s=xd(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||(sc(n[a],e,1,n[a].length-1,bd),n[a]=n[a].slice(0,e));return n}function bd(t,e){return e.area-t.area}function xd(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 vd=6378.137,Bu=1/298.257223563,Vu=Bu*(2-Bu),Ru=Math.PI/180,mn=class{constructor(e){let r=Ru*vd*1e3,n=Math.cos(e*Ru),i=1/(1-Vu*(1-n*n)),o=Math.sqrt(i);this.kx=r*o*n,this.ky=r*o*i*(1-Vu)}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}},Fs=100,Es=50;function lc(t,e){return e[0]-t[0]}function so(t){return t[1]-t[0]+1}function st(t,e){return t[1]>=t[0]&&t[1]<e}function Ms(t,e){if(t[0]>t[1])return[null,null];let r=so(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 Ls(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)Pn(r,t[n]);return r}function Ds(t){let e=[1/0,1/0,-1/0,-1/0];for(let r of t)for(let n of r)Pn(e,n);return e}function zu(t){return t[0]!==-1/0&&t[1]!==-1/0&&t[2]!==1/0&&t[3]!==1/0}function Ns(t,e,r){if(!zu(t)||!zu(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 qt(t,e,r){let n=r.pointOnLine(e,t);return r.distance(t,n.point)}function Us(t,e,r,n,i){let o=Math.min(qt(t,[r,n],i),qt(e,[r,n],i)),a=Math.min(qt(r,[t,e],i),qt(n,[t,e],i));return Math.min(o,a)}function Pd(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(vo(l,u,p,f))return 0;a=Math.min(a,Us(l,u,p,f,i))}}return a}function Sd(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 wd(t,e,r){if(Ir(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,qt(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 Ad(t,e,r,n){if(!st(e,t.length))return NaN;for(let o=e[0];o<=e[1];++o)if(Ir(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(vo(a,s,f,y))return 0;i=Math.min(i,Us(a,s,f,y,n))}}return i}function Ou(t,e){for(let r of t)for(let n of r)if(Ir(n,e,!0))return!0;return!1}function _d(t,e,r,n=1/0){let i=Ds(t),o=Ds(e);if(n!==1/0&&Ns(i,o,r)>=n)return n;if(fn(i,o)){if(Ou(t,e))return 0}else if(Ou(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],x=y[m];if(vo(p,f,d,x))return 0;a=Math.min(a,Us(p,f,d,x,r))}}return a}function Gu(t,e,r,n,i,o){if(!o)return;let a=Ns(Ls(n,o),i,r);a<e&&t.push([a,o,[0,0]])}function Yi(t,e,r,n,i,o,a){if(!o||!a)return;let s=Ns(Ls(n,o),Ls(i,a),r);s<e&&t.push([s,o,a])}function lo(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 ao([[0,[0,t.length-1],[0,0]]],lc),s=Ds(r);for(;a.length>0;){let l=a.pop();if(l[0]>=o)continue;let u=l[1],c=e?Es:Fs;if(so(u)<=c){if(!st(u,t.length))return NaN;if(e){let p=Ad(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=wd(t[p],r,n);if(o=Math.min(o,f),o===0)return 0}}else{let p=Ms(u,e);Gu(a,o,n,t,s,p[0]),Gu(a,o,n,t,s,p[1])}}return o}function uo(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 ao([[0,[0,t.length-1],[0,r.length-1]]],lc);for(;s.length>0;){let l=s.pop();if(l[0]>=a)continue;let u=l[1],c=l[2],p=e?Es:Fs,f=n?Es:Fs;if(so(u)<=p&&so(c)<=f){if(!st(u,t.length)&&st(c,r.length))return NaN;let y;if(e&&n)y=Pd(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=qt(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=qt(t[h],m,i),a=Math.min(a,y),a===0)return a}else y=Sd(t,u,r,c,i),a=Math.min(a,y)}else{let y=Ms(u,e),m=Ms(c,n);Yi(s,a,i,t,r,y[0],m[0]),Yi(s,a,i,t,r,y[0],m[1]),Yi(s,a,i,t,r,y[1],m[0]),Yi(s,a,i,t,r,y[1],m[1])}}return a}function Id(t,e){let r=t.geometry(),n=r.flat().map(a=>Os([a.x,a.y],t.canonical));if(r.length===0)return NaN;let i=new mn(n[0][1]),o=1/0;for(let a of e){switch(a.type){case"Point":o=Math.min(o,uo(n,!1,[a.coordinates],!1,i,o));break;case"LineString":o=Math.min(o,uo(n,!1,a.coordinates,!0,i,o));break;case"Polygon":o=Math.min(o,lo(n,!1,a.coordinates,i,o));break}if(o===0)return o}return o}function Td(t,e){let r=t.geometry(),n=r.flat().map(a=>Os([a.x,a.y],t.canonical));if(r.length===0)return NaN;let i=new mn(n[0][1]),o=1/0;for(let a of e){switch(a.type){case"Point":o=Math.min(o,uo(n,!0,[a.coordinates],!1,i,o));break;case"LineString":o=Math.min(o,uo(n,!0,a.coordinates,!0,i,o));break;case"Polygon":o=Math.min(o,lo(n,!0,a.coordinates,i,o));break}if(o===0)return o}return o}function Cd(t,e){let r=t.geometry();if(r.length===0||r[0].length===0)return NaN;let n=Yt(r,0).map(a=>a.map(s=>s.map(l=>Os([l.x,l.y],t.canonical)))),i=new mn(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,lo([a.coordinates],!1,s,i,o));break;case"LineString":o=Math.min(o,lo(a.coordinates,!0,s,i,o));break;case"Polygon":o=Math.min(o,_d(s,a.coordinates,i,o));break}if(o===0)return o}return o}function gs(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 hn=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 ${e.length-1} instead.`);if(cn(e[1])){let n=e[1];if(n.type==="FeatureCollection")return new t(n,n.features.map(i=>gs(i.geometry)).flat());if(n.type==="Feature")return new t(n,gs(n.geometry));if("type"in n&&"coordinates"in n)return new t(n,gs(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 Id(e,this.geometries);if(e.geometryType()==="LineString")return Td(e,this.geometries);if(e.geometryType()==="Polygon")return Cd(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}},dn=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 ${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 ${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:nn(n,this.key)}eachChild(){}outputDefined(){return!1}},Kt={"==":Yh,"!=":Kh,">":ed,"<":Qh,">=":rd,"<=":td,array:$e,at:Ps,boolean:$e,case:_s,coalesce:io,collator:oo,format:pn,image:Cs,in:Ss,"index-of":ws,interpolate:ke,"interpolate-hcl":ke,"interpolate-lab":ke,length:ks,let:ro,literal:_t,match:As,number:$e,"number-format":Ts,object:$e,slice:Is,step:Pr,string:$e,"to-boolean":St,"to-color":St,"to-number":St,"to-string":St,var:no,within:yn,distance:hn,"global-state":dn},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 "${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 to(r.registry,co,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 ${u.length} arguments, but found ${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])=>Fd(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 ${c}, but found (${p.join(", ")}) instead.`)}return null}static register(e,r){t.definitions=r;for(let n in r)e[n]=t}};function Nu(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=tc(e,r,n,o);if(a)throw new ne(a);return new H(e/255,r/255,n/255,o,!1)}function Uu(t,e){return t in e}function bs(t,e){let r=e[t];return typeof r>"u"?null:r}function kd(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 jt(t){return{type:t}}Ze.register(Kt,{error:[Ph,[$],(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],Nu],rgba:[ze,[k,k,k,k],Nu],has:{type:U,overloads:[[[$],(t,[e])=>Uu(e.evaluate(t),t.properties())],[[$,Wt],(t,[e,r])=>Uu(e.evaluate(t),r.evaluate(t))]]},get:{type:N,overloads:[[[$],(t,[e])=>bs(e.evaluate(t),t.properties())],[[$,Wt],(t,[e,r])=>bs(e.evaluate(t),r.evaluate(t))]]},"feature-state":[N,[$],(t,[e])=>bs(e.evaluate(t),t.featureState||{})],properties:[Wt,[],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,jt(k),(t,e)=>{let r=0;for(let n of e)r+=n.evaluate(t);return r}],"*":[k,jt(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,jt(k),(t,e)=>Math.min(...e.map(r=>r.evaluate(t)))],max:[k,jt(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])=>kd(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)],[jt(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)],[jt(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:[$,jt(N),(t,e)=>e.map(r=>on(r.evaluate(t))).join("")],"resolved-locale":[$,[mo],(t,[e])=>e.evaluate(t).resolvedLocale()]});function Fd(t){return Array.isArray(t)?`(${t.map(ie).join(", ")})`:`(${ie(t.type)}...)`}function co(t){if(t instanceof no)return co(t.boundExpression);if(t instanceof Ze&&t.name==="error")return!1;if(t instanceof oo)return!1;if(t instanceof yn)return!1;if(t instanceof hn)return!1;if(t instanceof dn)return!1;let e=t instanceof St||t instanceof $e,r=!0;return t.eachChild(n=>{e?r=r&&co(n):r=r&&n instanceof _t}),r?Po(t)&&So(t,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"]):!1}function Po(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 yn||t instanceof hn)return!1;let e=!0;return t.eachChild(r=>{e&&!Po(r)&&(e=!1)}),e}function gn(t){if(t instanceof Ze&&t.name==="feature-state")return!1;let e=!0;return t.eachChild(r=>{e&&!gn(r)&&(e=!1)}),e}function So(t,e){if(t instanceof Ze&&e.indexOf(t.name)>=0)return!1;let r=!0;return t.eachChild(n=>{r&&!So(n,e)&&(r=!1)}),r}function Bs(t){return{result:"success",value:t}}function gr(t){return{result:"error",value:t}}function It(t){return t["property-type"]==="data-driven"||t["property-type"]==="cross-faded-data-driven"}function uc(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function $s(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 wo(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)&&ue(t)===Wt}function Ed(t){return t}function Md(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 Ld(t){switch(t){case"exponential":return pc;case"interval":return Bd;case"categorical":return Dd;case"identity":return Vd;default:throw new Error(`Unknown function type "${t}"`)}}function cc(t,e){let r=t.stops&&typeof t.stops[0][0]=="object",n=r||t.property!==void 0,i=r||!n,o=t.type||($s(e)?"exponential":"interval"),a=Md(e);if(a&&(t=xr({},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&&!Mh(t.colorSpace))throw new Error(`Unknown color space: "${t.colorSpace}"`);let s=Ld(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,cc(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 pc({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?Sn(t.default,e.default):s(t,e,f,l,u)}}}function Sn(t,e,r){if(t!==void 0)return t;if(e!==void 0)return e;if(r!==void 0)return r}function Dd(t,e,r,n,i){let o=typeof r===i?n[r]:void 0;return Sn(o,t.default,e.default)}function Bd(t,e,r){if(j(r)!=="number")return Sn(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=xo(t.stops.map(o=>o[0]),r);return t.stops[i][1]}function pc(t,e,r){let n=t.base!==void 0?t.base:1;if(j(r)!=="number")return Sn(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=xo(t.stops.map(c=>c[0]),r),a=Rd(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]||Ed;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 Vd(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 Sn(r,t.default,e.default)}function Rd(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 Ht=class{constructor(e,r){this.expression=e,this._warningHistory={},this._evaluator=new eo,this._defaultValue=r?Od(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 ${Object.keys(this._enumValues).map(l=>JSON.stringify(l)).join(", ")}, but found ${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 wn(t){return Array.isArray(t)&&t.length>0&&typeof t[0]=="string"&&t[0]in Kt}function Qt(t,e){let r=new to(Kt,co,[],e?zd(e):void 0),n=r.parse(t,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return n?Bs(new Ht(n,e)):gr(r.errors)}var Je=class{constructor(e,r){this.kind=e,this._styleExpression=r,this.isStateDependent=e!=="constant"&&!gn(r.expression),this.globalStateRefs=Ao(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"&&!gn(r.expression),this.globalStateRefs=Ao(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 fc(t){return t._styleExpression!==void 0}function yc(t,e){let r=Qt(t,e);if(r.result==="error")return r;let n=r.value.expression,i=Po(n);if(!i&&!It(e))return gr([new Ve("","data expressions not supported")]);let o=So(n,["zoom"]);if(!o&&!uc(e))return gr([new Ve("","zoom expressions not supported")]);let a=Qi(n);if(!a&&!o)return gr([new Ve("",\'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.\')]);if(a instanceof Ve)return gr([a]);if(a instanceof ke&&!$s(e))return gr([new Ve("",\'"interpolate" expressions cannot be used with this property\')]);if(!a)return Bs(i?new Je("constant",r.value):new Je("source",r.value));let s=a instanceof ke?a.interpolation:void 0;return Bs(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,xr(this,cc(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 mc(t,e){if(wo(t))return new bn(t,e);if(wn(t)){let r=yc(t,e);if(r.result==="error")throw new Error(r.value.map(n=>`${n.key}: ${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 Qi(t){let e=null;if(t instanceof ro)e=Qi(t.result);else if(t instanceof io){for(let r of t.args)if(e=Qi(r),e)break}else(t instanceof Pr||t instanceof ke)&&t.input instanceof Ze&&t.input.name==="zoom"&&(e=t);return e instanceof Ve||t.eachChild(r=>{let n=Qi(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 Ao(t,e=new Set){return t instanceof dn&&e.add(t.key),t.eachChild(r=>{Ao(r,e)}),e}function zd(t){let e={color:ze,string:$,number:k,enum:$,boolean:U,formatted:Ar,padding:ho,numberArray:go,colorArray:an,projectionDefinition:yo,resolvedImage:vn,variableAnchorOffsetCollection:bo};return t.type==="array"?Ce(e[t.value]||N,t.length):e[t.type]}function Od(t){if(t.type==="color"&&wo(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 js(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(!js(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}var Gd={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};js(t)||(t=po(t));let e=Qt(t,Gd);if(e.result==="error")throw new Error(e.value.map(r=>`${r.key}: ${r.message}`).join(", "));{let r=hc(t);return{filter:(n,i,o)=>e.value.evaluate(n,i,{},o),needGeometry:r,getGlobalStateRefs:()=>Ao(e.value.expression)}}}function Nd(t,e){return t<e?-1:t>e?1:0}function hc(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(hc(t[e]))return!0;return!1}function po(t){if(!t)return!0;let e=t[0];return t.length<=1?e!=="any":e==="=="?xs(t[1],t[2],"=="):e==="!="?Ki(xs(t[1],t[2],"==")):e==="<"||e===">"||e==="<="||e===">="?xs(t[1],t[2],e):e==="any"?Ud(t.slice(1)):e==="all"?["all"].concat(t.slice(1).map(po)):e==="none"?["all"].concat(t.slice(1).map(po).map(Ki)):e==="in"?$u(t[1],t.slice(2)):e==="!in"?Ki($u(t[1],t.slice(2))):e==="has"?ju(t[1]):e==="!has"?Ki(ju(t[1])):!0}function xs(t,e,r){switch(t){case"$type":return[`filter-type-${r}`,e];case"$id":return[`filter-id-${r}`,e];default:return[`filter-${r}`,t,e]}}function Ud(t){return["any"].concat(t.map(po))}function $u(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(Nd)]]:["filter-in-small",t,["literal",e]]}}function ju(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function Ki(t){return["!",t]}function Vs(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+=`${Vs(o)},`;return`${i}]`}let r=Object.keys(t).sort(),n="{";for(let i=0;i<r.length;i++)n+=`${JSON.stringify(r[i])}:${Vs(t[r[i]])},`;return`${n}}`}function $d(t){let e="";for(let r of vh)e+=`/${Vs(t[r])}`;return e}function dc(t,e){let r={};for(let i=0;i<t.length;i++){let o=e&&e[t[i].id]||$d(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 gc(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 Zt(t){if(Array.isArray(t))return t.map(Zt);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){let e={};for(let r in t)e[r]=Zt(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, ${u} found`)];for(let c in r){let p=c.split(".")[0],f=nn(n,p)||n["*"],y;if(nn(i,p))y=i[p];else if(nn(n,p))y=s;else if(i["*"])y=i["*"];else if(n["*"])y=s;else{l.push(new C(e,r[c],`unknown property "${c}"`));continue}l=l.concat(y({key:(e&&`${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 "${c}"`));return l}function qs(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, ${j(e)} found`)];if(r.length&&e.length!==r.length)return[new C(a,e,`array length ${r.length} expected, length ${e.length} found`)];if(r["min-length"]&&e.length<r["min-length"])return[new C(a,e,`array length at least ${r["min-length"]} expected, length ${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:`${a}[${c}]`}));return u}function _o(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, ${i} found`)]:"minimum"in n&&r<n.minimum?[new C(e,r,`${r} is less than the minimum value ${n.minimum}`)]:"maximum"in n&&r>n.maximum?[new C(e,r,`${r} is greater than the maximum value ${n.maximum}`)]:[]}function bc(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&&!$s(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&&!uc(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(qs({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,x=h.key;if(j(d)!=="array")return[new C(x,d,`array expected, ${j(d)} found`)];if(d.length!==2)return[new C(x,d,`array length 2 expected, length ${d.length} found`)];if(u){if(j(d[0])!=="object")return[new C(x,d,`object expected, ${j(d[0])} found`)];if(d[0].zoom===void 0)return[new C(x,d,"object stop key must have zoom")];if(d[0].value===void 0)return[new C(x,d,"object stop key must have value")];if(a&&a>le(d[0].zoom))return[new C(x,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:`${x}[0]`,value:d[0],valueSpec:{zoom:{}},validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec,objectElementValidators:{zoom:_o,value:y}}))}else g=g.concat(y({key:`${x}[0]`,value:d[0],validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec},d));return wn(Zt(d[1]))?g.concat([new C(`${x}[1]`,d[1],"expressions are not allowed in function stops.")]):g.concat(h.validateSpec({key:`${x}[1]`,value:d[1],valueSpec:e,validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec}))}function y(h,g){let d=j(h.value),x=le(h.value),b=h.value!==null?h.value:g;if(!n)n=d;else if(d!==n)return[new C(h.key,b,`${d} stop domain type must match previous stop domain type ${n}`)];if(d!=="number"&&d!=="string"&&d!=="boolean")return[new C(h.key,b,"stop domain value must be a number, string, or boolean")];if(d!=="number"&&r!=="categorical"){let v=`number expected, ${d} found`;return It(e)&&r===void 0&&(v+=\'\\nIf you intended to use a categorical function, specify `"type": "categorical"`.\'),[new C(h.key,b,v)]}return r==="categorical"&&d==="number"&&(!isFinite(x)||Math.floor(x)!==x)?[new C(h.key,b,`integer expected, found ${x}`)]:r!=="categorical"&&d==="number"&&o!==void 0&&x<o?[new C(h.key,b,"stop domain values must appear in ascending order")]:(o=x,r==="categorical"&&x in i?[new C(h.key,b,"stop domain values must be unique")]:(i[x]=!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 Sr(t){let e=(t.expressionContext==="property"?yc:Qt)(Zt(t.value),t.valueSpec);if(e.result==="error")return e.value.map(n=>new C(`${t.key}${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 "${t.propertyKey}". Output values must be contained as literals within the expression.`)];if(t.expressionContext==="property"&&t.propertyType==="layout"&&!gn(r))return[new C(t.key,t.value,\'"feature-state" data expressions are not supported with layout properties.\')];if(t.expressionContext==="filter"&&!gn(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(!So(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"&&!Po(r))return[new C(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function jd(t){let e=t.value,r=t.key,n=j(e);return n!=="boolean"?[new C(r,e,`boolean expected, ${n} found`)]:[]}function Rs(t){let e=t.key,r=t.value,n=j(r);return n!=="string"?[new C(e,r,`color expected, ${n} found`)]:H.parse(String(r))?[]:[new C(e,r,`color expected, "${r}" found`)]}function xn(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 [${n.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(n.values).indexOf(le(r))===-1&&i.push(new C(e,r,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(r)} found`)),i}function Ws(t){return js(Zt(t.value))?Sr(xr({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):xc(t)}function xc(t){let e=t.value,r=t.key;if(j(e)!=="array")return[new C(r,e,`array expected, ${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(xn({key:`${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 "${e[0]}"`));case"==":case"!=":e.length!==3&&o.push(new C(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(i=j(e[1]),i!=="string"&&o.push(new C(`${r}[1]`,e[1],`string expected, ${i} found`)));for(let a=2;a<e.length;a++)i=j(e[a]),le(e[1])==="$type"?o=o.concat(xn({key:`${r}[${a}]`,value:e[a],valueSpec:n.geometry_type,style:t.style,styleSpec:t.styleSpec})):i!=="string"&&i!=="number"&&i!=="boolean"&&o.push(new C(`${r}[${a}]`,e[a],`string, number, or boolean expected, ${i} found`));break;case"any":case"all":case"none":for(let a=1;a<e.length;a++)o=o.concat(xc({key:`${r}[${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 "${e[0]}" operator must have 2 elements`)):i!=="string"&&o.push(new C(`${r}[1]`,e[1],`string expected, ${i} found`));break}return o}function vc(t,e){let r=t.key,n=t.validateSpec,i=t.style,o=t.styleSpec,a=t.value,s=t.objectKey,l=o[`${e}_${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 "${s}"`)];let p;if(j(a)==="string"&&It(c)&&!c.tokens&&(p=/^{([^}]+)}$/.exec(a)))return[new C(r,a,`"${s}" does not support interpolation syntax\nUse an identity property function instead: \\`{ "type": "identity", "property": ${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"&&wo(Zt(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 Pc(t){return vc(t,"paint")}function Sc(t){return vc(t,"layout")}function wc(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, ${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 "${r.id}", previously used at line ${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],`"${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 "${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 "${r.id}" requires a raster source`)):u!=="raster-dem"&&a==="hillshade"?e.push(new C(n,r.source,`layer "${r.id}" requires a raster-dem source`)):u!=="raster-dem"&&a==="color-relief"?e.push(new C(n,r.source,`layer "${r.id}" requires a raster-dem source`)):u==="raster"&&a!=="raster"?e.push(new C(n,r.source,`layer "${r.id}" requires a vector source`)):u==="vector"&&!r["source-layer"]?e.push(new C(n,r,`layer "${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 "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \\`lineMetrics\\` enabled.`)):e.push(new C(n,r.source,`source "${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:`${n}.type`,value:r.type,valueSpec:o.layer.type,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,object:r,objectKey:"type"})},filter:Ws,layout(l){return Re({layer:r,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return Sc(xr({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 Pc(xr({layerType:a},u))}}})}}})),e}function Jt(t){let e=t.value,r=t.key,n=j(e);return n!=="string"?[new C(r,e,`string expected, ${n} found`)]:[]}function qd(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, ${l} found`)),s;let c=le(n.encoding)==="custom",p=["redFactor","greenFactor","blueFactor","baseShift"],f=t.value.encoding?`"${t.value.encoding}"`:"Default";for(let y in n)!c&&p.includes(y)?s.push(new C(y,n[y],`In "${r}": "${y}" is only valid when "encoding" is set to "custom". ${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 "${y}"`));return s}var qu={promoteId:Wd};function Ac(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_${a.replace("-","_")}`],style:t.style,styleSpec:n,objectElementValidators:qu,validateSpec:o}),s;case"raster-dem":return s=qd({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:qu}),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(...Sr({key:`${r}.${l}.map`,value:c,expressionContext:"cluster-map"})),s.push(...Sr({key:`${r}.${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 xn({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function Wd({key:t,value:e}){if(j(e)==="string")return Jt({key:t,value:e});{let r=[];for(let n in e)r.push(...Jt({key:`${t}.${n}`,value:e[n]}));return r}}function _c(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, ${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 "${s}"`)])}return o}function Ic(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, ${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 "${s}"`)]);return a}function Tc(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, ${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 "${s}"`)]);return o}function Xd(t){return Jt(t).length===0?[]:Sr(t)}function Hd(t){return Jt(t).length===0?[]:Sr(t)}function Zd(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; ${r.length} values found`)];let i={type:"number"},o=[];for(let a=0;a<r.length;a++)o=o.concat(t.validateSpec({key:`${e}[${a}]`,value:r[a],validateSpec:t.validateSpec,valueSpec:i}));return o}else return _o({key:e,value:r,valueSpec:{}})}function Jd(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:`${e}[${a}]`,value:r[a],validateSpec:t.validateSpec,valueSpec:i}));return o}else return _o({key:e,value:r,valueSpec:{}})}function Yd(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(Rs({key:`${e}[${o}]`,value:r[o]}));return i}else return Rs({key:e,value:r})}function Kd(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(xn({key:`${e}[${a}]`,value:r[a],valueSpec:i.layout_symbol["text-anchor"]})),o=o.concat(qs({key:`${e}[${a+1}]`,value:r[a+1],valueSpec:{length:2,value:"number"},validateSpec:t.validateSpec,style:t.style,styleSpec:i}));return o}function Cc(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 ${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 ${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:`${n}[${a}]`,value:r[a],valueSpec:s,validateSpec:t.validateSpec}))}return e}else return Jt({key:n,value:r})}function Qd(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, ${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 "${s}"`)]);return a}function eg(t){let e=t.key,r=t.value;r=r instanceof String?r.valueOf():r;let n=j(r);return n==="array"&&!rg(r)&&!tg(r)?[new C(e,r,`projection expected, invalid array ${JSON.stringify(r)} found`)]:["array","string"].includes(n)?[]:[new C(e,r,`projection expected, invalid type "${n}" found`)]}function tg(t){return!!["interpolate","step","literal"].includes(t[0])}function rg(t){return Array.isArray(t)&&t.length===3&&typeof t[0]=="string"&&typeof t[1]=="string"&&typeof t[2]=="number"}function ng(t){return!!t&&t.constructor===Object}function kc(t){return ng(t.value)?[]:[new C(t.key,t.value,`object expected, ${j(t.value)} found`)]}var Wu={"*"(){return[]},array:qs,boolean:jd,number:_o,color:Rs,constants:gc,enum:xn,filter:Ws,function:bc,layer:wc,object:Re,source:Ac,light:_c,sky:Ic,terrain:Tc,projection:Qd,projectionDefinition:eg,string:Jt,formatted:Xd,resolvedImage:Hd,padding:Zd,numberArray:Jd,colorArray:Yd,variableAnchorOffsetCollection:Kd,sprite:Cc,state:kc};function fo(t){let e=t.value,r=t.valueSpec,n=t.styleSpec;return t.validateSpec=fo,r.expression&&wo(le(e))?bc(t):r.expression&&wn(Zt(e))?Sr(t):r.type&&Wu[r.type]?Wu[r.type](t):Re(xr({},t,{valueSpec:r.type?n[r.type]:r}))}function Fc(t){let e=t.value,r=t.key,n=Jt(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(fo({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,validateSpec:fo,objectElementValidators:{glyphs:Fc,"*"(){return[]}}})),t.constants&&(r=r.concat(gc({key:"constants",value:t.constants}))),Ec(r)}Me.source=qe(je(Ac));Me.sprite=qe(je(Cc));Me.glyphs=qe(je(Fc));Me.light=qe(je(_c));Me.sky=qe(je(Ic));Me.terrain=qe(je(Tc));Me.state=qe(je(kc));Me.layer=qe(je(wc));Me.filter=qe(je(Ws));Me.paintProperty=qe(je(Pc));Me.layoutProperty=qe(je(Sc));function je(t){return function(e){return t({...e,validateSpec:fo})}}function Ec(t){return[].concat(t).sort((e,r)=>e.line-r.line)}function qe(t){return function(...e){return Ec(t.apply(this,e))}}var Mc="AbortError";function Lc(t){return t.message===Mc}function Xs(){return new Error(Mc)}var Io={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function Dc(t){return Io.REGISTERED_PROTOCOLS[t.substring(0,t.indexOf("://"))]}function Bc(t,e){Io.REGISTERED_PROTOCOLS[t]=e}function Vc(t){delete Io.REGISTERED_PROTOCOLS[t]}var Rc="global-dispatcher",er=class extends Error{constructor(e,r,n,i){super(`AJAXError: ${r} (${e}): ${n}`),this.status=e,this.statusText=r,this.url=n,this.body=i}},Oc=()=>at(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,ig=t=>/^file:/.test(t)||/^file:/.test(Oc())&&!/^\\w+:/.test(t);async function og(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:Oc(),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 er(0,a.message,t.url,new Blob)}if(!n.ok){let a=await n.blob();throw new er(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 Xs();return{data:o,cacheControl:n.headers.get("Cache-Control"),expires:n.headers.get("Expires")}}function ag(t,e){return new Promise((r,n)=>{let i=new XMLHttpRequest;i.open(t.method||"GET",t.url,!0),(t.type==="arrayBuffer"||t.type==="image")&&(i.responseType="arraybuffer");for(let o in t.headers)i.setRequestHeader(o,t.headers[o]);t.type==="json"&&(i.responseType="text",t.headers?.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 o=i.response;if(t.type==="json")try{o=JSON.parse(i.response)}catch(a){n(a);return}r({data:o,cacheControl:i.getResponseHeader("Cache-Control"),expires:i.getResponseHeader("Expires")})}else{let o=new Blob([i.response],{type:i.getResponseHeader("Content-Type")});n(new er(i.status,i.statusText,t.url,o))}},e.signal.addEventListener("abort",()=>{i.abort(),n(Xs())}),i.send(t.body)})}var Gc=function(t,e){if(/:\\/\\//.test(t.url)&&!/^https?:|^file:/.test(t.url)){let r=Dc(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:Rc},e)}if(!ig(t.url)){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return og(t,e);if(at(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:t,mustQueue:!0,targetMapId:Rc},e)}return ag(t,e)},Nc=(t,e)=>Gc(de(t,{type:"json"}),e),Uc=(t,e)=>Gc(de(t,{type:"arrayBuffer"}),e);var ut={};function I(t,e,r={}){if(ut[t])throw new Error(`${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",$t);I("Color",H);I("Error",Error);I("AJAXError",er);I("ResolvedImage",Se);I("StylePropertyFunction",bn);I("StyleExpression",Ht,{omit:["_evaluator"]});I("ZoomDependentExpression",Tt);I("ZoomConstantExpression",Je);I("CompoundExpression",Ze,{omit:["_evaluate"]});for(let t in Kt)Kt[t]._classRegistryKey||I(`Expression_${t}`,Kt[t]);function $c(t){return t&&typeof ArrayBuffer<"u"&&(t instanceof ArrayBuffer||t.constructor&&t.constructor.name==="ArrayBuffer")}function Hs(t){let e=t.constructor;return t.$name||e._classRegistryKey}function sg(t){if(t===null||typeof t!="object")return!1;let e=Hs(t);return!!(e&&e!=="Object")}function jc(t){return!sg(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||$c(t)||vt(t)||ArrayBuffer.isView(t)||t instanceof ImageData)}function Tr(t,e){if(jc(t)){if(($c(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(Tr(a,e));return o}if(typeof t!="object")throw new Error(`can\'t serialize object of type ${typeof t}`);let r=Hs(t);if(!r)throw new Error(`can\'t serialize object of unregistered class ${t.constructor.name}`);if(!ut[r])throw new Error(`${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:Tr(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 Cr(t){if(jc(t))return t;if(Array.isArray(t))return t.map(Cr);if(typeof t!="object")throw new Error(`can\'t deserialize object of type ${typeof t}`);let e=Hs(t)||"Object";if(!ut[e])throw new Error(`can\'t deserialize unregistered class ${e}`);let{klass:r}=ut[e];if(!r)throw new Error(`can\'t deserialize unregistered class ${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:Cr(o)}return n}var To=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 lg={once:!0},Co=class{constructor(e,r){this.target=e,this.mapId=r,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new To(()=>this.process()),this.subscription=us(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?us(r.signal,"abort",()=>{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)},lg):null;this.resolveRejects[o]={resolve:u=>{a?.unsubscribe(),n(u)},reject:u=>{a?.unsubscribe(),i(u)}};let s=[],l={...e,id:o,sourceMapId:this.mapId,origin:location.origin,data:Tr(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(Cr(r.error)):o.resolve(Cr(r.data));return}if(!this.messageHandlers[r.type]){this.completeTask(e,new Error(`Could not find a registered handler for ${r.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));return}let n=Cr(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?Tr(r):null,data:Tr(n,i)};this.target.postMessage(o,{transfer:i})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}};function qc(t,e,r){r[t]&&r[t].indexOf(e)!==-1||(r[t]=r[t]||[],r[t].push(e))}function Zs(t,e,r){if(r&&r[t]){let n=r[t].indexOf(e);n!==-1&&r[t].splice(n,1)}}var ko=class{constructor(e,r={}){de(this,r),this.type=e}},An=class extends ko{constructor(e,r={}){super("error",de({error:e},r))}},Fo=class{on(e,r){return this._listeners=this._listeners||{},qc(e,r,this._listeners),{unsubscribe:()=>{this.off(e,r)}}}off(e,r){return Zs(e,r,this._listeners),Zs(e,r,this._oneTimeListeners),this}once(e,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},qc(e,r,this._oneTimeListeners),this):new Promise(n=>this.once(e,n))}fire(e,r){typeof e=="string"&&(e=new ko(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)Zs(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 An&&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,K0=ct.source,Q0=ct.light,ev=ct.sky,tv=ct.terrain,rv=ct.filter,Wc=ct.paintProperty,Xc=ct.layoutProperty;function Hc(t,e){let r=!1;if(e&&e.length)for(let n of e)t.fire(new An(new Error(n.message))),r=!0;return r}var _n=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 In(t){for(let e of t)if(Eo(e.charCodeAt(0)))return!0;return!1}function Zc(t){for(let e of t)if(!pg(e.charCodeAt(0)))return!1;return!0}function Js(t){let e=t.map(r=>{try{return new RegExp(`\\\\p{sc=${r}}`,"u").source}catch{return null}}).filter(r=>r);return new RegExp(e.join("|"),"u")}var ug=["Arab","Dupl","Mong","Ougr","Syrc"],cg=Js(ug);function pg(t){return!cg.test(String.fromCodePoint(t))}var fg=["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"],Jc=Js(fg);function Yc(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:Jc.test(String.fromCodePoint(t))}function Eo(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)||/\\p{sc=Cans}/u.test(String.fromCodePoint(t))||/\\p{sc=Hang}/u.test(String.fromCodePoint(t))||Jc.test(String.fromCodePoint(t)))}function yg(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 Ys(t){return!(Eo(t)||yg(t))}function Kc(t){return/\\p{sc=Arab}/u.test(String.fromCodePoint(t))}var mg=["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"],hg=Js(mg);function Qc(t){return hg.test(String.fromCodePoint(t))}function dg(t,e){return!(!e&&Qc(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||q.Khmer(t))}function ep(t){for(let e of t)if(Qc(e.charCodeAt(0)))return!0;return!1}function tp(t,e){for(let r of t)if(!dg(r.charCodeAt(0),e))return!1;return!0}var Ks=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 ${n}`)}},we=new Ks;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 _n,this.transition=r.transition||{},this.globalState=r.globalState||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new _n,this.transition={},this.globalState={})}isSupportedScript(e){return tp(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 kr=class{constructor(e,r){this.property=e,this.value=r,this.expression=mc(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)}},Tn=class{constructor(e){this.property=e,this.value=new kr(e,void 0)}transitioned(e,r){return new Lo(this.property,this.value,r,de({},e.transition,this.transition),e.now)}untransitioned(){return new Lo(this.property,this.value,null,{},0)}},Mo=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 Tn(this._values[e].property)),this._values[e].value=new kr(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 Tn(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[`${r}-transition`]=i)}return e}transitioned(e,r){let n=new Do(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 Do(this._properties);for(let r of Object.keys(this._values))e._values[r]=this._values[r].untransitioned();return e}},Lo=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,Su(s))}}else return o}},Do=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}},Bo=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 kr(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}},tr=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 kr(n,void 0),o=this.defaultTransitionablePropertyValues[r]=new Tn(n);this.defaultTransitioningPropertyValues[r]=o.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=i.possiblyEvaluate({})}}};I("DataDrivenProperty",L);I("DataConstantProperty",F);I("CrossFadedDataDrivenProperty",pt);I("CrossFadedProperty",tr);I("ColorRampProperty",ft);var Vo="-transition",oe=class extends Fo{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 Bo(r.layout)),r.paint)){this._transitionablePaint=new Mo(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.${this.id}.layout.${e}`;if(this._validate(Xc,i,e,r,n))return}if(e==="visibility"){this.visibility=r;return}this._unevaluatedLayout.setValue(e,r)}getPaintProperty(e){return e.endsWith(Vo)?this._transitionablePaint.getTransition(e.slice(0,-Vo.length)):this._transitionablePaint.getValue(e)}setPaintProperty(e,r,n={}){if(r!=null){let i=`layers.${this.id}.paint.${e}`;if(this._validate(Wc,i,e,r,n))return!1}if(e.endsWith(Vo))return this._transitionablePaint.setTransition(e.slice(0,-Vo.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),_u(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:Hc(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 gg={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}},bg=128,xg=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*xg),bg),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=vg(a.type),l=r=rp(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=rp(r,Math.max(n,e));return{members:i,size:o,alignment:e}}function vg(t){return gg[t].BYTES_PER_ELEMENT}function rp(t,e){return Math.ceil(t/e)*e}var np=Y(ye(),1),rr=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}};rr.prototype.bytesPerElement=4;I("StructArrayLayout2i4",rr);var Cn=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}};Cn.prototype.bytesPerElement=6;I("StructArrayLayout3i6",Cn);var Ro=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}};Ro.prototype.bytesPerElement=8;I("StructArrayLayout4i8",Ro);var kn=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}};kn.prototype.bytesPerElement=12;I("StructArrayLayout2i4i12",kn);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*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}};Fn.prototype.bytesPerElement=8;I("StructArrayLayout2i4ub8",Fn);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 En=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}};En.prototype.bytesPerElement=20;I("StructArrayLayout10ui20",En);var Mn=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}};Mn.prototype.bytesPerElement=24;I("StructArrayLayout4i4ui4i24",Mn);var Ln=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}};Ln.prototype.bytesPerElement=12;I("StructArrayLayout3f12",Ln);var Dn=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}};Dn.prototype.bytesPerElement=4;I("StructArrayLayout1ul4",Dn);var Bn=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}};Bn.prototype.bytesPerElement=20;I("StructArrayLayout6i1ul2ui20",Bn);var Vn=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}};Vn.prototype.bytesPerElement=12;I("StructArrayLayout2i2i2i12",Vn);var zo=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}};zo.prototype.bytesPerElement=16;I("StructArrayLayout2f1f2i16",zo);var Rn=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}};Rn.prototype.bytesPerElement=16;I("StructArrayLayout2ub2f2i16",Rn);var zn=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}};zn.prototype.bytesPerElement=6;I("StructArrayLayout3ui6",zn);var On=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 x=this.length;return this.resize(x+1),this.emplace(x,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,x){let b=e*24,v=e*12,S=e*48;return this.int16[b+0]=r,this.int16[b+1]=n,this.uint16[b+2]=i,this.uint16[b+3]=o,this.uint32[v+2]=a,this.uint32[v+3]=s,this.uint32[v+4]=l,this.uint16[b+10]=u,this.uint16[b+11]=c,this.uint16[b+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[b+22]=x,e}};On.prototype.bytesPerElement=48;I("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",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,x,b,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,x,b,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,x,b,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]=x,this.uint16[_+17]=b,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}};Gn.prototype.bytesPerElement=64;I("StructArrayLayout8i15ui1ul2f2ui64",Gn);var nr=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}};nr.prototype.bytesPerElement=4;I("StructArrayLayout1f4",nr);var Nn=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}};Nn.prototype.bytesPerElement=12;I("StructArrayLayout1ui2f12",Nn);var Un=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}};Un.prototype.bytesPerElement=8;I("StructArrayLayout1ul2ui8",Un);var $n=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}};$n.prototype.bytesPerElement=4;I("StructArrayLayout2ui4",$n);var Oo=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}};Oo.prototype.bytesPerElement=2;I("StructArrayLayout1ui2",Oo);var Fr=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}};Fr.prototype.bytesPerElement=16;I("StructArrayLayout4f16",Fr);var Go=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 np.default(this.anchorPointX,this.anchorPointY)}};Go.prototype.size=20;var jn=class extends Bn{get(e){return new Go(this,e)}};I("CollisionBoxArray",jn);var No=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]}};No.prototype.size=48;var qn=class extends On{get(e){return new No(this,e)}};I("PlacedSymbolArray",qn);var Uo=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]}};Uo.prototype.size=64;var Wn=class extends Gn{get(e){return new Uo(this,e)}};I("SymbolInstanceArray",Wn);var Xn=class extends nr{getoffsetX(e){return this.float32[e*1+0]}};I("GlyphOffsetArray",Xn);var Hn=class extends Cn{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",Hn);var $o=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]}};$o.prototype.size=12;var Zn=class extends Nn{get(e){return new $o(this,e)}};I("TextAnchorOffsetArray",Zn);var jo=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]}};jo.prototype.size=8;var Jn=class extends Un{get(e){return new jo(this,e)}};I("FeatureIndexArray",Jn);var qo=class extends rr{};var Wo=class extends rr{},Xo=class extends rr{},Ho=class extends kn{};var Zo=class extends Fn{},Jo=class extends Et{},yt=class extends En{},Yo=class extends Mn{},Ko=class extends Ln{},Qo=class extends Dn{},Yn=class extends Vn{};var ea=class extends Rn{};var Le=class extends zn{},Mt=class extends $n{};var Pg=Q([{name:"a_pos",components:2,type:"Int16"}],4);var{members:ip,size:kv,alignment:Fv}=Pg;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 ${t.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}. Consider using the \\`fillLargeMeshArrays\\` function if you require meshes with more than ${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 Qs(t,e){return t=it(Math.floor(t),0,255),e=it(Math.floor(e),0,255),256*t+e}var Kn=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 up=Y(rl(),1);var Qn=class t{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,n,i){this.ids.push(lp(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=lp(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 nl(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 lp(t){let e=+t;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:(0,up.default)(String(t))}function nl(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;ra(t,o,a),ra(e,3*o,3*a),ra(e,3*o+1,3*a+1),ra(e,3*o+2,3*a+2)}a-r<n-a?(nl(t,e,r,a),r=a+1):(nl(t,e,a+1,n),n=a)}}function ra(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}I("FeaturePositionMap",Qn);var ei=class{constructor(e,r){this.gl=e.gl,this.location=r}};var Er=class extends ei{constructor(e,r){super(e,r),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}};var na=class extends ei{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]))}},ia=class extends ei{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 qv=new Float32Array(16);function il(t){return[Qs(255*t.r,255*t.g),Qs(255*t.b,255*t.a)]}var ir=class{constructor(e,r,n){this.value=e,this.uniformNames=r.map(i=>`u_${i}`),this.type=n}setUniform(e,r,n){e.set(n.constantOr(this.value))}getBinding(e,r,n){return this.type==="color"?new ia(e,r):new Er(e,r)}},Lt=class{constructor(e,r){this.uniformNames=r.map(n=>`u_${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 na(e,r):new Er(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_${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=il(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_${s}_t`),this.type=n,this.useIntegerZoom=i,this.zoom=o,this.maxValue=0,this.paintVertexAttributes=r.map(s=>({name:`a_${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=il(n),a=il(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 Er(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,Kn.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,Kn.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}},oa=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=_g(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 ir(l.value,s,u),i.push(`/u_${o}`);else if(l.kind==="source"||f){let y=cp(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_${o}`)}else{let y=cp(o,u,"composite");this.binders[o]=new De(l,s,u,c,r,y),i.push(`/z_${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 ir||n instanceof Lt)&&e.push(...n.uniformNames.map(i=>`#define HAS_UNIFORM_${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<Kn.members.length;i++)e.push(Kn.members[i].name)}return e}getBinderUniforms(){let e=[];for(let r in this.binders){let n=this.binders[r];if(n instanceof ir||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 ir||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 oa(i,r,n);this.needsUpload=!1,this._featureMap=new Qn,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 _g(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(`${e}-`,"").replace(/-/g,"_")]}function Ig(t){return{"line-pattern":{source:yt,composite:yt},"fill-pattern":{source:yt,composite:yt},"fill-extrusion-pattern":{source:yt,composite:yt}}[t]}function cp(t,e,r){let n={color:{source:Et,composite:Fr},number:{source:nr,composite:Et}},i=Ig(t);return i&&i[r]||n[e][r]}I("ConstantBinder",ir);I("CrossFadedConstantBinder",Lt);I("SourceExpressionBinder",We);I("CrossFadedCompositeBinder",Ye);I("CompositeExpressionBinder",De);I("ProgramConfiguration",oa,{omit:["_buffers"]});I("ProgramConfigurationSet",Ae);var Tg=15,ol=Math.pow(2,Tg-1)-1,pp=-ol-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,pp,ol),a.y=it(l,pp,ol),(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 fp=-32768;function Cg(t,e,r,n,i){t.emplaceBack(fp+e*8+n,fp+r*8+i)}var or=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 Wo,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,ip),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}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: ${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++)Cg(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",or,{omit:["layers"]});var ti=Y(ye(),1);function mp(t,e){for(let r=0;r<t.length;r++)if(Mr(e,t[r]))return!0;for(let r=0;r<e.length;r++)if(Mr(t,e[r]))return!0;return!!sl(t,e)}function hp(t,e,r){return!!(Mr(t,e)||al(e,t,r))}function aa(t,e){if(t.length===1)return yp(e,t[0]);for(let r=0;r<e.length;r++){let n=e[r];for(let i=0;i<n.length;i++)if(Mr(t,n[i]))return!0}for(let r=0;r<t.length;r++)if(yp(e,t[r]))return!0;for(let r=0;r<e.length;r++)if(sl(t,e[r]))return!0;return!1}function dp(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(Mr(t,i[o]))return!0}if(kg(t,i,r))return!0}return!1}function kg(t,e,r){if(t.length>1){if(sl(t,e))return!0;for(let n=0;n<e.length;n++)if(al(e[n],t,r))return!0}for(let n=0;n<t.length;n++)if(al(t[n],e,r))return!0;return!1}function sl(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(Fg(n,i,a,s))return!0}}return!1}function Fg(t,e,r,n){return ot(t,r,n)!==ot(e,r,n)&&ot(t,e,r)!==ot(t,e,n)}function al(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(ll(t,o,a)<n)return!0}return!1}function ll(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 yp(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 Mr(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 gp(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 ti.default(e,r),new ti.default(e,i),new ti.default(n,i),new ti.default(n,r)];if(t.length>2){for(let a of o)if(Mr(t,a))return!0}for(let a=0;a<t.length-1;a++){let s=t[a],l=t[a+1];if(Eg(s,l,o))return!0}return!1}function Eg(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 sa=Y(ye(),1);function ar(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=sa.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 bp(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 sa.default(0,0):l.sub(s)._unit()._perp(),p=a===i.length-1?new sa.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 xp,Mg=()=>xp=xp||new ee({"circle-sort-key":new L(P.layout_circle["circle-sort-key"])}),vp,Lg=()=>vp=vp||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"])}),Pp={get paint(){return Lg()},get layout(){return Mg()}};var Sp=Y(ye(),1);var la=class extends oe{constructor(e){super(e,Pp)}createBucket(e){return new or(e)}queryRadius(e){let r=e;return ar("circle-radius",this,r)+ar("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:Dg(u,o,s,l),h=y?f*a:f;for(let g of i)for(let d of g){let x=y?d:wp(d,o,s,l),b=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"?b*=v/o.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(b*=o.cameraToCenterDistance/v),hp(m,x,b))return!0}return!1}};function wp(t,e,r,n){let i=e.projectTileCoordinates(t.x,t.y,r,n).point;return new Sp.default((i.x*.5+.5)*e.width,(-i.y*.5+.5)*e.height)}function Dg(t,e,r,n){return t.map(i=>wp(i,e,r,n))}var ri=class extends or{};I("HeatmapBucket",ri,{omit:["layers"]});var Ap,Bg=()=>Ap=Ap||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"])}),_p={get paint(){return Bg()}};function ul(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: ${i.length} but got: ${e*r*n}`);return t.width=e,t.height=r,t.data=i,t}function Ip(t,{width:e,height:r},n){if(e===t.width&&r===t.height)return;let i=ul({},{width:e,height:r},n);cl(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 cl(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 sr=class t{constructor(e,r){ul(this,e,1,r)}resize(e){Ip(this,e,1)}clone(){return new t({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,n,i,o){cl(e,r,n,i,o,1)}},fe=class t{constructor(e,r){ul(this,e,4,r)}resize(e){Ip(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){cl(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",sr);I("RGBAImage",fe);function Tp(t){let e={},r=t.resolution||256,n=t.clips?t.clips.length:1,i=t.image||new fe({width:r,height:n});if(!Au(r))throw new Error(`width is not a power of 2 - ${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 Cp="big-fb";var ua=class extends oe{createBucket(e){return new ri(e)}constructor(e){super(e,_p),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=Tp({expression:e,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(Cp)&&this.heatmapFbos.delete(Cp)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}};var kp,Vg=()=>kp=kp||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"])}),Fp={get paint(){return Vg()}};var ca=class extends oe{constructor(e){super(e,Fp),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(cs);return{directionRadians:e.map(cs),altitudeRadians:a,shadowColor:i,highlightColor:n}}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}};var Ep,Rg=()=>Ep=Ep||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"])}),Mp={get paint(){return Rg()}};var ni=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 ii=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(`"${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 pl(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 pl(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",ii);var pa=class extends oe{constructor(e){super(e,Mp)}_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 ${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=pl(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 ni(e,a,e.gl.RGBA),colorTexture:new ni(e,o,e.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return this.visibility!=="none"&&!!this.colorRampTextures}};var zg=Q([{name:"a_pos",components:2,type:"Int16"}],4);var{members:Lp,size:U1,alignment:$1}=zg;function Lr(t,e,r){let n=r.patternDependencies,i=!1;for(let o of e){let a=o.paint.get(`${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 Dr(t,e,r,n,i){let o=i.patternDependencies;for(let a of e){let l=a.paint.get(`${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 ci=Y(ye(),1);function ml(t,e,r=2){let n=e&&e.length,i=n?e[0]*r:t.length,o=Bp(t,0,i,r,!0),a=[];if(!o||o.next===o.prev)return a;let s,l,u;if(n&&(o=$g(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 ai(o,a,r,s,l,u,0),a}function Bp(t,e,r,n,i){let o;if(i===eb(t,e,r,n)>0)for(let a=e;a<r;a+=n)o=Dp(a/n|0,t[a],t[a+1],o);else for(let a=r-n;a>=e;a-=n)o=Dp(a/n|0,t[a],t[a+1],o);return o&&Br(o,o.next)&&(li(o),o=o.next),o}function lr(t,e){if(!t)return t;e||(e=t);let r=t,n;do if(n=!1,!r.steiner&&(Br(r,r.next)||se(r.prev,r,r.next)===0)){if(li(r),r=e=r.prev,r===r.next)break;n=!0}else r=r.next;while(n||r!==e);return e}function ai(t,e,r,n,i,o,a){if(!t)return;!a&&o&&Hg(t,n,i,o);let s=t;for(;t.prev!==t.next;){let l=t.prev,u=t.next;if(o?Gg(t,n,i,o):Og(t)){e.push(l.i,t.i,u.i),li(t),t=u.next,s=u.next;continue}if(t=u,t===s){a?a===1?(t=Ng(lr(t),e),ai(t,e,r,n,i,o,2)):a===2&&Ug(t,e,r,n,i,o):ai(lr(t),e,r,n,i,o,1);break}}}function Og(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&&oi(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 Gg(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=fl(y,m,e,r,n),x=fl(h,g,e,r,n),b=t.prevZ,v=t.nextZ;for(;b&&b.z>=d&&v&&v.z<=x;){if(b.x>=y&&b.x<=h&&b.y>=m&&b.y<=g&&b!==i&&b!==a&&oi(s,c,l,p,u,f,b.x,b.y)&&se(b.prev,b,b.next)>=0||(b=b.prevZ,v.x>=y&&v.x<=h&&v.y>=m&&v.y<=g&&v!==i&&v!==a&&oi(s,c,l,p,u,f,v.x,v.y)&&se(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;b&&b.z>=d;){if(b.x>=y&&b.x<=h&&b.y>=m&&b.y<=g&&b!==i&&b!==a&&oi(s,c,l,p,u,f,b.x,b.y)&&se(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;v&&v.z<=x;){if(v.x>=y&&v.x<=h&&v.y>=m&&v.y<=g&&v!==i&&v!==a&&oi(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 Ng(t,e){let r=t;do{let n=r.prev,i=r.next.next;!Br(n,i)&&Rp(n,r,r.next,i)&&si(n,i)&&si(i,n)&&(e.push(n.i,r.i,i.i),li(r),li(r.next),r=t=i),r=r.next}while(r!==t);return lr(r)}function Ug(t,e,r,n,i,o){let a=t;do{let s=a.next.next;for(;s!==a.prev;){if(a.i!==s.i&&Yg(a,s)){let l=zp(a,s);a=lr(a,a.next),l=lr(l,l.next),ai(a,e,r,n,i,o,0),ai(l,e,r,n,i,o,0);return}s=s.next}a=a.next}while(a!==t)}function $g(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=Bp(t,s,l,n,!1);u===u.next&&(u.steiner=!0),i.push(Jg(u))}i.sort(jg);for(let o=0;o<i.length;o++)r=qg(i[o],r);return r}function jg(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 qg(t,e){let r=Wg(t,e);if(!r)return e;let n=zp(r,t);return lr(n,n.next),lr(r,r.next)}function Wg(t,e){let r=e,n=t.x,i=t.y,o=-1/0,a;if(Br(t,r))return r;do{if(Br(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&&Vp(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);si(r,t)&&(p<c||p===c&&(r.x>a.x||r.x===a.x&&Xg(a,r)))&&(a=r,c=p)}r=r.next}while(r!==s);return a}function Xg(t,e){return se(t.prev,t,e.prev)<0&&se(e.next,t,t.next)<0}function Hg(t,e,r,n){let i=t;do i.z===0&&(i.z=fl(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,Zg(i)}function Zg(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 fl(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 Jg(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 Vp(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 oi(t,e,r,n,i,o,a,s){return!(t===a&&e===s)&&Vp(t,e,r,n,i,o,a,s)}function Yg(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!Kg(t,e)&&(si(t,e)&&si(e,t)&&Qg(t,e)&&(se(t.prev,t,e.prev)||se(t,e.prev,e))||Br(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 Br(t,e){return t.x===e.x&&t.y===e.y}function Rp(t,e,r,n){let i=ya(se(t,e,r)),o=ya(se(t,e,n)),a=ya(se(r,n,t)),s=ya(se(r,n,e));return!!(i!==o&&a!==s||i===0&&fa(t,r,e)||o===0&&fa(t,n,e)||a===0&&fa(r,t,n)||s===0&&fa(r,e,n))}function fa(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 ya(t){return t>0?1:t<0?-1:0}function Kg(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&&Rp(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}function si(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 Qg(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 zp(t,e){let r=yl(t.i,t.x,t.y),n=yl(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 Dp(t,e,r,n){let i=yl(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 li(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 yl(t,e,r){return{i:t,x:e,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function eb(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)}},ha=class ha{constructor(e){this.fill=e.fill,this.line=e.line,this.tile=e.tile,this.stencil=e.stencil,this.circle=e.circle}};ha.noSubdivision=new ha({fill:new Vt(0,0),line:new Vt(0,0),tile:new Vt(0,0),stencil:new Vt(0,0),circle:1});var ma=ha;I("SubdivisionGranularityExpression",Vt);I("SubdivisionGranularitySetting",ma);var Vr=-32768,ui=32767,hl=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 rb(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);nb(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,x=(i-u)/h,b=(o-u)/h,v=Math.min(x,b),S=Math.max(x,b);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,x=n+u*(d-r)/l;e.push(this._vertexToIndex(d,x))}else for(let g=m;g>=y;g--){let d=g*this._granularityCellSize,x=n+u*(d-r)/l;e.push(this._vertexToIndex(d,x))}}_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),x=i+f*g,b=Math.floor(Math.min(x,l)/this._granularityCellSize)+1,v=Math.ceil(Math.max(x,l)/this._granularityCellSize)-1,S=l<x,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;b=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=b;T<=v;T++){let E=T*this._granularityCellSize;e.push(this._vertexToIndex(E,w))}else for(let T=v;T>=b;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===Vr&&(e[r+1]=Vr+1),n===ui&&(e[r+1]=ui-1)}}_generatePoleQuad(e,r,n,i,o,a){i>o!=(a===Vr)?(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,Vr),h===o&&d===o&&this._generatePoleQuad(e,c,p,m,g,Vr),d===o&&y===o&&this._generatePoleQuad(e,p,u,g,f,Vr)),n&&(y===a&&h===a&&this._generatePoleQuad(e,u,c,f,m,ui),h===a&&d===a&&this._generatePoleQuad(e,c,p,m,g,ui),d===a&&y===a&&this._generatePoleQuad(e,p,u,g,f,ui))}}_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}=tb(e);this._initializeVertices(n);let o;try{let s=ml(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 da(t,e,r,n=!0){return new hl(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 ci.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,x=m!==g;if(!d&&!x)continue;let b=h-y,v=g-m,S=Math.abs(b),A=Math.abs(v),w=y,T=m;for(;;){let D=b>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=x?M/A:Number.POSITIVE_INFINITY;if((_<=z||!d)&&(V<=M||!x))break;if(G<O&&d||!x){w=D,T=T+v*G;let R=new ci.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+b*O,T=B;let R=new ci.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 ci.default(h,g);(s[s.length-1].x!==E.x||s[s.length-1].y!==E.y)&&s.push(E)}return s}function tb(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 rb(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 nb(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],x=!1;if(c<f)x=!0;else if(c>f)x=!1;else{let b=g-m,S=d-h,A=-b,w=h<d?1:-1,T=((c-m)*S+(p-h)*A)*w,E=((f-m)*S+(y-h)*A)*w;T>E&&(x=!0)}if(x){let b=e[l],v=e[a],S=e[s];b!==v&&b!==S&&v!==S&&r.push(S,v,b),a--,a<0&&(a=o-1)}else{let b=e[u],v=e[a],S=e[s];b!==v&&b!==S&&v!==S&&r.push(S,v,b),s++,s>=o&&(s=0)}if(l===u)break}}function ga(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 ib(e,r,n,i,o,t),c&&ob(a,r,s,i,l,t),e.forceNewSegmentOnNextPrepare(),a?.forceNewSegmentOnNextPrepare()}function pi(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 ib(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,x=(h?1:0)+(g?1:0)+(d?1:0);u.vertexLength+x>pe.MAX_VERTEX_ARRAY_LENGTH&&(u=t.createNewSegment(e,r),l=s.count,h=!0,g=!0,d=!0,c=0);let b=pi(a,n,o,s,f,h,u),v=pi(a,n,o,s,y,g,u),S=pi(a,n,o,s,m,d,u);r.emplaceBack(c+b-l,c+v-l,c+S-l),u.primitiveLength++}}function ob(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,x=(g?1:0)+(d?1:0);u.vertexLength+x>pe.MAX_VERTEX_ARRAY_LENGTH&&(u=t.createNewSegment(e,r),l=s.count,g=!0,d=!0,c=0);let b=pi(a,n,o,s,m,g,u),v=pi(a,n,o,s,h,d,u);r.emplaceBack(c+b-l,c+v-l),u.primitiveLength++}}}var ab=500,ur=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 Xo,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=Lr("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=Dr("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,Lp),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 Yt(r,ab)){let l=da(s,i,a.fill.getGranularityForZoomLevel(i.z)),u=this.layoutVertexArray;ga((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",ur,{omit:["layers","patternFeatures"]});var Op,sb=()=>Op=Op||new ee({"fill-sort-key":new L(P.layout_fill["fill-sort-key"])}),Gp,lb=()=>Gp=Gp||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"])}),Np={get paint(){return lb()},get layout(){return sb()}};var ba=class extends oe{constructor(e){super(e,Np)}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 ur(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 aa(o,r)}isTileClipped(){return!0}};var ub=Q([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Up=Q([{name:"a_centroid",components:2,type:"Int16"}],4);var{members:$p,size:kS,alignment:FS}=ub;var Jp=Y(Rt(),1);var Pb=Jp.default.VectorTileFeature.types,Sb=500,bl=Math.pow(2,13);function fi(t,e,r,n,i,o,a,s){t.emplaceBack(e,r,Math.floor(n*bl)*2+a,i*bl*2,o*bl*2,Math.round(s))}var 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.layoutVertexArray=new Ho,this.centroidVertexArray=new qo,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=Lr("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(Dr("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,$p),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,Up.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 Yt(r,Sb)){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||Zp(i[0]))return;for(let p of i)p.length!==0&&wb(e,p);let a={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},s=o.fill.getGranularityForZoomLevel(r.z),l=Pb[n.type]==="Polygon";for(let p of i){if(p.length===0||Zp(p))continue;let f=Ke(p,s,l);this._generateSideFaces(f,a)}if(!l)return;let u=da(i,r,s,!1),c=this.layoutVertexArray;ga((p,f)=>{fi(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(Ab(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),fi(this.layoutVertexArray,o.x,o.y,s.x,s.y,0,0,n),fi(this.layoutVertexArray,o.x,o.y,s.x,s.y,0,1,n),n+=l,fi(this.layoutVertexArray,a.x,a.y,s.x,s.y,0,0,n),fi(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 wb(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",cr,{omit:["layers","features"]});function Ab(t,e){return t.x===e.x&&(t.x<0||t.x>8192)||t.y===e.y&&(t.y<0||t.y>8192)}function Zp(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 Yp,_b=()=>Yp=Yp||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"])}),Kp={get paint(){return _b()}};var va=Y(ye(),1);var Pa=class extends oe{constructor(e){super(e,Kp)}createBucket(e){return new cr(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=Cb(l,s,0),f=Tb(i,c,u,s),y=f[0],m=f[1];return Ib(y,m,p)}};function yi(t,e){return t.x*e.x+t.y*e.y}function Qp(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=yi(s,s),p=yi(s,l),f=yi(l,l),y=yi(u,s),m=yi(u,l),h=c*f-p*p,g=(f*y-p*m)/h,d=(c*m-p*y)/h,x=1-g-d,b=n.z*x+i.z*g+o.z*d;if(isFinite(b))return b}return 1/0}else{let r=1/0;for(let n of e)r=Math.min(r,n.z);return r}}function Ib(t,e,r){let n=1/0;aa(r,e)&&(n=Qp(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];mp(r,f)&&(n=Math.min(n,Qp(r,f)))}}return n===1/0?!1:n}function Tb(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 x=d.x,b=d.y,v=n[0]*x+n[4]*b+n[12],S=n[1]*x+n[5]*b+n[13],A=n[2]*x+n[6]*b+n[14],w=n[3]*x+n[7]*b+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 va.default(T/B,E/B);G.z=D/B,h.push(G);let O=new va.default(z/V,M/V);O.z=_/V,g.push(O)}i.push(h),o.push(g)}return[i,o]}function Cb(t,e,r){let n=[];for(let i of t){let o=[i.x,i.y,r,1];Wi.transformMat4(o,o,e),n.push(new va.default(o[0]/o[3],o[1]/o[3]))}return n}var kb=Q([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:ef,size:fw,alignment:yw}=kb;var Fb=Q([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:tf,size:dw,alignment:gw}=Fb;var of=Y(Rt(),1);var Eb=of.default.VectorTileFeature.types,rf=63,Mb=Math.cos(75/2*(Math.PI/180)),Lb=15,Db=20,Bb=15,af=1/2,nf=Math.pow(2,Bb-1)/af,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.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(r=>{this.gradients[r.id]={}}),this.layoutVertexArray=new Zo,this.layoutVertexArray2=new Jo,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=Lr("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=Dr("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,tf)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ef),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=Eb[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?Lb*8192/(512*this.overscaling):0,m=this.segments.prepareSegment(p*10,this.layoutVertexArray,this.indexArray),h,g,d,x,b;this.e1=this.e2=-1,c&&(h=e[p-2],b=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;b&&(x=b),h&&(g=h),h=e[v],b=d?d.sub(h)._unit()._perp():x,x=x||b;let S=x.add(b);(S.x!==0||S.y!==0)&&S._unit();let A=x.x*b.x+x.y*b.y,w=S.x*b.x+S.y*b.y,T=w!==0?1/w:1/0,E=2*Math.sqrt(2-2*w),D=w<Mb&&g&&d,B=x.x*b.y-x.y*b.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,x,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=b.mult(-1);else{let _=T*x.add(b).mag()/x.sub(b).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,x,V,G,m),M==="fakeround"){let O=Math.round(E*180/Math.PI/Db);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=b.sub(x)._mult(K)._add(x)._unit()._mult(B?-1:1);this.addHalfVertex(h,X.x,X.y,!1,B,0,m)}}d&&this.addCurrentVertex(h,b,-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,x,0,0,m),this.addCurrentVertex(h,x,1,1,m,!0)),d&&(this.addCurrentVertex(h,b,-1,-1,m,!0),this.addCurrentVertex(h,b,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,b,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>nf/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*(nf-1):this.scaledDistance)*af;if(this.layoutVertexArray.emplaceBack((e<<1)+(o?1:0),(r<<1)+(a?1:0),Math.round(rf*n)+128,Math.round(rf*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",pr,{omit:["layers","patternFeatures"]});var sf,Vb=()=>sf=sf||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"])}),lf,Rb=()=>lf=lf||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 tr(P.paint_line["line-dasharray"]),"line-pattern":new pt(P.paint_line["line-pattern"]),"line-gradient":new ft(P.paint_line["line-gradient"])}),xl={get paint(){return Rb()},get layout(){return Vb()}};var vl=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)}},Sa;var wa=class extends oe{constructor(e){super(e,xl),this.gradientVersion=0,Sa||(Sa=new vl(xl.paint.properties["line-width"].specification),Sa.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){let r=this.gradientExpression();fc(r)?this.stepInterpolant=r._styleExpression.expression instanceof Pr: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"]=Sa.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new pr(e)}queryRadius(e){let r=e,n=uf(ar("line-width",this,r),ar("line-gap-width",this,r)),i=ar("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*uf(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=bp(i,u*a)),dp(s,i,l)}isTileClipped(){return!0}};function uf(t,e){return e>0?e+2*t:t}var cf=Q([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),pf=Q([{name:"a_projected_pos",components:3,type:"Float32"}],4),Zw=Q([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),ff=Q([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]),Jw=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"}]),Pl=Q([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Yw=Q([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4),Kw=Q([{name:"triangle",components:3,type:"Uint16"}]),Qw=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"}]),eA=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"}]),tA=Q([{type:"Float32",name:"offsetX"}]),rA=Q([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),nA=Q([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);var vi=Y(ye(),1);function zb(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 yf(t,e,r){return t.sections.forEach(n=>{n.text=zb(n.text,e,r)}),t}function mf(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`${u}:${f.x}:${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 zr={"!":"\\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 hf(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||!Ys(n)||zr[t[r+1]])&&(!i||!Ys(i)||zr[t[r-1]])&&zr[t[r]]?e+=zr[t[r]]:e+=t[r]}return e}var ae=24;var rx=Y(mi(),1),nx=3;var Ia=nx;function hi(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 Ta=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]}},di=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}=hi(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 Ta(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",Ta);I("ImageAtlas",di);var Fa=(i=>(i[i.none=0]="none",i[i.horizontal=1]="horizontal",i[i.vertical=2]="vertical",i[i.horizontalOnly=3]="horizontalOnly",i))(Fa||{}),bi=-17;function ix(t){for(let e of t)if(e.positionedGlyphs.length!==0)return!1;return!0}var Sf=57344,wf=63743,Ca=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}},gi=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=hf(this.text)}trim(){let e=0;for(let n=0;n<this.text.length&&ka[this.text.charCodeAt(n)];n++)e++;let r=this.text.length;for(let n=this.text.length-1;n>=0&&n>=e&&ka[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(Ca.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 ${wf-Sf+2}`);return}this.text+=String.fromCharCode(n),this.sections.push(Ca.forImage(r,e.verticalAlign)),this.sectionIndex.push(this.sections.length-1)}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=wf?null:++this.imageSectionID:(this.imageSectionID=Sf,this.imageSectionID)}};function ox(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 xi(t,e,r,n,i,o,a,s,l,u,c,p,f,y,m){let h=gi.fromFeature(t,i);p===2&&h.verticalizePunctuation();let g,{processBidirectionalText:d,processStyledBidirectionalText:x}=we;if(d&&h.sections.length===1){g=[];let S=d(h.toString(),Al(h,u,o,e,n,y));for(let A of S){let w=new gi;w.text=A,w.sections=h.sections;for(let T=0;T<A.length;T++)w.sectionIndex.push(0);g.push(w)}}else if(x){g=[];let S=x(h.text,h.sectionIndex,Al(h,u,o,e,n,y));for(let A of S){let w=new gi;w.text=A[0],w.sectionIndex=A[1],w.sections=h.sections,g.push(w)}}else g=ox(h,Al(h,u,o,e,n,y));let b=[],v={positionedLines:b,text:h.toString(),top:c[1],bottom:c[1],left:c[0],right:c[0],writingMode:p,iconsInText:!1,verticalizable:!1};return yx(v,e,r,n,g,a,s,l,p,u,f,m),ix(b)?!1:v}var ka={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},ax={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},sx={40:!0};function If(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 lx(t,e,r,n,i,o){let a=0;for(let l=0;l<t.length();l++){let u=t.getSection(l);a+=If(t.getCharCode(l),u,n,i,e,o)}let s=Math.max(1,Math.ceil(a/r));return a/s}function Af(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 ux(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 _f(t,e,r,n,i,o){let a=null,s=Af(e,r,i,o);for(let l of n){let u=e-l.x,c=Af(u,r,i,o)+l.badness;c<=s&&(a=l,s=c)}return{index:t,x:e,priorBreak:a,badness:s}}function Tf(t){return t?Tf(t.priorBreak).concat(t.index):[]}function Al(t,e,r,n,i,o){if(!t)return[];let a=[],s=lx(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(ka[f]||(u+=If(f,p,n,i,e,o)),c<t.length()-1){let y=Yc(f);(ax[f]||y||p.imageName||c!==t.length()-2&&sx[t.getCharCode(c+1)])&&a.push(_f(c+1,u,s,a,ux(f,t.getCharCode(c+1),y&&l),!1))}}return Tf(_f(t.length(),u,s,a,0,!0))}function Cf(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 cx(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 kf(t){switch(t){case"top":return 0;case"center":return .5;default:return 1}}function px(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 fx(t,e,r){return!(t===1||!e&&!Eo(r)||e&&(ka[r]||Kc(r)))}function yx(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,x=0;for(let S of i){S.trim();let A=S.getMaxScale(),w={positionedGlyphs:[],lineOffset:0};t.positionedLines[x]=w;let T=w.positionedGlyphs,E=0;if(!S.length()){y+=o,++x;continue}let D=cx(n,S,d);for(let M=0;M<S.length();M++){let _=S.getSection(M),V=S.getSectionIndex(M),G=S.getCharCode(M),O=fx(l,c,G),R;if(_.imageName){if(t.iconsInText=!0,_.scale=_.scale*d,R=hx(_,O,A,D,n),!R)continue;E=Math.max(E,R.imageOffset)}else if(R=mx(_,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),dx(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),++x}let{horizontalAlign:b,verticalAlign:v}=Cf(a);gx(t.positionedLines,g,b,v,m,h,o,y,i.length),t.top+=-v*y,t.bottom=t.top+y,t.left+=-b*m,t.right=t.left+m}function mx(t,e,r,n,i,o){let a=o[t.fontStack],s=a&&a[e],l=px(s,i,t,e);if(l===null)return null;let u;if(r)u=n.verticalLineContentWidth-t.scale*ae;else{let c=kf(t.verticalAlign);u=(n.horizontalLineContentHeight-t.scale*ae)*c}return{rect:l.rect,metrics:l.metrics,baselineOffset:u}}function hx(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:-Ia,advance:e?s[1]:s[0]},u;if(e)u=n.verticalLineContentWidth-s[1]*t.scale;else{let p=kf(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 dx(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 gx(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 Ff(t,e,r){let{horizontalAlign:n,verticalAlign:i}=Cf(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 Ea(t){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=t.image.textFitWidth??"stretchOrShrink",l=t.image.textFitHeight??"stretchOrShrink",u=o/a;if(l==="proportional"){if(s==="stretchOnly"&&n/i<u||s==="proportional"){let c=Math.ceil(i*u);e*=c/n,n=c}}else if(s==="proportional"&&l==="stretchOnly"&&u!==0&&n/i>u){let c=Math.ceil(n/u);r*=c/i,i=c}return{x1:e,y1:r,x2:e+n,y2:r+i}}function _l(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 Ef=Y(Rt(),1);var Nr=255,zt=128,Qe=Nr*zt;function Il(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 Tl(t,e,r){let n="never",i=t.get(e);return i?n=i:t.get(r)&&(n="always"),n}var bx=Ef.default.VectorTileFeature.types,xx=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Ma(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 Mf(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 vx(t){for(let e of t.sections)if(ep(e.text))return!0;return!1}var Pi=class{constructor(e){this.layoutVertexArray=new Yo,this.indexArray=new Le,this.programConfigurations=e,this.segments=new pe,this.dynamicLayoutVertexArray=new Ko,this.opacityVertexArray=new Qo,this.hasVisibleVertices=!1,this.placedSymbolArray=new qn}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,cf.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,pf.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,xx,!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",Pi);var Si=class{constructor(e,r,n){this.layoutVertexArray=new e,this.layoutAttributes=r,this.indexArray=new n,this.segments=new pe,this.collisionVertexArray=new ea}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,ff.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}};I("CollisionBuffers",Si);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=Il(this.zoom,n["text-size"]),this.iconSizeData=Il(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=Tl(i,"text-overlap","text-allow-overlap")!=="never"||Tl(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=>Fa[l])),this.stateDependentLayerIds=this.layers.filter(l=>l.isStateDependent()).map(l=>l.id),this.sourceID=e.sourceID}createArrays(){this.text=new Pi(new Ae(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new Pi(new Ae(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new Xn,this.lineVertexArray=new Hn,this.symbolInstances=new Wn,this.textAnchorOffsets=new Zn}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=zr[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:x,sourceLayerIndex:b}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||vx(B);(!z||we.getRTLTextPluginStatus()==="unavailable"||z&&we.isParsed())&&(A=yf(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:x,sourceLayerIndex:b,geometry:S.geometry,properties:g.properties,type:bx[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=In(A.toString()),_=z.fontStack||D,V=y[_]=y[_]||{};this.calculateGlyphDependencies(z.text,V,B,this.allowVerticalPlacement,M)}}}o.get("symbol-placement")==="line"&&(this.features=mf(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,x=this.allowVerticalPlacement&&s===2?Math.PI/2:0,b=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];Ma(m,l.x,l.y,S.x,R+S.y,E.x,E.y,n,V,D.x,D.y,z,M),Ma(m,l.x,l.y,A.x,R+A.y,E.x+E.w,E.y,n,V,B.x,D.y,z,M),Ma(m,l.x,l.y,w.x,R+w.y,E.x,E.y+E.h,n,V,D.x,B.y,z,M),Ma(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),Mf(e.dynamicLayoutVertexArray,l,x),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,b&&b[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 vi.default(e,r)),this._addCollisionDebugVertex(c,p,a,f,y,new vi.default(n,r)),this._addCollisionDebugVertex(c,p,a,f,y,new vi.default(n,i)),this._addCollisionDebugVertex(c,p,a,f,y,new vi.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 Si(Yn,Pl.members,Mt),this.iconCollisionBox=new Si(Yn,Pl.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=Mf;function Lf(t,e){return e.replace(/{([^{}]+)}/g,(r,n)=>t&&n in t?String(t[n]):"")}var Df,Px=()=>Df=Df||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"])}),Bf,Sx=()=>Bf=Bf||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"])}),La={get paint(){return Sx()},get layout(){return Px()}};var wi=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:wr,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",wi,{omit:["defaultValue"]});var Da=class t extends oe{constructor(e){super(e,La)}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()&&!wn(a.value)&&o?Lf(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 La.paint.overridableProperties){if(!t.hasPaintOverride(this.layout,e))continue;let r=this.paint.get(e),n=new wi(r),i=new Ht(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=La.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)===Ar){let c=u.value;a(c.sections)}else u instanceof pn?a(u.sections):u.eachChild(s)},l=n.value;l._styleExpression&&s(l._styleExpression.expression)}return o}};function Vf(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 Rf,wx=()=>Rf=Rf||new ee({"background-color":new F(P.paint_background["background-color"]),"background-pattern":new tr(P.paint_background["background-pattern"]),"background-opacity":new F(P.paint_background["background-opacity"])}),zf={get paint(){return wx()}};var Ba=class extends oe{constructor(e){super(e,zf)}};var Of,Ax=()=>Of=Of||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"])}),Gf={get paint(){return Ax()}};var Va=class extends oe{constructor(e){super(e,Gf)}};var Ra=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 Nf(t){if(t.type==="custom")return new Ra(t);switch(t.type){case"background":return new Ba(t);case"circle":return new la(t);case"color-relief":return new pa(t);case"fill":return new ba(t);case"fill-extrusion":return new Pa(t);case"heatmap":return new ua(t);case"hillshade":return new ca(t);case"line":return new wa(t);case"raster":return new Va(t);case"symbol":return new Da(t)}}var za=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]=Nf(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=dc(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 fy=Y(Rt(),1),yy=Y(mi(),1);var Ur=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=${e} can\'t be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}};var $f=Y(Rt(),1),jf=Y(mi(),1);var Oa=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 Ai=Y(ye(),1),fr=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 Ai.default(this.minX,this.minY))),r.extend(e(new Ai.default(this.maxX,this.minY))),r.extend(e(new Ai.default(this.minX,this.maxY))),r.extend(e(new Ai.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 _i=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 $t(8192,16,0),this.grid3D=new $t(8192,16,0),this.featureIndexArray=new Jn,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 $f.default.VectorTile(new jf.default(this.rawTileData)).layers,this.sourceLayerCoder=new Ur(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=fr.fromPoints(l),p=this.grid.query(c.minX-u,c.minY-u,c.maxX+u,c.maxY+u),f=fr.fromPoints(e.cameraQueryGeometry).expandBy(u),y=this.grid3D.query(f.minX,f.minY,f.maxX,f.maxY,(g,d,x,b)=>gp(e.cameraQueryGeometry,g-u,d-u,x+u,b+u));for(let g of y)p.push(g);p.sort(_x);let m={},h;for(let g=0;g<p.length;g++){let d=p[g];if(d===h)continue;h=d;let x=this.featureIndexArray.get(d),b=null;this.loadMatchingFeature(m,x.bucketIndex,x.sourceLayerIndex,x.featureIndex,s,o.layers,o.availableImages,r,n,i,(v,S,A)=>(b||(b=_e(v)),S.queryIntersectsFeature({queryGeometry:l,feature:v,featureState:A,geometry:b,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 x=f[d];if(a&&!a.has(x))continue;let b=l[x];if(!b)continue;let v={};g&&c&&(v=c.getState(b.sourceLayer||"_geojsonTileLayer",g));let S=de({},u[x]);S.paint=Uf(S.paint,b.paint,h,v,s),S.layout=Uf(S.layout,b.layout,h,v,s);let A=!p||p(h,b,v);if(!A)continue;let w=new Oa(h,this.z,this.x,this.y,g);w.layer=S;let T=e[x];T===void 0&&(T=e[x]=[]),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){let n=e.id;if(this.promoteId){let i=typeof this.promoteId=="string"?this.promoteId:this.promoteId[r];n=e.properties[i],typeof n=="boolean"&&(n=Number(n)),n===void 0&&e.properties?.cluster&&this.promoteId&&(n=Number(e.properties.cluster_id))}return n}};I("FeatureIndex",_i,{omit:["rawTileData","sourceLayerCoder"]});function Uf(t,e,r,n,i){return tn(t,(o,a)=>{let s=e instanceof kt?e.get(a):null;return s&&s.evaluate?s.evaluate(r,n,i):s})}function _x(t,e){return e-t}var qf=Y(ye(),1);var et=class t extends qf.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 Cl(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 Wf(t){let e=0;for(let r=0;r<t.length-1;r++)e+=t[r].dist(t[r+1]);return e}function Xf(t,e,r){return t?3/5*e*r:0}function Hf(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function Zf(t,e,r,n,i,o){let a=Xf(r,i,o),s=Hf(r,n)*o,l=0,u=Wf(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||Cl(t,d,s,a,e)?d:void 0}l+=y}}function Jf(t,e,r,n,i,o,a,s,l){let u=Xf(n,o,a),c=Hf(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 Yf(t,m,e,u,r,p,f,!1,l)}function Yf(t,e,r,n,i,o,a,s,l){let u=o/2,c=Wf(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),x=g.angleTo(h);for(;f+r<p+d;){f+=r;let b=(f-p)/d,v=lt.number(h.x,g.x,b),S=lt.number(h.y,g.y,b);if(v>=0&&v<l&&S>=0&&S<l&&f-u>=0&&f+u<=c){let A=new et(v,S,x,m);A._round(),(!n||Cl(t,A,o,n,i))&&y.push(A)}}p+=d}return!s&&!y.length&&!a&&(y=Yf(t,p/2,r,n,i,o,a,!0,l)),y}var ht=Y(ye(),1);function Kf(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 be=Y(ye(),1);var $r=he;function kl(t,e,r,n){let i=[],o=t.image,a=o.pixelRatio,s=o.paddedRect.w-2*$r,l=o.paddedRect.h-2*$r,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,x=y,b=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=Ea(t)),d=Ga(c,0,_[0]),b=Ga(p,0,_[1]),x=Ga(c,_[0],_[2]),v=Ga(p,_[1],_[3]),S=_[0]-d,w=_[1]-b,A=V-x,T=G-v}let E=u.x1,D=u.y1,B=u.x2-E,z=u.y2-D,M=(_,V,G,O)=>{let R=Na(_.stretch-d,x,B,E),K=Ua(_.fixed-S,A,_.stretch,y),X=Na(V.stretch-b,v,z,D),re=Ua(V.fixed-w,T,V.stretch,m),me=Na(G.stretch-d,x,B,E),Ut=Ua(G.fixed-S,A,G.stretch,y),tt=Na(O.stretch-b,v,z,D),gt=Ua(O.fixed-w,T,O.stretch,m),Gi=new be.default(R,X),Ni=new be.default(me,X),Ui=new be.default(me,tt),$i=new be.default(R,tt),is=new be.default(K/a,re/a),Ie=new be.default(Ut/a,gt/a),bt=e*Math.PI/180;if(bt){let xt=Math.sin(bt),Zr=Math.cos(bt),Be=[Zr,-xt,xt,Zr];Gi._matMult(Be),Ni._matMult(Be),$i._matMult(Be),Ui._matMult(Be)}let Hr=_.stretch+_.fixed,os=G.stretch+G.fixed,ji=V.stretch+V.fixed,as=O.stretch+O.fixed,Te={x:o.paddedRect.x+$r+Hr,y:o.paddedRect.y+$r+ji,w:os-Hr,h:as-ji},xe=A/a/B,rt=T/a/z;return{tl:Gi,tr:Ni,bl:$i,br:Ui,tex:Te,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:is,pixelOffsetBR:Ie,minFontScaleX:xe,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 _=Qf(c,h,y),V=Qf(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 Ga(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 Qf(t,e,r){let n=[{fixed:-$r,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+$r,stretch:r}),n}function Na(t,e,r,n){return t/e*r+n}function Ua(t,e,r,n){return t-e*r/n}function ey(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=Ia+1,h=!0,g=1,d=0,x=(i||s)&&p.vertical,b=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+b,p.y]:[0,0],S=i?[0,0]:[p.x+b+r[0],p.y+r[1]-d],A=[0,0];x&&(A=S,S=[0,0]);let w=p.metrics.isDoubleResolution?2:1,T=(p.metrics.left-m)*p.scale-b+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 be.default(T,E),M=new be.default(D,E),_=new be.default(T,B),V=new be.default(D,B);if(x){let X=new be.default(-b,b-bi),re=-Math.PI/2,me=ae/2-b,Ut=p.imageName?me:0,tt=new be.default(5-bi-me,-Ut),gt=new be.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 be.default(0,0),O=new be.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 Ii=Y(ye(),1);var yr=class{constructor(e,r,n,i,o,a,s,l,u,c){if(this.boxStartIndex=e.length,u){let p=a.top,f=a.bottom,y=a.collisionPadding;y&&(p-=y[1],f+=y[3]);let m=f-p;m>0&&(m=Math.max(10,m),this.circleDiameter=m)}else{let p=a.image?.content&&(a.image.textFitWidth||a.image.textFitHeight)?Ea(a):{x1:a.left,y1:a.top,x2:a.right,y2:a.bottom};p.y1=p.y1*s-l[0],p.y2=p.y2*s+l[2],p.x1=p.x1*s-l[3],p.x2=p.x2*s+l[1];let f=a.collisionPadding;if(f&&(p.x1-=f[0]*s,p.y1-=f[1]*s,p.x2+=f[2]*s,p.y2+=f[3]*s),c){let y=new Ii.default(p.x1,p.y1),m=new Ii.default(p.x2,p.y1),h=new Ii.default(p.x1,p.y2),g=new Ii.default(p.x2,p.y2),d=c*Math.PI/180;y._rotate(d),m._rotate(d),h._rotate(d),g._rotate(d),p.x1=Math.min(y.x,m.x,h.x,g.x),p.x2=Math.max(y.x,m.x,h.x,g.x),p.y1=Math.min(y.y,m.y,h.y,g.y),p.y2=Math.max(y.y,m.y,h.y,g.y)}e.emplaceBack(r.x,r.y,p.x1,p.y1,p.x2,p.y2,n,i,o)}this.boxEndIndex=e.length}};var Ti=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 Fl=Y(ye(),1);function ty(t,e=1,r=!1){let n=fr.fromPoints(t[0]),i=Math.min(n.width(),n.height()),o=i/2,a=new Ti([],Ix),{minX:s,minY:l,maxX:u,maxY:c}=n;if(i===0)return new Fl.default(s,l);for(let y=s;y<u;y+=i)for(let m=l;m<c;m+=i)a.push(new jr(y+o,m+o,o,t));let p=Cx(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 jr(y.p.x-o,y.p.y-o,o,t)),a.push(new jr(y.p.x+o,y.p.y-o,o,t)),a.push(new jr(y.p.x-o,y.p.y+o,o,t)),a.push(new jr(y.p.x+o,y.p.y+o,o,t)),f+=4)}return r&&(console.log(`num probes: ${f}`),console.log(`best distance: ${p.d}`)),p.p}function Ix(t,e){return e.max-t.max}function jr(t,e,r,n){this.p=new Fl.default(t,e),this.h=r,this.d=Tx(this.p,n),this.max=this.d+this.h*Math.SQRT2}function Tx(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,ll(t,u,c))}}return(r?1:-1)*Math.sqrt(n)}function Cx(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 jr(r/e,n/e,0,t)}var Dl=Y(rl(),1);var El=(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))(El||{}),Ot=7,$a=Number.POSITIVE_INFINITY;function Ml(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]!==$a?n(t,e[0],e[1]):r(t,e[0])}function Ll(t,e,r){let n=t.layout,i=n.get("text-variable-anchor-offset")?.evaluate(e,{},r);if(i){let a=i.values,s=[];for(let l=0;l<a.length;l+=2){let u=s[l]=a[l],c=a[l+1].map(p=>p*ae);u.startsWith("top")?c[1]-=Ot:u.startsWith("bottom")&&(c[1]+=Ot),s[l+1]=c}return new Ee(s)}let o=n.get("text-variable-anchor");if(o){let a;t._unevaluatedLayout.getValue("text-radial-offset")!==void 0?a=[n.get("text-radial-offset").evaluate(e,{},r)*ae,$a]:a=n.get("text-offset").evaluate(e,{},r).map(u=>u*ae);let l=[];for(let u of o)l.push(u,Ml(u,a));return new Ee(l)}return null}function iy(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=Zc(S)?A:0,T=n.get("text-anchor").evaluate(c,{},t.canonical),E=Ll(r,c,t.canonical);if(!E){let _=n.get("text-radial-offset").evaluate(c,{},t.canonical);_?d=Ml(T,[_*ae,$a]):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&&In(S)&&(h.vertical=xi(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(ry(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=xi(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=ry(T));let _=xi(g,t.glyphMap,t.glyphPositions,t.imagePositions,p,z,a,T,D,w,d,1,!1,y,f);_&&(h.horizontal[D]=_),M(),In(S)&&s&&l&&(h.vertical=xi(g,t.glyphMap,t.glyphPositions,t.imagePositions,p,z,a,T,D,w,d,2,!1,y,f))}}let x,b=!1;if(c.icon&&c.icon.name){let S=t.imageMap[c.icon.name];S&&(x=Ff(t.imagePositions[c.icon.name],n.get("icon-offset").evaluate(c,{},t.canonical),n.get("icon-anchor").evaluate(c,{},t.canonical)),b=!!S.sdf,t.bucket.sdfIcons===void 0?t.bucket.sdfIcons=b:t.bucket.sdfIcons!==b&&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=oy(h.horizontal)||h.vertical;t.bucket.iconsInText=v?v.iconsInText:!1,(v||x)&&kx(t.bucket,c,h,x,t.imageMap,o,y,m,d,b,t.canonical,t.subdivisionGranularity)}t.showCollisionBoxes&&t.bucket.generateCollisionDebugBuffers()}function ry(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 kx(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=oy(r.horizontal),g=24,d=a/g,x=t.tilePixelRatio*d,b=t.tilePixelRatio*f/g,v=t.tilePixelRatio*s,S=t.tilePixelRatio*y.get("symbol-spacing"),A=y.get("text-padding")*t.tilePixelRatio,w=Vf(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&&(_=_l(n,r.vertical,M,y.get("icon-text-fit-padding"),m,d)),h&&(n=_l(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||Ex(t,R,O,r,n,i,_,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,x,[A,A,A,A],E,l,v,w,D,m,e,o,u,c,a)};if(B==="line")for(let O of Kf(e.geometry,0,0,8192,8192)){let R=Ke(O,V),K=Jf(R,S,T,r.vertical||h,n,g,b,t.overscaling,8192);for(let X of K){let re=h;(!re||!Mx(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=Zf(R,T,r.vertical||h,n,g,b);K&&G(R,K)}}else if(e.type==="Polygon")for(let O of Yt(e.geometry,0)){let R=ty(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 Fx(t,e){let r=t.length,n=e?.values;if(n?.length>0)for(let i=0;i<n.length;i+=2){let o=El[n[i]],a=n[i+1];t.emplaceBack(o,a[0],a[1])}return[r,t.length]}function ny(t,e,r,n,i,o,a,s,l,u,c,p,f,y,m){let h=ey(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(`${t.layerIds[0]}: Value for "text-size" is >= ${Nr}. 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(`${t.layerIds[0]}: Value for "text-size" is >= ${Nr}. Reduce your "text-size".`)),t.addSymbols(t.text,h,d,s,o,a,u,e,l.lineStartIndex,l.lineLength,f,m);for(let x of c)p[x]=t.text.placedSymbolArray.length-1;return h.length*4}function oy(t){for(let e in t)return t[e];return null}function Ex(t,e,r,n,i,o,a,s,l,u,c,p,f,y,m,h,g,d,x,b,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,Dl.default)("");if(t.allowVerticalPlacement&&n.vertical){let xe=s.layout.get("text-rotate").evaluate(v,{},w)+90,rt=n.vertical;z=new yr(l,e,u,c,p,rt,f,y,m,xe),a&&(M=new yr(l,e,u,c,p,a,g,d,m,xe))}if(i){let Te=s.layout.get("icon-rotate").evaluate(v,{}),xe=s.layout.get("icon-text-fit")!=="none",rt=kl(i,Te,A,xe),xt=a?kl(a,Te,A,xe):void 0;B=new yr(l,e,u,c,p,i,g,d,!1,Te),_=rt.length*4;let Zr=t.iconSizeData,Be=null;Zr.kind==="source"?(Be=[zt*s.layout.get("icon-size").evaluate(v,{})],Be[0]>Qe&&ce(`${t.layerIds[0]}: Value for "icon-size" is >= ${Nr}. Reduce your "icon-size".`)):Zr.kind==="composite"&&(Be=[zt*S.compositeIconSizes[0].evaluate(v,{},w),zt*S.compositeIconSizes[1].evaluate(v,{},w)],(Be[0]>Qe||Be[1]>Qe)&&ce(`${t.layerIds[0]}: Value for "icon-size" is >= ${Nr}. Reduce your "icon-size".`)),t.addSymbols(t.icon,rt,Be,b,x,v,0,e,E.lineStartIndex,E.lineLength,-1,w),R=t.icon.placedSymbolArray.length-1,xt&&(V=xt.length*4,t.addSymbols(t.icon,xt,Be,b,x,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 xe=n.horizontal[Te];if(!D){re=(0,Dl.default)(xe.text);let xt=s.layout.get("text-rotate").evaluate(v,{},w);D=new yr(l,e,u,c,p,xe,f,y,m,xt)}let rt=xe.positionedLines.length===1;if(G+=ny(t,e,xe,o,s,m,v,h,E,n.vertical?1:3,rt?me:[Te],X,R,S,w),rt)break}n.vertical&&(O+=ny(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,Gi=z?z.boxEndIndex:t.collisionBoxArray.length,Ni=B?B.boxStartIndex:t.collisionBoxArray.length,Ui=B?B.boxEndIndex:t.collisionBoxArray.length,$i=M?M.boxStartIndex:t.collisionBoxArray.length,is=M?M.boxEndIndex:t.collisionBoxArray.length,Ie=-1,bt=(Te,xe)=>Te&&Te.circleDiameter?Math.max(Te.circleDiameter,xe):xe;Ie=bt(D,Ie),Ie=bt(z,Ie),Ie=bt(B,Ie),Ie=bt(M,Ie);let Hr=Ie>-1?1:0;Hr&&(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 os=Ll(s,v,w),[ji,as]=Fx(t.textAnchorOffsets,os);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,Gi,Ni,Ui,$i,is,u,G,O,_,V,Hr,0,f,Ie,ji,as)}function Mx(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 ja=1,Ci=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*ja,h:p.bitmap.height+2*ja};n.push(f),u[c]={rect:f,metrics:p.metrics}}}let{w:i,h:o}=hi(n),a=new sr({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;sr.copy(c.bitmap,a,{x:0,y:0},{x:p.x+ja,y:p.y+ja},c.bitmap)}}this.image=a,this.positions=r}};I("GlyphAtlas",Ci);function sy(t,e,r){e=Math.pow(2,r)-e-1;var n=ay(t*256,e*256,r),i=ay((t+1)*256,(e+1)*256,r);return n[0]+","+n[1]+","+i[0]+","+i[1]}function ay(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 py=Y(ye(),1);var Bl=63710088e-1,ki=class t{constructor(e,r){if(isNaN(e)||isNaN(r))throw new Error(`Invalid LngLat object: (${e}, ${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(wu(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${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 Bl*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 ly=2*Math.PI*Bl;function uy(t){return ly*Math.cos(t*Math.PI/180)}function Lx(t){return(180+t)/360}function Dx(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function Bx(t,e){return t/uy(e)}function Vx(t){return t*360-180}function Vl(t){let e=180-t*360;return 360/Math.PI*Math.atan(Math.exp(e*Math.PI/180))-90}function Rx(t,e){return t*uy(Vl(e))}function zx(t){return 1/Math.cos(t*Math.PI/180)}var Fi=class t{constructor(e,r,n=0){this.x=+e,this.y=+r,this.z=+n}static fromLngLat(e,r=0){let n=ki.convert(e);return new t(Lx(n.lng),Dx(n.lat),Bx(r,n.lat))}toLngLat(){return new ki(Vx(this.x),Vl(this.y))}toAltitude(){return Rx(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/ly*zx(Vl(this.y))}};function cy(t,e,r){return!(t<Hi||t>Xi||r<0||r>=Math.pow(2,t)||e<0||e>=Math.pow(2,t))}var qa=class{constructor(e,r,n){if(!cy(e,r,n))throw new Error(`x=${r}, y=${n}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} ${Hi}<=z<=${Xi} `);this.z=e,this.x=r,this.y=n,this.key=Ei(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=sy(this.x,this.y,this.z),o=Ox(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 py.default((e.x*r-this.x)*8192,(e.y*r-this.y)*8192)}toString(){return`${this.z}/${this.x}/${this.y}`}},Rl=class{constructor(e,r){this.wrap=e,this.canonical=r,this.key=Ei(e,r.z,r.z,r.x,r.y)}},Mi=class t{constructor(e,r,n,i,o){this.terrainRttPosMatrix32f=null;if(e<n)throw new Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${n}`);this.overscaledZ=e,this.wrap=r,this.canonical=new qa(n,+i,+o),this.key=Ei(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 = ${e}; overscaledZ = ${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 = ${e}; overscaledZ = ${this.overscaledZ}`);let n=this.canonical.z-e;return e>this.canonical.z?Ei(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):Ei(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 Rl(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new Fi(e.x-this.wrap,e.y))}};function Ei(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 Ox(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",qa);I("OverscaledTileID",Mi,{omit:["terrainRttPosMatrix32f"]});var Wa=class{constructor(e){this.tileID=new Mi(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 jn;let a=new Ur(Object.keys(e.layers).sort()),s=new _i(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 "${this.source}" layer "${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 = ${B.source} does not equal this.source = ${this.source}`),B.minzoom&&this.zoom<Math.floor(B.minzoom)||B.maxzoom&&this.zoom>=B.maxzoom||B.visibility==="none")continue;zl(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=tn(u.glyphDependencies,A=>Object.keys(A).map(Number));this.inFlightDependencies.forEach(A=>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,x,b]=await Promise.all([f,m,g]),v=new Ci(d),S=new di(x,b);for(let A in l){let w=l[A];w instanceof Xe?(zl(w.layers,this.zoom,n),iy({bucket:w,glyphMap:d,glyphPositions:v.positions,imageMap:x,imagePositions:S.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:u.subdivisionGranularity})):w.hasPattern&&(w instanceof pr||w instanceof ur||w instanceof cr)&&(zl(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?x:null,glyphPositions:this.returnDependencies?v.positions:null}}};function zl(t,e,r){let n=new W(e);for(let i of t)i.recalculate(n,r)}var Gx=60,XI=1e3/Gx;var qr=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 Wr=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 Uc(e.request,r);try{return{vectorTile:new fy.default.VectorTile(new yy.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 ${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: ${i.message}`,new Error(s)}}async loadTile(e){let r=e.uid,n=e&&e.request&&e.request.collectResourceTiming?new qr(e.request):!1,i=new Wa(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 Xa=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 Iu(i,-1,-1,u,c)):i,f=new ii(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 Gy=Y(gy(),1);var Ol=Y(ye(),1),by=Y(Rt(),1);var Nx=by.default.VectorTileFeature.prototype.toGeoJSON,Gl=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 Ol.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 Ol.default(i[0],i[1]));e.push(n)}return e}}toGeoJSON(e,r,n){return Nx.call(this,e,r,n)}},Za=class{constructor(e){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=8192,this.length=e.length,this._features=e}feature(e){return new Gl(this._features[e])}};var Ny=Y(Ay(),1);var _y=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],$l=1,Di=8,Vi=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!==$l)throw new Error(`Got v${i} data when expected v${$l}.`);let o=_y[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: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=n,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;let o=_y.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: ${n}.`);i&&i instanceof ArrayBuffer?(this.data=i,this.ids=new this.IndexArrayType(this.data,Di,e),this.coords=new this.ArrayType(this.data,Di+s+l,e*2),this._pos=e*2,this._finished=!0):(this.data=new ArrayBuffer(Di+a+s+l),this.ids=new this.IndexArrayType(this.data,Di,e),this.coords=new this.ArrayType(this.data,Di+s+l,e*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,($l<<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 ${e} items when expected ${this.numItems}.`);return ql(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],x=a[2*g+1];d>=e&&d<=n&&x>=r&&x<=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++)Iy(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];Iy(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 ql(t,e,r,n,i,o){if(i-n<=r)return;let a=n+i>>1;Ty(t,e,a,n,i,o),ql(t,e,r,n,a-1,1-o),ql(t,e,r,a+1,i,1-o)}function Ty(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));Ty(t,e,r,m,h,o)}let a=e[2*r+o],s=n,l=i;for(Bi(t,e,n,r),e[2*i+o]>a&&Bi(t,e,n,i);s<l;){for(Bi(t,e,s,l),s++,l--;e[2*s+o]<a;)s++;for(;e[2*l+o]>a;)l--}e[2*n+o]===a?Bi(t,e,n,l):(l++,Bi(t,e,l,i)),l<=r&&(n=l+1),r<=l&&(i=l-1)}}function Bi(t,e,r,n){jl(t,r,n),jl(e,2*r,2*n),jl(e,2*r+1,2*n+1)}function jl(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}function Iy(t,e,r,n){let i=t-r,o=e-n;return i*i+o*o}var Kx={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},Cy=Math.fround||(t=>e=>(t[0]=+e,t[0]))(new Float32Array(1)),mr=2,Nt=3,Wl=4,Gt=5,Fy=6,Ri=class{constructor(e){this.options=Object.assign(Object.create(Kx),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 ${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=Cy(Ya(c)),y=Cy(Ka(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(Ya(n),Ka(a),Ya(o),Ka(i)),u=s.data,c=[];for(let p of l){let f=this.stride*p;c.push(u[f+Gt]>1?ky(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+Wl]===e&&p.push(a[y+Gt]>1?ky(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 Vi(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=Ey(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=Ya(g),f=Ka(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+mr]<=r)continue;l[p+mr]=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 x=d*c;l[x+mr]>r&&(g+=l[x+Gt])}if(g>h&&g>=a){let d=f*h,x=y*h,b,v=-1,S=((p/c|0)<<5)+(r+1)+this.points.length;for(let A of m){let w=A*c;if(l[w+mr]<=r)continue;l[w+mr]=r;let T=l[w+Gt];d+=l[w]*T,x+=l[w+1]*T,l[w+Wl]=S,o&&(b||(b=this._map(l,p,!0),v=this.clusterProps.length,this.clusterProps.push(b)),o(b,this._map(l,w)))}l[p+Wl]=S,u.push(d/g,x/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 x=d*c;if(!(l[x+mr]<=r)){l[x+mr]=r;for(let b=0;b<c;b++)u.push(l[x+b])}}}}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+Fy]];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 ky(t,e,r){return{type:"Feature",id:t[e+Nt],properties:Ey(t,e,r),geometry:{type:"Point",coordinates:[Qx(t[e]),e0(t[e+1])]}}}function Ey(t,e,r){let n=t[e+Gt],i=n>=1e4?`${Math.round(n/1e3)}k`:n>=1e3?`${Math.round(n/100)/10}k`:n,o=t[e+Fy],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 Ya(t){return t/360+.5}function Ka(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 Qx(t){return(t-.5)*360}function e0(t){let e=(180-t*360)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function zi(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=t0(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&&zi(t,e,s,n),t[s+2]=i,r-s>3&&zi(t,s,r,n))}function t0(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,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")Qa(i,r);else if(e==="Polygon")Qa(i,r[0]);else if(e==="MultiLineString")for(let o of r)Qa(i,o);else if(e==="MultiPolygon")for(let o of r)Qa(i,o[0]);return i}function Qa(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 Zl(t,e){let r=[];if(t.type==="FeatureCollection")for(let n=0;n<t.features.length;n++)es(r,t.features[n],e,n);else t.type==="Feature"?es(r,t,e):es(r,{geometry:t},e);return r}function es(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")My(i,s);else if(o==="MultiPoint")for(let u of i)My(u,s);else if(o==="LineString")Hl(i,s,a,!1);else if(o==="MultiLineString")if(r.lineMetrics){for(let u of i)s=[],Hl(u,s,a,!1),t.push(dt(l,"LineString",s,e.properties));return}else Xl(i,s,a,!1);else if(o==="Polygon")Xl(i,s,a,!0);else if(o==="MultiPolygon")for(let u of i){let c=[];Xl(u,c,a,!0),s.push(c)}else if(o==="GeometryCollection"){for(let u of e.geometry.geometries)es(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 My(t,e){e.push(Ly(t[0]),Dy(t[1]),0)}function Hl(t,e,r,n){let i,o,a=0;for(let l=0;l<t.length;l++){let u=Ly(t[l][0]),c=Dy(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,zi(e,0,s,r),e[s+2]=1,e.size=Math.abs(a),e.start=0,e.end=e.size}function Xl(t,e,r,n){for(let i=0;i<t.length;i++){let o=[];Hl(t[i],o,r,n),e.push(o)}}function Ly(t){return t/360+.5}function Dy(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")r0(c,m,r,n,i);else if(p==="LineString")Vy(c,m,r,n,i,!1,s.lineMetrics);else if(p==="MultiLineString")Jl(c,m,r,n,i,!1);else if(p==="Polygon")Jl(c,m,r,n,i,!0);else if(p==="MultiPolygon")for(let h of c){let g=[];Jl(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 r0(t,e,r,n,i){for(let o=0;o<t.length;o+=3){let a=t[o+i];a>=r&&a<=n&&Xr(e,t[o],t[o+1],t[o+2])}}function Vy(t,e,r,n,i,o,a){let s=By(t),l=i===0?n0:i0,u=t.start,c,p;for(let d=0;d<t.length-3;d+=3){let x=t[d],b=t[d+1],v=t[d+2],S=t[d+3],A=t[d+4],w=i===0?x:b,T=i===0?S:A,E=!1;a&&(c=Math.sqrt(Math.pow(x-S,2)+Math.pow(b-A,2))),w<r?T>r&&(p=l(s,x,b,S,A,r),a&&(s.start=u+c*p)):w>n?T<n&&(p=l(s,x,b,S,A,n),a&&(s.start=u+c*p)):Xr(s,x,b,v),T<r&&w>=r&&(p=l(s,x,b,S,A,r),E=!0),T>n&&w<=n&&(p=l(s,x,b,S,A,n),E=!0),!o&&E&&(a&&(s.end=u+c*p),e.push(s),s=By(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&&Xr(s,y,m,h),f=s.length-3,o&&f>=3&&(s[f]!==s[0]||s[f+1]!==s[1])&&Xr(s,s[0],s[1],s[2]),s.length&&e.push(s)}function By(t){let e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function Jl(t,e,r,n,i,o){for(let a of t)Vy(a,e,r,n,i,o,!1)}function Xr(t,e,r,n){t.push(e,r,n)}function n0(t,e,r,n,i,o){let a=(o-e)/(n-e);return Xr(t,o,r+(i-r)*a,1),a}function i0(t,e,r,n,i,o){let a=(o-r)/(i-r);return Xr(t,e+(n-e)*a,o,1),a}function Kl(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=Ry(i,1).concat(n)),o&&(n=n.concat(Ry(o,-1)))),n}function Ry(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=Yl(i.geometry,e);else if(o==="MultiLineString"||o==="Polygon"){a=[];for(let s of i.geometry)a.push(Yl(s,e))}else if(o==="MultiPolygon"){a=[];for(let s of i.geometry){let l=[];for(let u of s)l.push(Yl(u,e));a.push(l)}}r.push(dt(i.id,o,a,i.tags))}return r}function Yl(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 ts(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(zy(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(zy(a[l][c],a[l][c+1],e,r,n,i));o.geometry.push(u)}}return t.transformed=!0,t}function zy(t,e,r,n,i,o){return[Math.round(r*(t*n-i)),Math.round(r*(e*n-o))]}function eu(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)o0(a,s,o,i);return a}function o0(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")Ql(a,i,t,r,!1,!1);else if(o==="MultiLineString"||o==="Polygon")for(let s=0;s<i.length;s++)Ql(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++)Ql(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 Ql(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&&a0(s,o),t.push(s)}function a0(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 s0={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0},ru=class{constructor(e,r){r=this.options=l0(Object.create(s0),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=Zl(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=Kl(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=tu(r,n,i),y=this.tiles[f];if(!y&&(c>1&&console.time("creation"),y=this.tiles[f]=eu(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${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,x=null,b=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&&(x=Ue(A,p,i-m,i+g,1,y.minY,y.maxY,u),b=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(x||[],r+1,n*2,i*2),l.push(b||[],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=tu(e,r,n);if(this.tiles[l])return ts(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[tu(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]?ts(this.tiles[l],o):null)}};function tu(t,e,r){return((1<<t)*r+e)*32+t}function l0(t,e){for(let r in e)t[r]=e[r];return t}function nu(t,e){return new ru(t,e)}function Oi(t,e){return e?t.properties[e]:t.id}function iu(t,e){if(t==null)return!0;if(t.type==="Feature")return Oi(t,e)!=null;if(t.type==="FeatureCollection"){let r=new Set;for(let n of t.features){let i=Oi(n,e);if(i==null||r.has(i))return!1;r.add(i)}return!0}return!1}function ou(t,e){let r=new Map;if(t!=null)if(t.type==="Feature")r.set(Oi(t,e),t);else for(let n of t.features)r.set(Oi(n,e),n);return r}function Oy(t,e,r){if(e.removeAll&&t.clear(),e.remove)for(let n of e.remove)t.delete(n);if(e.add)for(let n of e.add){let i=Oi(n,r);i!=null&&t.set(i,n)}if(e.update)for(let n of e.update){let i=t.get(n.id);if(i==null)continue;let o=n.newGeometry||n.removeAllProperties,a=!n.removeAllProperties&&(n.removeProperties?.length>0||n.addOrUpdateProperties?.length>0);if((o||a)&&(i={...i},t.set(n.id,i),a&&(i.properties={...i.properties})),n.newGeometry&&(i.geometry=n.newGeometry),n.removeAllProperties)i.properties={};else if(n.removeProperties?.length>0)for(let s of n.removeProperties)Object.prototype.hasOwnProperty.call(i.properties,s)&&delete i.properties[s];if(n.addOrUpdateProperties?.length>0)for(let{key:s,value:l}of n.addOrUpdateProperties)i.properties[s]=l}}var rs=class extends Wr{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 Za(o.features),s=(0,Ny.default)(a);return(s.byteOffset!==0||s.byteLength!==s.buffer.byteLength)&&(s=new Uint8Array(s)),{vectorTile:a,rawData:s.buffer}}async loadData(r){this._pendingRequest?.abort();let n=r&&r.request&&r.request.collectResourceTiming?new qr(r.request):!1;this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON(r,this._pendingRequest),this._geoJSONIndex=r.cluster?new Ri(u0(r)).load((await this._pendingData).features):nu(await this._pendingData,r.geojsonVtOptions),this.loaded={};let i={};if(n){let o=n.finish();o&&(i.resourceTiming={},i.resourceTiming[r.source]=JSON.parse(JSON.stringify(o)))}return i}catch(i){if(delete this._pendingRequest,Lc(i))return{abandoned:!0};throw i}}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 \'${r.source}\' is not a valid GeoJSON object.`);if((0,Gy.default)(i,!0),r.filter){let o=Qt(r.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(o.result==="error")throw new Error(o.value.map(s=>`${s.key}: ${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 Nc(r.request,n);return this._dataUpdateable=iu(o.data,i)?ou(o.data,i):void 0,o.data}if(typeof r.data=="string")try{let o=JSON.parse(r.data);return this._dataUpdateable=iu(o,i)?ou(o,i):void 0,o}catch{throw new Error(`Input data given to \'${r.source}\' is not a valid GeoJSON object.`)}if(!r.dataDiff)throw new Error(`Input data given to \'${r.source}\' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${r.source}`);return Oy(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 u0({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=Qt(u),p=Qt(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 ns=class{constructor(e){this.self=e,this.actor=new Co(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 "${r}" already registered.`);this.externalWorkerSourceTypes[r]=n},this.self.addProtocol=Bc,this.self.removeProtocol=Vc,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 za),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 Wr(i,this._getLayerIndex(e),this._getAvailableImages(e));break;case"geojson":this.workerSources[e][r][n]=new rs(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 Xa),this.demWorkerSources[e][r]}};at(self)&&(self.worker=new ns(self));})();\n/*! Bundled license information:\n\nieee754/index.js:\n (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)\n*/\n';var $F=()=>$t.WORKER_URL?$t.WORKER_URL:URL.createObjectURL(new Blob([P1],{type:"text/javascript"}));function w1(){return new Worker($F())}var T1="maplibre_preloaded_worker_pool",ya=class t{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<t.workerCount;)this.workers.push(w1());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[T1]}numActive(){return Object.keys(this.active).length}},KF=Math.floor(ae.hardwareConcurrency/2);ya.workerCount=Nb(globalThis)?Math.max(Math.min(KF,3),1):1;var wy;function Qp(){return wy||(wy=new ya),wy}var Ll=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 Jp(o,r);a.name=`Worker ${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)}},eh;function Ty(){return eh||(eh=new Ll(Qp(),cc),eh.registerMessageHandler("GR",(t,e,r)=>Bo(e,r))),eh}m();function JF(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 QF(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 S1(t,e,r,n,i,o,a){let s=QF(i?.layers??null,e,t.id),l=o.maxPitchScaleFactor(),u=t.tilesIn(n,l,s);u.sort(I1);let c=[];for(let h of u)c.push({wrappedTileID:h.tileID.wrapped().key,queryResults:h.tile.queryRenderedFeatures(e,r,t._state,h.queryGeometry,h.cameraQueryGeometry,h.scale,i,o,l,JF(t.transform,h.tileID),a?(f,d)=>a(h.tileID,f,d):void 0)});let p=eO(c);return tO(p,t)}function C1(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(I1);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 rO(s,t,r)}function M1(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 I1(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 eO(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 tO(t,e){for(let r in t)for(let n of t[r])A1(n,e);return t}function rO(t,e,r){for(let n in t)for(let i of t[n]){let o=e[n],a=r[o.source];A1(i,a)}return t}function A1(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 th(t,e,r){let n=t;if(t.url?n=(await Kn(e.transformRequest(t.url,"Source"),r)).data:await ae.frameAsync(r),!n)return null;let i=nn(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 nr=63710088e-1,J=class t{constructor(e,r){if(isNaN(e)||isNaN(r))throw new Error(`Invalid LngLat object: (${e}, ${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(${this.lng}, ${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 nr*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 mt=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(${this._sw.toString()}, ${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 E1=2*Math.PI*nr;function L1(t){return E1*Math.cos(t*Math.PI/180)}function Dn(t){return(180+t)/360}function Kr(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function dn(t,e){return t/L1(e)}function nO(t){return t*360-180}function Sy(t){let e=180-t*360;return 360/Math.PI*Math.atan(Math.exp(e*Math.PI/180))-90}function rh(t,e){return t*L1(Sy(e))}function iO(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(Dn(n.lng),Kr(n.lat),dn(r,n.lat))}toLngLat(){return new J(nO(this.x),Sy(this.y))}toAltitude(){return rh(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/E1*iO(Sy(this.y))}};var ga=class{constructor(e,r,n){this.bounds=mt.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(Dn(this.bounds.getWest())*r),minY:Math.floor(Kr(this.bounds.getNorth())*r),maxX:Math.ceil(Dn(this.bounds.getEast())*r),maxY:Math.ceil(Kr(this.bounds.getSouth())*r)};return e.x>=n.minX&&e.x<n.maxX&&e.y>=n.minY&&e.y<n.maxY}};var Dl=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,nn(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 th(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 ga(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 ho=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,nn(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 th(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,r&&(Z(this,r),r.bounds&&(this.tileBounds=new ga(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 Gt.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 R1(t,e,r){e=Math.pow(2,r)-e-1;var n=D1(t*256,e*256,r),i=D1((t+1)*256,(e+1)*256,r);return n[0]+","+n[1]+","+i[0]+","+i[1]}function D1(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 O1=se(fe(),1);m();function k1(t,e,r){return!(t<ls||t>Gi||r<0||r>=Math.pow(2,t)||e<0||e>=Math.pow(2,t))}function F1(t,e){let{x:r,y:n}=xe.fromLngLat(e);return!(t<ls||t>Gi||n<0||n>=1||r<0||r>=1)}var di=class{constructor(e,r,n){if(!k1(e,r,n))throw new Error(`x=${r}, y=${n}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} ${ls}<=z<=${Gi} `);this.z=e,this.x=r,this.y=n,this.key=fo(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=R1(this.x,this.y,this.z),o=oO(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 O1.default((e.x*r-this.x)*8192,(e.y*r-this.y)*8192)}toString(){return`${this.z}/${this.x}/${this.y}`}},yi=class{constructor(e,r){this.wrap=e,this.canonical=r,this.key=fo(e,r.z,r.z,r.x,r.y)}},Ye=class t{constructor(e,r,n,i,o){this.terrainRttPosMatrix32f=null;if(e<n)throw new Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${n}`);this.overscaledZ=e,this.wrap=r,this.canonical=new di(n,+i,+o),this.key=fo(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 = ${e}; overscaledZ = ${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 = ${e}; overscaledZ = ${this.overscaledZ}`);let n=this.canonical.z-e;return e>this.canonical.z?fo(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):fo(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 yi(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new xe(e.x-this.wrap,e.y))}};function fo(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 oO(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",di);X("OverscaledTileID",Ye,{omit:["terrainRttPosMatrix32f"]});var Rl=class extends ho{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 Gt.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=Wt(o)&&Wu()?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"&&Om()){let r=e.width+2,n=e.height+2;try{return new Le({width:r,height:n},await Hb(e,-1,-1,r,n))}catch{}}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 Ye(e.overscaledZ,o,r.z,i,r.y).key]={backfilled:!1},l[new Ye(e.overscaledZ,s,r.z,a,r.y).key]={backfilled:!1},r.y>0&&(l[new Ye(e.overscaledZ,o,r.z,i,r.y-1).key]={backfilled:!1},l[new Ye(e.overscaledZ,e.wrap,r.z,r.x,r.y-1).key]={backfilled:!1},l[new Ye(e.overscaledZ,s,r.z,a,r.y-1).key]={backfilled:!1}),r.y+1<n&&(l[new Ye(e.overscaledZ,o,r.z,i,r.y+1).key]={backfilled:!1},l[new Ye(e.overscaledZ,e.wrap,r.z,r.x,r.y+1).key]={backfilled:!1},l[new Ye(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 kl=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 "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${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 "${e}" rounded to "${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 mt,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",{...o,sourceDataType:"metadata"})),this.fire(new U("data",{...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 Fl=se(fe(),1),Tt=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 Fl.default(this.minX,this.minY))),r.extend(e(new Fl.default(this.maxX,this.minY))),r.extend(e(new Fl.default(this.minX,this.maxY))),r.extend(e(new Fl.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 _r=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 Gt.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=aO(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=sO(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}=Tt.fromPoints(r),s={};for(let l=0;l<=Gi;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 aO(t){let e=Tt.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 di(o,Math.floor((e.minX+e.maxX)/2*a),Math.floor((e.minY+e.maxY)/2*a))}function sO(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 Ol=class extends _r{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 t_(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.${this.id}`,null,`Playback for this video can be set only between the ${r.start(0)} and ${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 Bl=class extends _r{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.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new Q(new G(`sources.${e}`,null,'missing required property "coordinates"'))),r.animate&&typeof r.animate!="boolean"&&this.fire(new Q(new G(`sources.${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.${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.${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 lO={},B1=(t,e,r,n)=>{let i=uO(e.type),o=new i(t,e,r,n);if(o.id!==t)throw new Error(`Expected Source id to be ${t} instead of ${o.id}`);return o},uO=t=>{switch(t){case"geojson":return kl;case"image":return _r;case"raster":return ho;case"raster-dem":return Rl;case"vector":return Dl;case"video":return Ol;case"canvas":return Bl}return lO[t]};m();m();function z1(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 nh=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=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}};var U1=se(bl(),1),N1=se(xy(),1);m();var xa=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 Cy=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 Qi(8192,16,0),this.grid3D=new Qi(8192,16,0),this.featureIndexArray=new nl,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 U1.default.VectorTile(new N1.default(this.rawTileData)).layers,this.sourceLayerCoder=new nh(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=ii(o.filter),l=e.queryGeometry,u=e.queryPadding*a,c=Tt.fromPoints(l),p=this.grid.query(c.minX-u,c.minY-u,c.maxX+u,c.maxY+u),h=Tt.fromPoints(e.cameraQueryGeometry).expandBy(u),f=this.grid3D.query(h.minX,h.minY,h.maxX,h.maxY,(x,b,v,P)=>Uv(e.cameraQueryGeometry,x-u,b-u,v+u,P+u));for(let x of f)p.push(x);p.sort(cO);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=er(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=tr(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=V1(T.paint,P.paint,g,w,s),T.layout=V1(T.layout,P.layout,g,w,s);let S=!p||p(g,P,w);if(!S)continue;let C=new xa(g,this.z,this.x,this.y,x);C.layer=T;let A=e[v];A===void 0&&(A=e[v]=[]),A.push({featureIndex:i,feature:C,intersectionZ:S})}}lookupSymbolFeatures(e,r,n,i,o,a,s,l){let u={};this.loadVTLayers();let c=ii(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){let n=e.id;if(this.promoteId){let i=typeof this.promoteId=="string"?this.promoteId:this.promoteId[r];n=e.properties[i],typeof n=="boolean"&&(n=Number(n)),n===void 0&&e.properties?.cluster&&this.promoteId&&(n=Number(e.properties.cluster_id))}return n}};X("FeatureIndex",Cy,{omit:["rawTileData","sourceLayerCoder"]});function V1(t,e,r,n,i){return as(t,(o,a)=>{let s=e instanceof ai?e.get(a):null;return s&&s.evaluate?s.evaluate(r,n,i):s})}function cO(t,e){return e-t}m();m();var zl="RTLPluginLoaded";var Iy=class extends Ee{constructor(){super(...arguments);this.status="unavailable";this.url=null;this.dispatcher=Ty()}_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 ${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(zl))}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}},My=null;function ba(){return My||(My=new Iy),My}var pO=3e4,_a=class{constructor(e,r){this.timeAdded=0;this.fadeEndTime=0;this.tileID=e,this.uid=oc(),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 Ks;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=z1(e.buckets,r?.style),this.hasSymbolBuckets=!1;for(let i in this.buckets){let o=this.buckets[i];if(o instanceof $r)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 $r&&o.hasRTLText){this.hasRTLText=!0,ba().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=ii(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=tr(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 xa(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=Ub(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,pO):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 ih=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 Ey=se(fe(),1);m();var oh=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 G1=se(fe(),1),gi=89.25;function j1(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 vr(t,e){let r=ce(e.lat,-Nt,Nt);return new G1.default(Dn(e.lng)*t,Kr(r)*t)}function xi(t,e){return new xe(e.x/t,e.y/t).toLngLat()}function va(t){return t.cameraToCenterDistance*Math.min(Math.tan(Ve(90-t.pitch))*.85,Math.tan(Ve(gi-t.pitch)))}function ah(t,e){let r=t.canonical,n=e/lt(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 Vl(t,e,r,n,i){let o=xe.fromLngLat(t,e),a=dn(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 hO(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 H1(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 sh(t,e){return function(r,n,i,o,a){let s=2*((t-1)/rt(Math.cos(Ve(gi-a))/Math.cos(Ve(gi)))-1),l=Math.acos(i/o),u=2*H1(s-1,0,Ve(a/2)),c=Math.min(Ve(gi),l+Ve(a/2)),p=Math.min(c,l-Ve(a/2)),h=H1(s-1,p,c),f=Math.atan(n/i),d=Math.hypot(n,i),g=r;return g=g+rt(o/d/Math.max(.5,Math.cos(Ve(a/2)))),g+=s*rt(Math.cos(f))/2,g-=rt(Math.max(1,h/u/e))/2,g}}var fO=9.314,mO=3,dO=sh(fO,mO);function mo(t,e){let r=(e.roundZoom?Math.round:Math.floor)(t.zoom+rt(t.tileSize/e.tileSize));return Math.max(0,r)}function bi(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=mo(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,C=T.y,A=T.fullyVisible,E={x:S,y:C,z:T.zoom},L=a.getTileBoundingVolume(E,T.wrap,t.elevation,e);if(!A){let I=hO(r,L,n);if(I===0)continue;A=I===2}let F=a.distanceToTile2d(i.x,i.y,E,L),O=l;s&&(O=(e.calculateTileZoom||dO)(t.zoom+rt(t.tileSize/e.tileSize),F,x,b,t.fov)),O=(e.roundZoom?Math.round:Math.floor)(O),O=Math.max(0,O);let z=Math.min(O,c);if(T.wrap=a.getWrap(o,E,T.wrap),T.zoom>=z){if(T.zoom<u)continue;let I=p-T.zoom,R=f[0]-.5-(S<<I),H=f[1]-.5-(C<<I),W=e.reparseOverscaled?Math.max(T.zoom,O):T.zoom;w.push({tileID:new Ye(T.zoom===c?W:T.zoom,T.wrap,T.zoom,S,C),distanceSq:wt.sqrLen([d[0]-.5-S,d[1]-.5-C]),tileDistanceToCamera:Math.sqrt(R*R+H*H)});continue}for(let I=0;I<4;I++){let R=(S<<1)+I%2,H=(C<<1)+(I>>1),W=T.zoom+1;P.push({zoom:W,x:R,y:H,wrap:T.wrap,fullyVisible:A})}}return w.sort((T,S)=>T.distanceSq-S.distanceSq).map(T=>T.tileID)}m();var Ay=se(fe(),1);var Z1=Tt.fromPoints([new Ay.default(0,0),new Ay.default(8192,8192)]);var Rn=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=B1(e,r,n,this),this._tiles={},this._cache=new ih(0,i=>this._unloadTile(i)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new oh,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(q1).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 Ey.default(o.canonical.x,o.canonical.y)._rotate(-this.transform.bearingInRadians),l=new Ey.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(q1).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?$t.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 Ye(c.canonical.z,c.wrap,c.canonical.z,c.canonical.x,c.canonical.y)):(n=bi(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=mo(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);Y1(this._source.type)&&this._updateCoveredAndRetainedTiles(l,o,a,i,n,r);for(let c in l)this._tiles[c].clearFadeHold();let u=Fb(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){let n={},i={},o=Math.max(r-t.maxOverzooming,this._source.minzoom),a=Math.max(r+t.maxUnderzooming,this._source.minzoom),s={};for(let l of e){let u=this._addTile(l);n[l.key]=l,!u.hasData()&&r<this._source.maxzoom&&(s[l.key]=l)}this._retainLoadedChildren(s,r,a,n);for(let l of e){let u=this._tiles[l.key];if(u.hasData())continue;if(r+1>this._source.maxzoom){let p=l.children(this._source.maxzoom)[0],h=this.getTile(p);if(h&&h.hasData()){n[p.key]=p;continue}}else{let p=l.children(this._source.maxzoom);if(n[p[0].key]&&n[p[1].key]&&n[p[2].key]&&n[p[3].key])continue}let c=u.wasRequested();for(let p=l.overscaledZ-1;p>=o;--p){let h=l.scaledTo(p);if(i[h.key])break;if(i[h.key]=!0,u=this.getTile(h),!u&&c&&(u=this._addTile(h)),u){let f=u.hasData();if((f||!this.map?.cancelPendingTileRequestsWhileZooming||c)&&(n[h.key]=h),c=u.wasRequested(),f)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 _a(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=Tt.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(Z1)){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=Tt.fromPoints(e);o.shrinkBy(Math.min(o.width(),o.height())*.001);let a=o.map(r);Tt.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(Y1(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))}};Rn.maxOverzooming=10;Rn.maxUnderzooming=3;function q1(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 Y1(t){return t==="raster"||t==="image"||t==="video"}m();m();m();var Jr=se(fe(),1);m();var kn=se(fe(),1);function Ly(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 kn.default(e,c.y+(p.y-c.y)*((e-c.x)/(p.x-c.x)))._round():p.x<e&&(p=new kn.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 kn.default(c.x+(p.x-c.x)*((r-c.y)/(p.y-c.y)),r)._round():p.y<r&&(p=new kn.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 kn.default(n,c.y+(p.y-c.y)*((n-c.x)/(p.x-c.x)))._round():p.x>=n&&(p=new kn.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 kn.default(c.x+(p.x-c.x)*((i-c.y)/(p.y-c.y)),i)._round():p.y>=i&&(p=new kn.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 lh=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 uh(t,e){let r=!0;return t==="always"||(t==="never"||e==="never")&&(r=!1),r}var Ul=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||!uh(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||!uh(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))&&!uh(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))&&!uh(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 Pa=se(fe(),1);function Nl(t,e,r){let n=B.create();if(!t){let{vecSouth:i,vecEast:o}=hh(e),a=qn.create();a[0]=o[0],a[1]=o[1],a[2]=i[0],a[3]=i[1],qn.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 K1(t,e,r,n){if(t){let i=B.create();if(!e){let{vecSouth:o,vecEast:a}=hh(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 hh(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=wt.create();a[0]=-i*n*r-o*e,a[1]=-o*n*r+i*e;let s=wt.length(a);s<1e-9?wt.zero(a):wt.scale(a,a,1/s);let l=wt.create();l[0]=i*n*e-o*r,l[1]=o*n*e+i*r;let u=wt.length(l);return u<1e-9?wt.zero(l):wt.scale(l,l,1/u),{vecEast:l,vecSouth:a}}function fh(t,e,r,n){let i;n?(i=[t,e,n(t,e),1],Ne.transformMat4(i,i,r)):(i=[t,e,0,1],Gl(i,i,r));let o=i[3];return{point:new Pa.default(i[0]/o,i[1]/o),signedDistanceFromCamera:o,isOccluded:!1}}function ky(t,e){return .5+.5*(t/e)}function yO(t,e){return t.x>=-e[0]&&t.x<=e[0]&&t.y>=-e[1]&&t.y<=e[1]}function J1(t,e,r,n,i,o,a,s,l,u,c,p,h){let f=r?t.textSizeData:t.iconSizeData,d=co(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){yo(S.numGlyphs,x);continue}w=!1;let C=new Pa.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:C,unwrappedTileID:l,width:u,height:c,translation:p},L=Oy(S.anchorX,S.anchorY,E);if(!yO(L.point,g)){yo(S.numGlyphs,x);continue}let F=L.signedDistanceFromCamera,O=ky(e.transform.cameraToCenterDistance,F),z=ha(f,d,S),I=o?z*e.transform.getPitchedTextCorrection(S.anchorX,S.anchorY,l)/O:z*O,R=$1({projectionContext:E,pitchedLabelPlaneMatrixInverse:i,symbol:S,fontSize:I,flip:!1,keepUpright:a,glyphOffsetArray:t.glyphOffsetArray,dynamicLayoutVertexArray:x,aspectRatio:P,rotateToLine:s});w=R.useVertical,(R.notEnoughRoom||w||R.needsFlipping&&$1({projectionContext:E,pitchedLabelPlaneMatrixInverse:i,symbol:S,fontSize:I,flip:!0,keepUpright:a,glyphOffsetArray:t.glyphOffsetArray,dynamicLayoutVertexArray:x,aspectRatio:P,rotateToLine:s}).notEnoughRoom)&&yo(S.numGlyphs,x)}r?t.text.dynamicLayoutVertexBuffer.updateData(x):t.icon.dynamicLayoutVertexBuffer.updateData(x)}function Fy(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=ph(t*p,r,n,i,o.segment,u,c,s,a);if(!f)return null;let d=ph(t*h,r,n,i,o.segment,u,c,s,a);return!d||s.projectionCache.anyProjectionOccluded?null:{first:f,last:d}}function W1(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 $1(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=Fy(p,s,h,f,o,n,c,e);if(!v)return{notEnoughRoom:!0};let P=ch(v.first.point.x,v.first.point.y,e,r),w=ch(v.last.point.x,v.last.point.y,e,r);if(a&&!o){let T=W1(n.writingMode,P,w,u);if(T)return T}d=[v.first];for(let T=n.glyphStartIndex+1;T<g-1;T++){let S=ph(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=_i(e.tileAnchorPoint.x,e.tileAnchorPoint.y,e).point,b=n.lineStartIndex+n.segment+1,v=new Pa.default(e.lineVertexArray.getx(b),e.lineVertexArray.gety(b)),P=_i(v.x,v.y,e),w=P.signedDistanceFromCamera>0?P.point:Q1(e.tileAnchorPoint,v,x,1,e),T=ch(x.x,x.y,e,r),S=ch(w.x,w.y,e,r),C=W1(n.writingMode,T,S,u);if(C)return C}let g=ph(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)po(l,g.point,g.angle);return{}}function Q1(t,e,r,n,i){let o=t.add(t.sub(e)._unit()),a=_i(o.x,o.y,i).point,s=r.sub(a);return r.add(s._mult(n/s.mag()))}function Dy(t,e,r){let n=e.projectionCache;if(n.projections[t])return n.projections[t];let i=new Pa.default(e.lineVertexArray.getx(t),e.lineVertexArray.gety(t)),o=_i(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 Pa.default(e.lineVertexArray.getx(a),e.lineVertexArray.gety(a)),l=r.absOffsetX-r.distanceFromAnchor+1;return Q1(s,i,r.previousVertex,l,e)}function _i(t,e,r){let n=t+r.translation[0],i=e+r.translation[1],o;return r.pitchWithMap?(o=fh(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 ch(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 Oy(t,e,r){return r.transform.projectTileCoordinates(t,e,r.unwrappedTileID,r.getElevation)}function Ry(t,e,r){return t._unit()._perp()._mult(e*r)}function gO(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=Dy(t+l.direction,s,l),p=Ry(c.sub(r),a,l.direction),h=r.add(p),f=c.add(p);return s.projectionCache.offsets[t]=zb(o,u,h,f)||u,s.projectionCache.offsets[t]}function ph(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=_i(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=Dy(h,s,L),r===0)T.push(g),S=d.sub(g);else{let F,O=d.sub(g);if(O.mag()===0){let z=Dy(h+c,s,L);F=Ry(z.sub(d),r,c)}else F=Ry(O,r,c);b||(b=g.add(F)),x=gO(h,F,d,o,a,b,r,s,L),T.push(b),S=x.sub(b)}P=S.mag()}while(v+P<=w);let C=(w-v)/P,A=S._mult(C)._add(b||g),E=p+Math.atan2(d.y-g.y,d.x-g.x);return T.push(A),{point:A,angle:l?E:0,path:T}}var xO=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function yo(t,e){for(let r=0;r<t;r++){let n=e.length;e.resize(n+4),e.float32.set(xO,n*3)}}function Gl(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 eP(t,e){let r=B.create();return B.invert(r,e.pitchedLabelPlaneMatrix),t.map(n=>{let i=fh(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 tP(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,mh=class{constructor(e,r=new Ul(e.width+2*He,e.height+2*He,25),n=new Ul(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 A=g.x+(p?p.x*x:0),E=g.y+(p?p.y*x:0);b={allPointsOccluded:!1,box:[A+e.x1*x,E+e.y1*x,A+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,C=S;return C||(C=g.perspectiveRatio<this.perspectiveRatioCutoff),C||(C=!this.isInsideGrid(v,P,w,T)),C||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 Jr.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)/mi,w={projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},T=r.lineOffsetX*P,S=r.lineOffsetY*P,C={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},A=Fy(P,i,T,S,!1,r,!1,C),E=!1,L=!1,F=!0;if(A){let O=p*.5*b+h,z=new Jr.default(-He,-He),I=new Jr.default(this.screenRightBoundary,this.screenBottomBoundary),R=new lh,H=A.first,W=A.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=O*2.5;if(u){let be=this.projectPathToScreenSpace($,C);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 Ze=1;Ze<$.length;Ze++)be.x=Math.min(be.x,$[Ze].x),be.y=Math.min(be.y,$[Ze].y),ye.x=Math.max(ye.x,$[Ze].x),ye.y=Math.max(ye.y,$[Ze].y);be.x>=z.x&&ye.x<=I.x&&be.y>=z.y&&ye.y<=I.y?Xe=[$]:ye.x<z.x||be.x>I.x||ye.y<z.y||be.y>I.y?Xe=[]:Xe=Ly([$],z.x,z.y,I.x,I.y)}for(let be of Xe){R.reset(be,O*.25);let ye=0;R.length<=.5*O?ye=1:ye=Math.ceil(R.paddedLength/he)+1;for(let Ze=0;Ze<ye;Ze++){let st=Ze/Math.max(ye-1,1),vt=R.lerp(st),dt=vt.x+He,zt=vt.y+He;g.push(dt,zt,O,0);let cr=dt-O,rn=zt-O,pr=dt+O,Ct=zt+O;if(F=F&&this.isOffscreen(cr,rn,pr,Ct),L=L||this.isInsideGrid(cr,rn,pr,Ct),e!=="always"&&this.grid.hitTestCircle(dt,zt,O,e,c)&&(E=!0,!l))return{circles:[],offscreen:!1,collisionDetected:E}}}}return{circles:!l&&E||!L||b<this.perspectiveRatioCutoff?[]:g,offscreen:F,collisionDetected:E}}projectPathToScreenSpace(e,r){let n=eP(e,r);return tP(n)}queryRenderedSymbols(e){if(e.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};let r=[],n=new Tt;for(let p of e){let h=new Jr.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 Jr.default(p.x1,p.y1),new Jr.default(p.x2,p.y1),new Jr.default(p.x2,p.y2),new Jr.default(p.x1,p.y2)];dp(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],Gl(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 I=this.projectAndGetPerspectiveRatio(x+1,b,i,u,p),R=I.x-l.x,H=I.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 I=hh(this.transform);h=I.vecEast[0],f=I.vecEast[1],d=I.vecSouth[0],g=I.vecSouth[1]}let v=l.x,P=l.y,w=r;if(o){v=x,P=b;let I=this.transform.zoom-n.overscaledZ;if(w=Math.pow(2,-I),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,C=(T+S)/2,A=e.y1*w,E=e.y2*w,L=(A+E)/2,F=[{offsetX:T,offsetY:A},{offsetX:C,offsetY:A},{offsetX:S,offsetY:A},{offsetX:S,offsetY:L},{offsetX:S,offsetY:E},{offsetX:C,offsetY:E},{offsetX:T,offsetY:E},{offsetX:T,offsetY:L}],O=[];for(let{offsetX:I,offsetY:R}of F)O.push(new Jr.default(v+h*I+d*R,P+f*I+g*R));let z=!1;if(o){let I=O.map(R=>this.projectAndGetPerspectiveRatio(R.x,R.y,i,u,p));z=I.some(R=>!R.isOccluded),O=I.map(R=>new Jr.default(R.x,R.y))}else z=!0;return{box:kb(O),allPointsOccluded:!z}}};m();m();var rP=se(fe(),1);var jl=class t extends rP.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",jl);m();m();m();var vO=se(fe(),1);m();var PO=se(fe(),1);m();m();var wO=se(fe(),1);var SO=se($d(),1);m();var Hl=(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))(Hl||{});var TO=Number.POSITIVE_INFINITY;function nP(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 Vy=se(fe(),1);var dh=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}},go=class{constructor(e,r,n,i,o){this.text=new dh(e?e.text:null,r,n,o),this.icon=new dh(e?e.icon:null,r,i,o)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}},yh=class{constructor(e,r,n){this.text=e,this.icon=r,this.skipFade=n}},By=class{constructor(e,r,n,i,o){this.bucketInstanceId=e,this.featureIndex=r,this.sourceLayerIndex=n,this.bucketIndex=i,this.tileID=o}},zy=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 iP(t,e,r,n,i){let{horizontalAlign:o,verticalAlign:a}=Op(t),s=-(o-.5)*e,l=-(a-.5)*r;return new Vy.default(s+n[0]*i,l+n[1]*i)}var gh=class{constructor(e,r,n,i,o){this.transform=e.clone(),this.terrain=r,this.collisionIndex=new mh(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=n,this.retainedQueryData={},this.collisionGroups=new zy(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=yt(n,1,this.transform.zoom),g=Yt(this.collisionIndex.transform,n,u.get("text-translate"),u.get("text-translate-anchor")),x=Yt(this.collisionIndex.transform,n,u.get("icon-translate"),u.get("icon-translate-anchor")),b=Nl(f,this.transform,d);this.retainedQueryData[o.bucketInstanceId]=new By(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:co(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=Hl[e.textAnchor],S=[e.textOffset0,e.textOffset1],C=iP(T,n,i,S,o),A=this.collisionIndex.placeCollisionBox(r,h,l,u,c,s,a,x,p.predicate,P,C,w);if(!(v&&!this.collisionIndex.placeCollisionBox(v,h,l,u,c,s,a,b,p.predicate,P,C,w).placeable)&&A.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:C,placedGlyphBoxes:A}}}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=fa(o,"text-overlap","text-allow-overlap"),v=b==="always",P=fa(o,"icon-overlap","icon-allow-overlap"),w=P==="always",T=o.get("text-rotation-alignment")==="map",S=o.get("text-pitch-alignment")==="map",C=o.get("icon-text-fit")!=="none",A=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 F=this.retainedQueryData[i.bucketInstanceId].tileID,O=this._getTerrainElevationFunc(F),z=this.transform.getFastPathSimpleProjectionMatrix(F),I=(R,H,W)=>{if(r[R.crossTileID])return;if(p){this.placements[R.crossTileID]=new yh(!1,!1,!1);return}let $=!1,he=!1,Xe=!0,be=null,ye={box:null,placeable:!1,offscreen:null,occluded:!1},Ze={box:null,placeable:!1,offscreen:null},st=null,vt=null,dt=null,zt=0,cr=0,rn=0;H.textFeatureIndex?zt=H.textFeatureIndex:R.useRuntimeCollisionCircles&&(zt=R.featureIndex),H.verticalTextFeatureIndex&&(cr=H.verticalTextFeatureIndex);let pr=H.textBox;if(pr){let Mr=Dt=>{let At=1;if(i.allowVerticalPlacement&&!Dt&&this.prevPlacement){let Ar=this.prevPlacement.placedOrientations[R.crossTileID];Ar&&(this.placedOrientations[R.crossTileID]=Ar,At=Ar,this.markUsedOrientation(i,At,R))}return At},Ir=(Dt,At)=>{if(i.allowVerticalPlacement&&R.numVerticalGlyphVertices>0&&H.verticalTextBox){for(let Ar of i.writingModes)if(Ar===2?(ye=At(),Ze=ye):ye=Dt(),ye&&ye.placeable)break}else ye=Dt()},Hn=R.textAnchorOffsetStartIndex,bn=R.textAnchorOffsetEndIndex;if(bn===Hn){let Dt=(Di,Ro)=>{let Rt=this.collisionIndex.placeCollisionBox(Di,b,c,F,l,S,T,a,d.predicate,O,void 0,z);return Rt&&Rt.placeable&&(this.markUsedOrientation(i,Ro,R),this.placedOrientations[R.crossTileID]=Ro),Rt};Ir(()=>Dt(pr,1),()=>{let Di=H.verticalTextBox;return i.allowVerticalPlacement&&R.numVerticalGlyphVertices>0&&Di?Dt(Di,2):{box:null,offscreen:null}}),Mr(ye&&ye.placeable)}else{let Dt=Hl[this.prevPlacement?.variableOffsets[R.crossTileID]?.anchor],At=(Rt,wm,OM)=>{let BM=Rt.x2-Rt.x1,zM=Rt.y2-Rt.y1,VM=R.textBoxScale,UM=C&&P==="never"?wm:null,Ri=null,cx=b==="never"?1:2,px="never";Dt&&cx++;for(let Tm=0;Tm<cx;Tm++){for(let Sm=Hn;Sm<bn;Sm++){let hx=i.textAnchorOffsets.get(Sm);if(Dt&&hx.textAnchor!==Dt)continue;let Cm=this.attemptAnchorPlacement(hx,Rt,BM,zM,VM,T,S,c,F,l,d,px,R,i,OM,a,s,UM,O);if(Cm&&(Ri=Cm.placedGlyphBoxes,Ri&&Ri.placeable))return $=!0,be=Cm.shift,Ri}Dt?Dt=null:px=b}return n&&!Ri&&(Ri={box:this.collisionIndex.placeCollisionBox(pr,"always",c,F,l,S,T,a,d.predicate,O,void 0,z).box,offscreen:!1,placeable:!1,occluded:!1}),Ri};Ir(()=>At(pr,H.iconBox,1),()=>{let Rt=H.verticalTextBox,wm=ye&&ye.placeable;return i.allowVerticalPlacement&&!wm&&R.numVerticalGlyphVertices>0&&Rt?At(Rt,H.verticalIconBox,2):{box:null,occluded:!0,offscreen:null}}),ye&&($=ye.placeable,Xe=ye.offscreen);let Ro=Mr(ye&&ye.placeable);if(!$&&this.prevPlacement){let Rt=this.prevPlacement.variableOffsets[R.crossTileID];Rt&&(this.variableOffsets[R.crossTileID]=Rt,this.markUsedJustification(i,Rt.anchor,R,Ro))}}}if(st=ye,$=st&&st.placeable,Xe=st&&st.offscreen,R.useRuntimeCollisionCircles){let Mr=i.text.placedSymbolArray.get(R.centerJustifiedTextSymbolIndex),Ir=ha(i.textSizeData,f,Mr),Hn=o.get("text-padding"),bn=R.collisionCircleDiameter;vt=this.collisionIndex.placeCollisionCircles(b,Mr,i.lineVertexArray,i.glyphOffsetArray,Ir,l,u,n,S,d.predicate,bn,Hn,a,O),vt.circles.length&&vt.collisionDetected&&!n&&ve("Collisions detected, but collision boxes are not shown"),$=v||vt.circles.length>0&&!vt.collisionDetected,Xe=Xe&&vt.offscreen}if(H.iconFeatureIndex&&(rn=H.iconFeatureIndex),H.iconBox){let Mr=Ir=>this.collisionIndex.placeCollisionBox(Ir,P,c,F,l,S,T,s,d.predicate,O,C&&be?be:void 0,z);Ze&&Ze.placeable&&H.verticalIconBox?(dt=Mr(H.verticalIconBox),he=dt.placeable):(dt=Mr(H.iconBox),he=dt.placeable),Xe=Xe&&dt.offscreen}let Ct=g||R.numHorizontalGlyphVertices===0&&R.numVerticalGlyphVertices===0,Ya=x||R.numIconVertices===0;!Ct&&!Ya?he=$=he&&$:Ya?Ct||(he=he&&$):$=he&&$;let Lo=$&&st.placeable,Li=he&&dt.placeable;if(Lo&&(Ze&&Ze.placeable&&cr?this.collisionIndex.insertCollisionBox(st.box,b,o.get("text-ignore-placement"),i.bucketInstanceId,cr,d.ID):this.collisionIndex.insertCollisionBox(st.box,b,o.get("text-ignore-placement"),i.bucketInstanceId,zt,d.ID)),Li&&this.collisionIndex.insertCollisionBox(dt.box,P,o.get("icon-ignore-placement"),i.bucketInstanceId,rn,d.ID),vt&&$&&this.collisionIndex.insertCollisionCircles(vt.circles,b,o.get("text-ignore-placement"),i.bucketInstanceId,zt,d.ID),n&&this.storeCollisionData(i.bucketInstanceId,W,H,st,dt,vt),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 xn=($||E)&&!st?.occluded,Do=(he||L)&&!dt?.occluded;this.placements[R.crossTileID]=new yh(xn,Do,Xe||i.justReloaded),r[R.crossTileID]=!0};if(A){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];I(i.symbolInstances.get(W),i.collisionArrays[W],W)}}else for(let R=e.symbolInstanceStart;R<e.symbolInstanceEnd;R++)I(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[nP(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 go(c,i,u.text,u.icon),n=n||u.text!==c.text.placed||u.icon!==c.icon.placed):(this.opacities[l]=new go(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 go(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 go(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 go(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!==Xl},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],C=this.opacities[T];S?C=s:C||(C=d,this.opacities[T]=C),n[T]=!0;let A=P>0||w>0,E=v.numIconVertices>0,L=this.placedOrientations[v.crossTileID],F=L===2,O=L===1||L===3;if(A){let I=aP(C.text),R=F?Xl:I;g(e.text,P,R);let H=O?Xl:I;g(e.text,w,H);let W=C.text.isHidden();[v.rightJustifiedTextSymbolIndex,v.centerJustifiedTextSymbolIndex,v.leftJustifiedTextSymbolIndex].forEach(Xe=>{Xe>=0&&(e.text.placedSymbolArray.get(Xe).hidden=W||F?1:0)}),v.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(v.verticalPlacedTextSymbolIndex).hidden=W||O?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 I=aP(C.icon),R=!(f&&v.verticalPlacedIconSymbolIndex&&F);if(v.placedIconSymbolIndex>=0){let H=R?I:Xl;g(e.icon,v.numIconVertices,H),e.icon.placedSymbolArray.get(v.placedIconSymbolIndex).hidden=C.icon.isHidden()}if(v.verticalPlacedIconSymbolIndex>=0){let H=R?Xl:I;g(e.icon,v.numVerticalIconVertices,H),e.icon.placedSymbolArray.get(v.verticalPlacedIconSymbolIndex).hidden=C.icon.isHidden()}}let z=x&&x.has(b)?x.get(b):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){let I=e.collisionArrays[b];if(I){let R=new Vy.default(0,0);if(I.textBox||I.verticalTextBox){let H=!0;if(c){let W=this.variableOffsets[T];W?(R=iP(W.anchor,W.width,W.height,W.textOffset,W.textBoxScale),p&&R._rotate(h?-this.transform.bearingInRadians:this.transform.bearingInRadians)):H=!1}if(I.textBox||I.verticalTextBox){let W;I.textBox&&(W=F),I.verticalTextBox&&(W=O),oP(e.textCollisionBox.collisionVertexArray,C.text.placed,!H||W,z.text,R.x,R.y)}}if(I.iconBox||I.verticalIconBox){let H=!!(!O&&I.verticalIconBox),W;I.iconBox&&(W=H),I.verticalIconBox&&(W=!H),oP(e.iconCollisionBox.collisionVertexArray,C.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 (= ${e.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${e.text.layoutVertexArray.length}) / 4`);if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${e.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${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 oP(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 CO=Math.pow(2,25),MO=Math.pow(2,24),IO=Math.pow(2,17),AO=Math.pow(2,16),EO=Math.pow(2,9),LO=Math.pow(2,8),DO=Math.pow(2,1);function aP(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*CO+e*MO+r*IO+e*AO+r*EO+e*LO+r*DO+e}var Xl=0;var Uy=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}},xh=class{constructor(e,r,n,i,o,a,s,l){this.placement=new gh(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 Uy(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 sP=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],Ny=1,Zl=8,Yl=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!==Ny)throw new Error(`Got v${i} data when expected v${Ny}.`);let o=sP[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: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=n,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;let o=sP.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: ${n}.`);i&&i instanceof ArrayBuffer?(this.data=i,this.ids=new this.IndexArrayType(this.data,Zl,e),this.coords=new this.ArrayType(this.data,Zl+s+l,e*2),this._pos=e*2,this._finished=!0):(this.data=new ArrayBuffer(Zl+a+s+l),this.ids=new this.IndexArrayType(this.data,Zl,e),this.coords=new this.ArrayType(this.data,Zl+s+l,e*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,(Ny<<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 ${e} items when expected ${this.numItems}.`);return jy(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++)lP(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];lP(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 jy(t,e,r,n,i,o){if(i-n<=r)return;let a=n+i>>1;uP(t,e,a,n,i,o),jy(t,e,r,n,a-1,1-o),jy(t,e,r,a+1,i,1-o)}function uP(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));uP(t,e,r,d,g,o)}let a=e[2*r+o],s=n,l=i;for(ql(t,e,n,r),e[2*i+o]>a&&ql(t,e,n,i);s<l;){for(ql(t,e,s,l),s++,l--;e[2*s+o]<a;)s++;for(;e[2*l+o]>a;)l--}e[2*n+o]===a?ql(t,e,n,l):(l++,ql(t,e,l,i)),l<=r&&(n=l+1),r<=l&&(i=l-1)}}function ql(t,e,r,n){Gy(t,r,n),Gy(e,2*r,2*n),Gy(e,2*r+1,2*n+1)}function Gy(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}function lP(t,e,r,n){let i=t-r,o=e-n;return i*i+o*o}var Wl=512/8192/2,RO=128,Hy=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*Wl),y:Math.floor(c.anchorY*Wl)})),l=a.map(c=>c.crossTileID),u={positions:s,crossTileIDs:l};if(u.positions.length>RO){let c=new Yl(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=Wl/Math.pow(2,u),p=(a*8192+e.anchorX)*c,h=(s*8192+e.anchorY)*c,f=n*8192*Wl,d=i*8192*Wl;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)}},Xy=class{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}},Zy=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 Hy(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}},wa=class{constructor(){this.layerIndexes={},this.crossTileIDs=new Xy,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,r,n){let i=this.layerIndexes[e.id];i===void 0&&(i=this.layerIndexes[e.id]=new Zy);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 cP=`#ifdef GL_ES
4
- precision mediump float;
5
- #else
6
- #if !defined(lowp)
7
- #define lowp
8
- #endif
9
- #if !defined(mediump)
10
- #define mediump
11
- #endif
12
- #if !defined(highp)
13
- #define highp
14
- #endif
15
- #endif
16
- out highp vec4 fragColor;`;m();var pP=`#ifdef GL_ES
17
- precision highp float;
18
- #else
19
- #if !defined(lowp)
20
- #define lowp
21
- #endif
22
- #if !defined(mediump)
23
- #define mediump
24
- #endif
25
- #if !defined(highp)
26
- #define highp
27
- #endif
28
- #endif
29
- vec2 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
30
- );}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
31
- );}
32
- #ifdef TERRAIN3D
33
- uniform 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;
34
- #endif
35
- const 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) {
36
- #ifdef TERRAIN3D
37
- highp 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));
38
- #else
39
- return 1.0;
40
- #endif
41
- }float calculate_visibility(vec4 pos) {
42
- #ifdef TERRAIN3D
43
- vec3 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;
44
- #else
45
- return 1.0;
46
- #endif
47
- }float ele(vec2 pos) {
48
- #ifdef TERRAIN3D
49
- vec4 rgb=(texture(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;
50
- #else
51
- return 0.0;
52
- #endif
53
- }float get_elevation(vec2 pos) {
54
- #ifdef TERRAIN3D
55
- #ifdef GLOBE
56
- if ((pos.y <-32767.5) || (pos.y > 32766.5)) {return 0.0;}
57
- #endif
58
- vec2 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;
59
- #else
60
- return 0.0;
61
- #endif
62
- }const float PI=3.141592653589793;uniform mat4 u_projection_matrix;`;m();var hP=`uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity;
63
- #ifdef OVERDRAW_INSPECTOR
64
- fragColor=vec4(1.0);
65
- #endif
66
- }`;m();var fP="in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}";m();var mP=`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;
67
- #ifdef OVERDRAW_INSPECTOR
68
- fragColor=vec4(1.0);
69
- #endif
70
- }`;m();var dP="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 yP=`in vec3 v_data;in float v_visibility;
71
- #pragma mapbox: define highp vec4 color
72
- #pragma mapbox: define mediump float radius
73
- #pragma mapbox: define lowp float blur
74
- #pragma mapbox: define lowp float opacity
75
- #pragma mapbox: define highp vec4 stroke_color
76
- #pragma mapbox: define mediump float stroke_width
77
- #pragma mapbox: define lowp float stroke_opacity
78
- void main() {
79
- #pragma mapbox: initialize highp vec4 color
80
- #pragma mapbox: initialize mediump float radius
81
- #pragma mapbox: initialize lowp float blur
82
- #pragma mapbox: initialize lowp float opacity
83
- #pragma mapbox: initialize highp vec4 stroke_color
84
- #pragma mapbox: initialize mediump float stroke_width
85
- #pragma mapbox: initialize lowp float stroke_opacity
86
- vec2 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;}
87
- #ifdef OVERDRAW_INSPECTOR
88
- fragColor=vec4(1.0);
89
- #endif
90
- }`;m();var gP=`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;
91
- #pragma mapbox: define highp vec4 color
92
- #pragma mapbox: define mediump float radius
93
- #pragma mapbox: define lowp float blur
94
- #pragma mapbox: define lowp float opacity
95
- #pragma mapbox: define highp vec4 stroke_color
96
- #pragma mapbox: define mediump float stroke_width
97
- #pragma mapbox: define lowp float stroke_opacity
98
- void main(void) {
99
- #pragma mapbox: initialize highp vec4 color
100
- #pragma mapbox: initialize mediump float radius
101
- #pragma mapbox: initialize lowp float blur
102
- #pragma mapbox: initialize lowp float opacity
103
- #pragma mapbox: initialize highp vec4 stroke_color
104
- #pragma mapbox: initialize mediump float stroke_width
105
- #pragma mapbox: initialize lowp float stroke_opacity
106
- vec2 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) {
107
- #ifdef GLOBE
108
- vec3 center_vector=projectToSphere(circle_center);
109
- #endif
110
- float 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 {
111
- #ifdef GLOBE
112
- vec4 projected_center=interpolateProjection(circle_center,center_vector,ele);
113
- #else
114
- vec4 projected_center=projectTileWithElevation(circle_center,ele);
115
- #endif
116
- corner_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);}
117
- #ifdef GLOBE
118
- vec2 angles=extrude*angle_scale;vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(corner_position,corner_vector,ele);
119
- #else
120
- gl_Position=projectTileWithElevation(corner_position,ele);
121
- #endif
122
- } 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 qy="void main() {fragColor=vec4(1.0);}";m();var xP="in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}";m();var bP=`uniform highp float u_intensity;in vec2 v_extrude;
123
- #pragma mapbox: define highp float weight
124
- #define GAUSS_COEF 0.3989422804014327
125
- void main() {
126
- #pragma mapbox: initialize highp float weight
127
- float 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);
128
- #ifdef OVERDRAW_INSPECTOR
129
- fragColor=vec4(1.0);
130
- #endif
131
- }`;m();var _P=`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;
132
- #pragma mapbox: define highp float weight
133
- #pragma mapbox: define mediump float radius
134
- const highp float ZERO=1.0/255.0/16.0;
135
- #define GAUSS_COEF 0.3989422804014327
136
- void main(void) {
137
- #pragma mapbox: initialize highp float weight
138
- #pragma mapbox: initialize mediump float radius
139
- vec2 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);
140
- #ifdef GLOBE
141
- vec2 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);
142
- #else
143
- gl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center));
144
- #endif
145
- }`;m();var vP=`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;
146
- #ifdef OVERDRAW_INSPECTOR
147
- fragColor=vec4(0.0);
148
- #endif
149
- }`;m();var PP="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 wP="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 TP="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 SP="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 CP="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 MP=`#ifdef GL_ES
150
- precision highp float;
151
- #endif
152
- uniform 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
153
- {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));
154
- #ifdef OVERDRAW_INSPECTOR
155
- fragColor=vec4(1.0);
156
- #endif
157
- }`;m();var IP="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 AP="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 EP="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 LP=`in vec2 a_pos;void main() {
158
- #ifdef GLOBE
159
- gl_Position=projectTileFor3D(a_pos,0.0);
160
- #else
161
- gl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0);
162
- #endif
163
- }`;m();var DP=`#pragma mapbox: define highp vec4 color
164
- #pragma mapbox: define lowp float opacity
165
- void main() {
166
- #pragma mapbox: initialize highp vec4 color
167
- #pragma mapbox: initialize lowp float opacity
168
- fragColor=color*opacity;
169
- #ifdef OVERDRAW_INSPECTOR
170
- fragColor=vec4(1.0);
171
- #endif
172
- }`;m();var RP=`uniform vec2 u_fill_translate;in vec2 a_pos;
173
- #pragma mapbox: define highp vec4 color
174
- #pragma mapbox: define lowp float opacity
175
- void main() {
176
- #pragma mapbox: initialize highp vec4 color
177
- #pragma mapbox: initialize lowp float opacity
178
- gl_Position=projectTile(a_pos+u_fill_translate,a_pos);}`;m();var kP=`in vec2 v_pos;
179
- #ifdef GLOBE
180
- in float v_depth;
181
- #endif
182
- #pragma mapbox: define highp vec4 outline_color
183
- #pragma mapbox: define lowp float opacity
184
- void main() {
185
- #pragma mapbox: initialize highp vec4 outline_color
186
- #pragma mapbox: initialize lowp float opacity
187
- float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=outline_color*(alpha*opacity);
188
- #ifdef GLOBE
189
- if (v_depth > 1.0) {discard;}
190
- #endif
191
- #ifdef OVERDRAW_INSPECTOR
192
- fragColor=vec4(1.0);
193
- #endif
194
- }`;m();var FP=`uniform vec2 u_world;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos;
195
- #ifdef GLOBE
196
- out float v_depth;
197
- #endif
198
- #pragma mapbox: define highp vec4 outline_color
199
- #pragma mapbox: define lowp float opacity
200
- void main() {
201
- #pragma mapbox: initialize highp vec4 outline_color
202
- #pragma mapbox: initialize lowp float opacity
203
- gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
204
- #ifdef GLOBE
205
- v_depth=gl_Position.z/gl_Position.w;
206
- #endif
207
- }`;m();var OP=`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;
208
- #ifdef GLOBE
209
- in float v_depth;
210
- #endif
211
- #pragma mapbox: define lowp float opacity
212
- #pragma mapbox: define lowp vec4 pattern_from
213
- #pragma mapbox: define lowp vec4 pattern_to
214
- void main() {
215
- #pragma mapbox: initialize lowp float opacity
216
- #pragma mapbox: initialize mediump vec4 pattern_from
217
- #pragma mapbox: initialize mediump vec4 pattern_to
218
- vec2 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;
219
- #ifdef GLOBE
220
- if (v_depth > 1.0) {discard;}
221
- #endif
222
- #ifdef OVERDRAW_INSPECTOR
223
- fragColor=vec4(1.0);
224
- #endif
225
- }`;m();var BP=`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;
226
- #ifdef GLOBE
227
- out float v_depth;
228
- #endif
229
- #pragma mapbox: define lowp float opacity
230
- #pragma mapbox: define lowp vec4 pattern_from
231
- #pragma mapbox: define lowp vec4 pattern_to
232
- #pragma mapbox: define lowp float pixel_ratio_from
233
- #pragma mapbox: define lowp float pixel_ratio_to
234
- void main() {
235
- #pragma mapbox: initialize lowp float opacity
236
- #pragma mapbox: initialize mediump vec4 pattern_from
237
- #pragma mapbox: initialize mediump vec4 pattern_to
238
- #pragma mapbox: initialize lowp float pixel_ratio_from
239
- #pragma mapbox: initialize lowp float pixel_ratio_to
240
- vec2 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;
241
- #ifdef GLOBE
242
- v_depth=gl_Position.z/gl_Position.w;
243
- #endif
244
- }`;m();var zP=`#ifdef GL_ES
245
- precision highp float;
246
- #endif
247
- uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;
248
- #pragma mapbox: define lowp float opacity
249
- #pragma mapbox: define lowp vec4 pattern_from
250
- #pragma mapbox: define lowp vec4 pattern_to
251
- void main() {
252
- #pragma mapbox: initialize lowp float opacity
253
- #pragma mapbox: initialize mediump vec4 pattern_from
254
- #pragma mapbox: initialize mediump vec4 pattern_to
255
- vec2 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;
256
- #ifdef OVERDRAW_INSPECTOR
257
- fragColor=vec4(1.0);
258
- #endif
259
- }`;m();var VP=`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;
260
- #pragma mapbox: define lowp float opacity
261
- #pragma mapbox: define lowp vec4 pattern_from
262
- #pragma mapbox: define lowp vec4 pattern_to
263
- #pragma mapbox: define lowp float pixel_ratio_from
264
- #pragma mapbox: define lowp float pixel_ratio_to
265
- void main() {
266
- #pragma mapbox: initialize lowp float opacity
267
- #pragma mapbox: initialize mediump vec4 pattern_from
268
- #pragma mapbox: initialize mediump vec4 pattern_to
269
- #pragma mapbox: initialize lowp float pixel_ratio_from
270
- #pragma mapbox: initialize lowp float pixel_ratio_to
271
- vec2 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 UP=`in vec4 v_color;void main() {fragColor=v_color;
272
- #ifdef OVERDRAW_INSPECTOR
273
- fragColor=vec4(1.0);
274
- #endif
275
- }`;m();var NP=`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;
276
- #ifdef TERRAIN3D
277
- in vec2 a_centroid;
278
- #endif
279
- out vec4 v_color;
280
- #pragma mapbox: define highp float base
281
- #pragma mapbox: define highp float height
282
- #pragma mapbox: define highp vec4 color
283
- void main() {
284
- #pragma mapbox: initialize highp float base
285
- #pragma mapbox: initialize highp float height
286
- #pragma mapbox: initialize highp vec4 color
287
- vec3 normal=a_normal_ed.xyz;
288
- #ifdef TERRAIN3D
289
- float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
290
- #else
291
- float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
292
- #endif
293
- base=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;
294
- #ifdef GLOBE
295
- vec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);
296
- #else
297
- gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);
298
- #endif
299
- float 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);
300
- #ifdef GLOBE
301
- mat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition);
302
- #endif
303
- directional=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 GP=`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;
304
- #pragma mapbox: define lowp float base
305
- #pragma mapbox: define lowp float height
306
- #pragma mapbox: define lowp vec4 pattern_from
307
- #pragma mapbox: define lowp vec4 pattern_to
308
- #pragma mapbox: define lowp float pixel_ratio_from
309
- #pragma mapbox: define lowp float pixel_ratio_to
310
- void main() {
311
- #pragma mapbox: initialize lowp float base
312
- #pragma mapbox: initialize lowp float height
313
- #pragma mapbox: initialize mediump vec4 pattern_from
314
- #pragma mapbox: initialize mediump vec4 pattern_to
315
- #pragma mapbox: initialize lowp float pixel_ratio_from
316
- #pragma mapbox: initialize lowp float pixel_ratio_to
317
- vec2 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;
318
- #ifdef OVERDRAW_INSPECTOR
319
- fragColor=vec4(1.0);
320
- #endif
321
- }`;m();var jP=`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;
322
- #ifdef TERRAIN3D
323
- in vec2 a_centroid;
324
- #endif
325
- #ifdef GLOBE
326
- out vec3 v_sphere_pos;
327
- #endif
328
- out vec2 v_pos_a;out vec2 v_pos_b;out vec4 v_lighting;
329
- #pragma mapbox: define lowp float base
330
- #pragma mapbox: define lowp float height
331
- #pragma mapbox: define lowp vec4 pattern_from
332
- #pragma mapbox: define lowp vec4 pattern_to
333
- #pragma mapbox: define lowp float pixel_ratio_from
334
- #pragma mapbox: define lowp float pixel_ratio_to
335
- void main() {
336
- #pragma mapbox: initialize lowp float base
337
- #pragma mapbox: initialize lowp float height
338
- #pragma mapbox: initialize mediump vec4 pattern_from
339
- #pragma mapbox: initialize mediump vec4 pattern_to
340
- #pragma mapbox: initialize lowp float pixel_ratio_from
341
- #pragma mapbox: initialize lowp float pixel_ratio_to
342
- vec2 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;
343
- #ifdef TERRAIN3D
344
- float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
345
- #else
346
- float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
347
- #endif
348
- base=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;
349
- #ifdef GLOBE
350
- vec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);
351
- #else
352
- gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);
353
- #endif
354
- vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0
355
- ? a_pos
356
- : 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 HP=`#ifdef GL_ES
357
- precision highp float;
358
- #endif
359
- uniform 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);
360
- #ifdef OVERDRAW_INSPECTOR
361
- fragColor=vec4(1.0);
362
- #endif
363
- }`;m();var XP="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 ZP=`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];
364
- #define PI 3.141592653589793
365
- #define STANDARD 0
366
- #define COMBINED 1
367
- #define IGOR 2
368
- #define MULTIDIRECTIONAL 3
369
- #define BASIC 4
370
- float 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
371
- {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
372
- {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:
373
- basic_hillshade(deriv);break;case COMBINED:
374
- combined_hillshade(deriv);break;case IGOR:
375
- igor_hillshade(deriv);break;case MULTIDIRECTIONAL:
376
- multidirectional_hillshade(deriv);break;case STANDARD:
377
- default:
378
- standard_hillshade(deriv);break;}
379
- #ifdef OVERDRAW_INSPECTOR
380
- fragColor=vec4(1.0);
381
- #endif
382
- }`;m();var qP="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 YP=`uniform lowp float u_device_pixel_ratio;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;
383
- #ifdef GLOBE
384
- in float v_depth;
385
- #endif
386
- #pragma mapbox: define highp vec4 color
387
- #pragma mapbox: define lowp float blur
388
- #pragma mapbox: define lowp float opacity
389
- void main() {
390
- #pragma mapbox: initialize highp vec4 color
391
- #pragma mapbox: initialize lowp float blur
392
- #pragma mapbox: initialize lowp float opacity
393
- 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);fragColor=color*(alpha*opacity);
394
- #ifdef GLOBE
395
- if (v_depth > 1.0) {discard;}
396
- #endif
397
- #ifdef OVERDRAW_INSPECTOR
398
- fragColor=vec4(1.0);
399
- #endif
400
- }`;m();var WP=`
401
- #define scale 0.015873016
402
- in 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;
403
- #ifdef GLOBE
404
- out float v_depth;
405
- #endif
406
- #pragma mapbox: define highp vec4 color
407
- #pragma mapbox: define lowp float blur
408
- #pragma mapbox: define lowp float opacity
409
- #pragma mapbox: define mediump float gapwidth
410
- #pragma mapbox: define lowp float offset
411
- #pragma mapbox: define mediump float width
412
- void main() {
413
- #pragma mapbox: initialize highp vec4 color
414
- #pragma mapbox: initialize lowp float blur
415
- #pragma mapbox: initialize lowp float opacity
416
- #pragma mapbox: initialize mediump float gapwidth
417
- #pragma mapbox: initialize lowp float offset
418
- #pragma mapbox: initialize mediump float width
419
- float 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;
420
- #ifdef GLOBE
421
- v_depth=gl_Position.z/gl_Position.w;
422
- #endif
423
- #ifdef TERRAIN3D
424
- v_gamma_scale=1.0;
425
- #else
426
- float 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;
427
- #endif
428
- v_width2=vec2(outset,inset);}`;m();var $P=`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;
429
- #ifdef GLOBE
430
- in float v_depth;
431
- #endif
432
- #pragma mapbox: define lowp float blur
433
- #pragma mapbox: define lowp float opacity
434
- void main() {
435
- #pragma mapbox: initialize lowp float blur
436
- #pragma mapbox: initialize lowp float opacity
437
- 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);vec4 color=texture(u_image,v_uv);fragColor=color*(alpha*opacity);
438
- #ifdef GLOBE
439
- if (v_depth > 1.0) {discard;}
440
- #endif
441
- #ifdef OVERDRAW_INSPECTOR
442
- fragColor=vec4(1.0);
443
- #endif
444
- }`;m();var KP=`
445
- #define scale 0.015873016
446
- in 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;
447
- #ifdef GLOBE
448
- out float v_depth;
449
- #endif
450
- #pragma mapbox: define lowp float blur
451
- #pragma mapbox: define lowp float opacity
452
- #pragma mapbox: define mediump float gapwidth
453
- #pragma mapbox: define lowp float offset
454
- #pragma mapbox: define mediump float width
455
- void main() {
456
- #pragma mapbox: initialize lowp float blur
457
- #pragma mapbox: initialize lowp float opacity
458
- #pragma mapbox: initialize mediump float gapwidth
459
- #pragma mapbox: initialize lowp float offset
460
- #pragma mapbox: initialize mediump float width
461
- float 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;
462
- #ifdef GLOBE
463
- v_depth=gl_Position.z/gl_Position.w;
464
- #endif
465
- #ifdef TERRAIN3D
466
- v_gamma_scale=1.0;
467
- #else
468
- float 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;
469
- #endif
470
- v_width2=vec2(outset,inset);}`;m();var JP=`#ifdef GL_ES
471
- precision highp float;
472
- #endif
473
- uniform 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;
474
- #ifdef GLOBE
475
- in float v_depth;
476
- #endif
477
- #pragma mapbox: define lowp vec4 pattern_from
478
- #pragma mapbox: define lowp vec4 pattern_to
479
- #pragma mapbox: define lowp float pixel_ratio_from
480
- #pragma mapbox: define lowp float pixel_ratio_to
481
- #pragma mapbox: define lowp float blur
482
- #pragma mapbox: define lowp float opacity
483
- void main() {
484
- #pragma mapbox: initialize mediump vec4 pattern_from
485
- #pragma mapbox: initialize mediump vec4 pattern_to
486
- #pragma mapbox: initialize lowp float pixel_ratio_from
487
- #pragma mapbox: initialize lowp float pixel_ratio_to
488
- #pragma mapbox: initialize lowp float blur
489
- #pragma mapbox: initialize lowp float opacity
490
- vec2 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;
491
- #ifdef GLOBE
492
- if (v_depth > 1.0) {discard;}
493
- #endif
494
- #ifdef OVERDRAW_INSPECTOR
495
- fragColor=vec4(1.0);
496
- #endif
497
- }`;m();var QP=`
498
- #define scale 0.015873016
499
- #define LINE_DISTANCE_SCALE 2.0
500
- in 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;
501
- #ifdef GLOBE
502
- out float v_depth;
503
- #endif
504
- #pragma mapbox: define lowp float blur
505
- #pragma mapbox: define lowp float opacity
506
- #pragma mapbox: define lowp float offset
507
- #pragma mapbox: define mediump float gapwidth
508
- #pragma mapbox: define mediump float width
509
- #pragma mapbox: define lowp float floorwidth
510
- #pragma mapbox: define lowp vec4 pattern_from
511
- #pragma mapbox: define lowp vec4 pattern_to
512
- #pragma mapbox: define lowp float pixel_ratio_from
513
- #pragma mapbox: define lowp float pixel_ratio_to
514
- void main() {
515
- #pragma mapbox: initialize lowp float blur
516
- #pragma mapbox: initialize lowp float opacity
517
- #pragma mapbox: initialize lowp float offset
518
- #pragma mapbox: initialize mediump float gapwidth
519
- #pragma mapbox: initialize mediump float width
520
- #pragma mapbox: initialize lowp float floorwidth
521
- #pragma mapbox: initialize mediump vec4 pattern_from
522
- #pragma mapbox: initialize mediump vec4 pattern_to
523
- #pragma mapbox: initialize lowp float pixel_ratio_from
524
- #pragma mapbox: initialize lowp float pixel_ratio_to
525
- float 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;
526
- #ifdef GLOBE
527
- v_depth=gl_Position.z/gl_Position.w;
528
- #endif
529
- #ifdef TERRAIN3D
530
- v_gamma_scale=1.0;
531
- #else
532
- float 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;
533
- #endif
534
- v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`;m();var ew=`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;
535
- #ifdef GLOBE
536
- in float v_depth;
537
- #endif
538
- #pragma mapbox: define highp vec4 color
539
- #pragma mapbox: define lowp float blur
540
- #pragma mapbox: define lowp float opacity
541
- #pragma mapbox: define mediump float width
542
- #pragma mapbox: define lowp float floorwidth
543
- void main() {
544
- #pragma mapbox: initialize highp vec4 color
545
- #pragma mapbox: initialize lowp float blur
546
- #pragma mapbox: initialize lowp float opacity
547
- #pragma mapbox: initialize mediump float width
548
- #pragma mapbox: initialize lowp float floorwidth
549
- 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 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);
550
- #ifdef GLOBE
551
- if (v_depth > 1.0) {discard;}
552
- #endif
553
- #ifdef OVERDRAW_INSPECTOR
554
- fragColor=vec4(1.0);
555
- #endif
556
- }`;m();var tw=`
557
- #define scale 0.015873016
558
- #define LINE_DISTANCE_SCALE 2.0
559
- in 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;
560
- #ifdef GLOBE
561
- out float v_depth;
562
- #endif
563
- #pragma mapbox: define highp vec4 color
564
- #pragma mapbox: define lowp float blur
565
- #pragma mapbox: define lowp float opacity
566
- #pragma mapbox: define mediump float gapwidth
567
- #pragma mapbox: define lowp float offset
568
- #pragma mapbox: define mediump float width
569
- #pragma mapbox: define lowp float floorwidth
570
- void main() {
571
- #pragma mapbox: initialize highp vec4 color
572
- #pragma mapbox: initialize lowp float blur
573
- #pragma mapbox: initialize lowp float opacity
574
- #pragma mapbox: initialize mediump float gapwidth
575
- #pragma mapbox: initialize lowp float offset
576
- #pragma mapbox: initialize mediump float width
577
- #pragma mapbox: initialize lowp float floorwidth
578
- float 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;
579
- #ifdef GLOBE
580
- v_depth=gl_Position.z/gl_Position.w;
581
- #endif
582
- #ifdef TERRAIN3D
583
- v_gamma_scale=1.0;
584
- #else
585
- float 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;
586
- #endif
587
- v_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 rw=`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);
588
- #ifdef OVERDRAW_INSPECTOR
589
- fragColor=vec4(1.0);
590
- #endif
591
- }`;m();var nw=`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;
592
- #ifdef GLOBE
593
- if (a_pos.y <-32767.5) {v_pos0.y=0.0;}if (a_pos.y > 32766.5) {v_pos0.y=1.0;}
594
- #endif
595
- v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`;m();var iw=`uniform sampler2D u_texture;in vec2 v_tex;in float v_fade_opacity;
596
- #pragma mapbox: define lowp float opacity
597
- void main() {
598
- #pragma mapbox: initialize lowp float opacity
599
- lowp float alpha=opacity*v_fade_opacity;fragColor=texture(u_texture,v_tex)*alpha;
600
- #ifdef OVERDRAW_INSPECTOR
601
- fragColor=vec4(1.0);
602
- #endif
603
- }`;m();var ow=`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;
604
- #pragma mapbox: define lowp float opacity
605
- void main() {
606
- #pragma mapbox: initialize lowp float opacity
607
- vec2 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 ?
608
- camera_to_anchor_distance/u_camera_to_center_distance :
609
- u_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;
610
- #ifdef GLOBE
611
- if(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);}
612
- #endif
613
- vec4 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 aw=`#define SDF_PX 8.0
614
- uniform 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;
615
- #pragma mapbox: define highp vec4 fill_color
616
- #pragma mapbox: define highp vec4 halo_color
617
- #pragma mapbox: define lowp float opacity
618
- #pragma mapbox: define lowp float halo_width
619
- #pragma mapbox: define lowp float halo_blur
620
- void main() {
621
- #pragma mapbox: initialize highp vec4 fill_color
622
- #pragma mapbox: initialize highp vec4 halo_color
623
- #pragma mapbox: initialize lowp float opacity
624
- #pragma mapbox: initialize lowp float halo_width
625
- #pragma mapbox: initialize lowp float halo_blur
626
- float 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);
627
- #ifdef OVERDRAW_INSPECTOR
628
- fragColor=vec4(1.0);
629
- #endif
630
- }`;m();var sw=`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;
631
- #pragma mapbox: define highp vec4 fill_color
632
- #pragma mapbox: define highp vec4 halo_color
633
- #pragma mapbox: define lowp float opacity
634
- #pragma mapbox: define lowp float halo_width
635
- #pragma mapbox: define lowp float halo_blur
636
- void main() {
637
- #pragma mapbox: initialize highp vec4 fill_color
638
- #pragma mapbox: initialize highp vec4 halo_color
639
- #pragma mapbox: initialize lowp float opacity
640
- #pragma mapbox: initialize lowp float halo_width
641
- #pragma mapbox: initialize lowp float halo_blur
642
- vec2 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 ?
643
- camera_to_anchor_distance/u_camera_to_center_distance :
644
- u_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;
645
- #ifdef GLOBE
646
- if(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);}
647
- #endif
648
- vec4 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 lw=`#define SDF_PX 8.0
649
- #define SDF 1.0
650
- #define ICON 0.0
651
- uniform 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;
652
- #pragma mapbox: define highp vec4 fill_color
653
- #pragma mapbox: define highp vec4 halo_color
654
- #pragma mapbox: define lowp float opacity
655
- #pragma mapbox: define lowp float halo_width
656
- #pragma mapbox: define lowp float halo_blur
657
- void main() {
658
- #pragma mapbox: initialize highp vec4 fill_color
659
- #pragma mapbox: initialize highp vec4 halo_color
660
- #pragma mapbox: initialize lowp float opacity
661
- #pragma mapbox: initialize lowp float halo_width
662
- #pragma mapbox: initialize lowp float halo_blur
663
- float 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;
664
- #ifdef OVERDRAW_INSPECTOR
665
- fragColor=vec4(1.0);
666
- #endif
667
- return;}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);
668
- #ifdef OVERDRAW_INSPECTOR
669
- fragColor=vec4(1.0);
670
- #endif
671
- }`;m();var uw=`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;
672
- #pragma mapbox: define highp vec4 fill_color
673
- #pragma mapbox: define highp vec4 halo_color
674
- #pragma mapbox: define lowp float opacity
675
- #pragma mapbox: define lowp float halo_width
676
- #pragma mapbox: define lowp float halo_blur
677
- void main() {
678
- #pragma mapbox: initialize highp vec4 fill_color
679
- #pragma mapbox: initialize highp vec4 halo_color
680
- #pragma mapbox: initialize lowp float opacity
681
- #pragma mapbox: initialize lowp float halo_width
682
- #pragma mapbox: initialize lowp float halo_blur
683
- vec2 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 ?
684
- camera_to_anchor_distance/u_camera_to_center_distance :
685
- u_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;
686
- #ifdef GLOBE
687
- if(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);}
688
- #endif
689
- vec4 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 cw="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 pw="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 hw="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 fw="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 mw="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 dw="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 yw="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 gw="in vec4 v_output_error_encoded;void main() {fragColor=v_output_error_encoded;}";m();var xw="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 bw=`#define GLOBE_RADIUS 6371008.8
690
- uniform 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
691
- );}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);
692
- if (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
693
- );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 _w=`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
694
- );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 vw="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 Pw="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 ww="in vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}";var or={prelude:Ie(cP,pP),projectionMercator:Ie("",xw),projectionGlobe:Ie("",bw),background:Ie(hP,fP),backgroundPattern:Ie(mP,dP),circle:Ie(yP,gP),clippingMask:Ie(qy,xP),heatmap:Ie(bP,_P),heatmapTexture:Ie(vP,PP),collisionBox:Ie(wP,TP),collisionCircle:Ie(SP,CP),colorRelief:Ie(MP,IP),debug:Ie(AP,EP),depth:Ie(qy,LP),fill:Ie(DP,RP),fillOutline:Ie(kP,FP),fillOutlinePattern:Ie(OP,BP),fillPattern:Ie(zP,VP),fillExtrusion:Ie(UP,NP),fillExtrusionPattern:Ie(GP,jP),hillshadePrepare:Ie(HP,XP),hillshade:Ie(ZP,qP),line:Ie(YP,WP),lineGradient:Ie($P,KP),linePattern:Ie(JP,QP),lineSDF:Ie(ew,tw),raster:Ie(rw,nw),symbolIcon:Ie(iw,ow),symbolSDF:Ie(aw,sw),symbolTextAndIcon:Ie(lw,uw),terrain:Ie(hw,fw),terrainDepth:Ie(cw,mw),terrainCoords:Ie(pw,dw),projectionErrorMeasurement:Ie(gw,yw),atmosphere:Ie(_w,vw),sky:Ie(Pw,ww)};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"?`
695
- #ifndef HAS_UNIFORM_u_${h}
696
- in ${c} ${p} ${h};
697
- #else
698
- uniform ${c} ${p} u_${h};
699
- #endif
700
- `:`
701
- #ifdef HAS_UNIFORM_u_${h}
702
- ${c} ${p} ${h} = u_${h};
703
- #endif
704
- `)),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"?`
705
- #ifndef HAS_UNIFORM_u_${h}
706
- uniform lowp float u_${h}_t;
707
- in ${c} ${f} a_${h};
708
- out ${c} ${p} ${h};
709
- #else
710
- uniform ${c} ${p} u_${h};
711
- #endif
712
- `:d==="vec4"?`
713
- #ifndef HAS_UNIFORM_u_${h}
714
- ${h} = a_${h};
715
- #else
716
- ${c} ${p} ${h} = u_${h};
717
- #endif
718
- `:`
719
- #ifndef HAS_UNIFORM_u_${h}
720
- ${h} = unpack_mix_${d}(a_${h}, u_${h}_t);
721
- #else
722
- ${c} ${p} ${h} = u_${h};
723
- #endif
724
- `:u==="define"?`
725
- #ifndef HAS_UNIFORM_u_${h}
726
- uniform lowp float u_${h}_t;
727
- in ${c} ${f} a_${h};
728
- #else
729
- uniform ${c} ${p} u_${h};
730
- #endif
731
- `:d==="vec4"?`
732
- #ifndef HAS_UNIFORM_u_${h}
733
- ${c} ${p} ${h} = a_${h};
734
- #else
735
- ${c} ${p} ${h} = u_${h};
736
- #endif
737
- `:`
738
- #ifndef HAS_UNIFORM_u_${h}
739
- ${c} ${p} ${h} = unpack_mix_${d}(a_${h}, u_${h}_t);
740
- #else
741
- ${c} ${p} ${h} = u_${h};
742
- #endif
743
- `}),{fragmentSource:t,vertexSource:e,staticAttributes:n,staticUniforms:a}}function Tw(t){return t.replace(/\bin\s/g,"attribute ").replace(/\bout\s/g,"varying ").replace(/texture\(/g,"texture2D(")}function Sw(t){return t.replace(/\bin\s/g,"varying ").replace("out highp vec4 fragColor;","").replace(/fragColor/g,"gl_FragColor").replace(/texture\(/g,"texture2D(")}m();var ar=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 Pr=ze([{name:"a_pos",type:"Int16",components:2}]);var Yy="#define PROJECTION_MERCATOR",Wy="mercator",xo=class{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return Wy}get shaderDefine(){return Yy}get shaderPreludeCode(){return or.projectionMercator}get vertexShaderPreludeCode(){return or.projectionMercator.vertexSource}get subdivisionGranularity(){return fi.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 Et;a.emplaceBack(0,0),a.emplaceBack(8192,0),a.emplaceBack(0,8192),a.emplaceBack(8192,8192);let s=e.createVertexBuffer(a,Pr.members),l=de.simpleSegment(0,0,4,2),u=new Qe;u.emplaceBack(1,0,2),u.emplaceBack(1,2,3);let c=e.createIndexBuffer(u);return this._cachedMesh=new ar(s,c,l),this._cachedMesh}recalculate(){}hasTransition(){return!1}setErrorQueryLatitudeDegrees(e){}};m();var sr=se(fe(),1);m();var vi=se(fe(),1);m();var Cw=se(fe(),1);var Ta=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 Cw.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 Sa(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 Mw(t){return Math.max(0,Math.floor(t))}var Pi=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??0,this._maxPitch=o??60,this.setMaxBounds(),this._width=0,this._height=0,this._center=new J(0,0),this._elevation=0,this._zoom=0,this._tileZoom=Mw(this._zoom),this._scale=lt(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new Ta,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=Mw(this._zoom),this._scale=lt(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 Ta(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 vi.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=qn.create(),qn.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 Ui(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=lt(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 mt([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=[-Nt,Nt])}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}=Tt.fromPoints(r).extend(e);return[new vi.default(n,i),new vi.default(o,i),new vi.default(o,a),new vi.default(n,a),new vi.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=rh(1,s.y),x,b,v=0,P=10;do{if(v+=1,v>P)break;b=d/g;let S=c*b,C=p*b;x=new xe(s.x+S,s.y+C),g=1/x.meterInMercatorCoordinateUnits()}while(Math.abs(d-b*g)>1e-12);let w=x.toLngLat(),T=rt(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=dn(1,this.center.lat)*this.worldSize,n=this.cameraToCenterDistance/r,i=xe.fromLngLat(this.center,this.elevation),o=Vl(this.center,this.elevation,this.pitch,this.bearing,n);this._elevation=e;let a=this.calculateCenterFromCameraLngLatAlt(o.toLngLat(),rh(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 vi.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=dn(1,this.center.lat)*this.worldSize,r=this.cameraToCenterDistance/e;return Vl(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 Ca=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 bh=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){let o=0,a=0;if(i?.terrain){let l=new Ye(e.z,r,e.z,e.x,e.y),u=i.terrain.getMinMaxElevation(l);o=u.minElevation??Math.min(0,n),a=u.maxElevation??Math.max(0,n)}let s=1<<e.z;return new Ca([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 Ma=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=>kO(f,e,r,l));i&&FO(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 Ca(p,h))}};function kO(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 FO(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=Rb(t[p+i],l[p],r);h!==null&&h>=0?a=Math.max(a,h):a=Math.max(a,s[p])}let u=OO(t,e),c=BO(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 OO(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 BO(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 ts(e,l)}else return null}var Fn=class t{constructor(e,r,n,i,o){this._posMatrixCache=new Map;this._alignedPosMatrixCache=new Map;this._fogMatrixCacheF32=new Map;this._helper=new Pi({calcMatrices:()=>{this._calcMatrices()},getConstrained:(a,s)=>this.getConstrained(a,s)},e,r,n,i,o),this._coveringTilesDetailsProvider=new bh}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 yi(0,e)];if(this._helper._renderWorldCopies){let n=this.screenPointToMercatorCoordinate(new sr.default(0,0)),i=this.screenPointToMercatorCoordinate(new sr.default(this._helper._width,0)),o=this.screenPointToMercatorCoordinate(new sr.default(this._helper._width,this._helper._height)),a=this.screenPointToMercatorCoordinate(new sr.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 yi(c,e))}return r}getCameraFrustum(){return Ma.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=dn(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?.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){return this.screenPointToMercatorCoordinate(e,r)?.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 sr.default(i[0]/i[3],i[1]/i[3])}getBounds(){let e=Math.max(0,this._helper._height/2-va(this));return new mt().extend(this.screenPointToLocation(new sr.default(0,e))).extend(this.screenPointToLocation(new sr.default(this._helper._width,e))).extend(this.screenPointToLocation(new sr.default(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new sr.default(0,this._helper._height)))}isPointOnMapSurface(e,r){return r?r.pointCoordinate(e)!=null:e.y>this.height/2-va(this)}calculatePosMatrix(e,r=!1,n){let i=e.key??fo(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 l=o.get(i);return n?l.f32:l.f64}let a=ah(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=ah(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*lt(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=Kr(P[1])*o,s=Kr(P[0])*o,s-a<f&&(c=f/(s-a))}i&&(l=Rr(Dn(i[0])*o,0,o),u=Rr(Dn(i[1])*o,0,o),u<l&&(u+=o),u-l<h&&(p=h/(u-l)));let{x:d,y:g}=vr(o,e),x,b,v=Math.max(p||0,c||0);if(v){let P=new sr.default(p?(u+l)/2:d,c?(s+a)/2:g);return n.center=xi(o,P).wrap(),n.zoom+=rt(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 sr.default(x??d,b??g);n.center=xi(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=va(this),f=Math.atan(h/this._helper.cameraToCenterDistance),d=Ve(90-gi),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=vr(this.worldSize,this.center),n=r.x,i=r.y;this._helper._pixelPerMeter=dn(1,this.center.lat)*this.worldSize;let o=Ve(Math.min(this.pitch,gi)),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 sr.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=dn(1,this.center.lat)*this.worldSize,r=this._helper.cameraToCenterDistance/e;return Vl(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=nc(),{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],Gl(a,a,o));let s=a[3];return{point:new sr.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=Wn();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 Ye(0,0,0,0,0),n=this.getProjectionData({overscaledTileID:r,applyGlobeMatrix:e}),i=ah(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=Hr();return B.scale(a,i,o),n.fallbackMatrix=a,n.mainMatrix=a,n}getFastPathSimpleProjectionMatrix(e){return this.calculatePosMatrix(e)}};m();m();var $l=se(fe(),1);function $y(){ve("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function _h(t){if(t.useSlerp)if(t.k<1){let e=td(t.startEulerAngles.roll,t.startEulerAngles.pitch,t.startEulerAngles.bearing),r=td(t.endEulerAngles.roll,t.endEulerAngles.pitch,t.endEulerAngles.bearing),n=new Float64Array(4);Yn.slerp(n,e,r,t.k);let i=Xb(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 vh(t,e,r,n,i){let o=i.padding,a=vr(i.worldSize,r.getNorthWest()),s=vr(i.worldSize,r.getNorthEast()),l=vr(i.worldSize,r.getSouthEast()),u=vr(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 $l.default(Math.max(p.x,h.x,d.x,f.x),Math.max(p.y,h.y,d.y,f.y)),x=new $l.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){$y();return}let S=Math.min(rt(i.scale*Math.min(w,T)),t.maxZoom),C=$l.default.convert(t.offset),A=(e.left-e.right)/2,E=(e.top-e.bottom)/2,F=new $l.default(A,E).rotate(Ve(n)),z=C.add(F).mult(i.scale/lt(S));return{center:xi(i.worldSize,a.add(l).div(2).sub(z)),zoom:S,bearing:n}}var On=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 vh(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??n);Sa(e,x);let v=vr(e.worldSize,g),P=vr(e.worldSize,x).sub(v),w=lt(b-n);return h=b!==n,{easeFunc:S=>{if(h&&e.setZoom(Fe.number(n,b,S)),sc(o,u)||_h({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 C=lt(e.zoom-n),A=b>n?Math.min(2,w):Math.max(.5,w),E=Math.pow(A,1-S),L=xi(e.worldSize,v.add(P.mult(S*E)).mult(C));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;Sa(e,a);let l=vr(e.worldSize,r.locationAtOffset),u=vr(e.worldSize,a).sub(l),c=u.mag(),p=lt(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=lt(x-i)}return{easeFunc:(g,x,b,v)=>{e.setZoom(g===1?s:i+rt(x));let P=g===1?a:xi(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 zO=0,Iw=1,VO=771,De=class{constructor(e,r,n){this.blendFunction=e,this.blendColor=r,this.mask=n}};De.Replace=[Iw,zO];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([Iw,VO],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 Aw=(t,e)=>({u_input:new N(t,e.u_input),u_output_expected:new N(t,e.u_output_expected)}),Ew=(t,e)=>({u_input:t,u_output_expected:e});m();var Ky=new WeakMap;function wr(t){if(Ky.has(t))return Ky.get(t);{let e=t.getParameter(t.VERSION)?.startsWith("WebGL 2.0");return Ky.set(t,e),e}}var Ph=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 Et;i.emplaceBack(-1,-1),i.emplaceBack(2,-1),i.emplaceBack(-1,2);let o=new Qe;o.emplaceBack(0,1,2),this._fullscreenTriangle=new ar(r.createVertexBuffer(i,Pr.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),wr(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,Ew(e,r),null,null,"$clipping",this._fullscreenTriangle.vertexBuffer,this._fullscreenTriangle.indexBuffer,this._fullscreenTriangle.segments),this._pbo&&wr(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&&wr(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 wh=8192/128;function Lw(t,e){let r=Dw(e,"16bit"),n=Et.deserialize({arrayBuffer:r.vertices,length:r.vertices.byteLength/2/2}),i=Qe.deserialize({arrayBuffer:r.indices,length:r.indices.byteLength/2/3});return new ar(t.createVertexBuffer(n,Pr.members),t.createIndexBuffer(i),de.simpleSegment(0,0,n.length,i.length))}function Dw(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=-wh),w===r+1&&(T=8192+wh);let S=P/r*8192;P===-1&&(S=t.extendToNorthPole?fn:-wh),P===r+1&&(S=t.extendToSouthPole?En:8192+wh),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,C=w+(P+1)*o,A=w+1+(P+1)*o;b[v++]=T,b[v++]=C,b[v++]=S,b[v++]=S,b[v++]=C,b[v++]=A}return{vertices:g.buffer.slice(0),indices:b.buffer.slice(0),uses32bitIndices:d}}var UO="#define GLOBE",NO="globe",Rw={errorTransitionTimeSeconds:.5},Jy=new fi({fill:new br(128,2),line:new br(512,0),tile:new br(128,32),stencil:new br(128,1),circle:3}),Ia=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 NO}get shaderDefine(){return UO}get shaderPreludeCode(){return or.projectionGlobe}get vertexShaderPreludeCode(){return or.projectionMercator.vertexSource}get subdivisionGranularity(){return Jy}get useGlobeControls(){return!0}get latitudeErrorCorrectionRadians(){return this._errorCorrectionUsable}destroy(){this._errorMeasurement&&this._errorMeasurement.destroy()}updateGPUdependent(e){this._errorMeasurement||(this._errorMeasurement=new Ph(e));let r=Kr(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/Rw.errorTransitionTimeSeconds,0),1),l=-this._errorMeasurementLastValue;this._errorCorrectionUsable=Pn(this._errorCorrectionPreviousValue,l,ic(s))}_getMeshKey(e){return`${e.granularity.toString(36)}_${e.generateBorders?"b":""}${e.extendToNorthPole?"n":""}${e.extendToSouthPole?"s":""}`}getMeshFromTileID(e,r,n,i,o){let s=(o==="stencil"?Jy.stencil:Jy.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=Lw(e,r);return this._tileMeshCache[n]=i,i}recalculate(e){}hasTransition(){let e=ae.now(),r=!1;return r=r||(e-this._errorMeasurementLastChangeTime)/1e3<Rw.errorTransitionTimeSeconds+.2,r=r||this._errorMeasurement&&this._errorMeasurement.awaitingQuery,r}setErrorQueryLatitudeDegrees(e){this._errorQueryLatitudeDegrees=e}};var GO=new Ue({type:new q(D.projection.type)}),Kl=class extends Ee{constructor(e){super(),this._transitionable=new pn(GO),this.setProjection(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new Te(0)),this._mercatorProjection=new xo,this._verticalPerspectiveProjection=new Ia}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 sn){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?.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 Qr=se(fe(),1);m();function kw(t){let e=bo(t.worldSize,t.center.lat);return 2*Math.PI*e}function Fw(t,e,r){let n=It(e),i=It(r),o=V.dot(n,i),a=Math.acos(o),s=kw(t);return a/(2*Math.PI)*s}function Ow(t,e){let r=Ni(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 jO(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 yn(t,e,r,n,i){let o=1/(1<<i),a=t/8192*o+r*o,s=e/8192*o+n*o,l=Ni(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 It(t){return jO(t.lng*Math.PI/180,t.lat*Math.PI/180)}function bo(t,e){return t/(2*Math.PI)/Math.cos(e*Math.PI/180)}function eg(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 Bw(t){let e=tt();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 zw(t,e,r){let n=tt();V.sub(n,r,t);let i=tt();return V.scaleAndAdd(i,t,n,e/V.len(n)),i}function Th(t){return Math.cos(t*Math.PI/180)}function xt(t,e){let r=Th(t),n=Th(e);return rt(n/r)}function HO(t,e){return 360/kw({worldSize:t,center:{lat:e}})}function tg(t,e){let r=t.rotate(e.bearingInRadians),n=e.zoom+xt(e.center.lat,0),i=Pn(1/Th(e.center.lat),1/Th(Math.min(Math.abs(e.center.lat),60)),Oo(n,7,3,0,1)),o=HO(e.worldSize,e.center.lat);return new J(e.center.lng-r.x*o*i,ce(e.center.lat+r.y*o,-Nt,Nt))}function Qy(t){let e=.5*t,r=Math.sin(e),n=Math.cos(e);return Math.log(r+n)-Math.log(n-r)}function rg(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=Qy(s+n*(l-s)),c=Qy(s),p=Qy(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 Sh=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=`${e.z}_${e.x}_${e.y}_${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 Aa=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=Yn.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 Ch(t,e,r){let n=t-e;return n<0?-n:Math.max(0,n-r)}function ng(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,Ch(e,n,i))}var Mh=class{constructor(){this._boundingVolumeCache=new Sh(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,ng(e,r,s,l,a)),p=Math.min(p,ng(e,r,s+c,-l-a,a)),p=Math.min(p,ng(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=Ch(e.x,a,o),l=Ch(e.x,a-1,o),u=Ch(e.x,a+1,o),c=Math.min(s,l,u);return c===u?1:c===l?-1:0}allowVariableZoom(e,r){return mo(e,r)>4}allowWorldCopies(){return!1}getTileBoundingVolume(e,r,n,i){return this._boundingVolumeCache.getTileBoundingVolume(e,r,n,i)}_computeTileBoundingVolume(e,r,n,i){let o=0,a=0;if(i?.terrain){let s=new Ye(e.z,r,e.z,e.x,e.y),l=i.terrain.getMinMaxElevation(s);o=l.minElevation??Math.min(0,n),a=l.maxElevation??Math.max(0,n)}if(o/=nr,a/=nr,o+=1,a+=1,e.z<=0)return Aa.fromAabb([-a,-a,-a],[a,a,a]);if(e.z===1)return Aa.fromAabb([e.x===0?-a:0,e.y===0?0:-a,-a],[e.x===0?0:a,e.y===0?a:0,a]);{let s=[yn(0,0,e.x,e.y,e.z),yn(8192,0,e.x,e.y,e.z),yn(8192,8192,e.x,e.y,e.z),yn(0,8192,e.x,e.y,e.z)],l=[];for(let E of s)l.push(V.scale([],E,a));if(a!==o)for(let E of s)l.push(V.scale([],E,o));e.y===0&&l.push([0,1,0]),e.y===(1<<e.z)-1&&l.push([0,-1,0]);let u=[1,1,1],c=[-1,-1,-1];for(let E of l)for(let L=0;L<3;L++)u[L]=Math.min(u[L],E[L]),c[L]=Math.max(c[L],E[L]);let p=yn(8192/2,8192/2,e.x,e.y,e.z),h=V.cross([],[0,1,0],p);V.normalize(h,h);let f=V.cross([],p,h);V.normalize(f,f);let d=V.cross([],s[2],s[1]);V.normalize(d,d);let g=V.cross([],s[0],s[3]);V.normalize(g,g),l.push(V.scale([],p,a)),e.y>=(1<<e.z)/2&&l.push(V.scale([],yn(8192/2,0,e.x,e.y,e.z),a)),e.y<(1<<e.z)/2&&l.push(V.scale([],yn(8192/2,8192,e.x,e.y,e.z),a));let x=Vw(p,l),b=Vw(f,l),v=[-p[0],-p[1],-p[2],x.max],P=[p[0],p[1],p[2],-x.min],w=[-f[0],-f[1],-f[2],b.max],T=[f[0],f[1],f[2],-b.min],S=[...d,0],C=[...g,0],A=[];return e.y===0?A.push(mr(C,S,v),mr(C,S,P)):A.push(mr(w,S,v),mr(w,S,P),mr(w,C,v),mr(w,C,P)),e.y===(1<<e.z)-1?A.push(mr(C,S,v),mr(C,S,P)):A.push(mr(T,S,v),mr(T,S,P),mr(T,C,v),mr(T,C,P)),new Aa(A,[v,P,w,T,S,C],u,c)}}};function Vw(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 Ea=class t{constructor(){this._cachedClippingPlane=Fo();this._projectionMatrix=Wn();this._globeViewProjMatrix32f=nc();this._globeViewProjMatrixNoCorrection=Wn();this._globeViewProjMatrixNoCorrectionInverted=Wn();this._globeProjMatrixInverted=Wn();this._cameraPosition=tt();this._globeLatitudeErrorCorrectionRadians=0;this._helper=new Pi({calcMatrices:()=>{this._calcMatrices()},getConstrained:(e,r)=>this.getConstrained(e,r)}),this._coveringTilesDetailsProvider=new Mh}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=tt();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(It(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=j1(e,r,n.canonical),o=Ow(i.x,i.y);return this.getCircleRadiusCorrection()/Math.cos(o[1])}projectTileCoordinates(e,r,n,i){let o=n.canonical,a=yn(e,r,o.x,o.y,o.z),l=1+(i?i(e,r):0)/nr,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 Qr.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=bo(this.worldSize,this.center.lat),r=Hr(),n=Hr();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=Hr(),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=tt();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=Hr(),B.invert(this._globeViewProjMatrixNoCorrectionInverted,n);let a=tt();this._cameraPosition=tt(),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=Ma.fromInvProjectionMatrix(s,1,0,this._cachedClippingPlane,!0)}calculateFogMatrix(e){ve("calculateFogMatrix is not supported on globe projection.");let r=Hr();return B.identity(r),r}getVisibleUnwrappedCoordinates(e){return[new yi(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=It(e);V.scale(n,n,1+r/nr);let i=Fo();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 Qr.default(0,0),new Qr.default(e,0),new Qr.default(this.width,0),new Qr.default(this.width,r),new Qr.default(this.width,this.height),new Qr.default(e,this.height),new Qr.default(0,this.height),new Qr.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=Ut(u.lng,p.lng),f=Ut(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 mt(c)}getConstrained(e,r){let n=ce(e.lat,-Nt,Nt),i=ce(+r,this.minZoom+xt(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=It(n),o=It(e),a=tt();V.zero(a);let s=tt();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=rs(o[0],o[2],s[0],c),f=rs(o[0],o[2],s[0],p),d=tt();V.rotateY(d,o,a,-h);let g=rs(d[1],d[2],s[1],s[2]),x=tt();V.rotateY(x,o,a,-f);let b=rs(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,F=this.center.lat*Math.PI/180,O=ns(h,L),z=ns(g,F),I=ns(f,L),R=ns(b,F);O+z<I+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 C=T/Math.PI*180,A=S/Math.PI*180,E=this.center.lat;this.setCenter(new J(C,ce(A,-90,90))),this.setZoom(this.zoom+xt(E,this.center.lat))}locationToScreenPoint(e,r){let n=It(e);if(r){let i=r.getElevationForLngLatZoom(e,this._helper._tileZoom);V.scale(n,n,1+i/nr)}return this._projectSurfacePointToScreen(n)}_projectSurfacePointToScreen(e){let r=Fo();return Ne.transformMat4(r,[...e,1],this._globeViewProjMatrixNoCorrection),r[0]/=r[3],r[1]/=r[3],new Qr.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){return this.screenPointToMercatorCoordinate(e,r)?.toLngLat()}isPointOnMapSurface(e,r){let n=this._cameraPosition,i=this.getRayDirectionFromPixel(e);return!!this.rayPlanetIntersection(n,i)}getRayDirectionFromPixel(e){let r=Fo();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=tt();n[0]=r[0]-this._cameraPosition[0],n[1]=r[1]-this._cameraPosition[1],n[2]=r[2]-this._cameraPosition[2];let i=tt();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=Fo();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=tt(),a=tt();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=tt();V.add(f,r,[n[0]*i.tMin,n[1]*i.tMin,n[2]*i.tMin]);let d=tt();return V.normalize(d,f),eg(d)}let o=this._cachedClippingPlane,a=o[0]*n[0]+o[1]*n[1]+o[2]*n[2],l=-ts(o,r)/a,u=2,c=tt();if(l>0)V.add(c,r,[n[0]*l,n[1]*l,n[2]*l]);else{let f=tt();V.add(f,r,[n[0]*u,n[1]*u,n[2]*u]);let d=ts(this._cachedClippingPlane,f);V.sub(c,f,[this._cachedClippingPlane[0]*d,this._cachedClippingPlane[1]*d,this._cachedClippingPlane[2]*d])}let p=Bw(o),h=zw(p.center,p.radius,c);return eg(h)}getMatrixForModel(e,r){let n=J.convert(e),i=1/nr,o=Wn();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/nr]),B.rotateX(o,o,Math.PI*.5),B.scale(o,o,[i,i,i]),o}getProjectionDataForCustomLayer(e=!0){let r=this.getProjectionData({overscaledTileID:new Ye(0,0,0,0,0),applyGlobeMatrix:e});return r.tileMercatorCoords=[0,0,1,1],r}getFastPathSimpleProjectionMatrix(e){}};var Jl=class t{constructor(){this._globeLatitudeErrorCorrectionRadians=0;this._globeness=1;this._helper=new Pi({calcMatrices:()=>{this._calcMatrices()},getConstrained:(e,r)=>this.getConstrained(e,r)}),this._globeness=1,this._mercatorTransform=new Fn,this._verticalPerspectiveTransform=new Ea}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 Pn(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return Pn(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 Pn(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 Ih=se(fe(),1);var La=class t{get useGlobeControls(){return!0}handlePanInertia(e,r){let n=tg(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 Ih.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=Ut(r.center.lng,i.lng),v=b/(Math.abs(b/180)+1),P=Ut(r.center.lat,i.lat),w=r.getRayDirectionFromPixel(n),T=r.cameraPosition,S=V.dot(T,w)*-1,C=tt();V.add(C,T,[w[0]*S,w[1]*S,w[2]*S]);let A=V.length(C)-1,E=Math.exp(-Math.max(A-s,0)*l),L=bo(r.worldSize,r.center.lat)/Math.min(r.width,r.height),F=Oo(L,d,g,1,x),O=(1-lt(-a))*Math.min(E,F),z=r.center.lat,I=r.zoom,R=new J(r.center.lng+v*O,ce(r.center.lat+P*O,-Nt,Nt));r.setLocationAtPoint(i,n);let H=r.center,W=Oo(Math.abs(b),u,c,0,1),$=Oo(L,h,f,0,1),he=Math.pow(Math.max(W,$),p),Xe=Ut(H.lng,R.lng),be=Ut(H.lat,R.lat);r.setCenter(new J(H.lng+Xe*he,H.lat+be*he).wrap()),r.setZoom(I+xt(z,r.center.lat))}handleMapControlsPan(e,r,n){if(!e.panDelta)return;let i=r.center.lat,o=r.zoom;r.setCenter(tg(e.panDelta,r).wrap()),r.setZoom(o+xt(i,r.center.lat))}cameraForBoxAndBearing(e,r,n,i,o){let a=vh(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=Ut(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+Ut(h,f)*.5,b=d+Ut(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=[It(n.getNorthWest()),It(n.getNorthEast()),It(n.getSouthWest()),It(n.getSouthEast()),It(new J(f,b)),It(new J(h,b)),It(new J(x,d)),It(new J(x,g))],T=It(a.center),S=Number.POSITIVE_INFINITY;for(let C of w)s<0&&(S=t.getLesserNonNegativeNonNull(S,t.solveVectorScale(C,T,P,"x",s))),l>0&&(S=t.getLesserNonNegativeNonNull(S,t.solveVectorScale(C,T,P,"x",l))),u>0&&(S=t.getLesserNonNegativeNonNull(S,t.solveVectorScale(C,T,P,"y",u))),c<0&&(S=t.getLesserNonNegativeNonNull(S,t.solveVectorScale(C,T,P,"y",c)));if(!Number.isFinite(S)||S===0){$y();return}return a.zoom=v.zoom+rt(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+xt(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;Sa(e,g);let x=e.clone();x.setCenter(g),x.setZoom(p?+r.zoom:n+xt(i.lat,d.lat)),x.setBearing(r.bearing);let b=new Ih.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+xt(i.lat,v.lat),w=n+xt(i.lat,0),T=P+xt(v.lat,0),S=Ut(i.lng,v.lng),C=Ut(i.lat,v.lat),A=lt(T-w);return f=P!==n,{easeFunc:L=>{if(sc(a,c)||_h({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 F=T>w?Math.min(2,A):Math.max(.5,A),O=Math.pow(F,1-L),z=L*O,I=rg(i,S,C,z);e.setCenter(I.wrap())}if(f){let O=Fe.number(w,T,L)+xt(0,e.center.lat);e.setZoom(O)}},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+xt(e.center.lat,l.lat),c=e.clone();c.setCenter(l),c.setZoom(u),c.setBearing(r.bearing);let p=new Ih.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;Sa(e,h);let f=Fw(e,i,h),d=o+xt(i.lat,0),g=u+xt(h.lat,0),x=lt(g-d),b=typeof r.minZoom=="number",v;if(b){let S=+r.minZoom+xt(h.lat,0),A=Math.min(S,d,g)+xt(0,h.lat),L=e.getConstrained(h,A).zoom+xt(h.lat,0);v=lt(L-d)}let P=Ut(i.lng,h.lng),w=Ut(i.lat,h.lat);return{easeFunc:(S,C,A,E)=>{let L=rg(i,P,w,A);s&&e.interpolatePadding(a,r.padding,S);let F=S===1?h:L;e.setCenter(F.wrap());let O=d+rt(C);e.setZoom(S===1?u:O+xt(0,F.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 Ql=class{constructor(e){this._globe=e,this._mercatorCameraHelper=new On,this._verticalPerspectiveCameraHelper=new La}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 Uw(t){if(Array.isArray(t)){let e=new Kl({type:t});return{projection:e,transform:new Jl,cameraHelper:new Ql(e)}}switch(t){case"mercator":return{projection:new xo,transform:new Fn,cameraHelper:new On};case"globe":{let e=new Kl({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]});return{projection:e,transform:new Jl,cameraHelper:new Ql(e)}}case"vertical-perspective":return{projection:new Ia,transform:new Ea,cameraHelper:new La};default:return ve(`Unknown projection name: ${t}. Falling back to mercator projection.`),{projection:new xo,transform:new Fn,cameraHelper:new On}}}var Ah=(t,e)=>oi(t,e&&e.filter(r=>r.identifier!=="source.canvas")),XO=Q_(),Da=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 Ll(Qp(),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 Zp,this.imageManager.setEventedParent(this),this.glyphManager=new qp(r._requestManager,n.localIdeographFontFamily),this.lineAtlas=new $p(256,512),this.crossTileSymbolIndex=new wa,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new eo,this._loaded=!1,this._availableImages=[],this._globalState={},this._resetUpdates(),this.dispatcher.broadcast("SR",pc()),ba().on(zl,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){this._checkLoaded();let i=n===null?this.stylesheet.state?.[r]?.default??null:n;if(Dr(i,this._globalState[r]))return this;this._globalState[r]=i;let o=this._findGlobalStateAffectedSources([r]);for(let a in this.sourceCaches)o.has(a)&&(this._reloadSource(a),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;Kn(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(XO,{validate:!1})}_load(r,n,i){let o=n.transformStyle?n.transformStyle(i,r):r;if(!(n.validate&&Ah(this,Je(o)))){this._loaded=!0,this.stylesheet=o;for(let a in o.sources)this.addSource(a,o.sources[a],{validate:!1});o.sprite?this._loadSprite(o.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(o.glyphs),this._createLayers(),this.light=new Yp(this.stylesheet.light),this._setProjectionInternal(this.stylesheet.projection?.type||"mercator"),this.sky=new Wp(this.stylesheet.sky),this.map.setTerrain(this.stylesheet.terrain??null),this.setGlobalState(this.stylesheet.state??null),this.fire(new U("data",{dataType:"style"})),this.fire(new U("style.load"))}}_createLayers(){let r=Dd(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=Hp(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;y1(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:`${s}:${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 "${i}" does not exist on source "${o.id}" as specified by style layer "${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?kt(i):i);let o=[];for(let a of r)if(i[a]){let s=n?kt(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(){if(this.light?.hasTransition()||this.sky?.hasTransition()||this.projection?.hasTransition())return!0;for(let r in this.sourceCaches)if(this.sourceCaches[r].hasTransition())return!0;for(let r in this._layers)if(this._layers[r].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 ${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={}){this._checkLoaded();let i=this.serialize();if(r=n.transformStyle?n.transformStyle(i,r):r,(n.validate??!0)&&Ah(this,Je(r)))return!1;r=kt(r),r.layers=Dd(r.layers);let a=A_(i,r),s=this._getOperationsToPerform(a);if(s.unimplemented.length>0)throw new Error(`Unimplemented: ${s.unimplemented.join(", ")}.`);if(s.operations.length===0)return!1;for(let l of s.operations)l();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 "${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 "${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 "${r}" already exists.`);if(!n.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(n).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(n.type)>=0&&this._validate(Je.source,`sources.${r}`,n,null,i))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);let s=this.sourceCaches[r]=new Rn(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 "${r}" cannot be removed while layer "${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=${r}`);let i=this.sourceCaches[r].getSource();if(i.type!=="geojson")throw new Error(`geojsonSource.type is ${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 "${o}" already exists on this map.`)));return}let a;if(r.type==="custom"){if(Ah(this,f1(r)))return;a=Hp(r)}else{if("source"in r&&typeof r.source=="object"&&(this.addSource(o,r.source),r=kt(r),r=Z(r,{source:o})),this._validate(Je.layer,`layers.${o}`,r,{arrayIndex:-1},i))return;a=Hp(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 "${o}" before non-existing layer "${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 '${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 "${r}" before non-existing layer "${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 "${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 "${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 "${r}".`)));return}if(!Dr(o.filter,n)){if(n==null){o.setFilter(void 0),this._updateLayer(o);return}this._validate(Je.filter,`layers.${o.id}.filter`,n,null,i)||(o.setFilter(kt(n)),this._updateLayer(o))}}getFilter(r){return kt(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 "${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 "${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 "${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 '${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 '${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 '${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=as(this.sourceCaches,a=>a.serialize()),n=this._serializeByIds(this._order,!0),i=this.map.getTerrain()||void 0,o=this.stylesheet;return ac({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(Je.filter,"queryRenderedFeatures.filter",n.filter,null,n);let o={};if(n&&n.layers){if(!(Array.isArray(n.layers)||n.layers instanceof Set))return this.fire(new 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 '${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={...n,layers:l};for(let c in this.sourceCaches)n.layers&&!o[c]||a.push(S1(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(C1(this._layers,s,this.sourceCaches,r,u,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(a)}querySourceFeatures(r,n){n&&n.filter&&this._validate(Je.filter,"querySourceFeatures.filter",n.filter,null,n);let i=this.sourceCaches[r];return i?M1(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(){return this.stylesheet?.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(){return this.stylesheet?.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=Uw(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:Ah(this,r.call(Je,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),ba().off(zl,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 xh(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(Je.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=[...ma(this.stylesheet.sprite),...a];this._validate(Je.sprite,"sprite",s,null,i)||(this.stylesheet.sprite=s,this._loadSprite(a,!0,o))}removeSprite(r){this._checkLoaded();let n=ma(this.stylesheet.sprite);if(!n.find(i=>i.id===r)){this.fire(new Q(new Error(`Sprite "${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 ma(this.stylesheet.sprite)}setSprite(r,n={},i){this._checkLoaded(),!(r&&this._validate(Je.sprite,"sprite",r,null,n))&&(this.stylesheet.sprite=r,r?this._loadSprite(r,!0,i):(this._unloadSprite(),i&&i(null)))}};m();m();var Nw=ze([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);m();m();var Eh=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 Gw=(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 ft(t,e.u_terrain_matrix),u_terrain_unpack:new Ot(t,e.u_terrain_unpack),u_terrain_exaggeration:new N(t,e.u_terrain_exaggeration)}),jw=(t,e)=>({u_texture:new re(t,e.u_texture),u_ele_delta:new N(t,e.u_ele_delta),u_fog_matrix:new ft(t,e.u_fog_matrix),u_fog_color:new Bt(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 Bt(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)}),Hw=(t,e)=>({u_ele_delta:new N(t,e.u_ele_delta)}),Xw=(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)}),Zw=(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}),qw=t=>({u_ele_delta:t}),Yw=(t,e)=>({u_terrain_coords_id:t/255,u_texture:0,u_ele_delta:e});m();var Ww=(t,e)=>({u_projection_matrix:new ft(t,e.u_projection_matrix),u_projection_tile_mercator_coords:new Ot(t,e.u_projection_tile_mercator_coords),u_projection_clipping_plane:new Ot(t,e.u_projection_clipping_plane),u_projection_transition:new N(t,e.u_projection_transition),u_projection_fallback_matrix:new ft(t,e.u_projection_fallback_matrix)}),$w={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 Lh(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 Dh=class{constructor(e,r,n,i,o,a,s,l,u=[]){let c=e.gl;this.program=c.createProgram();let p=Lh(r.staticAttributes),h=n?n.getBinderAttributes():[],f=p.concat(h),d=or.prelude.staticUniforms?Lh(or.prelude.staticUniforms):[],g=s.staticUniforms?Lh(s.staticUniforms):[],x=r.staticUniforms?Lh(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():[];wr(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(or.prelude.fragmentSource,s.fragmentSource,r.fragmentSource).join(`
744
- `),S=w.concat(or.prelude.vertexSource,s.vertexSource,r.vertexSource).join(`
745
- `);wr(c)||(T=Sw(T),S=Tw(S));let C=c.createShader(c.FRAGMENT_SHADER);if(c.isContextLost()){this.failedToCreate=!0;return}if(c.shaderSource(C,T),c.compileShader(C),!c.getShaderParameter(C,c.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${c.getShaderInfoLog(C)}`);c.attachShader(this.program,C);let A=c.createShader(c.VERTEX_SHADER);if(c.isContextLost()){this.failedToCreate=!0;return}if(c.shaderSource(A,S),c.compileShader(A),!c.getShaderParameter(A,c.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${c.getShaderInfoLog(A)}`);c.attachShader(this.program,A),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: ${c.getProgramInfoLog(this.program)}`);c.deleteShader(A),c.deleteShader(C);for(let L=0;L<P.length;L++){let F=P[L];if(F&&!E[F]){let O=c.getUniformLocation(this.program,F);O&&(E[F]=O)}}this.fixedUniforms=i(e,E),this.terrainUniforms=Gw(e,E),this.projectionUniforms=Ww(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 C=$w[S];this.projectionUniforms[C].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 C=S.vaos||(S.vaos={});(C[c]||(C[c]=new Eh)).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 Rh(t,e,r){let n=1/yt(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 Kw(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/yt(n,1,r.transform.tileZoom),u_pixel_coord_upper:[c>>16,p>>16],u_pixel_coord_lower:[c&65535,p&65535]}}var Jw=(t,e)=>({u_lightpos:new gt(t,e.u_lightpos),u_lightpos_globe:new gt(t,e.u_lightpos_globe),u_lightintensity:new N(t,e.u_lightintensity),u_lightcolor:new gt(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)}),Qw=(t,e)=>({u_lightpos:new gt(t,e.u_lightpos),u_lightpos_globe:new gt(t,e.u_lightpos_globe),u_lightintensity:new N(t,e.u_lightintensity),u_lightcolor:new gt(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 gt(t,e.u_scale),u_fade:new N(t,e.u_fade)}),ig=(t,e,r,n)=>{let i=t.style.light,o=i.properties.get("position"),a=[o.x,o.y,o.z],s=vn.create();i.properties.get("anchor")==="viewport"&&vn.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}},eT=(t,e,r,n,i,o,a)=>Z(ig(t,e,r,n),Rh(o,t,a),{u_height_factor:-Math.pow(2,i.overscaledZ)/a.tileSize/8});m();var tT=(t,e)=>({u_fill_translate:new ee(t,e.u_fill_translate)}),rT=(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 gt(t,e.u_scale),u_fade:new N(t,e.u_fade),u_fill_translate:new ee(t,e.u_fill_translate)}),nT=(t,e)=>({u_world:new ee(t,e.u_world),u_fill_translate:new ee(t,e.u_fill_translate)}),iT=(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 gt(t,e.u_scale),u_fade:new N(t,e.u_fade),u_fill_translate:new ee(t,e.u_fill_translate)}),og=(t,e,r,n)=>Z(Rh(e,t,r),{u_fill_translate:n}),oT=t=>({u_fill_translate:t}),aT=(t,e)=>({u_world:t,u_fill_translate:e}),sT=(t,e,r,n,i)=>Z(og(t,e,r,i),{u_world:n});m();var lT=(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)}),uT=(t,e,r,n,i)=>{let o=t.transform,a,s,l=0;if(r.paint.get("circle-pitch-alignment")==="map"){let u=yt(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 cT=(t,e)=>({u_pixel_extrude_scale:new ee(t,e.u_pixel_extrude_scale)}),pT=(t,e)=>({u_viewport_size:new ee(t,e.u_viewport_size)}),hT=t=>({u_pixel_extrude_scale:[1/t.width,1/t.height]}),fT=t=>({u_viewport_size:[t.width,t.height]});m();var mT=(t,e)=>({u_color:new Bt(t,e.u_color),u_overlay:new re(t,e.u_overlay),u_overlay_scale:new N(t,e.u_overlay_scale)}),ag=(t,e=1)=>({u_color:t,u_overlay:0,u_overlay_scale:e});m();var dT=(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)}),yT=(t,e)=>({u_matrix:new ft(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)}),sg=(t,e,r,n)=>{let o=yt(t,1,e)/(8192*Math.pow(2,t.tileID.overscaledZ))*2*Math.PI*n;return{u_extrude_scale:yt(t,1,e),u_intensity:r,u_globe_extrude_scale:o}},lg=(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 gT=(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 ul(t,e.u_altitudes),u_azimuths:new ul(t,e.u_azimuths),u_accent:new Bt(t,e.u_accent),u_method:new re(t,e.u_method),u_shadows:new ll(t,e.u_shadows),u_highlights:new ll(t,e.u_highlights)}),xT=(t,e)=>({u_matrix:new ft(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 Ot(t,e.u_unpack)}),bT=(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:ZO(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}},_T=(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 ZO(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 vT=(t,e)=>({u_image:new re(t,e.u_image),u_unpack:new Ot(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)}),PT=(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 wT=(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)}),TT=(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)}),ST=(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 gt(t,e.u_scale),u_fade:new N(t,e.u_fade)}),CT=(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)}),kh=(t,e,r,n)=>{let i=t.transform;return{u_translation:LT(t,e,r),u_ratio:n/yt(e,1,i.zoom),u_device_pixel_ratio:t.pixelRatio,u_units_to_pixels:[1/i.pixelsToGLUnits[0],1/i.pixelsToGLUnits[1]]}},MT=(t,e,r,n,i)=>Z(kh(t,e,r,n),{u_image:0,u_image_height:i}),IT=(t,e,r,n,i)=>{let o=t.transform,a=ET(e,o);return{u_translation:LT(t,e,r),u_texsize:e.imageAtlasTexture.size,u_ratio:n/yt(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]]}},AT=(t,e,r,n,i,o)=>{let a=t.transform,s=t.lineAtlas,l=ET(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(kh(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 ET(t,e){return 1/yt(t,1,e.tileZoom)}function LT(t,e,r){return Yt(t.transform,e,r.paint.get("line-translate"),r.paint.get("line-translate-anchor"))}m();var DT=(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 gt(t,e.u_spin_weights),u_coords_top:new Ot(t,e.u_coords_top),u_coords_bottom:new Ot(t,e.u_coords_bottom)}),RT=(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:WO(n.paint.get("raster-saturation")),u_contrast_factor:YO(n.paint.get("raster-contrast")),u_spin_weights:qO(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 qO(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 YO(t){return t>0?1/(1-t):1+t}function WO(t){return t>0?1-1/(1.001-t):-t}m();var kT=(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 ft(t,e.u_label_plane_matrix),u_coord_matrix:new ft(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)}),FT=(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 ft(t,e.u_label_plane_matrix),u_coord_matrix:new ft(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)}),OT=(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 ft(t,e.u_label_plane_matrix),u_coord_matrix:new ft(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)}),ug=(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}},cg=(t,e,r,n,i,o,a,s,l,u,c,p,h,f)=>{let d=a.transform;return Z(ug(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})},BT=(t,e,r,n,i,o,a,s,l,u,c,p,h)=>Z(cg(t,e,r,n,i,o,a,s,l,u,!0,c,!0,h),{u_texsize_icon:p,u_texture_icon:1});m();var zT=(t,e)=>({u_opacity:new N(t,e.u_opacity),u_color:new Bt(t,e.u_color)}),VT=(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)}),UT=(t,e)=>({u_opacity:t,u_color:e}),NT=(t,e,r,n,i)=>Z(Kw(r,i,e,n),{u_opacity:t});m();var GT=(t,e)=>({u_sun_pos:new gt(t,e.u_sun_pos),u_atmosphere_blend:new N(t,e.u_atmosphere_blend),u_globe_position:new gt(t,e.u_globe_position),u_globe_radius:new N(t,e.u_globe_radius),u_inv_proj_matrix:new ft(t,e.u_inv_proj_matrix)}),jT=(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 HT=(t,e)=>({u_sky_color:new Bt(t,e.u_sky_color),u_horizon_color:new Bt(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)}),XT=(t,e,r)=>{let n=Math.cos(e.rollInRadians),i=Math.sin(e.rollInRadians),o=va(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 ZT=(t,e)=>{},qT={fillExtrusion:Jw,fillExtrusionPattern:Qw,fill:tT,fillPattern:rT,fillOutline:nT,fillOutlinePattern:iT,circle:lT,collisionBox:cT,collisionCircle:pT,debug:mT,depth:ZT,clippingMask:ZT,heatmap:dT,heatmapTexture:yT,hillshade:gT,hillshadePrepare:xT,colorRelief:vT,line:wT,lineGradient:TT,linePattern:ST,lineSDF:CT,raster:DT,symbolIcon:kT,symbolSDF:FT,symbolTextAndIcon:OT,background:zT,backgroundPattern:VT,terrain:jw,terrainDepth:Hw,terrainCoords:Xw,projectionErrorMeasurement:Aw,atmosphere:GT,sky:HT};m();m();var Fh=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 $O={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"},Oh=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 ${e.length}, which doesn't match current length of ${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[$O[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)}},Bh=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)}},zh=class extends Oe{getDefault(){return 1}set(e){e===this.current&&!this.dirty||(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}},Vh=class extends Oe{getDefault(){return 0}set(e){e===this.current&&!this.dirty||(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}},Uh=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)}},Nh=class extends Oe{getDefault(){return!0}set(e){e===this.current&&!this.dirty||(this.gl.depthMask(e),this.current=e,this.dirty=!1)}},Gh=class extends Oe{getDefault(){return 255}set(e){e===this.current&&!this.dirty||(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}},jh=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)}},Hh=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)}},Xh=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}},Zh=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)}},qh=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}},Yh=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)}},Wh=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}},$h=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)}},Kh=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)}},Jh=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)}},Qh=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}},ef=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)}},tf=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)}},rf=class extends Oe{getDefault(){return null}set(e){e===this.current&&!this.dirty||(this.gl.useProgram(e),this.current=e,this.dirty=!1)}},nf=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)}},of=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)}},af=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}},sf=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}},lf=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}},uf=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}},cf=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}},pf=class extends Oe{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let r=this.gl;wr(r)?r.bindVertexArray(e):r.getExtension("OES_vertex_array_object")?.bindVertexArrayOES(e),this.current=e,this.dirty=!1}},hf=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}},ff=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}},mf=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}},eu=class extends Oe{constructor(e,r){super(e),this.context=e,this.parent=r}getDefault(){return null}},df=class extends eu{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}},yf=class extends eu{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}},gf=class extends eu{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 YT="Framebuffer is not complete";function WT(t){return t.message===YT}function $T(){return new Error(YT)}var xf=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 df(e,s),i)this.depthAttachment=o?new gf(e,s):new yf(e,s);else if(o)throw new Error("Stencil cannot be set without depth");if(a.checkFramebufferStatus(a.FRAMEBUFFER)!==a.FRAMEBUFFER_COMPLETE)throw $T()}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 bf=class{constructor(e){if(this.gl=e,this.clearColor=new Bh(this),this.clearDepth=new zh(this),this.clearStencil=new Vh(this),this.colorMask=new Uh(this),this.depthMask=new Nh(this),this.stencilMask=new Gh(this),this.stencilFunc=new jh(this),this.stencilOp=new Hh(this),this.stencilTest=new Xh(this),this.depthRange=new Zh(this),this.depthTest=new qh(this),this.depthFunc=new Yh(this),this.blend=new Wh(this),this.blendFunc=new $h(this),this.blendColor=new Kh(this),this.blendEquation=new Jh(this),this.cullFace=new Qh(this),this.cullFaceSide=new ef(this),this.frontFace=new tf(this),this.program=new rf(this),this.activeTexture=new nf(this),this.viewport=new of(this),this.bindFramebuffer=new af(this),this.bindRenderbuffer=new sf(this),this.bindTexture=new lf(this),this.bindVertexBuffer=new uf(this),this.bindElementBuffer=new cf(this),this.bindVertexArray=new pf(this),this.pixelStoreUnpack=new hf(this),this.pixelStoreUnpackPremultiplyAlpha=new ff(this),this.pixelStoreUnpackFlipY=new mf(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),wr(e)){this.HALF_FLOAT=e.HALF_FLOAT;let r=e.getExtension("EXT_color_buffer_half_float");this.RGBA16F=e.RGBA16F??r?.RGBA16F_EXT,this.RGB16F=e.RGB16F??r?.RGB16F_EXT,e.getExtension("EXT_color_buffer_float")}else{e.getExtension("EXT_color_buffer_half_float"),e.getExtension("OES_texture_half_float_linear");let r=e.getExtension("OES_texture_half_float");this.HALF_FLOAT=r?.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 Fh(this,e,r)}createVertexBuffer(e,r,n){return new Oh(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 xf(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(){return wr(this.gl)?this.gl.createVertexArray():this.gl.getExtension("OES_vertex_array_object")?.createVertexArrayOES()}deleteVertexArray(e){return wr(this.gl)?this.gl.deleteVertexArray(e):this.gl.getExtension("OES_vertex_array_object")?.deleteVertexArrayOES(e)}unbindVAO(){this.bindVertexArray.set(null)}};m();var vf=se(fe(),1);m();var _f;function pg(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,hT(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 up;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],C=b.circleArray[P+3];f.emplace(d++,w,T,S,C,0),f.emplace(d++,w,T,S,C,1),f.emplace(d++,w,T,S,C,2),f.emplace(d++,w,T,S,C,3)}(!_f||_f.length<c*2)&&(_f=KO(c));let g=o.createIndexBuffer(_f,!0),x=o.createVertexBuffer(f,U0.members,!0);for(let b of u){let v=fT(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 KO(t){let e=t*2,r=new pp;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 JO=B.identity(new Float32Array(16));function QT(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"))&&eB(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&&KT(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&&KT(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&&(pg(t,e,r,n,!0),pg(t,e,r,n,!1))}function QO(t,e,r,n,i,o){let{horizontalAlign:a,verticalAlign:s}=Op(t),l=-(a-.5)*e,u=-(s-.5)*r;return new vf.default((l/i+n[0])*o,(u/i+n[1])*o)}function eB(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=co(x,u.zoom),v=yt(d,1,e.transform.zoom),P=Nl(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?(A,E)=>c.getElevation(f,A,E):null,C=Yt(u,d,a,s);rB(g,p,h,l,u,P,T,b,w,C,f.toUnwrapped(),S)}}}function tB(t,e,r,n,i,o){let a=e.tileAnchorPoint.add(new vf.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 fh(l.x,l.y,e.pitchedLabelPlaneMatrix,e.getElevation).point}else if(r){let l=_i(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 rB(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)yo(b.numGlyphs,f);else{let w=new vf.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?Oy(w.x,w.y,T):_i(w.x,w.y,T),C=ky(i.cameraToCenterDistance,S.signedDistanceFromCamera),A=ha(t.textSizeData,s,b)*C/mi;r&&(A*=t.tilePixelRatio/a);let{width:E,height:L,anchor:F,textOffset:O,textBoxScale:z}=P,I=QO(F,E,L,O,z,A),R=i.getPitchedTextCorrection(w.x+u[0],w.y+u[1],c),H=tB(S.point,T,e,I,-i.bearingInRadians,R),W=t.allowVerticalPlacement&&b.placedOrientation===2?Math.PI/2:0;for(let $=0;$<b.numGlyphs;$++)po(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)yo(v.numGlyphs,d);else{let P=g[b];if(!P)yo(v.numGlyphs,d);else for(let w=0;w<v.numGlyphs;w++)po(d,P.shiftedAnchor,P.angle)}}t.icon.dynamicLayoutVertexBuffer.updateData(d)}t.text.dynamicLayoutVertexBuffer.updateData(f)}function nB(t,e,r){return r.iconsInText&&e?"symbolTextAndIcon":t?"symbolSDF":"symbolIcon"}function KT(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),C=r._unevaluatedLayout.hasValue("text-variable-anchor")||r._unevaluatedLayout.hasValue("text-variable-anchor-offset"),A=[],E=g.getCircleRadiusCorrection();for(let L of n){let F=e.getTile(L),O=F.getBucket(r);if(!O)continue;let z=i?O.text:O.icon;if(!z||!z.segments.get().length||!z.hasVisibleVertices)continue;let I=z.programConfigurations.get(r.id),R=i||O.sdfIcons,H=i?O.textSizeData:O.iconSizeData,W=b||g.pitch!==0,$=t.useProgram(nB(R,i,O),I),he=co(H,g.zoom),Xe=t.style.map.terrain&&t.style.map.terrain.getTerrainData(L),be,ye=[0,0],Ze,st,vt=null,dt;if(i){if(Ze=F.glyphAtlasTexture,st=d.LINEAR,be=F.glyphAtlasTexture.size,O.iconsInText){ye=F.imageAtlasTexture.size,vt=F.imageAtlasTexture;let At=H.kind==="composite"||H.kind==="camera";dt=W||t.options.rotating||t.options.zooming||At?d.LINEAR:d.NEAREST}}else{let At=r.layout.get("icon-size").constantOr(0)!==1||O.iconsNeedLinear;Ze=F.imageAtlasTexture,st=R||t.options.rotating||t.options.zooming||At||W?d.LINEAR:d.NEAREST,be=F.imageAtlasTexture.size}let zt=yt(F,1,t.transform.zoom),cr=Nl(x,t.transform,zt),rn=B.create();B.invert(rn,cr);let pr=K1(b,x,t.transform,zt),Ct=Yt(g,F,o,a),Ya=g.getProjectionData({overscaledTileID:L,applyGlobeMatrix:!h,applyTerrainMatrix:!0}),Lo=C&&O.hasTextData(),Li=r.layout.get("icon-text-fit")!=="none"&&Lo&&O.hasIconData();if(v){let At=t.style.map.terrain?(Di,Ro)=>t.style.map.terrain.getElevation(L,Di,Ro):null,Ar=r.layout.get("text-rotation-alignment")==="map";J1(O,t,i,cr,rn,b,u,Ar,L.toUnwrapped(),g.width,g.height,Ct,At)}let xn=i&&C||Li,Do=b?cr:t.transform.clipSpaceToPixelsMatrix,Ir=v||xn?JO:Do,Hn=R&&r.paint.get(i?"text-halo-width":"icon-halo-width").constantOr(1)!==0,bn;R?O.iconsInText?bn=BT(H.kind,he,P,b,v,xn,t,Ir,pr,Ct,be,ye,E):bn=cg(H.kind,he,P,b,v,xn,t,Ir,pr,Ct,i,be,!0,E):bn=ug(H.kind,he,P,b,v,xn,t,Ir,pr,Ct,i,be,E);let Dt={program:$,buffers:z,uniformValues:bn,projectionData:Ya,atlasTexture:Ze,atlasTextureIcon:vt,atlasInterpolation:st,atlasInterpolationIcon:dt,isSDF:R,hasHalo:Hn};if(w&&O.canOverlap){T=!0;let At=z.segments.get();for(let Ar of At)A.push({segments:new de([Ar]),sortKey:Ar.sortKey,state:Dt,terrainData:Xe})}else A.push({segments:z.segments,sortKey:0,state:Dt,terrainData:Xe})}T&&A.sort((L,F)=>L.sortKey-F.sortKey);for(let L of A){let F=L.state;if(f.activeTexture.set(d.TEXTURE0),F.atlasTexture.bind(F.atlasInterpolation,d.CLAMP_TO_EDGE),F.atlasTextureIcon&&(f.activeTexture.set(d.TEXTURE1),F.atlasTextureIcon&&F.atlasTextureIcon.bind(F.atlasInterpolationIcon,d.CLAMP_TO_EDGE)),F.isSDF){let O=F.uniformValues;F.hasHalo&&(O.u_is_halo=1,JT(F.buffers,L.segments,r,t,F.program,S,c,p,O,F.projectionData,L.terrainData)),O.u_is_halo=0}JT(F.buffers,L.segments,r,t,F.program,S,c,p,F.uniformValues,F.projectionData,L.terrainData)}}function JT(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 eS(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"),C=r.paint.get("circle-translate-anchor"),A=Yt(h,w,S,C),E=T.programConfigurations.get(r.id),L=t.useProgram("circle",E),F=T.layoutVertexBuffer,O=T.indexBuffer,z=t.style.map.terrain&&t.style.map.terrain.getTerrainData(P),I=uT(t,w,r,A,b),R=h.getProjectionData({overscaledTileID:P,applyGlobeMatrix:!o,applyTerrainMatrix:!0}),H={programConfiguration:E,program:L,layoutVertexBuffer:F,indexBuffer:O,uniformValues:I,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:C,terrainData:A,projectionData:E}=v.state,L=v.segments;w.draw(c,p.TRIANGLES,f,d,g,le.backCCW,C,A,E,r.id,T,S,L,r.paint,t.transform.zoom,P)}}m();function tS(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"?aB(t,u,r,l,s):t.renderPass==="translucent"&&sB(t,r,l,a,s))}o.viewport.set([0,0,t.width,t.height])}else t.renderPass==="offscreen"?iB(t,e,r,n):t.renderPass==="translucent"&&oB(t,r)}function iB(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]);lB(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,sg(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 oB(t,e){let r=t.context,n=r.gl;r.setColorMode(t.colorModeForRenderPass());let i=e.heatmapFbos.get(na);if(!i)return;r.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,i.colorAttachment.get()),r.activeTexture.set(n.TEXTURE1),nS(r,e).bind(n.LINEAR,n.CLAMP_TO_EDGE),t.useProgram("heatmapTexture").draw(r,n.TRIANGLES,ne.disabled,pe.disabled,t.colorModeForRenderPass(),le.disabled,lg(t,e,0,1),null,null,e.id,t.viewportBuffer,t.quadTriangleIndexBuffer,t.viewportSegments,e.paint,t.transform.zoom)}function aB(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=rS(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,sg(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 sB(t,e,r,n,i){let o=t.context,a=o.gl,s=t.transform;o.setColorMode(t.colorModeForRenderPass());let l=nS(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,lg(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 lB(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(na);i?(n.bindTexture(n.TEXTURE_2D,i.colorAttachment.get()),t.bindFramebuffer.set(i.framebuffer)):(i=rS(t,e.width/4,e.height/4),r.heatmapFbos.set(na,i))}function rS(t,e,r){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=t.HALF_FLOAT??n.UNSIGNED_BYTE,a=t.RGBA16F??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 nS(t,e){return e.colorRampTexture||(e.colorRampTexture=new Se(t,e.colorRamp,t.gl.RGBA)),e.colorRampTexture}m();function iS(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 C=S.programConfigurations.get(r.id),A=t.context.program.get(),E=t.useProgram(g,C),L=P||E.program!==A,F=t.style.map.terrain&&t.style.map.terrain.getTerrainData(w),O=p.constantOr(null);if(O&&T.imageAtlas){let W=T.imageAtlas,$=W.patternPositions[O.to.toString()],he=W.patternPositions[O.from.toString()];$&&he&&C.setConstantPatternPositions($,he)}let z=v.getProjectionData({overscaledTileID:w,applyGlobeMatrix:!o,applyTerrainMatrix:!0}),I=v.getPixelScale(),R=h?IT(t,T,r,I,d):c?AT(t,T,r,I,c,d):f?MT(t,T,r,I,S.lineClipsArray.length):kh(t,T,r,I);if(h)x.activeTexture.set(b.TEXTURE0),T.imageAtlasTexture.bind(b.LINEAR,b.CLAMP_TO_EDGE),C.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,st=S.maxLineLength/8192*1024*be;he=ce(Bb(st),256,x.maxTextureSize)}W.gradient=bp({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,F,z,r.id,S.layoutVertexBuffer,S.indexBuffer,S.segments,r.paint,t.transform.zoom,C,S.layoutVertexBuffer2),P=!1}}m();m();function Pf(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 aS(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);oS(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);oS(t,e,r,n,p,l,!0,s)}}function oS(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 C=e.getTile(S);if(p&&!C.patternsLoaded())continue;let A=C.getBucket(r);if(!A)continue;let E=A.programConfigurations.get(r.id),L=t.useProgram(d,E),F=t.style.map.terrain&&t.style.map.terrain.getTerrainData(S);p&&(t.context.activeTexture.set(l.TEXTURE0),C.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),E.updatePaintBuffers(h)),Pf(E,u,T,C,r);let O=v.getProjectionData({overscaledTileID:S,applyGlobeMatrix:!s,applyTerrainMatrix:!0}),z=Yt(v,C,P,w);if(!a)x=A.indexBuffer,b=A.segments,g=p?og(t,h,C,z):oT(z);else{x=A.indexBuffer2,b=A.segments2;let R=[l.drawingBufferWidth,l.drawingBufferHeight];g=d==="fillOutlinePattern"&&p?sT(t,h,C,R,z):aT(R,z)}let I=t.stencilModeForClipping(S);L.draw(t.context,f,i,I,o,le.backCCW,g,F,O,r.id,A.layoutVertexBuffer,x,b,r.paint,t.transform.zoom,E)}}m();function sS(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();hg(t,e,r,n,s,pe.disabled,l,a)}else hg(t,e,r,n,s,pe.disabled,De.disabled,a),hg(t,e,r,n,s,t.stencilModeFor3D(),t.colorModeForRenderPass(),a)}}function hg(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 C=x.getProjectionData({overscaledTileID:b,applyGlobeMatrix:!s,applyTerrainMatrix:!0});Pf(T,c,g,v,r);let A=Yt(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?eT(t,E,d,A,b,f,v):ig(t,E,d,A);S.draw(l,l.gl.TRIANGLES,i,o,a,le.backCCW,L,w,C,r.id,P.layoutVertexBuffer,P.indexBuffer,P.segments,r.paint,t.transform.zoom,T,t.style.map.terrain&&P.centroidVertexBuffer)}}m();function lS(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")uB(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);fg(t,e,r,f,p,u,c,!1,o),fg(t,e,r,f,h,u,c,!0,o)}else{let[p,h]=t.getStencilConfigForOverlapAndUpdateStencilID(n);fg(t,e,r,h,p,u,c,!1,o)}}function fg(t,e,r,n,i,o,a,s,l){let u=t.style.projection,c=t.context,p=t.transform,h=c.gl,f=[`#define NUM_ILLUMINATION_SOURCES ${r.paint.get("hillshade-highlight-color").values.length}`],d=t.useProgram("hillshade",null,!1,f),g=!t.options.moving;for(let x of n){let b=e.getTile(x),v=b.fbo;if(!v)continue;let P=u.getMeshFromTileID(c,x.canonical,s,!0,"raster"),w=t.style.map.terrain?.getTerrainData(x);c.activeTexture.set(h.TEXTURE0),h.bindTexture(h.TEXTURE_2D,v.colorAttachment.get());let T=p.getProjectionData({overscaledTileID:x,aligned:g,applyGlobeMatrix:!l,applyTerrainMatrix:!0});d.draw(c,h.TRIANGLES,o,i[x.overscaledZ],a,le.backCCW,bT(t,b,r),w,T,r.id,P.vertexBuffer,P.indexBuffer,P.segments)}}function uB(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,_T(c.tileID,p),null,null,n.id,t.rasterBoundsBuffer,t.quadTriangleIndexBuffer,t.rasterBoundsSegments),c.needsHillshadePrepare=!1}}m();function uS(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);mg(t,e,r,h,c,l,u,!1,o),mg(t,e,r,h,p,l,u,!0,o)}else{let[c,p]=t.getStencilConfigForOverlapAndUpdateStencilID(n);mg(t,e,r,p,c,l,u,!1,o)}}function mg(t,e,r,n,i,o,a,s,l){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 x of n){let b=e.getTile(x),v=b.dem;if(g){let A=h.getParameter(h.MAX_TEXTURE_SIZE),{elevationTexture:E,colorTexture:L}=r.getColorRampTextures(c,A,v.getUnpackVector());c.activeTexture.set(h.TEXTURE1),E.bind(h.NEAREST,h.CLAMP_TO_EDGE),c.activeTexture.set(h.TEXTURE4),L.bind(h.LINEAR,h.CLAMP_TO_EDGE),g=!1}if(!v||!v.data)continue;let P=v.stride,w=v.getPixels();if(c.activeTexture.set(h.TEXTURE0),c.pixelStoreUnpackPremultiplyAlpha.set(!1),b.demTexture=b.demTexture||t.getTileTexture(P),b.demTexture){let A=b.demTexture;A.update(w,{premultiply:!1}),A.bind(h.LINEAR,h.CLAMP_TO_EDGE)}else b.demTexture=new Se(c,w,h.RGBA,{premultiply:!1}),b.demTexture.bind(h.LINEAR,h.CLAMP_TO_EDGE);let T=u.getMeshFromTileID(c,x.canonical,s,!0,"raster"),S=t.style.map.terrain?.getTerrainData(x),C=p.getProjectionData({overscaledTileID:x,aligned:d,applyGlobeMatrix:!l,applyTerrainMatrix:!0});f.draw(c,h.TRIANGLES,o,i[x.overscaledZ],a,le.backCCW,PT(r,b.dem),S,C,r.id,T.vertexBuffer,T.indexBuffer,T.segments)}}m();var tu=se(fe(),1),dg=[new tu.default(0,0),new tu.default(8192,0),new tu.default(8192,8192),new tu.default(0,8192)];function cS(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 _r)wf(t,e,r,n,null,!1,!1,a.tileCoords,a.flippedWindingOrder,o);else if(l){let[u,c,p]=t.stencilConfigForOverlapTwoPass(n);wf(t,e,r,p,u,!1,!0,dg,!1,o),wf(t,e,r,p,c,!0,!0,dg,!1,o)}else{let[u,c]=t.getStencilConfigForOverlapAndUpdateStencilID(n);wf(t,e,r,c,u,!1,!0,dg,!1,o)}}function wf(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),A=cB(w,T||S||null,e,r,t.transform,t.style.map.terrain),E,L,F=r.paint.get("raster-resampling")==="nearest"?h.NEAREST:h.LINEAR;p.activeTexture.set(h.TEXTURE0),w.texture.bind(F,h.CLAMP_TO_EDGE,h.LINEAR_MIPMAP_NEAREST),p.activeTexture.set(h.TEXTURE1),T?(T.texture.bind(F,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(F,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 O=t.style.map.terrain&&t.style.map.terrain.getTerrainData(v),z=d.getProjectionData({overscaledTileID:v,aligned:b,applyGlobeMatrix:!u,applyTerrainMatrix:!0}),I=RT(L||[0,0],E||1,A,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,I,O,z,r.id,R.vertexBuffer,R.indexBuffer,R.segments)}}function cB(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=mo(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 pS(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||bi(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}),C=f?NT(a,t,f,{tileID:T,tileSize:h},w):UT(a,o),A=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,C,A,S,r.id,E.vertexBuffer,E.indexBuffer,E.segments)}}m();var pB=new K(1,0,0,1),hB=new K(0,1,0,1),fB=new K(0,0,1,1),mB=new K(1,0,1,1),dB=new K(0,1,1,1);function mS(t){let e=t.transform.padding,r=3;hS(t,t.transform.height-(e.top||0),r,pB),hS(t,e.bottom||0,r,hB),fS(t,e.left||0,r,fB),fS(t,t.transform.width-(e.right||0),r,mB);let n=t.transform.centerPoint;yB(t,n.x,t.transform.height-n.y,dB)}function yB(t,e,r,n){Tf(t,e-2/2,r-20/2,2,20,n),Tf(t,e-20/2,r-2/2,20,2,n)}function hS(t,e,r,n){Tf(t,0,e+r/2,t.transform.width,r,n)}function fS(t,e,r,n){Tf(t,e-r/2,0,r,t.transform.height,n)}function Tf(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 dS(t,e,r){for(let n=0;n<r.length;n++)gB(t,e,r[n])}function gB(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+=` => ${r.overscaledZ}`);let b=`${x} ${f}kB`;xB(t,b);let v=t.transform.getProjectionData({overscaledTileID:r,applyGlobeMatrix:!0,applyTerrainMatrix:!0});o.draw(n,i.TRIANGLES,a,s,De.alphaBlended,le.disabled,ag(K.transparent,g),null,v,u,t.debugBuffer,t.quadTriangleIndexBuffer,t.debugSegments),o.draw(n,i.LINE_STRIP,a,s,l,le.disabled,ag(K.red),c,v,u,t.debugBuffer,t.tileBorderIndexBuffer,t.debugSegments)}function xB(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 yS(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 gS(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;
746
- uniform mat4 u_projection_matrix;
747
- ${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 xS(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=qw(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 bS(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=Yw(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 yg(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=Zw(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 _S(t,e){if(!e.mesh){let r=new Et;r.emplaceBack(-1,-1),r.emplaceBack(1,-1),r.emplaceBack(1,1),r.emplaceBack(-1,1);let n=new Qe;n.emplaceBack(0,1,2),n.emplaceBack(0,2,3),e.mesh=new ar(t.createVertexBuffer(r,Pr.members),t.createIndexBuffer(n),de.simpleSegment(0,0,r.length,n.length))}return e.mesh}function vS(t,e){let r=t.context,n=r.gl,i=XT(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=_S(r,e);l.draw(r,n.TRIANGLES,o,a,s,le.disabled,i,null,void 0,"sky",u.vertexBuffer,u.indexBuffer,u.segments)}function bB(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 PS(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=bB(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=bo(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=jT(l,c,d,p,h),x=_S(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 Sf=class{constructor(e,r){this.context=new bf(e),this.transform=r,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:B.identity(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Rn.maxUnderzooming+Rn.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new wa}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 Et;r.emplaceBack(0,0),r.emplaceBack(8192,0),r.emplaceBack(0,8192),r.emplaceBack(8192,8192),this.tileExtentBuffer=e.createVertexBuffer(r,Pr.members),this.tileExtentSegments=de.simpleSegment(0,0,4,2);let n=new Et;n.emplaceBack(0,0),n.emplaceBack(8192,0),n.emplaceBack(0,8192),n.emplaceBack(8192,8192),this.debugBuffer=e.createVertexBuffer(n,Pr.members),this.debugSegments=de.simpleSegment(0,0,4,5);let i=new ep;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,Nw.members),this.rasterBoundsSegments=de.simpleSegment(0,0,4,2);let o=new Et;o.emplaceBack(0,0),o.emplaceBack(8192,0),o.emplaceBack(0,8192),o.emplaceBack(8192,8192),this.rasterBoundsBufferPosOnly=e.createVertexBuffer(o,Pr.members),this.rasterBoundsSegmentsPosOnly=de.simpleSegment(0,0,4,5);let a=new Et;a.emplaceBack(0,0),a.emplaceBack(1,0),a.emplaceBack(0,1),a.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(a,Pr.members),this.viewportSegments=de.simpleSegment(0,0,4,2);let s=new ol;s.emplaceBack(0),s.emplaceBack(1),s.emplaceBack(3),s.emplaceBack(2),s.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(s);let l=new Qe;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 ar(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=bi(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){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:e.projection?.transitionState>0};for(let c in i){let p=i[c];p.used&&p.prepare(this.context),o[c]=p.getVisibleCoordinates(!1),a[c]=o[c].slice().reverse(),s[c]=p.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let c=0;c<n.length;c++){let p=n[c];if(this.style._layers[p].is3D()){this.opaquePassCutoff=c;break}}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(let c of n){let p=this.style._layers[c];if(!p.hasOffscreenPass()||p.isHidden(this.transform.zoom))continue;let h=a[p.source];p.type!=="custom"&&!h.length||this.renderLayer(this,i[p.source],p,h,l)}if(this.style.projection?.updateGPUdependent({context:this.context,useProgram:c=>this.useProgram(c)}),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&&vS(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 c=this.style._layers[n[this.currentLayer]],p=i[c.source],h=o[c.source];this._renderTileClippingMasks(c,h,!1),this.renderLayer(this,p,c,h,l)}this.renderPass="translucent";let u=!1;for(this.currentLayer=0;this.currentLayer<n.length;this.currentLayer++){let c=this.style._layers[n[this.currentLayer]],p=i[c.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(c,l))continue;!this.opaquePassEnabledForLayer()&&!u&&(u=!0,l.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());let h=(c.type==="symbol"?s:a)[c.source];this._renderTileClippingMasks(c,o[c.source],!!this.renderToTexture),this.renderLayer(this,p,c,h,l)}if(l.isRenderingGlobe&&PS(this,this.style.sky,this.style.light),this.options.showTileBoundaries){let c=yS(this.style,this.transform.zoom);c&&dS(this,c,c.getVisibleCoordinates())}this.options.showPadding&&mS(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,xS(this,this.style.map.terrain),bS(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,a1(n)?QT(e,r,n,i,this.style.placement.variableOffsets,o):Zv(n)?eS(e,r,n,i,o):Kv(n)?tS(e,r,n,i,o):O0(n)?iS(e,r,n,i,o):f0(n)?aS(e,r,n,i,o):C0(n)?sS(e,r,n,i,o):e0(n)?lS(e,r,n,i,o):n0(n)?uS(e,r,n,i,o):h1(n)?cS(e,r,n,i,o):u1(n)?pS(e,r,n,i,o):m1(n)&&gS(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?or.projectionMercator:a.shaderPreludeCode,l=n?Yy:a.shaderDefine,u=`/${n?Wy:a.shaderVariantName}`,c=r?r.cacheKey:"",p=this._showOverdrawInspector?"/overdraw":"",h=o?"/terrain":"",f=i?`/${i.join("/")}`:"",d=e+c+u+p+h+f;return this.cache[d]||(this.cache[d]=new Dh(this.context,or[e],r,qT[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 Cf(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 ru=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=`${this._hashName}=${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=Cf(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+=`/${a}/${s}/${n}`:c+=`${n}/${s}/${a}`,(l||u)&&(c+=`/${Math.round(l*10)/10}`),u&&(c+=`/${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,`${g}=${c}`):d}).filter(d=>d);return h||f.push(`${p}=${c}`),`#${f.join("&")}`}return`#${c}`}_isValidHash(e){if(e.length<3||e.some(isNaN))return!1;try{new J(+e[2],+e[1])}catch{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 wS=se(fe(),1),ou={linearity:.3,easing:is(0,0,.3,1)},_B=Z({deceleration:2500,maxSpeed:1400},ou),vB=Z({deceleration:20,maxSpeed:1400},ou),PB=Z({deceleration:1e3,maxSpeed:360},ou),wB=Z({deceleration:1e3,maxSpeed:90},ou),TB=Z({deceleration:1e3,maxSpeed:360},ou),Mf=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 wS.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=iu(r.pan.mag(),i,Z({},_B,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,nu(o,a)}if(r.zoom){let a=iu(r.zoom,i,vB);o.zoom=this._map.transform.zoom+a.amount,nu(o,a)}if(r.bearing){let a=iu(r.bearing,i,PB);o.bearing=this._map.transform.bearing+ce(a.amount,-179,179),nu(o,a)}if(r.pitch){let a=iu(r.pitch,i,wB);o.pitch=this._map.transform.pitch+a.amount,nu(o,a)}if(r.roll){let a=iu(r.roll,i,TB);o.roll=this._map.transform.roll+ce(a.amount,-179,179),nu(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 nu(t,e){(!t.duration||t.duration<e.duration)&&(t.duration=e.duration,t.easing=e.easing)}function iu(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 TS=se(fe(),1);var Lt=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}},wi=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 TS.default(0,0)),l=r.unproject(s);super(e,{points:o,point:s,lngLats:a,lngLat:l,originalEvent:n}),this._defaultPrevented=!1}},au=class extends U{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,r,n){super(e,{originalEvent:n}),this._defaultPrevented=!1}};var If=class{constructor(e,r){this._map=e,this._clickTolerance=r.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new au(e.type,this._map,e))}mousedown(e,r){return this._mousedownPos=r,this._firePreventable(new Lt(e.type,this._map,e))}mouseup(e){this._map.fire(new Lt(e.type,this._map,e))}click(e,r){this._mousedownPos&&this._mousedownPos.dist(r)>=this._clickTolerance||this._map.fire(new Lt(e.type,this._map,e))}dblclick(e){return this._firePreventable(new Lt(e.type,this._map,e))}mouseover(e){this._map.fire(new Lt(e.type,this._map,e))}mouseout(e){this._map.fire(new Lt(e.type,this._map,e))}touchstart(e){return this._firePreventable(new wi(e.type,this._map,e))}touchmove(e){this._map.fire(new wi(e.type,this._map,e))}touchend(e){this._map.fire(new wi(e.type,this._map,e))}touchcancel(e){this._map.fire(new wi(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}},Af=class{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new Lt(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Lt("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new Lt(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}};m();m();var SS=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(SS.default.convert(e),this._map.terrain)}};var su=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(${o}px,${s}px)`),this._box.style.width=`${a-o}px`,this._box.style.height=`${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 CS=se(fe(),1);m();function lu(t,e){if(t.length!==e.length)throw new Error(`The number of touches and points are not equal - touches ${t.length}, points ${e.length}`);let r={};for(let n=0;n<t.length;n++)r[t[n].identifier]=e[n];return r}function SB(t){let e=new CS.default(0,0);for(let r of t)e._add(r);return e.div(t.length)}var xg=500,CB=500,Ef=30,gg=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=SB(r),this.touches=lu(n,r)))}touchmove(e,r,n){if(this.aborted||!this.centroid)return;let i=lu(n,r);for(let o in this.touches){let a=this.touches[o],s=i[o];(!s||s.dist(a)>Ef)&&(this.aborted=!0)}}touchend(e,r,n){if((!this.centroid||e.timeStamp-this.startTime>CB)&&(this.aborted=!0),n.length===0){let i=!this.aborted&&this.centroid;if(this.reset(),i)return i}}},_o=class{constructor(e){this.singleTap=new gg(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<xg,a=!this.lastTap||this.lastTap.dist(i)<Ef;if((!o||!a)&&this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=i,this.count===this.numTaps)return this.reset(),i}}};var Lf=class{constructor(e){this._tr=new Ur(e),this._zoomIn=new _o({numTouches:1,numTaps:2}),this._zoomOut=new _o({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 MS=se(fe(),1);m();var Ti=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 MB=0,IB=2,AB={[MB]:1,[IB]:2};function EB(t,e){let r=AB[e];return t.buttons===void 0||(t.buttons&r)!==r}var vo=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!EB(e,this._eventButton)}isValidEndEvent(e){return ie.mouseButton(e)===this._eventButton}};var bg=0,_g=2,Df=t=>{t.mousedown=t.dragStart,t.mousemoveWindow=t.dragMove,t.mouseup=t.dragEnd,t.contextmenu=e=>{e.preventDefault()}};function IS({enable:t,clickTolerance:e}){let r=new vo({checkCorrectEvent:n=>ie.mouseButton(n)===bg&&!n.ctrlKey});return new Ti({clickTolerance:e,move:(n,i)=>({around:i,panDelta:i.sub(n)}),activateOnStart:!0,moveStateManager:r,enable:t,assignEvents:Df})}function AS({enable:t,clickTolerance:e,aroundCenter:r=!0,minPixelCenterThreshold:n=100,rotateDegreesPerPixelMoved:i=.8},o){let a=new vo({checkCorrectEvent:s=>ie.mouseButton(s)===bg&&s.ctrlKey||ie.mouseButton(s)===_g&&!s.ctrlKey});return new Ti({clickTolerance:e,move:(s,l)=>{let u=o();if(r&&Math.abs(u.y-s.y)>n)return{bearingDelta:ed(new MS.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:Df})}function ES({enable:t,clickTolerance:e,pitchDegreesPerPixelMoved:r=-.5}){let n=new vo({checkCorrectEvent:i=>ie.mouseButton(i)===bg&&i.ctrlKey||ie.mouseButton(i)===_g});return new Ti({clickTolerance:e,move:(i,o)=>({pitchDelta:(o.y-i.y)*r}),moveStateManager:n,enable:t,assignEvents:Df})}function LS({enable:t,clickTolerance:e,rollDegreesPerPixelMoved:r=.3},n){let i=new vo({checkCorrectEvent:o=>ie.mouseButton(o)===_g&&o.ctrlKey});return new Ti({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:Df})}m();var Rf=se(fe(),1);var kf=class{constructor(e,r){this._clickTolerance=e.clickTolerance||1,this._map=r,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new Rf.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=lu(n,r),o=new Rf.default(0,0),a=new Rf.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 uu=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=Ff(n,r,i),s=Ff(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=Ff(n,r,i),s=Ff(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 Ff(t,e,r){for(let n=0;n<t.length;n++)if(t[n].identifier===r)return e[n]}var LB=.1;function DS(t,e){return Math.log(t/e)/Math.LN2}var cu=class extends uu{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(DS(this._distance,this._startDistance))<LB))return this._active=!0,{zoomDelta:DS(this._distance,n),pinchAround:r}}},DB=25;function RS(t,e){return t.angleWith(e)*180/Math.PI}var pu=class extends uu{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:RS(this._vector,i),pinchAround:r}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());let r=Math.PI*this._minDiameter,n=DB/r*360,i=RS(e,this._startVector);return Math.abs(i)<n}};function vg(t){return Math.abs(t.y)>Math.abs(t.x)}var RB=100,hu=class extends uu{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,vg(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<RB?void 0:!1;let l=r.y>0==n.y>0;return vg(r)&&vg(n)&&l}};m();var kB={panStep:100,bearingStep:15,pitchStep:10},fu=class{constructor(e){this._tr=new Ur(e);let r=kB;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:FB,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 FB(t){return t*(2-t)}m();var kS=4.000244140625,OB=1/100,BB=1/450,zB=2,VB=5,mu=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=OB,this._wheelZoomRate=BB}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%kS===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)>kS?this._wheelZoomRate:this._defaultZoomRate,l=zB/(1+Math.exp(-Math.abs(this._delta*s)));this._delta<0&&l!==0&&(l=1/l);let u=typeof this._targetZoom!="number"?e.scale:lt(this._targetZoom);this._targetZoom=e.getConstrained(e.getCameraLngLat(),rt(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+VB)/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=os;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=is(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 du=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 Of=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 Bf=class{constructor(){this._tap=new _o({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<xg,a=this._tapPoint.dist(i)<Ef;!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 yu=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 gu=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 xu=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 bu=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 FS=se(fe(),1),zf=t=>t.zoom||t.drag||t.roll||t.pitch||t.rotate,wg=class extends U{};function Pg(t){return t.panDelta&&t.panDelta.mag()||t.zoomDelta||t.bearingDelta||t.pitchDelta||t.rollDelta}var Vf=class{constructor(e,r){this.handleWindowEvent=e=>{this.handleEvent(e,`${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(Wb(e,r||e.type)){let f=ie.mousePos(this._map.getCanvas(),e);h=c[r||e.type](e,f)}else if(Yb(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 $b(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||Pg(i))&&(this._changes.push([i,o,s]),this._triggerRenderFrame()),(Object.keys(a).length||Pg(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 Mf(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 If(r,e));let i=r.boxZoom=new su(r,e);this._add("boxZoom",i),e.interactive&&e.boxZoom&&i.enable();let o=r.cooperativeGestures=new bu(r,e.cooperativeGestures);this._add("cooperativeGestures",o),e.cooperativeGestures&&o.enable();let a=new Lf(r),s=new Of(r);r.doubleClickZoom=new du(s,a),this._add("tapZoom",a),this._add("clickZoom",s),e.interactive&&e.doubleClickZoom&&r.doubleClickZoom.enable();let l=new Bf;this._add("tapDragZoom",l);let u=r.touchPitch=new hu(r);this._add("touchPitch",u),e.interactive&&e.touchPitch&&r.touchPitch.enable(e.touchPitch);let c=()=>r.project(r.getCenter()),p=AS(e,c),h=ES(e),f=LS(e,c);r.dragRotate=new gu(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=IS(e),g=new kf(e,r);r.dragPan=new yu(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 pu,b=new cu;r.touchZoomRotate=new xu(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 mu(r,()=>this._triggerRenderFrame());this._add("scrollZoom",v,["mousePan"]),e.interactive&&e.scrollZoom&&r.scrollZoom.enable(e.scrollZoom);let P=r.keyboard=new fu(r);this._add("keyboard",P),e.interactive&&e.keyboard&&r.keyboard.enable(),this._add("blockableMapEvent",new Af(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!!zf(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 FS.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(!Pg(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=zf(this._eventsInProgress),o=zf(e),a={};for(let p in e){let{originalEvent:h}=e[p];this._eventsInProgress[p]||(a[`${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[`${p}end`]=l)}for(let p in s)this._fireEvent(p,s[p]);let u=zf(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 wg("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}};m();var Ra=se(fe(),1);var Uf=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=Ra.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=mt.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 mt(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(Ra.default.convert(r)),this.transform.screenPointToLocation(Ra.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=rt(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:os},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=Ra.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 I=nn(r,["center","zoom","bearing","pitch","roll","elevation"]);return this.jumpTo(I,n)}this.stop(),r=Z({offset:[0,0],speed:1.2,curve:1.42,easing:os},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=Ra.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 I=v/x.scaleOfMinZoom;b=Math.sqrt(I/w*2)}let T=b*b;function S(I){let R=(P*P-v*v+(I?-1:1)*T*T*w*w)/(2*(I?P:v)*T*w);return Math.log(Math.sqrt(R*R+1)-R)}function C(I){return(Math.exp(I)-Math.exp(-I))/2}function A(I){return(Math.exp(I)+Math.exp(-I))/2}function E(I){return C(I)/A(I)}let L=S(!1),F=function(I){return A(L)/A(L+b*I)},O=function(I){return v*((A(L)*E(L+b*I)-C(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 I=P<v?-1:1;z=Math.abs(Math.log(P/v))/b,O=()=>0,F=R=>Math.exp(I*b*R)}if("duration"in r)r.duration=+r.duration;else{let I="screenSpeed"in r?+r.screenSpeed/b:+r.speed;r.duration=1e3*z/I}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(I=>{let R=I*z,H=1/F(R),W=O(R);this._rotating&&i.setBearing(Fe.number(o,u,I)),this._pitching&&i.setPitch(Fe.number(a,c,I)),this._rolling&&i.setRoll(Fe.number(s,p,I)),this._padding&&(i.interpolatePadding(l,h,I),d=i.centerPoint.add(f)),x.easeFunc(I,H,W,d),this.terrain&&!r.freezeElevation&&this._updateElevation(I),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){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let i=this._onEaseEnd;delete this._onEaseEnd,i.call(this,n)}return r||this.handlers?.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 Bn=se(fe(),1);m();var Tg={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'},_u=class{constructor(e=Tg){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.${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 vu=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 Nf=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 jf=(n=>(n.create="create",n.load="load",n.fullLoad="fullLoad",n))(jf||{}),Gf=null,Pu=[],UB=60,Sg=1e3/UB,Cg="loadTime",Mg="fullLoadTime",ka={mark(t){performance.mark(t)},frame(t){let e=t;if(Gf!=null){let r=e-Gf;Pu.push(r)}Gf=e},clearMetrics(){Gf=null,Pu=[],performance.clearMeasures(Cg),performance.clearMeasures(Mg);for(let t in jf)performance.clearMarks(jf[t])},getPerformanceMetrics(){performance.measure(Cg,"create","load"),performance.measure(Mg,"create","fullLoad");let t=performance.getEntriesByName(Cg)[0].duration,e=performance.getEntriesByName(Mg)[0].duration,r=Pu.length,i=1/(Pu.reduce((s,l)=>s+l,0)/r/1e3),o=Pu.filter(s=>s>Sg).reduce((s,l)=>s+(l-Sg)/Sg,0),a=o/(r+o)*100;return{loadTime:t,fullLoadTime:e,fps:i,percentDroppedFrames:a,totalFrames:r}}};m();m();var OS=ze([{name:"a_pos3d",type:"Int16",components:3}]);m();var Hf=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 bi(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 _a(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=Hr();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=Hr();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 Xf=class{constructor(e,r,n){this._meshCache={};this.painter=e,this.sourceCache=new Hf(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){if(!(r>=0&&r<i&&n>=0&&n<i))return 0;let o=this.getTerrainData(e),a=o.tile?.dem;if(!a)return 0;let s=wt.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(!F1(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){let r=this.painter.style.projection?.transitionState>0,n=r&&e.canonical.y===0,i=r&&e.canonical.y===(1<<e.canonical.z)-1,o=`m_${n?"n":""}_${i?"s":""}`;if(this._meshCache[o])return this._meshCache[o];let a=this.painter.context,s=new Qc,l=new Qe,u=this.meshSize,c=8192/u,p=u*u;for(let C=0;C<=u;C++)for(let A=0;A<=u;A++)s.emplaceBack(A*c,C*c,0);for(let C=0;C<p;C+=u+1)for(let A=0;A<u;A++)l.emplaceBack(A+C,u+A+C+1,u+A+C+2),l.emplaceBack(A+C,u+A+C+2,A+C+1);let h=s.length,f=0,d=h+(u+1),g=(u+1)*u,x=n?fn:0,b=n?0:1,v=i?En:8192,P=i?0:1;for(let C=0;C<=u;C++)s.emplaceBack(C*c,x,b);for(let C=0;C<=u;C++)s.emplaceBack(C*c,v,P);for(let C=0;C<u;C++)l.emplaceBack(g+C,d+C,d+C+1),l.emplaceBack(g+C,d+C+1,g+C+1),l.emplaceBack(f+C,h+C+1,h+C),l.emplaceBack(f+C,f+C+1,h+C+1);let w=s.length,T=w+(u+1)*2;for(let C of[0,1])for(let A=0;A<=u;A++)for(let E of[0,1])s.emplaceBack(C*8192,A*c,E);for(let C=0;C<u*2;C+=2)l.emplaceBack(w+C,w+C+1,w+C+3),l.emplaceBack(w+C,w+C+3,w+C+2),l.emplaceBack(T+C,T+C+3,T+C+1),l.emplaceBack(T+C,T+C+2,T+C+3);let S=new ar(a.createVertexBuffer(s,OS.members),a.createIndexBuffer(l),de.simpleSegment(0,0,s.length,l.length));return this._meshCache[o]=S,S}getMeshFrameDelta(e){return 2*Math.PI*nr/Math.pow(2,Math.max(e,0))/5}getMinTileElevationForLngLatZoom(e,r){let{tileID:n}=this._getOverscaledTileIDFromLngLatZoom(e,r);return this.getMinMaxElevation(n).minElevation??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 Ye(r,0,r,s,l),mercatorX:o,mercatorY:a}}};m();m();var Zf=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 Fa={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0},qf=class{constructor(e,r){this.painter=e,this.terrain=r,this.pool=new Zf(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 _r?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(Fa[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={...r,isRenderingToTexture:!0},i=e.type,o=this.painter,a=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(Fa[i]&&((!this._prevType||!Fa[this._prevType])&&this._stacks.push([]),this._prevType=i,this._stacks[this._stacks.length-1].push(e.id),!a))return!0;if(Fa[this._prevType]||Fa[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()&&(yg(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 yg(this.painter,this.terrain,this._rttTiles,n),this._rttTiles=[],this.pool.freeAllObjects(),Fa[i]}return!1}};m();var BS={"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 NB=Yu.version,Wf=-2,VS=22,Si=0,US=60,Yf=180,zS={hash:!1,interactive:!0,bearingSnap:7,attributionControl:Tg,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 0},scrollZoom:!0,minZoom:Wf,maxZoom:VS,minPitch:Si,maxPitch:US,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:$t.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},Ig=class extends Uf{constructor(r){ka.mark("create");let n={...zS,...r,canvasContextAttributes:{...zS.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<Si)throw new Error(`minPitch must be greater than or equal to ${Si}`);if(n.maxPitch!=null&&n.maxPitch>Yf)throw new Error(`maxPitch must be less than or equal to ${Yf}`);let i=new Fn,o=new On;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 Nf;this._controls=[];this._mapId=oc();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={...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={...BS,...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=Gt.addThrottleControl(()=>this.isMoving()),this._requestManager=new hc(n.transformRequest),typeof n.container=="string"){if(this._container=document.getElementById(n.container),!this._container)throw new Error(`Container '${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 l=!1,u=Cf(c=>{this._trackResize&&!this._removed&&(this.resize(c),this.redraw())},50);this._resizeObserver=new ResizeObserver(c=>{if(!l){l=!0;return}u(c)}),this._resizeObserver.observe(this._container)}this.handlers=new Vf(this,n);let a=typeof n.hash=="string"&&n.hash||void 0;this._hash=n.hash&&new ru(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"||n.style?.projection?.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 _u(typeof n.attributionControl=="boolean"?void 0:n.attributionControl)),n.maplibreLogo&&this.addControl(new vu,n.logoPosition),this.on("style.load",()=>{if(s||this._resizeTransform(),this.transform.unmodified){let l=nn(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(l)}}),this.on("data",l=>{this._update(l.dataType==="style"),this.fire(new U(`${l.dataType}data`,l))}),this.on("dataloading",l=>{this.fire(new U(`${l.dataType}dataloading`,l))}),this.on("dataabort",l=>{this.fire(new U("sourcedataabort",l))})}_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){let[n,i]=this._containerDimensions();this.transform.resize(n,i,r),this._requestedCameraState?.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(){return this._overridePixelRatio??devicePixelRatio}setPixelRatio(r){this._overridePixelRatio=r,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(r){return this.transform.setMaxBounds(mt.convert(r)),this._update()}setMinZoom(r){if(r=r??Wf,r>=Wf&&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 ${Wf} and the current maxZoom, inclusive`)}getMinZoom(){return this.transform.minZoom}setMaxZoom(r){if(r=r??VS,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??Si,r<Si)throw new Error(`minPitch must be greater than or equal to ${Si}`);if(r>=Si&&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 ${Si} and the current maxPitch, inclusive`)}getMinPitch(){return this.transform.minPitch}setMaxPitch(r){if(r=r??US,r>Yf)throw new Error(`maxPitch must be less than or equal to ${Yf}`);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(Bn.default.convert(r),this.terrain)}isMoving(){return this._moving||this.handlers?.isMoving()}isZooming(){return this._zooming||this.handlers?.isZooming()}isRotating(){return this._rotating||this.handlers?.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 Lt(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 Lt(r,this,l.originalEvent)))},mouseout:l=>{o&&(o=!1,i.call(this,new Lt(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 Bn.default||Array.isArray(r),a=o?r:[[0,0],[this.transform.width,this.transform.height]];if(n=n||(o?{}:r)||{},a instanceof Bn.default||typeof a[0]=="number")i=[Bn.default.convert(a)];else{let s=Bn.default.convert(a[0]),l=Bn.default.convert(a[1]);i=[s,new Bn.default(l.x,s.y),l,new Bn.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 '${r}'`);return n}_updateStyle(r,n){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 Da(this,n||{});else return this.style?.projection?.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 Da(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");Kn(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: ${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 '${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.transform.setMinElevationForCurrentTile(0),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: ${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 Xf(this.painter,n,r),this.painter.renderToTexture=new qf(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=>{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))),i.source?.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(){return this.terrain?.options??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 "${i}", cannot set LOD parameters`);o.calculateTileZoom=sh(Math.max(1,r),Math.max(1,n))}else for(let o in this.style.sourceCaches)this.style.sourceCaches[o].getSource().calculateTileZoom=sh(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 "${r}", cannot refresh tile`);n===void 0?i.reload(!0):i.refreshTiles(n.map(o=>new di(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||Wt(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||Wt(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||Wt(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 Gt.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-${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=`${r}px`,this._canvas.style.height=`${n}px`}_setupPainter(){let r={...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 Sf(i,this.transform),cs.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){let n=this._idleTriggered?this._fadeDuration:0,i=this.style.projection?.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 l=this.transform.zoom,u=ae.now();this.style.zoomHistory.update(l,u);let c=new Te(l,{now:u,fadeDuration:n,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition(),globalState:this.style.getGlobalState()}),p=c.crossFadingFactor();(p!==1||p!==this._crossFadingFactor)&&(o=!0,this._crossFadingFactor=p),this.style.update(c)}let a=this.style.projection?.transitionState>0!==i;this.style.projection?.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState(this.style.projection?.transitionState,this.style.projection?.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||a)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),!this._elevationFreeze&&this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0)),this._placementDirty=this.style&&this.style._updatePlacement(this.transform,this.showCollisionBoxes,n,this._crossSourceCollisions,a),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:n,showPadding:this.showPadding}),this.fire(new U("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,ka.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,ka.mark("fullLoad")),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){this._hash&&this._hash.remove();for(let n of this._controls)n.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),Gt.removeThrottleControl(this._imageQueueHandle),this._resizeObserver?.disconnect();let r=this.painter.context.gl.getExtension("WEBGL_lose_context");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"),ka.clearMetrics(),this._removed=!0,this.fire(new U("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,ae.frame(this._frameRequest,r=>{ka.frame(r),this._frameRequest=null;try{this._render(r)}catch(n){if(!Jb(n)&&!WT(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 NB}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(r){return this._lazyInitEmptyStyle(),this.style.setProjection(r),this._update(!0)}};m();var GB=se(fe(),1);m();m();m();var ZB=se(fe(),1);m();m();m();m();m();m();m();var YB=se(fe(),1);var Yxe=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");var WB=se(fe(),1);var t_e=Yu.version;function r_e(t){$t.WORKER_URL=t}m();m();m();m();m();m();m();var Ht=63710088e-1,GS={centimeters:Ht*100,centimetres:Ht*100,degrees:Ht/111325,feet:Ht*3.28084,inches:Ht*39.37,kilometers:Ht/1e3,kilometres:Ht/1e3,meters:Ht,metres:Ht,miles:Ht/1609.344,millimeters:Ht*1e3,millimetres:Ht*1e3,nauticalmiles:Ht/1852,radians:1,yards:Ht*1.0936},o_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/Ht,yards:1.0936133};function Ci(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 $B(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(!NS(t[0])||!NS(t[1]))throw new Error("coordinates must contain numbers");var n={type:"Point",coordinates:t};return Ci(n,e,r)}function a_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 Ci(s,e,r)}function jS(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 Ci(n,e,r)}function s_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 l_e(t,e,r){r===void 0&&(r={});var n={type:"MultiLineString",coordinates:t};return Ci(n,e,r)}function u_e(t,e,r){r===void 0&&(r={});var n={type:"MultiPolygon",coordinates:t};return Ci(n,e,r)}function c_e(t,e){e===void 0&&(e="kilometers");var r=GS[e];if(!r)throw new Error(e+" units is invalid");return t*r}function p_e(t,e){e===void 0&&(e="kilometers");var r=GS[e];if(!r)throw new Error(e+" units is invalid");return t/r}function h_e(t){var e=t%(2*Math.PI);return e*180/Math.PI}function f_e(t){var e=t%360;return e*Math.PI/180}function NS(t){return!isNaN(t)&&t!==null&&!Array.isArray(t)}function $f(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($f(a.geometries[n],e,r)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function x_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 KB(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 JB(t,e){KB(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(Ci(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(Ci(p,i),n,u)===!1)return!1}})}function QB(t,e){JB(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($f(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=jS([s,p],r.properties);if(e(x,n,i,g,o)===!1)return!1;o++,s=p})===!1)return!1}}})}function b_e(t,e,r){var n=r,i=!1;return QB(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 Ag(t){var e=[1/0,1/0,-1/0,-1/0];return $f(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}Ag.default=Ag;var HS=Ag;function XS(t){return HS(t)}m();m();m();m();m();var Oa=class{constructor(){M(this,"hover",!1);M(this,"dirty",!1)}};m();m();import{z as Eg}from"zod";var ZS=Eg.union([Eg.enum(["low","medium","high","always-visible"]),Eg.number()]),qS=["","","low","medium","high","always-visible"],ez=2,tz=3;var rz=5;function YS(t){return Math.min(rz,Math.max(ez,t))}function Ba(t){if(typeof t=="number")return YS(t);let e=qS.indexOf(t);return e===-1?tz:e}function D_e(t){let e=YS(t);return qS[e]}m();m();import{z as Re}from"zod";m();import zn from"zod";var nz=zn.enum(Fx),iz=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},oz=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},az=t=>iz(t)||oz(t),WS=zn.object({on:zn.literal("zoom-level"),input:zn.tuple([zn.number()]).rest(zn.number()).refine(az,{message:"input array must be strictly increasing or decreasing"}),output:zn.tuple([zn.number()]).rest(zn.number()),easing:nz.default("linear")}).refine(t=>t.input.length===t.output.length,{message:"input and output must have the same length"});m();function Kf(t){"@babel/helpers - typeof";return Kf=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},Kf(t)}var sz=/^\s+/,lz=/\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=uz(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=rC(e),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var e=KS(this._r,this._g,this._b);return{h:e.h*360,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=KS(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=$S(this._r,this._g,this._b);return{h:e.h*360,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=$S(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 JS(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return fz(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(ot(this._r,255)*100)+"%",g:Math.round(ot(this._g,255)*100)+"%",b:Math.round(ot(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(ot(this._r,255)*100)+"%, "+Math.round(ot(this._g,255)*100)+"%, "+Math.round(ot(this._b,255)*100)+"%)":"rgba("+Math.round(ot(this._r,255)*100)+"%, "+Math.round(ot(this._g,255)*100)+"%, "+Math.round(ot(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:Sz[JS(this._r,this._g,this._b,!0)]||!1},toFilter:function(e){var r="#"+QS(this._r,this._g,this._b,this._a),n=r,i=this._gradientType?"GradientType = 1, ":"";if(e){var o=oe(e);n="#"+QS(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(gz,arguments)},brighten:function(){return this._applyModification(xz,arguments)},darken:function(){return this._applyModification(bz,arguments)},desaturate:function(){return this._applyModification(mz,arguments)},saturate:function(){return this._applyModification(dz,arguments)},greyscale:function(){return this._applyModification(yz,arguments)},spin:function(){return this._applyModification(_z,arguments)},_applyCombination:function(e,r){return e.apply(null,[this].concat([].slice.call(r)))},analogous:function(){return this._applyCombination(wz,arguments)},complement:function(){return this._applyCombination(vz,arguments)},monochromatic:function(){return this._applyCombination(Tz,arguments)},splitcomplement:function(){return this._applyCombination(Pz,arguments)},triad:function(){return this._applyCombination(eC,[3])},tetrad:function(){return this._applyCombination(eC,[4])}};oe.fromRatio=function(t,e){if(Kf(t)=="object"){var r={};for(var n in t)t.hasOwnProperty(n)&&(n==="a"?r[n]=t[n]:r[n]=wu(t[n]));t=r}return oe(t,e)};function uz(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=Az(t)),Kf(t)=="object"&&(Vn(t.r)&&Vn(t.g)&&Vn(t.b)?(e=cz(t.r,t.g,t.b),a=!0,s=String(t.r).substr(-1)==="%"?"prgb":"rgb"):Vn(t.h)&&Vn(t.s)&&Vn(t.v)?(n=wu(t.s),i=wu(t.v),e=hz(t.h,n,i),a=!0,s="hsv"):Vn(t.h)&&Vn(t.s)&&Vn(t.l)&&(n=wu(t.s),o=wu(t.l),e=pz(t.h,n,o),a=!0,s="hsl"),t.hasOwnProperty("a")&&(r=t.a)),r=rC(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 cz(t,e,r){return{r:ot(t,255)*255,g:ot(e,255)*255,b:ot(r,255)*255}}function $S(t,e,r){t=ot(t,255),e=ot(e,255),r=ot(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 pz(t,e,r){var n,i,o;t=ot(t,360),e=ot(e,100),r=ot(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 KS(t,e,r){t=ot(t,255),e=ot(e,255),r=ot(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 hz(t,e,r){t=ot(t,360)*6,e=ot(e,100),r=ot(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 JS(t,e,r,n){var i=[tn(Math.round(t).toString(16)),tn(Math.round(e).toString(16)),tn(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 fz(t,e,r,n,i){var o=[tn(Math.round(t).toString(16)),tn(Math.round(e).toString(16)),tn(Math.round(r).toString(16)),tn(nC(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 QS(t,e,r,n){var i=[tn(nC(n)),tn(Math.round(t).toString(16)),tn(Math.round(e).toString(16)),tn(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 mz(t,e){e=e===0?0:e||10;var r=oe(t).toHsl();return r.s-=e/100,r.s=Jf(r.s),oe(r)}function dz(t,e){e=e===0?0:e||10;var r=oe(t).toHsl();return r.s+=e/100,r.s=Jf(r.s),oe(r)}function yz(t){return oe(t).desaturate(100)}function gz(t,e){e=e===0?0:e||10;var r=oe(t).toHsl();return r.l+=e/100,r.l=Jf(r.l),oe(r)}function xz(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 bz(t,e){e=e===0?0:e||10;var r=oe(t).toHsl();return r.l-=e/100,r.l=Jf(r.l),oe(r)}function _z(t,e){var r=oe(t).toHsl(),n=(r.h+e)%360;return r.h=n<0?360+n:n,oe(r)}function vz(t){var e=oe(t).toHsl();return e.h=(e.h+180)%360,oe(e)}function eC(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 Pz(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 wz(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 Tz(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=Ez(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 Lg=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"},Sz=oe.hexNames=Cz(Lg);function Cz(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}function rC(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function ot(t,e){Mz(t)&&(t="100%");var r=Iz(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 Jf(t){return Math.min(1,Math.max(0,t))}function Tr(t){return parseInt(t,16)}function Mz(t){return typeof t=="string"&&t.indexOf(".")!=-1&&parseFloat(t)===1}function Iz(t){return typeof t=="string"&&t.indexOf("%")!=-1}function tn(t){return t.length==1?"0"+t:""+t}function wu(t){return t<=1&&(t=t*100+"%"),t}function nC(t){return Math.round(parseFloat(t)*255).toString(16)}function tC(t){return Tr(t)/255}var en=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 Vn(t){return!!en.CSS_UNIT.exec(t)}function Az(t){t=t.replace(sz,"").replace(lz,"").toLowerCase();var e=!1;if(Lg[t])t=Lg[t],e=!0;else if(t=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=en.rgb.exec(t))?{r:r[1],g:r[2],b:r[3]}:(r=en.rgba.exec(t))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=en.hsl.exec(t))?{h:r[1],s:r[2],l:r[3]}:(r=en.hsla.exec(t))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=en.hsv.exec(t))?{h:r[1],s:r[2],v:r[3]}:(r=en.hsva.exec(t))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=en.hex8.exec(t))?{r:Tr(r[1]),g:Tr(r[2]),b:Tr(r[3]),a:tC(r[4]),format:e?"name":"hex8"}:(r=en.hex6.exec(t))?{r:Tr(r[1]),g:Tr(r[2]),b:Tr(r[3]),format:e?"name":"hex"}:(r=en.hex4.exec(t))?{r:Tr(r[1]+""+r[1]),g:Tr(r[2]+""+r[2]),b:Tr(r[3]+""+r[3]),a:tC(r[4]+""+r[4]),format:e?"name":"hex8"}:(r=en.hex3.exec(t))?{r:Tr(r[1]+""+r[1]),g:Tr(r[2]+""+r[2]),b:Tr(r[3]+""+r[3]),format:e?"name":"hex"}:!1}function Ez(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 bt={RIGHT:"right",LEFT:"left",TOP:"top",HIDDEN:"hidden",CENTER:"center"},Po="low-priority",iC=Object.values(bt),Dg=[bt.RIGHT,bt.LEFT,bt.TOP,bt.HIDDEN],oC=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(),WS]).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)}),aC=oC.transform(t=>({...t,textColor:t.textColor??t.color,textOutlineColor:t.textOutlineColor??t.outlineColor,pinColor:t.pinColor??t.color,pinOutlineColor:t.pinOutlineColor??t.outlineColor,pinColorInactive:t.pinColorInactive??oe(t.pinColor??t.color).toRgbString(),pinOutlineColorInactive:t.pinOutlineColorInactive??oe(t.pinOutlineColor??t.outlineColor).toRgbString()})),q_e=Re.strictObject(oC.shape),sC=t=>aC.parse(t),Lz=Re.object({rank:ZS.optional(),appearance:aC.optional(),interactive:Re.boolean().default(!1),textPlacement:Re.union([Re.enum(iC),Re.array(Re.enum(iC))]).default(Dg)}),Rg=t=>{Lz.parse(t??{})},Y_e=(t,e,r)=>{Re.array(Re.number()).min(2).max(3).parse(t),Re.string().parse(e),Rg(r)},lC=["color","outlineColor","margin"],Dz=[...lC,"maxLines","lineHeight","textSize","maxWidth","textColor","textOutlineColor","opacity"],Rz=[...lC,"icon","pinColor","pinOutlineColor","pinColorInactive","pinOutlineColorInactive"],uC=(t,e)=>Dz.some(r=>e[r]!=null&&t[r]!==e[r]),cC=(t,e)=>Rz.some(r=>e[r]!=null&&t[r]!==e[r]);var pC=4,Fz=6,fC=6.5,Qf=fC/2,hC=[Qf,Qf,Qf,Qf],za=class za{constructor(e,r,n){M(this,"lines",0);M(this,"id");M(this,"rank");M(this,"type","label");M(this,"initialRank");M(this,"contextConfigured",!1);M(this,"fillText");M(this,"newStyle",{});M(this,"currentOpacity",0);M(this,"visibilityNeedsUpdate",!1);M(this,"activePlacement",bt.RIGHT);M(this,"text");M(this,"style",{top:0,left:0,textLabelVisible:!0,pinVisibility:1,textAlign:"left"});M(this,"projection",new _n);M(this,"labelCacheId");M(this,"_cache",{});M(this,"appearance");M(this,"options");M(this,"visible",!0);M(this,"enabled",!0);M(this,"isOccluded",!1);M(this,"offscreen",!1);M(this,"canShow",!1);M(this,"activeBoundingBox",{x:0,y:0,w:0,h:0});M(this,"dimensions",{width:0,height:0});M(this,"currentStrategyIndex",-1);M(this,"totalPinSize",0);M(this,"iconScale",1);M(this,"iconPadding");M(this,"dirty",!0);M(this,"textDirty",!0);M(this,"pinDirty",!0);M(this,"attachedDirty",!0);M(this,"collisionDirty",!0);M(this,"lastTextAlign");M(this,"imageHash");M(this,"pinSize",0);M(this,"iconVisible",!1);M(this,"dp");M(this,"animate",!0);M(this,"onStrategySelected",e=>{if(this.currentStrategyIndex===e)return;this.currentStrategyIndex=e;let r=this.strategies[e];if(this.activePlacement=r?.name??this.activePlacement,r){r.onStrategySelected();let n=this.style;this.style=this.newStyle,this.newStyle=n}});M(this,"packedMessage",{x:0,y:0,enabled:!1,rank:0,bboxes:[],shouldCollideWithScreenEdges:!1,lockedToStrategyIndex:-1});if(this.id=r.id??Vt(),this.options=r??{},this.text=e,this.dp=(o=1)=>o*n.pixelRatio,typeof r.rank=="string")this.rank=Ba(r.rank),this.initialRank=this.rank;else if(r.rank!=null&&r.rank>0)this.rank=r.rank,this.initialRank=r.rank;else{let o=Math.trunc(_.env.NODE_ENV==="test"?za.testId:za.testId*10)/10;za.testId+=.001,this.rank=o,this.initialRank=o}this.options.textPlacement=r.textPlacement??Dg;let i=sC(r.appearance??{});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(fC),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):hC}getBoundingBoxForPlacement(e){let{width:r,height:n}=this.dimensions,{margin:i}=this.appearance,o=Math.max(Fz,i);if(this.text==="")return this.getNoTextBbox(o);let a=Math.max(this.scaledPinSize,n);switch(e){case bt.RIGHT:return[a/2+o,a/2+o,this.scaledPinSize/2+o,this.scaledPinSize/2+r+o];case bt.LEFT:return[a/2+o,a/2+o,this.scaledPinSize/2+r+o,this.scaledPinSize/2+o];case bt.TOP:{let s=this.dp();return[n+this.scaledPinSize/2/s+o,this.scaledPinSize/2+o,r/2+o,r/2+o]}case bt.CENTER:return[n/2+o,n/2+o,r/2+o,r/2+o];case bt.HIDDEN:return this.getHiddenTextPlacementBbox(o);case Po:return hC;default:return this.getNoTextBbox(o)}}getStrategyStyleForPlacement(e){let{width:r,height:n}=this.dimensions;switch(e){case bt.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 bt.LEFT:this.newStyle.textAlign="right",this.newStyle.pinVisibility=1,this.newStyle.top=-n/2,this.newStyle.left=-r-this.scaledPinSize/2-pC,this.newStyle.textLabelVisible=!0;return;case bt.RIGHT:this.newStyle.textAlign="left",this.newStyle.pinVisibility=1,this.newStyle.top=-n/2,this.newStyle.left=this.scaledPinSize/2+pC,this.newStyle.textLabelVisible=!0;return;case bt.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 bt.HIDDEN:this.newStyle.pinVisibility=this.iconVisible?1:.5,this.newStyle.textLabelVisible=!1,this.newStyle.top=0,this.newStyle.left=0;return;case Po: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===bt.HIDDEN&&e.length>1||(r.push({name:i,getBoundingBox:()=>this.getBoundingBoxForPlacement(i),onStrategySelected:()=>this.getStrategyStyleForPlacement(i)}),i===bt.HIDDEN&&(n=!0));return n&&r.push({name:Po,getBoundingBox:()=>this.getBoundingBoxForPlacement(Po),onStrategySelected:()=>this.getStrategyStyleForPlacement(Po)}),r}recomputeCurrentStrategy(e=this.iconScale){if(this.iconScale!==e||this.dirty){let r=this.strategies[this.currentStrategyIndex];if(this.iconScale=e,this.collisionDirty=!0,r){r.onStrategySelected();let n=this.style;this.style=this.newStyle,this.newStyle=n}this.dirty=!1}}toPackedMessage(e=!1){this.visible&&e&&this.collisionDirty===!1&&this.currentStrategyIndex!=null&&this.currentStrategyIndex!==-1?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;let r=this.strategies[this.currentStrategyIndex],n=this.text===""||r?.name===bt.HIDDEN||r?.name===Po;if(!n&&this.currentStrategyIndex!==-1&&this.currentStrategyIndex!==this.packedMessage.bboxes[0]?.[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];!n&&i===this.currentStrategyIndex&&this.currentStrategyIndex!==-1?this.packedMessage.bboxes.unshift([...o.getBoundingBox(),i]):this.packedMessage.bboxes.push([...o.getBoundingBox(),i])}return this.packedMessage.shouldCollideWithScreenEdges=!1,this.collisionDirty=!1,this.packedMessage}destroy(){}};M(za,"testId",0);var kg=za,mC=kg;m();var YC=se(jC());import{z as _t}from"zod";m();var HC="0.6",We={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"},Xg=Object.values(We),XC=[We.CENTER,We.HIDDEN],ZC=Object.freeze({size:8,color:"#666"});var Zg=_t.object({rank:_t.union([_t.enum(["low","medium","high","always-visible"]),_t.number()]).optional(),interactive:_t.union([_t.boolean(),_t.literal("pointer-events-auto")]).optional(),id:_t.string().optional(),placement:_t.union([_t.enum(Xg),_t.array(_t.enum(Xg))]).optional(),dynamicResize:_t.boolean().optional(),zIndex:_t.number().optional(),lowPriorityPin:_t.object({size:_t.number().positive().optional(),color:_t.string().optional()}).optional()});function xve(t,e,r){_t.array(_t.number()).min(2).max(3).parse(t),_t.string().parse(e),Zg.parse(r)}var Ga=class Ga{constructor(e,r={}){M(this,"id");M(this,"type","marker");M(this,"rank",0);M(this,"initialRank",0);M(this,"activePlacement","center");M(this,"pointerEvents","none");M(this,"options",{rank:"low",interactive:!1,id:"",placement:XC,dynamicResize:!1,occluderId:0,zIndex:void 0,verticalOffset:0,lowPriorityPin:{...ZC}});M(this,"projection",new _n);M(this,"enabled",!0);M(this,"canShow",!1);M(this,"visible",!0);M(this,"isOccluded",!1);M(this,"offscreen",!1);M(this,"strategyIndex",-1);M(this,"activeBoundingBox",{x:0,y:0,w:0,h:0});M(this,"dimensions",{width:0,height:0});M(this,"markerContainer");M(this,"containerEl");M(this,"contentEl",null);M(this,"contentHtml","");M(this,"style",{top:"0px",left:"0px"});M(this,"dirty",!1);M(this,"attachedDirty",!0);M(this,"collisionDirty",!0);M(this,"visibilityNeedsUpdate","show");M(this,"animation",null);M(this,"currentStrategyIndex",-1);M(this,"onStrategySelected",(e,r=!1)=>{if(this.currentStrategyIndex===e&&!r)return;this.currentStrategyIndex=e;let n=this.strategies[e];if(this.activePlacement=n?.name??"center",this.activePlacement===We.HIDDEN){this.markerContainer.setAttribute("data-placement",We.HIDDEN);let i=this.options.lowPriorityPin,o=i.size,a=i.color;this.markerContainer.style.setProperty("--mappedin-pin-size",`${o}px`),this.markerContainer.style.setProperty("--pin-color",a),this.markerContainer.style.opacity=HC,this.style.top=-o/2+"px",this.style.left=-o/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:i,height:o}=this.dimensions,a=-o/2+"px",s=-i/2+"px";switch(this.style.top=a,this.style.left=s,this.activePlacement){case We.TOP:{this.style.top=-o+"px";break}case We.BOTTOM:{this.style.top="0px";break}case We.LEFT:{this.style.left=-i+"px";break}case We.RIGHT:{this.style.left="0px";break}case We.TOP_LEFT:{this.style.top=-o+"px",this.style.left=-i+"px";break}case We.TOP_RIGHT:{this.style.top=-o+"px",this.style.left="0px";break}case We.BOTTOM_LEFT:{this.style.top="0px",this.style.left=-i+"px";break}case We.BOTTOM_RIGHT:{this.style.top="0px",this.style.left="0px";break}case We.CENTER:default:this.style.top=a,this.style.left=s}}this.markerContainer.style.top=this.style.top,this.markerContainer.style.left=this.style.left});M(this,"packedMessage",{x:0,y:0,enabled:!1,rank:0,bboxes:[],lockedToStrategyIndex:-1,shouldCollideWithScreenEdges:!1});if(this.id=r?.id||Vt(),this.options=(0,YC.default)(this.options,r),this.options.placement=r.placement??this.options.placement,typeof r.rank=="string")this.rank=Ba(r.rank);else if(r.rank!=null&&r.rank>0)this.rank=r.rank;else{let n=Math.trunc(_.env.NODE_ENV==="test"?Ga.testId:Ga.testId*10)/10;Ga.testId+=.001,this.rank=n}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">${this.contentHtml}</div>`,this.markerContainer.setAttribute("data-marker-id",this.id.toString()),this.containerEl=this.markerContainer.firstElementChild??null,this.contentEl=this.markerContainer.firstElementChild?.firstElementChild??null}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===We.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 We.TOP:{a=r,s=0;break}case We.BOTTOM:{a=0,s=r;break}case We.LEFT:{l=e,u=0;break}case We.RIGHT:{l=0,u=e;break}case We.TOP_LEFT:{a=r,l=e,s=0,u=0;break}case We.TOP_RIGHT:{a=r,u=e,s=0,l=0;break}case We.BOTTOM_LEFT:{s=r,l=e,a=0,u=0;break}case We.BOTTOM_RIGHT:{s=r,u=e,a=0,l=0;break}case We.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){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!==this.packedMessage.bboxes[0]?.[4]){let n=this.packedMessage.bboxes.findIndex(i=>i[4]===this.currentStrategyIndex);if(n!==-1){let i=this.packedMessage.bboxes.splice(n,1)[0];this.packedMessage.bboxes.unshift(i)}}if(!this.collisionDirty)return this.packedMessage;this.packedMessage.bboxes=[];for(let n=0;n<this.strategies.length;n++){let i=this.strategies[n];n===this.currentStrategyIndex&&r?this.packedMessage.bboxes.unshift([...i.getBoundingBox(),n]):this.packedMessage.bboxes.push([...i.getBoundingBox(),n])}return this.collisionDirty=!1,this.packedMessage}get lowPriorityPinStrategyIndex(){return this.options.rank==="always-visible"?-1:this.strategies.findIndex(e=>e.name===We.HIDDEN)}destroy(){}};M(Ga,"testId",0);var qC=Ga;m();var Co=class extends Er{constructor(){super(...arguments);M(this,"type","geometry");M(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)})}},Sr=class{constructor(e,r){M(this,"id",Vt());M(this,"components");M(this,"parentId");M(this,"entities2D",new Map);this.components=[e,r]}get object3d(){return this.components[0].mesh}get parentObject3D(){return this.components[0].mesh?.parent}get type(){return this.components[0].type}attach(e){this.parentObject3D instanceof lr?e.object3d.userData.attachedEntityId=this.id:this.entities2D.set(e.id,e)}detach(e){this.parentObject3D instanceof lr&&(e.object3d.userData.parentEntityId=void 0),this.entities2D.delete(e.id)}removeAllEntities(){for(let e of this.entities2D.values())this.detach(e)}};m();var gn=class extends Er{},Gn=class{constructor(e,r,n=0){M(this,"id");M(this,"verticalOffset");M(this,"occluderId");M(this,"object3d",new gn);M(this,"components");M(this,"disposed",!1);M(this,"worldPosition",new pt);this.id=e.id||Vt(),this.components=[e],this.verticalOffset=n,this.object3d=new gn,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}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 WC=class extends Ka{constructor(r,n,i=!0){super();M(this,"rendererState");M(this,"convertTo3DMapPosition");M(this,"textSet",new Set);M(this,"batchedTextMap",new Map);M(this,"useWorker",!0);M(this,"debugTextAreaMesh",new Map);i===!1&&(this.useWorker=!1,IV(!1)),this.rendererState=r,this.convertTo3DMapPosition=n}remove(r){this.textSet.delete(r)}update(r){let n,i,o,a=[];for(let s of this.rendererState.geometry3DIdsInScene)if(n=this.rendererState.geometry3DMap.get(s),n?.type==="text3d"){i=n.components[0],o=n.components[1];let l=i.mesh?.parent;if(!l||!(l instanceof ur)||!(i instanceof um))continue;if("textArea"in i.feature.properties&&i.mesh!=null&&i.polygonEntityId!=null&&i.textMesh==null&&i.mesh.parent!=null&&i.feature.properties?.textArea?.position!=null){if(this.textSet.has(i.polygonEntityId))continue;this.textSet.add(i.polygonEntityId),this.batchedTextMap.has(l)||this.batchedTextMap.set(l,ja().then(({BatchedText:p})=>{let h=new p;return h.type="batchedtext",l.add(h),h}));let c=this.batchedTextMap.get(l);if(!c)throw new Error("batched text required");a.push($C({entityId:s,textComponent:i,styleComponent:o,convertTo3DMapPosition:this.convertTo3DMapPosition,batchedMeshPromise:c,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(s.toString()))continue;this.textSet.add(s.toString()),this.batchedTextMap.has(l)||this.batchedTextMap.set(l,ja().then(({BatchedText:p})=>{let h=new p;return h.type="batchedtext",l.add(h),h}));let c=this.batchedTextMap.get(l);if(!c)throw new Error("batched text required");a.push($C({entityId:s,textComponent:i,styleComponent:o,convertTo3DMapPosition:this.convertTo3DMapPosition,batchedMeshPromise:c,rendererState:this.rendererState,type:"point"}).then(()=>{this.publish("render")}))}let u=this.batchedTextMap.get(l);i.textMesh&&u&&i.polygonEntityId!=null&&Promise.all([u,Promise.resolve({meshComponent:i,styleComponent:o})]).then(([c,{meshComponent:p,styleComponent:h}])=>{let{textMesh:f}=p;if(c&&f){let d=Wg(c,f);p.visible&&!d?c.add(f):!p.visible&&d&&c.remove(f)}h.flipToFaceCamera&&this.flipIfNeeded(p,r)})}return Promise.all(a)}flipIfNeeded(r,n){let i=r.textMesh;if(!i)return!1;let o=i.rotation.z,a=qu(o+n);a>Math.PI/2&&a<3*Math.PI/2&&(i.rotation.z=qu(o+Math.PI))}showTextAreaMesh(){let r,n;for(let i of this.rendererState.geometry3DIdsInScene)if(r=this.rendererState.geometry3DMap.get(i),r?.type==="text3d"&&(n=r.components[0],"textArea"in n.feature.properties)){let o=n.feature.properties.textArea;if(!o)continue;let a=new Sx(o.maxWidth,o.maxHeight),s=new Xn(a,new Oi({color:"pink"})),{textMesh:l}=n;if(!l)continue;let u=this.convertTo3DMapPosition(o.position,Eu);s.position.copy(u),s.position.z=l.position.z-.1,s.rotation.z=l.rotation.z,qg.identity(),qg.makeRotationAxis(new pt(0,0,1),l.userData.rotationZ),Eu.set(o.maxWidth/2,0,0),Eu.applyMatrix4(qg),s.position.x-=Eu.x,s.position.y-=Eu.y,this.rendererState.entityScene.add(s),this.debugTextAreaMesh.set(i,s)}this.publish("render")}hideTextAreaMesh(){this.debugTextAreaMesh.forEach(r=>{this.rendererState.entityScene.remove(r)}),this.debugTextAreaMesh.clear(),this.publish("render")}};function IV(t){ja().then(({configureTroikaTextBuilder:e})=>{e({useWorker:t})})}var qg=new Fi,Eu=new pt,Yg;async function Vve(t){let{preloadFont:e}=await ja();return e(t)}function ja(){return Yg||(Yg=import("./text3d-EZBY7L7A.js").then(t=>t)),Yg}async function $C({entityId:t,textComponent:e,styleComponent:r,convertTo3DMapPosition:n,batchedMeshPromise:i,rendererState:o,type:a="text-area"}){return Promise.all([ja(),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=>{Pt.warn("Trouble creating text: ",s)}).then(s=>{if(!s?.text)return;let l=[Promise.resolve(s.text),i,Promise.resolve()];if(e.polygonEntityId){let u=o.geometry3DMap.get(e.polygonEntityId);if(u?.type==="geometry"){let c=u.components[0],p=u.components[1];c.textMesh=s.text,s.text.position.z=p.altitude+p.height+AV}}else l[2]=ja().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 Wg(t,e){return t._members.has(e)}var AV=.5;var EV=_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()}),KC=_e.strictObject(EV.partial().omit({id:!0,type:!0}).shape),JC=_e.strictObject(KC.omit({margin:!0,position:!0,maxWidth:!0,maxHeight:!0,content:!0}).shape),Zve=_e.strictObject({appearance:KC.optional(),parentId:_e.string().optional()}),um=class{constructor(e){M(this,"mesh",new Co);M(this,"textMesh");M(this,"type","text3d");M(this,"feature");M(this,"parent");M(this,"batchedText");M(this,"polygonEntityId");this.feature=e}get visible(){return this.batchedText&&this.textMesh?Wg(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 Ha,cm=class{constructor(e){M(this,"color");M(this,"dirty",!0);M(this,"enabled",!0);fr(this,Ha,!1);M(this,"edgeColors");M(this,"edgeVisibility");M(this,"geometry");M(this,"ranges");M(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||$e(this,Ha)===e)return;Mt(this,Ha,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 $e(this,Ha)}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]}};Ha=new WeakMap;m();m();m();var pm=class extends _x{constructor(r){let n=r,i=3,o=i*4;super(new Uint8Array(r*o),i,r,gx,yx);M(this,"_width");M(this,"_height");M(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 QC=`#define LAMBERT
748
- varying vec3 vViewPosition;
749
- varying vec4 vPosition;
750
- varying vec2 vUv;
751
- varying vec4 finalPosition;
752
- varying float vVerticalOffset;
753
- varying vec3 worldNormal;
754
- varying float vBatchId;
755
-
756
- #include <common>
757
- #include <batching_pars_vertex>
758
- #include <uv_pars_vertex>
759
- #include <displacementmap_pars_vertex>
760
- #include <envmap_pars_vertex>
761
- #include <color_pars_vertex>
762
- #include <fog_pars_vertex>
763
- #include <normal_pars_vertex>
764
- #include <morphtarget_pars_vertex>
765
- #include <skinning_pars_vertex>
766
- #include <shadowmap_pars_vertex>
767
- #include <logdepthbuf_pars_vertex>
768
- #include <clipping_planes_pars_vertex>
769
-
770
- void main() {
771
-
772
- #include <uv_vertex>
773
- #include <color_vertex>
774
- #include <morphinstance_vertex>
775
- #include <morphcolor_vertex>
776
- #include <batching_vertex>
777
-
778
- #include <beginnormal_vertex>
779
- #include <morphnormal_vertex>
780
- #include <skinbase_vertex>
781
- #include <skinnormal_vertex>
782
- #include <defaultnormal_vertex>
783
- #include <normal_vertex>
784
-
785
- #include <begin_vertex>
786
- #include <morphtarget_vertex>
787
- #include <skinning_vertex>
788
- #include <displacementmap_vertex>
789
- #include <project_vertex>
790
- #include <logdepthbuf_vertex>
791
- #include <clipping_planes_vertex>
792
-
793
- vViewPosition = - mvPosition.xyz;
794
-
795
- #include <worldpos_vertex>
796
- #include <envmap_vertex>
797
- #include <shadowmap_vertex>
798
- #include <fog_vertex>
799
-
800
- // To mitigate visual defects on machines such as windows and iOS
801
- vBatchId = getIndirectIndex(gl_DrawID) + 0.5;
802
- vViewPosition = - mvPosition.xyz;
803
- worldNormal = normal;
804
- vUv = uv;
805
- vVerticalOffset = position.z;
806
- }
807
- `;m();var eM=`#define LAMBERT
808
- uniform vec3 diffuse;
809
- uniform vec3 emissive;
810
- uniform float opacity;
811
- uniform float uGradientEnd;
812
- uniform float uGradientIntensity;
813
- uniform float uMinSideAlpha;
814
- uniform float uMaxSideAlpha;
815
- uniform float uGradientStart;
816
- uniform highp sampler2D uPropertiesTexture;
817
- uniform highp sampler2D uTopTexture;
818
- uniform highp sampler2D uTexture;
819
- uniform float uRepeatYFactor;
820
- uniform bool uBlendTexture;
821
- varying float vBatchId;
822
-
823
- varying vec2 vUv;
824
- varying float vVerticalOffset;
825
- varying vec3 worldNormal;
826
-
827
- #include <common>
828
- #include <packing>
829
- #include <dithering_pars_fragment>
830
- #include <color_pars_fragment>
831
- #include <uv_pars_fragment>
832
- #include <map_pars_fragment>
833
- #include <alphamap_pars_fragment>
834
- #include <alphatest_pars_fragment>
835
- #include <alphahash_pars_fragment>
836
- #include <aomap_pars_fragment>
837
- #include <lightmap_pars_fragment>
838
- #include <emissivemap_pars_fragment>
839
- #include <envmap_common_pars_fragment>
840
- #include <envmap_pars_fragment>
841
- #include <fog_pars_fragment>
842
- #include <bsdfs>
843
- #include <lights_pars_begin>
844
- #include <normal_pars_fragment>
845
- #include <lights_lambert_pars_fragment>
846
- #include <shadowmap_pars_fragment>
847
- #include <bumpmap_pars_fragment>
848
- #include <normalmap_pars_fragment>
849
- #include <specularmap_pars_fragment>
850
- #include <logdepthbuf_pars_fragment>
851
- #include <clipping_planes_pars_fragment>
852
-
853
- vec3 blendTextureColor(vec3 diffuseColor, vec4 texColor) {
854
- vec3 texturedColor = diffuseColor * texColor.rgb;
855
- return mix(diffuseColor, texturedColor, texColor.a);
856
- }
857
-
858
- void main() {
859
- #include <clipping_planes_fragment>
860
-
861
- // get the normalized world normal of vertex fragment
862
- vec3 surfaceNormal = normalize(worldNormal);
863
-
864
- // get angle relative to Z up
865
- float angle = degrees(acos(abs(dot(surfaceNormal, vec3(0.0, 0.0, 1.0)))));
866
-
867
- int idx = int(vBatchId) * 1;
868
- vec3 diffuse = vec3(texelFetch(uPropertiesTexture, ivec2(0, idx), 0).rgb);
869
- bool shouldShowTexture = texelFetch(uPropertiesTexture, ivec2(2, idx), 0).r > 0.99;
870
-
871
- if(shouldShowTexture) {
872
- vec4 tex2d = texture2D(uTexture, vec2(vUv.x, vUv.y * uRepeatYFactor));
873
- diffuse = uBlendTexture ? blendTextureColor(diffuse, tex2d) : tex2d.rgb;
874
- }
875
-
876
- // if this is a fragment facing upwards, use topColor. Avoid any sort of '==' comparison, due to floating point precision issue
877
- if(angle < 0.02) {
878
- bool shouldShowTopTexture = texelFetch(uPropertiesTexture, ivec2(2, idx), 0).g > 0.99;
879
-
880
- if(shouldShowTopTexture) {
881
- vec4 topTex2d = texture2D(uTopTexture, vUv);
882
- diffuse = uBlendTexture ? blendTextureColor(diffuse, topTex2d) : topTex2d.rgb;
883
- } else {
884
- diffuse = vec3(texelFetch(uPropertiesTexture, ivec2(1, idx), 0).rgb);
885
- }
886
- }
887
-
888
- vec4 diffuseColor = vec4(diffuse, opacity);
889
-
890
- // only for vertical surfaces
891
- if(angle > 89.0 && angle < 91.0) {
892
-
893
- // get the percentage of the z position from the ground, up
894
- float percentFromZeroZ = max((abs(vVerticalOffset) - uGradientStart) / uGradientEnd, 0.0);
895
-
896
- // gradient based on percentage
897
- float alpha = smoothstep(uMinSideAlpha, uMaxSideAlpha, percentFromZeroZ);
898
-
899
- // mix the shadow color with the diffuse color based on the alpha and opacity
900
- diffuseColor = vec4(mix(diffuseColor.rgb, diffuseColor.rgb * (1.0 - uGradientIntensity), 1.0 - alpha), opacity);
901
- }
902
-
903
- ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));
904
- vec3 totalEmissiveRadiance = emissive;
905
-
906
- #include <logdepthbuf_fragment>
907
- #include <map_fragment>
908
- #include <color_fragment>
909
- #include <alphamap_fragment>
910
- #include <alphatest_fragment>
911
- #include <alphahash_fragment>
912
- #include <specularmap_fragment>
913
- #include <normal_fragment_begin>
914
- #include <normal_fragment_maps>
915
- #include <emissivemap_fragment>
916
-
917
- // accumulation
918
- #include <lights_lambert_fragment>
919
- #include <lights_fragment_begin>
920
- #include <lights_fragment_maps>
921
- #include <lights_fragment_end>
922
-
923
- // modulation
924
- #include <aomap_fragment>
925
-
926
- vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
927
-
928
- #include <envmap_fragment>
929
- #include <opaque_fragment>
930
- #include <tonemapping_fragment>
931
- #include <colorspace_fragment>
932
- #include <fog_fragment>
933
- #include <premultiplied_alpha_fragment>
934
- #include <dithering_fragment>
935
-
936
- }
937
- `;var LV=-.05,DV=1,Lu=class extends Cx{constructor(r,n,i=1){super(r);M(this,"propertiesTexture");M(this,"texturesVisible",!1);M(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}});M(this,"colorSpace",Mm);M(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 pm(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=QC,o.fragmentShader=eM,Object.assign(this.uniforms,{uGradientIntensity:a,uGradientEnd:s,uGradientStart:l,uMinSideAlpha:{value:LV},uMaxSideAlpha:{value:DV},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=Wa,r.wrapT=Wa,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=Wa,r.wrapT=Wa,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?xx:Mm,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 m0e={top:0,bottom:0,left:0,right:0,type:"pixel"},Du={enabled:!1,thickness:0,size:0,offset:0,segments:3};function d0e(t,e){return{bevelEnabled:t?.enabled??Du.enabled,bevelThickness:t?.thickness??Du.thickness,bevelSize:t?.size??(t?.thickness||Du.size),bevelOffset:t?.offset??Du.offset,bevelSegments:t?.segments??Du.segments,depth:e}}var tM="mappedin";var rM={GEOMETRY:0,IMAGE_MESH:1,ALWAYS_ON_TOP_PATHS:10,ALWAYS_ON_TOP_MODELS:11},y0e=250,g0e="collision-worker.csp.js",x0e="maplibre-worker.csp.js";m();function k0e(t,e){let r=0;for(let u of t)r+=u.components[0]?.geometry?.attributes.position.count||0;let n=new Lr(e.color),i;i=new Lu({color:n,side:e.side==="back"?mx:e.side==="front"?fx:dx,opacity:e.opacity??1,transparent:e.opacity!==void 0?e.opacity<1:!1,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1},t.length);let o=new Xa(t.length,r,0,i);o.renderOrder=rM.GEOMETRY;let a,s,l;for(let u of t)a=u.components[0],!(!(a instanceof Mi)||!a.geometry)&&(a.mesh=o,a.material=i,a.instanceIndex=o.addGeometry(a.geometry),o.addInstance(a.instanceIndex),o.userData.entities[a.instanceIndex]=u.id,i instanceof Lu&&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 $g(t){return oe(t).darken(30).toRgbString()}function F0e(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 Fi;c.makeRotationFromQuaternion(new Im().setFromEuler(new Em(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)),C=Math.abs(w),A=Math.abs(T),E=Math.abs(S);var g,x;C<=A&&C<=E?(g="x",A<=E?x="y":x="z"):A<=C&&A<=E?(g="y",C<=E?x="x":x="z"):(g="z",C<=A?x="x":x="y"),g==="z"&&(g=x,x="z");let L,F,O,z,I,R;if(x==="z"||g==="z"){if(!f||!d)continue;L=f.repeat.u,F=f.repeat.v,O=f.offset.u,z=f.offset.v,I=f.rotation,R=d}else{if(!p||!h)continue;L=p.repeat.u,F=p.repeat.v,O=p.offset.u,z=p.offset.v,I=(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),Ze=new pt(be,ye,W.z).applyMatrix4($.matrixWorld),st=Math.abs(Ze[g]-H[g]),vt=Math.abs(Ze[x]-H[x]),dt=I*Math.PI/180||0,zt=Math.cos(dt),cr=Math.sin(dt),rn=$.matrixWorld.clone().invert(),pr=new Im().setFromEuler(new Em(0,0,r/180*Math.PI));for(let Ct=0;Ct<3;Ct++){let Lo=new pt(o.getX(u(P,Ct)),o.getY(u(P,Ct)),o.getZ(u(P,Ct))).applyMatrix4(rn);Lo.applyQuaternion(pr);let Li=Lo.applyMatrix4($.matrixWorld),xn=Li.x,Do=Li.y,Mr=Li.z;var b,v;g==="x"?b=L*(xn-H[g])/st+O:g==="y"?b=L*(Do-H[g])/st+O:b=L*(Mr-H[g])/st+O,x==="x"?v=F*(xn-H[x])/vt+z:x==="y"?v=F*(Do-H[x])/vt+z:v=F*(Mr-H[x])/vt+z,b-=.5,v-=.5;let Ir=b*zt-v*cr+.5,Hn=b*cr+v*zt+.5;s.setX(u(P,Ct),Ir),s.setY(u(P,Ct),Hn)}}}m();var hm=class{constructor(){M(this,"focusMesh");M(this,"dirty",!0)}};m();var fm=class{constructor(e,r){M(this,"texture");M(this,"topTexture");M(this,"showTexture",!0);M(this,"showTopTexture",!0);M(this,"textureInstance");M(this,"topTextureInstance");M(this,"dirty",!0);this.texture=typeof e=="string"?{path:e}:e,this.topTexture=typeof r=="string"?{path:r}:r}};m();var mm=class{constructor(){M(this,"dirty",!0);M(this,"needsRebuild",!1);M(this,"mesh")}set visible(e){this.mesh&&(this.mesh.visible=e)}get visible(){return this.mesh?this.mesh.visible:!1}};m();var dm=class{constructor(){M(this,"dirty",!0);M(this,"needsRebuild",!1);M(this,"verticalOffset",1/0);M(this,"plane");M(this,"holeFillMesh");M(this,"topColor");M(this,"topVisible",!0)}};function Ru(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 Gn&&t.components[1]===void 0?(t.components[1]=new Oa,t.components[1].dirty=!0):t instanceof Sr&&t.components[2]===void 0?(t.components[2]=new Oa,t.components[2].dirty=!0):t instanceof ur&&t.components[0]===void 0&&(t.components[0]=new Oa,t.components[0].dirty=!0),!0):(t instanceof Gn?t.components[1]=void 0:t instanceof Sr?t.components[2]=void 0:t instanceof ur&&(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),Ru(n,e,r);return!0}}return!1}function d1e(t,e,r){if(!(!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&&nM(n,r);return!0}return!1}}function FV(t,e){e!==void 0&&t.type==="geometry"&&(t.components[1].shading=e,t.components[1].dirty=!0)}function y1e(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&&FV(i,r)}return!0}return!1}function g1e(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 OV(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?.type==="geometry"||i?.type==="model")&&OV(i,e,r)}return!0}}return!1}function nM(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=$g(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 x1e(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 b1e(t,e){return e!==void 0&&(t.type==="marker"||t.type==="label"||t.type==="custom-geometry")&&t.parentObject3D!==e&&t.parentObject3D instanceof ur?(t.parentObject3D?.removeEntity(t),e.addEntity(t),!0):!1}function _1e(t,e){e!==void 0&&(t.type==="marker"||t.type==="label")&&t.components[0].enabled!==e&&(t.components[0].enabled=e)}function v1e(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(oM(t,e.placement)&&(n.collisionDirty=!0),e.dynamicResize!==void 0)return n.options.dynamicResize=e.dynamicResize,!0;if(e.options!=null){try{Zg.parse(e.options||{})}catch(i){return Pt.error(i),!1}return e.options.interactive!=null&&(e.options.interactive==="pointer-events-auto"?(n.pointerEvents="auto",Ru(t,!1,r)):(n.pointerEvents="none",Ru(t,e.options.interactive,r))),iM(t,e.options.rank),!0}}return!1}function iM(t,e){return e!==void 0&&(t.type==="marker"||t.type==="label")?(t.components[0].rank=Ba(e),!0):!1}function BV(t,e){if(e?.options?.appearance==null)return;let r=e.options.appearance||{},n=r.opacity!=null&&r.opacity!==t.appearance.opacity;Jg(t.appearance,r),n&&t.canShow&&t.visibilityNeedsUpdate!=="hide"&&(t.visibilityNeedsUpdate="show")}function P1e(t,e,r){if(e!==void 0&&t.type==="label"){let n=t.components[0];e.text!==void 0&&e.text!==n.text&&(n.text=e.text,n.textDirty=!0);try{Rg(e.options??{})}catch(i){Pt.error(i);return}(uC(n.appearance,e.options?.appearance||{})||e.options?.textPlacement!=null)&&(n.textDirty=!0),cC(n.appearance,e.options?.appearance||{})&&(n.pinDirty=!0),BV(n,e),oM(t,e.options?.textPlacement)&&(n.currentStrategyIndex=-1),Ru(t,e.options?.interactive,r),iM(t,e.options?.rank)}}function oM(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 w1e(t,e){e!==void 0&&t.type==="geometry"&&(t.components[1].hoverColor=e,t.components[1].dirty=!0)}function T1e(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 S1e(t,e){e!==void 0&&t.type==="image"&&(t.components[1].flipImageToFaceCamera=e)}function C1e(t,e){e!==void 0&&t.type==="geometry"&&(t.components[1].enableImageCollisions=e)}function aM(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 gn){let i=e.geometry2DMap.get(n.userData.entityId);if(i){let o=i.components[0];o instanceof mC&&(o.canShow=r)}}}),!0}else if(t.type==="label")return t.components[0].visible=r,!0}return!1}function zV(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?.type==="geometry"||i?.type==="model")&&zV(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 ur&&(n=t.parent.opacity),sM(t,e,n),!0}}else t instanceof Sr&&t.components[1].opacity!==r&&(t.components[1].opacity=r,t.components[1].dirty=!0);return!1}function sM(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 lr&&i.type==="geometry-group"||i instanceof ur&&i.type==="group-container")&&sM(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?.type==="geometry"||i?.type==="model")&&(o=i.components[1],o.dirty=!0)}}function M1e(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&&VV(o,r)}return!0}return n}function VV(t,e){if(t.type==="geometry"&&(e?.texture!=null||e?.topTexture!=null)){let r=!1,n=t.components[6];if(n==null?(t.components[6]=new fm(e?.texture,e?.topTexture),r=!0):(e?.texture!=null&&n?.texture!==e?.texture&&(n.texture=typeof e.texture=="string"?{path:e.texture}:e.texture,r=!0,n.dirty=!0),e?.topTexture!=null&&n?.topTexture!==e?.topTexture&&(n.topTexture=typeof e.topTexture=="string"?{path:e.topTexture}:e.topTexture,r=!0,n.dirty=!0)),r&&t.components[0]instanceof Mi){let i=t.components[0];return i.detached===!1&&(i.shouldDetach=!0,i.dirty=!0),!0}}return!1}function I1e(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?.type==="geometry-group"&&(o.userData.shadingDirty=!0),!0}}return!1}function UV(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&&UV(n,e,r)}}return!1}function NV(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 Sr&&NV(i,e,r)}else if(t.type==="geometry"){let n=t.components[3],i=t.components[1];!n&&r===!0?t.components[3]=new cm($g(i.color)):n&&(n.enabled=r,n.dirty=!0)}return!0}return!1}function A1e(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 hm,!0;if(e===!1&&r!=null)return t.components[n]=void 0,!0}return!1}function E1e(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 GV(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 Sr&&GV(i,e,r)}}}function L1e(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 mm;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 D1e(t,e,r){let{visible:n,color:i}=r;if(t.type!=="path")return;let o=t.components[0];n!=null&&aM(t,e,n),i!=null&&nM(t,{color:i}),Object.assign(o,jV(r)),Kg(r)||(o.materialDirty=!0,r.width!=null&&(o.dirty=!0))}function jV(t){return ku(t,HV)}var HV=["animateArrowsOnPath","displayArrowsOnPath","width","accentColor","completeFraction","highlightCompleteFraction","highlightStartFraction","highlightEndFraction","highlightColor","highlightWidthMultiplier","dashed","visibleThroughGeometry"];function R1e(t){if(!(t instanceof Sr&&t.type==="text3d"))throw new Error("expect target is TextGeometry3D")}var XV=["visible","color","strokeWidth","outlineOffsetX","outlineOffsetY","outlineWidth","outlineBlur","outlineOpacity","outlineColor","strokeWidth","strokeColor","strokeOpacity","maxWidth","maxHeight","font","hoverColor","fillOpacity","fontSize","flipToFaceCamera"];function k1e(t,e,r){aM(t,e,r.visible);let n=t.components[1],i=ku(r,XV);"margin"in r&&Pt.warn("update to margin is not supported atm"),"content"in r&&Pt.warn("content update is not supported atm");try{JC.parse(i)}catch(o){Pt.error(o);return}Object.keys(i).length>0&&(Object.assign(n,i),n.dirty=!0)}var ZV=["color","material","opacity","verticalOffset","rotation","position","scale"];function F1e(t,e){let r=ku(e,ZV),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 O1e(t,e){if(e!==void 0&&t.type==="model"){let r=t.components[7];r==null&&(t.components[7]=new dm,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 tx=se(gM());function xM(t){this.name="JSClipperError",this.message=t,this.stack=new Error().stack}xM.prototype=Error.prototype;tx.default.Error=function(t){throw new xM(t)};var jn=tx.default;var U4="gray",rx=new jn.ClipperOffset,Zt=100;function nx(t,e,r){let{color:n=U4,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;rx.AddPaths(c.map(b=>b.map(v=>({X:v.x*Zt,Y:(p?v.z:v.y)*Zt}))),a==="round"?jn.JoinType.jsRound:a==="miter"?jn.JoinType.jsMiter:jn.JoinType.jsSquare,s==="round"?jn.EndType.etOpenRound:s==="butt"?jn.EndType.etOpenButt:jn.EndType.etOpenSquare);let f=new jn.PolyTree;rx.Execute(f,o/2*Zt);let d=[],g={bevelEnabled:!1,depth:l};for(let b of f.m_AllPolys){let v=new wx;if(b.IsHole())continue;let P=b.m_polygon;v.moveTo(P[0].X/Zt,P[0].Y/Zt),P.slice(1).forEach(w=>v.lineTo(w.X/Zt,w.Y/Zt)),v.lineTo(P[0].X/Zt,P[0].Y/Zt),v.holes=b.m_Childs.map(w=>{let T=new Px,S=w.m_polygon;return T.moveTo(S[0].X/Zt,S[0].Y/Zt),S.slice(1).forEach(C=>T.lineTo(C.X/Zt,C.Y/Zt)),T.lineTo(S[0].X/Zt,S[0].Y/Zt),T}),d.push(new Tx(v,g))}let x=Gu(d);return p&&(x.rotateX(Math.PI/2),x.translate(0,h+l/2,u||0)),x.userData={style:{color:n,opacity:i}},rx.Clear(),x}m();m();var Cr=63710088e-1,Q1e={centimeters:Cr*100,centimetres:Cr*100,degrees:360/(2*Math.PI),feet:Cr*3.28084,inches:Cr*39.37,kilometers:Cr/1e3,kilometres:Cr/1e3,meters:Cr,metres:Cr,miles:Cr/1609.344,millimeters:Cr*1e3,millimetres:Cr*1e3,nauticalmiles:Cr/1852,radians:1,yards:Cr*1.0936};function bM(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 _M(t,e,r={}){if(t.length<2)throw new Error("coordinates must be an array of two or more positions");return bM({type:"LineString",coordinates:t},e,r)}function vM(t,e={}){let r={type:"FeatureCollection"};return e.id&&(r.id=e.id),e.bbox&&(r.bbox=e.bbox),r.features=t,r}function PM(t,e,r={}){return bM({type:"MultiLineString",coordinates:t},e,r)}m();function _m(t){return t.type==="Feature"?t.geometry:t}function N4(t,e={}){let r=_m(t);switch(!e.properties&&t.type==="Feature"&&(e.properties=t.properties),r.type){case"Polygon":return G4(r,e);case"MultiPolygon":return j4(r,e);default:throw new Error("invalid poly")}}function G4(t,e={}){let n=_m(t).coordinates,i=e.properties?e.properties:t.type==="Feature"?t.properties:{};return wM(n,i)}function j4(t,e={}){let n=_m(t).coordinates,i=e.properties?e.properties:t.type==="Feature"?t.properties:{},o=[];return n.forEach(a=>{o.push(wM(a,i))}),vM(o)}function wM(t,e){return t.length>1?PM(t,e):_M(t[0],e)}var ix=N4;m();function TM(t){t&&(t.map&&(t.map.dispose(),t.map=void 0),t.dispose())}function ox(t){for(;t.children.length>0;)ox(t.children[0]);"geometry"in t&&t.geometry&&t.geometry.dispose(),"material"in t&&Array.isArray(t.material)?t.material.forEach(function(e){TM(e)}):"material"in t&&typeof t.material<"u"&&TM(t.material),t.parent&&t.parent.remove(t)}m();function SM(t){return t!=null&&t.geometry.type==="Polygon"&&t.geometry.coordinates[0].length>2}function H4(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 X4(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]];H4(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 CM(t,e=5){return{...t,geometry:{...t.geometry,coordinates:t.geometry.coordinates.map(r=>X4(r,e))}}}var IM=.1,Z4=15,q4=.25,MM=class{constructor(e,r){M(this,"rendererState");M(this,"dirty",!1);M(this,"convertTo3DMapPosition");M(this,"colorToMaterialCache",{});this.rendererState=e,this.convertTo3DMapPosition=r}update(){let e,r,n,i;for(let o of this.rendererState.geometry3DIdsInScene)if(e=this.rendererState.geometry3DMap.get(o),e!=null&&(i=e.components[0],r=e.components[1],e.type==="geometry"&&i instanceof Mi&&SM(i.feature))){if(n=e.components[5],n?.dirty){if(n.mesh==null)try{let a=this.buildBorder(i.feature,r,n);i.mesh?.add(a)}catch(a){Pt.error(a),n.dirty=!1}n.mesh?.children.forEach(a=>{n&&a.material.color.set(r.borderColor)}),n.dirty=!1,n.visible=r.borderVisible}if(n?.needsRebuild){ox(n.mesh);try{let a=this.buildBorder(i.feature,r,n);i.mesh?.add(a)}catch(a){Pt.error(a)}n.needsRebuild=!1,n.visible=r.borderVisible}}}buildBorder(e,r,n){let i=ix(e),o=CM(e,Z4),a=ix(o),s=r.borderWidth/2,l=r.borderColor,u=nx(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 P of p||[])try{let w=nx({type:"Feature",geometry:{type:"LineString",coordinates:[[P[0],P[1],0],[P[0],P[1],r.height]]},properties:{}},this.convertTo3DMapPosition,{width:s,height:s,color:l,cap:"butt"});h.push(w)}catch(w){Pt.warn(w)}let f=Gu([u,c,...h]),d=this.colorToMaterialCache[l]?.[0];d==null&&(d=new Oi({color:l}));let g=this.colorToMaterialCache[l]?.[1];g==null&&(g=new Oi({color:l})),this.colorToMaterialCache[l]=[d,g];let x=new Er,b=new Xn(f,d),v=new Xn(f,g);return x.add(b),x.add(v),v.material.depthWrite=!1,v.material.depthTest=!1,v.material.opacity=q4,v.material.transparent=!0,x.position.z=r.altitude??0,n.mesh=x,x}destroy(){for(let[e,[r,n]]of Object.entries(this.colorToMaterialCache))r.dispose(),n.dispose();this.colorToMaterialCache={}}};var ax="#ffffff",Y4=.1,vm=.1,W4="#333333",Bu,zu,Vu,sx=class{constructor(e={}){M(this,"initialColor",ax);fr(this,Bu,ax);M(this,"initialTopColor");fr(this,zu);fr(this,Vu);M(this,"dirty",!0);M(this,"visible",!0);M(this,"opacity",1);M(this,"width",Y4);M(this,"height",vm);M(this,"initialHeight",vm);M(this,"altitude",0);M(this,"join","round");M(this,"cap","round");M(this,"showImage",!0);M(this,"flipImageToFaceCamera",!0);M(this,"enableImageCollisions",!1);M(this,"url");M(this,"side","double");M(this,"renderOrder",0);M(this,"shading");M(this,"bevel");M(this,"borderVisible",!1);M(this,"borderColor",W4);M(this,"borderWidth");this.color=e?.color!==void 0?e.color:this.color,this.initialColor=this.color,this.width=e?.width!==void 0?e.width:this.width,this.opacity=e?.opacity!==void 0?e.opacity:this.opacity,this.visible=e?.visible!==void 0?e.visible:this.visible,this.height=e?.height!==void 0?e.height:this.height,this.initialHeight=this.height,this.altitude=e?.altitude!==void 0?e.altitude:this.altitude,this.join=e?.join!==void 0?e.join:this.join,this.cap=e?.cap!==void 0?e.cap:this.cap,this.topColor=e?.topColor,this.initialTopColor=this.topColor,this.showImage=e?.showImage!==void 0?e.showImage:this.showImage,this.flipImageToFaceCamera=e?.flipImageToFaceCamera!==void 0?e.flipImageToFaceCamera:this.flipImageToFaceCamera,this.url=e?.url,this.side=e?.side!==void 0?e.side:this.side,this.renderOrder=e?.renderOrder!==void 0?e.renderOrder:this.renderOrder,this.shading=e?.shading,this.bevel=e?.bevel,this.borderVisible=e?.borderVisible!==void 0?e.borderVisible:this.borderVisible,this.borderColor=e?.borderColor!==void 0?e.borderColor:this.borderColor,this.borderWidth=e?.borderWidth!==void 0?e.borderWidth:IM,this.enableImageCollisions=e?.enableImageCollisions!==void 0?e.enableImageCollisions:this.enableImageCollisions}set color(e){Zu(e)?Mt(this,Bu,e):Pt.warn(`Failed to update color. Invalid color "${e}".`)}get color(){return $e(this,Bu)}set topColor(e){e===void 0||Zu(e)?Mt(this,zu,e):Pt.warn(`Failed to update top color. Invalid color "${e}".`)}get topColor(){return $e(this,zu)}set hoverColor(e){Zu(e)?Mt(this,Vu,e):Pt.warn(`Failed to update hover color. Invalid color "${e}".`)}get hoverColor(){return $e(this,Vu)}};Bu=new WeakMap,zu=new WeakMap,Vu=new WeakMap;var Xa=class extends vx{constructor(){super(...arguments);M(this,"type","entityBatchedMesh");M(this,"userData",{entities:{}})}},Uu,Eo,Mi=class{constructor(e){M(this,"mesh");M(this,"imageMesh");M(this,"textMesh");M(this,"textEntityId");M(this,"type","geometry");M(this,"dirty",!0);M(this,"shouldDetach",!1);M(this,"detached",!1);M(this,"instanceIndex",-1);M(this,"geometry");M(this,"batchedProps");M(this,"material");M(this,"feature");M(this,"currentHeight",vm);M(this,"color",new Lr);M(this,"topColor",new Lr);M(this,"position",new pt);M(this,"altitude",0);fr(this,Uu,1);fr(this,Eo);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(){return this.material?.getColor(this.instanceIndex)}get opacity(){return $e(this,Uu)}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}Mt(this,Uu,e)}get featureBbox(){return $e(this,Eo)?$e(this,Eo):(Mt(this,Eo,XS(this.feature)),$e(this,Eo))}};Uu=new WeakMap,Eo=new WeakMap;var lr=class extends Er{constructor(r){super();M(this,"visible",!0);M(this,"type","geometry-group");M(this,"components",[]);M(this,"userData",{entityId:"",entities3D:new Set,dirty:!0,shadingDirty:!0});this.userData.entityId=r}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 Xa?Object.values(r.userData.entities)[0]:void 0}};var ur=class t extends Er{constructor(r){super();M(this,"childrenIds",new Set);M(this,"children",[]);M(this,"type","group-container");M(this,"userData",{entityId:"",entities2D:new Set,dirty:!0,occluderDirty:!1,opacity:1,computedOpacity:1,preloadGeometry:!1});M(this,"components",[]);this.userData.entityId=r}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 Gn?(this.childrenIds.add(r.id),this.add(r.object3d),this.userData.entities2D.add(r.id),r.positionDirty=!0):r instanceof lr?(this.childrenIds.add(r.userData.entityId),this.add(r)):r instanceof Sr&&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 Gn?(this.childrenIds.delete(r.id),this.userData.entities2D.delete(r.id),this.remove(r.object3d)):r instanceof lr?(this.childrenIds.delete(r.userData.entityId),this.remove(r)):r instanceof Sr&&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 gn?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 $4(t){let e=t.min,r=t.max,n=new pt(e.x,e.y,e.z),i=new pt(r.x,e.y,e.z),o=new pt(e.x,r.y,e.z),a=new pt(r.x,r.y,e.z);return[n,i,o,a]}m();function AM(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?.id=="string"||typeof e?.id=="number"?(r=t.geometry2DMap.get(e.id),r==null&&(r=t.geometry3DMap.get(e.id))):r=e,r}function $Pe(t,e,r=[],n=new Am,i){(t.getSystems().renderSystem.threeDdirty||t.getSystems().renderSystem.twoDdirty)&&t.renderSync();let o=AM(t.getInternalState(),e);return EM(o,r,n,i),r}var Pm=new pt;function EM(t,e=[],r=new Am,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++)Pm.fromBufferAttribute(o,a),n!==void 0&&(Pm.z=n),e.push(Pm.clone()),r.expandByPoint(Pm)}}for(let i of t.children)EM(i,e,r,n)}}m();function K4(){return typeof window>"u"?1:Math.min(window.devicePixelRatio,2)}m();function J4(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 Q4=(()=>{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}}})(),LM=Q4.getDeviceType,DM=(()=>{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=LM().isFirefox?null:o.getExtension("WEBGL_debug_renderer_info");return e=a?o.getParameter(a.UNMASKED_RENDERER_WEBGL):o.getParameter(o.RENDERER),e}catch{let s=new Error("Failed getting device info");throw s.name="FailedGettingDeviceInfo",s}}function i(){if(!LM().isWindows)return!1;if(r!==void 0)return r;let o=e5()?.toLowerCase()??"";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}}})(),e5=DM.getInfo,t5=DM.shouldDisableOffscreenCanvas;m();function ku(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 Kg(t){return Object.keys(t).length===0}m();var r5=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 xwe(t,e,r,n){let i=t*(Math.PI/180),o=n/Zn,a=t+o*180/Math.PI,s=r/Zn/Math.cos(i),l=e+s*180/Math.PI;return{lat:a,lon:l}}function bwe(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=Zn*u*Math.cos(a),p=Zn*l;return{x:c,y:p}}var n5=(t,e,r,n=!1)=>{let i=t instanceof ur&&t.userData.preloadGeometry,o=n||i&&!t.visible;if(t.children&&(t.visible||i))for(let a of t.children){if(a.visible&&a.type&&!o)if("entities3D"in a.userData&&a.userData?.entities3D&&a instanceof lr){e.add(a.userData.entityId);for(let s of a.userData.entities3D.values())e.add(s)}else(a.type==="group-container"||a.type==="custom-geometry"||a instanceof Co)&&e.add(a.userData.entityId);a instanceof lr&&a.userData.dirty&&r.add(a.userData.entityId),n5(a,e,r,o)}return e},i5=(t,e)=>{if(t.children&&t.visible&&!t.userData?.hidden)for(let r of t.children)r.visible&&r instanceof gn&&e.add(r.userData.entityId),i5(r,e);return e};function Jg(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"?Jg(t[r],e[r]):t[r]=e[r]}return t}function _we(t,e,r){let n={translateX:t.x,translateY:t.y,translateZ:t.z,scale:t.meterInMercatorCoordinateUnits()},i=new Fi,o=new pt(n.scale,-n.scale,n.scale),a=new Fi().makeTranslation(n.translateX,n.translateY,n.translateZ).scale(o);return{id:tM,type:"custom",renderingMode:"3d",render:(s,l)=>{i.fromArray(l.defaultProjectionData.mainMatrix),e.projectionMatrix=i.multiply(a),r()}}}function o5(t){return fetch(t,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({grant_type:"client_credentials"})})}async function vwe(t){let e=await o5(t),{access_token:r}=await e.json();return{"x-mappedin-tiles-key":r}}function Pwe(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 wwe(t,e,r){let n=t*(Math.PI/180)/2,i=e/2;return r*Math.tan(n)/i}function Twe(t){return new mt(new J(t[0][0],t[0][1]),new J(t[1][0],t[1][1])).getCenter().toArray()}function Swe(t,e){return t<e||e<=12}function Cwe(t){let e=1;return t.type==="geometry-group"&&t.parent!=null&&t.parent instanceof ur?e=t.parent.userData.computedOpacity:(t.type==="geometry"||t.type==="custom-geometry"||t.type==="model")&&t.parentObject3D!=null&&t.parentObject3D instanceof lr&&t.parentObject3D.parent!=null&&t.parentObject3D.parent instanceof ur&&(e=t.parentObject3D.parent.userData.computedOpacity),e}function Mwe(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 a5="maplibre-frustum-culling-hack";function Iwe(){let t=new bx(.01,.01,.01),e=new Oi({opacity:0,depthWrite:!1,transparent:!0}),r=new Xn(t,e);return r.position.copy(new pt(0,50,0)),r.frustumCulled=!1,r.name=a5,r}var Ei=new pt,RM=new _n;function Awe(t,e,r=new Nu){return t.traverse(n=>{if(n instanceof Xn){let o=n.geometry.attributes.position;if(e.position.distanceTo(n.position)<e.near)return;for(let s=0;s<o.count;s++)Ei.fromBufferAttribute(o,s),Ei.applyMatrix4(n.matrixWorld),Ei.applyMatrix4(e.matrixWorldInverse),Ei.applyMatrix4(e.projectionMatrix),Ei.z<1&&Ei.z>0&&(RM.set(Ei.x,Ei.y),r.expandByPoint(RM))}}),r}function kM(t,e){let r=e.clientWidth,n=e.clientHeight;return new _n((t.x+1)*r/2,(1-t.y)*n/2)}function Ewe(t,e,r){let n=document.createElement("div");n.style.position="absolute",n.style.border=`2px solid ${e}`,n.style.pointerEvents="none";let i=kM(new _n(t.min.x,t.min.y),r),o=kM(new _n(t.max.x,t.max.y),r);n.style.left=`${i.x}px`,n.style.top=`${o.y}px`;let a=Math.abs(o.x-i.x),s=Math.abs(o.y-i.y);return n.style.width=`${a}px`,n.style.height=`${s}px`,r.appendChild(n),n}function Lwe(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??0,h=s??0,f=l??0,d=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))}m();var lx=class{constructor(e){M(this,"visible");M(this,"altitude");M(this,"color");M(this,"dirty",!0);M(this,"maxWidth");M(this,"maxHeight");M(this,"hoverByPolygon");M(this,"flipToFaceCamera",FM.flipToFaceCamera);M(this,"font");M(this,"fillOpacity");M(this,"fontSize");M(this,"margin");M(this,"outlineWidth");M(this,"outlineBlur");M(this,"outlineOffsetX");M(this,"strokeColor");M(this,"strokeOpacity");M(this,"strokeWidth");M(this,"hoverColor");M(this,"outlineOffsetY");M(this,"outlineColor");M(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}},FM=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 ux=class{constructor(e){M(this,"dirty",!0);M(this,"visible",!0);M(this,"opacity",1);M(this,"verticalOffset",0);M(this,"interactive",!1);M(this,"color");M(this,"material");M(this,"rotation");M(this,"scale");M(this,"visibleThroughGeometry",!1);M(this,"clippingPlaneZOffset",1/0);M(this,"clippingPlaneTopColor");M(this,"clippingPlaneTopVisible",!0);e&&Object.assign(this,e)}};m();var s5=[1,1,1],l5=[0,0,0];export{NM as a,u5 as b,Pt as c,$a as d,Ex as e,Zn as f,XM as g,ZM as h,T5 as i,Hu as j,S5 as k,C5 as l,qM as m,M5 as n,I5 as o,A5 as p,k5 as q,U5 as r,Vt as s,H5 as t,Ka as u,Rm as v,Zu as w,tN as x,rN as y,Ox as z,tI as A,aN as B,nI as C,sN as D,Ci as E,$B as F,a_e as G,jS as H,s_e as I,l_e as J,u_e as K,c_e as L,p_e as M,h_e as N,f_e as O,$f as P,x_e as Q,JB as R,b_e as S,HS as T,ZS as U,rz as V,D_e as W,oe as X,iC as Y,Dg as Z,oC as _,sC as $,Y_e as aa,mC as ba,jC as ca,Xg as da,xve as ea,qC as fa,xe as ga,Cf as ha,Ig as ia,WB as ja,r_e as ka,Gn as la,Co as ma,Sr as na,m0e as oa,d0e as pa,tM as qa,rM as ra,y0e as sa,g0e as ta,x0e as ua,$4 as va,AM as wa,$Pe as xa,K4 as ya,J4 as za,t5 as Aa,r5 as Ba,qu as Ca,xwe as Da,bwe as Ea,n5 as Fa,i5 as Ga,_we as Ha,vwe as Ia,Pwe as Ja,wwe as Ka,Twe as La,Swe as Ma,Cwe as Na,Mwe as Oa,Iwe as Pa,Awe as Qa,Ewe as Ra,Lwe as Sa,lx as Ta,FM as Ua,ux as Va,s5 as Wa,l5 as Xa,WC as Ya,IV as Za,Vve as _a,EV as $a,JC as ab,Zve as bb,um as cb,cm as db,Lu as eb,k0e as fb,$g as gb,F0e as hb,hm as ib,fm as jb,dm as kb,Ru as lb,d1e as mb,y1e as nb,g1e as ob,OV as pb,nM as qb,x1e as rb,b1e as sb,_1e as tb,v1e as ub,P1e as vb,w1e as wb,T1e as xb,S1e as yb,C1e as zb,aM as Ab,zV as Bb,M1e as Cb,VV as Db,I1e as Eb,UV as Fb,NV as Gb,A1e as Hb,E1e as Ib,GV as Jb,L1e as Kb,D1e as Lb,jV as Mb,R1e as Nb,k1e as Ob,F1e as Pb,O1e as Qb,jn as Rb,nx as Sb,ox as Tb,MM as Ub,ax as Vb,sx as Wb,Xa as Xb,Mi as Yb,lr as Zb,ur as _b};
938
- //# sourceMappingURL=chunk-UOCWYBVK.js.map