@mappedin/mappedin-js 5.50.0 → 5.52.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 (32) hide show
  1. package/lib/esm/get-venue/index.d.ts +27 -3
  2. package/lib/esm/get-venue/index.js +1 -1
  3. package/lib/esm/navigator/index.d.ts +2 -1
  4. package/lib/esm/navigator/index.js +1 -1
  5. package/lib/esm/renderer/{Arrival-KLIH5LTH.js → Arrival-UP4PJA4U.js} +1 -1
  6. package/lib/esm/renderer/{Chalet-ZU2FPU2K.js → Chalet-O3KLVJGV.js} +1 -1
  7. package/lib/esm/renderer/{GLTFExporter-AEQQSSOJ.js → GLTFExporter-TCED5YLG.js} +1 -1
  8. package/lib/esm/renderer/{HelveticaNeue-PHK3JE5I.js → HelveticaNeue-WLGRUQWN.js} +1 -1
  9. package/lib/esm/renderer/{Helvetiker-JVUX4WK7.js → Helvetiker-UU7LFERE.js} +1 -1
  10. package/lib/esm/renderer/{Lato-BX5JVWZI.js → Lato-2SXEYW4V.js} +1 -1
  11. package/lib/esm/renderer/{MyriadPro-3UATSCWU.js → MyriadPro-BSXPENY5.js} +1 -1
  12. package/lib/esm/renderer/{PerformanceController-I6QAT4EJ.js → PerformanceController-72JJ2M4J.js} +1 -1
  13. package/lib/esm/renderer/{ProximaNova-54WAWGUY.js → ProximaNova-H6MTSMLS.js} +1 -1
  14. package/lib/esm/renderer/{SimonCircular-ETZIFPSM.js → SimonCircular-TSBYW4PJ.js} +1 -1
  15. package/lib/esm/renderer/browser-T4GX5CT7.js +1 -0
  16. package/lib/esm/renderer/chunk-DCWRUQBL.js +1 -0
  17. package/lib/esm/renderer/chunk-GSLNUYA6.js +1 -0
  18. package/lib/esm/renderer/chunk-ORJYYHGW.js +1 -0
  19. package/lib/esm/renderer/index.css +1 -1
  20. package/lib/esm/renderer/index.d.ts +145 -83
  21. package/lib/esm/renderer/index.js +1 -1
  22. package/lib/esm/renderer/maplibre-worker.csp.js +1 -1
  23. package/lib/esm/renderer/outdoor-context-BSDLOTS5.js +1 -0
  24. package/lib/mappedin.css +1 -1
  25. package/lib/mappedin.js +1 -1
  26. package/lib/node/index.js +1 -1
  27. package/package.json +2 -2
  28. package/lib/esm/renderer/browser-327UAZTD.js +0 -1
  29. package/lib/esm/renderer/chunk-3XZX75KS.js +0 -1
  30. package/lib/esm/renderer/chunk-OHPDU25U.js +0 -1
  31. package/lib/esm/renderer/chunk-ZRT45YCM.js +0 -1
  32. package/lib/esm/renderer/outdoor-context-XOOYHZLY.js +0 -1
@@ -0,0 +1 @@
1
+ import{a as d}from"./chunk-GSLNUYA6.js";import{a as l,c as Et,d as wi,e as se}from"./chunk-ORJYYHGW.js";var Pe=Et(((e,t)=>{"use strict";function r(e,t){this.x=e,this.y=t}d(),t.exports=r,l(r,"Point"),r.prototype={clone:l((function(){return new r(this.x,this.y)}),"clone"),add:l((function(e){return this.clone()._add(e)}),"add"),sub:l((function(e){return this.clone()._sub(e)}),"sub"),multByPoint:l((function(e){return this.clone()._multByPoint(e)}),"multByPoint"),divByPoint:l((function(e){return this.clone()._divByPoint(e)}),"divByPoint"),mult:l((function(e){return this.clone()._mult(e)}),"mult"),div:l((function(e){return this.clone()._div(e)}),"div"),rotate:l((function(e){return this.clone()._rotate(e)}),"rotate"),rotateAround:l((function(e,t){return this.clone()._rotateAround(e,t)}),"rotateAround"),matMult:l((function(e){return this.clone()._matMult(e)}),"matMult"),unit:l((function(){return this.clone()._unit()}),"unit"),perp:l((function(){return this.clone()._perp()}),"perp"),round:l((function(){return this.clone()._round()}),"round"),mag:l((function(){return Math.sqrt(this.x*this.x+this.y*this.y)}),"mag"),equals:l((function(e){return this.x===e.x&&this.y===e.y}),"equals"),dist:l((function(e){return Math.sqrt(this.distSqr(e))}),"dist"),distSqr:l((function(e){var t=e.x-this.x,r=e.y-this.y;return t*t+r*r}),"distSqr"),angle:l((function(){return Math.atan2(this.y,this.x)}),"angle"),angleTo:l((function(e){return Math.atan2(this.y-e.y,this.x-e.x)}),"angleTo"),angleWith:l((function(e){return this.angleWithSep(e.x,e.y)}),"angleWith"),angleWithSep:l((function(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)}),"angleWithSep"),_matMult:l((function(e){var t=e[0]*this.x+e[1]*this.y,r=e[2]*this.x+e[3]*this.y;return this.x=t,this.y=r,this}),"_matMult"),_add:l((function(e){return this.x+=e.x,this.y+=e.y,this}),"_add"),_sub:l((function(e){return this.x-=e.x,this.y-=e.y,this}),"_sub"),_mult:l((function(e){return this.x*=e,this.y*=e,this}),"_mult"),_div:l((function(e){return this.x/=e,this.y/=e,this}),"_div"),_multByPoint:l((function(e){return this.x*=e.x,this.y*=e.y,this}),"_multByPoint"),_divByPoint:l((function(e){return this.x/=e.x,this.y/=e.y,this}),"_divByPoint"),_unit:l((function(){return this._div(this.mag()),this}),"_unit"),_perp:l((function(){var e=this.y;return this.y=this.x,this.x=-e,this}),"_perp"),_rotate:l((function(e){var t=Math.cos(e),r=Math.sin(e),i=t*this.x-r*this.y,a=r*this.x+t*this.y;return this.x=i,this.y=a,this}),"_rotate"),_rotateAround:l((function(e,t){var r=Math.cos(e),i=Math.sin(e),a=t.x+r*(this.x-t.x)-i*(this.y-t.y),n=t.y+i*(this.x-t.x)+r*(this.y-t.y);return this.x=a,this.y=n,this}),"_rotateAround"),_round:l((function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}),"_round")},r.convert=function(e){return e instanceof r?e:Array.isArray(e)?new r(e[0],e[1]):e}})),Ic=Et(((e,t)=>{"use strict";function r(e,t,r,i){this.cx=3*e,this.bx=3*(r-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(i-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=r,this.p2y=i}d(),t.exports=r,l(r,"UnitBezier"),r.prototype={sampleCurveX:l((function(e){return((this.ax*e+this.bx)*e+this.cx)*e}),"sampleCurveX"),sampleCurveY:l((function(e){return((this.ay*e+this.by)*e+this.cy)*e}),"sampleCurveY"),sampleCurveDerivativeX:l((function(e){return(3*this.ax*e+2*this.bx)*e+this.cx}),"sampleCurveDerivativeX"),solveCurveX:l((function(e,t){if(void 0===t&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var r=e,i=0;i<8;i++){var a=this.sampleCurveX(r)-e;if(Math.abs(a)<t)return r;var n=this.sampleCurveDerivativeX(r);if(Math.abs(n)<1e-6)break;r-=a/n}var s=0,o=1;for(r=e,i=0;i<20&&(a=this.sampleCurveX(r),!(Math.abs(a-e)<t));i++)e>a?s=r:o=r,r=.5*(o-s)+s;return r}),"solveCurveX"),solve:l((function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}),"solve")}})),Fx=Et(((e,t)=>{function r(e,t){var r,i,a,n,s,o,l,u;for(r=3&e.length,i=e.length-r,a=t,s=3432918353,o=461845907,u=0;u<i;)l=255&e.charCodeAt(u)|(255&e.charCodeAt(++u))<<8|(255&e.charCodeAt(++u))<<16|(255&e.charCodeAt(++u))<<24,++u,a=27492+(65535&(n=5*(65535&(a=(a^=l=(65535&(l=(l=(65535&l)*s+(((l>>>16)*s&65535)<<16)&4294967295)<<15|l>>>17))*o+(((l>>>16)*o&65535)<<16)&4294967295)<<13|a>>>19))+((5*(a>>>16)&65535)<<16)&4294967295))+(((n>>>16)+58964&65535)<<16);switch(l=0,r){case 3:l^=(255&e.charCodeAt(u+2))<<16;case 2:l^=(255&e.charCodeAt(u+1))<<8;case 1:a^=l=(65535&(l=(l=(65535&(l^=255&e.charCodeAt(u)))*s+(((l>>>16)*s&65535)<<16)&4294967295)<<15|l>>>17))*o+(((l>>>16)*o&65535)<<16)&4294967295}return a^=e.length,a=2246822507*(65535&(a^=a>>>16))+((2246822507*(a>>>16)&65535)<<16)&4294967295,a=3266489909*(65535&(a^=a>>>13))+((3266489909*(a>>>16)&65535)<<16)&4294967295,(a^=a>>>16)>>>0}d(),l(r,"murmurhash3_32_gc"),typeof t<"u"&&(t.exports=r)})),Bx=Et(((e,t)=>{function r(e,t){for(var r,i=e.length,a=t^i,n=0;i>=4;)r=1540483477*(65535&(r=255&e.charCodeAt(n)|(255&e.charCodeAt(++n))<<8|(255&e.charCodeAt(++n))<<16|(255&e.charCodeAt(++n))<<24))+((1540483477*(r>>>16)&65535)<<16),a=1540483477*(65535&a)+((1540483477*(a>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),i-=4,++n;switch(i){case 3:a^=(255&e.charCodeAt(n+2))<<16;case 2:a^=(255&e.charCodeAt(n+1))<<8;case 1:a=1540483477*(65535&(a^=255&e.charCodeAt(n)))+((1540483477*(a>>>16)&65535)<<16)}return a=1540483477*(65535&(a^=a>>>13))+((1540483477*(a>>>16)&65535)<<16),(a^=a>>>15)>>>0}d(),l(r,"murmurhash2_32_gc"),void 0!==typeof t&&(t.exports=r)})),Xh=Et(((e,t)=>{d();var r=Fx(),i=Bx();t.exports=r,t.exports.murmur3=r,t.exports.murmur2=i})),Mf=Et(((e,t)=>{"use strict";function r(e,t,r){r=r||2;var a,s,o,l,u,c,p,d=t&&t.length,f=d?t[0]*r:e.length,m=i(e,0,f,r,!0),y=[];if(!m||m.next===m.prev)return y;if(d&&(m=h(e,t,m,r)),e.length>80*r){a=o=e[0],s=l=e[1];for(var g=r;g<f;g+=r)(u=e[g])<a&&(a=u),(c=e[g+1])<s&&(s=c),u>o&&(o=u),c>l&&(l=c);p=0!==(p=Math.max(o-a,l-s))?32767/p:0}return n(m,y,r,a,s,p,0),y}function i(e,t,r,i,a){var n,s;if(a===F(e,t,r,i)>0)for(n=t;n<r;n+=i)s=z(n,e[n],e[n+1],s);else for(n=r-i;n>=t;n-=i)s=z(n,e[n],e[n+1],s);return s&&A(s,s.next)&&(D(s),s=s.next),s}function a(e,t){if(!e)return e;t||(t=e);var r,i=e;do{if(r=!1,i.steiner||!A(i,i.next)&&0!==S(i.prev,i,i.next))i=i.next;else{if(D(i),(i=t=i.prev)===i.next)break;r=!0}}while(r||i!==t);return t}function n(e,t,r,i,l,h,p){if(e){!p&&h&&g(e,i,l,h);for(var d,f,m=e;e.prev!==e.next;)if(d=e.prev,f=e.next,h?o(e,i,l,h):s(e))t.push(d.i/r|0),t.push(e.i/r|0),t.push(f.i/r|0),D(e),e=f.next,m=f.next;else if((e=f)===m){p?1===p?n(e=u(a(e),t,r),t,r,i,l,h,2):2===p&&c(e,t,r,i,l,h):n(a(e),t,r,i,l,h,1);break}}}function s(e){var t=e.prev,r=e,i=e.next;if(S(t,r,i)>=0)return!1;for(var a=t.x,n=r.x,s=i.x,o=t.y,l=r.y,u=i.y,c=a<n?a<s?a:s:n<s?n:s,h=o<l?o<u?o:u:l<u?l:u,p=a>n?a>s?a:s:n>s?n:s,d=o>l?o>u?o:u:l>u?l:u,f=i.next;f!==t;){if(f.x>=c&&f.x<=p&&f.y>=h&&f.y<=d&&b(a,o,n,l,s,u,f.x,f.y)&&S(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function o(e,t,r,i){var a=e.prev,n=e,s=e.next;if(S(a,n,s)>=0)return!1;for(var o=a.x,l=n.x,u=s.x,c=a.y,h=n.y,p=s.y,d=o<l?o<u?o:u:l<u?l:u,f=c<h?c<p?c:p:h<p?h:p,m=o>l?o>u?o:u:l>u?l:u,y=c>h?c>p?c:p:h>p?h:p,g=x(d,f,t,r,i),_=x(m,y,t,r,i),v=e.prevZ,w=e.nextZ;v&&v.z>=g&&w&&w.z<=_;){if(v.x>=d&&v.x<=m&&v.y>=f&&v.y<=y&&v!==a&&v!==s&&b(o,c,l,h,u,p,v.x,v.y)&&S(v.prev,v,v.next)>=0||(v=v.prevZ,w.x>=d&&w.x<=m&&w.y>=f&&w.y<=y&&w!==a&&w!==s&&b(o,c,l,h,u,p,w.x,w.y)&&S(w.prev,w,w.next)>=0))return!1;w=w.nextZ}for(;v&&v.z>=g;){if(v.x>=d&&v.x<=m&&v.y>=f&&v.y<=y&&v!==a&&v!==s&&b(o,c,l,h,u,p,v.x,v.y)&&S(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;w&&w.z<=_;){if(w.x>=d&&w.x<=m&&w.y>=f&&w.y<=y&&w!==a&&w!==s&&b(o,c,l,h,u,p,w.x,w.y)&&S(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function u(e,t,r){var i=e;do{var n=i.prev,s=i.next.next;!A(n,s)&&I(n,i,i.next,s)&&C(n,s)&&C(s,n)&&(t.push(n.i/r|0),t.push(i.i/r|0),t.push(s.i/r|0),D(i),D(i.next),i=e=s),i=i.next}while(i!==e);return a(i)}function c(e,t,r,i,s,o){var l=e;do{for(var u=l.next.next;u!==l.prev;){if(l.i!==u.i&&w(l,u)){var c=k(l,u);return l=a(l,l.next),c=a(c,c.next),n(l,t,r,i,s,o,0),void n(c,t,r,i,s,o,0)}u=u.next}l=l.next}while(l!==e)}function h(e,t,r,a){var n,s,o,l=[];for(n=0,s=t.length;n<s;n++)(o=i(e,t[n]*a,n<s-1?t[n+1]*a:e.length,a,!1))===o.next&&(o.steiner=!0),l.push(v(o));for(l.sort(p),n=0;n<l.length;n++)r=f(l[n],r);return r}function p(e,t){return e.x-t.x}function f(e,t){var r=m(e,t);if(!r)return t;var i=k(r,e);return a(i,i.next),a(r,r.next)}function m(e,t){var r,i=t,a=e.x,n=e.y,s=-1/0;do{if(n<=i.y&&n>=i.next.y&&i.next.y!==i.y){var o=i.x+(n-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(o<=a&&o>s&&(s=o,r=i.x<i.next.x?i:i.next,o===a))return r}i=i.next}while(i!==t);if(!r)return null;var l,u=r,c=r.x,h=r.y,p=1/0;i=r;do{a>=i.x&&i.x>=c&&a!==i.x&&b(n<h?a:s,n,c,h,n<h?s:a,n,i.x,i.y)&&(l=Math.abs(n-i.y)/(a-i.x),C(i,e)&&(l<p||l===p&&(i.x>r.x||i.x===r.x&&y(r,i)))&&(r=i,p=l)),i=i.next}while(i!==u);return r}function y(e,t){return S(e.prev,e,t.prev)<0&&S(t.next,e,e.next)<0}function g(e,t,r,i){var a=e;do{0===a.z&&(a.z=x(a.x,a.y,t,r,i)),a.prevZ=a.prev,a.nextZ=a.next,a=a.next}while(a!==e);a.prevZ.nextZ=null,a.prevZ=null,_(a)}function _(e){var t,r,i,a,n,s,o,l,u=1;do{for(r=e,e=null,n=null,s=0;r;){for(s++,i=r,o=0,t=0;t<u&&(o++,i=i.nextZ);t++);for(l=u;o>0||l>0&&i;)0!==o&&(0===l||!i||r.z<=i.z)?(a=r,r=r.nextZ,o--):(a=i,i=i.nextZ,l--),n?n.nextZ=a:e=a,a.prevZ=n,n=a;r=i}n.nextZ=null,u*=2}while(s>1);return e}function x(e,t,r,i,a){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*a|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*a|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function v(e){var t=e,r=e;do{(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next}while(t!==e);return r}function b(e,t,r,i,a,n,s,o){return(a-s)*(t-o)>=(e-s)*(n-o)&&(e-s)*(i-o)>=(r-s)*(t-o)&&(r-s)*(n-o)>=(a-s)*(i-o)}function w(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!P(e,t)&&(C(e,t)&&C(t,e)&&E(e,t)&&(S(e.prev,e,t.prev)||S(e,t.prev,t))||A(e,t)&&S(e.prev,e,e.next)>0&&S(t.prev,t,t.next)>0)}function S(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function A(e,t){return e.x===t.x&&e.y===t.y}function I(e,t,r,i){var a=T(S(e,t,r)),n=T(S(e,t,i)),s=T(S(r,i,e)),o=T(S(r,i,t));return!!(a!==n&&s!==o||0===a&&M(e,r,t)||0===n&&M(e,i,t)||0===s&&M(r,e,i)||0===o&&M(r,t,i))}function M(e,t,r){return t.x<=Math.max(e.x,r.x)&&t.x>=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function T(e){return e>0?1:e<0?-1:0}function P(e,t){var r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&I(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}function C(e,t){return S(e.prev,e,e.next)<0?S(e,t,e.next)>=0&&S(e,e.prev,t)>=0:S(e,t,e.prev)<0||S(e,e.next,t)<0}function E(e,t){var r=e,i=!1,a=(e.x+t.x)/2,n=(e.y+t.y)/2;do{r.y>n!=r.next.y>n&&r.next.y!==r.y&&a<(r.next.x-r.x)*(n-r.y)/(r.next.y-r.y)+r.x&&(i=!i),r=r.next}while(r!==e);return i}function k(e,t){var r=new B(e.i,e.x,e.y),i=new B(t.i,t.x,t.y),a=e.next,n=t.prev;return e.next=t,t.prev=e,r.next=a,a.prev=r,i.next=r,r.prev=i,n.next=i,i.prev=n,i}function z(e,t,r,i){var a=new B(e,t,r);return i?(a.next=i.next,a.prev=i,i.next.prev=a,i.next=a):(a.prev=a,a.next=a),a}function D(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function B(e,t,r){this.i=e,this.x=t,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function F(e,t,r,i){for(var a=0,n=t,s=r-i;n<r;n+=i)a+=(e[s]-e[n])*(e[n+1]+e[s+1]),s=n;return a}d(),t.exports=r,t.exports.default=r,l(r,"earcut"),l(i,"linkedList"),l(a,"filterPoints"),l(n,"earcutLinked"),l(s,"isEar"),l(o,"isEarHashed"),l(u,"cureLocalIntersections"),l(c,"splitEarcut"),l(h,"eliminateHoles"),l(p,"compareX"),l(f,"eliminateHole"),l(m,"findHoleBridge"),l(y,"sectorContainsSector"),l(g,"indexCurve"),l(_,"sortLinked"),l(x,"zOrder"),l(v,"getLeftmost"),l(b,"pointInTriangle"),l(w,"isValidDiagonal"),l(S,"area"),l(A,"equals"),l(I,"intersects"),l(M,"onSegment"),l(T,"sign"),l(P,"intersectsPolygon"),l(C,"locallyInside"),l(E,"middleInside"),l(k,"splitPolygon"),l(z,"insertNode"),l(D,"removeNode"),l(B,"Node"),r.deviation=function(e,t,r,i){var a=t&&t.length,n=a?t[0]*r:e.length,s=Math.abs(F(e,0,n,r));if(a)for(var o=0,l=t.length;o<l;o++){var u=t[o]*r,c=o<l-1?t[o+1]*r:e.length;s-=Math.abs(F(e,u,c,r))}var h=0;for(o=0;o<i.length;o+=3){var p=i[o]*r,d=i[o+1]*r,f=i[o+2]*r;h+=Math.abs((e[p]-e[f])*(e[d+1]-e[p+1])-(e[p]-e[d])*(e[f+1]-e[p+1]))}return 0===s&&0===h?0:Math.abs((h-s)/s)},l(F,"signedArea"),r.flatten=function(e){for(var t=e[0][0].length,r={vertices:[],holes:[],dimensions:t},i=0,a=0;a<e.length;a++){for(var n=0;n<e[a].length;n++)for(var s=0;s<t;s++)r.vertices.push(e[a][n][s]);a>0&&(i+=e[a-1].length,r.holes.push(i))}return r}})),Lf=Et(((e,t)=>{"use strict";d();var r=Pe();function i(e,t,r,i,n){this.properties={},this.extent=r,this.type=0,this._pbf=e,this._geometry=-1,this._keys=i,this._values=n,e.readFields(a,this,t)}function a(e,t,r){1==e?t.id=r.readVarint():2==e?n(r,t):3==e?t.type=r.readVarint():4==e&&(t._geometry=r.pos)}function n(e,t){for(var r=e.readVarint()+e.pos;e.pos<r;){var i=t._keys[e.readVarint()],a=t._values[e.readVarint()];t.properties[i]=a}}function s(e){var t=e.length;if(t<=1)return[e];for(var r,i,a=[],n=0;n<t;n++){var s=o(e[n]);0!==s&&(void 0===i&&(i=s<0),i===s<0?(r&&a.push(r),r=[e[n]]):r.push(e[n]))}return r&&a.push(r),a}function o(e){for(var t,r,i=0,a=0,n=e.length,s=n-1;a<n;s=a++)t=e[a],i+=((r=e[s]).x-t.x)*(t.y+r.y);return i}t.exports=i,l(i,"VectorTileFeature"),l(a,"readFeature"),l(n,"readTag"),i.types=["Unknown","Point","LineString","Polygon"],i.prototype.loadGeometry=function(){var e=this._pbf;e.pos=this._geometry;for(var t,i=e.readVarint()+e.pos,a=1,n=0,s=0,o=0,l=[];e.pos<i;){if(n<=0){var u=e.readVarint();a=7&u,n=u>>3}if(n--,1===a||2===a)s+=e.readSVarint(),o+=e.readSVarint(),1===a&&(t&&l.push(t),t=[]),t.push(new r(s,o));else{if(7!==a)throw new Error("unknown command "+a);t&&t.push(t[0].clone())}}return t&&l.push(t),l},i.prototype.bbox=function(){var e=this._pbf;e.pos=this._geometry;for(var t=e.readVarint()+e.pos,r=1,i=0,a=0,n=0,s=1/0,o=-1/0,l=1/0,u=-1/0;e.pos<t;){if(i<=0){var c=e.readVarint();r=7&c,i=c>>3}if(i--,1===r||2===r)(a+=e.readSVarint())<s&&(s=a),a>o&&(o=a),(n+=e.readSVarint())<l&&(l=n),n>u&&(u=n);else if(7!==r)throw new Error("unknown command "+r)}return[s,l,o,u]},i.prototype.toGeoJSON=function(e,t,r){var a,n,o=this.extent*Math.pow(2,r),u=this.extent*e,c=this.extent*t,h=this.loadGeometry(),p=i.types[this.type];function d(e){for(var t=0;t<e.length;t++){var r=e[t],i=180-360*(r.y+c)/o;e[t]=[360*(r.x+u)/o-180,360/Math.PI*Math.atan(Math.exp(i*Math.PI/180))-90]}}switch(l(d,"project"),this.type){case 1:var f=[];for(a=0;a<h.length;a++)f[a]=h[a][0];d(h=f);break;case 2:for(a=0;a<h.length;a++)d(h[a]);break;case 3:for(h=s(h),a=0;a<h.length;a++)for(n=0;n<h[a].length;n++)d(h[a][n])}1===h.length?h=h[0]:p="Multi"+p;var m={type:"Feature",geometry:{type:p,coordinates:h},properties:this.properties};return"id"in this&&(m.id=this.id),m},l(s,"classifyRings"),l(o,"signedArea")})),Df=Et(((e,t)=>{"use strict";d();var r=Lf();function i(e,t){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(a,this,t),this.length=this._features.length}function a(e,t,r){15===e?t.version=r.readVarint():1===e?t.name=r.readString():5===e?t.extent=r.readVarint():2===e?t._features.push(r.pos):3===e?t._keys.push(r.readString()):4===e&&t._values.push(n(r))}function n(e){for(var t=null,r=e.readVarint()+e.pos;e.pos<r;){var i=e.readVarint()>>3;t=1===i?e.readString():2===i?e.readFloat():3===i?e.readDouble():4===i?e.readVarint64():5===i?e.readVarint():6===i?e.readSVarint():7===i?e.readBoolean():null}return t}t.exports=i,l(i,"VectorTileLayer"),l(a,"readLayer"),l(n,"readValueMessage"),i.prototype.feature=function(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];var t=this._pbf.readVarint()+this._pbf.pos;return new r(this._pbf,t,this.extent,this._keys,this._values)}})),r_=Et(((e,t)=>{"use strict";d();var r=Df();function i(e,t){this.layers=e.readFields(a,{},t)}function a(e,t,i){if(3===e){var a=new r(i,i.readVarint()+i.pos);a.length&&(t[a.name]=a)}}t.exports=i,l(i,"VectorTile"),l(a,"readTile")})),Ra=Et(((e,t)=>{d(),t.exports.VectorTile=r_(),t.exports.VectorTileFeature=Lf(),t.exports.VectorTileLayer=Df()})),P_=Et((e=>{d(),e.read=function(e,t,r,i,a){var n,s,o=8*a-i-1,l=(1<<o)-1,u=l>>1,c=-7,h=r?a-1:0,p=r?-1:1,d=e[t+h];for(h+=p,n=d&(1<<-c)-1,d>>=-c,c+=o;c>0;n=256*n+e[t+h],h+=p,c-=8);for(s=n&(1<<-c)-1,n>>=-c,c+=i;c>0;s=256*s+e[t+h],h+=p,c-=8);if(0===n)n=1-u;else{if(n===l)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,i),n-=u}return(d?-1:1)*s*Math.pow(2,n-i)},e.write=function(e,t,r,i,a,n){var s,o,l,u=8*n-a-1,c=(1<<u)-1,h=c>>1,p=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,d=i?0:n-1,f=i?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(o=isNaN(t)?1:0,s=c):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),(t+=s+h>=1?p/l:p*Math.pow(2,1-h))*l>=2&&(s++,l/=2),s+h>=c?(o=0,s=c):s+h>=1?(o=(t*l-1)*Math.pow(2,a),s+=h):(o=t*Math.pow(2,h-1)*Math.pow(2,a),s=0));a>=8;e[r+d]=255&o,d+=f,o/=256,a-=8);for(s=s<<a|o,u+=a;u>0;e[r+d]=255&s,d+=f,s/=256,u-=8);e[r+d-f]|=128*m}})),Zf=Et(((e,t)=>{"use strict";d(),t.exports=i;var r=P_();function i(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}l(i,"Pbf"),i.Varint=0,i.Fixed64=1,i.Bytes=2,i.Fixed32=5;var a=4294967296,n=1/a,s=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function o(e,t,r){var i,a,n=r.buf;if(i=(112&(a=n[r.pos++]))>>4,a<128||(i|=(127&(a=n[r.pos++]))<<3,a<128)||(i|=(127&(a=n[r.pos++]))<<10,a<128)||(i|=(127&(a=n[r.pos++]))<<17,a<128)||(i|=(127&(a=n[r.pos++]))<<24,a<128)||(i|=(1&(a=n[r.pos++]))<<31,a<128))return c(e,i,t);throw new Error("Expected varint not more than 10 bytes")}function u(e){return e.type===i.Bytes?e.readVarint()+e.pos:e.pos+1}function c(e,t,r){return r?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}function h(e,t){var r,i;if(e>=0?(r=e%4294967296|0,i=e/4294967296|0):(i=~(-e/4294967296),4294967295^(r=~(-e%4294967296))?r=r+1|0:(r=0,i=i+1|0)),e>=0x10000000000000000||e<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),p(r,i,t),f(i,t)}function p(e,t,r){r.buf[r.pos++]=127&e|128,e>>>=7,r.buf[r.pos++]=127&e|128,e>>>=7,r.buf[r.pos++]=127&e|128,e>>>=7,r.buf[r.pos++]=127&e|128,e>>>=7,r.buf[r.pos]=127&e}function f(e,t){var r=(7&e)<<4;t.buf[t.pos++]|=r|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e)))))}function m(e,t,r){var i=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));r.realloc(i);for(var a=r.pos-1;a>=e;a--)r.buf[a+i]=r.buf[a]}function y(e,t){for(var r=0;r<e.length;r++)t.writeVarint(e[r])}function g(e,t){for(var r=0;r<e.length;r++)t.writeSVarint(e[r])}function _(e,t){for(var r=0;r<e.length;r++)t.writeFloat(e[r])}function x(e,t){for(var r=0;r<e.length;r++)t.writeDouble(e[r])}function v(e,t){for(var r=0;r<e.length;r++)t.writeBoolean(e[r])}function b(e,t){for(var r=0;r<e.length;r++)t.writeFixed32(e[r])}function w(e,t){for(var r=0;r<e.length;r++)t.writeSFixed32(e[r])}function S(e,t){for(var r=0;r<e.length;r++)t.writeFixed64(e[r])}function A(e,t){for(var r=0;r<e.length;r++)t.writeSFixed64(e[r])}function I(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+16777216*e[t+3]}function M(e,t,r){e[r]=t,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24}function T(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}function P(e,t,r){for(var i="",a=t;a<r;){var n,s,o,l=e[a],u=null,c=l>239?4:l>223?3:l>191?2:1;if(a+c>r)break;1===c?l<128&&(u=l):2===c?128==(192&(n=e[a+1]))&&((u=(31&l)<<6|63&n)<=127&&(u=null)):3===c?(n=e[a+1],s=e[a+2],128==(192&n)&&128==(192&s)&&(((u=(15&l)<<12|(63&n)<<6|63&s)<=2047||u>=55296&&u<=57343)&&(u=null))):4===c&&(n=e[a+1],s=e[a+2],o=e[a+3],128==(192&n)&&128==(192&s)&&128==(192&o)&&(((u=(15&l)<<18|(63&n)<<12|(63&s)<<6|63&o)<=65535||u>=1114112)&&(u=null))),null===u?(u=65533,c=1):u>65535&&(u-=65536,i+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),i+=String.fromCharCode(u),a+=c}return i}function C(e,t,r){return s.decode(e.subarray(t,r))}function E(e,t,r){for(var i,a,n=0;n<t.length;n++){if((i=t.charCodeAt(n))>55295&&i<57344){if(!a){i>56319||n+1===t.length?(e[r++]=239,e[r++]=191,e[r++]=189):a=i;continue}if(i<56320){e[r++]=239,e[r++]=191,e[r++]=189,a=i;continue}i=a-55296<<10|i-56320|65536,a=null}else a&&(e[r++]=239,e[r++]=191,e[r++]=189,a=null);i<128?e[r++]=i:(i<2048?e[r++]=i>>6|192:(i<65536?e[r++]=i>>12|224:(e[r++]=i>>18|240,e[r++]=i>>12&63|128),e[r++]=i>>6&63|128),e[r++]=63&i|128)}return r}i.prototype={destroy:l((function(){this.buf=null}),"destroy"),readFields:l((function(e,t,r){for(r=r||this.length;this.pos<r;){var i=this.readVarint(),a=i>>3,n=this.pos;this.type=7&i,e(a,t,this),this.pos===n&&this.skip(i)}return t}),"readFields"),readMessage:l((function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)}),"readMessage"),readFixed32:l((function(){var e=I(this.buf,this.pos);return this.pos+=4,e}),"readFixed32"),readSFixed32:l((function(){var e=T(this.buf,this.pos);return this.pos+=4,e}),"readSFixed32"),readFixed64:l((function(){var e=I(this.buf,this.pos)+I(this.buf,this.pos+4)*a;return this.pos+=8,e}),"readFixed64"),readSFixed64:l((function(){var e=I(this.buf,this.pos)+T(this.buf,this.pos+4)*a;return this.pos+=8,e}),"readSFixed64"),readFloat:l((function(){var e=r.read(this.buf,this.pos,!0,23,4);return this.pos+=4,e}),"readFloat"),readDouble:l((function(){var e=r.read(this.buf,this.pos,!0,52,8);return this.pos+=8,e}),"readDouble"),readVarint:l((function(e){var t,r,i=this.buf;return t=127&(r=i[this.pos++]),r<128||(t|=(127&(r=i[this.pos++]))<<7,r<128)||(t|=(127&(r=i[this.pos++]))<<14,r<128)||(t|=(127&(r=i[this.pos++]))<<21,r<128)?t:o(t|=(15&(r=i[this.pos]))<<28,e,this)}),"readVarint"),readVarint64:l((function(){return this.readVarint(!0)}),"readVarint64"),readSVarint:l((function(){var e=this.readVarint();return e%2==1?(e+1)/-2:e/2}),"readSVarint"),readBoolean:l((function(){return!!this.readVarint()}),"readBoolean"),readString:l((function(){var e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=12&&s?C(this.buf,t,e):P(this.buf,t,e)}),"readString"),readBytes:l((function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t}),"readBytes"),readPackedVarint:l((function(e,t){if(this.type!==i.Bytes)return e.push(this.readVarint(t));var r=u(this);for(e=e||[];this.pos<r;)e.push(this.readVarint(t));return e}),"readPackedVarint"),readPackedSVarint:l((function(e){if(this.type!==i.Bytes)return e.push(this.readSVarint());var t=u(this);for(e=e||[];this.pos<t;)e.push(this.readSVarint());return e}),"readPackedSVarint"),readPackedBoolean:l((function(e){if(this.type!==i.Bytes)return e.push(this.readBoolean());var t=u(this);for(e=e||[];this.pos<t;)e.push(this.readBoolean());return e}),"readPackedBoolean"),readPackedFloat:l((function(e){if(this.type!==i.Bytes)return e.push(this.readFloat());var t=u(this);for(e=e||[];this.pos<t;)e.push(this.readFloat());return e}),"readPackedFloat"),readPackedDouble:l((function(e){if(this.type!==i.Bytes)return e.push(this.readDouble());var t=u(this);for(e=e||[];this.pos<t;)e.push(this.readDouble());return e}),"readPackedDouble"),readPackedFixed32:l((function(e){if(this.type!==i.Bytes)return e.push(this.readFixed32());var t=u(this);for(e=e||[];this.pos<t;)e.push(this.readFixed32());return e}),"readPackedFixed32"),readPackedSFixed32:l((function(e){if(this.type!==i.Bytes)return e.push(this.readSFixed32());var t=u(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed32());return e}),"readPackedSFixed32"),readPackedFixed64:l((function(e){if(this.type!==i.Bytes)return e.push(this.readFixed64());var t=u(this);for(e=e||[];this.pos<t;)e.push(this.readFixed64());return e}),"readPackedFixed64"),readPackedSFixed64:l((function(e){if(this.type!==i.Bytes)return e.push(this.readSFixed64());var t=u(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed64());return e}),"readPackedSFixed64"),skip:l((function(e){var t=7&e;if(t===i.Varint)for(;this.buf[this.pos++]>127;);else if(t===i.Bytes)this.pos=this.readVarint()+this.pos;else if(t===i.Fixed32)this.pos+=4;else{if(t!==i.Fixed64)throw new Error("Unimplemented type: "+t);this.pos+=8}}),"skip"),writeTag:l((function(e,t){this.writeVarint(e<<3|t)}),"writeTag"),realloc:l((function(e){for(var t=this.length||16;t<this.pos+e;)t*=2;if(t!==this.length){var r=new Uint8Array(t);r.set(this.buf),this.buf=r,this.length=t}}),"realloc"),finish:l((function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}),"finish"),writeFixed32:l((function(e){this.realloc(4),M(this.buf,e,this.pos),this.pos+=4}),"writeFixed32"),writeSFixed32:l((function(e){this.realloc(4),M(this.buf,e,this.pos),this.pos+=4}),"writeSFixed32"),writeFixed64:l((function(e){this.realloc(8),M(this.buf,-1&e,this.pos),M(this.buf,Math.floor(e*n),this.pos+4),this.pos+=8}),"writeFixed64"),writeSFixed64:l((function(e){this.realloc(8),M(this.buf,-1&e,this.pos),M(this.buf,Math.floor(e*n),this.pos+4),this.pos+=8}),"writeSFixed64"),writeVarint:l((function(e){(e=+e||0)>268435455||e<0?h(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=e>>>7&127))))}),"writeVarint"),writeSVarint:l((function(e){this.writeVarint(e<0?2*-e-1:2*e)}),"writeSVarint"),writeBoolean:l((function(e){this.writeVarint(!!e)}),"writeBoolean"),writeString:l((function(e){e=String(e),this.realloc(4*e.length),this.pos++;var t=this.pos;this.pos=E(this.buf,e,this.pos);var r=this.pos-t;r>=128&&m(t,r,this),this.pos=t-1,this.writeVarint(r),this.pos+=r}),"writeString"),writeFloat:l((function(e){this.realloc(4),r.write(this.buf,e,this.pos,!0,23,4),this.pos+=4}),"writeFloat"),writeDouble:l((function(e){this.realloc(8),r.write(this.buf,e,this.pos,!0,52,8),this.pos+=8}),"writeDouble"),writeBytes:l((function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var r=0;r<t;r++)this.buf[this.pos++]=e[r]}),"writeBytes"),writeRawMessage:l((function(e,t){this.pos++;var r=this.pos;e(t,this);var i=this.pos-r;i>=128&&m(r,i,this),this.pos=r-1,this.writeVarint(i),this.pos+=i}),"writeRawMessage"),writeMessage:l((function(e,t,r){this.writeTag(e,i.Bytes),this.writeRawMessage(t,r)}),"writeMessage"),writePackedVarint:l((function(e,t){t.length&&this.writeMessage(e,y,t)}),"writePackedVarint"),writePackedSVarint:l((function(e,t){t.length&&this.writeMessage(e,g,t)}),"writePackedSVarint"),writePackedBoolean:l((function(e,t){t.length&&this.writeMessage(e,v,t)}),"writePackedBoolean"),writePackedFloat:l((function(e,t){t.length&&this.writeMessage(e,_,t)}),"writePackedFloat"),writePackedDouble:l((function(e,t){t.length&&this.writeMessage(e,x,t)}),"writePackedDouble"),writePackedFixed32:l((function(e,t){t.length&&this.writeMessage(e,b,t)}),"writePackedFixed32"),writePackedSFixed32:l((function(e,t){t.length&&this.writeMessage(e,w,t)}),"writePackedSFixed32"),writePackedFixed64:l((function(e,t){t.length&&this.writeMessage(e,S,t)}),"writePackedFixed64"),writePackedSFixed64:l((function(e,t){t.length&&this.writeMessage(e,A,t)}),"writePackedSFixed64"),writeBytesField:l((function(e,t){this.writeTag(e,i.Bytes),this.writeBytes(t)}),"writeBytesField"),writeFixed32Field:l((function(e,t){this.writeTag(e,i.Fixed32),this.writeFixed32(t)}),"writeFixed32Field"),writeSFixed32Field:l((function(e,t){this.writeTag(e,i.Fixed32),this.writeSFixed32(t)}),"writeSFixed32Field"),writeFixed64Field:l((function(e,t){this.writeTag(e,i.Fixed64),this.writeFixed64(t)}),"writeFixed64Field"),writeSFixed64Field:l((function(e,t){this.writeTag(e,i.Fixed64),this.writeSFixed64(t)}),"writeSFixed64Field"),writeVarintField:l((function(e,t){this.writeTag(e,i.Varint),this.writeVarint(t)}),"writeVarintField"),writeSVarintField:l((function(e,t){this.writeTag(e,i.Varint),this.writeSVarint(t)}),"writeSVarintField"),writeStringField:l((function(e,t){this.writeTag(e,i.Bytes),this.writeString(t)}),"writeStringField"),writeFloatField:l((function(e,t){this.writeTag(e,i.Fixed32),this.writeFloat(t)}),"writeFloatField"),writeDoubleField:l((function(e,t){this.writeTag(e,i.Fixed64),this.writeDouble(t)}),"writeDoubleField"),writeBooleanField:l((function(e,t){this.writeVarintField(e,!!t)}),"writeBooleanField")},l(o,"readVarintRemainder"),l(u,"readPackedEnd"),l(c,"toNum"),l(h,"writeBigVarint"),l(p,"writeBigVarintLow"),l(f,"writeBigVarintHigh"),l(m,"makeRoomForExtraLength"),l(y,"writePackedVarint"),l(g,"writePackedSVarint"),l(_,"writePackedFloat"),l(x,"writePackedDouble"),l(v,"writePackedBoolean"),l(b,"writePackedFixed32"),l(w,"writePackedSFixed32"),l(S,"writePackedFixed64"),l(A,"writePackedSFixed64"),l(I,"readUInt32"),l(M,"writeInt32"),l(T,"readInt32"),l(P,"readUtf8"),l(C,"readUtf8TextDecoder"),l(E,"writeUtf8")}));d();var xo={name:"@packages/outdoor-context",private:!0,description:"BSD licensed community fork of mapbox-gl, a WebGL interactive maps library",version:"3.2.0",main:"dist/maplibre-gl.js",style:"dist/maplibre-gl.css",license:"BSD-3-Clause",funding:"https://github.com/maplibre/maplibre-gl-js?sponsor=1",repository:{type:"git",url:"git://github.com/maplibre/maplibre-gl-js.git"},types:"dist/maplibre-gl.d.ts",type:"module",dependencies:{"@mapbox/geojson-rewind":"^0.5.2","@mapbox/jsonlint-lines-primitives":"^2.0.2","@mapbox/point-geometry":"^0.1.0","@mapbox/tiny-sdf":"^2.0.6","@mapbox/unitbezier":"^0.0.1","@mapbox/vector-tile":"^1.3.1","@mapbox/whoots-js":"^3.1.0","@maplibre/maplibre-gl-style-spec":"^19.2.2","@types/geojson":"^7946.0.10","@types/mapbox__point-geometry":"^0.1.2","@types/mapbox__vector-tile":"^1.3.0","@types/pbf":"^3.0.2",earcut:"^2.2.4","geojson-vt":"^3.2.1","gl-matrix":"^3.4.3","global-prefix":"^3.0.0",kdbush:"^4.0.2","murmurhash-js":"^1.0.0",pbf:"^3.2.1",potpack:"^2.0.0",quickselect:"^2.0.0",supercluster:"^8.0.1",tinyqueue:"^2.0.3","vt-pbf":"^3.1.3"},devDependencies:{"@mapbox/mapbox-gl-rtl-text":"^0.2.3","@mapbox/mvt-fixtures":"^3.10.0","@rollup/plugin-commonjs":"^25.0.3","@rollup/plugin-json":"^6.0.0","@rollup/plugin-node-resolve":"^15.1.0","@rollup/plugin-replace":"^5.0.2","@rollup/plugin-strip":"^3.0.2","@rollup/plugin-terser":"^0.4.3","@rollup/plugin-typescript":"^11.1.2","@types/benchmark":"^2.1.2","@types/cssnano":"^5.0.0","@types/d3":"^7.4.0","@types/diff":"^5.0.3","@types/earcut":"^2.1.1","@types/eslint":"^8.44.0","@types/gl":"^6.0.2","@types/glob":"^8.1.0","@types/jest":"^29.5.3","@types/jsdom":"^21.1.1","@types/minimist":"^1.2.2","@types/murmurhash-js":"^1.0.4","@types/nise":"^1.4.1","@types/node":"^20.4.2","@types/offscreencanvas":"^2019.7.0","@types/pixelmatch":"^5.2.4","@types/pngjs":"^6.0.1","@types/react":"^18.2.15","@types/react-dom":"^18.2.6","@types/request":"^2.48.8","@types/shuffle-seed":"^1.1.0","@types/supercluster":"^7.1.0","@types/window-or-global":"^1.0.4","@typescript-eslint/eslint-plugin":"^5.61.0","@typescript-eslint/parser":"^5.62.0",address:"^1.2.2",benchmark:"^2.1.4",canvas:"^2.11.2",cssnano:"^6.0.1",d3:"^7.8.5","d3-queue":"^3.0.7","devtools-protocol":"^0.0.1170846",diff:"^5.1.0","dts-bundle-generator":"^8.0.1",eslint:"^8.45.0","eslint-config-mourner":"^3.0.0","eslint-plugin-html":"^7.1.0","eslint-plugin-import":"^2.27.5","eslint-plugin-jest":"^27.2.3","eslint-plugin-tsdoc":"0.2.17","eslint-plugin-react":"^7.32.2",expect:"^29.5.0",gl:"^6.0.2",glob:"^10.3.3","is-builtin-module":"^3.2.1",jest:"^29.6.1","jest-canvas-mock":"^2.5.2","jest-environment-jsdom":"^29.6.1",jsdom:"^22.1.0","json-stringify-pretty-compact":"^4.0.0",minimist:"^1.2.8","mock-geolocation":"^1.0.11",nise:"^5.1.4","node-plantuml":"^0.9.0","npm-font-open-sans":"^1.1.0","npm-run-all":"^4.1.5","pdf-merger-js":"^4.3.0",pixelmatch:"^5.3.0",pngjs:"^7.0.0",postcss:"^8.4.26","postcss-cli":"^10.1.0","postcss-inline-svg":"^6.0.0","pretty-bytes":"^6.1.1",puppeteer:"^20.8.2",react:"^18.2.0","react-dom":"^18.2.0",rollup:"^3.26.2","rollup-plugin-sourcemaps":"^0.6.3",rw:"^1.3.3",semver:"^7.5.4","shuffle-seed":"^1.1.6","source-map-explorer":"^2.5.3",st:"^3.0.0",stylelint:"^15.10.1","stylelint-config-standard":"^34.0.0","ts-jest":"^29.1.1","ts-node":"^10.9.1",tslib:"^2.6.0",typedoc:"^0.24.8","typedoc-plugin-markdown":"^3.15.3","typedoc-plugin-missing-exports":"^2.0.0",typescript:"^5.1.6"},overrides:{"postcss-inline-svg":{"css-select":"^5.1.0","dom-serializer":"^2.0.0",htmlparser2:"^8.0.1","postcss-value-parser":"^4.2.0"}},scripts:{"generate-dist-package":"npm run tsnode build/generate-dist-package.js","generate-shaders":"npm run tsnode build/generate-shaders.ts","generate-struct-arrays":"npm run tsnode build/generate-struct-arrays.ts","generate-style-code":"npm run tsnode build/generate-style-code.ts","generate-typings":"npm run tsnode build/generate-typings.ts","generate-docs":"typedoc && npm run tsnode build/generate-docs.ts","generate-images":"npm run tsnode build/generate-doc-images.ts","build-dist":"run-p --print-label generate-typings build-dev build-prod build-csp build-csp-dev build-css","build-dev":"rollup --configPlugin @rollup/plugin-typescript -c --environment BUILD:dev","watch-dev":"rollup --configPlugin @rollup/plugin-typescript -c --environment BUILD:dev --watch","build-prod":"rollup --configPlugin @rollup/plugin-typescript -c --environment BUILD:production","build-csp":"rollup --configPlugin @rollup/plugin-typescript -c rollup.config.csp.ts","build-csp-dev":"rollup --configPlugin @rollup/plugin-typescript -c rollup.config.csp.ts --environment BUILD:dev","build-css":"postcss -o dist/maplibre-gl.css src/css/maplibre-gl.css","build-diagrams":"cd docs/diagrams; ls *.plantuml | xargs -I {} puml generate --svg {} -o {}.svg","watch-css":"postcss --watch -o dist/maplibre-gl.css src/css/maplibre-gl.css","build-benchmarks":"npm run build-dev && rollup --configPlugin @rollup/plugin-typescript -c test/bench/rollup_config_benchmarks.ts","watch-benchmarks":"rollup --configPlugin @rollup/plugin-typescript -c test/bench/rollup_config_benchmarks.ts --watch","start-server":"st --no-cache -H 0.0.0.0 --port 9966 .",start:"run-p watch-css watch-dev start-server","start-bench":"run-p watch-css watch-benchmarks start-server",lint:"eslint --cache --ext .ts,.tsx,.js,.html --ignore-path .gitignore .","lint-css":"stylelint src/css/maplibre-gl.css",test:"run-p lint lint-css test-render jest",jest:"jest","jest-ci":"jest --reporters=github-actions --reporters=summary","test-build":"jest --selectProjects=build","test-integration":"jest --selectProjects=integration","test-render":"npm run tsnode test/integration/render/run_render_tests.ts","test-unit":"jest --selectProjects=unit","test-watch-roots":"jest --watch",codegen:"run-p generate-dist-package generate-style-code generate-struct-arrays generate-shaders",benchmark:"npm run tsnode test/bench/run-benchmarks.ts","gl-stats":"npm run tsnode test/bench/gl-stats.ts",prepare:"npm run codegen",typecheck:"tsc --noEmit && tsc --project tsconfig.dist.json",tsnode:"node --experimental-loader=ts-node/esm --no-warnings"},files:["build/","dist/*","src/"],engines:{npm:">=8.1.0",node:">=16.14.0"}};d(),d();var ng=se(Pe(),1),ag=se(Ic(),1);function og(e){if(e<=0)return 0;if(e>=1)return 1;let t=e*e,r=t*e;return 4*(e<.5?r:3*(e-t)+r-.75)}function Cc(e,t,r,i){let a=new ag.default(e,t,r,i);return function(e){return a.solve(e)}}l(og,"easeCubicInOut"),l(Cc,"bezier");var Ec=Cc(.25,.1,.25,1);function Te(e,t,r){return Math.min(r,Math.max(t,e))}function Jt(e,t,r){let i=r-t,a=((e-t)%i+i)%i+t;return a===t?r:a}function bo(e,t,r){if(!e.length)return r(null,[]);let i=e.length,a=new Array(e.length),n=null;e.forEach(((e,s)=>{t(e,((e,t)=>{e&&(n=e),a[s]=t,0===--i&&r(n,a)}))}))}function sg(e,t){let r=[];for(let i in e)i in t||r.push(i);return r}function R(e,...t){for(let r of t)for(let t in r)e[t]=r[t];return e}function Rt(e,t){let r={};for(let i=0;i<t.length;i++){let a=t[i];a in e&&(r[a]=e[a])}return r}l(Te,"clamp"),l(Jt,"wrap"),l(bo,"asyncAll"),l(sg,"keysDifference"),l(R,"extend"),l(Rt,"pick");var Mw=1;function _o(){return Mw++}function lg(e){return Math.log(e)/Math.LN2%1==0}function ug(e){return e<=1?1:Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))}function Mn(e,t,r){let i={};for(let a in e)i[a]=t.call(r||this,e[a],a,e);return i}function vo(e,t,r){let i={};for(let a in e)t.call(r||this,e[a],a,e)&&(i[a]=e[a]);return i}function Yt(e,t){if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!Yt(e[r],t[r]))return!1;return!0}if("object"==typeof e&&null!==e&&null!==t){if("object"!=typeof t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let r in e)if(!Yt(e[r],t[r]))return!1;return!0}return e===t}function ct(e){return Array.isArray(e)?e.map(ct):"object"==typeof e&&e?Mn(e,ct):e}function cg(e,t){for(let r=0;r<e.length;r++)if(t.indexOf(e[r])>=0)return!0;return!1}l(_o,"uniqueId"),l(lg,"isPowerOfTwo"),l(ug,"nextPowerOfTwo"),l(Mn,"mapObject"),l(vo,"filterObject"),l(Yt,"deepEqual"),l(ct,"clone"),l(cg,"arraysIntersect");var rg={};function Ce(e){rg[e]||(typeof console<"u"&&console.warn(e),rg[e]=!0)}function Qt(e,t,r){return(r.y-e.y)*(t.x-e.x)>(t.y-e.y)*(r.x-e.x)}function pg(e,t,r,i){let a=t.y-e.y,n=t.x-e.x,s=i.y-r.y,o=i.x-r.x,l=s*n-o*a;if(0===l)return null;let u=(o*(e.y-r.y)-s*(e.x-r.x))/l;return new ng.default(e.x+u*n,e.y+u*a)}function hg(e){let t=0;for(let r,i,a=0,n=e.length,s=n-1;a<n;s=a++)r=e[a],i=e[s],t+=(i.x-r.x)*(r.y+i.y);return t}function fg([e,t,r]){return t+=90,t*=Math.PI/180,r*=Math.PI/180,{x:e*Math.cos(t)*Math.sin(r),y:e*Math.sin(t)*Math.sin(r),z:e*Math.cos(r)}}function pt(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}function mg(e){let t={};if(e.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((e,r,i,a)=>{let n=i||a;return t[r]=!n||n.toLowerCase(),""})),t["max-age"]){let e=parseInt(t["max-age"],10);isNaN(e)?delete t["max-age"]:t["max-age"]=e}return t}l(Ce,"warnOnce"),l(Qt,"isCounterClockwise"),l(pg,"findLineIntersection"),l(hg,"calculateSignedArea"),l(fg,"sphericalToCartesian"),l(pt,"isWorker"),l(mg,"parseCacheControl");var Mc=null;function jr(e){if(null==Mc){let t=e.navigator?e.navigator.userAgent:null;Mc=!!e.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return Mc}function kt(e){return typeof ImageBitmap<"u"&&e instanceof ImageBitmap}function dg(e,t){let r=new Blob([new Uint8Array(e)],{type:"image/png"});createImageBitmap(r).then((e=>{t(null,e)})).catch((e=>{t(new Error("Could not load image because of ".concat(e.message,". Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.")))}))}l(jr,"isSafari"),l(kt,"isImageBitmap"),l(dg,"arrayBufferToImageBitmap");var ig="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function yg(e,t){let r=new Image;r.onload=()=>{t(null,r),URL.revokeObjectURL(r.src),r.onload=null,window.requestAnimationFrame((()=>{r.src=ig}))},r.onerror=()=>t(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));let i=new Blob([new Uint8Array(e)],{type:"image/png"});r.src=e.byteLength?URL.createObjectURL(i):ig}l(yg,"arrayBufferToImage"),d();var wo,kc,Cw=typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),ne={now:Cw,frame(e){let t=requestAnimationFrame(e);return{cancel:l((()=>cancelAnimationFrame(t)),"cancel")}},getImageData(e,t=0){return this.getImageCanvasContext(e).getImageData(-t,-t,e.width+2*t,e.height+2*t)},getImageCanvasContext(e){let t=window.document.createElement("canvas"),r=t.getContext("2d",{willReadFrequently:!0});if(!r)throw new Error("failed to create canvas 2d context");return t.width=e.width,t.height=e.height,r.drawImage(e,0,0,e.width,e.height),r},resolveURL:e=>(wo||(wo=document.createElement("a")),wo.href=e,wo.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(null==kc&&(kc=matchMedia("(prefers-reduced-motion: reduce)")),kc.matches)}};d();var Lc=se(Pe(),1),Be=class e{static testProp(t){if(!e.docStyle)return t[0];for(let r=0;r<t.length;r++)if(t[r]in e.docStyle)return t[r];return t[0]}static create(e,t,r){let i=window.document.createElement(e);return void 0!==t&&(i.className=t),r&&r.appendChild(i),i}static createNS(e,t){return window.document.createElementNS(e,t)}static disableDrag(){e.docStyle&&e.selectProp&&(e.userSelect=e.docStyle[e.selectProp],e.docStyle[e.selectProp]="none")}static enableDrag(){e.docStyle&&e.selectProp&&(e.docStyle[e.selectProp]=e.userSelect)}static setTransform(t,r){t.style[e.transformProp]=r}static addEventListener(e,t,r,i={}){"passive"in i?e.addEventListener(t,r,i):e.addEventListener(t,r,i.capture)}static removeEventListener(e,t,r,i={}){"passive"in i?e.removeEventListener(t,r,i):e.removeEventListener(t,r,i.capture)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",e.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",e.suppressClickInternal,!0),window.setTimeout((()=>{window.removeEventListener("click",e.suppressClickInternal,!0)}),0)}static mousePos(e,t){let r=e.getBoundingClientRect();return new Lc.default(t.clientX-r.left-e.clientLeft,t.clientY-r.top-e.clientTop)}static touchPos(e,t){let r=e.getBoundingClientRect(),i=[];for(let a=0;a<t.length;a++)i.push(new Lc.default(t[a].clientX-r.left-e.clientLeft,t[a].clientY-r.top-e.clientTop));return i}static mouseButton(e){return e.button}static remove(e){e&&e.parentNode&&e.parentNode.removeChild(e)}};l(Be,"DOM"),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 B=Be;d(),d();var Je={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""},Fc=class extends Error{constructor(e,t,r,i){super("AJAXError: ".concat(t," (").concat(e,"): ").concat(r)),this.status=e,this.statusText=t,this.url=r,this.body=i}};l(Fc,"AJAXError");var fr=Fc,So=pt()?()=>self.worker&&self.worker.referrer:()=>("blob:"===window.location.protocol?window.parent:window).location.href,Dc=l((e=>Je.REGISTERED_PROTOCOLS[e.substring(0,e.indexOf("://"))]),"getProtocolAction"),Ew=l((e=>/^file:/.test(e)||/^file:/.test(So())&&!/^\w+:/.test(e)),"isFileURL");function gg(e,t){let r=new AbortController,i=new Request(e.url,{method:e.method||"GET",body:e.body,credentials:e.credentials,headers:e.headers,referrer:So(),signal:r.signal}),a=!1,n=!1;"json"===e.type&&i.headers.set("Accept","application/json");let s=l(((r,a,s)=>{if(!n){if(r&&"SecurityError"!==r.message&&Ce(r),a&&s)return o(a);fetch(i).then((r=>r.ok?o(r):r.blob().then((i=>t(new fr(r.status,r.statusText,e.url,i)))))).catch((e=>{20!==e.code&&t(new Error(e.message))}))}}),"validateOrFetch"),o=l((r=>{("arrayBuffer"===e.type||"image"===e.type?r.arrayBuffer():"json"===e.type?r.json():r.text()).then((e=>{n||(a=!0,t(null,e,r.headers.get("Cache-Control"),r.headers.get("Expires")))})).catch((e=>{n||t(new Error(e.message))}))}),"finishRequest");return s(null,null),{cancel:l((()=>{n=!0,a||r.abort()}),"cancel")}}function kw(e,t){let r=new XMLHttpRequest;r.open(e.method||"GET",e.url,!0),("arrayBuffer"===e.type||"image"===e.type)&&(r.responseType="arraybuffer");for(let t in e.headers)r.setRequestHeader(t,e.headers[t]);return"json"===e.type&&(r.responseType="text",r.setRequestHeader("Accept","application/json")),r.withCredentials="include"===e.credentials,r.onerror=()=>{t(new Error(r.statusText))},r.onload=()=>{if((r.status>=200&&r.status<300||0===r.status)&&null!==r.response){let i=r.response;if("json"===e.type)try{i=JSON.parse(r.response)}catch(e){return t(e)}t(null,i,r.getResponseHeader("Cache-Control"),r.getResponseHeader("Expires"))}else{let i=new Blob([r.response],{type:r.getResponseHeader("Content-Type")});t(new fr(r.status,r.statusText,e.url,i))}},r.send(e.body),{cancel:l((()=>r.abort()),"cancel")}}l(gg,"makeFetchRequest"),l(kw,"makeXMLHttpRequest");var Pi=l((function(e,t){if(/:\/\//.test(e.url)&&!/^https?:|^file:/.test(e.url)){if(pt()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",e,t);if(!pt())return(Dc(e.url)||gg)(e,t)}if(!Ew(e.url)){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return gg(e,t);if(pt()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",e,t,void 0,!0)}return kw(e,t)}),"makeRequest"),mr=l((function(e,t){return Pi(R(e,{type:"json"}),t)}),"getJSON"),Po=l((function(e,t){return Pi(R(e,{type:"arrayBuffer"}),t)}),"getArrayBuffer");function zc(e){if(!e||e.indexOf("://")<=0||0===e.indexOf("data:image/")||0===e.indexOf("blob:"))return!0;let t=new URL(e),r=window.location;return t.protocol===r.protocol&&t.host===r.host}l(zc,"sameOrigin");var xg=l((function(e,t){let r=window.document.createElement("video");r.muted=!0,r.onloadstart=function(){t(null,r)};for(let t=0;t<e.length;t++){let i=window.document.createElement("source");zc(e[t])||(r.crossOrigin="Anonymous"),i.src=e[t],r.appendChild(i)}return{cancel:l((()=>{}),"cancel")}}),"getVideo");d(),d();var Cn,Ti,st,En={supported:!1,testSupport:Lw},Bc=!1,bg=!1;function Lw(e){Bc||!Ti||(bg?_g(e):Cn=e)}function _g(e){let t=e.createTexture();e.bindTexture(e.TEXTURE_2D,t);try{if(e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,Ti),e.isContextLost())return;En.supported=!0}catch{}e.deleteTexture(t),Bc=!0}typeof document<"u"&&((Ti=document.createElement("img")).onload=function(){Cn&&_g(Cn),Cn=null,bg=!0},Ti.onerror=function(){Bc=!0,Cn=null},Ti.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),l(Lw,"testSupport"),l(_g,"testWebpTextureUpload"),(e=>{let t,r,i,a;e.resetRequestQueue=l((()=>{t=[],r=0,i=0,a={}}),"resetRequestQueue"),e.addThrottleControl=l((e=>{let t=i++;return a[t]=e,t}),"addThrottleControl"),e.removeThrottleControl=l((e=>{delete a[e],c()}),"removeThrottleControl");let n=l((()=>{let e=Object.keys(a),t=!1;if(e.length>0)for(let r of e)if(t=a[r](),t)break;return t}),"isThrottled");e.getImage=l(((e,i,a=!0)=>{En.supported&&(e.headers||(e.headers={}),e.headers.accept="image/webp,*/*");let n={requestParameters:e,supportImageRefresh:a,callback:i,cancelled:!1,completed:!1,cancel:l((()=>{!n.completed&&!n.cancelled&&(n.cancelled=!0,n.innerRequest&&(n.innerRequest.cancel(),r--),c())}),"cancel")};return t.push(n),c(),n}),"getImage");let s=l(((e,t)=>{"function"==typeof createImageBitmap?dg(e,t):yg(e,t)}),"arrayBufferToCanvasImageSource"),o=l((e=>{let{requestParameters:t,supportImageRefresh:r,callback:i}=e;return R(t,{type:"image"}),(!1!==r||pt()||Dc(t.url)||t.headers&&!Object.keys(t.headers).reduce(((e,t)=>e&&"accept"===t),!0)?Pi:h)(t,((t,r,a,n)=>{u(e,i,t,r,a,n)}))}),"doImageRequest"),u=l(((e,t,i,a,n,o)=>{i?t(i):a instanceof HTMLImageElement||a instanceof ImageBitmap?t(null,a):a&&s(a,l(((e,r)=>{null!=e?t(e):null!=r&&t(null,r,{cacheControl:n,expires:o})}),"decoratedCallback")),e.cancelled||(e.completed=!0,r--,c())}),"onImageResponse"),c=l((()=>{let e=n()?Je.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:Je.MAX_PARALLEL_IMAGE_REQUESTS;for(let i=r;i<e&&t.length>0;i++){let e=t.shift();if(e.cancelled){i--;continue}let a=o(e);r++,e.innerRequest=a}}),"processQueue"),h=l(((e,t)=>{let r=new Image,i=e.url,a=!1,n=e.credentials;return n&&"include"===n?r.crossOrigin="use-credentials":(n&&"same-origin"===n||!zc(i))&&(r.crossOrigin="anonymous"),r.fetchPriority="high",r.onload=()=>{t(null,r),r.onerror=r.onload=null},r.onerror=()=>{a||t(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.")),r.onerror=r.onload=null},r.src=i,{cancel:l((()=>{a=!0,r.src=""}),"cancel")}}),"getImageUsingHtmlImage")})(st||(st={})),st.resetRequestQueue(),d();var Rc=class{constructor(e){this._transformRequestFn=e}transformRequest(e,t){return this._transformRequestFn&&this._transformRequestFn(e,t)||{url:e}}normalizeSpriteURL(e,t,r){let i=zw(e);return i.path+="".concat(t).concat(r),Fw(i)}setTransformRequest(e){this._transformRequestFn=e}};l(Rc,"RequestManager");var To=Rc,Dw=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function zw(e){let t=e.match(Dw);if(!t)throw new Error('Unable to parse URL "'.concat(e,'"'));return{protocol:t[1],authority:t[2],path:t[3]||"/",params:t[4]?t[4].split("&"):[]}}function Fw(e){let t=e.params.length?"?".concat(e.params.join("&")):"";return"".concat(e.protocol,"://").concat(e.authority).concat(e.path).concat(t)}function vg(e,t,r){r[e]&&-1!==r[e].indexOf(t)||(r[e]=r[e]||[],r[e].push(t))}function Oc(e,t,r){if(r&&r[e]){let i=r[e].indexOf(t);-1!==i&&r[e].splice(i,1)}}l(zw,"parseUrl"),l(Fw,"formatUrl"),d(),d(),l(vg,"_addEventListener"),l(Oc,"_removeEventListener");var Vc=class{constructor(e,t={}){R(this,t),this.type=e}};l(Vc,"Event");var z=Vc,Uc=class extends z{constructor(e,t={}){super("error",R({error:e},t))}};l(Uc,"ErrorEvent");var H=Uc,Nc=class{on(e,t){return this._listeners=this._listeners||{},vg(e,t,this._listeners),this}off(e,t){return Oc(e,t,this._listeners),Oc(e,t,this._oneTimeListeners),this}once(e,t){return t?(this._oneTimeListeners=this._oneTimeListeners||{},vg(e,t,this._oneTimeListeners),this):new Promise((t=>this.once(e,t)))}fire(e,t){"string"==typeof e&&(e=new z(e,t||{}));let r=e.type;if(this.listens(r)){e.target=this;let t=this._listeners&&this._listeners[r]?this._listeners[r].slice():[];for(let r of t)r.call(this,e);let i=this._oneTimeListeners&&this._oneTimeListeners[r]?this._oneTimeListeners[r].slice():[];for(let t of i)Oc(r,t,this._oneTimeListeners),t.call(this,e);let a=this._eventedParent;a&&(R(e,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),a.fire(e))}else e instanceof H&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,t){return this._eventedParent=e,this._eventedParentData=t,this}};l(Nc,"Evented");var de=Nc;d(),d(),d(),d();var Og=se(Ic(),1),Bw=8,Rw={version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},Ow={"*":{type:"source"}},Vw=["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],Uw={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:"*"}},Nw={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:"*"}},Gw={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:{}},default:"mapbox"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},qw={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"}},jw={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"}}},Zw={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"}}},$w={id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},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"}},Hw=["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],Ww={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Xw={"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"}},Kw={"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"}},Yw={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Jw={"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"}},Qw={"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"}},e2={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},t2={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},r2={type:"array",value:"*"},i2={type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},n2={type:"enum",values:{Point:{},LineString:{},Polygon:{}}},a2={type:"array",minimum:0,maximum:24,value:["number","color"],length:2},o2={type:"array",value:"*",minimum:1},s2={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}},l2={source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},u2=["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],c2={"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"}},p2={"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"}},h2={"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"}},f2={"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"}},m2={"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"}},d2={"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"}},y2={"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,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:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",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"}},g2={"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"}},x2={duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},b2={"*":{type:"string"}},M={$version:Bw,$root:Rw,sources:Ow,source:Vw,source_vector:Uw,source_raster:Nw,source_raster_dem:Gw,source_geojson:qw,source_video:jw,source_image:Zw,layer:$w,layout:Hw,layout_background:Ww,layout_fill:Xw,layout_circle:Kw,layout_heatmap:Yw,"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:Jw,layout_symbol:Qw,layout_raster:e2,layout_hillshade:t2,filter:r2,filter_operator:i2,geometry_type:n2,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:a2,expression:o2,light:s2,terrain:l2,paint:u2,paint_fill:c2,"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:p2,paint_circle:h2,paint_heatmap:f2,paint_symbol:m2,paint_raster:d2,paint_hillshade:y2,paint_background:g2,transition:x2,"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:b2},_2=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function v2(e,t){let r={};for(let t in e)"ref"!==t&&(r[t]=e[t]);return _2.forEach((e=>{e in t&&(r[e]=t[e])})),r}function op(e){e=e.slice();let t=Object.create(null);for(let r=0;r<e.length;r++)t[e[r].id]=e[r];for(let r=0;r<e.length;r++)"ref"in e[r]&&(e[r]=v2(e[r],t[e[r].ref]));return e}function Oe(e,t){if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!Oe(e[r],t[r]))return!1;return!0}if("object"==typeof e&&null!==e&&null!==t){if("object"!=typeof t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let r in e)if(!Oe(e[r],t[r]))return!1;return!0}return e===t}l(v2,"deref"),l(op,"derefLayers"),l(Oe,"deepEqual");var Ae={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight"};function Vg(e,t,r){r.push({command:Ae.addSource,args:[e,t[e]]})}function Ug(e,t,r){t.push({command:Ae.removeSource,args:[e]}),r[e]=!0}function w2(e,t,r,i){Ug(e,r,i),Vg(e,t,r)}function S2(e,t,r){let i;for(i in e[r])if(Object.prototype.hasOwnProperty.call(e[r],i)&&"data"!==i&&!Oe(e[r][i],t[r][i]))return!1;for(i in t[r])if(Object.prototype.hasOwnProperty.call(t[r],i)&&"data"!==i&&!Oe(e[r][i],t[r][i]))return!1;return!0}function P2(e,t,r,i){let a;for(a in t=t||{},e=e||{})Object.prototype.hasOwnProperty.call(e,a)&&(Object.prototype.hasOwnProperty.call(t,a)||Ug(a,r,i));for(a in t)Object.prototype.hasOwnProperty.call(t,a)&&(Object.prototype.hasOwnProperty.call(e,a)?Oe(e[a],t[a])||("geojson"===e[a].type&&"geojson"===t[a].type&&S2(e,t,a)?r.push({command:Ae.setGeoJSONSourceData,args:[a,t[a].data]}):w2(a,t,r,i)):Vg(a,t,r))}function Ao(e,t,r,i,a,n){let s;for(s in t=t||{},e=e||{})Object.prototype.hasOwnProperty.call(e,s)&&(Oe(e[s],t[s])||r.push({command:n,args:[i,s,t[s],a]}));for(s in t)!Object.prototype.hasOwnProperty.call(t,s)||Object.prototype.hasOwnProperty.call(e,s)||Oe(e[s],t[s])||r.push({command:n,args:[i,s,t[s],a]})}function wg(e){return e.id}function Sg(e,t){return e[t.id]=t,e}function T2(e,t,r){t=t||[];let i,a,n,s,o,l,u,c=(e=e||[]).map(wg),h=t.map(wg),p=e.reduce(Sg,{}),d=t.reduce(Sg,{}),f=c.slice(),m=Object.create(null);for(i=0,a=0;i<c.length;i++)n=c[i],Object.prototype.hasOwnProperty.call(d,n)?a++:(r.push({command:Ae.removeLayer,args:[n]}),f.splice(f.indexOf(n,a),1));for(i=0,a=0;i<h.length;i++)n=h[h.length-1-i],f[f.length-1-i]!==n&&(Object.prototype.hasOwnProperty.call(p,n)?(r.push({command:Ae.removeLayer,args:[n]}),f.splice(f.lastIndexOf(n,f.length-a),1)):a++,l=f[f.length-i],r.push({command:Ae.addLayer,args:[d[n],l]}),f.splice(f.length-i,0,n),m[n]=!0);for(i=0;i<h.length;i++)if(n=h[i],s=p[n],o=d[n],!m[n]&&!Oe(s,o)){if(!Oe(s.source,o.source)||!Oe(s["source-layer"],o["source-layer"])||!Oe(s.type,o.type)){r.push({command:Ae.removeLayer,args:[n]}),l=f[f.lastIndexOf(n)+1],r.push({command:Ae.addLayer,args:[o,l]});continue}for(u in Ao(s.layout,o.layout,r,n,null,Ae.setLayoutProperty),Ao(s.paint,o.paint,r,n,null,Ae.setPaintProperty),Oe(s.filter,o.filter)||r.push({command:Ae.setFilter,args:[n,o.filter]}),(!Oe(s.minzoom,o.minzoom)||!Oe(s.maxzoom,o.maxzoom))&&r.push({command:Ae.setLayerZoomRange,args:[n,o.minzoom,o.maxzoom]}),s)Object.prototype.hasOwnProperty.call(s,u)&&("layout"===u||"paint"===u||"filter"===u||"metadata"===u||"minzoom"===u||"maxzoom"===u||(0===u.indexOf("paint.")?Ao(s[u],o[u],r,n,u.slice(6),Ae.setPaintProperty):Oe(s[u],o[u])||r.push({command:Ae.setLayerProperty,args:[n,u,o[u]]})));for(u in o)!Object.prototype.hasOwnProperty.call(o,u)||Object.prototype.hasOwnProperty.call(s,u)||"layout"===u||"paint"===u||"filter"===u||"metadata"===u||"minzoom"===u||"maxzoom"===u||(0===u.indexOf("paint.")?Ao(s[u],o[u],r,n,u.slice(6),Ae.setPaintProperty):Oe(s[u],o[u])||r.push({command:Ae.setLayerProperty,args:[n,u,o[u]]}))}}function Ng(e,t){if(!e)return[{command:Ae.setStyle,args:[t]}];let r=[];try{if(!Oe(e.version,t.version))return[{command:Ae.setStyle,args:[t]}];Oe(e.center,t.center)||r.push({command:Ae.setCenter,args:[t.center]}),Oe(e.zoom,t.zoom)||r.push({command:Ae.setZoom,args:[t.zoom]}),Oe(e.bearing,t.bearing)||r.push({command:Ae.setBearing,args:[t.bearing]}),Oe(e.pitch,t.pitch)||r.push({command:Ae.setPitch,args:[t.pitch]}),Oe(e.sprite,t.sprite)||r.push({command:Ae.setSprite,args:[t.sprite]}),Oe(e.glyphs,t.glyphs)||r.push({command:Ae.setGlyphs,args:[t.glyphs]}),Oe(e.transition,t.transition)||r.push({command:Ae.setTransition,args:[t.transition]}),Oe(e.light,t.light)||r.push({command:Ae.setLight,args:[t.light]});let i={},a=[];P2(e.sources,t.sources,a,i);let n=[];e.layers&&e.layers.forEach((e=>{i[e.source]?r.push({command:Ae.removeLayer,args:[e.id]}):n.push(e)})),r=r.concat(a),T2(n,t.layers,r)}catch(e){console.warn("Unable to compute style diff:",e),r=[{command:Ae.setStyle,args:[t]}]}return r}l(Vg,"addSource"),l(Ug,"removeSource"),l(w2,"updateSource"),l(S2,"canUpdateGeoJSON"),l(P2,"diffSources"),l(Ao,"diffLayerPropertyChanges"),l(wg,"pluckId"),l(Sg,"indexById"),l(T2,"diffLayers"),l(Ng,"diffStyles");var gp=class{constructor(e,t,r,i){this.message=(e?"".concat(e,": "):"")+r,i&&(this.identifier=i),null!=t&&t.__line__&&(this.line=t.__line__)}};l(gp,"ValidationError");var U=gp;function Di(e,...t){for(let r of t)for(let t in r)e[t]=r[t];return e}l(Di,"extendBy");var xp=class extends Error{constructor(e,t){super(t),this.message=t,this.key=e}};l(xp,"ExpressionParsingError");var Lt=xp,Go=class e{constructor(e,t=[]){this.parent=e,this.bindings={};for(let[e,r]of t)this.bindings[e]=r}concat(t){return new e(this,t)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error("".concat(e," not found in scope."))}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}};l(Go,"Scope");var Xc=Go,Bi={kind:"null"},q={kind:"number"},ce={kind:"string"},ae={kind:"boolean"},zt={kind:"color"},ki={kind:"object"},oe={kind:"value"},A2={kind:"error"},ss={kind:"collator"},Ri={kind:"formatted"},ls={kind:"padding"},Xn={kind:"resolvedImage"},us={kind:"variableAnchorOffsetCollection"};function wt(e,t){return{kind:"array",itemType:e,N:t}}function Ue(e){if("array"===e.kind){let t=Ue(e.itemType);return"number"==typeof e.N?"array<".concat(t,", ").concat(e.N,">"):"value"===e.itemType.kind?"array":"array<".concat(t,">")}return e.kind}l(wt,"array$1"),l(Ue,"toString$1");var I2=[Bi,q,ce,ae,zt,Ri,ki,wt(oe),ls,Xn,us];function Un(e,t){if("error"===t.kind)return null;if("array"===e.kind){if("array"===t.kind&&(0===t.N&&"value"===t.itemType.kind||!Un(e.itemType,t.itemType))&&("number"!=typeof e.N||e.N===t.N))return null}else{if(e.kind===t.kind)return null;if("value"===e.kind)for(let e of I2)if(!Un(e,t))return null}return"Expected ".concat(Ue(e)," but found ").concat(Ue(t)," instead.")}function sp(e,t){return t.some((t=>t.kind===e.kind))}function Nn(e,t){return t.some((t=>"null"===t?null===e:"array"===t?Array.isArray(e):"object"===t?e&&!Array.isArray(e)&&"object"==typeof e:t===typeof e))}function kn(e,t){return"array"===e.kind&&"array"===t.kind?e.itemType.kind===t.itemType.kind&&"number"==typeof e.N:e.kind===t.kind}l(Un,"checkSubtype"),l(sp,"isValidType"),l(Nn,"isValidNativeType"),l(kn,"verifyType");var Gg=.96422,qg=1,jg=.82521,Zg=4/29,Li=6/29,$g=3*Li*Li,M2=Li*Li*Li,C2=Math.PI/180,E2=180/Math.PI;function Hg(e){return(e%=360)<0&&(e+=360),e}function Wg([e,t,r,i]){let a,n,s=qc((.2225045*(e=Gc(e))+.7168786*(t=Gc(t))+.0606169*(r=Gc(r)))/qg);e===t&&t===r?a=n=s:(a=qc((.4360747*e+.3850649*t+.1430804*r)/Gg),n=qc((.0139322*e+.0971045*t+.7141733*r)/jg));let o=116*s-16;return[o<0?0:o,500*(a-s),200*(s-n),i]}function Gc(e){return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function qc(e){return e>M2?Math.pow(e,1/3):e/$g+Zg}function Xg([e,t,r,i]){let a=(e+16)/116,n=isNaN(t)?a:a+t/500,s=isNaN(r)?a:a-r/200;return a=qg*Zc(a),n=Gg*Zc(n),s=jg*Zc(s),[jc(3.1338561*n-1.6168667*a-.4906146*s),jc(-.9787684*n+1.9161415*a+.033454*s),jc(.0719453*n-.2289914*a+1.4052427*s),i]}function jc(e){return(e=e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055)<0?0:e>1?1:e}function Zc(e){return e>Li?e*e*e:$g*(e-Zg)}function k2(e){let[t,r,i,a]=Wg(e),n=Math.sqrt(r*r+i*i);return[Math.round(1e4*n)?Hg(Math.atan2(i,r)*E2):NaN,n,t,a]}function L2([e,t,r,i]){return e=isNaN(e)?0:e*C2,Xg([r,Math.cos(e)*t,Math.sin(e)*t,i])}function D2([e,t,r,i]){function a(i){let a=(i+e/30)%12,n=t*Math.min(r,1-r);return r-n*Math.max(-1,Math.min(a-3,9-a,1))}return e=Hg(e),t/=100,r/=100,l(a,"f"),[a(0),a(8),a(4),i]}function z2(e){if("transparent"===(e=e.toLowerCase().trim()))return[0,0,0,0];let t=F2[e];if(t){let[e,r,i]=t;return[e/255,r/255,i/255,1]}if(e.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(e)){let t=e.length<6?1:2,r=1;return[Io(e.slice(r,r+=t)),Io(e.slice(r,r+=t)),Io(e.slice(r,r+=t)),Io(e.slice(r,r+t)||"ff")]}if(e.startsWith("rgb")){let t=/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,r=e.match(t);if(r){let[e,t,i,a,n,s,o,l,u,c,h,p]=r,d=[a||" ",o||" ",c].join("");if(" "===d||" /"===d||",,"===d||",,,"===d){let e=[i,s,u].join(""),r="%%%"===e?100:""===e?255:0;if(r){let e=[Ai(+t/r,0,1),Ai(+n/r,0,1),Ai(+l/r,0,1),h?Pg(+h,p):1];if(Tg(e))return e}}return}}let r=e.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(r){let[e,t,i,a,n,s,o,l,u]=r,c=[i||" ",n||" ",o].join("");if(" "===c||" /"===c||",,"===c||",,,"===c){let e=[+t,Ai(+a,0,100),Ai(+s,0,100),l?Pg(+l,u):1];if(Tg(e))return D2(e)}}}function Io(e){return parseInt(e.padEnd(2,e),16)/255}function Pg(e,t){return Ai(t?e/100:e,0,1)}function Ai(e,t,r){return Math.min(Math.max(t,e),r)}function Tg(e){return!e.some(Number.isNaN)}l(Hg,"constrainAngle"),l(Wg,"rgbToLab"),l(Gc,"rgb2xyz"),l(qc,"xyz2lab"),l(Xg,"labToRgb"),l(jc,"xyz2rgb"),l(Zc,"lab2xyz"),l(k2,"rgbToHcl"),l(L2,"hclToRgb"),l(D2,"hslToRgb"),l(z2,"parseCssColor"),l(Io,"parseHex"),l(Pg,"parseAlpha"),l(Ai,"clamp"),l(Tg,"validateNumbers");var F2={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]},zn=class e{constructor(e,t,r,i=1,a=!0){this.r=e,this.g=t,this.b=r,this.a=i,a||(this.r*=i,this.g*=i,this.b*=i,i||this.overwriteGetter("rgb",[e,t,r,i]))}static parse(t){if(t instanceof e)return t;if("string"!=typeof t)return;let r=z2(t);return r?new e(...r,!1):void 0}get rgb(){let{r:e,g:t,b:r,a:i}=this,a=i||1/0;return this.overwriteGetter("rgb",[e/a,t/a,r/a,i])}get hcl(){return this.overwriteGetter("hcl",k2(this.rgb))}get lab(){return this.overwriteGetter("lab",Wg(this.rgb))}overwriteGetter(e,t){return Object.defineProperty(this,e,{value:t}),t}toString(){let[e,t,r,i]=this.rgb;return"rgba(".concat([e,t,r].map((e=>Math.round(255*e))).join(","),",").concat(i,")")}};l(zn,"Color");var X=zn;X.black=new X(0,0,0,1),X.white=new X(1,1,1,1),X.transparent=new X(0,0,0,0),X.red=new X(1,0,0,1);var bp=class{constructor(e,t,r){this.sensitivity=e?t?"variant":"case":t?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,t){return this.collator.compare(e,t)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}};l(bp,"Collator");var Gn=bp,_p=class{constructor(e,t,r,i,a){this.text=e,this.image=t,this.scale=r,this.fontStack=i,this.textColor=a}};l(_p,"FormattedSection");var qn=_p,Mi=class e{constructor(e){this.sections=e}static fromString(t){return new e([new qn(t,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some((e=>0!==e.text.length||e.image&&0!==e.image.name.length))}static factory(t){return t instanceof e?t:e.fromString(t)}toString(){return 0===this.sections.length?"":this.sections.map((e=>e.text)).join("")}};l(Mi,"Formatted");var Pt=Mi,Ci=class e{constructor(e){this.values=e.slice()}static parse(t){if(t instanceof e)return t;if("number"==typeof t)return new e([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(let e of t)if("number"!=typeof e)return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]]}return new e(t)}}toString(){return JSON.stringify(this.values)}};l(Ci,"Padding");var Vt=Ci,B2=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]),Fn=class e{constructor(e){this.values=e.slice()}static parse(t){if(t instanceof e)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let e=0;e<t.length;e+=2){let r=t[e],i=t[e+1];if("string"!=typeof r||!B2.has(r)||!Array.isArray(i)||2!==i.length||"number"!=typeof i[0]||"number"!=typeof i[1])return}return new e(t)}}toString(){return JSON.stringify(this.values)}};l(Fn,"VariableAnchorOffsetCollection");var er=Fn,qo=class e{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(t){return t?new e({name:t,available:!1}):null}};l(qo,"ResolvedImage");var ht=qo;function Kg(e,t,r,i){if(!("number"==typeof e&&e>=0&&e<=255&&"number"==typeof t&&t>=0&&t<=255&&"number"==typeof r&&r>=0&&r<=255)){return"Invalid rgba value [".concat(("number"==typeof i?[e,t,r,i]:[e,t,r]).join(", "),"]: 'r', 'g', and 'b' must be between 0 and 255.")}return typeof i>"u"||"number"==typeof i&&i>=0&&i<=1?null:"Invalid rgba value [".concat([e,t,r,i].join(", "),"]: 'a' must be between 0 and 1.")}function ko(e){if(null===e||"string"==typeof e||"boolean"==typeof e||"number"==typeof e||e instanceof X||e instanceof Gn||e instanceof Pt||e instanceof Vt||e instanceof er||e instanceof ht)return!0;if(Array.isArray(e)){for(let t of e)if(!ko(t))return!1;return!0}if("object"==typeof e){for(let t in e)if(!ko(e[t]))return!1;return!0}return!1}function Xe(e){if(null===e)return Bi;if("string"==typeof e)return ce;if("boolean"==typeof e)return ae;if("number"==typeof e)return q;if(e instanceof X)return zt;if(e instanceof Gn)return ss;if(e instanceof Pt)return Ri;if(e instanceof Vt)return ls;if(e instanceof er)return us;if(e instanceof ht)return Xn;if(Array.isArray(e)){let t,r=e.length;for(let r of e){let e=Xe(r);if(t){if(t===e)continue;t=oe;break}t=e}return wt(t||oe,r)}return ki}function Ln(e){let t=typeof e;return null===e?"":"string"===t||"number"===t||"boolean"===t?String(e):e instanceof X||e instanceof Pt||e instanceof Vt||e instanceof er||e instanceof ht?e.toString():JSON.stringify(e)}l(Kg,"validateRGBA"),l(ko,"isValue"),l(Xe,"typeOf"),l(Ln,"toString");var jo=class e{constructor(e,t){this.type=e,this.value=t}static parse(t,r){if(2!==t.length)return r.error("'literal' expression requires exactly one argument, but found ".concat(t.length-1," instead."));if(!ko(t[1]))return r.error("invalid value");let i=t[1],a=Xe(i),n=r.expectedType;return"array"===a.kind&&0===a.N&&n&&"array"===n.kind&&("number"!=typeof n.N||0===n.N)&&(a=n),new e(a,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}};l(jo,"Literal");var gr=jo,vp=class{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}};l(vp,"RuntimeError");var Ne=vp,Mo={string:ce,number:q,boolean:ae,object:ki},Zo=class e{constructor(e,t){this.type=e,this.args=t}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let i,a=1,n=t[0];if("array"===n){let e,n;if(t.length>2){let i=t[1];if("string"!=typeof i||!(i in Mo)||"object"===i)return r.error('The item type argument of "array" must be one of string, number, boolean',1);e=Mo[i],a++}else e=oe;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return r.error('The length argument to "array" must be a positive integer literal',2);n=t[2],a++}i=wt(e,n)}else{if(!Mo[n])throw new Error("Types doesn't contain name = ".concat(n));i=Mo[n]}let s=[];for(;a<t.length;a++){let e=r.parse(t[a],a,oe);if(!e)return null;s.push(e)}return new e(i,s)}evaluate(e){for(let t=0;t<this.args.length;t++){let r=this.args[t].evaluate(e);if(!Un(this.type,Xe(r)))return r;if(t===this.args.length-1)throw new Ne("Expected value to be of type ".concat(Ue(this.type),", but found ").concat(Ue(Xe(r))," instead."))}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}};l(Zo,"Assertion");var Ot=Zo,Ag={"to-boolean":ae,"to-color":zt,"to-number":q,"to-string":ce},$o=class e{constructor(e,t){this.type=e,this.args=t}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let i=t[0];if(!Ag[i])throw new Error("Can't parse ".concat(i," as it is not part of the known types"));if(("to-boolean"===i||"to-string"===i)&&2!==t.length)return r.error("Expected one argument.");let a=Ag[i],n=[];for(let e=1;e<t.length;e++){let i=r.parse(t[e],e,oe);if(!i)return null;n.push(i)}return new e(a,n)}evaluate(e){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(e);case"color":{let t,r;for(let i of this.args){if(t=i.evaluate(e),r=null,t instanceof X)return t;if("string"==typeof t){let r=e.parseColor(t);if(r)return r}else if(Array.isArray(t)&&(r=t.length<3||t.length>4?"Invalid rbga value ".concat(JSON.stringify(t),": expected an array containing either three or four numeric values."):Kg(t[0],t[1],t[2],t[3]),!r))return new X(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new Ne(r||"Could not parse color from value '".concat("string"==typeof t?t:JSON.stringify(t),"'"))}case"padding":{let t;for(let r of this.args){t=r.evaluate(e);let i=Vt.parse(t);if(i)return i}throw new Ne("Could not parse padding from value '".concat("string"==typeof t?t:JSON.stringify(t),"'"))}case"variableAnchorOffsetCollection":{let t;for(let r of this.args){t=r.evaluate(e);let i=er.parse(t);if(i)return i}throw new Ne("Could not parse variableAnchorOffsetCollection from value '".concat("string"==typeof t?t:JSON.stringify(t),"'"))}case"number":{let t=null;for(let r of this.args){if(t=r.evaluate(e),null===t)return 0;let i=Number(t);if(!isNaN(i))return i}throw new Ne("Could not convert ".concat(JSON.stringify(t)," to number."))}case"formatted":return Pt.fromString(Ln(this.args[0].evaluate(e)));case"resolvedImage":return ht.fromString(Ln(this.args[0].evaluate(e)));default:return Ln(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}};l($o,"Coercion");var dr=$o,R2=["Unknown","Point","LineString","Polygon"],wp=class{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?R2[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(e){let t=this._parseColorCache[e];return t||(t=this._parseColorCache[e]=X.parse(e)),t}};l(wp,"EvaluationContext");var Lo=wp,Ho=class e{constructor(e,t,r=[],i,a=new Xc,n=[]){this.registry=e,this.path=r,this.key=r.map((e=>"[".concat(e,"]"))).join(""),this.scope=a,this.errors=n,this.expectedType=i,this._isConstant=t}parse(e,t,r,i,a={}){return t?this.concat(t,r,i)._parse(e,a):this._parse(e,a)}_parse(e,t){function r(e,t,r){return"assert"===r?new Ot(t,[e]):"coerce"===r?new dr(t,[e]):e}if((null===e||"string"==typeof e||"boolean"==typeof e||"number"==typeof e)&&(e=["literal",e]),l(r,"annotate"),Array.isArray(e)){if(0===e.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');let i=e[0];if("string"!=typeof i)return this.error("Expression name must be a string, but found ".concat(typeof i,' instead. If you wanted a literal array, use ["literal", [...]].'),0),null;let a=this.registry[i];if(a){let i=a.parse(e,this);if(!i)return null;if(this.expectedType){let e=this.expectedType,a=i.type;if("string"!==e.kind&&"number"!==e.kind&&"boolean"!==e.kind&&"object"!==e.kind&&"array"!==e.kind||"value"!==a.kind)if("color"!==e.kind&&"formatted"!==e.kind&&"resolvedImage"!==e.kind||"value"!==a.kind&&"string"!==a.kind)if("padding"!==e.kind||"value"!==a.kind&&"number"!==a.kind&&"array"!==a.kind)if("variableAnchorOffsetCollection"!==e.kind||"value"!==a.kind&&"array"!==a.kind){if(this.checkSubtype(e,a))return null}else i=r(i,e,t.typeAnnotation||"coerce");else i=r(i,e,t.typeAnnotation||"coerce");else i=r(i,e,t.typeAnnotation||"coerce");else i=r(i,e,t.typeAnnotation||"assert")}if(!(i instanceof gr)&&"resolvedImage"!==i.type.kind&&this._isConstant(i)){let e=new Lo;try{i=new gr(i.type,i.evaluate(e))}catch(e){return this.error(e.message),null}}return i}return this.error('Unknown expression "'.concat(i,'". If you wanted a literal array, use ["literal", [...]].'),0)}return typeof e>"u"?this.error("'undefined' value invalid. Use null instead."):"object"==typeof e?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error("Expected an array, but found ".concat(typeof e," instead."))}concat(t,r,i){let a="number"==typeof t?this.path.concat(t):this.path,n=i?this.scope.concat(i):this.scope;return new e(this.registry,this._isConstant,a,r||null,n,this.errors)}error(e,...t){let r="".concat(this.key).concat(t.map((e=>"[".concat(e,"]"))).join(""));this.errors.push(new Lt(r,e))}checkSubtype(e,t){let r=Un(e,t);return r&&this.error(r),r}};l(Ho,"ParsingContext");var Do=Ho,Wo=class e{constructor(e,t,r){this.type=ss,this.locale=r,this.caseSensitive=e,this.diacriticSensitive=t}static parse(t,r){if(2!==t.length)return r.error("Expected one argument.");let i=t[1];if("object"!=typeof i||Array.isArray(i))return r.error("Collator options argument must be an object.");let a=r.parse(void 0!==i["case-sensitive"]&&i["case-sensitive"],1,ae);if(!a)return null;let n=r.parse(void 0!==i["diacritic-sensitive"]&&i["diacritic-sensitive"],1,ae);if(!n)return null;let s=null;return i.locale&&(s=r.parse(i.locale,1,ce),!s)?null:new e(a,n,s)}evaluate(e){return new Gn(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}};l(Wo,"CollatorExpression");var zo=Wo,yr=8192;function lp(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[0]),e[3]=Math.max(e[3],t[1])}function O2(e){return(180+e)/360}function V2(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function Fo(e,t){return!(e[0]<=t[0]||e[2]>=t[2]||e[1]<=t[1]||e[3]>=t[3])}function U2(e,t){let r=O2(e[0]),i=V2(e[1]),a=Math.pow(2,t.z);return[Math.round(r*a*yr),Math.round(i*a*yr)]}function N2(e,t,r){let i=e[0]-t[0],a=e[1]-t[1],n=e[0]-r[0],s=e[1]-r[1];return i*s-n*a===0&&i*n<=0&&a*s<=0}function G2(e,t,r){return t[1]>e[1]!=r[1]>e[1]&&e[0]<(r[0]-t[0])*(e[1]-t[1])/(r[1]-t[1])+t[0]}function up(e,t){let r=!1;for(let i=0,a=t.length;i<a;i++){let a=t[i];for(let t=0,i=a.length;t<i-1;t++){if(N2(e,a[t],a[t+1]))return!1;G2(e,a[t],a[t+1])&&(r=!r)}}return r}function q2(e,t){for(let r=0;r<t.length;r++)if(up(e,t[r]))return!0;return!1}function j2(e,t){return e[0]*t[1]-e[1]*t[0]}function Ig(e,t,r,i){let a=e[0]-r[0],n=e[1]-r[1],s=t[0]-r[0],o=t[1]-r[1],l=i[0]-r[0],u=i[1]-r[1],c=a*u-l*n,h=s*u-l*o;return c>0&&h<0||c<0&&h>0}function Z2(e,t,r,i){let a=[t[0]-e[0],t[1]-e[1]];return 0!==j2([i[0]-r[0],i[1]-r[1]],a)&&!(!Ig(e,t,r,i)||!Ig(r,i,e,t))}function $2(e,t,r){for(let i of r)for(let r=0;r<i.length-1;++r)if(Z2(e,t,i[r],i[r+1]))return!0;return!1}function Yg(e,t){for(let r=0;r<e.length;++r)if(!up(e[r],t))return!1;for(let r=0;r<e.length-1;++r)if($2(e[r],e[r+1],t))return!1;return!0}function H2(e,t){for(let r=0;r<t.length;r++)if(Yg(e,t[r]))return!0;return!1}function cp(e,t,r){let i=[];for(let a=0;a<e.length;a++){let n=[];for(let i=0;i<e[a].length;i++){let s=U2(e[a][i],r);lp(t,s),n.push(s)}i.push(n)}return i}function Jg(e,t,r){let i=[];for(let a=0;a<e.length;a++){let n=cp(e[a],t,r);i.push(n)}return i}function Qg(e,t,r,i){if(e[0]<r[0]||e[0]>r[2]){let t=.5*i,a=e[0]-r[0]>t?-i:r[0]-e[0]>t?i:0;0===a&&(a=e[0]-r[2]>t?-i:r[2]-e[0]>t?i:0),e[0]+=a}lp(t,e)}function W2(e){e[0]=e[1]=1/0,e[2]=e[3]=-1/0}function Mg(e,t,r,i){let a=Math.pow(2,i.z)*yr,n=[i.x*yr,i.y*yr],s=[];for(let i of e)for(let e of i){let i=[e.x+n[0],e.y+n[1]];Qg(i,t,r,a),s.push(i)}return s}function Cg(e,t,r,i){let a=Math.pow(2,i.z)*yr,n=[i.x*yr,i.y*yr],s=[];for(let r of e){let e=[];for(let i of r){let r=[i.x+n[0],i.y+n[1]];lp(t,r),e.push(r)}s.push(e)}if(t[2]-t[0]<=a/2){W2(t);for(let e of s)for(let i of e)Qg(i,t,r,a)}return s}function X2(e,t){let r=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],a=e.canonicalID();if("Polygon"===t.type){let n=cp(t.coordinates,i,a),s=Mg(e.geometry(),r,i,a);if(!Fo(r,i))return!1;for(let e of s)if(!up(e,n))return!1}if("MultiPolygon"===t.type){let n=Jg(t.coordinates,i,a),s=Mg(e.geometry(),r,i,a);if(!Fo(r,i))return!1;for(let e of s)if(!q2(e,n))return!1}return!0}function K2(e,t){let r=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],a=e.canonicalID();if("Polygon"===t.type){let n=cp(t.coordinates,i,a),s=Cg(e.geometry(),r,i,a);if(!Fo(r,i))return!1;for(let e of s)if(!Yg(e,n))return!1}if("MultiPolygon"===t.type){let n=Jg(t.coordinates,i,a),s=Cg(e.geometry(),r,i,a);if(!Fo(r,i))return!1;for(let e of s)if(!H2(e,n))return!1}return!0}l(lp,"updateBBox"),l(O2,"mercatorXfromLng"),l(V2,"mercatorYfromLat"),l(Fo,"boxWithinBox"),l(U2,"getTileCoordinates"),l(N2,"onBoundary"),l(G2,"rayIntersect"),l(up,"pointWithinPolygon"),l(q2,"pointWithinPolygons"),l(j2,"perp"),l(Ig,"twoSided"),l(Z2,"lineIntersectLine"),l($2,"lineIntersectPolygon"),l(Yg,"lineStringWithinPolygon"),l(H2,"lineStringWithinPolygons"),l(cp,"getTilePolygon"),l(Jg,"getTilePolygons"),l(Qg,"updatePoint"),l(W2,"resetBBox"),l(Mg,"getTilePoints"),l(Cg,"getTileLines"),l(X2,"pointsWithinPolygons"),l(K2,"linesWithinPolygons");var Ei=class e{constructor(e,t){this.type=ae,this.geojson=e,this.geometries=t}static parse(t,r){if(2!==t.length)return r.error("'within' expression requires exactly one argument, but found ".concat(t.length-1," instead."));if(ko(t[1])){let r=t[1];if("FeatureCollection"===r.type)for(let t=0;t<r.features.length;++t){let i=r.features[t].geometry.type;if("Polygon"===i||"MultiPolygon"===i)return new e(r,r.features[t].geometry)}else if("Feature"===r.type){let t=r.geometry.type;if("Polygon"===t||"MultiPolygon"===t)return new e(r,r.geometry)}else if("Polygon"===r.type||"MultiPolygon"===r.type)return new e(r,r)}return r.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(null!=e.geometry()&&null!=e.canonicalID()){if("Point"===e.geometryType())return X2(e,this.geometries);if("LineString"===e.geometryType())return K2(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}};l(Ei,"Within");var jn=Ei,Xo=class e{constructor(e,t){this.type=t.type,this.name=e,this.boundExpression=t}static parse(t,r){if(2!==t.length||"string"!=typeof t[1])return r.error("'var' expression requires exactly one string literal argument.");let i=t[1];return r.scope.has(i)?new e(i,r.scope.get(i)):r.error('Unknown variable "'.concat(i,'". Make sure "').concat(i,'" has been bound in an enclosing "let" expression before using it.'),1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}};l(Xo,"Var");var Bo=Xo,$r=class e{constructor(e,t,r,i){this.name=e,this.type=t,this._evaluate=r,this.args=i}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(t,r){let i=t[0],a=e.definitions[i];if(!a)return r.error('Unknown expression "'.concat(i,'". If you wanted a literal array, use ["literal", [...]].'),0);let n=Array.isArray(a)?a[0]:a.type,s=Array.isArray(a)?[[a[1],a[2]]]:a.overloads,o=s.filter((([e])=>!Array.isArray(e)||e.length===t.length-1)),l=null;for(let[a,s]of o){l=new Do(r.registry,Ro,r.path,null,r.scope);let o=[],u=!1;for(let e=1;e<t.length;e++){let r=t[e],i=Array.isArray(a)?a[e-1]:a.type,n=l.parse(r,1+o.length,i);if(!n){u=!0;break}o.push(n)}if(!u){if(Array.isArray(a)&&a.length!==o.length){l.error("Expected ".concat(a.length," arguments, but found ").concat(o.length," instead."));continue}for(let e=0;e<o.length;e++){let t=Array.isArray(a)?a[e]:a.type,r=o[e];l.concat(e+1).checkSubtype(t,r.type)}if(0===l.errors.length)return new e(i,n,s,o)}}if(1===o.length)r.errors.push(...l.errors);else{let e=(o.length?o:s).map((([e])=>Y2(e))).join(" | "),i=[];for(let e=1;e<t.length;e++){let a=r.parse(t[e],1+i.length);if(!a)return null;i.push(Ue(a.type))}r.error("Expected arguments of type ".concat(e,", but found (").concat(i.join(", "),") instead."))}return null}static register(t,r){e.definitions=r;for(let i in r)t[i]=e}};l($r,"CompoundExpression");var jt=$r;function Y2(e){return Array.isArray(e)?"(".concat(e.map(Ue).join(", "),")"):"(".concat(Ue(e.type),"...)")}function Ro(e){if(e instanceof Bo)return Ro(e.boundExpression);if(e instanceof jt&&"error"===e.name)return!1;if(e instanceof zo)return!1;if(e instanceof jn)return!1;let t=e instanceof dr||e instanceof Ot,r=!0;return e.eachChild((e=>{r=t?r&&Ro(e):r&&e instanceof gr})),!!r&&(cs(e)&&ps(e,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"]))}function cs(e){if(e instanceof jt){if("get"===e.name&&1===e.args.length)return!1;if("feature-state"===e.name)return!1;if("has"===e.name&&1===e.args.length)return!1;if("properties"===e.name||"geometry-type"===e.name||"id"===e.name)return!1;if(/^filter-/.test(e.name))return!1}if(e instanceof jn)return!1;let t=!0;return e.eachChild((e=>{t&&!cs(e)&&(t=!1)})),t}function Zn(e){if(e instanceof jt&&"feature-state"===e.name)return!1;let t=!0;return e.eachChild((e=>{t&&!Zn(e)&&(t=!1)})),t}function ps(e,t){if(e instanceof jt&&t.indexOf(e.name)>=0)return!1;let r=!0;return e.eachChild((e=>{r&&!ps(e,t)&&(r=!1)})),r}function hs(e,t){let r,i,a=e.length-1,n=0,s=a,o=0;for(;n<=s;)if(o=Math.floor((n+s)/2),r=e[o],i=e[o+1],r<=t){if(o===a||t<i)return o;n=o+1}else{if(!(r>t))throw new Ne("Input is not a number.");s=o-1}return 0}l(Y2,"stringifySignature"),l(Ro,"isExpressionConstant"),l(cs,"isFeatureConstant"),l(Zn,"isStateConstant"),l(ps,"isGlobalPropertyConstant"),l(hs,"findStopLessThanOrEqualTo");var Ko=class e{constructor(e,t,r){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(let[e,t]of r)this.labels.push(e),this.outputs.push(t)}static parse(t,r){if(t.length-1<4)return r.error("Expected at least 4 arguments, but found only ".concat(t.length-1,"."));if((t.length-1)%2!=0)return r.error("Expected an even number of arguments.");let i=r.parse(t[1],1,q);if(!i)return null;let a=[],n=null;r.expectedType&&"value"!==r.expectedType.kind&&(n=r.expectedType);for(let e=1;e<t.length;e+=2){let i=1===e?-1/0:t[e],s=t[e+1],o=e,l=e+1;if("number"!=typeof i)return r.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',o);if(a.length&&a[a.length-1][0]>=i)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',o);let u=r.parse(s,l,n);if(!u)return null;n=n||u.type,a.push([i,u])}return new e(n,i,a)}evaluate(e){let t=this.labels,r=this.outputs;if(1===t.length)return r[0].evaluate(e);let i=this.input.evaluate(e);if(i<=t[0])return r[0].evaluate(e);let a=t.length;return i>=t[a-1]?r[a-1].evaluate(e):r[hs(t,i)].evaluate(e)}eachChild(e){e(this.input);for(let t of this.outputs)e(t)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}};l(Ko,"Step");var zi=Ko;function J2(e){return"rgb"===e||"hcl"===e||"lab"===e}function Hr(e,t,r){return e+r*(t-e)}function Q2(e,t,r,i="rgb"){switch(i){case"rgb":{let[i,a,n,s]=Oo(e.rgb,t.rgb,r);return new X(i,a,n,s,!1)}case"hcl":{let i,a,[n,s,o,l]=e.hcl,[u,c,h,p]=t.hcl;if(isNaN(n)||isNaN(u))isNaN(n)?isNaN(u)?i=NaN:(i=u,(1===o||0===o)&&(a=c)):(i=n,(1===h||0===h)&&(a=s));else{let e=u-n;u>n&&e>180?e-=360:u<n&&n-u>180&&(e+=360),i=n+r*e}let[d,f,m,y]=L2([i,null!=a?a:Hr(s,c,r),Hr(o,h,r),Hr(l,p,r)]);return new X(d,f,m,y,!1)}case"lab":{let[i,a,n,s]=Xg(Oo(e.lab,t.lab,r));return new X(i,a,n,s,!1)}}}function Oo(e,t,r){return e.map(((e,i)=>Hr(e,t[i],r)))}function eS(e,t,r){return new Vt(Oo(e.values,t.values,r))}function tS(e,t,r){let i=e.values,a=t.values;if(i.length!==a.length)throw new Ne("Cannot interpolate values of different length. from: ".concat(e.toString(),", to: ").concat(t.toString()));let n=[];for(let e=0;e<i.length;e+=2){if(i[e]!==a[e])throw new Ne("Cannot interpolate values containing mismatched anchors. from[".concat(e,"]: ").concat(i[e],", to[").concat(e,"]: ").concat(a[e]));n.push(i[e]);let[t,s]=i[e+1],[o,l]=a[e+1];n.push([Hr(t,o,r),Hr(s,l,r)])}return new er(n)}l(J2,"isSupportedInterpolationColorSpace"),l(Hr,"number"),l(Q2,"color"),l(Oo,"array"),l(eS,"padding"),l(tS,"variableAnchorOffsetCollection");var ke={number:Hr,color:Q2,array:Oo,padding:eS,variableAnchorOffsetCollection:tS},Bn=class e{constructor(e,t,r,i,a){this.type=e,this.operator=t,this.interpolation=r,this.input=i,this.labels=[],this.outputs=[];for(let[e,t]of a)this.labels.push(e),this.outputs.push(t)}static interpolationFactor(e,t,r,i){let a=0;if("exponential"===e.name)a=$c(t,e.base,r,i);else if("linear"===e.name)a=$c(t,1,r,i);else if("cubic-bezier"===e.name){let n=e.controlPoints;a=new Og.default(n[0],n[1],n[2],n[3]).solve($c(t,1,r,i))}return a}static parse(t,r){let[i,a,n,...s]=t;if(!Array.isArray(a)||0===a.length)return r.error("Expected an interpolation type expression.",1);if("linear"===a[0])a={name:"linear"};else if("exponential"===a[0]){let e=a[1];if("number"!=typeof e)return r.error("Exponential interpolation requires a numeric base.",1,1);a={name:"exponential",base:e}}else{if("cubic-bezier"!==a[0])return r.error("Unknown interpolation type ".concat(String(a[0])),1,0);{let e=a.slice(1);if(4!==e.length||e.some((e=>"number"!=typeof e||e<0||e>1)))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);a={name:"cubic-bezier",controlPoints:e}}}if(t.length-1<4)return r.error("Expected at least 4 arguments, but found only ".concat(t.length-1,"."));if((t.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(n=r.parse(n,2,q),!n)return null;let o=[],l=null;"interpolate-hcl"===i||"interpolate-lab"===i?l=zt:r.expectedType&&"value"!==r.expectedType.kind&&(l=r.expectedType);for(let e=0;e<s.length;e+=2){let t=s[e],i=s[e+1],a=e+3,n=e+4;if("number"!=typeof t)return r.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',a);if(o.length&&o[o.length-1][0]>=t)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',a);let u=r.parse(i,n,l);if(!u)return null;l=l||u.type,o.push([t,u])}return kn(l,q)||kn(l,zt)||kn(l,ls)||kn(l,us)||kn(l,wt(q))?new e(l,i,a,n,o):r.error("Type ".concat(Ue(l)," is not interpolatable."))}evaluate(t){let r=this.labels,i=this.outputs;if(1===r.length)return i[0].evaluate(t);let a=this.input.evaluate(t);if(a<=r[0])return i[0].evaluate(t);let n=r.length;if(a>=r[n-1])return i[n-1].evaluate(t);let s=hs(r,a),o=r[s],l=r[s+1],u=e.interpolationFactor(this.interpolation,a,o,l),c=i[s].evaluate(t),h=i[s+1].evaluate(t);switch(this.operator){case"interpolate":return ke[this.type.kind](c,h,u);case"interpolate-hcl":return ke.color(c,h,u,"hcl");case"interpolate-lab":return ke.color(c,h,u,"lab")}}eachChild(e){e(this.input);for(let t of this.outputs)e(t)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}};l(Bn,"Interpolate");var St=Bn;function $c(e,t,r,i){let a=i-r,n=e-r;return 0===a?0:1===t?n/a:(Math.pow(t,n)-1)/(Math.pow(t,a)-1)}l($c,"exponentialInterpolation");var Rn=class e{constructor(e,t){this.type=e,this.args=t}static parse(t,r){if(t.length<2)return r.error("Expectected at least one argument.");let i=null,a=r.expectedType;a&&"value"!==a.kind&&(i=a);let n=[];for(let e of t.slice(1)){let t=r.parse(e,1+n.length,i,void 0,{typeAnnotation:"omit"});if(!t)return null;i=i||t.type,n.push(t)}if(!i)throw new Error("No output type");return a&&n.some((e=>Un(a,e.type)))?new e(oe,n):new e(i,n)}evaluate(e){let t,r=null,i=0;for(let a of this.args)if(i++,r=a.evaluate(e),r&&r instanceof ht&&!r.available&&(t||(t=r.name),r=null,i===this.args.length&&(r=t)),null!==r)break;return r}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}};l(Rn,"Coalesce");var Vo=Rn,Yo=class e{constructor(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(let t of this.bindings)e(t[1]);e(this.result)}static parse(t,r){if(t.length<4)return r.error("Expected at least 3 arguments, but found ".concat(t.length-1," instead."));let i=[];for(let e=1;e<t.length-1;e+=2){let a=t[e];if("string"!=typeof a)return r.error("Expected string, but found ".concat(typeof a," instead."),e);if(/[^a-zA-Z0-9_]/.test(a))return r.error("Variable names must contain only alphanumeric characters or '_'.",e);let n=r.parse(t[e+1],e+1);if(!n)return null;i.push([a,n])}let a=r.parse(t[t.length-1],t.length-1,r.expectedType,i);return a?new e(i,a):null}outputDefined(){return this.result.outputDefined()}};l(Yo,"Let");var Uo=Yo,Jo=class e{constructor(e,t,r){this.type=e,this.index=t,this.input=r}static parse(t,r){if(3!==t.length)return r.error("Expected 2 arguments, but found ".concat(t.length-1," instead."));let i=r.parse(t[1],1,q),a=r.parse(t[2],2,wt(r.expectedType||oe));if(!i||!a)return null;let n=a.type;return new e(n.itemType,i,a)}evaluate(e){let t=this.index.evaluate(e),r=this.input.evaluate(e);if(t<0)throw new Ne("Array index out of bounds: ".concat(t," < 0."));if(t>=r.length)throw new Ne("Array index out of bounds: ".concat(t," > ").concat(r.length-1,"."));if(t!==Math.floor(t))throw new Ne("Array index must be an integer, but found ".concat(t," instead."));return r[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}};l(Jo,"At");var Kc=Jo,Qo=class e{constructor(e,t){this.type=ae,this.needle=e,this.haystack=t}static parse(t,r){if(3!==t.length)return r.error("Expected 2 arguments, but found ".concat(t.length-1," instead."));let i=r.parse(t[1],1,oe),a=r.parse(t[2],2,oe);return i&&a?sp(i.type,[ae,ce,q,Bi,oe])?new e(i,a):r.error("Expected first argument to be of type boolean, string, number or null, but found ".concat(Ue(i.type)," instead")):null}evaluate(e){let t=this.needle.evaluate(e),r=this.haystack.evaluate(e);if(!r)return!1;if(!Nn(t,["boolean","string","number","null"]))throw new Ne("Expected first argument to be of type boolean, string, number or null, but found ".concat(Ue(Xe(t))," instead."));if(!Nn(r,["string","array"]))throw new Ne("Expected second argument to be of type array or string, but found ".concat(Ue(Xe(r))," instead."));return r.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}};l(Qo,"In");var Yc=Qo,On=class e{constructor(e,t,r){this.type=q,this.needle=e,this.haystack=t,this.fromIndex=r}static parse(t,r){if(t.length<=2||t.length>=5)return r.error("Expected 3 or 4 arguments, but found ".concat(t.length-1," instead."));let i=r.parse(t[1],1,oe),a=r.parse(t[2],2,oe);if(!i||!a)return null;if(!sp(i.type,[ae,ce,q,Bi,oe]))return r.error("Expected first argument to be of type boolean, string, number or null, but found ".concat(Ue(i.type)," instead"));if(4===t.length){let n=r.parse(t[3],3,q);return n?new e(i,a,n):null}return new e(i,a)}evaluate(e){let t=this.needle.evaluate(e),r=this.haystack.evaluate(e);if(!Nn(t,["boolean","string","number","null"]))throw new Ne("Expected first argument to be of type boolean, string, number or null, but found ".concat(Ue(Xe(t))," instead."));if(!Nn(r,["string","array"]))throw new Ne("Expected second argument to be of type array or string, but found ".concat(Ue(Xe(r))," instead."));if(this.fromIndex){let i=this.fromIndex.evaluate(e);return r.indexOf(t,i)}return r.indexOf(t)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}};l(On,"IndexOf");var Jc=On,es=class e{constructor(e,t,r,i,a,n){this.inputType=e,this.type=t,this.input=r,this.cases=i,this.outputs=a,this.otherwise=n}static parse(t,r){if(t.length<5)return r.error("Expected at least 4 arguments, but found only ".concat(t.length-1,"."));if(t.length%2!=1)return r.error("Expected an even number of arguments.");let i,a;r.expectedType&&"value"!==r.expectedType.kind&&(a=r.expectedType);let n={},s=[];for(let e=2;e<t.length-1;e+=2){let o=t[e],l=t[e+1];Array.isArray(o)||(o=[o]);let u=r.concat(e);if(0===o.length)return u.error("Expected at least one branch label.");for(let e of o){if("number"!=typeof e&&"string"!=typeof e)return u.error("Branch labels must be numbers or strings.");if("number"==typeof e&&Math.abs(e)>Number.MAX_SAFE_INTEGER)return u.error("Branch labels must be integers no larger than ".concat(Number.MAX_SAFE_INTEGER,"."));if("number"==typeof e&&Math.floor(e)!==e)return u.error("Numeric branch labels must be integer values.");if(i){if(u.checkSubtype(i,Xe(e)))return null}else i=Xe(e);if(typeof n[String(e)]<"u")return u.error("Branch labels must be unique.");n[String(e)]=s.length}let c=r.parse(l,e,a);if(!c)return null;a=a||c.type,s.push(c)}let o=r.parse(t[1],1,oe);if(!o)return null;let l=r.parse(t[t.length-1],t.length-1,a);return!l||"value"!==o.type.kind&&r.concat(1).checkSubtype(i,o.type)?null:new e(i,a,o,n,s,l)}evaluate(e){let t=this.input.evaluate(e);return(Xe(t)===this.inputType&&this.outputs[this.cases[t]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))&&this.otherwise.outputDefined()}};l(es,"Match");var Qc=es,ts=class e{constructor(e,t,r){this.type=e,this.branches=t,this.otherwise=r}static parse(t,r){if(t.length<4)return r.error("Expected at least 3 arguments, but found only ".concat(t.length-1,"."));if(t.length%2!=0)return r.error("Expected an odd number of arguments.");let i;r.expectedType&&"value"!==r.expectedType.kind&&(i=r.expectedType);let a=[];for(let e=1;e<t.length-1;e+=2){let n=r.parse(t[e],e,ae);if(!n)return null;let s=r.parse(t[e+1],e+1,i);if(!s)return null;a.push([n,s]),i=i||s.type}let n=r.parse(t[t.length-1],t.length-1,i);if(!n)return null;if(!i)throw new Error("Can't infer output type");return new e(i,a,n)}evaluate(e){for(let[t,r]of this.branches)if(t.evaluate(e))return r.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(let[t,r]of this.branches)e(t),e(r);e(this.otherwise)}outputDefined(){return this.branches.every((([e,t])=>t.outputDefined()))&&this.otherwise.outputDefined()}};l(ts,"Case");var ep=ts,Vn=class e{constructor(e,t,r,i){this.type=e,this.input=t,this.beginIndex=r,this.endIndex=i}static parse(t,r){if(t.length<=2||t.length>=5)return r.error("Expected 3 or 4 arguments, but found ".concat(t.length-1," instead."));let i=r.parse(t[1],1,oe),a=r.parse(t[2],2,q);if(!i||!a)return null;if(!sp(i.type,[wt(oe),ce,oe]))return r.error("Expected first argument to be of type array or string, but found ".concat(Ue(i.type)," instead"));if(4===t.length){let n=r.parse(t[3],3,q);return n?new e(i.type,i,a,n):null}return new e(i.type,i,a)}evaluate(e){let t=this.input.evaluate(e),r=this.beginIndex.evaluate(e);if(!Nn(t,["string","array"]))throw new Ne("Expected first argument to be of type array or string, but found ".concat(Ue(Xe(t))," instead."));if(this.endIndex){let i=this.endIndex.evaluate(e);return t.slice(r,i)}return t.slice(r)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}};l(Vn,"Slice");var tp=Vn;function Eg(e,t){return"=="===e||"!="===e?"boolean"===t.kind||"string"===t.kind||"number"===t.kind||"null"===t.kind||"value"===t.kind:"string"===t.kind||"number"===t.kind||"value"===t.kind}function rS(e,t,r){return t===r}function iS(e,t,r){return t!==r}function nS(e,t,r){return t<r}function aS(e,t,r){return t>r}function oS(e,t,r){return t<=r}function sS(e,t,r){return t>=r}function ex(e,t,r,i){return 0===i.compare(t,r)}function lS(e,t,r,i){return!ex(e,t,r,i)}function uS(e,t,r,i){return i.compare(t,r)<0}function cS(e,t,r,i){return i.compare(t,r)>0}function pS(e,t,r,i){return i.compare(t,r)<=0}function hS(e,t,r,i){return i.compare(t,r)>=0}function Oi(e,t,r){var i;let a="=="!==e&&"!="!==e;return l(i=class{constructor(e,t,r){this.type=ae,this.lhs=e,this.rhs=t,this.collator=r,this.hasUntypedArgument="value"===e.type.kind||"value"===t.type.kind}static parse(e,t){if(3!==e.length&&4!==e.length)return t.error("Expected two or three arguments.");let r=e[0],n=t.parse(e[1],1,oe);if(!n)return null;if(!Eg(r,n.type))return t.concat(1).error('"'.concat(r,"\" comparisons are not supported for type '").concat(Ue(n.type),"'."));let s=t.parse(e[2],2,oe);if(!s)return null;if(!Eg(r,s.type))return t.concat(2).error('"'.concat(r,"\" comparisons are not supported for type '").concat(Ue(s.type),"'."));if(n.type.kind!==s.type.kind&&"value"!==n.type.kind&&"value"!==s.type.kind)return t.error("Cannot compare types '".concat(Ue(n.type),"' and '").concat(Ue(s.type),"'."));a&&("value"===n.type.kind&&"value"!==s.type.kind?n=new Ot(s.type,[n]):"value"!==n.type.kind&&"value"===s.type.kind&&(s=new Ot(n.type,[s])));let o=null;if(4===e.length){if("string"!==n.type.kind&&"string"!==s.type.kind&&"value"!==n.type.kind&&"value"!==s.type.kind)return t.error("Cannot use collator to compare non-string types.");if(o=t.parse(e[3],3,ss),!o)return null}return new i(n,s,o)}evaluate(i){let n=this.lhs.evaluate(i),s=this.rhs.evaluate(i);if(a&&this.hasUntypedArgument){let t=Xe(n),r=Xe(s);if(t.kind!==r.kind||"string"!==t.kind&&"number"!==t.kind)throw new Ne('Expected arguments for "'.concat(e,'" to be (string, string) or (number, number), but found (').concat(t.kind,", ").concat(r.kind,") instead."))}if(this.collator&&!a&&this.hasUntypedArgument){let e=Xe(n),r=Xe(s);if("string"!==e.kind||"string"!==r.kind)return t(i,n,s)}return this.collator?r(i,n,s,this.collator.evaluate(i)):t(i,n,s)}eachChild(e){e(this.lhs),e(this.rhs),this.collator&&e(this.collator)}outputDefined(){return!0}},"Comparison"),i}l(Eg,"isComparableType"),l(rS,"eq"),l(iS,"neq"),l(nS,"lt"),l(aS,"gt"),l(oS,"lteq"),l(sS,"gteq"),l(ex,"eqCollate"),l(lS,"neqCollate"),l(uS,"ltCollate"),l(cS,"gtCollate"),l(pS,"lteqCollate"),l(hS,"gteqCollate"),l(Oi,"makeComparison");var fS=Oi("==",rS,ex),mS=Oi("!=",iS,lS),dS=Oi("<",nS,uS),yS=Oi(">",aS,cS),gS=Oi("<=",oS,pS),xS=Oi(">=",sS,hS),rs=class e{constructor(e,t,r,i,a){this.type=ce,this.number=e,this.locale=t,this.currency=r,this.minFractionDigits=i,this.maxFractionDigits=a}static parse(t,r){if(3!==t.length)return r.error("Expected two arguments.");let i=r.parse(t[1],1,q);if(!i)return null;let a=t[2];if("object"!=typeof a||Array.isArray(a))return r.error("NumberFormat options argument must be an object.");let n=null;if(a.locale&&(n=r.parse(a.locale,1,ce),!n))return null;let s=null;if(a.currency&&(s=r.parse(a.currency,1,ce),!s))return null;let o=null;if(a["min-fraction-digits"]&&(o=r.parse(a["min-fraction-digits"],1,q),!o))return null;let l=null;return a["max-fraction-digits"]&&(l=r.parse(a["max-fraction-digits"],1,q),!l)?null:new e(i,n,s,o,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}};l(rs,"NumberFormat");var rp=rs,is=class e{constructor(e){this.type=Ri,this.sections=e}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let i=t[1];if(!Array.isArray(i)&&"object"==typeof i)return r.error("First argument must be an image or text section.");let a=[],n=!1;for(let e=1;e<=t.length-1;++e){let i=t[e];if(n&&"object"==typeof i&&!Array.isArray(i)){n=!1;let e=null;if(i["font-scale"]&&(e=r.parse(i["font-scale"],1,q),!e))return null;let t=null;if(i["text-font"]&&(t=r.parse(i["text-font"],1,wt(ce)),!t))return null;let s=null;if(i["text-color"]&&(s=r.parse(i["text-color"],1,zt),!s))return null;let o=a[a.length-1];o.scale=e,o.font=t,o.textColor=s}else{let i=r.parse(t[e],1,oe);if(!i)return null;let s=i.type.kind;if("string"!==s&&"value"!==s&&"null"!==s&&"resolvedImage"!==s)return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");n=!0,a.push({content:i,scale:null,font:null,textColor:null})}}return new e(a)}evaluate(e){let t=l((t=>{let r=t.content.evaluate(e);return Xe(r)===Xn?new qn("",r,null,null,null):new qn(Ln(r),null,t.scale?t.scale.evaluate(e):null,t.font?t.font.evaluate(e).join(","):null,t.textColor?t.textColor.evaluate(e):null)}),"evaluateSection");return new Pt(this.sections.map(t))}eachChild(e){for(let t of this.sections)e(t.content),t.scale&&e(t.scale),t.font&&e(t.font),t.textColor&&e(t.textColor)}outputDefined(){return!1}};l(is,"FormatExpression");var $n=is,ns=class e{constructor(e){this.type=Xn,this.input=e}static parse(t,r){if(2!==t.length)return r.error("Expected two arguments.");let i=r.parse(t[1],1,ce);return i?new e(i):r.error("No image name provided.")}evaluate(e){let t=this.input.evaluate(e),r=ht.fromString(t);return r&&e.availableImages&&(r.available=e.availableImages.indexOf(t)>-1),r}eachChild(e){e(this.input)}outputDefined(){return!1}};l(ns,"ImageExpression");var ip=ns,as=class e{constructor(e){this.type=q,this.input=e}static parse(t,r){if(2!==t.length)return r.error("Expected 1 argument, but found ".concat(t.length-1," instead."));let i=r.parse(t[1],1);return i?"array"!==i.type.kind&&"string"!==i.type.kind&&"value"!==i.type.kind?r.error("Expected argument of type string or array, but found ".concat(Ue(i.type)," instead.")):new e(i):null}evaluate(e){let t=this.input.evaluate(e);if("string"==typeof t)return t.length;if(Array.isArray(t))return t.length;throw new Ne("Expected value to be of type string or array, but found ".concat(Ue(Xe(t))," instead."))}eachChild(e){e(this.input)}outputDefined(){return!1}};l(as,"Length");var np=as,Yr={"==":fS,"!=":mS,">":yS,"<":dS,">=":xS,"<=":gS,array:Ot,at:Kc,boolean:Ot,case:ep,coalesce:Vo,collator:zo,format:$n,image:ip,in:Yc,"index-of":Jc,interpolate:St,"interpolate-hcl":St,"interpolate-lab":St,length:np,let:Uo,literal:gr,match:Qc,number:Ot,"number-format":rp,object:Ot,slice:tp,step:zi,string:Ot,"to-boolean":dr,"to-color":dr,"to-number":dr,"to-string":dr,var:Bo,within:jn};function kg(e,[t,r,i,a]){t=t.evaluate(e),r=r.evaluate(e),i=i.evaluate(e);let n=a?a.evaluate(e):1,s=Kg(t,r,i,n);if(s)throw new Ne(s);return new X(t/255,r/255,i/255,n,!1)}function Lg(e,t){return e in t}function Hc(e,t){let r=t[e];return typeof r>"u"?null:r}function bS(e,t,r,i){for(;r<=i;){let a=r+i>>1;if(t[a]===e)return!0;t[a]>e?i=a-1:r=a+1}return!1}function Zr(e){return{type:e}}function ap(e){return{result:"success",value:e}}function Ii(e){return{result:"error",value:e}}function xr(e){return"data-driven"===e["property-type"]||"cross-faded-data-driven"===e["property-type"]}function tx(e){return!!e.expression&&e.expression.parameters.indexOf("zoom")>-1}function pp(e){return!!e.expression&&e.expression.interpolated}function _e(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":null===e?"null":typeof e}function fs(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function _S(e){return e}function rx(e,t){let r,i,a,n="color"===t.type,s=e.stops&&"object"==typeof e.stops[0][0],o=s||void 0!==e.property,u=s||!o,c=e.type||(pp(t)?"exponential":"interval");if(n||"padding"===t.type){let r=n?X.parse:Vt.parse;(e=Di({},e)).stops&&(e.stops=e.stops.map((e=>[e[0],r(e[1])]))),e.default?e.default=r(e.default):e.default=r(t.default)}if(e.colorSpace&&!J2(e.colorSpace))throw new Error('Unknown color space: "'.concat(e.colorSpace,'"'));if("exponential"===c)r=Dg;else if("interval"===c)r=wS;else if("categorical"===c){r=vS,i=Object.create(null);for(let t of e.stops)i[t[0]]=t[1];a=typeof e.stops[0][0]}else{if("identity"!==c)throw new Error('Unknown function type "'.concat(c,'"'));r=SS}if(s){let r={},i=[];for(let t=0;t<e.stops.length;t++){let a=e.stops[t],n=a[0].zoom;void 0===r[n]&&(r[n]={zoom:n,type:e.type,property:e.property,default:e.default,stops:[]},i.push(n)),r[n].stops.push([a[0].value,a[1]])}let a=[];for(let e of i)a.push([r[e].zoom,rx(r[e],t)]);let n={name:"linear"};return{kind:"composite",interpolationType:n,interpolationFactor:St.interpolationFactor.bind(void 0,n),zoomStops:a.map((e=>e[0])),evaluate:({zoom:r},i)=>Dg({stops:a,base:e.base},t,r).evaluate(r,i)}}if(u){let n="exponential"===c?{name:"exponential",base:void 0!==e.base?e.base:1}:null;return{kind:"camera",interpolationType:n,interpolationFactor:St.interpolationFactor.bind(void 0,n),zoomStops:e.stops.map((e=>e[0])),evaluate:l((({zoom:n})=>r(e,t,n,i,a)),"evaluate")}}return{kind:"source",evaluate(n,s){let o=s&&s.properties?s.properties[e.property]:void 0;return void 0===o?Kn(e.default,t.default):r(e,t,o,i,a)}}}function Kn(e,t,r){return void 0!==e?e:void 0!==t?t:void 0!==r?r:void 0}function vS(e,t,r,i,a){return Kn(typeof r===a?i[r]:void 0,e.default,t.default)}function wS(e,t,r){if("number"!==_e(r))return Kn(e.default,t.default);let i=e.stops.length;if(1===i||r<=e.stops[0][0])return e.stops[0][1];if(r>=e.stops[i-1][0])return e.stops[i-1][1];let a=hs(e.stops.map((e=>e[0])),r);return e.stops[a][1]}function Dg(e,t,r){let i=void 0!==e.base?e.base:1;if("number"!==_e(r))return Kn(e.default,t.default);let a=e.stops.length;if(1===a||r<=e.stops[0][0])return e.stops[0][1];if(r>=e.stops[a-1][0])return e.stops[a-1][1];let n=hs(e.stops.map((e=>e[0])),r),s=PS(r,i,e.stops[n][0],e.stops[n+1][0]),o=e.stops[n][1],l=e.stops[n+1][1],u=ke[t.type]||_S;return"function"==typeof o.evaluate?{evaluate(...t){let r=o.evaluate.apply(void 0,t),i=l.evaluate.apply(void 0,t);if(void 0!==r&&void 0!==i)return u(r,i,s,e.colorSpace)}}:u(o,l,s,e.colorSpace)}function SS(e,t,r){switch(t.type){case"color":r=X.parse(r);break;case"formatted":r=Pt.fromString(r.toString());break;case"resolvedImage":r=ht.fromString(r.toString());break;case"padding":r=Vt.parse(r);break;default:_e(r)!==t.type&&("enum"!==t.type||!t.values[r])&&(r=void 0)}return Kn(r,e.default,t.default)}function PS(e,t,r,i){let a=i-r,n=e-r;return 0===a?0:1===t?n/a:(Math.pow(t,n)-1)/(Math.pow(t,a)-1)}l(kg,"rgba"),l(Lg,"has"),l(Hc,"get"),l(bS,"binarySearch"),l(Zr,"varargs"),jt.register(Yr,{error:[A2,[ce],(e,[t])=>{throw new Ne(t.evaluate(e))}],typeof:[ce,[oe],(e,[t])=>Ue(Xe(t.evaluate(e)))],"to-rgba":[wt(q,4),[zt],(e,[t])=>{let[r,i,a,n]=t.evaluate(e).rgb;return[255*r,255*i,255*a,n]}],rgb:[zt,[q,q,q],kg],rgba:[zt,[q,q,q,q],kg],has:{type:ae,overloads:[[[ce],(e,[t])=>Lg(t.evaluate(e),e.properties())],[[ce,ki],(e,[t,r])=>Lg(t.evaluate(e),r.evaluate(e))]]},get:{type:oe,overloads:[[[ce],(e,[t])=>Hc(t.evaluate(e),e.properties())],[[ce,ki],(e,[t,r])=>Hc(t.evaluate(e),r.evaluate(e))]]},"feature-state":[oe,[ce],(e,[t])=>Hc(t.evaluate(e),e.featureState||{})],properties:[ki,[],e=>e.properties()],"geometry-type":[ce,[],e=>e.geometryType()],id:[oe,[],e=>e.id()],zoom:[q,[],e=>e.globals.zoom],"heatmap-density":[q,[],e=>e.globals.heatmapDensity||0],"line-progress":[q,[],e=>e.globals.lineProgress||0],accumulated:[oe,[],e=>void 0===e.globals.accumulated?null:e.globals.accumulated],"+":[q,Zr(q),(e,t)=>{let r=0;for(let i of t)r+=i.evaluate(e);return r}],"*":[q,Zr(q),(e,t)=>{let r=1;for(let i of t)r*=i.evaluate(e);return r}],"-":{type:q,overloads:[[[q,q],(e,[t,r])=>t.evaluate(e)-r.evaluate(e)],[[q],(e,[t])=>-t.evaluate(e)]]},"/":[q,[q,q],(e,[t,r])=>t.evaluate(e)/r.evaluate(e)],"%":[q,[q,q],(e,[t,r])=>t.evaluate(e)%r.evaluate(e)],ln2:[q,[],()=>Math.LN2],pi:[q,[],()=>Math.PI],e:[q,[],()=>Math.E],"^":[q,[q,q],(e,[t,r])=>Math.pow(t.evaluate(e),r.evaluate(e))],sqrt:[q,[q],(e,[t])=>Math.sqrt(t.evaluate(e))],log10:[q,[q],(e,[t])=>Math.log(t.evaluate(e))/Math.LN10],ln:[q,[q],(e,[t])=>Math.log(t.evaluate(e))],log2:[q,[q],(e,[t])=>Math.log(t.evaluate(e))/Math.LN2],sin:[q,[q],(e,[t])=>Math.sin(t.evaluate(e))],cos:[q,[q],(e,[t])=>Math.cos(t.evaluate(e))],tan:[q,[q],(e,[t])=>Math.tan(t.evaluate(e))],asin:[q,[q],(e,[t])=>Math.asin(t.evaluate(e))],acos:[q,[q],(e,[t])=>Math.acos(t.evaluate(e))],atan:[q,[q],(e,[t])=>Math.atan(t.evaluate(e))],min:[q,Zr(q),(e,t)=>Math.min(...t.map((t=>t.evaluate(e))))],max:[q,Zr(q),(e,t)=>Math.max(...t.map((t=>t.evaluate(e))))],abs:[q,[q],(e,[t])=>Math.abs(t.evaluate(e))],round:[q,[q],(e,[t])=>{let r=t.evaluate(e);return r<0?-Math.round(-r):Math.round(r)}],floor:[q,[q],(e,[t])=>Math.floor(t.evaluate(e))],ceil:[q,[q],(e,[t])=>Math.ceil(t.evaluate(e))],"filter-==":[ae,[ce,oe],(e,[t,r])=>e.properties()[t.value]===r.value],"filter-id-==":[ae,[oe],(e,[t])=>e.id()===t.value],"filter-type-==":[ae,[ce],(e,[t])=>e.geometryType()===t.value],"filter-<":[ae,[ce,oe],(e,[t,r])=>{let i=e.properties()[t.value],a=r.value;return typeof i==typeof a&&i<a}],"filter-id-<":[ae,[oe],(e,[t])=>{let r=e.id(),i=t.value;return typeof r==typeof i&&r<i}],"filter->":[ae,[ce,oe],(e,[t,r])=>{let i=e.properties()[t.value],a=r.value;return typeof i==typeof a&&i>a}],"filter-id->":[ae,[oe],(e,[t])=>{let r=e.id(),i=t.value;return typeof r==typeof i&&r>i}],"filter-<=":[ae,[ce,oe],(e,[t,r])=>{let i=e.properties()[t.value],a=r.value;return typeof i==typeof a&&i<=a}],"filter-id-<=":[ae,[oe],(e,[t])=>{let r=e.id(),i=t.value;return typeof r==typeof i&&r<=i}],"filter->=":[ae,[ce,oe],(e,[t,r])=>{let i=e.properties()[t.value],a=r.value;return typeof i==typeof a&&i>=a}],"filter-id->=":[ae,[oe],(e,[t])=>{let r=e.id(),i=t.value;return typeof r==typeof i&&r>=i}],"filter-has":[ae,[oe],(e,[t])=>t.value in e.properties()],"filter-has-id":[ae,[],e=>null!==e.id()&&void 0!==e.id()],"filter-type-in":[ae,[wt(ce)],(e,[t])=>t.value.indexOf(e.geometryType())>=0],"filter-id-in":[ae,[wt(oe)],(e,[t])=>t.value.indexOf(e.id())>=0],"filter-in-small":[ae,[ce,wt(oe)],(e,[t,r])=>r.value.indexOf(e.properties()[t.value])>=0],"filter-in-large":[ae,[ce,wt(oe)],(e,[t,r])=>bS(e.properties()[t.value],r.value,0,r.value.length-1)],all:{type:ae,overloads:[[[ae,ae],(e,[t,r])=>t.evaluate(e)&&r.evaluate(e)],[Zr(ae),(e,t)=>{for(let r of t)if(!r.evaluate(e))return!1;return!0}]]},any:{type:ae,overloads:[[[ae,ae],(e,[t,r])=>t.evaluate(e)||r.evaluate(e)],[Zr(ae),(e,t)=>{for(let r of t)if(r.evaluate(e))return!0;return!1}]]},"!":[ae,[ae],(e,[t])=>!t.evaluate(e)],"is-supported-script":[ae,[ce],(e,[t])=>{let r=e.globals&&e.globals.isSupportedScript;return!r||r(t.evaluate(e))}],upcase:[ce,[ce],(e,[t])=>t.evaluate(e).toUpperCase()],downcase:[ce,[ce],(e,[t])=>t.evaluate(e).toLowerCase()],concat:[ce,Zr(oe),(e,t)=>t.map((t=>Ln(t.evaluate(e)))).join("")],"resolved-locale":[ce,[ss],(e,[t])=>t.evaluate(e).resolvedLocale()]}),l(ap,"success"),l(Ii,"error"),l(xr,"supportsPropertyExpression"),l(tx,"supportsZoomExpression"),l(pp,"supportsInterpolation"),l(_e,"getType"),l(fs,"isFunction"),l(_S,"identityFunction"),l(rx,"createFunction"),l(Kn,"coalesce$1"),l(vS,"evaluateCategoricalFunction"),l(wS,"evaluateIntervalFunction"),l(Dg,"evaluateExponentialFunction"),l(SS,"evaluateIdentityFunction"),l(PS,"interpolationFactor");var Sp=class{constructor(e,t){this.expression=e,this._warningHistory={},this._evaluator=new Lo,this._defaultValue=t?AS(t):null,this._enumValues=t&&"enum"===t.type?t.values:null}evaluateWithoutErrorHandling(e,t,r,i,a,n){return this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=r,this._evaluator.canonical=i,this._evaluator.availableImages=a||null,this._evaluator.formattedSection=n,this.expression.evaluate(this._evaluator)}evaluate(e,t,r,i,a,n){this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=r||null,this._evaluator.canonical=i,this._evaluator.availableImages=a||null,this._evaluator.formattedSection=n||null;try{let e=this.expression.evaluate(this._evaluator);if(null==e||"number"==typeof e&&e!=e)return this._defaultValue;if(this._enumValues&&!(e in this._enumValues))throw new Ne("Expected value to be one of ".concat(Object.keys(this._enumValues).map((e=>JSON.stringify(e))).join(", "),", but found ").concat(JSON.stringify(e)," instead."));return e}catch(e){return this._warningHistory[e.message]||(this._warningHistory[e.message]=!0,typeof console<"u"&&console.warn(e.message)),this._defaultValue}}};l(Sp,"StyleExpression");var Wr=Sp;function Yn(e){return Array.isArray(e)&&e.length>0&&"string"==typeof e[0]&&e[0]in Yr}function hp(e,t){let r=new Do(Yr,Ro,[],t?TS(t):void 0),i=r.parse(e,void 0,void 0,void 0,t&&"string"===t.type?{typeAnnotation:"coerce"}:void 0);return i?ap(new Wr(i,t)):Ii(r.errors)}l(Yn,"isExpression"),l(hp,"createExpression");var Pp=class{constructor(e,t){this.kind=e,this._styleExpression=t,this.isStateDependent="constant"!==e&&!Zn(t.expression)}evaluateWithoutErrorHandling(e,t,r,i,a,n){return this._styleExpression.evaluateWithoutErrorHandling(e,t,r,i,a,n)}evaluate(e,t,r,i,a,n){return this._styleExpression.evaluate(e,t,r,i,a,n)}};l(Pp,"ZoomConstantExpression");var br=Pp,Tp=class{constructor(e,t,r,i){this.kind=e,this.zoomStops=r,this._styleExpression=t,this.isStateDependent="camera"!==e&&!Zn(t.expression),this.interpolationType=i}evaluateWithoutErrorHandling(e,t,r,i,a,n){return this._styleExpression.evaluateWithoutErrorHandling(e,t,r,i,a,n)}evaluate(e,t,r,i,a,n){return this._styleExpression.evaluate(e,t,r,i,a,n)}interpolationFactor(e,t,r){return this.interpolationType?St.interpolationFactor(this.interpolationType,e,t,r):0}};l(Tp,"ZoomDependentExpression");var _r=Tp;function ix(e,t){let r=hp(e,t);if("error"===r.result)return r;let i=r.value.expression,a=cs(i);if(!a&&!xr(t))return Ii([new Lt("","data expressions not supported")]);let n=ps(i,["zoom"]);if(!n&&!tx(t))return Ii([new Lt("","zoom expressions not supported")]);let s=Eo(i);if(!s&&!n)return Ii([new Lt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(s instanceof Lt)return Ii([s]);if(s instanceof St&&!pp(t))return Ii([new Lt("",'"interpolate" expressions cannot be used with this property')]);if(!s)return ap(new br(a?"constant":"source",r.value));let o=s instanceof St?s.interpolation:void 0;return ap(new _r(a?"camera":"composite",r.value,s.labels,o))}l(ix,"createPropertyExpression");var os=class e{constructor(e,t){this._parameters=e,this._specification=t,Di(this,rx(this._parameters,this._specification))}static deserialize(t){return new e(t._parameters,t._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}};l(os,"StylePropertyFunction");var Hn=os;function nx(e,t){if(fs(e))return new Hn(e,t);if(Yn(e)){let r=ix(e,t);if("error"===r.result)throw new Error(r.value.map((e=>"".concat(e.key,": ").concat(e.message))).join(", "));return r.value}{let r=e;return"color"===t.type&&"string"==typeof e?r=X.parse(e):"padding"!==t.type||"number"!=typeof e&&!Array.isArray(e)?"variableAnchorOffsetCollection"===t.type&&Array.isArray(e)&&(r=er.parse(e)):r=Vt.parse(e),{kind:"constant",evaluate:l((()=>r),"evaluate")}}}function Eo(e){let t=null;if(e instanceof Uo)t=Eo(e.result);else if(e instanceof Vo){for(let r of e.args)if(t=Eo(r),t)break}else(e instanceof zi||e instanceof St)&&e.input instanceof jt&&"zoom"===e.input.name&&(t=e);return t instanceof Lt||e.eachChild((e=>{let r=Eo(e);r instanceof Lt?t=r:!t&&r?t=new Lt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&r&&t!==r&&(t=new Lt("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),t}function TS(e){let t={color:zt,string:ce,number:q,enum:ce,boolean:ae,formatted:Ri,padding:ls,resolvedImage:Xn,variableAnchorOffsetCollection:us};return"array"===e.type?wt(t[e.value]||oe,e.length):t[e.type]}function AS(e){return"color"===e.type&&fs(e.default)?new X(0,0,0,0):"color"===e.type?X.parse(e.default)||null:"padding"===e.type?Vt.parse(e.default)||null:"variableAnchorOffsetCollection"===e.type?er.parse(e.default)||null:void 0===e.default?null:e.default}function fp(e){if(!0===e||!1===e)return!0;if(!Array.isArray(e)||0===e.length)return!1;switch(e[0]){case"has":return e.length>=2&&"$id"!==e[1]&&"$type"!==e[1];case"in":return e.length>=3&&("string"!=typeof e[1]||Array.isArray(e[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==e.length||Array.isArray(e[1])||Array.isArray(e[2]);case"any":case"all":for(let t of e.slice(1))if(!fp(t)&&"boolean"!=typeof t)return!1;return!0;default:return!0}}l(nx,"normalizePropertyExpression"),l(Eo,"findZoomCurve"),l(TS,"getExpectedType"),l(AS,"getDefaultValue"),l(fp,"isExpressionFilter");var IS={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Jn(e){if(null==e)return{filter:l((()=>!0),"filter"),needGeometry:!1};fp(e)||(e=No(e));let t=hp(e,IS);if("error"===t.result)throw new Error(t.value.map((e=>"".concat(e.key,": ").concat(e.message))).join(", "));{let r=ax(e);return{filter:l(((e,r,i)=>t.value.evaluate(e,r,{},i)),"filter"),needGeometry:r}}}function MS(e,t){return e<t?-1:e>t?1:0}function ax(e){if(!Array.isArray(e))return!1;if("within"===e[0])return!0;for(let t=1;t<e.length;t++)if(ax(e[t]))return!0;return!1}function No(e){if(!e)return!0;let t=e[0];return e.length<=1?"any"!==t:"=="===t?Wc(e[1],e[2],"=="):"!="===t?Co(Wc(e[1],e[2],"==")):"<"===t||">"===t||"<="===t||">="===t?Wc(e[1],e[2],t):"any"===t?CS(e.slice(1)):"all"===t?["all"].concat(e.slice(1).map(No)):"none"===t?["all"].concat(e.slice(1).map(No).map(Co)):"in"===t?zg(e[1],e.slice(2)):"!in"===t?Co(zg(e[1],e.slice(2))):"has"===t?Fg(e[1]):"!has"===t?Co(Fg(e[1])):"within"!==t||e}function Wc(e,t,r){switch(e){case"$type":return["filter-type-".concat(r),t];case"$id":return["filter-id-".concat(r),t];default:return["filter-".concat(r),e,t]}}function CS(e){return["any"].concat(e.map(No))}function zg(e,t){if(0===t.length)return!1;switch(e){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some((e=>typeof e!=typeof t[0]))?["filter-in-large",e,["literal",t.sort(MS)]]:["filter-in-small",e,["literal",t]]}}function Fg(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function Co(e){return["!",e]}function ox(){let e={},t=M.$version;for(let r in M.$root){let i=M.$root[r];if(i.required){let a=null;a="version"===r?t:"array"===i.type?[]:{},null!=a&&(e[r]=a)}}return e}function sx(e){let t=e.key,r=e.value;return r?[new U(t,r,"constants have been deprecated as of v8")]:[]}function We(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function Xr(e){if(Array.isArray(e))return e.map(Xr);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){let t={};for(let r in e)t[r]=Xr(e[r]);return t}return We(e)}function Dt(e){let t=e.key,r=e.value,i=e.valueSpec||{},a=e.objectElementValidators||{},n=e.style,s=e.styleSpec,o=e.validateSpec,l=[],u=_e(r);if("object"!==u)return[new U(t,r,"object expected, ".concat(u," found"))];for(let e in r){let u,c=e.split(".")[0],h=i[c]||i["*"];if(a[c])u=a[c];else if(i[c])u=o;else if(a["*"])u=a["*"];else{if(!i["*"]){l.push(new U(t,r[e],'unknown property "'.concat(e,'"')));continue}u=o}l=l.concat(u({key:(t&&"".concat(t,"."))+e,value:r[e],valueSpec:h,style:n,styleSpec:s,object:r,objectKey:e,validateSpec:o},r))}for(let e in i)a[e]||i[e].required&&void 0===i[e].default&&void 0===r[e]&&l.push(new U(t,r,'missing required property "'.concat(e,'"')));return l}function mp(e){let t=e.value,r=e.valueSpec,i=e.validateSpec,a=e.style,n=e.styleSpec,s=e.key,o=e.arrayElementValidator||i;if("array"!==_e(t))return[new U(s,t,"array expected, ".concat(_e(t)," found"))];if(r.length&&t.length!==r.length)return[new U(s,t,"array length ".concat(r.length," expected, length ").concat(t.length," found"))];if(r["min-length"]&&t.length<r["min-length"])return[new U(s,t,"array length at least ".concat(r["min-length"]," expected, length ").concat(t.length," found"))];let l={type:r.value,values:r.values};n.$version<7&&(l.function=r.function),"object"===_e(r.value)&&(l=r.value);let u=[];for(let r=0;r<t.length;r++)u=u.concat(o({array:t,arrayIndex:r,value:t[r],valueSpec:l,validateSpec:e.validateSpec,style:a,styleSpec:n,key:"".concat(s,"[").concat(r,"]")}));return u}function dp(e){let t=e.key,r=e.value,i=e.valueSpec,a=_e(r);return"number"===a&&r!=r&&(a="NaN"),"number"!==a?[new U(t,r,"number expected, ".concat(a," found"))]:"minimum"in i&&r<i.minimum?[new U(t,r,"".concat(r," is less than the minimum value ").concat(i.minimum))]:"maximum"in i&&r>i.maximum?[new U(t,r,"".concat(r," is greater than the maximum value ").concat(i.maximum))]:[]}function lx(e){let t,r,i,a=e.valueSpec,n=We(e.value.type),s={},o="categorical"!==n&&void 0===e.value.property,l=!o,u="array"===_e(e.value.stops)&&"array"===_e(e.value.stops[0])&&"object"===_e(e.value.stops[0][0]),c=Dt({key:e.key,value:e.value,valueSpec:e.styleSpec.function,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{stops:h,default:f}});return"identity"===n&&o&&c.push(new U(e.key,e.value,'missing required property "property"')),"identity"!==n&&!e.value.stops&&c.push(new U(e.key,e.value,'missing required property "stops"')),"exponential"===n&&e.valueSpec.expression&&!pp(e.valueSpec)&&c.push(new U(e.key,e.value,"exponential functions not supported")),e.styleSpec.$version>=8&&(l&&!xr(e.valueSpec)?c.push(new U(e.key,e.value,"property functions not supported")):o&&!tx(e.valueSpec)&&c.push(new U(e.key,e.value,"zoom functions not supported"))),("categorical"===n||u)&&void 0===e.value.property&&c.push(new U(e.key,e.value,'"property" property is required')),c;function h(e){if("identity"===n)return[new U(e.key,e.value,'identity function may not have a "stops" property')];let t=[],r=e.value;return t=t.concat(mp({key:e.key,value:r,valueSpec:e.valueSpec,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,arrayElementValidator:p})),"array"===_e(r)&&0===r.length&&t.push(new U(e.key,r,"array must have at least one stop")),t}function p(e){let t=[],n=e.value,o=e.key;if("array"!==_e(n))return[new U(o,n,"array expected, ".concat(_e(n)," found"))];if(2!==n.length)return[new U(o,n,"array length 2 expected, length ".concat(n.length," found"))];if(u){if("object"!==_e(n[0]))return[new U(o,n,"object expected, ".concat(_e(n[0])," found"))];if(void 0===n[0].zoom)return[new U(o,n,"object stop key must have zoom")];if(void 0===n[0].value)return[new U(o,n,"object stop key must have value")];if(i&&i>We(n[0].zoom))return[new U(o,n[0].zoom,"stop zoom values must appear in ascending order")];We(n[0].zoom)!==i&&(i=We(n[0].zoom),r=void 0,s={}),t=t.concat(Dt({key:"".concat(o,"[0]"),value:n[0],valueSpec:{zoom:{}},validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{zoom:dp,value:d}}))}else t=t.concat(d({key:"".concat(o,"[0]"),value:n[0],valueSpec:{},validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec},n));return Yn(Xr(n[1]))?t.concat([new U("".concat(o,"[1]"),n[1],"expressions are not allowed in function stops.")]):t.concat(e.validateSpec({key:"".concat(o,"[1]"),value:n[1],valueSpec:a,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec}))}function d(e,i){let o=_e(e.value),l=We(e.value),u=null!==e.value?e.value:i;if(t){if(o!==t)return[new U(e.key,u,"".concat(o," stop domain type must match previous stop domain type ").concat(t))]}else t=o;if("number"!==o&&"string"!==o&&"boolean"!==o)return[new U(e.key,u,"stop domain value must be a number, string, or boolean")];if("number"!==o&&"categorical"!==n){let t="number expected, ".concat(o," found");return xr(a)&&void 0===n&&(t+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new U(e.key,u,t)]}return"categorical"!==n||"number"!==o||isFinite(l)&&Math.floor(l)===l?"categorical"!==n&&"number"===o&&void 0!==r&&l<r?[new U(e.key,u,"stop domain values must appear in ascending order")]:(r=l,"categorical"===n&&l in s?[new U(e.key,u,"stop domain values must be unique")]:(s[l]=!0,[])):[new U(e.key,u,"integer expected, found ".concat(l))]}function f(e){return e.validateSpec({key:e.key,value:e.value,valueSpec:a,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec})}}function Fi(e){let t=("property"===e.expressionContext?ix:hp)(Xr(e.value),e.valueSpec);if("error"===t.result)return t.value.map((t=>new U("".concat(e.key).concat(t.key),e.value,t.message)));let r=t.value.expression||t.value._styleExpression.expression;if("property"===e.expressionContext&&"text-font"===e.propertyKey&&!r.outputDefined())return[new U(e.key,e.value,'Invalid data expression for "'.concat(e.propertyKey,'". Output values must be contained as literals within the expression.'))];if("property"===e.expressionContext&&"layout"===e.propertyType&&!Zn(r))return[new U(e.key,e.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===e.expressionContext&&!Zn(r))return[new U(e.key,e.value,'"feature-state" data expressions are not supported with filters.')];if(e.expressionContext&&0===e.expressionContext.indexOf("cluster")){if(!ps(r,["zoom","feature-state"]))return[new U(e.key,e.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===e.expressionContext&&!cs(r))return[new U(e.key,e.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function ES(e){let t=e.value,r=e.key,i=_e(t);return"boolean"!==i?[new U(r,t,"boolean expected, ".concat(i," found"))]:[]}function kS(e){let t=e.key,r=e.value,i=_e(r);return"string"!==i?[new U(t,r,"color expected, ".concat(i," found"))]:X.parse(String(r))?[]:[new U(t,r,'color expected, "'.concat(r,'" found'))]}function Wn(e){let t=e.key,r=e.value,i=e.valueSpec,a=[];return Array.isArray(i.values)?-1===i.values.indexOf(We(r))&&a.push(new U(t,r,"expected one of [".concat(i.values.join(", "),"], ").concat(JSON.stringify(r)," found"))):-1===Object.keys(i.values).indexOf(We(r))&&a.push(new U(t,r,"expected one of [".concat(Object.keys(i.values).join(", "),"], ").concat(JSON.stringify(r)," found"))),a}function yp(e){return fp(Xr(e.value))?Fi(Di({},e,{expressionContext:"filter",valueSpec:{value:"boolean"}})):ux(e)}function ux(e){let t=e.value,r=e.key;if("array"!==_e(t))return[new U(r,t,"array expected, ".concat(_e(t)," found"))];let i,a=e.styleSpec,n=[];if(t.length<1)return[new U(r,t,"filter array must have at least 1 element")];switch(n=n.concat(Wn({key:"".concat(r,"[0]"),value:t[0],valueSpec:a.filter_operator,style:e.style,styleSpec:e.styleSpec})),We(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&"$type"===We(t[1])&&n.push(new U(r,t,'"$type" cannot be use with operator "'.concat(t[0],'"')));case"==":case"!=":3!==t.length&&n.push(new U(r,t,'filter array for operator "'.concat(t[0],'" must have 3 elements')));case"in":case"!in":t.length>=2&&(i=_e(t[1]),"string"!==i&&n.push(new U("".concat(r,"[1]"),t[1],"string expected, ".concat(i," found"))));for(let s=2;s<t.length;s++)i=_e(t[s]),"$type"===We(t[1])?n=n.concat(Wn({key:"".concat(r,"[").concat(s,"]"),value:t[s],valueSpec:a.geometry_type,style:e.style,styleSpec:e.styleSpec})):"string"!==i&&"number"!==i&&"boolean"!==i&&n.push(new U("".concat(r,"[").concat(s,"]"),t[s],"string, number, or boolean expected, ".concat(i," found")));break;case"any":case"all":case"none":for(let i=1;i<t.length;i++)n=n.concat(ux({key:"".concat(r,"[").concat(i,"]"),value:t[i],style:e.style,styleSpec:e.styleSpec}));break;case"has":case"!has":i=_e(t[1]),2!==t.length?n.push(new U(r,t,'filter array for "'.concat(t[0],'" operator must have 2 elements'))):"string"!==i&&n.push(new U("".concat(r,"[1]"),t[1],"string expected, ".concat(i," found")));break;case"within":i=_e(t[1]),2!==t.length?n.push(new U(r,t,'filter array for "'.concat(t[0],'" operator must have 2 elements'))):"object"!==i&&n.push(new U("".concat(r,"[1]"),t[1],"object expected, ".concat(i," found")))}return n}function cx(e,t){let r=e.key,i=e.validateSpec,a=e.style,n=e.styleSpec,s=e.value,o=e.objectKey,l=n["".concat(t,"_").concat(e.layerType)];if(!l)return[];let u=o.match(/^(.*)-transition$/);if("paint"===t&&u&&l[u[1]]&&l[u[1]].transition)return i({key:r,value:s,valueSpec:n.transition,style:a,styleSpec:n});let c,h=e.valueSpec||l[o];if(!h)return[new U(r,s,'unknown property "'.concat(o,'"'))];if("string"===_e(s)&&xr(h)&&!h.tokens&&(c=/^{([^}]+)}$/.exec(s)))return[new U(r,s,'"'.concat(o,'" does not support interpolation syntax\n')+'Use an identity property function instead: `{ "type": "identity", "property": '.concat(JSON.stringify(c[1])," }`."))];let p=[];return"symbol"===e.layerType&&("text-field"===o&&a&&!a.glyphs&&p.push(new U(r,s,'use of "text-field" requires a style "glyphs" property')),"text-font"===o&&fs(Xr(s))&&"identity"===We(s.type)&&p.push(new U(r,s,'"text-font" does not support identity functions'))),p.concat(i({key:e.key,value:s,valueSpec:h,style:a,styleSpec:n,expressionContext:"property",propertyType:t,propertyKey:o}))}function px(e){return cx(e,"paint")}function hx(e){return cx(e,"layout")}function fx(e){let t=[],r=e.value,i=e.key,a=e.style,n=e.styleSpec;!r.type&&!r.ref&&t.push(new U(i,r,'either "type" or "ref" is required'));let s=We(r.type),o=We(r.ref);if(r.id){let n=We(r.id);for(let s=0;s<e.arrayIndex;s++){let e=a.layers[s];We(e.id)===n&&t.push(new U(i,r.id,'duplicate layer id "'.concat(r.id,'", previously used at line ').concat(e.id.__line__)))}}if("ref"in r){let e;["type","source","source-layer","filter","layout"].forEach((e=>{e in r&&t.push(new U(i,r[e],'"'.concat(e,'" is prohibited for ref layers')))})),a.layers.forEach((t=>{We(t.id)===o&&(e=t)})),e?e.ref?t.push(new U(i,r.ref,"ref cannot reference another ref layer")):s=We(e.type):t.push(new U(i,r.ref,'ref layer "'.concat(o,'" not found')))}else if("background"!==s)if(r.source){let e=a.sources&&a.sources[r.source],n=e&&We(e.type);e?"vector"===n&&"raster"===s?t.push(new U(i,r.source,'layer "'.concat(r.id,'" requires a raster source'))):"raster"===n&&"raster"!==s?t.push(new U(i,r.source,'layer "'.concat(r.id,'" requires a vector source'))):"vector"!==n||r["source-layer"]?"raster-dem"===n&&"hillshade"!==s?t.push(new U(i,r.source,"raster-dem source can only be used with layer type 'hillshade'.")):"line"===s&&r.paint&&r.paint["line-gradient"]&&("geojson"!==n||!e.lineMetrics)&&t.push(new U(i,r,'layer "'.concat(r.id,'" specifies a line-gradient, which requires a GeoJSON source with `lineMetrics` enabled.'))):t.push(new U(i,r,'layer "'.concat(r.id,'" must specify a "source-layer"'))):t.push(new U(i,r.source,'source "'.concat(r.source,'" not found')))}else t.push(new U(i,r,'missing required property "source"'));return t=t.concat(Dt({key:i,value:r,valueSpec:n.layer,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":()=>[],type:()=>e.validateSpec({key:"".concat(i,".type"),value:r.type,valueSpec:n.layer.type,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,object:r,objectKey:"type"}),filter:yp,layout:e=>Dt({layer:r,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":e=>hx(Di({layerType:s},e))}}),paint:e=>Dt({layer:r,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":e=>px(Di({layerType:s},e))}})}})),t}function Kr(e){let t=e.value,r=e.key,i=_e(t);return"string"!==i?[new U(r,t,"string expected, ".concat(i," found"))]:[]}l(Jn,"createFilter"),l(MS,"compare"),l(ax,"geometryNeeded"),l(No,"convertFilter$1"),l(Wc,"convertComparisonOp$1"),l(CS,"convertDisjunctionOp"),l(zg,"convertInOp$1"),l(Fg,"convertHasOp$1"),l(Co,"convertNegation"),l(ox,"emptyStyle"),l(sx,"validateConstants"),l(We,"unbundle"),l(Xr,"deepUnbundle"),l(Dt,"validateObject"),l(mp,"validateArray"),l(dp,"validateNumber"),l(lx,"validateFunction"),l(Fi,"validateExpression"),l(ES,"validateBoolean"),l(kS,"validateColor"),l(Wn,"validateEnum"),l(yp,"validateFilter"),l(ux,"validateNonExpressionFilter"),l(cx,"validateProperty"),l(px,"validatePaintProperty"),l(hx,"validateLayoutProperty"),l(fx,"validateLayer"),l(Kr,"validateString");var Bg={promoteId:LS};function mx(e){let t=e.value,r=e.key,i=e.styleSpec,a=e.style,n=e.validateSpec;if(!t.type)return[new U(r,t,'"type" is required')];let s,o=We(t.type);switch(o){case"vector":case"raster":case"raster-dem":return s=Dt({key:r,value:t,valueSpec:i["source_".concat(o.replace("-","_"))],style:e.style,styleSpec:i,objectElementValidators:Bg,validateSpec:n}),s;case"geojson":if(s=Dt({key:r,value:t,valueSpec:i.source_geojson,style:a,styleSpec:i,validateSpec:n,objectElementValidators:Bg}),t.cluster)for(let e in t.clusterProperties){let[i,a]=t.clusterProperties[e],o="string"==typeof i?[i,["accumulated"],["get",e]]:i;s.push(...Fi({key:"".concat(r,".").concat(e,".map"),value:a,validateSpec:n,expressionContext:"cluster-map"})),s.push(...Fi({key:"".concat(r,".").concat(e,".reduce"),value:o,validateSpec:n,expressionContext:"cluster-reduce"}))}return s;case"video":return Dt({key:r,value:t,valueSpec:i.source_video,style:a,validateSpec:n,styleSpec:i});case"image":return Dt({key:r,value:t,valueSpec:i.source_image,style:a,validateSpec:n,styleSpec:i});case"canvas":return[new U(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Wn({key:"".concat(r,".type"),value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:a,validateSpec:n,styleSpec:i})}}function LS({key:e,value:t}){if("string"===_e(t))return Kr({key:e,value:t});{let r=[];for(let i in t)r.push(...Kr({key:"".concat(e,".").concat(i),value:t[i]}));return r}}function dx(e){let t=e.value,r=e.styleSpec,i=r.light,a=e.style,n=[],s=_e(t);if(void 0===t)return n;if("object"!==s)return n=n.concat([new U("light",t,"object expected, ".concat(s," found"))]),n;for(let s in t){let o=s.match(/^(.*)-transition$/);n=o&&i[o[1]]&&i[o[1]].transition?n.concat(e.validateSpec({key:s,value:t[s],valueSpec:r.transition,validateSpec:e.validateSpec,style:a,styleSpec:r})):i[s]?n.concat(e.validateSpec({key:s,value:t[s],valueSpec:i[s],validateSpec:e.validateSpec,style:a,styleSpec:r})):n.concat([new U(s,t[s],'unknown property "'.concat(s,'"'))])}return n}function yx(e){let t=e.value,r=e.styleSpec,i=r.terrain,a=e.style,n=[],s=_e(t);if(void 0===t)return n;if("object"!==s)return n=n.concat([new U("terrain",t,"object expected, ".concat(s," found"))]),n;for(let s in t)n=i[s]?n.concat(e.validateSpec({key:s,value:t[s],valueSpec:i[s],validateSpec:e.validateSpec,style:a,styleSpec:r})):n.concat([new U(s,t[s],'unknown property "'.concat(s,'"'))]);return n}function DS(e){return 0===Kr(e).length?[]:Fi(e)}function zS(e){return 0===Kr(e).length?[]:Fi(e)}function FS(e){let t=e.key,r=e.value;if("array"===_e(r)){if(r.length<1||r.length>4)return[new U(t,r,"padding requires 1 to 4 values; ".concat(r.length," values found"))];let i={type:"number"},a=[];for(let n=0;n<r.length;n++)a=a.concat(e.validateSpec({key:"".concat(t,"[").concat(n,"]"),value:r[n],validateSpec:e.validateSpec,valueSpec:i}));return a}return dp({key:t,value:r,valueSpec:{}})}function BS(e){let t=e.key,r=e.value,i=_e(r),a=e.styleSpec;if("array"!==i||r.length<1||r.length%2!=0)return[new U(t,r,"variableAnchorOffsetCollection requires a non-empty array of even length")];let n=[];for(let i=0;i<r.length;i+=2)n=n.concat(Wn({key:"".concat(t,"[").concat(i,"]"),value:r[i],valueSpec:a.layout_symbol["text-anchor"]})),n=n.concat(mp({key:"".concat(t,"[").concat(i+1,"]"),value:r[i+1],valueSpec:{length:2,value:"number"},validateSpec:e.validateSpec,style:e.style,styleSpec:a}));return n}function gx(e){let t=[],r=e.value,i=e.key;if(Array.isArray(r)){let a=[],n=[];for(let s in r){r[s].id&&a.includes(r[s].id)&&t.push(new U(i,r,"all the sprites' ids must be unique, but ".concat(r[s].id," is duplicated"))),a.push(r[s].id),r[s].url&&n.includes(r[s].url)&&t.push(new U(i,r,"all the sprites' URLs must be unique, but ".concat(r[s].url," is duplicated"))),n.push(r[s].url);let o={id:{type:"string",required:!0},url:{type:"string",required:!0}};t=t.concat(Dt({key:"".concat(i,"[").concat(s,"]"),value:r[s],valueSpec:o,validateSpec:e.validateSpec}))}return t}return Kr({key:i,value:r})}l(mx,"validateSource"),l(LS,"validatePromoteId"),l(dx,"validateLight"),l(yx,"validateTerrain"),l(DS,"validateFormatted"),l(zS,"validateImage"),l(FS,"validatePadding"),l(BS,"validateVariableAnchorOffsetCollection"),l(gx,"validateSprite");var Rg={"*":()=>[],array:mp,boolean:ES,number:dp,color:kS,constants:sx,enum:Wn,filter:yp,function:lx,layer:fx,object:Dt,source:mx,light:dx,terrain:yx,string:Kr,formatted:DS,resolvedImage:zS,padding:FS,variableAnchorOffsetCollection:BS,sprite:gx};function Dn(e){let t=e.value,r=e.valueSpec,i=e.styleSpec;return e.validateSpec=Dn,r.expression&&fs(We(t))?lx(e):r.expression&&Yn(Xr(t))?Fi(e):r.type&&Rg[r.type]?Rg[r.type](e):Dt(Di({},e,{valueSpec:r.type?i[r.type]:r}))}function xx(e){let t=e.value,r=e.key,i=Kr(e);return i.length||(-1===t.indexOf("{fontstack}")&&i.push(new U(r,t,'"glyphs" url must include a "{fontstack}" token')),-1===t.indexOf("{range}")&&i.push(new U(r,t,'"glyphs" url must include a "{range}" token'))),i}function Ut(e,t=M){let r=[];return r=r.concat(Dn({key:"",value:e,valueSpec:t.$root,styleSpec:t,style:e,validateSpec:Dn,objectElementValidators:{glyphs:xx,"*":()=>[]}})),e.constants&&(r=r.concat(sx({key:"constants",value:e.constants,style:e,styleSpec:t,validateSpec:Dn}))),bx(r)}function tr(e){return function(t){return e({...t,validateSpec:Dn})}}function bx(e){return[].concat(e).sort(((e,t)=>e.line-t.line))}function rr(e){return function(...t){return bx(e.apply(this,t))}}l(Dn,"validate"),l(xx,"validateGlyphsUrl"),l(Ut,"validateStyleMin"),Ut.source=rr(tr(mx)),Ut.sprite=rr(tr(gx)),Ut.glyphs=rr(tr(xx)),Ut.light=rr(tr(dx)),Ut.terrain=rr(tr(yx)),Ut.layer=rr(tr(fx)),Ut.filter=rr(tr(yp)),Ut.paintProperty=rr(tr(px)),Ut.layoutProperty=rr(tr(hx)),l(tr,"injectValidateSpec"),l(bx,"sortErrors"),l(rr,"wrapCleanErrors"),d();var je=Ut,Ok=je.source,_x=je.light,Vk=je.terrain,Uk=je.filter,vx=je.paintProperty,wx=je.layoutProperty;function Vi(e,t){let r=!1;if(t&&t.length)for(let i of t)e.fire(new H(new Error(i.message))),r=!0;return r}l(Vi,"emitValidationErrors"),d(),d(),d();var ms=class e{constructor(e,t,r){let i=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;let a=new Int32Array(this.arrayBuffer);e=a[0],t=a[1],r=a[2],this.d=t+2*r;for(let e=0;e<this.d*this.d;e++){let t=a[3+e],r=a[3+e+1];i.push(t===r?null:a.subarray(t,r))}let n=a[3+i.length],s=a[3+i.length+1];this.keys=a.subarray(n,s),this.bboxes=a.subarray(s),this.insert=this._insertReadonly}else{this.d=t+2*r;for(let e=0;e<this.d*this.d;e++)i.push([]);this.keys=[],this.bboxes=[]}this.n=t,this.extent=e,this.padding=r,this.scale=t/e,this.uid=0;let a=r/t*e;this.min=-a,this.max=e+a}insert(e,t,r,i,a){this._forEachCell(t,r,i,a,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(t),this.bboxes.push(r),this.bboxes.push(i),this.bboxes.push(a)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,t,r,i,a,n){this.cells[a].push(n)}query(e,t,r,i,a){let n=this.min,s=this.max;if(e<=n&&t<=n&&s<=r&&s<=i&&!a)return Array.prototype.slice.call(this.keys);{let n=[],s={};return this._forEachCell(e,t,r,i,this._queryCell,n,s,a),n}}_queryCell(e,t,r,i,a,n,s,o){let l=this.cells[a];if(null!==l){let a=this.keys,u=this.bboxes;for(let c=0;c<l.length;c++){let h=l[c];if(void 0===s[h]){let l=4*h;(o?o(u[l+0],u[l+1],u[l+2],u[l+3]):e<=u[l+2]&&t<=u[l+3]&&r>=u[l+0]&&i>=u[l+1])?(s[h]=!0,n.push(a[h])):s[h]=!1}}}}_forEachCell(e,t,r,i,a,n,s,o){let l=this._convertToCellCoord(e),u=this._convertToCellCoord(t),c=this._convertToCellCoord(r),h=this._convertToCellCoord(i);for(let p=l;p<=c;p++)for(let l=u;l<=h;l++){let u=this.d*l+p;if((!o||o(this._convertFromCellCoord(p),this._convertFromCellCoord(l),this._convertFromCellCoord(p+1),this._convertFromCellCoord(l+1)))&&a.call(this,e,t,r,i,u,n,s,o))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let e=this.cells,t=3+this.cells.length+1+1,r=0;for(let e=0;e<this.cells.length;e++)r+=this.cells[e].length;let i=new Int32Array(t+r+this.keys.length+this.bboxes.length);i[0]=this.extent,i[1]=this.n,i[2]=this.padding;let a=t;for(let t=0;t<e.length;t++){let r=e[t];i[3+t]=a,i.set(r,a),a+=r.length}return i[3+e.length]=a,i.set(this.keys,a),a+=this.keys.length,i[3+e.length+1]=a,i.set(this.bboxes,a),a+=this.bboxes.length,i.buffer}static serialize(e,t){let r=e.toArrayBuffer();return t&&t.push(r),{buffer:r}}static deserialize(t){return new e(t.buffer)}};l(ms,"TransferableGridIndex");var Jr=ms,vr={};function N(e,t,r={}){if(vr[e])throw new Error("".concat(e," is already registered."));Object.defineProperty(t,"_classRegistryKey",{value:e,writeable:!1}),vr[e]={klass:t,omit:r.omit||[],shallow:r.shallow||[]}}l(N,"register"),N("Object",Object),N("TransferableGridIndex",Jr),N("Color",X),N("Error",Error),N("AJAXError",fr),N("ResolvedImage",ht),N("StylePropertyFunction",Hn),N("StyleExpression",Wr,{omit:["_evaluator"]}),N("ZoomDependentExpression",_r),N("ZoomConstantExpression",br),N("CompoundExpression",jt,{omit:["_evaluate"]});for(let e in Yr)Yr[e]._classRegistryKey||N("Expression_".concat(e),Yr[e]);function Sx(e){return e&&typeof ArrayBuffer<"u"&&(e instanceof ArrayBuffer||e.constructor&&"ArrayBuffer"===e.constructor.name)}function Ui(e,t){if(null==e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||e instanceof Blob)return e;if(Sx(e)||kt(e))return t&&t.push(e),e;if(ArrayBuffer.isView(e)){let r=e;return t&&t.push(r.buffer),r}if(e instanceof ImageData)return t&&t.push(e.data.buffer),e;if(Array.isArray(e)){let r=[];for(let i of e)r.push(Ui(i,t));return r}if("object"==typeof e){let r=e.constructor,i=r._classRegistryKey;if(!i)throw new Error("can't serialize object of unregistered class");if(!vr[i])throw new Error("".concat(i," is not registered."));let a=r.serialize?r.serialize(e,t):{};if(r.serialize){if(t&&a===t[t.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(let r in e){if(!e.hasOwnProperty(r)||vr[i].omit.indexOf(r)>=0)continue;let n=e[r];a[r]=vr[i].shallow.indexOf(r)>=0?n:Ui(n,t)}e instanceof Error&&(a.message=e.message)}if(a.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==i&&(a.$name=i),a}throw new Error("can't serialize object of type ".concat(typeof e))}function Ni(e){if(null==e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||e instanceof Blob||Sx(e)||kt(e)||ArrayBuffer.isView(e)||e instanceof ImageData)return e;if(Array.isArray(e))return e.map(Ni);if("object"==typeof e){let t=e.$name||"Object";if(!vr[t])throw new Error("can't deserialize unregistered class ".concat(t));let{klass:r}=vr[t];if(!r)throw new Error("can't deserialize unregistered class ".concat(t));if(r.deserialize)return r.deserialize(e);let i=Object.create(r.prototype);for(let r of Object.keys(e)){if("$name"===r)continue;let a=e[r];i[r]=vr[t].shallow.indexOf(r)>=0?a:Ni(a)}return i}throw new Error("can't deserialize object of type ".concat(typeof e))}l(Sx,"isArrayBuffer"),l(Ui,"serialize"),l(Ni,"deserialize"),d(),d();var Ap=class{constructor(){this.first=!0}update(e,t){let r=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=r,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=r,!0):(this.lastFloorZoom>r?(this.lastIntegerZoom=r+1,this.lastIntegerZoomTime=t):this.lastFloorZoom<r&&(this.lastIntegerZoom=r,this.lastIntegerZoomTime=t),e!==this.lastZoom&&(this.lastZoom=e,this.lastFloorZoom=r,!0))}};l(Ap,"ZoomHistory");var Gi=Ap;d(),d();var pe={"Latin-1 Supplement":l((e=>e>=128&&e<=255),"Latin-1 Supplement"),Arabic:l((e=>e>=1536&&e<=1791),"Arabic"),"Arabic Supplement":l((e=>e>=1872&&e<=1919),"Arabic Supplement"),"Arabic Extended-A":l((e=>e>=2208&&e<=2303),"Arabic Extended-A"),"Hangul Jamo":l((e=>e>=4352&&e<=4607),"Hangul Jamo"),"Unified Canadian Aboriginal Syllabics":l((e=>e>=5120&&e<=5759),"Unified Canadian Aboriginal Syllabics"),Khmer:l((e=>e>=6016&&e<=6143),"Khmer"),"Unified Canadian Aboriginal Syllabics Extended":l((e=>e>=6320&&e<=6399),"Unified Canadian Aboriginal Syllabics Extended"),"General Punctuation":l((e=>e>=8192&&e<=8303),"General Punctuation"),"Letterlike Symbols":l((e=>e>=8448&&e<=8527),"Letterlike Symbols"),"Number Forms":l((e=>e>=8528&&e<=8591),"Number Forms"),"Miscellaneous Technical":l((e=>e>=8960&&e<=9215),"Miscellaneous Technical"),"Control Pictures":l((e=>e>=9216&&e<=9279),"Control Pictures"),"Optical Character Recognition":l((e=>e>=9280&&e<=9311),"Optical Character Recognition"),"Enclosed Alphanumerics":l((e=>e>=9312&&e<=9471),"Enclosed Alphanumerics"),"Geometric Shapes":l((e=>e>=9632&&e<=9727),"Geometric Shapes"),"Miscellaneous Symbols":l((e=>e>=9728&&e<=9983),"Miscellaneous Symbols"),"Miscellaneous Symbols and Arrows":l((e=>e>=11008&&e<=11263),"Miscellaneous Symbols and Arrows"),"CJK Radicals Supplement":l((e=>e>=11904&&e<=12031),"CJK Radicals Supplement"),"Kangxi Radicals":l((e=>e>=12032&&e<=12255),"Kangxi Radicals"),"Ideographic Description Characters":l((e=>e>=12272&&e<=12287),"Ideographic Description Characters"),"CJK Symbols and Punctuation":l((e=>e>=12288&&e<=12351),"CJK Symbols and Punctuation"),Hiragana:l((e=>e>=12352&&e<=12447),"Hiragana"),Katakana:l((e=>e>=12448&&e<=12543),"Katakana"),Bopomofo:l((e=>e>=12544&&e<=12591),"Bopomofo"),"Hangul Compatibility Jamo":l((e=>e>=12592&&e<=12687),"Hangul Compatibility Jamo"),Kanbun:l((e=>e>=12688&&e<=12703),"Kanbun"),"Bopomofo Extended":l((e=>e>=12704&&e<=12735),"Bopomofo Extended"),"CJK Strokes":l((e=>e>=12736&&e<=12783),"CJK Strokes"),"Katakana Phonetic Extensions":l((e=>e>=12784&&e<=12799),"Katakana Phonetic Extensions"),"Enclosed CJK Letters and Months":l((e=>e>=12800&&e<=13055),"Enclosed CJK Letters and Months"),"CJK Compatibility":l((e=>e>=13056&&e<=13311),"CJK Compatibility"),"CJK Unified Ideographs Extension A":l((e=>e>=13312&&e<=19903),"CJK Unified Ideographs Extension A"),"Yijing Hexagram Symbols":l((e=>e>=19904&&e<=19967),"Yijing Hexagram Symbols"),"CJK Unified Ideographs":l((e=>e>=19968&&e<=40959),"CJK Unified Ideographs"),"Yi Syllables":l((e=>e>=40960&&e<=42127),"Yi Syllables"),"Yi Radicals":l((e=>e>=42128&&e<=42191),"Yi Radicals"),"Hangul Jamo Extended-A":l((e=>e>=43360&&e<=43391),"Hangul Jamo Extended-A"),"Hangul Syllables":l((e=>e>=44032&&e<=55215),"Hangul Syllables"),"Hangul Jamo Extended-B":l((e=>e>=55216&&e<=55295),"Hangul Jamo Extended-B"),"Private Use Area":l((e=>e>=57344&&e<=63743),"Private Use Area"),"CJK Compatibility Ideographs":l((e=>e>=63744&&e<=64255),"CJK Compatibility Ideographs"),"Arabic Presentation Forms-A":l((e=>e>=64336&&e<=65023),"Arabic Presentation Forms-A"),"Vertical Forms":l((e=>e>=65040&&e<=65055),"Vertical Forms"),"CJK Compatibility Forms":l((e=>e>=65072&&e<=65103),"CJK Compatibility Forms"),"Small Form Variants":l((e=>e>=65104&&e<=65135),"Small Form Variants"),"Arabic Presentation Forms-B":l((e=>e>=65136&&e<=65279),"Arabic Presentation Forms-B"),"Halfwidth and Fullwidth Forms":l((e=>e>=65280&&e<=65519),"Halfwidth and Fullwidth Forms")};function Ip(e){for(let t of e)if(Px(t.charCodeAt(0)))return!0;return!1}function Px(e){return 746===e||747===e||!(e<4352)&&!(!(pe["Bopomofo Extended"](e)||pe.Bopomofo(e)||pe["CJK Compatibility Forms"](e)&&!(e>=65097&&e<=65103)||pe["CJK Compatibility Ideographs"](e)||pe["CJK Compatibility"](e)||pe["CJK Radicals Supplement"](e)||pe["CJK Strokes"](e)||pe["CJK Symbols and Punctuation"](e)&&!(e>=12296&&e<=12305)&&!(e>=12308&&e<=12319)&&12336!==e||pe["CJK Unified Ideographs Extension A"](e)||pe["CJK Unified Ideographs"](e)||pe["Enclosed CJK Letters and Months"](e)||pe["Hangul Compatibility Jamo"](e)||pe["Hangul Jamo Extended-A"](e)||pe["Hangul Jamo Extended-B"](e)||pe["Hangul Jamo"](e)||pe["Hangul Syllables"](e)||pe.Hiragana(e)||pe["Ideographic Description Characters"](e)||pe.Kanbun(e)||pe["Kangxi Radicals"](e)||pe["Katakana Phonetic Extensions"](e)||pe.Katakana(e)&&12540!==e)&&(!pe["Halfwidth and Fullwidth Forms"](e)||65288===e||65289===e||65293===e||e>=65306&&e<=65310||65339===e||65341===e||65343===e||e>=65371&&e<=65503||65507===e||e>=65512&&e<=65519)&&(!pe["Small Form Variants"](e)||e>=65112&&e<=65118||e>=65123&&e<=65126)&&!pe["Unified Canadian Aboriginal Syllabics"](e)&&!pe["Unified Canadian Aboriginal Syllabics Extended"](e)&&!pe["Vertical Forms"](e)&&!pe["Yijing Hexagram Symbols"](e)&&!pe["Yi Syllables"](e)&&!pe["Yi Radicals"](e))}function Tx(e){return e>=1424&&e<=2303||pe["Arabic Presentation Forms-A"](e)||pe["Arabic Presentation Forms-B"](e)}function RS(e,t){return!(!t&&Tx(e)||e>=2304&&e<=3583||e>=3840&&e<=4255||pe.Khmer(e))}function Ax(e){for(let t of e)if(Tx(t.charCodeAt(0)))return!0;return!1}function Ix(e,t){for(let r of e)if(!RS(r.charCodeAt(0),t))return!1;return!0}l(Ip,"allowsVerticalWritingMode"),l(Px,"charHasUprightVerticalOrientation"),l(Tx,"charInRTLScript"),l(RS,"charInSupportedScript"),l(Ax,"stringContainsRTLText"),l(Ix,"isStringInSupportedScript"),d();var Nt={unavailable:"unavailable",deferred:"deferred",loading:"loading",loaded:"loaded",error:"error"},Mp=null,ft=Nt.unavailable,wr=null,Ep=l((function(e){e&&"string"==typeof e&&e.indexOf("NetworkError")>-1&&(ft=Nt.error),Mp&&Mp(e)}),"triggerPluginCompletionEvent");function Cp(){ds.fire(new z("pluginStateChange",{pluginStatus:ft,pluginURL:wr}))}l(Cp,"sendPluginStateToWorker");var ds=new de,Qn=l((function(){return ft}),"getRTLTextPluginStatus"),Mx=l((function(e){return e({pluginStatus:ft,pluginURL:wr}),ds.on("pluginStateChange",e),e}),"registerForPluginStateChange"),Cx=l((function(e,t,r=!1){if(ft===Nt.deferred||ft===Nt.loading||ft===Nt.loaded)throw new Error("setRTLTextPlugin cannot be called multiple times.");wr=ne.resolveURL(e),ft=Nt.deferred,Mp=t,Cp(),r||Ex()}),"setRTLTextPlugin"),Ex=l((function(){if(ft!==Nt.deferred||!wr)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");ft=Nt.loading,Cp(),wr&&Po({url:wr},(e=>{e?Ep(e):(ft=Nt.loaded,Cp())}))}),"downloadRTLTextPlugin"),mt={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>ft===Nt.loaded||null!=mt.applyArabicShaping,isLoading:()=>ft===Nt.loading,setState(e){if(!pt())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");ft=e.pluginStatus,wr=e.pluginURL},isParsed(){if(!pt())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return null!=mt.applyArabicShaping&&null!=mt.processBidirectionalText&&null!=mt.processStyledBidirectionalText},getPluginURL(){if(!pt())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return wr}},kx=l((function(){!mt.isLoading()&&!mt.isLoaded()&&"deferred"===Qn()&&Ex()}),"lazyLoadRTLTextPlugin"),kp=class{constructor(e,t){this.zoom=e,t?(this.now=t.now,this.fadeDuration=t.fadeDuration,this.zoomHistory=t.zoomHistory,this.transition=t.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Gi,this.transition={})}isSupportedScript(e){return Ix(e,mt.isLoaded())}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let e=this.zoom,t=e-Math.floor(e),r=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:t+(1-t)*r}:{fromScale:.5,toScale:1,t:1-(1-r)*t}}};l(kp,"EvaluationParameters");var ye=kp,Lp=class{constructor(e,t){this.property=e,this.value=t,this.expression=nx(void 0===t?e.specification.default:t,e.specification)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(e,t,r){return this.property.possiblyEvaluate(this,e,t,r)}};l(Lp,"PropertyValue");var qi=Lp,Dp=class{constructor(e){this.property=e,this.value=new qi(e,void 0)}transitioned(e,t){return new ys(this.property,this.value,t,R({},e.transition,this.transition),e.now)}untransitioned(){return new ys(this.property,this.value,null,{},0)}};l(Dp,"TransitionablePropertyValue");var ea=Dp,zp=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return ct(this._values[e].value.value)}setValue(e,t){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new ea(this._values[e].property)),this._values[e].value=new qi(this._values[e].property,null===t?void 0:ct(t))}getTransition(e){return ct(this._values[e].transition)}setTransition(e,t){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new ea(this._values[e].property)),this._values[e].transition=ct(t)||void 0}serialize(){let e={};for(let t of Object.keys(this._values)){let r=this.getValue(t);void 0!==r&&(e[t]=r);let i=this.getTransition(t);void 0!==i&&(e["".concat(t,"-transition")]=i)}return e}transitioned(e,t){let r=new gs(this._properties);for(let i of Object.keys(this._values))r._values[i]=this._values[i].transitioned(e,t._values[i]);return r}untransitioned(){let e=new gs(this._properties);for(let t of Object.keys(this._values))e._values[t]=this._values[t].untransitioned();return e}};l(zp,"Transitionable");var ji=zp,Fp=class{constructor(e,t,r,i,a){this.property=e,this.value=t,this.begin=a+i.delay||0,this.end=this.begin+i.duration||0,e.specification.transition&&(i.delay||i.duration)&&(this.prior=r)}possiblyEvaluate(e,t,r){let i=e.now||0,a=this.value.possiblyEvaluate(e,t,r),n=this.prior;if(n){if(i>this.end)return this.prior=null,a;if(this.value.isDataDriven())return this.prior=null,a;if(i<this.begin)return n.possiblyEvaluate(e,t,r);{let s=(i-this.begin)/(this.end-this.begin);return this.property.interpolate(n.possiblyEvaluate(e,t,r),a,og(s))}}return a}};l(Fp,"TransitioningPropertyValue");var ys=Fp,Bp=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,t,r){let i=new Sr(this._properties);for(let a of Object.keys(this._values))i._values[a]=this._values[a].possiblyEvaluate(e,t,r);return i}hasTransition(){for(let e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}};l(Bp,"Transitioning");var gs=Bp,Rp=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}getValue(e){return ct(this._values[e].value)}setValue(e,t){this._values[e]=new qi(this._values[e].property,null===t?void 0:ct(t))}serialize(){let e={};for(let t of Object.keys(this._values)){let r=this.getValue(t);void 0!==r&&(e[t]=r)}return e}possiblyEvaluate(e,t,r){let i=new Sr(this._properties);for(let a of Object.keys(this._values))i._values[a]=this._values[a].possiblyEvaluate(e,t,r);return i}};l(Rp,"Layout");var xs=Rp,Op=class{constructor(e,t,r){this.property=e,this.value=t,this.parameters=r}isConstant(){return"constant"===this.value.kind}constantOr(e){return"constant"===this.value.kind?this.value.value:e}evaluate(e,t,r,i){return this.property.evaluate(this.value,this.parameters,e,t,r,i)}};l(Op,"PossiblyEvaluatedPropertyValue");var ot=Op,Vp=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}};l(Vp,"PossiblyEvaluated");var Sr=Vp,Up=class{constructor(e){this.specification=e}possiblyEvaluate(e,t){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(t)}interpolate(e,t,r){let i=this.specification.type,a=ke[i];return a?a(e,t,r):e}};l(Up,"DataConstantProperty");var Z=Up,Np=class{constructor(e,t){this.specification=e,this.overrides=t}possiblyEvaluate(e,t,r,i){return"constant"===e.expression.kind||"camera"===e.expression.kind?new ot(this,{kind:"constant",value:e.expression.evaluate(t,null,{},r,i)},t):new ot(this,e.expression,t)}interpolate(e,t,r){if("constant"!==e.value.kind||"constant"!==t.value.kind)return e;if(void 0===e.value.value||void 0===t.value.value)return new ot(this,{kind:"constant",value:void 0},e.parameters);let i=this.specification.type,a=ke[i];if(a){let i=a(e.value.value,t.value.value,r);return new ot(this,{kind:"constant",value:i},e.parameters)}return e}evaluate(e,t,r,i,a,n){return"constant"===e.kind?e.value:e.evaluate(t,r,i,a,n)}};l(Np,"DataDrivenProperty");var W=Np,Gp=class extends W{possiblyEvaluate(e,t,r,i){if(void 0===e.value)return new ot(this,{kind:"constant",value:void 0},t);if("constant"===e.expression.kind){let a=e.expression.evaluate(t,null,{},r,i),n="resolvedImage"===e.property.specification.type&&"string"!=typeof a?a.name:a,s=this._calculate(n,n,n,t);return new ot(this,{kind:"constant",value:s},t)}if("camera"===e.expression.kind){let r=this._calculate(e.expression.evaluate({zoom:t.zoom-1}),e.expression.evaluate({zoom:t.zoom}),e.expression.evaluate({zoom:t.zoom+1}),t);return new ot(this,{kind:"constant",value:r},t)}return new ot(this,e.expression,t)}evaluate(e,t,r,i,a,n){if("source"===e.kind){let s=e.evaluate(t,r,i,a,n);return this._calculate(s,s,s,t)}return"composite"===e.kind?this._calculate(e.evaluate({zoom:Math.floor(t.zoom)-1},r,i),e.evaluate({zoom:Math.floor(t.zoom)},r,i),e.evaluate({zoom:Math.floor(t.zoom)+1},r,i),t):e.value}_calculate(e,t,r,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:r,to:t}}interpolate(e){return e}};l(Gp,"CrossFadedDataDrivenProperty");var ir=Gp,qp=class{constructor(e){this.specification=e}possiblyEvaluate(e,t,r,i){if(void 0!==e.value){if("constant"===e.expression.kind){let a=e.expression.evaluate(t,null,{},r,i);return this._calculate(a,a,a,t)}return this._calculate(e.expression.evaluate(new ye(Math.floor(t.zoom-1),t)),e.expression.evaluate(new ye(Math.floor(t.zoom),t)),e.expression.evaluate(new ye(Math.floor(t.zoom+1),t)),t)}}_calculate(e,t,r,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:r,to:t}}interpolate(e){return e}};l(qp,"CrossFadedProperty");var Qr=qp,jp=class{constructor(e){this.specification=e}possiblyEvaluate(e,t,r,i){return!!e.expression.evaluate(t,null,{},r,i)}interpolate(){return!1}};l(jp,"ColorRampProperty");var ei=jp,Zp=class{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let t in e){let r=e[t];r.specification.overridable&&this.overridableProperties.push(t);let i=this.defaultPropertyValues[t]=new qi(r,void 0),a=this.defaultTransitionablePropertyValues[t]=new ea(r);this.defaultTransitioningPropertyValues[t]=a.untransitioned(),this.defaultPossiblyEvaluatedValues[t]=i.possiblyEvaluate({})}}};l(Zp,"Properties");var Re=Zp;N("DataDrivenProperty",W),N("DataConstantProperty",Z),N("CrossFadedDataDrivenProperty",ir),N("CrossFadedProperty",Qr),N("ColorRampProperty",ei);var bs="-transition",$p=class extends de{constructor(e,t){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:l((()=>!0),"filter"),needGeometry:!1},"custom"!==e.type&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,"background"!==e.type&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),t.layout&&(this._unevaluatedLayout=new xs(t.layout)),t.paint)){this._transitionablePaint=new ji(t.paint);for(let t in e.paint)this.setPaintProperty(t,e.paint[t],{validate:!1});for(let t in e.layout)this.setLayoutProperty(t,e.layout[t],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Sr(t.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return"visibility"===e?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,t,r={}){if(null!=t){let i="layers.".concat(this.id,".layout.").concat(e);if(this._validate(wx,i,e,t,r))return}"visibility"!==e?this._unevaluatedLayout.setValue(e,t):this.visibility=t}getPaintProperty(e){return e.endsWith(bs)?this._transitionablePaint.getTransition(e.slice(0,-bs.length)):this._transitionablePaint.getValue(e)}setPaintProperty(e,t,r={}){if(null!=t){let i="layers.".concat(this.id,".paint.").concat(e);if(this._validate(vx,i,e,t,r))return!1}if(e.endsWith(bs))return this._transitionablePaint.setTransition(e.slice(0,-bs.length),t||void 0),!1;{let r=this._transitionablePaint._values[e],i="cross-faded-data-driven"===r.property.specification["property-type"],a=r.value.isDataDriven(),n=r.value;this._transitionablePaint.setValue(e,t),this._handleSpecialPaintPropertyUpdate(e);let s=this._transitionablePaint._values[e].value;return s.isDataDriven()||a||i||this._handleOverridablePaintPropertyUpdate(e,n,s)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,t,r){return!1}isHidden(e){return!!(this.minzoom&&e<this.minzoom||this.maxzoom&&e>=this.maxzoom)||"none"===this.visibility}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,t){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,t)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,t)}serialize(){let e={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),vo(e,((e,t)=>!(void 0===e||"layout"===t&&!Object.keys(e).length||"paint"===t&&!Object.keys(e).length)))}_validate(e,t,r,i,a={}){return(!a||!1!==a.validate)&&Vi(this,e.call(je,{key:t,layerType:this.type,objectKey:r,value:i,styleSpec:M,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let e in this.paint._values){let t=this.paint.get(e);if(t instanceof ot&&xr(t.property.specification)&&("source"===t.value.kind||"composite"===t.value.kind)&&t.value.isStateDependent)return!0}return!1}};l($p,"StyleLayer");var Ze=$p;d(),d(),d();var OS={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},Hp=class{constructor(e,t){this._structArray=e,this._pos1=t*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}};l(Hp,"Struct");var ti=Hp,VS=128,US=5,Wp=class{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,t){return e._trim(),t&&(e.isTransferred=!0,t.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){let t=Object.create(this.prototype);return t.arrayBuffer=e.arrayBuffer,t.length=e.length,t.capacity=e.arrayBuffer.byteLength/t.bytesPerElement,t._refreshViews(),t}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(this.capacity*US),VS),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let t=this.uint8;this._refreshViews(),t&&this.uint8.set(t)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}};l(Wp,"StructArray");var Ve=Wp;function ve(e,t=1){let r=0,i=0;return{members:e.map((e=>{let a=NS(e.type),n=r=Lx(r,Math.max(t,a)),s=e.components||1;return i=Math.max(i,a),r+=a*s,{name:e.name,type:e.type,components:s,offset:n}})),size:Lx(r,Math.max(i,t)),alignment:t}}function NS(e){return OS[e].BYTES_PER_ELEMENT}function Lx(e,t){return Math.ceil(e/t)*t}l(ve,"createLayout"),l(NS,"sizeOf"),l(Lx,"align");var Dx=se(Pe(),1),Xp=class extends Ve{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t){let r=this.length;return this.resize(r+1),this.emplace(r,e,t)}emplace(e,t,r){let i=2*e;return this.int16[i+0]=t,this.int16[i+1]=r,e}};l(Xp,"StructArrayLayout2i4");var ri=Xp;ri.prototype.bytesPerElement=4,N("StructArrayLayout2i4",ri);var Kp=class extends Ve{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r){let i=this.length;return this.resize(i+1),this.emplace(i,e,t,r)}emplace(e,t,r,i){let a=3*e;return this.int16[a+0]=t,this.int16[a+1]=r,this.int16[a+2]=i,e}};l(Kp,"StructArrayLayout3i6");var Zi=Kp;Zi.prototype.bytesPerElement=6,N("StructArrayLayout3i6",Zi);var Yp=class extends Ve{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,i){let a=this.length;return this.resize(a+1),this.emplace(a,e,t,r,i)}emplace(e,t,r,i,a){let n=4*e;return this.int16[n+0]=t,this.int16[n+1]=r,this.int16[n+2]=i,this.int16[n+3]=a,e}};l(Yp,"StructArrayLayout4i8");var ta=Yp;ta.prototype.bytesPerElement=8,N("StructArrayLayout4i8",ta);var Jp=class extends Ve{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,a,n){let s=this.length;return this.resize(s+1),this.emplace(s,e,t,r,i,a,n)}emplace(e,t,r,i,a,n,s){let o=6*e;return this.int16[o+0]=t,this.int16[o+1]=r,this.int16[o+2]=i,this.int16[o+3]=a,this.int16[o+4]=n,this.int16[o+5]=s,e}};l(Jp,"StructArrayLayout2i4i12");var ra=Jp;ra.prototype.bytesPerElement=12,N("StructArrayLayout2i4i12",ra);var Qp=class extends Ve{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,a,n){let s=this.length;return this.resize(s+1),this.emplace(s,e,t,r,i,a,n)}emplace(e,t,r,i,a,n,s){let o=4*e,l=8*e;return this.int16[o+0]=t,this.int16[o+1]=r,this.uint8[l+4]=i,this.uint8[l+5]=a,this.uint8[l+6]=n,this.uint8[l+7]=s,e}};l(Qp,"StructArrayLayout2i4ub8");var ia=Qp;ia.prototype.bytesPerElement=8,N("StructArrayLayout2i4ub8",ia);var eh=class extends Ve{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t){let r=this.length;return this.resize(r+1),this.emplace(r,e,t)}emplace(e,t,r){let i=2*e;return this.float32[i+0]=t,this.float32[i+1]=r,e}};l(eh,"StructArrayLayout2f8");var Pr=eh;Pr.prototype.bytesPerElement=8,N("StructArrayLayout2f8",Pr);var th=class extends Ve{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,a,n,s,o,l,u){let c=this.length;return this.resize(c+1),this.emplace(c,e,t,r,i,a,n,s,o,l,u)}emplace(e,t,r,i,a,n,s,o,l,u,c){let h=10*e;return this.uint16[h+0]=t,this.uint16[h+1]=r,this.uint16[h+2]=i,this.uint16[h+3]=a,this.uint16[h+4]=n,this.uint16[h+5]=s,this.uint16[h+6]=o,this.uint16[h+7]=l,this.uint16[h+8]=u,this.uint16[h+9]=c,e}};l(th,"StructArrayLayout10ui20");var na=th;na.prototype.bytesPerElement=20,N("StructArrayLayout10ui20",na);var rh=class extends Ve{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,a,n,s,o,l,u,c,h){let p=this.length;return this.resize(p+1),this.emplace(p,e,t,r,i,a,n,s,o,l,u,c,h)}emplace(e,t,r,i,a,n,s,o,l,u,c,h,p){let d=12*e;return this.int16[d+0]=t,this.int16[d+1]=r,this.int16[d+2]=i,this.int16[d+3]=a,this.uint16[d+4]=n,this.uint16[d+5]=s,this.uint16[d+6]=o,this.uint16[d+7]=l,this.int16[d+8]=u,this.int16[d+9]=c,this.int16[d+10]=h,this.int16[d+11]=p,e}};l(rh,"StructArrayLayout4i4ui4i24");var aa=rh;aa.prototype.bytesPerElement=24,N("StructArrayLayout4i4ui4i24",aa);var ih=class extends Ve{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r){let i=this.length;return this.resize(i+1),this.emplace(i,e,t,r)}emplace(e,t,r,i){let a=3*e;return this.float32[a+0]=t,this.float32[a+1]=r,this.float32[a+2]=i,e}};l(ih,"StructArrayLayout3f12");var oa=ih;oa.prototype.bytesPerElement=12,N("StructArrayLayout3f12",oa);var nh=class extends Ve{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){let t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){let r=1*e;return this.uint32[r+0]=t,e}};l(nh,"StructArrayLayout1ul4");var sa=nh;sa.prototype.bytesPerElement=4,N("StructArrayLayout1ul4",sa);var ah=class extends Ve{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,a,n,s,o,l){let u=this.length;return this.resize(u+1),this.emplace(u,e,t,r,i,a,n,s,o,l)}emplace(e,t,r,i,a,n,s,o,l,u){let c=10*e,h=5*e;return this.int16[c+0]=t,this.int16[c+1]=r,this.int16[c+2]=i,this.int16[c+3]=a,this.int16[c+4]=n,this.int16[c+5]=s,this.uint32[h+3]=o,this.uint16[c+8]=l,this.uint16[c+9]=u,e}};l(ah,"StructArrayLayout6i1ul2ui20");var la=ah;la.prototype.bytesPerElement=20,N("StructArrayLayout6i1ul2ui20",la);var oh=class extends Ve{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,a,n){let s=this.length;return this.resize(s+1),this.emplace(s,e,t,r,i,a,n)}emplace(e,t,r,i,a,n,s){let o=6*e;return this.int16[o+0]=t,this.int16[o+1]=r,this.int16[o+2]=i,this.int16[o+3]=a,this.int16[o+4]=n,this.int16[o+5]=s,e}};l(oh,"StructArrayLayout2i2i2i12");var ua=oh;ua.prototype.bytesPerElement=12,N("StructArrayLayout2i2i2i12",ua);var sh=class extends Ve{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,a){let n=this.length;return this.resize(n+1),this.emplace(n,e,t,r,i,a)}emplace(e,t,r,i,a,n){let s=4*e,o=8*e;return this.float32[s+0]=t,this.float32[s+1]=r,this.float32[s+2]=i,this.int16[o+6]=a,this.int16[o+7]=n,e}};l(sh,"StructArrayLayout2f1f2i16");var ca=sh;ca.prototype.bytesPerElement=16,N("StructArrayLayout2f1f2i16",ca);var lh=class extends Ve{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r,i){let a=this.length;return this.resize(a+1),this.emplace(a,e,t,r,i)}emplace(e,t,r,i,a){let n=12*e,s=3*e;return this.uint8[n+0]=t,this.uint8[n+1]=r,this.float32[s+1]=i,this.float32[s+2]=a,e}};l(lh,"StructArrayLayout2ub2f12");var pa=lh;pa.prototype.bytesPerElement=12,N("StructArrayLayout2ub2f12",pa);var uh=class extends Ve{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,r){let i=this.length;return this.resize(i+1),this.emplace(i,e,t,r)}emplace(e,t,r,i){let a=3*e;return this.uint16[a+0]=t,this.uint16[a+1]=r,this.uint16[a+2]=i,e}};l(uh,"StructArrayLayout3ui6");var $i=uh;$i.prototype.bytesPerElement=6,N("StructArrayLayout3ui6",$i);var ch=class extends Ve{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r,i,a,n,s,o,l,u,c,h,p,d,f,m,y){let g=this.length;return this.resize(g+1),this.emplace(g,e,t,r,i,a,n,s,o,l,u,c,h,p,d,f,m,y)}emplace(e,t,r,i,a,n,s,o,l,u,c,h,p,d,f,m,y,g){let _=24*e,x=12*e,v=48*e;return this.int16[_+0]=t,this.int16[_+1]=r,this.uint16[_+2]=i,this.uint16[_+3]=a,this.uint32[x+2]=n,this.uint32[x+3]=s,this.uint32[x+4]=o,this.uint16[_+10]=l,this.uint16[_+11]=u,this.uint16[_+12]=c,this.float32[x+7]=h,this.float32[x+8]=p,this.uint8[v+36]=d,this.uint8[v+37]=f,this.uint8[v+38]=m,this.uint32[x+10]=y,this.int16[_+22]=g,e}};l(ch,"StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48");var ha=ch;ha.prototype.bytesPerElement=48,N("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",ha);var ph=class extends Ve{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r,i,a,n,s,o,l,u,c,h,p,d,f,m,y,g,_,x,v,b,w,S,A,I,M,T){let P=this.length;return this.resize(P+1),this.emplace(P,e,t,r,i,a,n,s,o,l,u,c,h,p,d,f,m,y,g,_,x,v,b,w,S,A,I,M,T)}emplace(e,t,r,i,a,n,s,o,l,u,c,h,p,d,f,m,y,g,_,x,v,b,w,S,A,I,M,T,P){let C=34*e,E=17*e;return this.int16[C+0]=t,this.int16[C+1]=r,this.int16[C+2]=i,this.int16[C+3]=a,this.int16[C+4]=n,this.int16[C+5]=s,this.int16[C+6]=o,this.int16[C+7]=l,this.uint16[C+8]=u,this.uint16[C+9]=c,this.uint16[C+10]=h,this.uint16[C+11]=p,this.uint16[C+12]=d,this.uint16[C+13]=f,this.uint16[C+14]=m,this.uint16[C+15]=y,this.uint16[C+16]=g,this.uint16[C+17]=_,this.uint16[C+18]=x,this.uint16[C+19]=v,this.uint16[C+20]=b,this.uint16[C+21]=w,this.uint16[C+22]=S,this.uint32[E+12]=A,this.float32[E+13]=I,this.float32[E+14]=M,this.float32[E+15]=T,this.float32[E+16]=P,e}};l(ph,"StructArrayLayout8i15ui1ul4f68");var fa=ph;fa.prototype.bytesPerElement=68,N("StructArrayLayout8i15ui1ul4f68",fa);var hh=class extends Ve{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){let t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){let r=1*e;return this.float32[r+0]=t,e}};l(hh,"StructArrayLayout1f4");var ii=hh;ii.prototype.bytesPerElement=4,N("StructArrayLayout1f4",ii);var fh=class extends Ve{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,r){let i=this.length;return this.resize(i+1),this.emplace(i,e,t,r)}emplace(e,t,r,i){let a=2*e,n=4*e;return this.uint32[a+0]=t,this.uint16[n+2]=r,this.uint16[n+3]=i,e}};l(fh,"StructArrayLayout1ul2ui8");var ma=fh;ma.prototype.bytesPerElement=8,N("StructArrayLayout1ul2ui8",ma);var mh=class extends Ve{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t){let r=this.length;return this.resize(r+1),this.emplace(r,e,t)}emplace(e,t,r){let i=2*e;return this.uint16[i+0]=t,this.uint16[i+1]=r,e}};l(mh,"StructArrayLayout2ui4");var da=mh;da.prototype.bytesPerElement=4,N("StructArrayLayout2ui4",da);var dh=class extends Ve{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){let t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){let r=1*e;return this.uint16[r+0]=t,e}};l(dh,"StructArrayLayout1ui2");var ya=dh;ya.prototype.bytesPerElement=2,N("StructArrayLayout1ui2",ya);var yh=class extends Ve{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r,i){let a=this.length;return this.resize(a+1),this.emplace(a,e,t,r,i)}emplace(e,t,r,i,a){let n=4*e;return this.float32[n+0]=t,this.float32[n+1]=r,this.float32[n+2]=i,this.float32[n+3]=a,e}};l(yh,"StructArrayLayout4f16");var Hi=yh;Hi.prototype.bytesPerElement=16,N("StructArrayLayout4f16",Hi);var gh=class extends ti{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 Dx.default(this.anchorPointX,this.anchorPointY)}};l(gh,"CollisionBoxStruct");var _s=gh;_s.prototype.size=20;var xh=class extends la{get(e){return new _s(this,e)}};l(xh,"CollisionBoxArray");var ga=xh;N("CollisionBoxArray",ga);var bh=class extends ti{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}};l(bh,"PlacedSymbolStruct");var vs=bh;vs.prototype.size=48;var _h=class extends ha{get(e){return new vs(this,e)}};l(_h,"PlacedSymbolArray");var xa=_h;N("PlacedSymbolArray",xa);var vh=class extends ti{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 textOffset0(){return this._structArray.float32[this._pos4+14]}get textOffset1(){return this._structArray.float32[this._pos4+15]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+16]}};l(vh,"SymbolInstanceStruct");var ws=vh;ws.prototype.size=68;var wh=class extends fa{get(e){return new ws(this,e)}};l(wh,"SymbolInstanceArray");var ba=wh;N("SymbolInstanceArray",ba);var Sh=class extends ii{getoffsetX(e){return this.float32[1*e+0]}};l(Sh,"GlyphOffsetArray");var _a=Sh;N("GlyphOffsetArray",_a);var Ph=class extends Zi{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}};l(Ph,"SymbolLineVertexArray");var va=Ph;N("SymbolLineVertexArray",va);var Th=class extends ti{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}};l(Th,"FeatureIndexStruct");var Ss=Th;Ss.prototype.size=8;var Ah=class extends ma{get(e){return new Ss(this,e)}};l(Ah,"FeatureIndexArray");var wa=Ah;N("FeatureIndexArray",wa);var Ih=class extends ri{};l(Ih,"PosArray");var Tr=Ih,Mh=class extends Zi{};l(Mh,"Pos3dArray");var Ps=Mh,Ch=class extends ta{};l(Ch,"RasterBoundsArray");var Wi=Ch,Eh=class extends ri{};l(Eh,"CircleLayoutArray");var Ts=Eh,kh=class extends ri{};l(kh,"FillLayoutArray");var As=kh,Lh=class extends ra{};l(Lh,"FillExtrusionLayoutArray");var Is=Lh,Dh=class extends ia{};l(Dh,"LineLayoutArray");var Ms=Dh,zh=class extends Pr{};l(zh,"LineExtLayoutArray");var Cs=zh,Fh=class extends na{};l(Fh,"PatternLayoutArray");var nr=Fh,Bh=class extends aa{};l(Bh,"SymbolLayoutArray");var Es=Bh,Rh=class extends oa{};l(Rh,"SymbolDynamicLayoutArray");var ks=Rh,Oh=class extends sa{};l(Oh,"SymbolOpacityArray");var Ls=Oh,Vh=class extends ua{};l(Vh,"CollisionBoxLayoutArray");var Sa=Vh,Uh=class extends ca{};l(Uh,"CollisionCircleLayoutArray");var Ds=Uh,Nh=class extends pa{};l(Nh,"CollisionVertexArray");var zs=Nh,Gh=class extends $i{};l(Gh,"QuadTriangleArray");var Fs=Gh,qh=class extends $i{};l(qh,"TriangleIndexArray");var at=qh,jh=class extends da{};l(jh,"LineIndexArray");var Ar=jh,Zh=class extends ya{};l(Zh,"LineStripIndexArray");var Pa=Zh;d();var GS=ve([{name:"a_pos",components:2,type:"Int16"}],4),{members:zx,size:nD,alignment:aD}=GS;d();var ni=class e{constructor(e=[]){this.segments=e}prepareSegment(t,r,i,a){let n=this.segments[this.segments.length-1];return t>e.MAX_VERTEX_ARRAY_LENGTH&&Ce("Max vertices per segment is ".concat(e.MAX_VERTEX_ARRAY_LENGTH,": bucket requested ").concat(t)),(!n||n.vertexLength+t>e.MAX_VERTEX_ARRAY_LENGTH||n.sortKey!==a)&&(n={vertexOffset:r.length,primitiveOffset:i.length,vertexLength:0,primitiveLength:0},void 0!==a&&(n.sortKey=a),this.segments.push(n)),n}get(){return this.segments}destroy(){for(let e of this.segments)for(let t in e.vaos)e.vaos[t].destroy()}static simpleSegment(t,r,i,a){return new e([{vertexOffset:t,primitiveOffset:r,vertexLength:i,primitiveLength:a,vaos:{},sortKey:0}])}};l(ni,"SegmentVector");var me=ni;function $h(e,t){return 256*(e=Te(Math.floor(e),0,255))+(t=Te(Math.floor(t),0,255))}me.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,N("SegmentVector",me),d(),d(),l($h,"packUint8ToFloat"),d();var Ta=ve([{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"}]);d();var Vx=se(Xh(),1),Os=class e{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,t,r,i){this.ids.push(Ox(e)),this.positions.push(t,r,i)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");let t=Ox(e),r=0,i=this.ids.length-1;for(;r<i;){let e=r+i>>1;this.ids[e]>=t?i=e:r=e+1}let a=[];for(;this.ids[r]===t;){let e=this.positions[3*r],t=this.positions[3*r+1],i=this.positions[3*r+2];a.push({index:e,start:t,end:i}),r++}return a}static serialize(e,t){let r=new Float64Array(e.ids),i=new Uint32Array(e.positions);return Kh(r,i,0,r.length-1),t&&t.push(r.buffer,i.buffer),{ids:r,positions:i}}static deserialize(t){let r=new e;return r.ids=t.ids,r.positions=t.positions,r.indexed=!0,r}};l(Os,"FeaturePositionMap");var Aa=Os;function Ox(e){let t=+e;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:(0,Vx.default)(String(e))}function Kh(e,t,r,i){for(;r<i;){let a=e[r+i>>1],n=r-1,s=i+1;for(;;){do{n++}while(e[n]<a);do{s--}while(e[s]>a);if(n>=s)break;Rs(e,n,s),Rs(t,3*n,3*s),Rs(t,3*n+1,3*s+1),Rs(t,3*n+2,3*s+2)}s-r<i-s?(Kh(e,t,r,s),r=s+1):(Kh(e,t,s+1,i),i=s)}}function Rs(e,t,r){let i=e[t];e[t]=e[r],e[r]=i}l(Ox,"getNumericId"),l(Kh,"sort"),l(Rs,"swap"),N("FeaturePositionMap",Aa),d();var Yh=class{constructor(e,t){this.gl=e.gl,this.location=t}};l(Yh,"Uniform");var ar=Yh,Jh=class extends ar{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1i(this.location,e))}};l(Jh,"Uniform1i");var Y=Jh,Qh=class extends ar{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}};l(Qh,"Uniform1f");var V=Qh,ef=class extends ar{constructor(e,t){super(e,t),this.current=[0,0]}set(e){(e[0]!==this.current[0]||e[1]!==this.current[1])&&(this.current=e,this.gl.uniform2f(this.location,e[0],e[1]))}};l(ef,"Uniform2f");var ee=ef,tf=class extends ar{constructor(e,t){super(e,t),this.current=[0,0,0]}set(e){(e[0]!==this.current[0]||e[1]!==this.current[1]||e[2]!==this.current[2])&&(this.current=e,this.gl.uniform3f(this.location,e[0],e[1],e[2]))}};l(tf,"Uniform3f");var lt=tf,rf=class extends ar{constructor(e,t){super(e,t),this.current=[0,0,0,0]}set(e){(e[0]!==this.current[0]||e[1]!==this.current[1]||e[2]!==this.current[2]||e[3]!==this.current[3])&&(this.current=e,this.gl.uniform4f(this.location,e[0],e[1],e[2],e[3]))}};l(rf,"Uniform4f");var Ir=rf,nf=class extends ar{constructor(e,t){super(e,t),this.current=X.transparent}set(e){(e.r!==this.current.r||e.g!==this.current.g||e.b!==this.current.b||e.a!==this.current.a)&&(this.current=e,this.gl.uniform4f(this.location,e.r,e.g,e.b,e.a))}};l(nf,"UniformColor");var Ft=nf,$S=new Float32Array(16),af=class extends ar{constructor(e,t){super(e,t),this.current=$S}set(e){if(e[12]!==this.current[12]||e[0]!==this.current[0])return this.current=e,void this.gl.uniformMatrix4fv(this.location,!1,e);for(let t=1;t<16;t++)if(e[t]!==this.current[t]){this.current=e,this.gl.uniformMatrix4fv(this.location,!1,e);break}}};l(af,"UniformMatrix4f");var te=af;function of(e){return[$h(255*e.r,255*e.g),$h(255*e.b,255*e.a)]}l(of,"packColor");var sf=class{constructor(e,t,r){this.value=e,this.uniformNames=t.map((e=>"u_".concat(e))),this.type=r}setUniform(e,t,r){e.set(r.constantOr(this.value))}getBinding(e,t,r){return"color"===this.type?new Ft(e,t):new V(e,t)}};l(sf,"ConstantBinder");var ai=sf,lf=class{constructor(e,t){this.uniformNames=t.map((e=>"u_".concat(e))),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,t){this.pixelRatioFrom=t.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=t.tlbr,this.patternTo=e.tlbr}setUniform(e,t,r,i){let a="u_pattern_to"===i?this.patternTo:"u_pattern_from"===i?this.patternFrom:"u_pixel_ratio_to"===i?this.pixelRatioTo:"u_pixel_ratio_from"===i?this.pixelRatioFrom:null;a&&e.set(a)}getBinding(e,t,r){return"u_pattern"===r.substr(0,9)?new Ir(e,t):new V(e,t)}};l(lf,"CrossFadedConstantBinder");var Mr=lf,uf=class{constructor(e,t,r,i){this.expression=e,this.type=r,this.maxValue=0,this.paintVertexAttributes=t.map((e=>({name:"a_".concat(e),type:"Float32",components:"color"===r?2:1,offset:0}))),this.paintVertexArray=new i}populatePaintArray(e,t,r,i,a){let n=this.paintVertexArray.length,s=this.expression.evaluate(new ye(0),t,{},i,[],a);this.paintVertexArray.resize(e),this._setPaintValue(n,e,s)}updatePaintArray(e,t,r,i){let a=this.expression.evaluate({zoom:0},r,i);this._setPaintValue(e,t,a)}_setPaintValue(e,t,r){if("color"===this.type){let i=of(r);for(let r=e;r<t;r++)this.paintVertexArray.emplace(r,i[0],i[1])}else{for(let i=e;i<t;i++)this.paintVertexArray.emplace(i,r);this.maxValue=Math.max(this.maxValue,Math.abs(r))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}};l(uf,"SourceExpressionBinder");var Gt=uf,cf=class{constructor(e,t,r,i,a,n){this.expression=e,this.uniformNames=t.map((e=>"u_".concat(e,"_t"))),this.type=r,this.useIntegerZoom=i,this.zoom=a,this.maxValue=0,this.paintVertexAttributes=t.map((e=>({name:"a_".concat(e),type:"Float32",components:"color"===r?4:2,offset:0}))),this.paintVertexArray=new n}populatePaintArray(e,t,r,i,a){let n=this.expression.evaluate(new ye(this.zoom),t,{},i,[],a),s=this.expression.evaluate(new ye(this.zoom+1),t,{},i,[],a),o=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(o,e,n,s)}updatePaintArray(e,t,r,i){let a=this.expression.evaluate({zoom:this.zoom},r,i),n=this.expression.evaluate({zoom:this.zoom+1},r,i);this._setPaintValue(e,t,a,n)}_setPaintValue(e,t,r,i){if("color"===this.type){let a=of(r),n=of(i);for(let r=e;r<t;r++)this.paintVertexArray.emplace(r,a[0],a[1],n[0],n[1])}else{for(let a=e;a<t;a++)this.paintVertexArray.emplace(a,r,i);this.maxValue=Math.max(this.maxValue,Math.abs(r),Math.abs(i))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,t){let r=this.useIntegerZoom?Math.floor(t.zoom):t.zoom,i=Te(this.expression.interpolationFactor(r,this.zoom,this.zoom+1),0,1);e.set(i)}getBinding(e,t,r){return new V(e,t)}};l(cf,"CompositeExpressionBinder");var Tt=cf,pf=class{constructor(e,t,r,i,a,n){this.expression=e,this.type=t,this.useIntegerZoom=r,this.zoom=i,this.layerId=n,this.zoomInPaintVertexArray=new a,this.zoomOutPaintVertexArray=new a}populatePaintArray(e,t,r){let i=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(i,e,t.patterns&&t.patterns[this.layerId],r)}updatePaintArray(e,t,r,i,a){this._setPaintValues(e,t,r.patterns&&r.patterns[this.layerId],a)}_setPaintValues(e,t,r,i){if(!i||!r)return;let{min:a,mid:n,max:s}=r,o=i[a],l=i[n],u=i[s];if(o&&l&&u)for(let r=e;r<t;r++)this.zoomInPaintVertexArray.emplace(r,l.tl[0],l.tl[1],l.br[0],l.br[1],o.tl[0],o.tl[1],o.br[0],o.br[1],l.pixelRatio,o.pixelRatio),this.zoomOutPaintVertexArray.emplace(r,l.tl[0],l.tl[1],l.br[0],l.br[1],u.tl[0],u.tl[1],u.br[0],u.br[1],l.pixelRatio,u.pixelRatio)}upload(e){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,Ta.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,Ta.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}};l(pf,"CrossFadedCompositeBinder");var Zt=pf,hf=class{constructor(e,t,r){this.binders={},this._buffers=[];let i=[];for(let a in e.paint._values){if(!r(a))continue;let n=e.paint.get(a);if(!(n instanceof ot&&xr(n.property.specification)))continue;let s=HS(a,e.type),o=n.value,l=n.property.specification.type,u=n.property.useIntegerZoom,c=n.property.specification["property-type"],h="cross-faded"===c||"cross-faded-data-driven"===c;if("constant"===o.kind)this.binders[a]=h?new Mr(o.value,s):new ai(o.value,s,l),i.push("/u_".concat(a));else if("source"===o.kind||h){let r=Ux(a,l,"source");this.binders[a]=h?new Zt(o,l,u,t,r,e.id):new Gt(o,s,l,r),i.push("/a_".concat(a))}else{let e=Ux(a,l,"composite");this.binders[a]=new Tt(o,s,l,u,t,e),i.push("/z_".concat(a))}}this.cacheKey=i.sort().join("")}getMaxValue(e){let t=this.binders[e];return t instanceof Gt||t instanceof Tt?t.maxValue:0}populatePaintArrays(e,t,r,i,a){for(let n in this.binders){let s=this.binders[n];(s instanceof Gt||s instanceof Tt||s instanceof Zt)&&s.populatePaintArray(e,t,r,i,a)}}setConstantPatternPositions(e,t){for(let r in this.binders){let i=this.binders[r];i instanceof Mr&&i.setConstantPatternPositions(e,t)}}updatePaintArrays(e,t,r,i,a){let n=!1;for(let s in e){let o=t.getPositions(s);for(let t of o){let o=r.feature(t.index);for(let r in this.binders){let l=this.binders[r];if((l instanceof Gt||l instanceof Tt||l instanceof Zt)&&!0===l.expression.isStateDependent){let u=i.paint.get(r);l.expression=u.value,l.updatePaintArray(t.start,t.end,o,e[s],a),n=!0}}}}return n}defines(){let e=[];for(let t in this.binders){let r=this.binders[t];(r instanceof ai||r instanceof Mr)&&e.push(...r.uniformNames.map((e=>"#define HAS_UNIFORM_".concat(e))))}return e}getBinderAttributes(){let e=[];for(let t in this.binders){let r=this.binders[t];if(r instanceof Gt||r instanceof Tt)for(let t=0;t<r.paintVertexAttributes.length;t++)e.push(r.paintVertexAttributes[t].name);else if(r instanceof Zt)for(let t=0;t<Ta.members.length;t++)e.push(Ta.members[t].name)}return e}getBinderUniforms(){let e=[];for(let t in this.binders){let r=this.binders[t];if(r instanceof ai||r instanceof Mr||r instanceof Tt)for(let t of r.uniformNames)e.push(t)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,t){let r=[];for(let i in this.binders){let a=this.binders[i];if(a instanceof ai||a instanceof Mr||a instanceof Tt)for(let n of a.uniformNames)if(t[n]){let s=a.getBinding(e,t[n],n);r.push({name:n,property:i,binding:s})}}return r}setUniforms(e,t,r,i){for(let{name:e,property:a,binding:n}of t)this.binders[a].setUniform(n,i,r.get(a),e)}updatePaintBuffers(e){this._buffers=[];for(let t in this.binders){let r=this.binders[t];if(e&&r instanceof Zt){let t=2===e.fromScale?r.zoomInPaintVertexBuffer:r.zoomOutPaintVertexBuffer;t&&this._buffers.push(t)}else(r instanceof Gt||r instanceof Tt)&&r.paintVertexBuffer&&this._buffers.push(r.paintVertexBuffer)}}upload(e){for(let t in this.binders){let r=this.binders[t];(r instanceof Gt||r instanceof Tt||r instanceof Zt)&&r.upload(e)}this.updatePaintBuffers()}destroy(){for(let e in this.binders){let t=this.binders[e];(t instanceof Gt||t instanceof Tt||t instanceof Zt)&&t.destroy()}}};l(hf,"ProgramConfiguration");var Vs=hf,ff=class{constructor(e,t,r=()=>!0){this.programConfigurations={};for(let i of e)this.programConfigurations[i.id]=new Vs(i,t,r);this.needsUpload=!1,this._featureMap=new Aa,this._bufferOffset=0}populatePaintArrays(e,t,r,i,a,n){for(let r in this.programConfigurations)this.programConfigurations[r].populatePaintArrays(e,t,i,a,n);void 0!==t.id&&this._featureMap.add(t.id,r,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,t,r,i){for(let a of r)this.needsUpload=this.programConfigurations[a.id].updatePaintArrays(e,this._featureMap,t,a,i)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(let t in this.programConfigurations)this.programConfigurations[t].upload(e);this.needsUpload=!1}}destroy(){for(let e in this.programConfigurations)this.programConfigurations[e].destroy()}};l(ff,"ProgramConfigurationSet");var dt=ff;function HS(e,t){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"]}[e]||[e.replace("".concat(t,"-"),"").replace(/-/g,"_")]}function WS(e){return{"line-pattern":{source:nr,composite:nr},"fill-pattern":{source:nr,composite:nr},"fill-extrusion-pattern":{source:nr,composite:nr}}[e]}function Ux(e,t,r){let i={color:{source:Pr,composite:Hi},number:{source:ii,composite:Pr}},a=WS(e);return a&&a[r]||i[t][r]}l(HS,"paintAttributeNames"),l(WS,"getLayoutException"),l(Ux,"layoutType"),N("ConstantBinder",ai),N("CrossFadedConstantBinder",Mr),N("SourceExpressionBinder",Gt),N("CrossFadedCompositeBinder",Zt),N("CompositeExpressionBinder",Tt),N("ProgramConfiguration",Vs,{omit:["_buffers"]}),N("ProgramConfigurationSet",dt),d(),d(),d();var XS=15,mf=Math.pow(2,XS-1)-1,Nx=-mf-1;function yt(e){let t=8192/e.extent,r=e.loadGeometry();for(let e=0;e<r.length;e++){let i=r[e];for(let e=0;e<i.length;e++){let r=i[e],a=Math.round(r.x*t),n=Math.round(r.y*t);r.x=Te(a,Nx,mf),r.y=Te(n,Nx,mf),(a<r.x||a>r.x+1||n<r.y||n>r.y+1)&&Ce("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function gt(e,t){return{type:e.type,id:e.id,properties:e.properties,geometry:t?yt(e):[]}}function Us(e,t,r,i,a){e.emplaceBack(2*t+(i+1)/2,2*r+(a+1)/2)}l(yt,"loadGeometry"),d(),l(gt,"toEvaluationFeature"),l(Us,"addCircleVertex");var df=class{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new Ts,this.indexArray=new at,this.segments=new me,this.programConfigurations=new dt(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,t,r){let i=this.layers[0],a=[],n=null,s=!1;"circle"===i.type&&(n=i.layout.get("circle-sort-key"),s=!n.isConstant());for(let{feature:t,id:i,index:o,sourceLayerIndex:l}of e){let e=this.layers[0]._featureFilter.needGeometry,u=gt(t,e);if(!this.layers[0]._featureFilter.filter(new ye(this.zoom),u,r))continue;let c=s?n.evaluate(u,{},r):void 0,h={id:i,properties:t.properties,type:t.type,sourceLayerIndex:l,index:o,geometry:e?u.geometry:yt(t),patterns:{},sortKey:c};a.push(h)}s&&a.sort(((e,t)=>e.sortKey-t.sortKey));for(let i of a){let{geometry:a,index:n,sourceLayerIndex:s}=i,o=e[n].feature;this.addFeature(i,a,n,r),t.featureIndex.insert(o,a,n,s,this.index)}}update(e,t,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,r)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,zx),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,t,r,i){for(let r of t)for(let t of r){let r=t.x,i=t.y;if(r<0||r>=8192||i<0||i>=8192)continue;let a=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),n=a.vertexLength;Us(this.layoutVertexArray,r,i,-1,-1),Us(this.layoutVertexArray,r,i,1,-1),Us(this.layoutVertexArray,r,i,1,1),Us(this.layoutVertexArray,r,i,-1,1),this.indexArray.emplaceBack(n,n+1,n+2),this.indexArray.emplaceBack(n,n+3,n+2),a.vertexLength+=4,a.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,{},i)}};l(df,"CircleBucket");var oi=df;N("CircleBucket",oi,{omit:["layers"]}),d();var Ia=se(Pe(),1);function Ns(e,t){for(let r=0;r<e.length;r++)if(Xi(t,e[r]))return!0;for(let r=0;r<t.length;r++)if(Xi(e,t[r]))return!0;return!!gf(e,t)}function qx(e,t,r){return!(!Xi(e,t)&&!yf(t,e,r))}function Gs(e,t){if(1===e.length)return Gx(t,e[0]);for(let r=0;r<t.length;r++){let i=t[r];for(let t=0;t<i.length;t++)if(Xi(e,i[t]))return!0}for(let r=0;r<e.length;r++)if(Gx(t,e[r]))return!0;for(let r=0;r<t.length;r++)if(gf(e,t[r]))return!0;return!1}function jx(e,t,r){for(let i=0;i<t.length;i++){let a=t[i];if(e.length>=3)for(let t=0;t<a.length;t++)if(Xi(e,a[t]))return!0;if(KS(e,a,r))return!0}return!1}function KS(e,t,r){if(e.length>1){if(gf(e,t))return!0;for(let i=0;i<t.length;i++)if(yf(t[i],e,r))return!0}for(let i=0;i<e.length;i++)if(yf(e[i],t,r))return!0;return!1}function gf(e,t){if(0===e.length||0===t.length)return!1;for(let r=0;r<e.length-1;r++){let i=e[r],a=e[r+1];for(let e=0;e<t.length-1;e++){if(YS(i,a,t[e],t[e+1]))return!0}}return!1}function YS(e,t,r,i){return Qt(e,r,i)!==Qt(t,r,i)&&Qt(e,t,r)!==Qt(e,t,i)}function yf(e,t,r){let i=r*r;if(1===t.length)return e.distSqr(t[0])<i;for(let r=1;r<t.length;r++){if(Zx(e,t[r-1],t[r])<i)return!0}return!1}function Zx(e,t,r){let i=t.distSqr(r);if(0===i)return e.distSqr(t);let a=((e.x-t.x)*(r.x-t.x)+(e.y-t.y)*(r.y-t.y))/i;return a<0?e.distSqr(t):a>1?e.distSqr(r):e.distSqr(r.sub(t)._mult(a)._add(t))}function Gx(e,t){let r,i,a,n=!1;for(let s=0;s<e.length;s++){r=e[s];for(let e=0,s=r.length-1;e<r.length;s=e++)i=r[e],a=r[s],i.y>t.y!=a.y>t.y&&t.x<(a.x-i.x)*(t.y-i.y)/(a.y-i.y)+i.x&&(n=!n)}return n}function Xi(e,t){let r=!1;for(let i=0,a=e.length-1;i<e.length;a=i++){let n=e[i],s=e[a];n.y>t.y!=s.y>t.y&&t.x<(s.x-n.x)*(t.y-n.y)/(s.y-n.y)+n.x&&(r=!r)}return r}function $x(e,t,r,i,a){for(let n of e)if(t<=n.x&&r<=n.y&&i>=n.x&&a>=n.y)return!0;let n=[new Ia.default(t,r),new Ia.default(t,a),new Ia.default(i,a),new Ia.default(i,r)];if(e.length>2)for(let t of n)if(Xi(e,t))return!0;for(let t=0;t<e.length-1;t++){if(JS(e[t],e[t+1],n))return!0}return!1}function JS(e,t,r){let i=r[0],a=r[2];if(e.x<i.x&&t.x<i.x||e.x>a.x&&t.x>a.x||e.y<i.y&&t.y<i.y||e.y>a.y&&t.y>a.y)return!1;let n=Qt(e,t,r[0]);return n!==Qt(e,t,r[1])||n!==Qt(e,t,r[2])||n!==Qt(e,t,r[3])}l(Ns,"polygonIntersectsPolygon"),l(qx,"polygonIntersectsBufferedPoint"),l(Gs,"polygonIntersectsMultiPolygon"),l(jx,"polygonIntersectsBufferedMultiLine"),l(KS,"lineIntersectsBufferedLine"),l(gf,"lineIntersectsLine"),l(YS,"lineSegmentIntersectsLineSegment"),l(yf,"pointIntersectsBufferedLine"),l(Zx,"distToSegmentSquared"),l(Gx,"multiPolygonContainsPoint"),l(Xi,"polygonContainsPoint"),l($x,"polygonIntersectsBox"),l(JS,"edgeIntersectsBox"),d();var qs=se(Pe(),1);function si(e,t,r){let i=t.paint.get(e).value;return"constant"===i.kind?i.value:r.programConfigurations.get(t.id).getMaxValue(e)}function Cr(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function Er(e,t,r,i,a){if(!t[0]&&!t[1])return e;let n=qs.default.convert(t)._mult(a);"viewport"===r&&n._rotate(-i);let s=[];for(let t=0;t<e.length;t++){let r=e[t];s.push(r.sub(n))}return s}function Hx(e,t){let r=[];for(let i=0;i<e.length;i++){let a=e[i],n=[];for(let e=0;e<a.length;e++){let r=a[e-1],i=a[e],s=a[e+1],o=0===e?new qs.default(0,0):i.sub(r)._unit()._perp(),l=e===a.length-1?new qs.default(0,0):s.sub(i)._unit()._perp(),u=o._add(l)._unit(),c=u.x*l.x+u.y*l.y;0!==c&&u._mult(1/c),n.push(u._mult(t)._add(i))}r.push(n)}return r}l(si,"getMaximumPaintValue"),l(Cr,"translateDistance"),l(Er,"translate"),l(Hx,"offsetLine"),d();var Wx,Xx,eP=l((()=>Wx=Wx||new Re({"circle-sort-key":new W(M.layout_circle["circle-sort-key"])})),"getLayout"),tP=l((()=>Xx=Xx||new Re({"circle-radius":new W(M.paint_circle["circle-radius"]),"circle-color":new W(M.paint_circle["circle-color"]),"circle-blur":new W(M.paint_circle["circle-blur"]),"circle-opacity":new W(M.paint_circle["circle-opacity"]),"circle-translate":new Z(M.paint_circle["circle-translate"]),"circle-translate-anchor":new Z(M.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Z(M.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Z(M.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new W(M.paint_circle["circle-stroke-width"]),"circle-stroke-color":new W(M.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new W(M.paint_circle["circle-stroke-opacity"])})),"getPaint"),Kx={get paint(){return tP()},get layout(){return eP()}};d(),d();var ie=1e-6,we=typeof Float32Array<"u"?Float32Array:Array,$t=Math.random,Uz=Math.PI/180;Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var Ma={};function rP(){var e=new we(4);return we!=Float32Array&&(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e}function iP(e){var t=new we(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function nP(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function aP(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=1,e}function oP(e,t,r,i){var a=new we(4);return a[0]=e,a[1]=t,a[2]=r,a[3]=i,a}function sP(e,t,r,i,a){return e[0]=t,e[1]=r,e[2]=i,e[3]=a,e}function lP(e,t){if(e===t){var r=t[1];e[1]=t[2],e[2]=r}else e[0]=t[0],e[1]=t[2],e[2]=t[1],e[3]=t[3];return e}function uP(e,t){var r=t[0],i=t[1],a=t[2],n=t[3],s=r*n-a*i;return s?(s=1/s,e[0]=n*s,e[1]=-i*s,e[2]=-a*s,e[3]=r*s,e):null}function cP(e,t){var r=t[0];return e[0]=t[3],e[1]=-t[1],e[2]=-t[2],e[3]=r,e}function pP(e){return e[0]*e[3]-e[2]*e[1]}function Yx(e,t,r){var i=t[0],a=t[1],n=t[2],s=t[3],o=r[0],l=r[1],u=r[2],c=r[3];return e[0]=i*o+n*l,e[1]=a*o+s*l,e[2]=i*u+n*c,e[3]=a*u+s*c,e}function hP(e,t,r){var i=t[0],a=t[1],n=t[2],s=t[3],o=Math.sin(r),l=Math.cos(r);return e[0]=i*l+n*o,e[1]=a*l+s*o,e[2]=i*-o+n*l,e[3]=a*-o+s*l,e}function fP(e,t,r){var i=t[0],a=t[1],n=t[2],s=t[3],o=r[0],l=r[1];return e[0]=i*o,e[1]=a*o,e[2]=n*l,e[3]=s*l,e}function mP(e,t){var r=Math.sin(t),i=Math.cos(t);return e[0]=i,e[1]=r,e[2]=-r,e[3]=i,e}function dP(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=t[1],e}function yP(e){return"mat2("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"}function gP(e){return Math.hypot(e[0],e[1],e[2],e[3])}function xP(e,t,r,i){return e[2]=i[2]/i[0],r[0]=i[0],r[1]=i[1],r[3]=i[3]-e[2]*r[1],[e,t,r]}function bP(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e}function Jx(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e}function _P(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}function vP(e,t){var r=e[0],i=e[1],a=e[2],n=e[3],s=t[0],o=t[1],l=t[2],u=t[3];return Math.abs(r-s)<=ie*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(i-o)<=ie*Math.max(1,Math.abs(i),Math.abs(o))&&Math.abs(a-l)<=ie*Math.max(1,Math.abs(a),Math.abs(l))&&Math.abs(n-u)<=ie*Math.max(1,Math.abs(n),Math.abs(u))}function wP(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e}function SP(e,t,r,i){return e[0]=t[0]+r[0]*i,e[1]=t[1]+r[1]*i,e[2]=t[2]+r[2]*i,e[3]=t[3]+r[3]*i,e}wi(Ma,{LDU:()=>xP,add:()=>bP,adjoint:()=>cP,clone:()=>iP,copy:()=>nP,create:()=>rP,determinant:()=>pP,equals:()=>vP,exactEquals:()=>_P,frob:()=>gP,fromRotation:()=>mP,fromScaling:()=>dP,fromValues:()=>oP,identity:()=>aP,invert:()=>uP,mul:()=>PP,multiply:()=>Yx,multiplyScalar:()=>wP,multiplyScalarAndAdd:()=>SP,rotate:()=>hP,scale:()=>fP,set:()=>sP,str:()=>yP,sub:()=>TP,subtract:()=>Jx,transpose:()=>lP}),d(),l(rP,"create"),l(iP,"clone"),l(nP,"copy"),l(aP,"identity"),l(oP,"fromValues"),l(sP,"set"),l(lP,"transpose"),l(uP,"invert"),l(cP,"adjoint"),l(pP,"determinant"),l(Yx,"multiply"),l(hP,"rotate"),l(fP,"scale"),l(mP,"fromRotation"),l(dP,"fromScaling"),l(yP,"str"),l(gP,"frob"),l(xP,"LDU"),l(bP,"add"),l(Jx,"subtract"),l(_P,"exactEquals"),l(vP,"equals"),l(wP,"multiplyScalar"),l(SP,"multiplyScalarAndAdd");var PP=Yx,TP=Jx,Ca={};function AP(){var e=new we(9);return we!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function IP(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e}function MP(e){var t=new we(9);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 CP(e,t){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 EP(e,t,r,i,a,n,s,o,l){var u=new we(9);return u[0]=e,u[1]=t,u[2]=r,u[3]=i,u[4]=a,u[5]=n,u[6]=s,u[7]=o,u[8]=l,u}function kP(e,t,r,i,a,n,s,o,l,u){return e[0]=t,e[1]=r,e[2]=i,e[3]=a,e[4]=n,e[5]=s,e[6]=o,e[7]=l,e[8]=u,e}function LP(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function DP(e,t){if(e===t){var r=t[1],i=t[2],a=t[5];e[1]=t[3],e[2]=t[6],e[3]=r,e[5]=t[7],e[6]=i,e[7]=a}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e}function zP(e,t){var r=t[0],i=t[1],a=t[2],n=t[3],s=t[4],o=t[5],l=t[6],u=t[7],c=t[8],h=c*s-o*u,p=-c*n+o*l,d=u*n-s*l,f=r*h+i*p+a*d;return f?(f=1/f,e[0]=h*f,e[1]=(-c*i+a*u)*f,e[2]=(o*i-a*s)*f,e[3]=p*f,e[4]=(c*r-a*l)*f,e[5]=(-o*r+a*n)*f,e[6]=d*f,e[7]=(-u*r+i*l)*f,e[8]=(s*r-i*n)*f,e):null}function FP(e,t){var r=t[0],i=t[1],a=t[2],n=t[3],s=t[4],o=t[5],l=t[6],u=t[7],c=t[8];return e[0]=s*c-o*u,e[1]=a*u-i*c,e[2]=i*o-a*s,e[3]=o*l-n*c,e[4]=r*c-a*l,e[5]=a*n-r*o,e[6]=n*u-s*l,e[7]=i*l-r*u,e[8]=r*s-i*n,e}function BP(e){var t=e[0],r=e[1],i=e[2],a=e[3],n=e[4],s=e[5],o=e[6],l=e[7],u=e[8];return t*(u*n-s*l)+r*(-u*a+s*o)+i*(l*a-n*o)}function Qx(e,t,r){var i=t[0],a=t[1],n=t[2],s=t[3],o=t[4],l=t[5],u=t[6],c=t[7],h=t[8],p=r[0],d=r[1],f=r[2],m=r[3],y=r[4],g=r[5],_=r[6],x=r[7],v=r[8];return e[0]=p*i+d*s+f*u,e[1]=p*a+d*o+f*c,e[2]=p*n+d*l+f*h,e[3]=m*i+y*s+g*u,e[4]=m*a+y*o+g*c,e[5]=m*n+y*l+g*h,e[6]=_*i+x*s+v*u,e[7]=_*a+x*o+v*c,e[8]=_*n+x*l+v*h,e}function RP(e,t,r){var i=t[0],a=t[1],n=t[2],s=t[3],o=t[4],l=t[5],u=t[6],c=t[7],h=t[8],p=r[0],d=r[1];return e[0]=i,e[1]=a,e[2]=n,e[3]=s,e[4]=o,e[5]=l,e[6]=p*i+d*s+u,e[7]=p*a+d*o+c,e[8]=p*n+d*l+h,e}function OP(e,t,r){var i=t[0],a=t[1],n=t[2],s=t[3],o=t[4],l=t[5],u=t[6],c=t[7],h=t[8],p=Math.sin(r),d=Math.cos(r);return e[0]=d*i+p*s,e[1]=d*a+p*o,e[2]=d*n+p*l,e[3]=d*s-p*i,e[4]=d*o-p*a,e[5]=d*l-p*n,e[6]=u,e[7]=c,e[8]=h,e}function VP(e,t,r){var i=r[0],a=r[1];return e[0]=i*t[0],e[1]=i*t[1],e[2]=i*t[2],e[3]=a*t[3],e[4]=a*t[4],e[5]=a*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function UP(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=t[0],e[7]=t[1],e[8]=1,e}function NP(e,t){var r=Math.sin(t),i=Math.cos(t);return e[0]=i,e[1]=r,e[2]=0,e[3]=-r,e[4]=i,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function GP(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=t[1],e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function qP(e,t){return e[0]=t[0],e[1]=t[1],e[2]=0,e[3]=t[2],e[4]=t[3],e[5]=0,e[6]=t[4],e[7]=t[5],e[8]=1,e}function jP(e,t){var r=t[0],i=t[1],a=t[2],n=t[3],s=r+r,o=i+i,l=a+a,u=r*s,c=i*s,h=i*o,p=a*s,d=a*o,f=a*l,m=n*s,y=n*o,g=n*l;return e[0]=1-h-f,e[3]=c-g,e[6]=p+y,e[1]=c+g,e[4]=1-u-f,e[7]=d-m,e[2]=p-y,e[5]=d+m,e[8]=1-u-h,e}function ZP(e,t){var r=t[0],i=t[1],a=t[2],n=t[3],s=t[4],o=t[5],l=t[6],u=t[7],c=t[8],h=t[9],p=t[10],d=t[11],f=t[12],m=t[13],y=t[14],g=t[15],_=r*o-i*s,x=r*l-a*s,v=r*u-n*s,b=i*l-a*o,w=i*u-n*o,S=a*u-n*l,A=c*m-h*f,I=c*y-p*f,M=c*g-d*f,T=h*y-p*m,P=h*g-d*m,C=p*g-d*y,E=_*C-x*P+v*T+b*M-w*I+S*A;return E?(E=1/E,e[0]=(o*C-l*P+u*T)*E,e[1]=(l*M-s*C-u*I)*E,e[2]=(s*P-o*M+u*A)*E,e[3]=(a*P-i*C-n*T)*E,e[4]=(r*C-a*M+n*I)*E,e[5]=(i*M-r*P-n*A)*E,e[6]=(m*S-y*w+g*b)*E,e[7]=(y*v-f*S-g*x)*E,e[8]=(f*w-m*v+g*_)*E,e):null}function $P(e,t,r){return e[0]=2/t,e[1]=0,e[2]=0,e[3]=0,e[4]=-2/r,e[5]=0,e[6]=-1,e[7]=1,e[8]=1,e}function HP(e){return"mat3("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+")"}function WP(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}function XP(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e[4]=t[4]+r[4],e[5]=t[5]+r[5],e[6]=t[6]+r[6],e[7]=t[7]+r[7],e[8]=t[8]+r[8],e}function eb(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e[4]=t[4]-r[4],e[5]=t[5]-r[5],e[6]=t[6]-r[6],e[7]=t[7]-r[7],e[8]=t[8]-r[8],e}function KP(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*r,e}function YP(e,t,r,i){return e[0]=t[0]+r[0]*i,e[1]=t[1]+r[1]*i,e[2]=t[2]+r[2]*i,e[3]=t[3]+r[3]*i,e[4]=t[4]+r[4]*i,e[5]=t[5]+r[5]*i,e[6]=t[6]+r[6]*i,e[7]=t[7]+r[7]*i,e[8]=t[8]+r[8]*i,e}function JP(e,t){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]}function QP(e,t){var r=e[0],i=e[1],a=e[2],n=e[3],s=e[4],o=e[5],l=e[6],u=e[7],c=e[8],h=t[0],p=t[1],d=t[2],f=t[3],m=t[4],y=t[5],g=t[6],_=t[7],x=t[8];return Math.abs(r-h)<=ie*Math.max(1,Math.abs(r),Math.abs(h))&&Math.abs(i-p)<=ie*Math.max(1,Math.abs(i),Math.abs(p))&&Math.abs(a-d)<=ie*Math.max(1,Math.abs(a),Math.abs(d))&&Math.abs(n-f)<=ie*Math.max(1,Math.abs(n),Math.abs(f))&&Math.abs(s-m)<=ie*Math.max(1,Math.abs(s),Math.abs(m))&&Math.abs(o-y)<=ie*Math.max(1,Math.abs(o),Math.abs(y))&&Math.abs(l-g)<=ie*Math.max(1,Math.abs(l),Math.abs(g))&&Math.abs(u-_)<=ie*Math.max(1,Math.abs(u),Math.abs(_))&&Math.abs(c-x)<=ie*Math.max(1,Math.abs(c),Math.abs(x))}wi(Ca,{add:()=>XP,adjoint:()=>FP,clone:()=>MP,copy:()=>CP,create:()=>AP,determinant:()=>BP,equals:()=>QP,exactEquals:()=>JP,frob:()=>WP,fromMat2d:()=>qP,fromMat4:()=>IP,fromQuat:()=>jP,fromRotation:()=>NP,fromScaling:()=>GP,fromTranslation:()=>UP,fromValues:()=>EP,identity:()=>LP,invert:()=>zP,mul:()=>eT,multiply:()=>Qx,multiplyScalar:()=>KP,multiplyScalarAndAdd:()=>YP,normalFromMat4:()=>ZP,projection:()=>$P,rotate:()=>OP,scale:()=>VP,set:()=>kP,str:()=>HP,sub:()=>tT,subtract:()=>eb,translate:()=>RP,transpose:()=>DP}),d(),l(AP,"create"),l(IP,"fromMat4"),l(MP,"clone"),l(CP,"copy"),l(EP,"fromValues"),l(kP,"set"),l(LP,"identity"),l(DP,"transpose"),l(zP,"invert"),l(FP,"adjoint"),l(BP,"determinant"),l(Qx,"multiply"),l(RP,"translate"),l(OP,"rotate"),l(VP,"scale"),l(UP,"fromTranslation"),l(NP,"fromRotation"),l(GP,"fromScaling"),l(qP,"fromMat2d"),l(jP,"fromQuat"),l(ZP,"normalFromMat4"),l($P,"projection"),l(HP,"str"),l(WP,"frob"),l(XP,"add"),l(eb,"subtract"),l(KP,"multiplyScalar"),l(YP,"multiplyScalarAndAdd"),l(JP,"exactEquals"),l(QP,"equals");var eT=Qx,tT=eb,G={};function rT(){var e=new we(16);return we!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function iT(e){var t=new we(16);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 nT(e,t){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 aT(e,t,r,i,a,n,s,o,l,u,c,h,p,d,f,m){var y=new we(16);return y[0]=e,y[1]=t,y[2]=r,y[3]=i,y[4]=a,y[5]=n,y[6]=s,y[7]=o,y[8]=l,y[9]=u,y[10]=c,y[11]=h,y[12]=p,y[13]=d,y[14]=f,y[15]=m,y}function oT(e,t,r,i,a,n,s,o,l,u,c,h,p,d,f,m,y){return e[0]=t,e[1]=r,e[2]=i,e[3]=a,e[4]=n,e[5]=s,e[6]=o,e[7]=l,e[8]=u,e[9]=c,e[10]=h,e[11]=p,e[12]=d,e[13]=f,e[14]=m,e[15]=y,e}function tb(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function sT(e,t){if(e===t){var r=t[1],i=t[2],a=t[3],n=t[6],s=t[7],o=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=r,e[6]=t[9],e[7]=t[13],e[8]=i,e[9]=n,e[11]=t[14],e[12]=a,e[13]=s,e[14]=o}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function lT(e,t){var r=t[0],i=t[1],a=t[2],n=t[3],s=t[4],o=t[5],l=t[6],u=t[7],c=t[8],h=t[9],p=t[10],d=t[11],f=t[12],m=t[13],y=t[14],g=t[15],_=r*o-i*s,x=r*l-a*s,v=r*u-n*s,b=i*l-a*o,w=i*u-n*o,S=a*u-n*l,A=c*m-h*f,I=c*y-p*f,M=c*g-d*f,T=h*y-p*m,P=h*g-d*m,C=p*g-d*y,E=_*C-x*P+v*T+b*M-w*I+S*A;return E?(E=1/E,e[0]=(o*C-l*P+u*T)*E,e[1]=(a*P-i*C-n*T)*E,e[2]=(m*S-y*w+g*b)*E,e[3]=(p*w-h*S-d*b)*E,e[4]=(l*M-s*C-u*I)*E,e[5]=(r*C-a*M+n*I)*E,e[6]=(y*v-f*S-g*x)*E,e[7]=(c*S-p*v+d*x)*E,e[8]=(s*P-o*M+u*A)*E,e[9]=(i*M-r*P-n*A)*E,e[10]=(f*w-m*v+g*_)*E,e[11]=(h*v-c*w-d*_)*E,e[12]=(o*I-s*T-l*A)*E,e[13]=(r*T-i*I+a*A)*E,e[14]=(m*x-f*b-y*_)*E,e[15]=(c*b-h*x+p*_)*E,e):null}function uT(e,t){var r=t[0],i=t[1],a=t[2],n=t[3],s=t[4],o=t[5],l=t[6],u=t[7],c=t[8],h=t[9],p=t[10],d=t[11],f=t[12],m=t[13],y=t[14],g=t[15];return e[0]=o*(p*g-d*y)-h*(l*g-u*y)+m*(l*d-u*p),e[1]=-(i*(p*g-d*y)-h*(a*g-n*y)+m*(a*d-n*p)),e[2]=i*(l*g-u*y)-o*(a*g-n*y)+m*(a*u-n*l),e[3]=-(i*(l*d-u*p)-o*(a*d-n*p)+h*(a*u-n*l)),e[4]=-(s*(p*g-d*y)-c*(l*g-u*y)+f*(l*d-u*p)),e[5]=r*(p*g-d*y)-c*(a*g-n*y)+f*(a*d-n*p),e[6]=-(r*(l*g-u*y)-s*(a*g-n*y)+f*(a*u-n*l)),e[7]=r*(l*d-u*p)-s*(a*d-n*p)+c*(a*u-n*l),e[8]=s*(h*g-d*m)-c*(o*g-u*m)+f*(o*d-u*h),e[9]=-(r*(h*g-d*m)-c*(i*g-n*m)+f*(i*d-n*h)),e[10]=r*(o*g-u*m)-s*(i*g-n*m)+f*(i*u-n*o),e[11]=-(r*(o*d-u*h)-s*(i*d-n*h)+c*(i*u-n*o)),e[12]=-(s*(h*y-p*m)-c*(o*y-l*m)+f*(o*p-l*h)),e[13]=r*(h*y-p*m)-c*(i*y-a*m)+f*(i*p-a*h),e[14]=-(r*(o*y-l*m)-s*(i*y-a*m)+f*(i*l-a*o)),e[15]=r*(o*p-l*h)-s*(i*p-a*h)+c*(i*l-a*o),e}function cT(e){var t=e[0],r=e[1],i=e[2],a=e[3],n=e[4],s=e[5],o=e[6],l=e[7],u=e[8],c=e[9],h=e[10],p=e[11],d=e[12],f=e[13],m=e[14],y=e[15];return(t*s-r*n)*(h*y-p*m)-(t*o-i*n)*(c*y-p*f)+(t*l-a*n)*(c*m-h*f)+(r*o-i*s)*(u*y-p*d)-(r*l-a*s)*(u*m-h*d)+(i*l-a*o)*(u*f-c*d)}function rb(e,t,r){var i=t[0],a=t[1],n=t[2],s=t[3],o=t[4],l=t[5],u=t[6],c=t[7],h=t[8],p=t[9],d=t[10],f=t[11],m=t[12],y=t[13],g=t[14],_=t[15],x=r[0],v=r[1],b=r[2],w=r[3];return e[0]=x*i+v*o+b*h+w*m,e[1]=x*a+v*l+b*p+w*y,e[2]=x*n+v*u+b*d+w*g,e[3]=x*s+v*c+b*f+w*_,x=r[4],v=r[5],b=r[6],w=r[7],e[4]=x*i+v*o+b*h+w*m,e[5]=x*a+v*l+b*p+w*y,e[6]=x*n+v*u+b*d+w*g,e[7]=x*s+v*c+b*f+w*_,x=r[8],v=r[9],b=r[10],w=r[11],e[8]=x*i+v*o+b*h+w*m,e[9]=x*a+v*l+b*p+w*y,e[10]=x*n+v*u+b*d+w*g,e[11]=x*s+v*c+b*f+w*_,x=r[12],v=r[13],b=r[14],w=r[15],e[12]=x*i+v*o+b*h+w*m,e[13]=x*a+v*l+b*p+w*y,e[14]=x*n+v*u+b*d+w*g,e[15]=x*s+v*c+b*f+w*_,e}function pT(e,t,r){var i,a,n,s,o,l,u,c,h,p,d,f,m=r[0],y=r[1],g=r[2];return t===e?(e[12]=t[0]*m+t[4]*y+t[8]*g+t[12],e[13]=t[1]*m+t[5]*y+t[9]*g+t[13],e[14]=t[2]*m+t[6]*y+t[10]*g+t[14],e[15]=t[3]*m+t[7]*y+t[11]*g+t[15]):(i=t[0],a=t[1],n=t[2],s=t[3],o=t[4],l=t[5],u=t[6],c=t[7],h=t[8],p=t[9],d=t[10],f=t[11],e[0]=i,e[1]=a,e[2]=n,e[3]=s,e[4]=o,e[5]=l,e[6]=u,e[7]=c,e[8]=h,e[9]=p,e[10]=d,e[11]=f,e[12]=i*m+o*y+h*g+t[12],e[13]=a*m+l*y+p*g+t[13],e[14]=n*m+u*y+d*g+t[14],e[15]=s*m+c*y+f*g+t[15]),e}function hT(e,t,r){var i=r[0],a=r[1],n=r[2];return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e[4]=t[4]*a,e[5]=t[5]*a,e[6]=t[6]*a,e[7]=t[7]*a,e[8]=t[8]*n,e[9]=t[9]*n,e[10]=t[10]*n,e[11]=t[11]*n,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function fT(e,t,r,i){var a,n,s,o,l,u,c,h,p,d,f,m,y,g,_,x,v,b,w,S,A,I,M,T,P=i[0],C=i[1],E=i[2],k=Math.hypot(P,C,E);return k<ie?null:(P*=k=1/k,C*=k,E*=k,a=Math.sin(r),s=1-(n=Math.cos(r)),o=t[0],l=t[1],u=t[2],c=t[3],h=t[4],p=t[5],d=t[6],f=t[7],m=t[8],y=t[9],g=t[10],_=t[11],x=P*P*s+n,v=C*P*s+E*a,b=E*P*s-C*a,w=P*C*s-E*a,S=C*C*s+n,A=E*C*s+P*a,I=P*E*s+C*a,M=C*E*s-P*a,T=E*E*s+n,e[0]=o*x+h*v+m*b,e[1]=l*x+p*v+y*b,e[2]=u*x+d*v+g*b,e[3]=c*x+f*v+_*b,e[4]=o*w+h*S+m*A,e[5]=l*w+p*S+y*A,e[6]=u*w+d*S+g*A,e[7]=c*w+f*S+_*A,e[8]=o*I+h*M+m*T,e[9]=l*I+p*M+y*T,e[10]=u*I+d*M+g*T,e[11]=c*I+f*M+_*T,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function mT(e,t,r){var i=Math.sin(r),a=Math.cos(r),n=t[4],s=t[5],o=t[6],l=t[7],u=t[8],c=t[9],h=t[10],p=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=n*a+u*i,e[5]=s*a+c*i,e[6]=o*a+h*i,e[7]=l*a+p*i,e[8]=u*a-n*i,e[9]=c*a-s*i,e[10]=h*a-o*i,e[11]=p*a-l*i,e}function dT(e,t,r){var i=Math.sin(r),a=Math.cos(r),n=t[0],s=t[1],o=t[2],l=t[3],u=t[8],c=t[9],h=t[10],p=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=n*a-u*i,e[1]=s*a-c*i,e[2]=o*a-h*i,e[3]=l*a-p*i,e[8]=n*i+u*a,e[9]=s*i+c*a,e[10]=o*i+h*a,e[11]=l*i+p*a,e}function yT(e,t,r){var i=Math.sin(r),a=Math.cos(r),n=t[0],s=t[1],o=t[2],l=t[3],u=t[4],c=t[5],h=t[6],p=t[7];return t!==e&&(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[0]=n*a+u*i,e[1]=s*a+c*i,e[2]=o*a+h*i,e[3]=l*a+p*i,e[4]=u*a-n*i,e[5]=c*a-s*i,e[6]=h*a-o*i,e[7]=p*a-l*i,e}function gT(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=t[0],e[13]=t[1],e[14]=t[2],e[15]=1,e}function xT(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function bT(e,t,r){var i,a,n,s=r[0],o=r[1],l=r[2],u=Math.hypot(s,o,l);return u<ie?null:(s*=u=1/u,o*=u,l*=u,i=Math.sin(t),n=1-(a=Math.cos(t)),e[0]=s*s*n+a,e[1]=o*s*n+l*i,e[2]=l*s*n-o*i,e[3]=0,e[4]=s*o*n-l*i,e[5]=o*o*n+a,e[6]=l*o*n+s*i,e[7]=0,e[8]=s*l*n+o*i,e[9]=o*l*n-s*i,e[10]=l*l*n+a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e)}function _T(e,t){var r=Math.sin(t),i=Math.cos(t);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=i,e[6]=r,e[7]=0,e[8]=0,e[9]=-r,e[10]=i,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function vT(e,t){var r=Math.sin(t),i=Math.cos(t);return e[0]=i,e[1]=0,e[2]=-r,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=r,e[9]=0,e[10]=i,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function wT(e,t){var r=Math.sin(t),i=Math.cos(t);return e[0]=i,e[1]=r,e[2]=0,e[3]=0,e[4]=-r,e[5]=i,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function ib(e,t,r){var i=t[0],a=t[1],n=t[2],s=t[3],o=i+i,l=a+a,u=n+n,c=i*o,h=i*l,p=i*u,d=a*l,f=a*u,m=n*u,y=s*o,g=s*l,_=s*u;return e[0]=1-(d+m),e[1]=h+_,e[2]=p-g,e[3]=0,e[4]=h-_,e[5]=1-(c+m),e[6]=f+y,e[7]=0,e[8]=p+g,e[9]=f-y,e[10]=1-(c+d),e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e}function ST(e,t){var r=new we(3),i=-t[0],a=-t[1],n=-t[2],s=t[3],o=t[4],l=t[5],u=t[6],c=t[7],h=i*i+a*a+n*n+s*s;return h>0?(r[0]=2*(o*s+c*i+l*n-u*a)/h,r[1]=2*(l*s+c*a+u*i-o*n)/h,r[2]=2*(u*s+c*n+o*a-l*i)/h):(r[0]=2*(o*s+c*i+l*n-u*a),r[1]=2*(l*s+c*a+u*i-o*n),r[2]=2*(u*s+c*n+o*a-l*i)),ib(e,t,r),e}function PT(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function nb(e,t){var r=t[0],i=t[1],a=t[2],n=t[4],s=t[5],o=t[6],l=t[8],u=t[9],c=t[10];return e[0]=Math.hypot(r,i,a),e[1]=Math.hypot(n,s,o),e[2]=Math.hypot(l,u,c),e}function TT(e,t){var r=new we(3);nb(r,t);var i=1/r[0],a=1/r[1],n=1/r[2],s=t[0]*i,o=t[1]*a,l=t[2]*n,u=t[4]*i,c=t[5]*a,h=t[6]*n,p=t[8]*i,d=t[9]*a,f=t[10]*n,m=s+c+f,y=0;return m>0?(y=2*Math.sqrt(m+1),e[3]=.25*y,e[0]=(h-d)/y,e[1]=(p-l)/y,e[2]=(o-u)/y):s>c&&s>f?(y=2*Math.sqrt(1+s-c-f),e[3]=(h-d)/y,e[0]=.25*y,e[1]=(o+u)/y,e[2]=(p+l)/y):c>f?(y=2*Math.sqrt(1+c-s-f),e[3]=(p-l)/y,e[0]=(o+u)/y,e[1]=.25*y,e[2]=(h+d)/y):(y=2*Math.sqrt(1+f-s-c),e[3]=(o-u)/y,e[0]=(p+l)/y,e[1]=(h+d)/y,e[2]=.25*y),e}function AT(e,t,r,i){var a=t[0],n=t[1],s=t[2],o=t[3],l=a+a,u=n+n,c=s+s,h=a*l,p=a*u,d=a*c,f=n*u,m=n*c,y=s*c,g=o*l,_=o*u,x=o*c,v=i[0],b=i[1],w=i[2];return e[0]=(1-(f+y))*v,e[1]=(p+x)*v,e[2]=(d-_)*v,e[3]=0,e[4]=(p-x)*b,e[5]=(1-(h+y))*b,e[6]=(m+g)*b,e[7]=0,e[8]=(d+_)*w,e[9]=(m-g)*w,e[10]=(1-(h+f))*w,e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e}function IT(e,t,r,i,a){var n=t[0],s=t[1],o=t[2],l=t[3],u=n+n,c=s+s,h=o+o,p=n*u,d=n*c,f=n*h,m=s*c,y=s*h,g=o*h,_=l*u,x=l*c,v=l*h,b=i[0],w=i[1],S=i[2],A=a[0],I=a[1],M=a[2],T=(1-(m+g))*b,P=(d+v)*b,C=(f-x)*b,E=(d-v)*w,k=(1-(p+g))*w,z=(y+_)*w,D=(f+x)*S,B=(y-_)*S,F=(1-(p+m))*S;return e[0]=T,e[1]=P,e[2]=C,e[3]=0,e[4]=E,e[5]=k,e[6]=z,e[7]=0,e[8]=D,e[9]=B,e[10]=F,e[11]=0,e[12]=r[0]+A-(T*A+E*I+D*M),e[13]=r[1]+I-(P*A+k*I+B*M),e[14]=r[2]+M-(C*A+z*I+F*M),e[15]=1,e}function MT(e,t){var r=t[0],i=t[1],a=t[2],n=t[3],s=r+r,o=i+i,l=a+a,u=r*s,c=i*s,h=i*o,p=a*s,d=a*o,f=a*l,m=n*s,y=n*o,g=n*l;return e[0]=1-h-f,e[1]=c+g,e[2]=p-y,e[3]=0,e[4]=c-g,e[5]=1-u-f,e[6]=d+m,e[7]=0,e[8]=p+y,e[9]=d-m,e[10]=1-u-h,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function CT(e,t,r,i,a,n,s){var o=1/(r-t),l=1/(a-i),u=1/(n-s);return e[0]=2*n*o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=2*n*l,e[6]=0,e[7]=0,e[8]=(r+t)*o,e[9]=(a+i)*l,e[10]=(s+n)*u,e[11]=-1,e[12]=0,e[13]=0,e[14]=s*n*2*u,e[15]=0,e}function ab(e,t,r,i,a){var n,s=1/Math.tan(t/2);return e[0]=s/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=a&&a!==1/0?(n=1/(i-a),e[10]=(a+i)*n,e[14]=2*a*i*n):(e[10]=-1,e[14]=-2*i),e}wi(G,{add:()=>VT,adjoint:()=>uT,clone:()=>iT,copy:()=>nT,create:()=>rT,determinant:()=>cT,equals:()=>qT,exactEquals:()=>GT,frob:()=>OT,fromQuat:()=>MT,fromQuat2:()=>ST,fromRotation:()=>bT,fromRotationTranslation:()=>ib,fromRotationTranslationScale:()=>AT,fromRotationTranslationScaleOrigin:()=>IT,fromScaling:()=>xT,fromTranslation:()=>gT,fromValues:()=>aT,fromXRotation:()=>_T,fromYRotation:()=>vT,fromZRotation:()=>wT,frustum:()=>CT,getRotation:()=>TT,getScaling:()=>nb,getTranslation:()=>PT,identity:()=>tb,invert:()=>lT,lookAt:()=>FT,mul:()=>jT,multiply:()=>rb,multiplyScalar:()=>UT,multiplyScalarAndAdd:()=>NT,ortho:()=>DT,orthoNO:()=>ob,orthoZO:()=>zT,perspective:()=>ET,perspectiveFromFieldOfView:()=>LT,perspectiveNO:()=>ab,perspectiveZO:()=>kT,rotate:()=>fT,rotateX:()=>mT,rotateY:()=>dT,rotateZ:()=>yT,scale:()=>hT,set:()=>oT,str:()=>RT,sub:()=>ZT,subtract:()=>sb,targetTo:()=>BT,translate:()=>pT,transpose:()=>sT}),d(),l(rT,"create"),l(iT,"clone"),l(nT,"copy"),l(aT,"fromValues"),l(oT,"set"),l(tb,"identity"),l(sT,"transpose"),l(lT,"invert"),l(uT,"adjoint"),l(cT,"determinant"),l(rb,"multiply"),l(pT,"translate"),l(hT,"scale"),l(fT,"rotate"),l(mT,"rotateX"),l(dT,"rotateY"),l(yT,"rotateZ"),l(gT,"fromTranslation"),l(xT,"fromScaling"),l(bT,"fromRotation"),l(_T,"fromXRotation"),l(vT,"fromYRotation"),l(wT,"fromZRotation"),l(ib,"fromRotationTranslation"),l(ST,"fromQuat2"),l(PT,"getTranslation"),l(nb,"getScaling"),l(TT,"getRotation"),l(AT,"fromRotationTranslationScale"),l(IT,"fromRotationTranslationScaleOrigin"),l(MT,"fromQuat"),l(CT,"frustum"),l(ab,"perspectiveNO");var ET=ab;function kT(e,t,r,i,a){var n,s=1/Math.tan(t/2);return e[0]=s/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=a&&a!==1/0?(n=1/(i-a),e[10]=a*n,e[14]=a*i*n):(e[10]=-1,e[14]=-i),e}function LT(e,t,r,i){var a=Math.tan(t.upDegrees*Math.PI/180),n=Math.tan(t.downDegrees*Math.PI/180),s=Math.tan(t.leftDegrees*Math.PI/180),o=Math.tan(t.rightDegrees*Math.PI/180),l=2/(s+o),u=2/(a+n);return e[0]=l,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=u,e[6]=0,e[7]=0,e[8]=-(s-o)*l*.5,e[9]=(a-n)*u*.5,e[10]=i/(r-i),e[11]=-1,e[12]=0,e[13]=0,e[14]=i*r/(r-i),e[15]=0,e}function ob(e,t,r,i,a,n,s){var o=1/(t-r),l=1/(i-a),u=1/(n-s);return e[0]=-2*o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*u,e[11]=0,e[12]=(t+r)*o,e[13]=(a+i)*l,e[14]=(s+n)*u,e[15]=1,e}l(kT,"perspectiveZO"),l(LT,"perspectiveFromFieldOfView"),l(ob,"orthoNO");var DT=ob;function zT(e,t,r,i,a,n,s){var o=1/(t-r),l=1/(i-a),u=1/(n-s);return e[0]=-2*o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=u,e[11]=0,e[12]=(t+r)*o,e[13]=(a+i)*l,e[14]=n*u,e[15]=1,e}function FT(e,t,r,i){var a,n,s,o,l,u,c,h,p,d,f=t[0],m=t[1],y=t[2],g=i[0],_=i[1],x=i[2],v=r[0],b=r[1],w=r[2];return Math.abs(f-v)<ie&&Math.abs(m-b)<ie&&Math.abs(y-w)<ie?tb(e):(c=f-v,h=m-b,p=y-w,a=_*(p*=d=1/Math.hypot(c,h,p))-x*(h*=d),n=x*(c*=d)-g*p,s=g*h-_*c,(d=Math.hypot(a,n,s))?(a*=d=1/d,n*=d,s*=d):(a=0,n=0,s=0),o=h*s-p*n,l=p*a-c*s,u=c*n-h*a,(d=Math.hypot(o,l,u))?(o*=d=1/d,l*=d,u*=d):(o=0,l=0,u=0),e[0]=a,e[1]=o,e[2]=c,e[3]=0,e[4]=n,e[5]=l,e[6]=h,e[7]=0,e[8]=s,e[9]=u,e[10]=p,e[11]=0,e[12]=-(a*f+n*m+s*y),e[13]=-(o*f+l*m+u*y),e[14]=-(c*f+h*m+p*y),e[15]=1,e)}function BT(e,t,r,i){var a=t[0],n=t[1],s=t[2],o=i[0],l=i[1],u=i[2],c=a-r[0],h=n-r[1],p=s-r[2],d=c*c+h*h+p*p;d>0&&(c*=d=1/Math.sqrt(d),h*=d,p*=d);var f=l*p-u*h,m=u*c-o*p,y=o*h-l*c;return(d=f*f+m*m+y*y)>0&&(f*=d=1/Math.sqrt(d),m*=d,y*=d),e[0]=f,e[1]=m,e[2]=y,e[3]=0,e[4]=h*y-p*m,e[5]=p*f-c*y,e[6]=c*m-h*f,e[7]=0,e[8]=c,e[9]=h,e[10]=p,e[11]=0,e[12]=a,e[13]=n,e[14]=s,e[15]=1,e}function RT(e){return"mat4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+", "+e[9]+", "+e[10]+", "+e[11]+", "+e[12]+", "+e[13]+", "+e[14]+", "+e[15]+")"}function OT(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}function VT(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e[4]=t[4]+r[4],e[5]=t[5]+r[5],e[6]=t[6]+r[6],e[7]=t[7]+r[7],e[8]=t[8]+r[8],e[9]=t[9]+r[9],e[10]=t[10]+r[10],e[11]=t[11]+r[11],e[12]=t[12]+r[12],e[13]=t[13]+r[13],e[14]=t[14]+r[14],e[15]=t[15]+r[15],e}function sb(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e[4]=t[4]-r[4],e[5]=t[5]-r[5],e[6]=t[6]-r[6],e[7]=t[7]-r[7],e[8]=t[8]-r[8],e[9]=t[9]-r[9],e[10]=t[10]-r[10],e[11]=t[11]-r[11],e[12]=t[12]-r[12],e[13]=t[13]-r[13],e[14]=t[14]-r[14],e[15]=t[15]-r[15],e}function UT(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*r,e[9]=t[9]*r,e[10]=t[10]*r,e[11]=t[11]*r,e[12]=t[12]*r,e[13]=t[13]*r,e[14]=t[14]*r,e[15]=t[15]*r,e}function NT(e,t,r,i){return e[0]=t[0]+r[0]*i,e[1]=t[1]+r[1]*i,e[2]=t[2]+r[2]*i,e[3]=t[3]+r[3]*i,e[4]=t[4]+r[4]*i,e[5]=t[5]+r[5]*i,e[6]=t[6]+r[6]*i,e[7]=t[7]+r[7]*i,e[8]=t[8]+r[8]*i,e[9]=t[9]+r[9]*i,e[10]=t[10]+r[10]*i,e[11]=t[11]+r[11]*i,e[12]=t[12]+r[12]*i,e[13]=t[13]+r[13]*i,e[14]=t[14]+r[14]*i,e[15]=t[15]+r[15]*i,e}function GT(e,t){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]}function qT(e,t){var r=e[0],i=e[1],a=e[2],n=e[3],s=e[4],o=e[5],l=e[6],u=e[7],c=e[8],h=e[9],p=e[10],d=e[11],f=e[12],m=e[13],y=e[14],g=e[15],_=t[0],x=t[1],v=t[2],b=t[3],w=t[4],S=t[5],A=t[6],I=t[7],M=t[8],T=t[9],P=t[10],C=t[11],E=t[12],k=t[13],z=t[14],D=t[15];return Math.abs(r-_)<=ie*Math.max(1,Math.abs(r),Math.abs(_))&&Math.abs(i-x)<=ie*Math.max(1,Math.abs(i),Math.abs(x))&&Math.abs(a-v)<=ie*Math.max(1,Math.abs(a),Math.abs(v))&&Math.abs(n-b)<=ie*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(s-w)<=ie*Math.max(1,Math.abs(s),Math.abs(w))&&Math.abs(o-S)<=ie*Math.max(1,Math.abs(o),Math.abs(S))&&Math.abs(l-A)<=ie*Math.max(1,Math.abs(l),Math.abs(A))&&Math.abs(u-I)<=ie*Math.max(1,Math.abs(u),Math.abs(I))&&Math.abs(c-M)<=ie*Math.max(1,Math.abs(c),Math.abs(M))&&Math.abs(h-T)<=ie*Math.max(1,Math.abs(h),Math.abs(T))&&Math.abs(p-P)<=ie*Math.max(1,Math.abs(p),Math.abs(P))&&Math.abs(d-C)<=ie*Math.max(1,Math.abs(d),Math.abs(C))&&Math.abs(f-E)<=ie*Math.max(1,Math.abs(f),Math.abs(E))&&Math.abs(m-k)<=ie*Math.max(1,Math.abs(m),Math.abs(k))&&Math.abs(y-z)<=ie*Math.max(1,Math.abs(y),Math.abs(z))&&Math.abs(g-D)<=ie*Math.max(1,Math.abs(g),Math.abs(D))}l(zT,"orthoZO"),l(FT,"lookAt"),l(BT,"targetTo"),l(RT,"str"),l(OT,"frob"),l(VT,"add"),l(sb,"subtract"),l(UT,"multiplyScalar"),l(NT,"multiplyScalarAndAdd"),l(GT,"exactEquals"),l(qT,"equals");var jT=rb,ZT=sb,xt={};function lb(){var e=new we(3);return we!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function $T(e){var t=new we(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function ub(e){var t=e[0],r=e[1],i=e[2];return Math.hypot(t,r,i)}function HT(e,t,r){var i=new we(3);return i[0]=e,i[1]=t,i[2]=r,i}function WT(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function XT(e,t,r,i){return e[0]=t,e[1]=r,e[2]=i,e}function KT(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e}function cb(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e}function pb(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e[2]=t[2]*r[2],e}function hb(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e[2]=t[2]/r[2],e}function YT(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e}function JT(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e}function QT(e,t,r){return e[0]=Math.min(t[0],r[0]),e[1]=Math.min(t[1],r[1]),e[2]=Math.min(t[2],r[2]),e}function eA(e,t,r){return e[0]=Math.max(t[0],r[0]),e[1]=Math.max(t[1],r[1]),e[2]=Math.max(t[2],r[2]),e}function tA(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e[2]=Math.round(t[2]),e}function rA(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e}function iA(e,t,r,i){return e[0]=t[0]+r[0]*i,e[1]=t[1]+r[1]*i,e[2]=t[2]+r[2]*i,e}function fb(e,t){var r=t[0]-e[0],i=t[1]-e[1],a=t[2]-e[2];return Math.hypot(r,i,a)}function mb(e,t){var r=t[0]-e[0],i=t[1]-e[1],a=t[2]-e[2];return r*r+i*i+a*a}function db(e){var t=e[0],r=e[1],i=e[2];return t*t+r*r+i*i}function nA(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function aA(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e}function oA(e,t){var r=t[0],i=t[1],a=t[2],n=r*r+i*i+a*a;return n>0&&(n=1/Math.sqrt(n)),e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e}function yb(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function sA(e,t,r){var i=t[0],a=t[1],n=t[2],s=r[0],o=r[1],l=r[2];return e[0]=a*l-n*o,e[1]=n*s-i*l,e[2]=i*o-a*s,e}function lA(e,t,r,i){var a=t[0],n=t[1],s=t[2];return e[0]=a+i*(r[0]-a),e[1]=n+i*(r[1]-n),e[2]=s+i*(r[2]-s),e}function uA(e,t,r,i,a,n){var s=n*n,o=s*(2*n-3)+1,l=s*(n-2)+n,u=s*(n-1),c=s*(3-2*n);return e[0]=t[0]*o+r[0]*l+i[0]*u+a[0]*c,e[1]=t[1]*o+r[1]*l+i[1]*u+a[1]*c,e[2]=t[2]*o+r[2]*l+i[2]*u+a[2]*c,e}function cA(e,t,r,i,a,n){var s=1-n,o=s*s,l=n*n,u=o*s,c=3*n*o,h=3*l*s,p=l*n;return e[0]=t[0]*u+r[0]*c+i[0]*h+a[0]*p,e[1]=t[1]*u+r[1]*c+i[1]*h+a[1]*p,e[2]=t[2]*u+r[2]*c+i[2]*h+a[2]*p,e}function pA(e,t){t=t||1;var r=2*$t()*Math.PI,i=2*$t()-1,a=Math.sqrt(1-i*i)*t;return e[0]=Math.cos(r)*a,e[1]=Math.sin(r)*a,e[2]=i*t,e}function hA(e,t,r){var i=t[0],a=t[1],n=t[2],s=r[3]*i+r[7]*a+r[11]*n+r[15];return s=s||1,e[0]=(r[0]*i+r[4]*a+r[8]*n+r[12])/s,e[1]=(r[1]*i+r[5]*a+r[9]*n+r[13])/s,e[2]=(r[2]*i+r[6]*a+r[10]*n+r[14])/s,e}function fA(e,t,r){var i=t[0],a=t[1],n=t[2];return e[0]=i*r[0]+a*r[3]+n*r[6],e[1]=i*r[1]+a*r[4]+n*r[7],e[2]=i*r[2]+a*r[5]+n*r[8],e}function mA(e,t,r){var i=r[0],a=r[1],n=r[2],s=r[3],o=t[0],l=t[1],u=t[2],c=a*u-n*l,h=n*o-i*u,p=i*l-a*o,d=a*p-n*h,f=n*c-i*p,m=i*h-a*c,y=2*s;return c*=y,h*=y,p*=y,d*=2,f*=2,m*=2,e[0]=o+c+d,e[1]=l+h+f,e[2]=u+p+m,e}function dA(e,t,r,i){var a=[],n=[];return a[0]=t[0]-r[0],a[1]=t[1]-r[1],a[2]=t[2]-r[2],n[0]=a[0],n[1]=a[1]*Math.cos(i)-a[2]*Math.sin(i),n[2]=a[1]*Math.sin(i)+a[2]*Math.cos(i),e[0]=n[0]+r[0],e[1]=n[1]+r[1],e[2]=n[2]+r[2],e}function yA(e,t,r,i){var a=[],n=[];return a[0]=t[0]-r[0],a[1]=t[1]-r[1],a[2]=t[2]-r[2],n[0]=a[2]*Math.sin(i)+a[0]*Math.cos(i),n[1]=a[1],n[2]=a[2]*Math.cos(i)-a[0]*Math.sin(i),e[0]=n[0]+r[0],e[1]=n[1]+r[1],e[2]=n[2]+r[2],e}function gA(e,t,r,i){var a=[],n=[];return a[0]=t[0]-r[0],a[1]=t[1]-r[1],a[2]=t[2]-r[2],n[0]=a[0]*Math.cos(i)-a[1]*Math.sin(i),n[1]=a[0]*Math.sin(i)+a[1]*Math.cos(i),n[2]=a[2],e[0]=n[0]+r[0],e[1]=n[1]+r[1],e[2]=n[2]+r[2],e}function xA(e,t){var r=e[0],i=e[1],a=e[2],n=t[0],s=t[1],o=t[2],l=Math.sqrt(r*r+i*i+a*a)*Math.sqrt(n*n+s*s+o*o),u=l&&yb(e,t)/l;return Math.acos(Math.min(Math.max(u,-1),1))}function bA(e){return e[0]=0,e[1]=0,e[2]=0,e}function _A(e){return"vec3("+e[0]+", "+e[1]+", "+e[2]+")"}function vA(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function wA(e,t){var r=e[0],i=e[1],a=e[2],n=t[0],s=t[1],o=t[2];return Math.abs(r-n)<=ie*Math.max(1,Math.abs(r),Math.abs(n))&&Math.abs(i-s)<=ie*Math.max(1,Math.abs(i),Math.abs(s))&&Math.abs(a-o)<=ie*Math.max(1,Math.abs(a),Math.abs(o))}wi(xt,{add:()=>KT,angle:()=>xA,bezier:()=>cA,ceil:()=>YT,clone:()=>$T,copy:()=>WT,create:()=>lb,cross:()=>sA,dist:()=>AA,distance:()=>fb,div:()=>TA,divide:()=>hb,dot:()=>yb,equals:()=>wA,exactEquals:()=>vA,floor:()=>JT,forEach:()=>EA,fromValues:()=>HT,hermite:()=>uA,inverse:()=>aA,len:()=>MA,length:()=>ub,lerp:()=>lA,max:()=>eA,min:()=>QT,mul:()=>PA,multiply:()=>pb,negate:()=>nA,normalize:()=>oA,random:()=>pA,rotateX:()=>dA,rotateY:()=>yA,rotateZ:()=>gA,round:()=>tA,scale:()=>rA,scaleAndAdd:()=>iA,set:()=>XT,sqrDist:()=>IA,sqrLen:()=>CA,squaredDistance:()=>mb,squaredLength:()=>db,str:()=>_A,sub:()=>SA,subtract:()=>cb,transformMat3:()=>fA,transformMat4:()=>hA,transformQuat:()=>mA,zero:()=>bA}),d(),l(lb,"create"),l($T,"clone"),l(ub,"length"),l(HT,"fromValues"),l(WT,"copy"),l(XT,"set"),l(KT,"add"),l(cb,"subtract"),l(pb,"multiply"),l(hb,"divide"),l(YT,"ceil"),l(JT,"floor"),l(QT,"min"),l(eA,"max"),l(tA,"round"),l(rA,"scale"),l(iA,"scaleAndAdd"),l(fb,"distance"),l(mb,"squaredDistance"),l(db,"squaredLength"),l(nA,"negate"),l(aA,"inverse"),l(oA,"normalize"),l(yb,"dot"),l(sA,"cross"),l(lA,"lerp"),l(uA,"hermite"),l(cA,"bezier"),l(pA,"random"),l(hA,"transformMat4"),l(fA,"transformMat3"),l(mA,"transformQuat"),l(dA,"rotateX"),l(yA,"rotateY"),l(gA,"rotateZ"),l(xA,"angle"),l(bA,"zero"),l(_A,"str"),l(vA,"exactEquals"),l(wA,"equals");var SA=cb,PA=pb,TA=hb,AA=fb,IA=mb,MA=ub,CA=db,EA=function(){var e=lb();return function(t,r,i,a,n,s){var o,l;for(r||(r=3),i||(i=0),l=a?Math.min(a*r+i,t.length):t.length,o=i;o<l;o+=r)e[0]=t[o],e[1]=t[o+1],e[2]=t[o+2],n(e,e,s),t[o]=e[0],t[o+1]=e[1],t[o+2]=e[2];return t}}(),Ke={};function gb(){var e=new we(4);return we!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function kA(e){var t=new we(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function LA(e,t,r,i){var a=new we(4);return a[0]=e,a[1]=t,a[2]=r,a[3]=i,a}function DA(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function zA(e,t,r,i,a){return e[0]=t,e[1]=r,e[2]=i,e[3]=a,e}function FA(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e}function xb(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e}function bb(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e[2]=t[2]*r[2],e[3]=t[3]*r[3],e}function _b(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e[2]=t[2]/r[2],e[3]=t[3]/r[3],e}function BA(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e[3]=Math.ceil(t[3]),e}function RA(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e[3]=Math.floor(t[3]),e}function OA(e,t,r){return e[0]=Math.min(t[0],r[0]),e[1]=Math.min(t[1],r[1]),e[2]=Math.min(t[2],r[2]),e[3]=Math.min(t[3],r[3]),e}function VA(e,t,r){return e[0]=Math.max(t[0],r[0]),e[1]=Math.max(t[1],r[1]),e[2]=Math.max(t[2],r[2]),e[3]=Math.max(t[3],r[3]),e}function UA(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e[2]=Math.round(t[2]),e[3]=Math.round(t[3]),e}function NA(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e}function GA(e,t,r,i){return e[0]=t[0]+r[0]*i,e[1]=t[1]+r[1]*i,e[2]=t[2]+r[2]*i,e[3]=t[3]+r[3]*i,e}function vb(e,t){var r=t[0]-e[0],i=t[1]-e[1],a=t[2]-e[2],n=t[3]-e[3];return Math.hypot(r,i,a,n)}function wb(e,t){var r=t[0]-e[0],i=t[1]-e[1],a=t[2]-e[2],n=t[3]-e[3];return r*r+i*i+a*a+n*n}function Sb(e){var t=e[0],r=e[1],i=e[2],a=e[3];return Math.hypot(t,r,i,a)}function Pb(e){var t=e[0],r=e[1],i=e[2],a=e[3];return t*t+r*r+i*i+a*a}function qA(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e}function jA(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e[3]=1/t[3],e}function ZA(e,t){var r=t[0],i=t[1],a=t[2],n=t[3],s=r*r+i*i+a*a+n*n;return s>0&&(s=1/Math.sqrt(s)),e[0]=r*s,e[1]=i*s,e[2]=a*s,e[3]=n*s,e}function $A(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function HA(e,t,r,i){var a=r[0]*i[1]-r[1]*i[0],n=r[0]*i[2]-r[2]*i[0],s=r[0]*i[3]-r[3]*i[0],o=r[1]*i[2]-r[2]*i[1],l=r[1]*i[3]-r[3]*i[1],u=r[2]*i[3]-r[3]*i[2],c=t[0],h=t[1],p=t[2],d=t[3];return e[0]=h*u-p*l+d*o,e[1]=-c*u+p*s-d*n,e[2]=c*l-h*s+d*a,e[3]=-c*o+h*n-p*a,e}function WA(e,t,r,i){var a=t[0],n=t[1],s=t[2],o=t[3];return e[0]=a+i*(r[0]-a),e[1]=n+i*(r[1]-n),e[2]=s+i*(r[2]-s),e[3]=o+i*(r[3]-o),e}function XA(e,t){var r,i,a,n,s,o;t=t||1;do{s=(r=2*$t()-1)*r+(i=2*$t()-1)*i}while(s>=1);do{o=(a=2*$t()-1)*a+(n=2*$t()-1)*n}while(o>=1);var l=Math.sqrt((1-s)/o);return e[0]=t*r,e[1]=t*i,e[2]=t*a*l,e[3]=t*n*l,e}function KA(e,t,r){var i=t[0],a=t[1],n=t[2],s=t[3];return e[0]=r[0]*i+r[4]*a+r[8]*n+r[12]*s,e[1]=r[1]*i+r[5]*a+r[9]*n+r[13]*s,e[2]=r[2]*i+r[6]*a+r[10]*n+r[14]*s,e[3]=r[3]*i+r[7]*a+r[11]*n+r[15]*s,e}function YA(e,t,r){var i=t[0],a=t[1],n=t[2],s=r[0],o=r[1],l=r[2],u=r[3],c=u*i+o*n-l*a,h=u*a+l*i-s*n,p=u*n+s*a-o*i,d=-s*i-o*a-l*n;return e[0]=c*u+d*-s+h*-l-p*-o,e[1]=h*u+d*-o+p*-s-c*-l,e[2]=p*u+d*-l+c*-o-h*-s,e[3]=t[3],e}function JA(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e}function QA(e){return"vec4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"}function eI(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}function tI(e,t){var r=e[0],i=e[1],a=e[2],n=e[3],s=t[0],o=t[1],l=t[2],u=t[3];return Math.abs(r-s)<=ie*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(i-o)<=ie*Math.max(1,Math.abs(i),Math.abs(o))&&Math.abs(a-l)<=ie*Math.max(1,Math.abs(a),Math.abs(l))&&Math.abs(n-u)<=ie*Math.max(1,Math.abs(n),Math.abs(u))}wi(Ke,{add:()=>FA,ceil:()=>BA,clone:()=>kA,copy:()=>DA,create:()=>gb,cross:()=>HA,dist:()=>aI,distance:()=>vb,div:()=>nI,divide:()=>_b,dot:()=>$A,equals:()=>tI,exactEquals:()=>eI,floor:()=>RA,forEach:()=>uI,fromValues:()=>LA,inverse:()=>jA,len:()=>sI,length:()=>Sb,lerp:()=>WA,max:()=>VA,min:()=>OA,mul:()=>iI,multiply:()=>bb,negate:()=>qA,normalize:()=>ZA,random:()=>XA,round:()=>UA,scale:()=>NA,scaleAndAdd:()=>GA,set:()=>zA,sqrDist:()=>oI,sqrLen:()=>lI,squaredDistance:()=>wb,squaredLength:()=>Pb,str:()=>QA,sub:()=>rI,subtract:()=>xb,transformMat4:()=>KA,transformQuat:()=>YA,zero:()=>JA}),d(),l(gb,"create"),l(kA,"clone"),l(LA,"fromValues"),l(DA,"copy"),l(zA,"set"),l(FA,"add"),l(xb,"subtract"),l(bb,"multiply"),l(_b,"divide"),l(BA,"ceil"),l(RA,"floor"),l(OA,"min"),l(VA,"max"),l(UA,"round"),l(NA,"scale"),l(GA,"scaleAndAdd"),l(vb,"distance"),l(wb,"squaredDistance"),l(Sb,"length"),l(Pb,"squaredLength"),l(qA,"negate"),l(jA,"inverse"),l(ZA,"normalize"),l($A,"dot"),l(HA,"cross"),l(WA,"lerp"),l(XA,"random"),l(KA,"transformMat4"),l(YA,"transformQuat"),l(JA,"zero"),l(QA,"str"),l(eI,"exactEquals"),l(tI,"equals");var rI=xb,iI=bb,nI=_b,aI=vb,oI=wb,sI=Sb,lI=Pb,uI=function(){var e=gb();return function(t,r,i,a,n,s){var o,l;for(r||(r=4),i||(i=0),l=a?Math.min(a*r+i,t.length):t.length,o=i;o<l;o+=r)e[0]=t[o],e[1]=t[o+1],e[2]=t[o+2],e[3]=t[o+3],n(e,e,s),t[o]=e[0],t[o+1]=e[1],t[o+2]=e[2],t[o+3]=e[3];return t}}(),Yi={};function Tb(){var e=new we(2);return we!=Float32Array&&(e[0]=0,e[1]=0),e}function cI(e){var t=new we(2);return t[0]=e[0],t[1]=e[1],t}function pI(e,t){var r=new we(2);return r[0]=e,r[1]=t,r}function hI(e,t){return e[0]=t[0],e[1]=t[1],e}function fI(e,t,r){return e[0]=t,e[1]=r,e}function mI(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e}function Ab(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e}function Ib(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e}function Mb(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e}function dI(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e}function yI(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e}function gI(e,t,r){return e[0]=Math.min(t[0],r[0]),e[1]=Math.min(t[1],r[1]),e}function xI(e,t,r){return e[0]=Math.max(t[0],r[0]),e[1]=Math.max(t[1],r[1]),e}function bI(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e}function _I(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e}function vI(e,t,r,i){return e[0]=t[0]+r[0]*i,e[1]=t[1]+r[1]*i,e}function Cb(e,t){var r=t[0]-e[0],i=t[1]-e[1];return Math.hypot(r,i)}function Eb(e,t){var r=t[0]-e[0],i=t[1]-e[1];return r*r+i*i}function kb(e){var t=e[0],r=e[1];return Math.hypot(t,r)}function Lb(e){var t=e[0],r=e[1];return t*t+r*r}function wI(e,t){return e[0]=-t[0],e[1]=-t[1],e}function SI(e,t){return e[0]=1/t[0],e[1]=1/t[1],e}function PI(e,t){var r=t[0],i=t[1],a=r*r+i*i;return a>0&&(a=1/Math.sqrt(a)),e[0]=t[0]*a,e[1]=t[1]*a,e}function TI(e,t){return e[0]*t[0]+e[1]*t[1]}function AI(e,t,r){var i=t[0]*r[1]-t[1]*r[0];return e[0]=e[1]=0,e[2]=i,e}function II(e,t,r,i){var a=t[0],n=t[1];return e[0]=a+i*(r[0]-a),e[1]=n+i*(r[1]-n),e}function MI(e,t){t=t||1;var r=2*$t()*Math.PI;return e[0]=Math.cos(r)*t,e[1]=Math.sin(r)*t,e}function CI(e,t,r){var i=t[0],a=t[1];return e[0]=r[0]*i+r[2]*a,e[1]=r[1]*i+r[3]*a,e}function EI(e,t,r){var i=t[0],a=t[1];return e[0]=r[0]*i+r[2]*a+r[4],e[1]=r[1]*i+r[3]*a+r[5],e}function kI(e,t,r){var i=t[0],a=t[1];return e[0]=r[0]*i+r[3]*a+r[6],e[1]=r[1]*i+r[4]*a+r[7],e}function LI(e,t,r){var i=t[0],a=t[1];return e[0]=r[0]*i+r[4]*a+r[12],e[1]=r[1]*i+r[5]*a+r[13],e}function DI(e,t,r,i){var a=t[0]-r[0],n=t[1]-r[1],s=Math.sin(i),o=Math.cos(i);return e[0]=a*o-n*s+r[0],e[1]=a*s+n*o+r[1],e}function zI(e,t){var r=e[0],i=e[1],a=t[0],n=t[1],s=Math.sqrt(r*r+i*i)*Math.sqrt(a*a+n*n),o=s&&(r*a+i*n)/s;return Math.acos(Math.min(Math.max(o,-1),1))}function FI(e){return e[0]=0,e[1]=0,e}function BI(e){return"vec2("+e[0]+", "+e[1]+")"}function RI(e,t){return e[0]===t[0]&&e[1]===t[1]}function OI(e,t){var r=e[0],i=e[1],a=t[0],n=t[1];return Math.abs(r-a)<=ie*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(i-n)<=ie*Math.max(1,Math.abs(i),Math.abs(n))}wi(Yi,{add:()=>mI,angle:()=>zI,ceil:()=>dI,clone:()=>cI,copy:()=>hI,create:()=>Tb,cross:()=>AI,dist:()=>qI,distance:()=>Cb,div:()=>GI,divide:()=>Mb,dot:()=>TI,equals:()=>OI,exactEquals:()=>RI,floor:()=>yI,forEach:()=>$I,fromValues:()=>pI,inverse:()=>SI,len:()=>VI,length:()=>kb,lerp:()=>II,max:()=>xI,min:()=>gI,mul:()=>NI,multiply:()=>Ib,negate:()=>wI,normalize:()=>PI,random:()=>MI,rotate:()=>DI,round:()=>bI,scale:()=>_I,scaleAndAdd:()=>vI,set:()=>fI,sqrDist:()=>jI,sqrLen:()=>ZI,squaredDistance:()=>Eb,squaredLength:()=>Lb,str:()=>BI,sub:()=>UI,subtract:()=>Ab,transformMat2:()=>CI,transformMat2d:()=>EI,transformMat3:()=>kI,transformMat4:()=>LI,zero:()=>FI}),d(),l(Tb,"create"),l(cI,"clone"),l(pI,"fromValues"),l(hI,"copy"),l(fI,"set"),l(mI,"add"),l(Ab,"subtract"),l(Ib,"multiply"),l(Mb,"divide"),l(dI,"ceil"),l(yI,"floor"),l(gI,"min"),l(xI,"max"),l(bI,"round"),l(_I,"scale"),l(vI,"scaleAndAdd"),l(Cb,"distance"),l(Eb,"squaredDistance"),l(kb,"length"),l(Lb,"squaredLength"),l(wI,"negate"),l(SI,"inverse"),l(PI,"normalize"),l(TI,"dot"),l(AI,"cross"),l(II,"lerp"),l(MI,"random"),l(CI,"transformMat2"),l(EI,"transformMat2d"),l(kI,"transformMat3"),l(LI,"transformMat4"),l(DI,"rotate"),l(zI,"angle"),l(FI,"zero"),l(BI,"str"),l(RI,"exactEquals"),l(OI,"equals");var VI=kb,UI=Ab,NI=Ib,GI=Mb,qI=Cb,jI=Eb,ZI=Lb,$I=function(){var e=Tb();return function(t,r,i,a,n,s){var o,l;for(r||(r=2),i||(i=0),l=a?Math.min(a*r+i,t.length):t.length,o=i;o<l;o+=r)e[0]=t[o],e[1]=t[o+1],n(e,e,s),t[o]=e[0],t[o+1]=e[1];return t}}(),Db=se(Pe(),1),xf=class extends Ze{constructor(e){super(e,Kx)}createBucket(e){return new oi(e)}queryRadius(e){let t=e;return si("circle-radius",this,t)+si("circle-stroke-width",this,t)+Cr(this.paint.get("circle-translate"))}queryIntersectsFeature(e,t,r,i,a,n,s,o){let l=Er(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),n.angle,s),u=this.paint.get("circle-radius").evaluate(t,r)+this.paint.get("circle-stroke-width").evaluate(t,r),c="map"===this.paint.get("circle-pitch-alignment"),h=c?l:HI(l,o),p=c?u*s:u;for(let e of i)for(let t of e){let e=c?t:zb(t,o),r=p,i=Ke.transformMat4([],[t.x,t.y,0,1],o);if("viewport"===this.paint.get("circle-pitch-scale")&&"map"===this.paint.get("circle-pitch-alignment")?r*=i[3]/n.cameraToCenterDistance:"map"===this.paint.get("circle-pitch-scale")&&"viewport"===this.paint.get("circle-pitch-alignment")&&(r*=n.cameraToCenterDistance/i[3]),qx(h,e,r))return!0}return!1}};l(xf,"CircleStyleLayer");var js=xf;function zb(e,t){let r=Ke.transformMat4([],[e.x,e.y,0,1],t);return new Db.default(r[0]/r[3],r[1]/r[3])}function HI(e,t){return e.map((e=>zb(e,t)))}l(zb,"projectPoint"),l(HI,"projectQueryGeometry"),d(),d();var bf=class extends oi{};l(bf,"HeatmapBucket");var Ea=bf;N("HeatmapBucket",Ea,{omit:["layers"]}),d();var Fb,WI=l((()=>Fb=Fb||new Re({"heatmap-radius":new W(M.paint_heatmap["heatmap-radius"]),"heatmap-weight":new W(M.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Z(M.paint_heatmap["heatmap-intensity"]),"heatmap-color":new ei(M.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Z(M.paint_heatmap["heatmap-opacity"])})),"getPaint"),Bb={get paint(){return WI()}};function _f(e,{width:t,height:r},i,a){if(a){if(a instanceof Uint8ClampedArray)a=new Uint8Array(a.buffer);else if(a.length!==t*r*i)throw new RangeError("mismatched image size. expected: ".concat(a.length," but got: ").concat(t*r*i))}else a=new Uint8Array(t*r*i);return e.width=t,e.height=r,e.data=a,e}function Rb(e,{width:t,height:r},i){if(t===e.width&&r===e.height)return;let a=_f({},{width:t,height:r},i);vf(e,a,{x:0,y:0},{x:0,y:0},{width:Math.min(e.width,t),height:Math.min(e.height,r)},i),e.width=t,e.height=r,e.data=a.data}function vf(e,t,r,i,a,n){if(0===a.width||0===a.height)return t;if(a.width>e.width||a.height>e.height||r.x>e.width-a.width||r.y>e.height-a.height)throw new RangeError("out of range source coordinates for image copy");if(a.width>t.width||a.height>t.height||i.x>t.width-a.width||i.y>t.height-a.height)throw new RangeError("out of range destination coordinates for image copy");let s=e.data,o=t.data;if(s===o)throw new Error("srcData equals dstData, so image is already copied");for(let l=0;l<a.height;l++){let u=((r.y+l)*e.width+r.x)*n,c=((i.y+l)*t.width+i.x)*n;for(let e=0;e<a.width*n;e++)o[c+e]=s[u+e]}return t}d(),d(),l(_f,"createImage"),l(Rb,"resizeImage"),l(vf,"copyImage");var Zs=class e{constructor(e,t){_f(this,e,1,t)}resize(e){Rb(this,e,1)}clone(){return new e({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,r,i,a){vf(e,t,r,i,a,1)}};l(Zs,"AlphaImage");var li=Zs,$s=class e{constructor(e,t){_f(this,e,4,t)}resize(e){Rb(this,e,4)}replace(e,t){t?this.data.set(e):e instanceof Uint8ClampedArray?this.data=new Uint8Array(e.buffer):this.data=e}clone(){return new e({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,r,i,a){vf(e,t,r,i,a,4)}};l($s,"RGBAImage");var Ee=$s;function Hs(e){let t={},r=e.resolution||256,i=e.clips?e.clips.length:1,a=e.image||new Ee({width:r,height:i});if(!lg(r))throw new Error("width is not a power of 2 - ".concat(r));let n=l(((r,i,n)=>{t[e.evaluationKey]=n;let s=e.expression.evaluate(t);a.data[r+i+0]=Math.floor(255*s.r/s.a),a.data[r+i+1]=Math.floor(255*s.g/s.a),a.data[r+i+2]=Math.floor(255*s.b/s.a),a.data[r+i+3]=Math.floor(255*s.a)}),"renderPixel");if(e.clips)for(let t=0,a=0;t<i;++t,a+=4*r)for(let i=0,s=0;i<r;i++,s+=4){let o=i/(r-1),{start:l,end:u}=e.clips[t];n(a,s,l*(1-o)+u*o)}else for(let e=0,t=0;e<r;e++,t+=4){n(0,t,e/(r-1))}return a}N("AlphaImage",li),N("RGBAImage",Ee),l(Hs,"renderColorRamp");var wf=class extends Ze{createBucket(e){return new Ea(e)}constructor(e){super(e,Bb),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){"heatmap-color"===e&&this._updateColorRamp()}_updateColorRamp(){let e=this._transitionablePaint._values["heatmap-color"].value.expression;this.colorRamp=Hs({expression:e,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}};l(wf,"HeatmapStyleLayer");var Ws=wf;d(),d();var Ob,XI=l((()=>Ob=Ob||new Re({"hillshade-illumination-direction":new Z(M.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Z(M.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Z(M.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Z(M.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Z(M.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Z(M.paint_hillshade["hillshade-accent-color"])})),"getPaint"),Vb={get paint(){return XI()}},Sf=class extends Ze{constructor(e){super(e,Vb)}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}};l(Sf,"HillshadeStyleLayer");var Xs=Sf;d(),d(),d();var KI=ve([{name:"a_pos",components:2,type:"Int16"}],4),{members:Ub,size:c3,alignment:p3}=KI,$b=se(Mf(),1);function Cf(e,t,r,i,a){Zb(e,t,r||0,i||e.length-1,a||hM)}function Zb(e,t,r,i,a){for(;i>r;){if(i-r>600){var n=i-r+1,s=t-r+1,o=Math.log(n),l=.5*Math.exp(2*o/3),u=.5*Math.sqrt(o*l*(n-l)/n)*(s-n/2<0?-1:1);Zb(e,t,Math.max(r,Math.floor(t-s*l/n+u)),Math.min(i,Math.floor(t+(n-s)*l/n+u)),a)}var c=e[t],h=r,p=i;for(za(e,r,t),a(e[i],c)>0&&za(e,r,i);h<p;){for(za(e,h,p),h++,p--;a(e[h],c)<0;)h++;for(;a(e[p],c)>0;)p--}0===a(e[r],c)?za(e,r,p):za(e,++p,i),p<=t&&(r=p+1),t<=p&&(i=p-1)}}function za(e,t,r){var i=e[t];e[t]=e[r],e[r]=i}function hM(e,t){return e<t?-1:e>t?1:0}function Fa(e,t){let r=e.length;if(r<=1)return[e];let i,a,n=[];for(let t=0;t<r;t++){let r=hg(e[t]);0!==r&&(e[t].area=Math.abs(r),void 0===a&&(a=r<0),a===r<0?(i&&n.push(i),i=[e[t]]):i.push(e[t]))}if(i&&n.push(i),t>1)for(let e=0;e<n.length;e++)n[e].length<=t||(Cf(n[e],t,1,n[e].length-1,fM),n[e]=n[e].slice(0,t));return n}function fM(e,t){return t.area-e.area}function Qi(e,t,r){let i=r.patternDependencies,a=!1;for(let r of t){let t=r.paint.get("".concat(e,"-pattern"));t.isConstant()||(a=!0);let n=t.constantOr(null);n&&(a=!0,i[n.to]=!0,i[n.from]=!0)}return a}function en(e,t,r,i,a){let n=a.patternDependencies;for(let s of t){let t=s.paint.get("".concat(e,"-pattern")).value;if("constant"!==t.kind){let e=t.evaluate({zoom:i-1},r,{},a.availableImages),o=t.evaluate({zoom:i},r,{},a.availableImages),l=t.evaluate({zoom:i+1},r,{},a.availableImages);e=e&&e.name?e.name:e,o=o&&o.name?o.name:o,l=l&&l.name?l.name:l,n[e]=!0,n[o]=!0,n[l]=!0,r.patterns[s.id]={min:e,mid:o,max:l}}}return r}d(),d(),l(Cf,"quickselect"),l(Zb,"quickselectStep"),l(za,"swap"),l(hM,"defaultCompare"),l(Fa,"classifyRings"),l(fM,"compareAreas"),d(),l(Qi,"hasPattern"),l(en,"addPatternDependencies");var mM=500,Ef=class{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new As,this.indexArray=new at,this.indexArray2=new Ar,this.programConfigurations=new dt(e.layers,e.zoom),this.segments=new me,this.segments2=new me,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,t,r){this.hasPattern=Qi("fill",this.layers,t);let i=this.layers[0].layout.get("fill-sort-key"),a=!i.isConstant(),n=[];for(let{feature:s,id:o,index:l,sourceLayerIndex:u}of e){let e=this.layers[0]._featureFilter.needGeometry,c=gt(s,e);if(!this.layers[0]._featureFilter.filter(new ye(this.zoom),c,r))continue;let h=a?i.evaluate(c,{},r,t.availableImages):void 0,p={id:o,properties:s.properties,type:s.type,sourceLayerIndex:u,index:l,geometry:e?c.geometry:yt(s),patterns:{},sortKey:h};n.push(p)}a&&n.sort(((e,t)=>e.sortKey-t.sortKey));for(let i of n){let{geometry:a,index:n,sourceLayerIndex:s}=i;if(this.hasPattern){let e=en("fill",this.layers,i,this.zoom,t);this.patternFeatures.push(e)}else this.addFeature(i,a,n,r,{});let o=e[n].feature;t.featureIndex.insert(o,a,n,s,this.index)}}update(e,t,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,r)}addFeatures(e,t,r){for(let e of this.patternFeatures)this.addFeature(e,e.geometry,e.index,t,r)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Ub),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(e,t,r,i,a){for(let e of Fa(t,mM)){let t=0;for(let r of e)t+=r.length;let r=this.segments.prepareSegment(t,this.layoutVertexArray,this.indexArray),i=r.vertexLength,a=[],n=[];for(let t of e){if(0===t.length)continue;t!==e[0]&&n.push(a.length/2);let r=this.segments2.prepareSegment(t.length,this.layoutVertexArray,this.indexArray2),i=r.vertexLength;this.layoutVertexArray.emplaceBack(t[0].x,t[0].y),this.indexArray2.emplaceBack(i+t.length-1,i),a.push(t[0].x),a.push(t[0].y);for(let e=1;e<t.length;e++)this.layoutVertexArray.emplaceBack(t[e].x,t[e].y),this.indexArray2.emplaceBack(i+e-1,i+e),a.push(t[e].x),a.push(t[e].y);r.vertexLength+=t.length,r.primitiveLength+=t.length}let s=(0,$b.default)(a,n);for(let e=0;e<s.length;e+=3)this.indexArray.emplaceBack(i+s[e],i+s[e+1],i+s[e+2]);r.vertexLength+=t,r.primitiveLength+=s.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,a,i)}};l(Ef,"FillBucket");var Ba=Ef;N("FillBucket",Ba,{omit:["layers","patternFeatures"]}),d();var Hb,Wb,dM=l((()=>Hb=Hb||new Re({"fill-sort-key":new W(M.layout_fill["fill-sort-key"])})),"getLayout"),yM=l((()=>Wb=Wb||new Re({"fill-antialias":new Z(M.paint_fill["fill-antialias"]),"fill-opacity":new W(M.paint_fill["fill-opacity"]),"fill-color":new W(M.paint_fill["fill-color"]),"fill-outline-color":new W(M.paint_fill["fill-outline-color"]),"fill-translate":new Z(M.paint_fill["fill-translate"]),"fill-translate-anchor":new Z(M.paint_fill["fill-translate-anchor"]),"fill-pattern":new ir(M.paint_fill["fill-pattern"])})),"getPaint"),Xb={get paint(){return yM()},get layout(){return dM()}},kf=class extends Ze{constructor(e){super(e,Xb)}recalculate(e,t){super.recalculate(e,t);let r=this.paint._values["fill-outline-color"];"constant"===r.value.kind&&void 0===r.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new Ba(e)}queryRadius(){return Cr(this.paint.get("fill-translate"))}queryIntersectsFeature(e,t,r,i,a,n,s){return Gs(Er(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),n.angle,s),i)}isTileClipped(){return!0}};l(kf,"FillStyleLayer");var el=kf;d(),d(),d();var gM=ve([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Kb=ve([{name:"a_centroid",components:2,type:"Int16"}],4),{members:Yb,size:lB,alignment:uB}=gM,i_=se(Mf(),1),n_=se(Ra(),1),CM=n_.default.VectorTileFeature.types,EM=500,zf=Math.pow(2,13);function Oa(e,t,r,i,a,n,s,o){e.emplaceBack(t,r,2*Math.floor(i*zf)+s,a*zf*2,n*zf*2,Math.round(o))}l(Oa,"addVertex");var Ff=class{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new Is,this.centroidVertexArray=new Tr,this.indexArray=new at,this.programConfigurations=new dt(e.layers,e.zoom),this.segments=new me,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,t,r){this.features=[],this.hasPattern=Qi("fill-extrusion",this.layers,t);for(let{feature:i,id:a,index:n,sourceLayerIndex:s}of e){let e=this.layers[0]._featureFilter.needGeometry,o=gt(i,e);if(!this.layers[0]._featureFilter.filter(new ye(this.zoom),o,r))continue;let l={id:a,sourceLayerIndex:s,index:n,geometry:e?o.geometry:yt(i),properties:i.properties,type:i.type,patterns:{}};this.hasPattern?this.features.push(en("fill-extrusion",this.layers,l,this.zoom,t)):this.addFeature(l,l.geometry,n,r,{}),t.featureIndex.insert(i,l.geometry,n,s,this.index,!0)}}addFeatures(e,t,r){for(let e of this.features){let{geometry:i}=e;this.addFeature(e,i,e.index,t,r)}}update(e,t,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,r)}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.centroidVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Yb),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,Kb.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,t,r,i,a){let n={x:0,y:0,vertexCount:0};for(let r of Fa(t,EM)){let t=0;for(let e of r)t+=e.length;let i=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(let e of r){if(0===e.length||LM(e))continue;let t=0;for(let r=0;r<e.length;r++){let a=e[r];if(r>=1){let s=e[r-1];if(!kM(a,s)){i.vertexLength+4>me.MAX_VERTEX_ARRAY_LENGTH&&(i=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let e=a.sub(s)._perp()._unit(),r=s.dist(a);t+r>32768&&(t=0),Oa(this.layoutVertexArray,a.x,a.y,e.x,e.y,0,0,t),Oa(this.layoutVertexArray,a.x,a.y,e.x,e.y,0,1,t),n.x+=2*a.x,n.y+=2*a.y,n.vertexCount+=2,t+=r,Oa(this.layoutVertexArray,s.x,s.y,e.x,e.y,0,0,t),Oa(this.layoutVertexArray,s.x,s.y,e.x,e.y,0,1,t),n.x+=2*s.x,n.y+=2*s.y,n.vertexCount+=2;let o=i.vertexLength;this.indexArray.emplaceBack(o,o+2,o+1),this.indexArray.emplaceBack(o+1,o+2,o+3),i.vertexLength+=4,i.primitiveLength+=2}}}}if(i.vertexLength+t>me.MAX_VERTEX_ARRAY_LENGTH&&(i=this.segments.prepareSegment(t,this.layoutVertexArray,this.indexArray)),"Polygon"!==CM[e.type])continue;let a=[],s=[],o=i.vertexLength;for(let e of r)if(0!==e.length){e!==r[0]&&s.push(a.length/2);for(let t=0;t<e.length;t++){let r=e[t];Oa(this.layoutVertexArray,r.x,r.y,0,0,1,1,0),n.x+=r.x,n.y+=r.y,n.vertexCount+=1,a.push(r.x),a.push(r.y)}}let l=(0,i_.default)(a,s);for(let e=0;e<l.length;e+=3)this.indexArray.emplaceBack(o+l[e],o+l[e+2],o+l[e+1]);i.primitiveLength+=l.length/3,i.vertexLength+=t}for(let e=0;e<n.vertexCount;e++)this.centroidVertexArray.emplaceBack(Math.floor(n.x/n.vertexCount),Math.floor(n.y/n.vertexCount));this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,a,i)}};l(Ff,"FillExtrusionBucket");var Va=Ff;function kM(e,t){return e.x===t.x&&(e.x<0||e.x>8192)||e.y===t.y&&(e.y<0||e.y>8192)}function LM(e){return e.every((e=>e.x<0))||e.every((e=>e.x>8192))||e.every((e=>e.y<0))||e.every((e=>e.y>8192))}N("FillExtrusionBucket",Va,{omit:["layers","features"]}),l(kM,"isBoundaryEdge"),l(LM,"isEntirelyOutside"),d();var a_,DM=l((()=>a_=a_||new Re({"fill-extrusion-opacity":new Z(M["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new W(M["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Z(M["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Z(M["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new ir(M["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new W(M["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new W(M["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Z(M["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})),"getPaint"),o_={get paint(){return DM()}},rl=se(Pe(),1),Bf=class extends Ze{constructor(e){super(e,o_)}createBucket(e){return new Va(e)}queryRadius(){return Cr(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(e,t,r,i,a,n,s,o){let l=Er(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),n.angle,s),u=this.paint.get("fill-extrusion-height").evaluate(t,r),c=this.paint.get("fill-extrusion-base").evaluate(t,r),h=BM(l,o,n,0),p=FM(i,c,u,o);return zM(p[0],p[1],h)}};l(Bf,"FillExtrusionStyleLayer");var il=Bf;function Ua(e,t){return e.x*t.x+e.y*t.y}function s_(e,t){if(1===e.length){let r,i=0,a=t[i++];for(;!r||a.equals(r);)if(r=t[i++],!r)return 1/0;for(;i<t.length;i++){let n=t[i],s=e[0],o=r.sub(a),l=n.sub(a),u=s.sub(a),c=Ua(o,o),h=Ua(o,l),p=Ua(l,l),d=Ua(u,o),f=Ua(u,l),m=c*p-h*h,y=(p*d-h*f)/m,g=(c*f-h*d)/m,_=1-y-g,x=a.z*_+r.z*y+n.z*g;if(isFinite(x))return x}return 1/0}{let e=1/0;for(let r of t)e=Math.min(e,r.z);return e}}function zM(e,t,r){let i=1/0;Gs(r,t)&&(i=s_(r,t[0]));for(let a=0;a<t.length;a++){let n=t[a],s=e[a];for(let e=0;e<n.length-1;e++){let t=n[e],a=n[e+1],o=s[e],l=[t,a,s[e+1],o,t];Ns(r,l)&&(i=Math.min(i,s_(r,l)))}}return i!==1/0&&i}function FM(e,t,r,i){let a=[],n=[],s=i[8]*t,o=i[9]*t,l=i[10]*t,u=i[11]*t,c=i[8]*r,h=i[9]*r,p=i[10]*r,d=i[11]*r;for(let t of e){let e=[],r=[];for(let a of t){let t=a.x,n=a.y,f=i[0]*t+i[4]*n+i[12],m=i[1]*t+i[5]*n+i[13],y=i[2]*t+i[6]*n+i[14],g=i[3]*t+i[7]*n+i[15],_=f+s,x=m+o,v=y+l,b=g+u,w=f+c,S=m+h,A=y+p,I=g+d,M=new rl.default(_/b,x/b);M.z=v/b,e.push(M);let T=new rl.default(w/I,S/I);T.z=A/I,r.push(T)}a.push(e),n.push(r)}return[a,n]}function BM(e,t,r,i){let a=[];for(let r of e){let e=[r.x,r.y,i,1];Ke.transformMat4(e,e,t),a.push(new rl.default(e[0]/e[3],e[1]/e[3]))}return a}l(Ua,"dot"),l(s_,"getIntersectionDistance"),l(zM,"checkIntersection"),l(FM,"projectExtrusion"),l(BM,"projectQueryGeometry"),d(),d(),d();var RM=ve([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:l_,size:aR,alignment:oR}=RM;d();var OM=ve([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:u_,size:cR,alignment:pR}=OM,h_=se(Ra(),1),VM=h_.default.VectorTileFeature.types,c_=63,UM=Math.cos(Math.PI/180*37.5),NM=15,GM=20,qM=15,f_=.5,p_=Math.pow(2,qM-1)/f_,Rf=class{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((e=>{this.gradients[e.id]={}})),this.layoutVertexArray=new Ms,this.layoutVertexArray2=new Cs,this.indexArray=new at,this.programConfigurations=new dt(e.layers,e.zoom),this.segments=new me,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id))}populate(e,t,r){this.hasPattern=Qi("line",this.layers,t);let i=this.layers[0].layout.get("line-sort-key"),a=!i.isConstant(),n=[];for(let{feature:t,id:s,index:o,sourceLayerIndex:l}of e){let e=this.layers[0]._featureFilter.needGeometry,u=gt(t,e);if(!this.layers[0]._featureFilter.filter(new ye(this.zoom),u,r))continue;let c=a?i.evaluate(u,{},r):void 0,h={id:s,properties:t.properties,type:t.type,sourceLayerIndex:l,index:o,geometry:e?u.geometry:yt(t),patterns:{},sortKey:c};n.push(h)}a&&n.sort(((e,t)=>e.sortKey-t.sortKey));for(let i of n){let{geometry:a,index:n,sourceLayerIndex:s}=i;if(this.hasPattern){let e=en("line",this.layers,i,this.zoom,t);this.patternFeatures.push(e)}else this.addFeature(i,a,n,r,{});let o=e[n].feature;t.featureIndex.insert(o,a,n,s,this.index)}}update(e,t,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,r)}addFeatures(e,t,r){for(let e of this.patternFeatures)this.addFeature(e,e.geometry,e.index,t,r)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,u_)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,l_),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")){return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}}addFeature(e,t,r,i,a){let n=this.layers[0].layout,s=n.get("line-join").evaluate(e,{}),o=n.get("line-cap"),l=n.get("line-miter-limit"),u=n.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(let r of t)this.addLine(r,e,s,o,l,u);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,a,i)}addLine(e,t,r,i,a,n){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let t=0;t<e.length-1;t++)this.totalDistance+=e[t].dist(e[t+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let s="Polygon"===VM[t.type],o=e.length;for(;o>=2&&e[o-1].equals(e[o-2]);)o--;let l=0;for(;l<o-1&&e[l].equals(e[l+1]);)l++;if(o<(s?3:2))return;"bevel"===r&&(a=1.05);let u,c,h,p,d,f=this.overscaling<=16?8192*NM/(512*this.overscaling):0,m=this.segments.prepareSegment(10*o,this.layoutVertexArray,this.indexArray);this.e1=this.e2=-1,s&&(u=e[o-2],d=e[l].sub(u)._unit()._perp());for(let t=l;t<o;t++){if(h=t===o-1?s?e[l+1]:void 0:e[t+1],h&&e[t].equals(h))continue;d&&(p=d),u&&(c=u),u=e[t],d=h?h.sub(u)._unit()._perp():p,p=p||d;let y=p.add(d);(0!==y.x||0!==y.y)&&y._unit();let g=p.x*d.x+p.y*d.y,_=y.x*d.x+y.y*d.y,x=0!==_?1/_:1/0,v=2*Math.sqrt(2-2*_),b=_<UM&&c&&h,w=p.x*d.y-p.y*d.x>0;if(b&&t>l){let e=u.dist(c);if(e>2*f){let t=u.sub(u.sub(c)._mult(f/e)._round());this.updateDistance(c,t),this.addCurrentVertex(t,p,0,0,m),c=t}}let S=c&&h,A=S?r:s?"butt":i;if(S&&"round"===A&&(x<n?A="miter":x<=2&&(A="fakeround")),"miter"===A&&x>a&&(A="bevel"),"bevel"===A&&(x>2&&(A="flipbevel"),x<a&&(A="miter")),c&&this.updateDistance(c,u),"miter"===A)y._mult(x),this.addCurrentVertex(u,y,0,0,m);else if("flipbevel"===A){if(x>100)y=d.mult(-1);else{let e=x*p.add(d).mag()/p.sub(d).mag();y._perp()._mult(e*(w?-1:1))}this.addCurrentVertex(u,y,0,0,m),this.addCurrentVertex(u,y.mult(-1),0,0,m)}else if("bevel"===A||"fakeround"===A){let e=-Math.sqrt(x*x-1),t=w?e:0,r=w?0:e;if(c&&this.addCurrentVertex(u,p,t,r,m),"fakeround"===A){let e=Math.round(180*v/Math.PI/GM);for(let t=1;t<e;t++){let r=t/e;if(.5!==r){let e=r-.5;r+=r*e*(r-1)*((1.0904+g*(g*(3.55645-1.43519*g)-3.2452))*e*e+(.848013+g*(.215638*g-1.06021)))}let i=d.sub(p)._mult(r)._add(p)._unit()._mult(w?-1:1);this.addHalfVertex(u,i.x,i.y,!1,w,0,m)}}h&&this.addCurrentVertex(u,d,-t,-r,m)}else if("butt"===A)this.addCurrentVertex(u,y,0,0,m);else if("square"===A){let e=c?1:-1;this.addCurrentVertex(u,y,e,e,m)}else"round"===A&&(c&&(this.addCurrentVertex(u,p,0,0,m),this.addCurrentVertex(u,p,1,1,m,!0)),h&&(this.addCurrentVertex(u,d,-1,-1,m,!0),this.addCurrentVertex(u,d,0,0,m)));if(b&&t<o-1){let e=u.dist(h);if(e>2*f){let t=u.add(h.sub(u)._mult(f/e)._round());this.updateDistance(u,t),this.addCurrentVertex(t,d,0,0,m),u=t}}}}addCurrentVertex(e,t,r,i,a,n=!1){let s=t.x+t.y*r,o=t.y-t.x*r,l=-t.x+t.y*i,u=-t.y-t.x*i;this.addHalfVertex(e,s,o,n,!1,r,a),this.addHalfVertex(e,l,u,n,!0,-i,a),this.distance>p_/2&&0===this.totalDistance&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,t,r,i,a,n))}addHalfVertex({x:e,y:t},r,i,a,n,s,o){let l=(this.lineClips?this.scaledDistance*(p_-1):this.scaledDistance)*f_;if(this.layoutVertexArray.emplaceBack((e<<1)+(a?1:0),(t<<1)+(n?1:0),Math.round(c_*r)+128,Math.round(c_*i)+128,1+(0===s?0:s<0?-1:1)|(63&l)<<2,l>>6),this.lineClips){let e=(this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start);this.layoutVertexArray2.emplaceBack(e,this.lineClipsArray.length)}let u=o.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,u),o.primitiveLength++),n?this.e2=u:this.e1=u}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,t){this.distance+=e.dist(t),this.updateScaledDistance()}};l(Rf,"LineBucket");var Na=Rf;N("LineBucket",Na,{omit:["layers","patternFeatures"]}),d();var m_,d_,jM=l((()=>m_=m_||new Re({"line-cap":new Z(M.layout_line["line-cap"]),"line-join":new W(M.layout_line["line-join"]),"line-miter-limit":new Z(M.layout_line["line-miter-limit"]),"line-round-limit":new Z(M.layout_line["line-round-limit"]),"line-sort-key":new W(M.layout_line["line-sort-key"])})),"getLayout"),ZM=l((()=>d_=d_||new Re({"line-opacity":new W(M.paint_line["line-opacity"]),"line-color":new W(M.paint_line["line-color"]),"line-translate":new Z(M.paint_line["line-translate"]),"line-translate-anchor":new Z(M.paint_line["line-translate-anchor"]),"line-width":new W(M.paint_line["line-width"]),"line-gap-width":new W(M.paint_line["line-gap-width"]),"line-offset":new W(M.paint_line["line-offset"]),"line-blur":new W(M.paint_line["line-blur"]),"line-dasharray":new Qr(M.paint_line["line-dasharray"]),"line-pattern":new ir(M.paint_line["line-pattern"]),"line-gradient":new ei(M.paint_line["line-gradient"])})),"getPaint"),Of={get paint(){return ZM()},get layout(){return jM()}},Uf=class extends W{possiblyEvaluate(e,t){return t=new ye(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,zoomHistory:t.zoomHistory,transition:t.transition}),super.possiblyEvaluate(e,t)}evaluate(e,t,r,i){return t=R({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(e,t,r,i)}};l(Uf,"LineFloorwidthProperty");var nl,Vf=Uf,Nf=class extends Ze{constructor(e){super(e,Of),this.gradientVersion=0,nl||((nl=new Vf(Of.paint.properties["line-width"].specification)).useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if("line-gradient"===e){let e=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=e._styleExpression.expression instanceof zi,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,t){super.recalculate(e,t),this.paint._values["line-floorwidth"]=nl.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new Na(e)}queryRadius(e){let t=e,r=y_(si("line-width",this,t),si("line-gap-width",this,t)),i=si("line-offset",this,t);return r/2+Math.abs(i)+Cr(this.paint.get("line-translate"))}queryIntersectsFeature(e,t,r,i,a,n,s){let o=Er(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),n.angle,s),l=s/2*y_(this.paint.get("line-width").evaluate(t,r),this.paint.get("line-gap-width").evaluate(t,r)),u=this.paint.get("line-offset").evaluate(t,r);return u&&(i=Hx(i,u*s)),jx(o,i,l)}isTileClipped(){return!0}};l(Nf,"LineStyleLayer");var al=Nf;function y_(e,t){return t>0?t+2*e:e}l(y_,"getLineWidth"),d(),d(),d();var g_=ve([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),x_=ve([{name:"a_projected_pos",components:3,type:"Float32"}],4),t4=ve([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),b_=ve([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]),r4=ve([{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"}]),Gf=ve([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),__=ve([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4),i4=ve([{name:"triangle",components:3,type:"Uint16"}]),n4=ve([{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"}]),a4=ve([{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",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),o4=ve([{type:"Float32",name:"offsetX"}]),s4=ve([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),ja=se(Pe(),1);function $M(e,t,r){let i=t.layout.get("text-transform").evaluate(r,{});return"uppercase"===i?e=e.toLocaleUpperCase():"lowercase"===i&&(e=e.toLocaleLowerCase()),mt.applyArabicShaping&&(e=mt.applyArabicShaping(e)),e}function v_(e,t,r){return e.sections.forEach((e=>{e.text=$M(e.text,t,r)})),e}function w_(e){let t={},r={},i=[],a=0;function n(t){i.push(e[t]),a++}function s(e,t,a){let n=r[e];return delete r[e],r[t]=n,i[n].geometry[0].pop(),i[n].geometry[0]=i[n].geometry[0].concat(a[0]),n}function o(e,r,a){let n=t[r];return delete t[r],t[e]=n,i[n].geometry[0].shift(),i[n].geometry[0]=a[0].concat(i[n].geometry[0]),n}function u(e,t,r){let i=r?t[0][t[0].length-1]:t[0][0];return"".concat(e,":").concat(i.x,":").concat(i.y)}l(n,"add"),l(s,"mergeFromRight"),l(o,"mergeFromLeft"),l(u,"getKey");for(let l=0;l<e.length;l++){let c=e[l],h=c.geometry,p=c.text?c.text.toString():null;if(!p){n(l);continue}let d=u(p,h),f=u(p,h,!0);if(d in r&&f in t&&r[d]!==t[f]){let e=o(d,f,h),a=s(d,f,i[e].geometry);delete t[d],delete r[f],r[u(p,i[a].geometry,!0)]=a,i[e].geometry=null}else d in r?s(d,f,h):f in t?o(d,f,h):(n(l),t[d]=a-1,r[f]=a-1)}return i.filter((e=>e.geometry))}d(),l($M,"transformTextInternal"),l(v_,"transformText"),d(),l(w_,"mergeLines"),d(),d();var S_={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};d();var ci=24;d();var k_=se(Zf(),1),E_=3;function cC(e,t,r){1===e&&r.readMessage(pC,t)}function pC(e,t,r){if(3===e){let{id:e,bitmap:i,width:a,height:n,left:s,top:o,advance:l}=r.readMessage(hC,{});t.push({id:e,bitmap:new li({width:a+2*E_,height:n+2*E_},i),metrics:{width:a,height:n,left:s,top:o,advance:l}})}}function hC(e,t,r){1===e?t.id=r.readVarint():2===e?t.bitmap=r.readBytes():3===e?t.width=r.readVarint():4===e?t.height=r.readVarint():5===e?t.left=r.readSVarint():6===e?t.top=r.readSVarint():7===e&&(t.advance=r.readVarint())}function L_(e){return new k_.default(e).readFields(cC,[])}function Ga(e){let t=0,r=0;for(let i of e)t+=i.w*i.h,r=Math.max(r,i.w);e.sort(((e,t)=>t.h-e.h));let i=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),r),h:1/0}],a=0,n=0;for(let t of e)for(let e=i.length-1;e>=0;e--){let r=i[e];if(!(t.w>r.w||t.h>r.h)){if(t.x=r.x,t.y=r.y,n=Math.max(n,t.y+t.h),a=Math.max(a,t.x+t.w),t.w===r.w&&t.h===r.h){let t=i.pop();e<i.length&&(i[e]=t)}else t.h===r.h?(r.x+=t.w,r.w-=t.w):t.w===r.w?(r.y+=t.h,r.h-=t.h):(i.push({x:r.x+t.w,y:r.y,w:r.w-t.w,h:t.h}),r.y+=t.h,r.h-=t.h);break}}return{w:a,h:n,fill:t/(a*n)||0}}l(cC,"readFontstacks"),l(pC,"readFontstack"),l(hC,"readGlyph"),l(L_,"parseGlyphPbf"),d(),d(),l(Ga,"potpack");var bt=1,Hf=class{constructor(e,{pixelRatio:t,version:r,stretchX:i,stretchY:a,content:n}){this.paddedRect=e,this.pixelRatio=t,this.stretchX=i,this.stretchY=a,this.content=n,this.version=r}get tl(){return[this.paddedRect.x+bt,this.paddedRect.y+bt]}get br(){return[this.paddedRect.x+this.paddedRect.w-bt,this.paddedRect.y+this.paddedRect.h-bt]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2*bt)/this.pixelRatio,(this.paddedRect.h-2*bt)/this.pixelRatio]}};l(Hf,"ImagePosition");var an=Hf,Wf=class{constructor(e,t){let r={},i={};this.haveRenderCallbacks=[];let a=[];this.addImages(e,r,a),this.addImages(t,i,a);let{w:n,h:s}=Ga(a),o=new Ee({width:n||1,height:s||1});for(let t in e){let i=e[t],a=r[t].paddedRect;Ee.copy(i.data,o,{x:0,y:0},{x:a.x+bt,y:a.y+bt},i.data)}for(let e in t){let r=t[e],a=i[e].paddedRect,n=a.x+bt,s=a.y+bt,l=r.data.width,u=r.data.height;Ee.copy(r.data,o,{x:0,y:0},{x:n,y:s},r.data),Ee.copy(r.data,o,{x:0,y:u-1},{x:n,y:s-1},{width:l,height:1}),Ee.copy(r.data,o,{x:0,y:0},{x:n,y:s+u},{width:l,height:1}),Ee.copy(r.data,o,{x:l-1,y:0},{x:n-1,y:s},{width:1,height:u}),Ee.copy(r.data,o,{x:0,y:0},{x:n+l,y:s},{width:1,height:u})}this.image=o,this.iconPositions=r,this.patternPositions=i}addImages(e,t,r){for(let i in e){let a=e[i],n={x:0,y:0,w:a.data.width+2*bt,h:a.data.height+2*bt};r.push(n),t[i]=new an(n,a),a.hasRenderCallback&&this.haveRenderCallbacks.push(i)}}patchUpdatedImages(e,t){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(let r in e.updatedImages)this.patchUpdatedImage(this.iconPositions[r],e.getImage(r),t),this.patchUpdatedImage(this.patternPositions[r],e.getImage(r),t)}patchUpdatedImage(e,t,r){if(!e||!t||e.version===t.version)return;e.version=t.version;let[i,a]=e.tl;r.update(t.data,void 0,{x:i,y:a})}};l(Wf,"ImageAtlas");var $f=Wf;N("ImagePosition",an),N("ImageAtlas",$f);var pi=(e=>(e[e.none=0]="none",e[e.horizontal=1]="horizontal",e[e.vertical=2]="vertical",e[e.horizontalOnly=3]="horizontalOnly",e))(pi||{});function ll(e){let t=.5,r=.5;switch(e){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0}switch(e){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:t,verticalAlign:r}}l(ll,"getAnchorAlignment");var F_=se(Ra(),1);d();var D_=255,qa=128,ul=D_*qa;function Xf(e,t){let{expression:r}=t;if("constant"===r.kind)return{kind:"constant",layoutSize:r.evaluate(new ye(e+1))};if("source"===r.kind)return{kind:"source"};{let{zoomStops:t,interpolationType:i}=r,a=0;for(;a<t.length&&t[a]<=e;)a++;a=Math.max(0,a-1);let n=a;for(;n<t.length&&t[n]<e+1;)n++;n=Math.min(t.length-1,n);let s=t[a],o=t[n];return"composite"===r.kind?{kind:"composite",minZoom:s,maxZoom:o,interpolationType:i}:{kind:"camera",minZoom:s,maxZoom:o,minSize:r.evaluate(new ye(s)),maxSize:r.evaluate(new ye(o)),interpolationType:i}}}function on(e,{uSize:t,uSizeT:r},{lowerSize:i,upperSize:a}){return"source"===e.kind?i/qa:"composite"===e.kind?ke.number(i/qa,a/qa,r):t}function hi(e,t){let r=0,i=0;if("constant"===e.kind)i=e.layoutSize;else if("source"!==e.kind){let{interpolationType:a,minZoom:n,maxZoom:s}=e,o=a?Te(St.interpolationFactor(a,t,n,s),0,1):0;"camera"===e.kind?i=ke.number(e.minSize,e.maxSize,o):r=o}return{uSizeT:r,uSize:i}}function sn(e,t,r){let i="never",a=e.get(t);return a?i=a:e.get(r)&&(i="always"),i}l(Xf,"getSizeData"),l(on,"evaluateSizeForFeature"),l(hi,"evaluateSizeForZoom"),d(),l(sn,"getOverlapMode");var mC=F_.default.VectorTileFeature.types,dC=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function cl(e,t,r,i,a,n,s,o,l,u,c,h,p){let d=o?Math.min(ul,Math.round(o[0])):0,f=o?Math.min(ul,Math.round(o[1])):0;e.emplaceBack(t,r,Math.round(32*i),Math.round(32*a),n,s,(d<<1)+(l?1:0),f,16*u,16*c,256*h,256*p)}function fi(e,t,r){e.emplaceBack(t.x,t.y,r),e.emplaceBack(t.x,t.y,r),e.emplaceBack(t.x,t.y,r),e.emplaceBack(t.x,t.y,r)}function yC(e){for(let t of e.sections)if(Ax(t.text))return!0;return!1}l(cl,"addVertex"),l(fi,"addDynamicAttributes"),l(yC,"containsRTLText");var Kf=class{constructor(e){this.layoutVertexArray=new Es,this.indexArray=new at,this.programConfigurations=e,this.segments=new me,this.dynamicLayoutVertexArray=new ks,this.opacityVertexArray=new Ls,this.hasVisibleVertices=!1,this.placedSymbolArray=new xa}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length}upload(e,t,r,i){this.isEmpty()||(r&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,g_.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,t),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,x_.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,dC,!0),this.opacityVertexBuffer.itemSize=1),(r||i)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}};l(Kf,"SymbolBuffers");var Za=Kf;N("SymbolBuffers",Za);var Yf=class{constructor(e,t,r){this.layoutVertexArray=new e,this.layoutAttributes=t,this.indexArray=new r,this.segments=new me,this.collisionVertexArray=new zs}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,b_.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}};l(Yf,"CollisionBuffers");var $a=Yf;N("CollisionBuffers",$a);var Jf=class{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((e=>e.id)),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=G.identity([]),this.placementViewportMatrix=G.identity([]);let t=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Xf(this.zoom,t["text-size"]),this.iconSizeData=Xf(this.zoom,t["icon-size"]);let r=this.layers[0].layout,i=r.get("symbol-sort-key"),a=r.get("symbol-z-order");this.canOverlap="never"!==sn(r,"text-overlap","text-allow-overlap")||"never"!==sn(r,"icon-overlap","icon-allow-overlap")||r.get("text-ignore-placement")||r.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==a&&!i.isConstant();let n="viewport-y"===a||"auto"===a&&!this.sortFeaturesByKey;this.sortFeaturesByY=n&&this.canOverlap,"point"===r.get("symbol-placement")&&(this.writingModes=r.get("text-writing-mode").map((e=>pi[e]))),this.stateDependentLayerIds=this.layers.filter((e=>e.isStateDependent())).map((e=>e.id)),this.sourceID=e.sourceID}createArrays(){this.text=new Za(new dt(this.layers,this.zoom,(e=>/^text/.test(e)))),this.icon=new Za(new dt(this.layers,this.zoom,(e=>/^icon/.test(e)))),this.glyphOffsetArray=new _a,this.lineVertexArray=new va,this.symbolInstances=new ba}calculateGlyphDependencies(e,t,r,i,a){for(let n=0;n<e.length;n++)if(t[e.charCodeAt(n)]=!0,(r||i)&&a){let r=S_[e.charAt(n)];r&&(t[r.charCodeAt(0)]=!0)}}populate(e,t,r){let i=this.layers[0],a=i.layout,n=a.get("text-font"),s=a.get("text-field"),o=a.get("icon-image"),l=("constant"!==s.value.kind||s.value.value instanceof Pt&&!s.value.value.isEmpty()||s.value.value.toString().length>0)&&("constant"!==n.value.kind||n.value.value.length>0),u="constant"!==o.value.kind||!!o.value.value||Object.keys(o.parameters).length>0,c=a.get("symbol-sort-key");if(this.features=[],!l&&!u)return;let h=t.iconDependencies,p=t.glyphDependencies,d=t.availableImages,f=new ye(this.zoom);for(let{feature:t,id:s,index:o,sourceLayerIndex:m}of e){let e,y,g=i._featureFilter.needGeometry,_=gt(t,g);if(!i._featureFilter.filter(f,_,r))continue;if(g||(_.geometry=yt(t)),l){let t=i.getValueAndResolveTokens("text-field",_,r,d),a=Pt.factory(t);yC(a)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===Qn()||this.hasRTLText&&mt.isParsed())&&(e=v_(a,i,_))}if(u){let e=i.getValueAndResolveTokens("icon-image",_,r,d);y=e instanceof ht?e:ht.fromString(e)}if(!e&&!y)continue;let x=this.sortFeaturesByKey?c.evaluate(_,{},r):void 0,v={id:s,text:e,icon:y,index:o,sourceLayerIndex:m,geometry:_.geometry,properties:t.properties,type:mC[t.type],sortKey:x};if(this.features.push(v),y&&(h[y.name]=!0),e){let t=n.evaluate(_,{},r).join(","),i="viewport"!==a.get("text-rotation-alignment")&&"point"!==a.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(2)>=0;for(let r of e.sections)if(r.image)h[r.image.name]=!0;else{let a=Ip(e.toString()),n=r.fontStack||t,s=p[n]=p[n]||{};this.calculateGlyphDependencies(r.text,s,i,this.allowVerticalPlacement,a)}}}"line"===a.get("symbol-placement")&&(this.features=w_(this.features)),this.sortFeaturesByKey&&this.features.sort(((e,t)=>e.sortKey-t.sortKey))}update(e,t,r){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,t,this.layers,r),this.icon.programConfigurations.updatePaintArrays(e,t,this.layers,r))}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,t){let r=this.lineVertexArray.length;if(void 0!==e.segment){let r=e.dist(t[e.segment+1]),i=e.dist(t[e.segment]),a={};for(let i=e.segment+1;i<t.length;i++)a[i]={x:t[i].x,y:t[i].y,tileUnitDistanceFromAnchor:r},i<t.length-1&&(r+=t[i+1].dist(t[i]));for(let r=e.segment||0;r>=0;r--)a[r]={x:t[r].x,y:t[r].y,tileUnitDistanceFromAnchor:i},r>0&&(i+=t[r-1].dist(t[r]));for(let e=0;e<t.length;e++){let t=a[e];this.lineVertexArray.emplaceBack(t.x,t.y,t.tileUnitDistanceFromAnchor)}}return{lineStartIndex:r,lineLength:this.lineVertexArray.length-r}}addSymbols(e,t,r,i,a,n,s,o,l,u,c,h){let p=e.indexArray,d=e.layoutVertexArray,f=e.segments.prepareSegment(4*t.length,d,p,this.canOverlap?n.sortKey:void 0),m=this.glyphOffsetArray.length,y=f.vertexLength,g=this.allowVerticalPlacement&&2===s?Math.PI/2:0,_=n.text&&n.text.sections;for(let i=0;i<t.length;i++){let{tl:a,tr:s,bl:l,br:u,tex:c,pixelOffsetTL:m,pixelOffsetBR:y,minFontScaleX:x,minFontScaleY:v,glyphOffset:b,isSDF:w,sectionIndex:S}=t[i],A=f.vertexLength,I=b[1];cl(d,o.x,o.y,a.x,I+a.y,c.x,c.y,r,w,m.x,m.y,x,v),cl(d,o.x,o.y,s.x,I+s.y,c.x+c.w,c.y,r,w,y.x,m.y,x,v),cl(d,o.x,o.y,l.x,I+l.y,c.x,c.y+c.h,r,w,m.x,y.y,x,v),cl(d,o.x,o.y,u.x,I+u.y,c.x+c.w,c.y+c.h,r,w,y.x,y.y,x,v),fi(e.dynamicLayoutVertexArray,o,g),p.emplaceBack(A,A+1,A+2),p.emplaceBack(A+1,A+2,A+3),f.vertexLength+=4,f.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(b[0]),(i===t.length-1||S!==t[i+1].sectionIndex)&&e.programConfigurations.populatePaintArrays(d.length,n,n.index,{},h,_&&_[S])}e.placedSymbolArray.emplaceBack(o.x,o.y,m,this.glyphOffsetArray.length-m,y,l,u,o.segment,r?r[0]:0,r?r[1]:0,i[0],i[1],s,0,!1,0,c)}_addCollisionDebugVertex(e,t,r,i,a,n){return t.emplaceBack(0,0),e.emplaceBack(r.x,r.y,i,a,Math.round(n.x),Math.round(n.y))}addCollisionDebugVertices(e,t,r,i,a,n,s){let o=a.segments.prepareSegment(4,a.layoutVertexArray,a.indexArray),l=o.vertexLength,u=a.layoutVertexArray,c=a.collisionVertexArray,h=s.anchorX,p=s.anchorY;this._addCollisionDebugVertex(u,c,n,h,p,new ja.default(e,t)),this._addCollisionDebugVertex(u,c,n,h,p,new ja.default(r,t)),this._addCollisionDebugVertex(u,c,n,h,p,new ja.default(r,i)),this._addCollisionDebugVertex(u,c,n,h,p,new ja.default(e,i)),o.vertexLength+=4;let d=a.indexArray;d.emplaceBack(l,l+1),d.emplaceBack(l+1,l+2),d.emplaceBack(l+2,l+3),d.emplaceBack(l+3,l),o.primitiveLength+=4}addDebugCollisionBoxes(e,t,r,i){for(let a=e;a<t;a++){let e=this.collisionBoxArray.get(a),t=e.x1,n=e.y1,s=e.x2,o=e.y2;this.addCollisionDebugVertices(t,n,s,o,i?this.textCollisionBox:this.iconCollisionBox,e.anchorPoint,r)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new $a(Sa,Gf.members,Ar),this.iconCollisionBox=new $a(Sa,Gf.members,Ar);for(let e=0;e<this.symbolInstances.length;e++){let t=this.symbolInstances.get(e);this.addDebugCollisionBoxes(t.textBoxStartIndex,t.textBoxEndIndex,t,!0),this.addDebugCollisionBoxes(t.verticalTextBoxStartIndex,t.verticalTextBoxEndIndex,t,!0),this.addDebugCollisionBoxes(t.iconBoxStartIndex,t.iconBoxEndIndex,t,!1),this.addDebugCollisionBoxes(t.verticalIconBoxStartIndex,t.verticalIconBoxEndIndex,t,!1)}}_deserializeCollisionBoxesForSymbol(e,t,r,i,a,n,s,o,l){let u={};for(let i=t;i<r;i++){let t=e.get(i);u.textBox={x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,anchorPointX:t.anchorPointX,anchorPointY:t.anchorPointY},u.textFeatureIndex=t.featureIndex;break}for(let t=i;t<a;t++){let r=e.get(t);u.verticalTextBox={x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2,anchorPointX:r.anchorPointX,anchorPointY:r.anchorPointY},u.verticalTextFeatureIndex=r.featureIndex;break}for(let t=n;t<s;t++){let r=e.get(t);u.iconBox={x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2,anchorPointX:r.anchorPointX,anchorPointY:r.anchorPointY},u.iconFeatureIndex=r.featureIndex;break}for(let t=o;t<l;t++){let r=e.get(t);u.verticalIconBox={x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2,anchorPointX:r.anchorPointX,anchorPointY:r.anchorPointY},u.verticalIconFeatureIndex=r.featureIndex;break}return u}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let t=0;t<this.symbolInstances.length;t++){let r=this.symbolInstances.get(t);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,r.textBoxStartIndex,r.textBoxEndIndex,r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r.iconBoxStartIndex,r.iconBoxEndIndex,r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(e,t){let r=e.placedSymbolArray.get(t),i=r.vertexStartIndex+4*r.numGlyphs;for(let t=r.vertexStartIndex;t<i;t+=4)e.indexArray.emplaceBack(t,t+1,t+2),e.indexArray.emplaceBack(t+1,t+2,t+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;let t=Math.sin(e),r=Math.cos(e),i=[],a=[],n=[];for(let e=0;e<this.symbolInstances.length;++e){n.push(e);let s=this.symbolInstances.get(e);i.push(0|Math.round(t*s.anchorX+r*s.anchorY)),a.push(s.featureIndex)}return n.sort(((e,t)=>i[e]-i[t]||a[t]-a[e])),n}addToSortKeyRanges(e,t){let r=this.sortKeyRanges[this.sortKeyRanges.length-1];r&&r.sortKey===t?r.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:t,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let e of this.symbolInstanceIndexes){let t=this.symbolInstances.get(e);this.featureSortOrder.push(t.featureIndex),[t.rightJustifiedTextSymbolIndex,t.centerJustifiedTextSymbolIndex,t.leftJustifiedTextSymbolIndex].forEach(((e,t,r)=>{e>=0&&r.indexOf(e)===t&&this.addIndicesForPlacedSymbol(this.text,e)})),t.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,t.verticalPlacedTextSymbolIndex),t.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,t.placedIconSymbolIndex),t.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,t.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}};l(Jf,"SymbolBucket");var qt=Jf;function B_(e,t){return t.replace(/{([^{}]+)}/g,((t,r)=>r in e?String(e[r]):""))}N("SymbolBucket",qt,{omit:["layers","collisionBoxArray","features","compareText"]}),qt.MAX_GLYPHS=65535,qt.addDynamicAttributes=fi,d(),l(B_,"resolveTokens"),d();var R_,O_,gC=l((()=>R_=R_||new Re({"symbol-placement":new Z(M.layout_symbol["symbol-placement"]),"symbol-spacing":new Z(M.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Z(M.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new W(M.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Z(M.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Z(M.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Z(M.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Z(M.layout_symbol["icon-ignore-placement"]),"icon-optional":new Z(M.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Z(M.layout_symbol["icon-rotation-alignment"]),"icon-size":new W(M.layout_symbol["icon-size"]),"icon-text-fit":new Z(M.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Z(M.layout_symbol["icon-text-fit-padding"]),"icon-image":new W(M.layout_symbol["icon-image"]),"icon-rotate":new W(M.layout_symbol["icon-rotate"]),"icon-padding":new W(M.layout_symbol["icon-padding"]),"icon-keep-upright":new Z(M.layout_symbol["icon-keep-upright"]),"icon-offset":new W(M.layout_symbol["icon-offset"]),"icon-anchor":new W(M.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Z(M.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Z(M.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Z(M.layout_symbol["text-rotation-alignment"]),"text-field":new W(M.layout_symbol["text-field"]),"text-font":new W(M.layout_symbol["text-font"]),"text-size":new W(M.layout_symbol["text-size"]),"text-max-width":new W(M.layout_symbol["text-max-width"]),"text-line-height":new Z(M.layout_symbol["text-line-height"]),"text-letter-spacing":new W(M.layout_symbol["text-letter-spacing"]),"text-justify":new W(M.layout_symbol["text-justify"]),"text-radial-offset":new W(M.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Z(M.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new W(M.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new W(M.layout_symbol["text-anchor"]),"text-max-angle":new Z(M.layout_symbol["text-max-angle"]),"text-writing-mode":new Z(M.layout_symbol["text-writing-mode"]),"text-rotate":new W(M.layout_symbol["text-rotate"]),"text-padding":new Z(M.layout_symbol["text-padding"]),"text-keep-upright":new Z(M.layout_symbol["text-keep-upright"]),"text-transform":new W(M.layout_symbol["text-transform"]),"text-offset":new W(M.layout_symbol["text-offset"]),"text-allow-overlap":new Z(M.layout_symbol["text-allow-overlap"]),"text-overlap":new Z(M.layout_symbol["text-overlap"]),"text-ignore-placement":new Z(M.layout_symbol["text-ignore-placement"]),"text-optional":new Z(M.layout_symbol["text-optional"])})),"getLayout"),xC=l((()=>O_=O_||new Re({"icon-opacity":new W(M.paint_symbol["icon-opacity"]),"icon-color":new W(M.paint_symbol["icon-color"]),"icon-halo-color":new W(M.paint_symbol["icon-halo-color"]),"icon-halo-width":new W(M.paint_symbol["icon-halo-width"]),"icon-halo-blur":new W(M.paint_symbol["icon-halo-blur"]),"icon-translate":new Z(M.paint_symbol["icon-translate"]),"icon-translate-anchor":new Z(M.paint_symbol["icon-translate-anchor"]),"text-opacity":new W(M.paint_symbol["text-opacity"]),"text-color":new W(M.paint_symbol["text-color"],{runtimeType:zt,getOverride:l((e=>e.textColor),"getOverride"),hasOverride:l((e=>!!e.textColor),"hasOverride")}),"text-halo-color":new W(M.paint_symbol["text-halo-color"]),"text-halo-width":new W(M.paint_symbol["text-halo-width"]),"text-halo-blur":new W(M.paint_symbol["text-halo-blur"]),"text-translate":new Z(M.paint_symbol["text-translate"]),"text-translate-anchor":new Z(M.paint_symbol["text-translate-anchor"])})),"getPaint"),pl={get paint(){return xC()},get layout(){return gC()}};d();var Qf=class{constructor(e){if(void 0===e.property.overrides)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:Bi,this.defaultValue=e}evaluate(e){if(e.formattedSection){let t=this.defaultValue.property.overrides;if(t&&t.hasOverride(e.formattedSection))return t.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){if(!this.defaultValue.isConstant()){e(this.defaultValue.value._styleExpression.expression)}}outputDefined(){return!1}serialize(){return null}};l(Qf,"FormatSectionOverride");var Ha=Qf;N("FormatSectionOverride",Ha,{omit:["defaultValue"]});var Wa=class e extends Ze{constructor(e){super(e,pl)}recalculate(e,t){if(super.recalculate(e,t),"auto"===this.layout.get("icon-rotation-alignment")&&("point"!==this.layout.get("symbol-placement")?this.layout._values["icon-rotation-alignment"]="map":this.layout._values["icon-rotation-alignment"]="viewport"),"auto"===this.layout.get("text-rotation-alignment")&&("point"!==this.layout.get("symbol-placement")?this.layout._values["text-rotation-alignment"]="map":this.layout._values["text-rotation-alignment"]="viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]="map"===this.layout.get("text-rotation-alignment")?"map":"viewport"),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),"point"===this.layout.get("symbol-placement")){let e=this.layout.get("text-writing-mode");if(e){let t=[];for(let r of e)t.indexOf(r)<0&&t.push(r);this.layout._values["text-writing-mode"]=t}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,t,r,i){let a=this.layout.get(e).evaluate(t,{},r,i),n=this._unevaluatedLayout._values[e];return n.isDataDriven()||Yn(n.value)||!a?a:B_(t.properties,a)}createBucket(e){return new qt(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let t of pl.paint.overridableProperties){if(!e.hasPaintOverride(this.layout,t))continue;let r=this.paint.get(t),i=new Ha(r),a=new Wr(i,r.property.specification),n=null;n="constant"===r.value.kind||"source"===r.value.kind?new br("source",a):new _r("composite",a,r.value.zoomStops),this.paint._values[t]=new ot(r.property,n,r.parameters)}}_handleOverridablePaintPropertyUpdate(t,r,i){return!(!this.layout||r.isDataDriven()||i.isDataDriven())&&e.hasPaintOverride(this.layout,t)}static hasPaintOverride(e,t){let r=e.get("text-field"),i=pl.paint.properties[t],a=!1,n=l((e=>{for(let t of e)if(i.overrides&&i.overrides.hasOverride(t))return void(a=!0)}),"checkSections");if("constant"===r.value.kind&&r.value.value instanceof Pt)n(r.value.value.sections);else if("source"===r.value.kind){let e=l((t=>{if(!a)if(t instanceof gr&&Xe(t.value)===Ri){let e=t.value;n(e.sections)}else t instanceof $n?n(t.sections):t.eachChild(e)}),"checkExpression"),t=r.value;t._styleExpression&&e(t._styleExpression.expression)}return a}};l(Wa,"SymbolStyleLayer");var hl=Wa;d(),d();var V_,bC=l((()=>V_=V_||new Re({"background-color":new Z(M.paint_background["background-color"]),"background-pattern":new Qr(M.paint_background["background-pattern"]),"background-opacity":new Z(M.paint_background["background-opacity"])})),"getPaint"),U_={get paint(){return bC()}},em=class extends Ze{constructor(e){super(e,U_)}};l(em,"BackgroundStyleLayer");var fl=em;d(),d();var N_,_C=l((()=>N_=N_||new Re({"raster-opacity":new Z(M.paint_raster["raster-opacity"]),"raster-hue-rotate":new Z(M.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Z(M.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Z(M.paint_raster["raster-brightness-max"]),"raster-saturation":new Z(M.paint_raster["raster-saturation"]),"raster-contrast":new Z(M.paint_raster["raster-contrast"]),"raster-resampling":new Z(M.paint_raster["raster-resampling"]),"raster-fade-duration":new Z(M.paint_raster["raster-fade-duration"])})),"getPaint"),G_={get paint(){return _C()}},tm=class extends Ze{constructor(e){super(e,G_)}};l(tm,"RasterStyleLayer");var ml=tm;function q_(e){let t=[],r=e.id;return void 0===r&&t.push({message:"layers.".concat(r,': missing required property "id"')}),void 0===e.render&&t.push({message:"layers.".concat(r,': missing required method "render"')}),e.renderingMode&&"2d"!==e.renderingMode&&"3d"!==e.renderingMode&&t.push({message:"layers.".concat(r,': property "renderingMode" must be either "2d" or "3d"')}),t}d(),l(q_,"validateCustomStyleLayer");var rm=class extends Ze{constructor(e){super(e,{}),this.onAdd=l((e=>{this.implementation.onAdd&&this.implementation.onAdd(e,e.painter.context.gl)}),"onAdd"),this.onRemove=l((e=>{this.implementation.onRemove&&this.implementation.onRemove(e,e.painter.context.gl)}),"onRemove"),this.implementation=e}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}};l(rm,"CustomStyleLayer");var dl=rm;function yl(e){if("custom"===e.type)return new dl(e);switch(e.type){case"background":return new fl(e);case"circle":return new js(e);case"fill":return new el(e);case"fill-extrusion":return new il(e);case"heatmap":return new Ws(e);case"hillshade":return new Xs(e);case"line":return new al(e);case"raster":return new ml(e);case"symbol":return new hl(e)}}function ln(e){let t=[];if("string"==typeof e)t.push({id:"default",url:e});else if(e&&e.length>0){let r=[];for(let{id:i,url:a}of e){let e="".concat(i).concat(a);-1===r.indexOf(e)&&(r.push(e),t.push({id:i,url:a}))}}return t}function Z_(e,t,r,i){let a=ln(e),n=a.length,s=r>1?"@2x":"",o={},l={},u={};for(let{id:e,url:r}of a){let a=t.transformRequest(t.normalizeSpriteURL(r,s,".json"),"SpriteJSON"),c="".concat(e,"_").concat(a.url);o[c]=mr(a,((t,r)=>{delete o[c],l[e]=r,j_(i,l,u,t,n)}));let h=t.transformRequest(t.normalizeSpriteURL(r,s,".png"),"SpriteImage"),p="".concat(e,"_").concat(h.url);o[p]=st.getImage(h,((t,r)=>{delete o[p],u[e]=r,j_(i,l,u,t,n)}))}return{cancel(){for(let e of Object.values(o))e.cancel()}}}function j_(e,t,r,i,a){if(i)return void e(i);if(a!==Object.values(t).length||a!==Object.values(r).length)return;let n={};for(let e in t){n[e]={};let i=ne.getImageCanvasContext(r[e]),a=t[e];for(let t in a){let{width:r,height:s,x:o,y:l,sdf:u,pixelRatio:c,stretchX:h,stretchY:p,content:d}=a[t],f={width:r,height:s,x:o,y:l,context:i};n[e][t]={data:null,pixelRatio:c,sdf:u,stretchX:h,stretchY:p,content:d,spriteData:f}}}e(null,n)}l(yl,"createStyleLayer"),d(),d(),l(ln,"coerceSpriteToArray"),l(Z_,"loadSprite"),l(j_,"doOnceCompleted"),d(),d();var im=class{constructor(e,t,r,i){this.context=e,this.format=r,this.texture=e.gl.createTexture(),this.update(t,i)}update(e,t,r){let{width:i,height:a}=e,n=!(this.size&&this.size[0]===i&&this.size[1]===a||r),{context:s}=this,{gl:o}=s;if(this.useMipmap=!(!t||!t.useMipmap),o.bindTexture(o.TEXTURE_2D,this.texture),s.pixelStoreUnpackFlipY.set(!1),s.pixelStoreUnpack.set(1),s.pixelStoreUnpackPremultiplyAlpha.set(this.format===o.RGBA&&(!t||!1!==t.premultiply)),n)this.size=[i,a],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||kt(e)?o.texImage2D(o.TEXTURE_2D,0,this.format,this.format,o.UNSIGNED_BYTE,e):o.texImage2D(o.TEXTURE_2D,0,this.format,i,a,0,this.format,o.UNSIGNED_BYTE,e.data);else{let{x:t,y:n}=r||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||kt(e)?o.texSubImage2D(o.TEXTURE_2D,0,t,n,o.RGBA,o.UNSIGNED_BYTE,e):o.texSubImage2D(o.TEXTURE_2D,0,t,n,i,a,o.RGBA,o.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&o.generateMipmap(o.TEXTURE_2D)}bind(e,t,r){let{context:i}=this,{gl:a}=i;a.bindTexture(a.TEXTURE_2D,this.texture),r===a.LINEAR_MIPMAP_NEAREST&&!this.isSizePowerOfTwo()&&(r=a.LINEAR),e!==this.filter&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,e),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,r||e),this.filter=e),t!==this.wrap&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,t),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,t),this.wrap=t)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){let{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}};l(im,"Texture");var be=im;function $_(e){let{userImage:t}=e;return!!(t&&t.render&&t.render())&&(e.data.replace(new Uint8Array(t.data.buffer)),!0)}d(),l($_,"renderStyleImage");var gl=1,nm=class extends de{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new Ee({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(let{ids:e,callback:t}of this.requestors)this._notify(e,t);this.requestors=[]}}getImage(e){let t=this.images[e];if(t&&!t.data&&t.spriteData){let e=t.spriteData;t.data=new Ee({width:e.width,height:e.height},e.context.getImageData(e.x,e.y,e.width,e.height).data),t.spriteData=null}return t}addImage(e,t){if(this.images[e])throw new Error("Image id ".concat(e," already exist, use updateImage instead"));this._validate(e,t)&&(this.images[e]=t)}_validate(e,t){let r=!0,i=t.data||t.spriteData;return this._validateStretch(t.stretchX,i&&i.width)||(this.fire(new H(new Error('Image "'.concat(e,'" has invalid "stretchX" value')))),r=!1),this._validateStretch(t.stretchY,i&&i.height)||(this.fire(new H(new Error('Image "'.concat(e,'" has invalid "stretchY" value')))),r=!1),this._validateContent(t.content,t)||(this.fire(new H(new Error('Image "'.concat(e,'" has invalid "content" value')))),r=!1),r}_validateStretch(e,t){if(!e)return!0;let r=0;for(let i of e){if(i[0]<r||i[1]<i[0]||t<i[1])return!1;r=i[1]}return!0}_validateContent(e,t){if(!e)return!0;if(4!==e.length)return!1;let r=t.spriteData,i=r&&r.width||t.data.width,a=r&&r.height||t.data.height;return!(e[0]<0||i<e[0]||e[1]<0||a<e[1]||e[2]<0||i<e[2]||e[3]<0||a<e[3]||e[2]<e[0]||e[3]<e[1])}updateImage(e,t,r=!0){let i=this.getImage(e);if(r&&(i.data.width!==t.data.width||i.data.height!==t.data.height))throw new Error("size mismatch between old image (".concat(i.data.width,"x").concat(i.data.height,") and new image (").concat(t.data.width,"x").concat(t.data.height,")."));t.version=i.version+1,this.images[e]=t,this.updatedImages[e]=!0}removeImage(e){let t=this.images[e];delete this.images[e],delete this.patterns[e],t.userImage&&t.userImage.onRemove&&t.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(e,t){let r=!0;if(!this.isLoaded())for(let t of e)this.images[t]||(r=!1);this.isLoaded()||r?this._notify(e,t):this.requestors.push({ids:e,callback:t})}_notify(e,t){let r={};for(let t of e){let e=this.getImage(t);e||(this.fire(new z("styleimagemissing",{id:t})),e=this.getImage(t)),e?r[t]={data:e.data.clone(),pixelRatio:e.pixelRatio,sdf:e.sdf,version:e.version,stretchX:e.stretchX,stretchY:e.stretchY,content:e.content,hasRenderCallback:!(!e.userImage||!e.userImage.render)}:Ce('Image "'.concat(t,'" 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.'))}t(null,r)}getPixelSize(){let{width:e,height:t}=this.atlasImage;return{width:e,height:t}}getPattern(e){let t=this.patterns[e],r=this.getImage(e);if(!r)return null;if(t&&t.position.version===r.version)return t.position;if(t)t.position.version=r.version;else{let t={w:r.data.width+2*gl,h:r.data.height+2*gl,x:0,y:0},i=new an(t,r);this.patterns[e]={bin:t,position:i}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){let t=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new be(e,this.atlasImage,t.RGBA),this.atlasTexture.bind(t.LINEAR,t.CLAMP_TO_EDGE)}_updatePatternAtlas(){let e=[];for(let t in this.patterns)e.push(this.patterns[t].bin);let{w:t,h:r}=Ga(e),i=this.atlasImage;i.resize({width:t||1,height:r||1});for(let e in this.patterns){let{bin:t}=this.patterns[e],r=t.x+gl,a=t.y+gl,n=this.getImage(e).data,s=n.width,o=n.height;Ee.copy(n,i,{x:0,y:0},{x:r,y:a},{width:s,height:o}),Ee.copy(n,i,{x:0,y:o-1},{x:r,y:a-1},{width:s,height:1}),Ee.copy(n,i,{x:0,y:0},{x:r,y:a+o},{width:s,height:1}),Ee.copy(n,i,{x:s-1,y:0},{x:r-1,y:a},{width:1,height:o}),Ee.copy(n,i,{x:0,y:0},{x:r+s,y:a},{width:1,height:o})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(let t of e){if(this.callbackDispatchedThisFrame[t])continue;this.callbackDispatchedThisFrame[t]=!0;let e=this.getImage(t);e||Ce('Image with ID: "'.concat(t,'" was not found')),$_(e)&&this.updateImage(t,e)}}};l(nm,"ImageManager");var xl=nm;function H_(e,t,r,i,a){let n=256*t,s=n+255,o=i.transformRequest(r.replace("{fontstack}",e).replace("{range}","".concat(n,"-").concat(s)),"Glyphs");Po(o,((e,t)=>{if(e)a(e);else if(t){let e={};for(let r of L_(t))e[r.id]=r;a(null,e)}}))}d(),d(),l(H_,"loadGlyphRange"),d();var am=class{constructor({fontSize:e=24,buffer:t=3,radius:r=8,cutoff:i=.25,fontFamily:a="sans-serif",fontWeight:n="normal",fontStyle:s="normal"}={}){this.buffer=t,this.cutoff=i,this.radius=r;let o=this.size=e+4*t,l=this._createCanvas(o),u=this.ctx=l.getContext("2d",{willReadFrequently:!0});u.font="".concat(s," ").concat(n," ").concat(e,"px ").concat(a),u.textBaseline="alphabetic",u.textAlign="left",u.fillStyle="black",this.gridOuter=new Float64Array(o*o),this.gridInner=new Float64Array(o*o),this.f=new Float64Array(o),this.z=new Float64Array(o+1),this.v=new Uint16Array(o)}_createCanvas(e){let t=document.createElement("canvas");return t.width=t.height=e,t}draw(e){let{width:t,actualBoundingBoxAscent:r,actualBoundingBoxDescent:i,actualBoundingBoxLeft:a,actualBoundingBoxRight:n}=this.ctx.measureText(e),s=Math.ceil(r),o=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(n-a))),l=Math.min(this.size-this.buffer,s+Math.ceil(i)),u=o+2*this.buffer,c=l+2*this.buffer,h=Math.max(u*c,0),p=new Uint8ClampedArray(h),d={data:p,width:u,height:c,glyphWidth:o,glyphHeight:l,glyphTop:s,glyphLeft:0,glyphAdvance:t};if(0===o||0===l)return d;let{ctx:f,buffer:m,gridInner:y,gridOuter:g}=this;f.clearRect(m,m,o,l),f.fillText(e,m,m+s);let _=f.getImageData(m,m,o,l);g.fill(1e20,0,h),y.fill(0,0,h);for(let e=0;e<l;e++)for(let t=0;t<o;t++){let r=_.data[4*(e*o+t)+3]/255;if(0===r)continue;let i=(e+m)*u+t+m;if(1===r)g[i]=0,y[i]=1e20;else{let e=.5-r;g[i]=e>0?e*e:0,y[i]=e<0?e*e:0}}W_(g,0,0,u,c,u,this.f,this.v,this.z),W_(y,m,m,o,l,u,this.f,this.v,this.z);for(let e=0;e<h;e++){let t=Math.sqrt(g[e])-Math.sqrt(y[e]);p[e]=Math.round(255-255*(t/this.radius+this.cutoff))}return d}};l(am,"TinySDF");var Xa=am;function W_(e,t,r,i,a,n,s,o,l){for(let u=t;u<t+i;u++)X_(e,r*n+u,n,a,s,o,l);for(let u=r;u<r+a;u++)X_(e,u*n+t,1,i,s,o,l)}function X_(e,t,r,i,a,n,s){n[0]=0,s[0]=-1e20,s[1]=1e20,a[0]=e[t];for(let o=1,l=0,u=0;o<i;o++){a[o]=e[t+o*r];let i=o*o;do{let e=n[l];u=(a[o]-a[e]+i-e*e)/(o-e)/2}while(u<=s[l]&&--l>-1);l++,n[l]=o,s[l]=u,s[l+1]=1e20}for(let o=0,l=0;o<i;o++){for(;s[l+1]<o;)l++;let i=n[l],u=o-i;e[t+o*r]=a[i]+u*u}}l(W_,"edt"),l(X_,"edt1d");var mi=class e{constructor(e,t){this.requestManager=e,this.localIdeographFontFamily=t,this.entries={}}setURL(e){this.url=e}getGlyphs(t,r){let i=[];for(let e in t)for(let r of t[e])i.push({stack:e,id:r});bo(i,(({stack:t,id:r},i)=>{let a=this.entries[t];a||(a=this.entries[t]={glyphs:{},requests:{},ranges:{}});let n=a.glyphs[r];if(void 0!==n)return void i(null,{stack:t,id:r,glyph:n});if(n=this._tinySDF(a,t,r),n)return a.glyphs[r]=n,void i(null,{stack:t,id:r,glyph:n});let s=Math.floor(r/256);if(256*s>65535)return void i(new Error("glyphs > 65535 not supported"));if(a.ranges[s])return void i(null,{stack:t,id:r,glyph:n});if(!this.url)return void i(new Error("glyphsUrl is not set"));let o=a.requests[s];o||(o=a.requests[s]=[],e.loadGlyphRange(t,s,this.url,this.requestManager,((e,t)=>{if(t){for(let e in t)this._doesCharSupportLocalGlyph(+e)||(a.glyphs[+e]=t[+e]);a.ranges[s]=!0}for(let r of o)r(e,t);delete a.requests[s]}))),o.push(((e,a)=>{e?i(e):a&&i(null,{stack:t,id:r,glyph:a[r]||null})}))}),((e,t)=>{if(e)r(e);else if(t){let e={};for(let{stack:r,id:i,glyph:a}of t)(e[r]||(e[r]={}))[i]=a&&{id:a.id,bitmap:a.bitmap.clone(),metrics:a.metrics};r(null,e)}}))}_doesCharSupportLocalGlyph(e){return!!this.localIdeographFontFamily&&(pe["CJK Unified Ideographs"](e)||pe["Hangul Syllables"](e)||pe.Hiragana(e)||pe.Katakana(e))}_tinySDF(t,r,i){let a=this.localIdeographFontFamily;if(!a||!this._doesCharSupportLocalGlyph(i))return;let n=t.tinySDF;if(!n){let i="400";/bold/i.test(r)?i="900":/medium/i.test(r)?i="500":/light/i.test(r)&&(i="200"),n=t.tinySDF=new e.TinySDF({fontSize:24,buffer:3,radius:8,cutoff:.25,fontFamily:a,fontWeight:i})}let s=n.draw(String.fromCharCode(i));return{id:i,bitmap:new li({width:s.width||30,height:s.height||30},s.data),metrics:{width:s.glyphWidth||24,height:s.glyphHeight||24,left:s.glyphLeft||0,top:s.glyphTop-27||-8,advance:s.glyphAdvance||24}}}};l(mi,"GlyphManager"),mi.loadGlyphRange=H_,mi.TinySDF=Xa;var bl=mi;d();var lm=class{constructor(){this.specification=M.light.position}possiblyEvaluate(e,t){return fg(e.expression.evaluate(t))}interpolate(e,t,r){return{x:ke.number(e.x,t.x,r),y:ke.number(e.y,t.y,r),z:ke.number(e.z,t.z,r)}}};l(lm,"LightPositionProperty");var om,sm=lm,K_="-transition",um=class extends de{constructor(e){super(),om=om||new Re({anchor:new Z(M.light.anchor),position:new sm,color:new Z(M.light.color),intensity:new Z(M.light.intensity)}),this._transitionable=new ji(om),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,t={}){if(!this._validate(_x,e,t))for(let t in e){let r=e[t];t.endsWith(K_)?this._transitionable.setTransition(t.slice(0,-K_.length),r):this._transitionable.setValue(t,r)}}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,t,r){return(!r||!1!==r.validate)&&Vi(this,e.call(je,R({value:t,style:{glyphs:!0,sprite:!0},styleSpec:M})))}};l(um,"Light");var _l=um;d();var cm=class{constructor(e,t){this.width=e,this.height=t,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(e,t){let r=e.join(",")+String(t);return this.dashEntry[r]||(this.dashEntry[r]=this.addDash(e,t)),this.dashEntry[r]}getDashRanges(e,t,r){let i=[],a=e.length%2==1?-e[e.length-1]*r:0,n=e[0]*r,s=!0;i.push({left:a,right:n,isDash:s,zeroLength:0===e[0]});let o=e[0];for(let t=1;t<e.length;t++){s=!s;let l=e[t];a=o*r,o+=l,n=o*r,i.push({left:a,right:n,isDash:s,zeroLength:0===l})}return i}addRoundDash(e,t,r){let i=t/2;for(let t=-r;t<=r;t++){let a=this.nextRow+r+t,n=this.width*a,s=0,o=e[s];for(let a=0;a<this.width;a++){a/o.right>1&&(o=e[++s]);let l,u=Math.abs(a-o.left),c=Math.abs(a-o.right),h=Math.min(u,c),p=t/r*(i+1);if(o.isDash){let e=i-Math.abs(p);l=Math.sqrt(h*h+e*e)}else l=i-Math.sqrt(h*h+p*p);this.data[n+a]=Math.max(0,Math.min(255,l+128))}}}addRegularDash(e){for(let t=e.length-1;t>=0;--t){let r=e[t],i=e[t+1];r.zeroLength?e.splice(t,1):i&&i.isDash===r.isDash&&(i.left=r.left,e.splice(t,1))}let t=e[0],r=e[e.length-1];t.isDash===r.isDash&&(t.left=r.left-this.width,r.right=t.right+this.width);let i=this.width*this.nextRow,a=0,n=e[a];for(let t=0;t<this.width;t++){t/n.right>1&&(n=e[++a]);let r=Math.abs(t-n.left),s=Math.abs(t-n.right),o=Math.min(r,s),l=n.isDash?o:-o;this.data[i+t]=Math.max(0,Math.min(255,l+128))}}addDash(e,t){let r=t?7:0,i=2*r+1;if(this.nextRow+i>this.height)return Ce("LineAtlas out of space"),null;let a=0;for(let t=0;t<e.length;t++)a+=e[t];if(0!==a){let i=this.width/a,n=this.getDashRanges(e,this.width,i);t?this.addRoundDash(n,i,r):this.addRegularDash(n)}let n={y:(this.nextRow+r+.5)/this.height,height:2*r/this.height,width:a};return this.nextRow+=i,this.dirty=!0,n}bind(e){let t=e.gl;this.texture?(t.bindTexture(t.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,t.texSubImage2D(t.TEXTURE_2D,0,0,0,this.width,this.height,t.ALPHA,t.UNSIGNED_BYTE,this.data))):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.ALPHA,this.width,this.height,0,t.ALPHA,t.UNSIGNED_BYTE,this.data))}};l(cm,"LineAtlas");var vl=cm;d(),d(),d();var pm=class{constructor(e){this._callback=e,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout((()=>{this._triggered=!1,this._callback()}),0))}remove(){delete this._channel,this._callback=()=>{}}};l(pm,"ThrottledInvoker");var wl=pm,hm=class{constructor(e,t,r){this.receive=l((e=>{let t=e.data,r=t.id;if(r&&(!t.targetMapId||this.mapId===t.targetMapId))if("<cancel>"===t.type){delete this.tasks[r];let e=this.cancelCallbacks[r];delete this.cancelCallbacks[r],e&&e()}else pt()||t.mustQueue?(this.tasks[r]=t,this.taskQueue.push(r),this.invoker.trigger()):this.processTask(r,t)}),"receive"),this.process=l((()=>{if(!this.taskQueue.length)return;let e=this.taskQueue.shift(),t=this.tasks[e];delete this.tasks[e],this.taskQueue.length&&this.invoker.trigger(),t&&this.processTask(e,t)}),"process"),this.target=e,this.parent=t,this.mapId=r,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},this.invoker=new wl(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=pt()?e:window}send(e,t,r,i,a=!1){let n=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&&(this.callbacks[n]=r);let s=jr(this.globalScope)?void 0:[];return this.target.postMessage({id:n,type:e,hasCallback:!!r,targetMapId:i,mustQueue:a,sourceMapId:this.mapId,data:Ui(t,s)},s),{cancel:l((()=>{r&&delete this.callbacks[n],this.target.postMessage({id:n,type:"<cancel>",targetMapId:i,sourceMapId:this.mapId})}),"cancel")}}processTask(e,t){if("<response>"===t.type){let r=this.callbacks[e];delete this.callbacks[e],r&&(t.error?r(Ni(t.error)):r(null,Ni(t.data)))}else{let r=!1,i=jr(this.globalScope)?void 0:[],a=t.hasCallback?(t,a)=>{r=!0,delete this.cancelCallbacks[e],this.target.postMessage({id:e,type:"<response>",sourceMapId:this.mapId,error:t?Ui(t):null,data:Ui(a,i)},i)}:e=>{r=!0},n=null,s=Ni(t.data);if(this.parent[t.type])n=this.parent[t.type](t.sourceMapId,s,a);else if(this.parent.getWorkerSource){let e=t.type.split(".");n=this.parent.getWorkerSource(t.sourceMapId,e[0],s.source)[e[1]](s,a)}else a(new Error("Could not find function ".concat(t.type)));!r&&n&&n.cancel&&(this.cancelCallbacks[e]=n.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}};l(hm,"Actor");var Sl=hm,Pl=class e{constructor(t,r,i){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=i;let a=this.workerPool.acquire(i);for(let t=0;t<a.length;t++){let n=a[t],s=new e.Actor(n,r,i);s.name="Worker ".concat(t),this.actors.push(s)}if(!this.actors.length)throw new Error("No actors found")}broadcast(e,t,r){r=r||function(){},bo(this.actors,((r,i)=>{r.send(e,t,i)}),r)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(e=!0){this.actors.forEach((e=>{e.remove()})),this.actors=[],e&&this.workerPool.release(this.id)}};l(Pl,"Dispatcher");var Ka=Pl;function Tl(e,t,r){let i=l((function(t,i){if(t)return r(t);if(i){let t=Rt(R(i,e),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);i.vector_layers&&(t.vectorLayers=i.vector_layers,t.vectorLayerIds=t.vectorLayers.map((e=>e.id))),r(null,t)}}),"loaded");return e.url?mr(t.transformRequest(e.url,"Source"),i):ne.frame((()=>i(null,e)))}Ka.Actor=Sl,d(),d(),d(),l(Tl,"loadTileJson"),d(),d(),d();var yi=6371008.8,di=class e{constructor(e,t){if(isNaN(e)||isNaN(t))throw new Error("Invalid LngLat object: (".concat(e,", ").concat(t,")"));if(this.lng=+e,this.lat=+t,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new e(Jt(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return"LngLat(".concat(this.lng,", ").concat(this.lat,")")}distanceTo(e){let t=Math.PI/180,r=this.lat*t,i=e.lat*t,a=Math.sin(r)*Math.sin(i)+Math.cos(r)*Math.cos(i)*Math.cos((e.lng-this.lng)*t);return yi*Math.acos(Math.min(a,1))}static convert(t){if(t instanceof e)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new e(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new e(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}};l(di,"LngLat");var re=di,kr=class e{constructor(e,t){e&&(t?this.setSouthWest(e).setNorthEast(t):Array.isArray(e)&&(4===e.length?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 re?new re(e.lng,e.lat):re.convert(e),this}setSouthWest(e){return this._sw=e instanceof re?new re(e.lng,e.lat):re.convert(e),this}extend(t){let r,i,a=this._sw,n=this._ne;if(t instanceof re)r=t,i=t;else{if(!(t instanceof e)){if(Array.isArray(t)){if(4===t.length||t.every(Array.isArray)){let r=t;return this.extend(e.convert(r))}{let e=t;return this.extend(re.convert(e))}}return t&&("lng"in t||"lon"in t)&&"lat"in t?this.extend(re.convert(t)):this}if(r=t._sw,i=t._ne,!r||!i)return this}return a||n?(a.lng=Math.min(r.lng,a.lng),a.lat=Math.min(r.lat,a.lat),n.lng=Math.max(i.lng,n.lng),n.lat=Math.max(i.lat,n.lat)):(this._sw=new re(r.lng,r.lat),this._ne=new re(i.lng,i.lat)),this}getCenter(){return new re((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 re(this.getWest(),this.getNorth())}getSouthEast(){return new re(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return"LngLatBounds(".concat(this._sw.toString(),", ").concat(this._ne.toString(),")")}isEmpty(){return!(this._sw&&this._ne)}contains(e){let{lng:t,lat:r}=re.convert(e),i=this._sw.lat<=r&&r<=this._ne.lat,a=this._sw.lng<=t&&t<=this._ne.lng;return this._sw.lng>this._ne.lng&&(a=this._sw.lng>=t&&t>=this._ne.lng),i&&a}static convert(t){return t instanceof e||!t?t:new e(t)}static fromLngLat(t,r=0){let i=360*r/40075017,a=i/Math.cos(Math.PI/180*t.lat);return new e(new re(t.lng-a,t.lat-i),new re(t.lng+a,t.lat+i))}};l(kr,"LngLatBounds");var ut=kr;d();var Y_=2*Math.PI*yi;function J_(e){return Y_*Math.cos(e*Math.PI/180)}function Lr(e){return(180+e)/360}function Dr(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function mm(e,t){return e/J_(t)}function vC(e){return 360*e-180}function fm(e){let t=180-360*e;return 360/Math.PI*Math.atan(Math.exp(t*Math.PI/180))-90}function wC(e,t){return e*J_(fm(t))}function SC(e){return 1/Math.cos(e*Math.PI/180)}l(J_,"circumferenceAtLatitude"),l(Lr,"mercatorXfromLng"),l(Dr,"mercatorYfromLat"),l(mm,"mercatorZfromAltitude"),l(vC,"lngFromMercatorX"),l(fm,"latFromMercatorY"),l(wC,"altitudeFromMercatorZ"),l(SC,"mercatorScale");var Al=class e{constructor(e,t,r=0){this.x=+e,this.y=+t,this.z=+r}static fromLngLat(t,r=0){let i=re.convert(t);return new e(Lr(i.lng),Dr(i.lat),mm(r,i.lat))}toLngLat(){return new re(vC(this.x),fm(this.y))}toAltitude(){return wC(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/Y_*SC(fm(this.y))}};l(Al,"MercatorCoordinate");var ze=Al,dm=class{constructor(e,t,r){this.bounds=ut.convert(this.validateBounds(e)),this.minzoom=t||0,this.maxzoom=r||24}validateBounds(e){return Array.isArray(e)&&4===e.length?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(e){let t=Math.pow(2,e.z),r=Math.floor(Lr(this.bounds.getWest())*t),i=Math.floor(Dr(this.bounds.getNorth())*t),a=Math.ceil(Lr(this.bounds.getEast())*t),n=Math.ceil(Dr(this.bounds.getSouth())*t);return e.x>=r&&e.x<a&&e.y>=i&&e.y<n}};l(dm,"TileBounds");var un=dm,ym=class extends de{constructor(e,t,r,i){if(super(),this.load=l((()=>{this._loaded=!1,this.fire(new z("dataloading",{dataType:"source"})),this._tileJSONRequest=Tl(this._options,this.map._requestManager,((e,t)=>{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),e?this.fire(new H(e)):t&&(R(this,t),t.bounds&&(this.tileBounds=new un(t.bounds,this.minzoom,this.maxzoom)),this.fire(new z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new z("data",{dataType:"source",sourceDataType:"content"})))}))}),"load"),this.serialize=l((()=>R({},this._options)),"serialize"),this.id=e,this.dispatcher=r,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,R(this,Rt(t,["url","scheme","tileSize","promoteId"])),this._options=R({type:"vector"},t),this._collectResourceTiming=t.collectResourceTiming,512!==this.tileSize)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(i)}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.cancel(),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.cancel(),this._tileJSONRequest=null)}loadTile(e,t){let r=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),i={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};function a(r,i){return delete e.request,e.aborted?t(null):r&&404!==r.status?t(r):(i&&i.resourceTiming&&(e.resourceTiming=i.resourceTiming),this.map._refreshExpiredTiles&&i&&e.setExpiryData(i),e.loadVectorData(i,this.map.painter),t(null),void(e.reloadCallback&&(this.loadTile(e,e.reloadCallback),e.reloadCallback=null)))}i.request.collectResourceTiming=this._collectResourceTiming,e.actor&&"expired"!==e.state?"loading"===e.state?e.reloadCallback=t:e.request=e.actor.send("reloadTile",i,a.bind(this)):(e.actor=this.dispatcher.getActor(),e.request=e.actor.send("loadTile",i,a.bind(this))),l(a,"done")}abortTile(e){e.request&&(e.request.cancel(),delete e.request),e.actor&&e.actor.send("abortTile",{uid:e.uid,type:this.type,source:this.id},void 0)}unloadTile(e){e.unloadVectorData(),e.actor&&e.actor.send("removeTile",{uid:e.uid,type:this.type,source:this.id},void 0)}hasTransition(){return!1}};l(ym,"VectorTileSource");var cn=ym;d();var gm=class extends de{constructor(e,t,r,i){super(),this.id=e,this.dispatcher=r,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=R({type:"raster"},t),R(this,Rt(t,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new z("dataloading",{dataType:"source"})),this._tileJSONRequest=Tl(this._options,this.map._requestManager,((e,t)=>{this._tileJSONRequest=null,this._loaded=!0,e?this.fire(new H(e)):t&&(R(this,t),t.bounds&&(this.tileBounds=new un(t.bounds,this.minzoom,this.maxzoom)),this.fire(new z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new z("data",{dataType:"source",sourceDataType:"content"})))}))}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return R({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e,t){let r=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.request=st.getImage(this.map._requestManager.transformRequest(r,"Tile"),((r,i,a)=>{if(delete e.request,e.aborted)e.state="unloaded",t(null);else if(r)e.state="errored",t(r);else if(i){this.map._refreshExpiredTiles&&a&&e.setExpiryData(a);let r=this.map.painter.context,n=r.gl;e.texture=this.map.painter.getTileTexture(i.width),e.texture?e.texture.update(i,{useMipmap:!0}):(e.texture=new be(r,i,n.RGBA,{useMipmap:!0}),e.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE,n.LINEAR_MIPMAP_NEAREST),r.extTextureFilterAnisotropic&&n.texParameterf(n.TEXTURE_2D,r.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,r.extTextureFilterAnisotropicMax)),e.state="loaded",t(null)}}),this.map._refreshExpiredTiles)}abortTile(e,t){e.request&&(e.request.cancel(),delete e.request),t()}unloadTile(e,t){e.texture&&this.map.painter.saveTileTexture(e.texture),t()}hasTransition(){return!1}};l(gm,"RasterTileSource");var xm,zr=gm;function Q_(){return null==xm&&(xm=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof createImageBitmap),xm}function tv(e,t,r){var i=ev(256*e,256*(t=Math.pow(2,r)-t-1),r),a=ev(256*(e+1),256*(t+1),r);return i[0]+","+i[1]+","+a[0]+","+a[1]}function ev(e,t,r){var i=2*Math.PI*6378137/256/Math.pow(2,r);return[e*i-2*Math.PI*6378137/2,t*i-2*Math.PI*6378137/2]}d(),d(),l(Q_,"offscreenCanvasSupported"),d(),d(),l(tv,"getTileBBox"),l(ev,"getMercCoords");var rv=se(Pe(),1),bm=class{constructor(e,t,r){if(e<0||e>25||r<0||r>=Math.pow(2,e)||t<0||t>=Math.pow(2,e))throw new Error("x=".concat(t,", y=").concat(r,", z=").concat(e," outside of bounds. 0<=x<").concat(Math.pow(2,e),", 0<=y<").concat(Math.pow(2,e)," 0<=z<=25 "));this.z=e,this.x=t,this.y=r,this.key=Ya(0,e,e,t,r)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,t,r){let i=tv(this.x,this.y,this.z),a=PC(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("tms"===r?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,t>1?"@2x":"").replace(/{quadkey}/g,a).replace(/{bbox-epsg-3857}/g,i)}isChildOf(e){let t=this.z-e.z;return t>0&&e.x===this.x>>t&&e.y===this.y>>t}getTilePoint(e){let t=Math.pow(2,this.z);return new rv.default(8192*(e.x*t-this.x),8192*(e.y*t-this.y))}toString(){return"".concat(this.z,"/").concat(this.x,"/").concat(this.y)}};l(bm,"CanonicalTileID");var pn=bm,_m=class{constructor(e,t){this.wrap=e,this.canonical=t,this.key=Ya(e,t.z,t.z,t.x,t.y)}};l(_m,"UnwrappedTileID");var hn=_m,At=class e{constructor(e,t,r,i,a){if(e<r)throw new Error("overscaledZ should be >= z; overscaledZ = ".concat(e,"; z = ").concat(r));this.overscaledZ=e,this.wrap=t,this.canonical=new pn(r,+i,+a),this.key=Ya(t,e,r,i,a)}clone(){return new e(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(t){if(t>this.overscaledZ)throw new Error("targetZ > this.overscaledZ; targetZ = ".concat(t,"; overscaledZ = ").concat(this.overscaledZ));let r=this.canonical.z-t;return t>this.canonical.z?new e(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new e(t,this.wrap,t,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(e,t){if(e>this.overscaledZ)throw new Error("targetZ > this.overscaledZ; targetZ = ".concat(e,"; overscaledZ = ").concat(this.overscaledZ));let r=this.canonical.z-e;return e>this.canonical.z?Ya(this.wrap*+t,e,this.canonical.z,this.canonical.x,this.canonical.y):Ya(this.wrap*+t,e,e,this.canonical.x>>r,this.canonical.y>>r)}isChildOf(e){if(e.wrap!==this.wrap)return!1;let t=this.canonical.z-e.canonical.z;return 0===e.overscaledZ||e.overscaledZ<this.overscaledZ&&e.canonical.x===this.canonical.x>>t&&e.canonical.y===this.canonical.y>>t}children(t){if(this.overscaledZ>=t)return[new e(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let r=this.canonical.z+1,i=2*this.canonical.x,a=2*this.canonical.y;return[new e(r,this.wrap,r,i,a),new e(r,this.wrap,r,i+1,a),new e(r,this.wrap,r,i,a+1),new e(r,this.wrap,r,i+1,a+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new e(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new e(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new hn(this.wrap,this.canonical)}toString(){return"".concat(this.overscaledZ,"/").concat(this.canonical.x,"/").concat(this.canonical.y)}getTilePoint(e){return this.canonical.getTilePoint(new ze(e.x-this.wrap,e.y))}};l(At,"OverscaledTileID");var nt=At;function Ya(e,t,r,i,a){(e*=2)<0&&(e=-1*e-1);let n=1<<r;return(n*n*e+n*a+i).toString(36)+r.toString(36)+t.toString(36)}function PC(e,t,r){let i,a="";for(let n=e;n>0;n--)i=1<<n-1,a+=(t&i?1:0)+(r&i?2:0);return a}l(Ya,"calculateKey"),l(PC,"getQuadkey"),N("CanonicalTileID",pn),N("OverscaledTileID",nt,{omit:["posMatrix"]}),d();var wm=class{constructor(e,t,r){if(this.uid=e,t.height!==t.width)throw new RangeError("DEM tiles must be square");if(r&&"mapbox"!==r&&"terrarium"!==r)return void Ce('"'.concat(r,'" is not a valid encoding type. Valid types include "mapbox" and "terrarium".'));this.stride=t.height;let i=this.dim=t.height-2;this.data=new Uint32Array(t.data.buffer),this.encoding=r||"mapbox";for(let e=0;e<i;e++)this.data[this._idx(-1,e)]=this.data[this._idx(0,e)],this.data[this._idx(i,e)]=this.data[this._idx(i-1,e)],this.data[this._idx(e,-1)]=this.data[this._idx(e,0)],this.data[this._idx(e,i)]=this.data[this._idx(e,i-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(i,-1)]=this.data[this._idx(i-1,0)],this.data[this._idx(-1,i)]=this.data[this._idx(0,i-1)],this.data[this._idx(i,i)]=this.data[this._idx(i-1,i-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let e=0;e<i;e++)for(let t=0;t<i;t++){let r=this.get(e,t);r>this.max&&(this.max=r),r<this.min&&(this.min=r)}}get(e,t){let r=new Uint8Array(this.data.buffer),i=4*this._idx(e,t);return("terrarium"===this.encoding?this._unpackTerrarium:this._unpackMapbox)(r[i],r[i+1],r[i+2])}getUnpackVector(){return"terrarium"===this.encoding?[256,1,1/256,32768]:[6553.6,25.6,.1,1e4]}_idx(e,t){if(e<-1||e>=this.dim+1||t<-1||t>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(t+1)*this.stride+(e+1)}_unpackMapbox(e,t,r){return(256*e*256+256*t+r)/10-1e4}_unpackTerrarium(e,t,r){return 256*e+t+r/256-32768}getPixels(){return new Ee({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,t,r){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let i=t*this.dim,a=t*this.dim+this.dim,n=r*this.dim,s=r*this.dim+this.dim;switch(t){case-1:i=a-1;break;case 1:a=i+1}switch(r){case-1:n=s-1;break;case 1:s=n+1}let o=-t*this.dim,l=-r*this.dim;for(let t=n;t<s;t++)for(let r=i;r<a;r++)this.data[this._idx(r,t)]=e.data[this._idx(r+o,t+l)]}};l(wm,"DEMData");var vm=wm;N("DEMData",vm);var Sm=class extends zr{constructor(e,t,r,i){super(e,t,r,i),this.type="raster-dem",this.maxzoom=22,this._options=R({type:"raster-dem"},t),this.encoding=t.encoding||"mapbox"}serialize(){return{type:"raster-dem",url:this.url,tileSize:this.tileSize,tiles:this.tiles,bounds:this.bounds,encoding:this.encoding}}loadTile(e,t){let r=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);function i(r,i){if(delete e.request,e.aborted)e.state="unloaded",t(null);else if(r)e.state="errored",t(r);else if(i){this.map._refreshExpiredTiles&&e.setExpiryData(i),delete i.cacheControl,delete i.expires;let t=kt(i)&&Q_()?i:ne.getImageData(i,1),r={uid:e.uid,coord:e.tileID,source:this.id,rawImageData:t,encoding:this.encoding};(!e.actor||"expired"===e.state)&&(e.actor=this.dispatcher.getActor(),e.actor.send("loadDEMTile",r,a.bind(this)))}}function a(r,i){r&&(e.state="errored",t(r)),i&&(e.dem=i,e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded",t(null))}e.request=st.getImage(this.map._requestManager.transformRequest(r,"Tile"),i.bind(this),this.map._refreshExpiredTiles),e.neighboringTiles=this._getNeighboringTiles(e.tileID),l(i,"imageLoaded"),l(a,"done")}_getNeighboringTiles(e){let t=e.canonical,r=Math.pow(2,t.z),i=(t.x-1+r)%r,a=0===t.x?e.wrap-1:e.wrap,n=(t.x+1+r)%r,s=t.x+1===r?e.wrap+1:e.wrap,o={};return o[new nt(e.overscaledZ,a,t.z,i,t.y).key]={backfilled:!1},o[new nt(e.overscaledZ,s,t.z,n,t.y).key]={backfilled:!1},t.y>0&&(o[new nt(e.overscaledZ,a,t.z,i,t.y-1).key]={backfilled:!1},o[new nt(e.overscaledZ,e.wrap,t.z,t.x,t.y-1).key]={backfilled:!1},o[new nt(e.overscaledZ,s,t.z,n,t.y-1).key]={backfilled:!1}),t.y+1<r&&(o[new nt(e.overscaledZ,a,t.z,i,t.y+1).key]={backfilled:!1},o[new nt(e.overscaledZ,e.wrap,t.z,t.x,t.y+1).key]={backfilled:!1},o[new nt(e.overscaledZ,s,t.z,n,t.y+1).key]={backfilled:!1}),o}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&&e.actor.send("removeDEMTile",{uid:e.uid,source:this.id})}};l(Sm,"RasterDEMTileSource");var fn=Sm;d();var Pm=class extends de{constructor(e,t,r,i){super(),this.load=l((()=>{this._updateWorkerData()}),"load"),this.serialize=l((()=>R({},this._options,{type:this.type,data:this._data})),"serialize"),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=r.getActor(),this.setEventedParent(i),this._data=t.data,this._options=R({},t),this._collectResourceTiming=t.collectResourceTiming,void 0!==t.maxzoom&&(this.maxzoom=t.maxzoom),t.type&&(this.type=t.type),t.attribution&&(this.attribution=t.attribution),this.promoteId=t.promoteId;let a=8192/this.tileSize;this.workerOptions=R({source:this.id,cluster:t.cluster||!1,geojsonVtOptions:{buffer:(void 0!==t.buffer?t.buffer:128)*a,tolerance:(void 0!==t.tolerance?t.tolerance:.375)*a,extent:8192,maxZoom:this.maxzoom,lineMetrics:t.lineMetrics||!1,generateId:t.generateId||!1},superclusterOptions:{maxZoom:void 0!==t.clusterMaxZoom?t.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,t.clusterMinPoints||2),extent:8192,radius:(t.clusterRadius||50)*a,log:!1,generateId:t.generateId||!1},clusterProperties:t.clusterProperties,filter:t.filter},t.workerOptions),"string"==typeof this.promoteId&&(this.workerOptions.promoteId=this.promoteId)}onAdd(e){this.map=e,this.load()}setData(e){return this._data=e,this._updateWorkerData(),this}updateData(e){return this._updateWorkerData(e),this}setClusterOptions(e){return this.workerOptions.cluster=e.cluster,e&&(void 0!==e.clusterRadius&&(this.workerOptions.superclusterOptions.radius=e.clusterRadius),void 0!==e.clusterMaxZoom&&(this.workerOptions.superclusterOptions.maxZoom=e.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(e,t){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:e,source:this.id},t),this}getClusterChildren(e,t){return this.actor.send("geojson.getClusterChildren",{clusterId:e,source:this.id},t),this}getClusterLeaves(e,t,r,i){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:e,limit:t,offset:r},i),this}_updateWorkerData(e){let t=R({},this.workerOptions);e?t.dataDiff=e:"string"==typeof this._data?(t.request=this.map._requestManager.transformRequest(ne.resolveURL(this._data),"Source"),t.request.collectResourceTiming=this._collectResourceTiming):t.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new z("dataloading",{dataType:"source"})),this.actor.send("".concat(this.type,".loadData"),t,((e,t)=>{if(this._pendingLoads--,this._removed||t&&t.abandoned)return void this.fire(new z("dataabort",{dataType:"source"}));let r=null;if(t&&t.resourceTiming&&t.resourceTiming[this.id]&&(r=t.resourceTiming[this.id].slice(0)),e)return void this.fire(new H(e));let i={dataType:"source"};this._collectResourceTiming&&r&&r.length>0&&R(i,{resourceTiming:r}),this.fire(new z("data",{...i,sourceDataType:"metadata"})),this.fire(new z("data",{...i,sourceDataType:"content"}))}))}loaded(){return 0===this._pendingLoads}loadTile(e,t){let r=e.actor?"reloadTile":"loadTile";e.actor=this.actor;let i={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};e.request=this.actor.send(r,i,((i,a)=>(delete e.request,e.unloadVectorData(),e.aborted?t(null):i?t(i):(e.loadVectorData(a,this.map.painter,"reloadTile"===r),t(null)))))}abortTile(e){e.request&&(e.request.cancel(),delete e.request),e.aborted=!0}unloadTile(e){e.unloadVectorData(),this.actor.send("removeTile",{uid:e.uid,type:this.type,source:this.id})}onRemove(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})}hasTransition(){return!1}};l(Pm,"GeoJSONSource");var mn=Pm;d(),d(),d();var Fr=ve([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]),Tm=class extends de{constructor(e,t,r,i){super(),this.load=l(((e,t)=>{this._loaded=!1,this.fire(new z("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=st.getImage(this.map._requestManager.transformRequest(this.url,"Image"),((r,i)=>{this._request=null,this._loaded=!0,r?this.fire(new H(r)):i&&(this.image=i,e&&(this.coordinates=e),t&&t(),this._finishLoading())}))}),"load"),this.prepare=l((()=>{if(0===Object.keys(this.tiles).length||!this.image)return;let e=this.map.painter.context,t=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,Fr.members)),this.boundsSegments||(this.boundsSegments=me.simpleSegment(0,0,4,2)),this.texture||(this.texture=new be(e,this.image,t.RGBA),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE));let r=!1;for(let e in this.tiles){let t=this.tiles[e];"loaded"!==t.state&&(t.state="loaded",t.texture=this.texture,r=!0)}r&&this.fire(new z("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}),"prepare"),this.serialize=l((()=>({type:"image",url:this.options.url,coordinates:this.coordinates})),"serialize"),this.id=e,this.dispatcher=r,this.coordinates=t.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(i),this.options=t}loaded(){return this._loaded}updateImage(e){return e.url?(this._request&&(this._request.cancel(),this._request=null),this.options.url=e.url,this.load(e.coordinates,(()=>{this.texture=null})),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new z("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(){this._request&&(this._request.cancel(),this._request=null)}setCoordinates(e){this.coordinates=e;let t=e.map(ze.fromLngLat);this.tileID=TC(t),this.minzoom=this.maxzoom=this.tileID.z;let r=t.map((e=>this.tileID.getTilePoint(e)._round()));return this._boundsArray=new Wi,this._boundsArray.emplaceBack(r[0].x,r[0].y,0,0),this._boundsArray.emplaceBack(r[1].x,r[1].y,8192,0),this._boundsArray.emplaceBack(r[3].x,r[3].y,0,8192),this._boundsArray.emplaceBack(r[2].x,r[2].y,8192,8192),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new z("data",{dataType:"source",sourceDataType:"content"})),this}loadTile(e,t){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={},t(null)):(e.state="errored",t(null))}hasTransition(){return!1}};l(Tm,"ImageSource");var It=Tm;function TC(e){let t=1/0,r=1/0,i=-1/0,a=-1/0;for(let n of e)t=Math.min(t,n.x),r=Math.min(r,n.y),i=Math.max(i,n.x),a=Math.max(a,n.y);let n=i-t,s=a-r,o=Math.max(n,s),l=Math.max(0,Math.floor(-Math.log(o)/Math.LN2)),u=Math.pow(2,l);return new pn(l,Math.floor((t+i)/2*u),Math.floor((r+a)/2*u))}l(TC,"getCoordinatesCenterTileID");var Am=class extends It{constructor(e,t,r,i){super(e,t,r,i),this.load=l((()=>{this._loaded=!1;let e=this.options;this.urls=[];for(let t of e.urls)this.urls.push(this.map._requestManager.transformRequest(t,"Source").url);xg(this.urls,((e,t)=>{this._loaded=!0,e?this.fire(new H(e)):t&&(this.video=t,this.video.loop=!0,this.video.addEventListener("playing",(()=>{this.map.triggerRepaint()})),this.map&&this.video.play(),this._finishLoading())}))}),"load"),this.prepare=l((()=>{if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;let e=this.map.painter.context,t=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,Fr.members)),this.boundsSegments||(this.boundsSegments=me.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE),t.texSubImage2D(t.TEXTURE_2D,0,0,0,t.RGBA,t.UNSIGNED_BYTE,this.video)):(this.texture=new be(e,this.video,t.RGBA),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE));let r=!1;for(let e in this.tiles){let t=this.tiles[e];"loaded"!==t.state&&(t.state="loaded",t.texture=this.texture,r=!0)}r&&this.fire(new z("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}),"prepare"),this.serialize=l((()=>({type:"video",urls:this.urls,coordinates:this.coordinates})),"serialize"),this.roundZoom=!0,this.type="video",this.options=t}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){let t=this.video.seekable;e<t.start(0)||e>t.end(0)?this.fire(new H(new U("sources.".concat(this.id),null,"Playback for this video can be set only between the ".concat(t.start(0)," and ").concat(t.end(0),"-second mark.")))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}hasTransition(){return this.video&&!this.video.paused}};l(Am,"VideoSource");var dn=Am;d();var Im=class extends It{constructor(e,t,r,i){super(e,t,r,i),this.load=l((()=>{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 H(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}),"load"),this.prepare=l((()=>{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()||0===Object.keys(this.tiles).length)return;let t=this.map.painter.context,r=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,Fr.members)),this.boundsSegments||(this.boundsSegments=me.simpleSegment(0,0,4,2)),this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new be(t,this.canvas,r.RGBA,{premultiply:!0});let i=!1;for(let e in this.tiles){let t=this.tiles[e];"loaded"!==t.state&&(t.state="loaded",t.texture=this.texture,i=!0)}i&&this.fire(new z("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}),"prepare"),this.serialize=l((()=>({type:"canvas",coordinates:this.coordinates})),"serialize"),t.coordinates?(!Array.isArray(t.coordinates)||4!==t.coordinates.length||t.coordinates.some((e=>!Array.isArray(e)||2!==e.length||e.some((e=>"number"!=typeof e)))))&&this.fire(new H(new U("sources.".concat(e),null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new H(new U("sources.".concat(e),null,'missing required property "coordinates"'))),t.animate&&"boolean"!=typeof t.animate&&this.fire(new H(new U("sources.".concat(e),null,'optional "animate" property must be a boolean value'))),t.canvas?"string"!=typeof t.canvas&&!(t.canvas instanceof HTMLCanvasElement)&&this.fire(new H(new U("sources.".concat(e),null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new H(new U("sources.".concat(e),null,'missing required property "canvas"'))),this.options=t,this.animate=void 0===t.animate||t.animate}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}};l(Im,"CanvasSource");var yn=Im,iv={},nv=l(((e,t,r,i)=>{let a=new(Mm(t.type))(e,t,r,i);if(a.id!==e)throw new Error("Expected Source id to be ".concat(e," instead of ").concat(a.id));return a}),"create"),Mm=l((e=>{switch(e){case"geojson":return mn;case"image":return It;case"raster":return zr;case"raster-dem":return fn;case"vector":return cn;case"video":return dn;case"canvas":return yn}return iv[e]}),"getSourceType"),av=l(((e,t)=>{iv[e]=t}),"setSourceType");function AC(e,t){let r=G.create();return G.translate(r,r,[1,1,0]),G.scale(r,r,[.5*e.width,.5*e.height,1]),G.multiply(r,r,e.calculatePosMatrix(t.toUnwrapped()))}function IC(e,t,r){if(e)for(let i of e){let e=t[i];if(e&&e.source===r&&"fill-extrusion"===e.type)return!0}else for(let e in t){let i=t[e];if(i.source===r&&"fill-extrusion"===i.type)return!0}return!1}function ov(e,t,r,i,a,n){let s=IC(a&&a.layers,t,e.id),o=n.maxPitchScaleFactor(),l=e.tilesIn(i,o,s);l.sort(uv);let u=[];for(let i of l)u.push({wrappedTileID:i.tileID.wrapped().key,queryResults:i.tile.queryRenderedFeatures(t,r,e._state,i.queryGeometry,i.cameraQueryGeometry,i.scale,a,n,o,AC(e.transform,i.tileID))});let c=MC(u);for(let t in c)c[t].forEach((t=>{let r=t.feature,i=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=i}));return c}function sv(e,t,r,i,a,n,s){let o={},l=n.queryRenderedSymbols(i),u=[];for(let e of Object.keys(l).map(Number))u.push(s[e]);u.sort(uv);for(let r of u){let i=r.featureIndex.lookupSymbolFeatures(l[r.bucketInstanceId],t,r.bucketIndex,r.sourceLayerIndex,a.filter,a.layers,a.availableImages,e);for(let e in i){let t=o[e]=o[e]||[],a=i[e];a.sort(((e,t)=>{let i=r.featureSortOrder;if(i){let r=i.indexOf(e.featureIndex);return i.indexOf(t.featureIndex)-r}return t.featureIndex-e.featureIndex}));for(let e of a)t.push(e)}}for(let t in o)o[t].forEach((i=>{let a=i.feature,n=e[t],s=r[n.source].getFeatureState(a.layer["source-layer"],a.id);a.source=a.layer.source,a.layer["source-layer"]&&(a.sourceLayer=a.layer["source-layer"]),a.state=s}));return o}function lv(e,t){let r=e.getRenderableIds().map((t=>e.getTileByID(t))),i=[],a={};for(let e=0;e<r.length;e++){let n=r[e],s=n.tileID.canonical.key;a[s]||(a[s]=!0,n.querySourceFeatures(i,t))}return i}function uv(e,t){let r=e.tileID,i=t.tileID;return r.overscaledZ-i.overscaledZ||r.canonical.y-i.canonical.y||r.wrap-i.wrap||r.canonical.x-i.canonical.x}function MC(e){let t={},r={};for(let i of e){let e=i.queryResults,a=i.wrappedTileID,n=r[a]=r[a]||{};for(let r in e){let i=e[r],a=n[r]=n[r]||{},s=t[r]=t[r]||[];for(let e of i)a[e.featureIndex]||(a[e.featureIndex]=!0,s.push(e))}}return t}function cv(e,t){let r={};if(!t)return r;for(let i of e){let e=i.layerIds.map((e=>t.getLayer(e))).filter(Boolean);if(0!==e.length){i.layers=e,i.stateDependentLayerIds&&(i.stateDependentLayers=i.stateDependentLayerIds.map((t=>e.filter((e=>e.id===t))[0])));for(let t of e)r[t.id]=i}}return r}d(),l(AC,"getPixelPosMatrix"),l(IC,"queryIncludes3DLayer"),l(ov,"queryRenderedFeatures"),l(sv,"queryRenderedSymbols"),l(lv,"querySourceFeatures"),l(uv,"sortTilesIn"),l(MC,"mergeRenderedFeatureLayers"),d(),d(),d(),l(cv,"deserialize"),d(),d();var Cm=class{constructor(e){this._stringToNumber={},this._numberToString=[];for(let t=0;t<e.length;t++){let r=e[t];this._stringToNumber[r]=t,this._numberToString[t]=r}}encode(e){return this._stringToNumber[e]}decode(e){if(e>=this._numberToString.length)throw new Error("Out of bounds. Index requested n=".concat(e," can't be >= this._numberToString.length ").concat(this._numberToString.length));return this._numberToString[e]}};l(Cm,"DictionaryCoder");var Il=Cm,fv=se(Ra(),1),mv=se(Zf(),1);d();var Em=class{constructor(e,t,r,i,a){this.type="Feature",this._vectorTileFeature=e,e._z=t,e._x=r,e._y=i,this.properties=e.properties,this.id=a}get geometry(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){let e={geometry:this.geometry};for(let t in this)"_geometry"===t||"_vectorTileFeature"===t||(e[t]=this[t]);return e}};l(Em,"GeoJSONFeature");var gn=Em,Lm=class{constructor(e,t){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new Jr(8192,16,0),this.grid3D=new Jr(8192,16,0),this.featureIndexArray=new wa,this.promoteId=t}insert(e,t,r,i,a,n){let s=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(r,i,a);let o=n?this.grid3D:this.grid;for(let e=0;e<t.length;e++){let r=t[e],i=[1/0,1/0,-1/0,-1/0];for(let e=0;e<r.length;e++){let t=r[e];i[0]=Math.min(i[0],t.x),i[1]=Math.min(i[1],t.y),i[2]=Math.max(i[2],t.x),i[3]=Math.max(i[3],t.y)}i[0]<8192&&i[1]<8192&&i[2]>=0&&i[3]>=0&&o.insert(s,i[0],i[1],i[2],i[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new fv.default.VectorTile(new mv.default(this.rawTileData)).layers,this.sourceLayerCoder=new Il(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,t,r,i){this.loadVTLayers();let a=e.params||{},n=8192/e.tileSize/e.scale,s=Jn(a.filter),o=e.queryGeometry,l=e.queryPadding*n,u=hv(o),c=this.grid.query(u.minX-l,u.minY-l,u.maxX+l,u.maxY+l),h=hv(e.cameraQueryGeometry),p=this.grid3D.query(h.minX-l,h.minY-l,h.maxX+l,h.maxY+l,((t,r,i,a)=>$x(e.cameraQueryGeometry,t-l,r-l,i+l,a+l)));for(let e of p)c.push(e);c.sort(CC);let d,f={};for(let l=0;l<c.length;l++){let u=c[l];if(u===d)continue;d=u;let h=this.featureIndexArray.get(u),p=null;this.loadMatchingFeature(f,h.bucketIndex,h.sourceLayerIndex,h.featureIndex,s,a.layers,a.availableImages,t,r,i,((t,r,i)=>(p||(p=yt(t)),r.queryIntersectsFeature(o,t,i,p,this.z,e.transform,n,e.pixelPosMatrix))))}return f}loadMatchingFeature(e,t,r,i,a,n,s,o,l,u,c){let h=this.bucketLayerIDs[t];if(n&&!cg(n,h))return;let p=this.sourceLayerCoder.decode(r),d=this.vtLayers[p].feature(i);if(a.needGeometry){let e=gt(d,!0);if(!a.filter(new ye(this.tileID.overscaledZ),e,this.tileID.canonical))return}else if(!a.filter(new ye(this.tileID.overscaledZ),d))return;let f=this.getId(d,p);for(let t=0;t<h.length;t++){let r=h[t];if(n&&n.indexOf(r)<0)continue;let a=o[r];if(!a)continue;let p={};f&&u&&(p=u.getState(a.sourceLayer||"_geojsonTileLayer",f));let m=R({},l[r]);m.paint=pv(m.paint,a.paint,d,p,s),m.layout=pv(m.layout,a.layout,d,p,s);let y=!c||c(d,a,p);if(!y)continue;let g=new gn(d,this.z,this.x,this.y,f);g.layer=m;let _=e[r];void 0===_&&(_=e[r]=[]),_.push({featureIndex:i,feature:g,intersectionZ:y})}}lookupSymbolFeatures(e,t,r,i,a,n,s,o){let l={};this.loadVTLayers();let u=Jn(a);for(let a of e)this.loadMatchingFeature(l,r,i,a,u,n,s,o,t);return l}hasLayer(e){for(let t of this.bucketLayerIDs)for(let r of t)if(e===r)return!0;return!1}getId(e,t){let r=e.id;if(this.promoteId){let i="string"==typeof this.promoteId?this.promoteId:this.promoteId[t];r=e.properties[i],"boolean"==typeof r&&(r=Number(r))}return r}};l(Lm,"FeatureIndex");var km=Lm;function pv(e,t,r,i,a){return Mn(e,((e,n)=>{let s=t instanceof Sr?t.get(n):null;return s&&s.evaluate?s.evaluate(r,i,a):s}))}function hv(e){let t=1/0,r=1/0,i=-1/0,a=-1/0;for(let n of e)t=Math.min(t,n.x),r=Math.min(r,n.y),i=Math.max(i,n.x),a=Math.max(a,n.y);return{minX:t,minY:r,maxX:i,maxY:a}}function CC(e,t){return t-e}N("FeatureIndex",km,{omit:["rawTileData","sourceLayerCoder"]}),l(pv,"evaluateProperties"),l(hv,"getBounds"),l(CC,"topDownFeatureComparator");var EC=3e4,Dm=class{constructor(e,t){this.timeAdded=0,this.fadeEndTime=0,this.tileID=e,this.uid=_o(),this.uses=0,this.tileSize=t,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(e){let t=e+this.timeAdded;t<this.fadeEndTime||(this.fadeEndTime=t)}wasRequested(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}clearTextures(e){this.demTexture&&e.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(e,t,r){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",e){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=cv(e.buckets,t.style),this.hasSymbolBuckets=!1;for(let e in this.buckets){let t=this.buckets[e];if(t instanceof qt){if(this.hasSymbolBuckets=!0,!r)break;t.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let e in this.buckets){let t=this.buckets[e];if(t instanceof qt&&t.hasRTLText){this.hasRTLText=!0,kx();break}}this.queryPadding=0;for(let e in this.buckets){let r=this.buckets[e];this.queryPadding=Math.max(this.queryPadding,t.style.getLayer(e).queryRadius(r))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage)}else this.collisionBoxArray=new ga}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 t in this.buckets){let r=this.buckets[t];r.uploadPending()&&r.upload(e)}let t=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new be(e,this.imageAtlas.image,t.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new be(e,this.glyphAtlasImage,t.ALPHA),this.glyphAtlasImage=null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,t,r,i,a,n,s,o,l,u){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:i,cameraQueryGeometry:a,scale:n,tileSize:this.tileSize,pixelPosMatrix:u,transform:o,params:s,queryPadding:this.queryPadding*l},e,t,r):{}}querySourceFeatures(e,t){let r=this.latestFeatureIndex;if(!r||!r.rawTileData)return;let i=r.loadVTLayers(),a=t&&t.sourceLayer?t.sourceLayer:"",n=i._geojsonTileLayer||i[a];if(!n)return;let s=Jn(t&&t.filter),{z:o,x:l,y:u}=this.tileID.canonical,c={z:o,x:l,y:u};for(let t=0;t<n.length;t++){let i=n.feature(t);if(s.needGeometry){let e=gt(i,!0);if(!s.filter(new ye(this.tileID.overscaledZ),e,this.tileID.canonical))continue}else if(!s.filter(new ye(this.tileID.overscaledZ),i))continue;let h=r.getId(i,a),p=new gn(i,o,l,u,h);p.tile=c,e.push(p)}}hasData(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){let t=this.expirationTime;if(e.cacheControl){let t=mg(e.cacheControl);t["max-age"]&&(this.expirationTime=Date.now()+1e3*t["max-age"])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){let e=Date.now(),r=!1;if(this.expirationTime>e)r=!1;else if(t)if(this.expirationTime<t)r=!0;else{let i=this.expirationTime-t;i?this.expirationTime=e+Math.max(i,EC):r=!0}else r=!0;r?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-(new Date).getTime(),Math.pow(2,31)-1)}setFeatureState(e,t){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||0===Object.keys(e).length)return;let r=this.latestFeatureIndex.loadVTLayers();for(let i in this.buckets){if(!t.style.hasLayer(i))continue;let a=this.buckets[i],n=a.layers[0].sourceLayer||"_geojsonTileLayer",s=r[n],o=e[n];if(!s||!o||0===Object.keys(o).length)continue;a.update(o,s,this.imageAtlas&&this.imageAtlas.patternPositions||{});let l=t&&t.style&&t.style.getLayer(i);l&&(this.queryPadding=Math.max(this.queryPadding,l.queryRadius(a)))}}holdingForFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<ne.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(e){this.symbolFadeHoldUntil=ne.now()+e}setDependencies(e,t){let r={};for(let e of t)r[e]=!0;this.dependencies[e]=r}hasDependency(e,t){for(let r of e){let e=this.dependencies[r];if(e)for(let r of t)if(e[r])return!0}return!1}};l(Dm,"Tile");var xn=Dm;d();var zm=class{constructor(e,t){this.max=e,this.onRemove=t,this.reset()}reset(){for(let e in this.data)for(let t of this.data[e])t.timeout&&clearTimeout(t.timeout),this.onRemove(t.value);return this.data={},this.order=[],this}add(e,t,r){let i=e.wrapped().key;void 0===this.data[i]&&(this.data[i]=[]);let a={value:t,timeout:void 0};if(void 0!==r&&(a.timeout=setTimeout((()=>{this.remove(e,a)}),r)),this.data[i].push(a),this.order.push(i),this.order.length>this.max){let e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){let t=this.data[e].shift();return t.timeout&&clearTimeout(t.timeout),0===this.data[e].length&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),t.value}getByKey(e){let t=this.data[e];return t?t[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,t){if(!this.has(e))return this;let r=e.wrapped().key,i=void 0===t?0:this.data[r].indexOf(t),a=this.data[r][i];return this.data[r].splice(i,1),a.timeout&&clearTimeout(a.timeout),0===this.data[r].length&&delete this.data[r],this.onRemove(a.value),this.order.splice(this.order.indexOf(r),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){let e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}filter(e){let t=[];for(let r in this.data)for(let i of this.data[r])e(i.value)||t.push(i);for(let e of t)this.remove(e.value.tileID,e)}};l(zm,"TileCache");var Ml=zm,Bm=se(Pe(),1);d();var Fm=class{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,t,r){let i=String(t);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][i]=this.stateChanges[e][i]||{},R(this.stateChanges[e][i],r),null===this.deletedStates[e]){this.deletedStates[e]={};for(let t in this.state[e])t!==i&&(this.deletedStates[e][t]=null)}else if(this.deletedStates[e]&&null===this.deletedStates[e][i]){this.deletedStates[e][i]={};for(let t in this.state[e][i])r[t]||(this.deletedStates[e][i][t]=null)}else for(let t in r)this.deletedStates[e]&&this.deletedStates[e][i]&&null===this.deletedStates[e][i][t]&&delete this.deletedStates[e][i][t]}removeFeatureState(e,t,r){if(null===this.deletedStates[e])return;let i=String(t);if(this.deletedStates[e]=this.deletedStates[e]||{},r&&void 0!==t)null!==this.deletedStates[e][i]&&(this.deletedStates[e][i]=this.deletedStates[e][i]||{},this.deletedStates[e][i][r]=null);else if(void 0!==t)if(this.stateChanges[e]&&this.stateChanges[e][i])for(r in this.deletedStates[e][i]={},this.stateChanges[e][i])this.deletedStates[e][i][r]=null;else this.deletedStates[e][i]=null;else this.deletedStates[e]=null}getState(e,t){let r=String(t),i=this.state[e]||{},a=this.stateChanges[e]||{},n=R({},i[r],a[r]);if(null===this.deletedStates[e])return{};if(this.deletedStates[e]){let r=this.deletedStates[e][t];if(null===r)return{};for(let e in r)delete n[e]}return n}initializeTileState(e,t){e.setFeatureState(this.state,t)}coalesceChanges(e,t){let r={};for(let e in this.stateChanges){this.state[e]=this.state[e]||{};let t={};for(let r in this.stateChanges[e])this.state[e][r]||(this.state[e][r]={}),R(this.state[e][r],this.stateChanges[e][r]),t[r]=this.state[e][r];r[e]=t}for(let e in this.deletedStates){this.state[e]=this.state[e]||{};let t={};if(null===this.deletedStates[e])for(let r in this.state[e])t[r]={},this.state[e][r]={};else for(let r in this.deletedStates[e]){if(null===this.deletedStates[e][r])this.state[e][r]={};else for(let t of Object.keys(this.deletedStates[e][r]))delete this.state[e][r][t];t[r]=this.state[e][r]}r[e]=r[e]||{},R(r[e],t)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(r).length)for(let i in e)e[i].setFeatureState(r,t)}};l(Fm,"SourceFeatureState");var Cl=Fm,gi=class e extends de{constructor(e,t,r){super(),this.id=e,this.dispatcher=r,this.on("data",(e=>{"source"===e.dataType&&"metadata"===e.sourceDataType&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===e.dataType&&"content"===e.sourceDataType&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)})),this.on("dataloading",(()=>{this._sourceErrored=!1})),this.on("error",(()=>{this._sourceErrored=this._source.loaded()})),this._source=nv(e,t,r,this),this._tiles={},this._cache=new Ml(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Cl,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(!(void 0===this.used&&void 0===this.usedForTerrain||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(let e in this._tiles){let t=this._tiles[e];if("loaded"!==t.state&&"errored"!==t.state)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)}_loadTile(e,t){return this._source.loadTile(e,t)}_unloadTile(e){if(this._source.unloadTile)return this._source.unloadTile(e,(()=>{}))}_abortTile(e){this._source.abortTile&&this._source.abortTile(e,(()=>{})),this._source.fire(new z("dataabort",{tile:e,coord:e.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(let t in this._tiles){let r=this._tiles[t];r.upload(e),r.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map((e=>e.tileID)).sort(dv).map((e=>e.key))}getRenderableIds(e){let t=[];for(let r in this._tiles)this._isIdRenderable(r,e)&&t.push(this._tiles[r]);return e?t.sort(((e,t)=>{let r=e.tileID,i=t.tileID,a=new Bm.default(r.canonical.x,r.canonical.y)._rotate(this.transform.angle),n=new Bm.default(i.canonical.x,i.canonical.y)._rotate(this.transform.angle);return r.overscaledZ-i.overscaledZ||n.y-a.y||n.x-a.x})).map((e=>e.tileID.key)):t.map((e=>e.tileID)).sort(dv).map((e=>e.key))}hasRenderableParent(e){let t=this.findLoadedParent(e,0);return!!t&&this._isIdRenderable(t.tileID.key)}_isIdRenderable(e,t){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(t||!this._tiles[e].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(let e in this._tiles)"errored"!==this._tiles[e].state&&this._reloadTile(e,"reloading")}}_reloadTile(e,t){let r=this._tiles[e];r&&("loading"!==r.state&&(r.state=t),this._loadTile(r,this._tileLoaded.bind(this,r,e,t)))}_tileLoaded(e,t,r,i){if(i)return e.state="errored",void(404!==i.status?this._source.fire(new H(i,{tile:e})):this.update(this.transform,this.terrain));e.timeAdded=ne.now(),"expired"===r&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(t,e),"raster-dem"===this.getSource().type&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new z("data",{dataType:"source",tile:e,coord:e.tileID}))}_backfillDEM(e){let t=this.getRenderableIds();for(let i=0;i<t.length;i++){let a=t[i];if(e.neighboringTiles&&e.neighboringTiles[a]){let t=this.getTileByID(a);r(e,t),r(t,e)}}function r(e,t){e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0;let r=t.tileID.canonical.x-e.tileID.canonical.x,i=t.tileID.canonical.y-e.tileID.canonical.y,a=Math.pow(2,e.tileID.canonical.z),n=t.tileID.key;0===r&&0===i||Math.abs(i)>1||(Math.abs(r)>1&&(1===Math.abs(r+a)?r+=a:1===Math.abs(r-a)&&(r-=a)),t.dem&&e.dem&&(e.dem.backfillBorder(t.dem,r,i),e.neighboringTiles&&e.neighboringTiles[n]&&(e.neighboringTiles[n].backfilled=!0)))}l(r,"fillBorder")}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,t,r,i){for(let a in this._tiles){let n=this._tiles[a];if(i[a]||!n.hasData()||n.tileID.overscaledZ<=t||n.tileID.overscaledZ>r)continue;let s=n.tileID;for(;n&&n.tileID.overscaledZ>t+1;){let e=n.tileID.scaledTo(n.tileID.overscaledZ-1);n=this._tiles[e.key],n&&n.hasData()&&(s=e)}let o=s;for(;o.overscaledZ>t;)if(o=o.scaledTo(o.overscaledZ-1),e[o.key]){i[s.key]=s;break}}}findLoadedParent(e,t){if(e.key in this._loadedParentTiles){let r=this._loadedParentTiles[e.key];return r&&r.tileID.overscaledZ>=t?r:null}for(let r=e.overscaledZ-1;r>=t;r--){let t=e.scaledTo(r),i=this._getLoadedTile(t);if(i)return i}}_getLoadedTile(e){let t=this._tiles[e.key];return t&&t.hasData()?t:this._cache.getByKey(e.wrapped().key)}updateCacheSize(e){let t=(Math.ceil(e.width/this._source.tileSize)+1)*(Math.ceil(e.height/this._source.tileSize)+1),r=null===this._maxTileCacheZoomLevels?Je.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels,i=Math.floor(t*r),a="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,i):i;this._cache.setMaxSize(a)}handleWrapJump(e){let t=(e-(void 0===this._prevLng?e:this._prevLng))/360,r=Math.round(t);if(this._prevLng=e,r){let e={};for(let t in this._tiles){let i=this._tiles[t];i.tileID=i.tileID.unwrapTo(i.tileID.wrap+r),e[i.tileID.key]=i}this._tiles=e;for(let e in this._timers)clearTimeout(this._timers[e]),delete this._timers[e];for(let e in this._tiles){let t=this._tiles[e];this._setTileReloadTimer(e,t)}}}update(t,r){if(this.transform=t,this.terrain=r,!this._sourceLoaded||this._paused)return;let i;this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?i=t.getVisibleUnwrappedCoordinates(this._source.tileID).map((e=>new nt(e.canonical.z,e.wrap,e.canonical.z,e.canonical.x,e.canonical.y))):(i=t.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:r}),this._source.hasTile&&(i=i.filter((e=>this._source.hasTile(e))))):i=[];let a=t.coveringZoomLevel(this._source),n=Math.max(a-e.maxOverzooming,this._source.minzoom),s=Math.max(a+e.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){let e={};for(let t of i)if(t.canonical.z>this._source.minzoom){let r=t.scaledTo(t.canonical.z-1);e[r.key]=r;let i=t.scaledTo(Math.max(this._source.minzoom,Math.min(t.canonical.z,5)));e[i.key]=i}i=i.concat(Object.values(e))}let o=0===i.length&&!this._updated&&this._didEmitContent;this._updated=!0,o&&this.fire(new z("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));let l=this._updateRetainedTiles(i,a);if(yv(this._source.type)){let e={},t={},o=Object.keys(l),u=ne.now();for(let r of o){let i=l[r],a=this._tiles[r];if(!a||0!==a.fadeEndTime&&a.fadeEndTime<=u)continue;let s=this.findLoadedParent(i,n);s&&(this._addTile(s.tileID),e[s.tileID.key]=s.tileID),t[r]=i}this._retainLoadedChildren(t,a,s,l);for(let t in e)l[t]||(this._coveredTiles[t]=!0,l[t]=e[t]);if(r){let e={},t={};for(let r of i)this._tiles[r.key].hasData()?e[r.key]=r:t[r.key]=r;for(let r in t){let i=t[r].children(this._source.maxzoom);this._tiles[i[0].key]&&this._tiles[i[1].key]&&this._tiles[i[2].key]&&this._tiles[i[3].key]&&(e[i[0].key]=l[i[0].key]=i[0],e[i[1].key]=l[i[1].key]=i[1],e[i[2].key]=l[i[2].key]=i[2],e[i[3].key]=l[i[3].key]=i[3],delete t[r])}for(let r in t){let i=this.findLoadedParent(t[r],this._source.minzoom);if(i){e[i.tileID.key]=l[i.tileID.key]=i.tileID;for(let t in e)e[t].isChildOf(i.tileID)&&delete e[t]}}for(let t in this._tiles)e[t]||(this._coveredTiles[t]=!0)}}for(let e in l)this._tiles[e].clearFadeHold();let u=sg(this._tiles,l);for(let e of u){let t=this._tiles[e];t.hasSymbolBuckets&&!t.holdingForFade()?t.setHoldDuration(this.map._fadeDuration):(!t.hasSymbolBuckets||t.symbolFadeFinished())&&this._removeTile(e)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(let e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(e)}_updateRetainedTiles(t,r){let i={},a={},n=Math.max(r-e.maxOverzooming,this._source.minzoom),s=Math.max(r+e.maxUnderzooming,this._source.minzoom),o={};for(let e of t){let t=this._addTile(e);i[e.key]=e,!t.hasData()&&r<this._source.maxzoom&&(o[e.key]=e)}this._retainLoadedChildren(o,r,s,i);for(let e of t){let t=this._tiles[e.key];if(t.hasData())continue;if(r+1>this._source.maxzoom){let t=e.children(this._source.maxzoom)[0],r=this.getTile(t);if(r&&r.hasData()){i[t.key]=t;continue}}else{let t=e.children(this._source.maxzoom);if(i[t[0].key]&&i[t[1].key]&&i[t[2].key]&&i[t[3].key])continue}let s=t.wasRequested();for(let r=e.overscaledZ-1;r>=n;--r){let n=e.scaledTo(r);if(a[n.key])break;if(a[n.key]=!0,t=this.getTile(n),!t&&s&&(t=this._addTile(n)),t){let e=t.hasData();if((s||e)&&(i[n.key]=n),s=t.wasRequested(),e)break}}}return i}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(let e in this._tiles){let t,r=[],i=this._tiles[e].tileID;for(;i.overscaledZ>0;){if(i.key in this._loadedParentTiles){t=this._loadedParentTiles[i.key];break}r.push(i.key);let e=i.scaledTo(i.overscaledZ-1);if(t=this._getLoadedTile(e),t)break;i=e}for(let e of r)this._loadedParentTiles[e]=t}}_addTile(e){let t=this._tiles[e.key];if(t)return t;t=this._cache.getAndRemove(e),t&&(this._setTileReloadTimer(e.key,t),t.tileID=e,this._state.initializeTileState(t,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,t)));let r=t;return t||(t=new xn(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(t,this._tileLoaded.bind(this,t,e.key,t.state))),t.uses++,this._tiles[e.key]=t,r||this._source.fire(new z("dataloading",{tile:t,coord:t.tileID,dataType:"source"})),t}_setTileReloadTimer(e,t){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);let r=t.getExpiryTimeout();r&&(this._timers[e]=setTimeout((()=>{this._reloadTile(e,"expired"),delete this._timers[e]}),r))}_removeTile(e){let t=this._tiles[e];t&&(t.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),!(t.uses>0)&&(t.hasData()&&"reloading"!==t.state?this._cache.add(t.tileID,t,t.getExpiryTimeout()):(t.aborted=!0,this._abortTile(t),this._unloadTile(t))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(let e in this._tiles)this._removeTile(e);this._cache.reset()}tilesIn(e,t,r){let i=[],a=this.transform;if(!a)return i;let n=r?a.getCameraQueryGeometry(e):e,s=e.map((e=>a.pointCoordinate(e,this.terrain))),o=n.map((e=>a.pointCoordinate(e,this.terrain))),l=this.getIds(),u=1/0,c=1/0,h=-1/0,p=-1/0;for(let e of o)u=Math.min(u,e.x),c=Math.min(c,e.y),h=Math.max(h,e.x),p=Math.max(p,e.y);for(let e=0;e<l.length;e++){let r=this._tiles[l[e]];if(r.holdingForFade())continue;let n=r.tileID,d=Math.pow(2,a.zoom-r.tileID.overscaledZ),f=t*r.queryPadding*8192/r.tileSize/d,m=[n.getTilePoint(new ze(u,c)),n.getTilePoint(new ze(h,p))];if(m[0].x-f<8192&&m[0].y-f<8192&&m[1].x+f>=0&&m[1].y+f>=0){let e=s.map((e=>n.getTilePoint(e))),t=o.map((e=>n.getTilePoint(e)));i.push({tile:r,tileID:n,queryGeometry:e,cameraQueryGeometry:t,scale:d})}}return i}getVisibleCoordinates(e){let t=this.getRenderableIds(e).map((e=>this._tiles[e].tileID));for(let e of t)e.posMatrix=this.transform.calculatePosMatrix(e.toUnwrapped());return t}hasTransition(){if(this._source.hasTransition())return!0;if(yv(this._source.type)){let e=ne.now();for(let t in this._tiles)if(this._tiles[t].fadeEndTime>=e)return!0}return!1}setFeatureState(e,t,r){e=e||"_geojsonTileLayer",this._state.updateState(e,t,r)}removeFeatureState(e,t,r){e=e||"_geojsonTileLayer",this._state.removeFeatureState(e,t,r)}getFeatureState(e,t){return e=e||"_geojsonTileLayer",this._state.getState(e,t)}setDependencies(e,t,r){let i=this._tiles[e];i&&i.setDependencies(t,r)}reloadTilesForDependencies(e,t){for(let r in this._tiles)this._tiles[r].hasDependency(e,t)&&this._reloadTile(r,"reloading");this._cache.filter((r=>!r.hasDependency(e,t)))}};l(gi,"SourceCache");var sr=gi;function dv(e,t){let r=Math.abs(2*e.wrap)-+(e.wrap<0),i=Math.abs(2*t.wrap)-+(t.wrap<0);return e.overscaledZ-t.overscaledZ||i-r||t.canonical.y-e.canonical.y||t.canonical.x-e.canonical.x}function yv(e){return"raster"===e||"image"===e||"video"===e}sr.maxOverzooming=10,sr.maxUnderzooming=3,l(dv,"compareTileId"),l(yv,"isRasterType"),d(),d(),d(),d();var gv='(()=>{var Tf=Object.create;var da=Object.defineProperty;var Ef=Object.getOwnPropertyDescriptor;var Ff=Object.getOwnPropertyNames;var Mf=Object.getPrototypeOf,Lf=Object.prototype.hasOwnProperty;var we=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),sl=(t,e)=>{for(var r in e)da(t,r,{get:e[r],enumerable:!0})},Df=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Ff(e))!Lf.call(t,i)&&i!==r&&da(t,i,{get:()=>e[i],enumerable:!(n=Ef(e,i))||n.enumerable});return t};var Z=(t,e,r)=>(r=t!=null?Tf(Mf(t)):{},Df(e||!t||!t.__esModule?da(r,"default",{value:t,enumerable:!0}):r,t));var he=we((Kx,ll)=>{"use strict";ll.exports=rr;function rr(t,e){this.x=t,this.y=e}rr.prototype={clone:function(){return new rr(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}};rr.convert=function(t){return t instanceof rr?t:Array.isArray(t)?new rr(t[0],t[1]):t}});var ga=we((Yx,cl)=>{"use strict";cl.exports=ul;function ul(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}ul.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 Du=we((w0,es)=>{function Jm(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 es<"u"&&(es.exports=Jm)});var Vu=we((A0,ts)=>{function Wm(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 ts!==void 0&&(ts.exports=Wm)});var rs=we((_0,fo)=>{var Bu=Du(),Hm=Vu();fo.exports=Bu;fo.exports.murmur3=Bu;fo.exports.murmur2=Hm});var hs=we((g1,ms)=>{"use strict";ms.exports=Io;ms.exports.default=Io;function Io(t,e,r){r=r||2;var n=e&&e.length,i=n?e[0]*r:t.length,o=Sc(t,0,i,r,!0),a=[];if(!o||o.next===o.prev)return a;var s,l,u,c,p,f,y;if(n&&(o=Vd(t,e,o,r)),t.length>80*r){s=u=t[0],l=c=t[1];for(var m=r;m<i;m+=r)p=t[m],f=t[m+1],p<s&&(s=p),f<l&&(l=f),p>u&&(u=p),f>c&&(c=f);y=Math.max(u-s,c-l),y=y!==0?32767/y:0}return Bn(o,a,r,s,l,y,0),a}function Sc(t,e,r,n,i){var o,a;if(i===ys(t,e,r,n)>0)for(o=e;o<r;o+=n)a=Pc(o,t[o],t[o+1],a);else for(o=r-n;o>=e;o-=n)a=Pc(o,t[o],t[o+1],a);return a&&Co(a,a.next)&&(Rn(a),a=a.next),a}function Ht(t,e){if(!t)return t;e||(e=t);var r=t,n;do if(n=!1,!r.steiner&&(Co(r,r.next)||se(r.prev,r,r.next)===0)){if(Rn(r),r=e=r.prev,r===r.next)break;n=!0}else r=r.next;while(n||r!==e);return e}function Bn(t,e,r,n,i,o,a){if(t){!a&&o&&Nd(t,n,i,o);for(var s=t,l,u;t.prev!==t.next;){if(l=t.prev,u=t.next,o?Md(t,n,i,o):Fd(t)){e.push(l.i/r|0),e.push(t.i/r|0),e.push(u.i/r|0),Rn(t),t=u.next,s=u.next;continue}if(t=u,t===s){a?a===1?(t=Ld(Ht(t),e,r),Bn(t,e,r,n,i,o,2)):a===2&&Dd(t,e,r,n,i,o):Bn(Ht(t),e,r,n,i,o,1);break}}}}function Fd(t){var e=t.prev,r=t,n=t.next;if(se(e,r,n)>=0)return!1;for(var i=e.x,o=r.x,a=n.x,s=e.y,l=r.y,u=n.y,c=i<o?i<a?i:a:o<a?o:a,p=s<l?s<u?s:u:l<u?l:u,f=i>o?i>a?i:a:o>a?o:a,y=s>l?s>u?s:u:l>u?l:u,m=n.next;m!==e;){if(m.x>=c&&m.x<=f&&m.y>=p&&m.y<=y&&Pr(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 Md(t,e,r,n){var i=t.prev,o=t,a=t.next;if(se(i,o,a)>=0)return!1;for(var s=i.x,l=o.x,u=a.x,c=i.y,p=o.y,f=a.y,y=s<l?s<u?s:u:l<u?l:u,m=c<p?c<f?c:f:p<f?p:f,d=s>l?s>u?s:u:l>u?l:u,h=c>p?c>f?c:f:p>f?p:f,g=ps(y,m,e,r,n),v=ps(d,h,e,r,n),b=t.prevZ,x=t.nextZ;b&&b.z>=g&&x&&x.z<=v;){if(b.x>=y&&b.x<=d&&b.y>=m&&b.y<=h&&b!==i&&b!==a&&Pr(s,c,l,p,u,f,b.x,b.y)&&se(b.prev,b,b.next)>=0||(b=b.prevZ,x.x>=y&&x.x<=d&&x.y>=m&&x.y<=h&&x!==i&&x!==a&&Pr(s,c,l,p,u,f,x.x,x.y)&&se(x.prev,x,x.next)>=0))return!1;x=x.nextZ}for(;b&&b.z>=g;){if(b.x>=y&&b.x<=d&&b.y>=m&&b.y<=h&&b!==i&&b!==a&&Pr(s,c,l,p,u,f,b.x,b.y)&&se(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;x&&x.z<=v;){if(x.x>=y&&x.x<=d&&x.y>=m&&x.y<=h&&x!==i&&x!==a&&Pr(s,c,l,p,u,f,x.x,x.y)&&se(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function Ld(t,e,r){var n=t;do{var i=n.prev,o=n.next.next;!Co(i,o)&&wc(i,n,n.next,o)&&zn(i,o)&&zn(o,i)&&(e.push(i.i/r|0),e.push(n.i/r|0),e.push(o.i/r|0),Rn(n),Rn(n.next),n=t=o),n=n.next}while(n!==t);return Ht(n)}function Dd(t,e,r,n,i,o){var a=t;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&Gd(a,s)){var l=Ac(a,s);a=Ht(a,a.next),l=Ht(l,l.next),Bn(a,e,r,n,i,o,0),Bn(l,e,r,n,i,o,0);return}s=s.next}a=a.next}while(a!==t)}function Vd(t,e,r,n){var i=[],o,a,s,l,u;for(o=0,a=e.length;o<a;o++)s=e[o]*n,l=o<a-1?e[o+1]*n:t.length,u=Sc(t,s,l,n,!1),u===u.next&&(u.steiner=!0),i.push($d(u));for(i.sort(Bd),o=0;o<i.length;o++)r=zd(i[o],r);return r}function Bd(t,e){return t.x-e.x}function zd(t,e){var r=Rd(t,e);if(!r)return e;var n=Ac(r,t);return Ht(n,n.next),Ht(r,r.next)}function Rd(t,e){var r=e,n=t.x,i=t.y,o=-1/0,a;do{if(i<=r.y&&i>=r.next.y&&r.next.y!==r.y){var s=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=n&&s>o&&(o=s,a=r.x<r.next.x?r:r.next,s===n))return a}r=r.next}while(r!==e);if(!a)return null;var l=a,u=a.x,c=a.y,p=1/0,f;r=a;do n>=r.x&&r.x>=u&&n!==r.x&&Pr(i<c?n:o,i,u,c,i<c?o:n,i,r.x,r.y)&&(f=Math.abs(i-r.y)/(n-r.x),zn(r,t)&&(f<p||f===p&&(r.x>a.x||r.x===a.x&&Od(a,r)))&&(a=r,p=f)),r=r.next;while(r!==l);return a}function Od(t,e){return se(t.prev,t,e.prev)<0&&se(e.next,t,t.next)<0}function Nd(t,e,r,n){var i=t;do i.z===0&&(i.z=ps(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,Ud(i)}function Ud(t){var e,r,n,i,o,a,s,l,u=1;do{for(r=t,t=null,o=null,a=0;r;){for(a++,n=r,s=0,e=0;e<u&&(s++,n=n.nextZ,!!n);e++);for(l=u;s>0||l>0&&n;)s!==0&&(l===0||!n||r.z<=n.z)?(i=r,r=r.nextZ,s--):(i=n,n=n.nextZ,l--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;r=n}o.nextZ=null,u*=2}while(a>1);return t}function ps(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 $d(t){var e=t,r=t;do(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next;while(e!==t);return r}function Pr(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 Gd(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!qd(t,e)&&(zn(t,e)&&zn(e,t)&&jd(t,e)&&(se(t.prev,t,e.prev)||se(t,e.prev,e))||Co(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 Co(t,e){return t.x===e.x&&t.y===e.y}function wc(t,e,r,n){var i=_o(se(t,e,r)),o=_o(se(t,e,n)),a=_o(se(r,n,t)),s=_o(se(r,n,e));return!!(i!==o&&a!==s||i===0&&Ao(t,r,e)||o===0&&Ao(t,n,e)||a===0&&Ao(r,t,n)||s===0&&Ao(r,e,n))}function Ao(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 _o(t){return t>0?1:t<0?-1:0}function qd(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&wc(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}function zn(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 jd(t,e){var 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 Ac(t,e){var r=new fs(t.i,t.x,t.y),n=new fs(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 Pc(t,e,r,n){var i=new fs(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 Rn(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 fs(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Io.deviation=function(t,e,r,n){var i=e&&e.length,o=i?e[0]*r:t.length,a=Math.abs(ys(t,0,o,r));if(i)for(var s=0,l=e.length;s<l;s++){var u=e[s]*r,c=s<l-1?e[s+1]*r:t.length;a-=Math.abs(ys(t,u,c,r))}var p=0;for(s=0;s<n.length;s+=3){var f=n[s]*r,y=n[s+1]*r,m=n[s+2]*r;p+=Math.abs((t[f]-t[m])*(t[y+1]-t[f+1])-(t[f]-t[y])*(t[m+1]-t[f+1]))}return a===0&&p===0?0:Math.abs((p-a)/a)};function ys(t,e,r,n){for(var i=0,o=e,a=r-n;o<r;o+=n)i+=(t[a]-t[o])*(t[o+1]+t[a+1]),a=o;return i}Io.flatten=function(t){for(var e=t[0][0].length,r={vertices:[],holes:[],dimensions:e},n=0,i=0;i<t.length;i++){for(var o=0;o<t[i].length;o++)for(var a=0;a<e;a++)r.vertices.push(t[i][o][a]);i>0&&(n+=t[i-1].length,r.holes.push(n))}return r}});var gs=we((eP,Mc)=>{"use strict";var Xd=he();Mc.exports=_r;function _r(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(Qd,this,e)}function Qd(t,e,r){t==1?e.id=r.readVarint():t==2?eg(r,e):t==3?e.type=r.readVarint():t==4&&(e._geometry=r.pos)}function eg(t,e){for(var r=t.readVarint()+t.pos;t.pos<r;){var n=e._keys[t.readVarint()],i=e._values[t.readVarint()];e.properties[n]=i}}_r.types=["Unknown","Point","LineString","Polygon"];_r.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 Xd(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};_r.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]};_r.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=_r.types[this.type],l,u;function c(y){for(var m=0;m<y.length;m++){var d=y[m],h=180-(d.y+o)*360/n;y[m]=[(d.x+i)*360/n-180,360/Math.PI*Math.atan(Math.exp(h*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=tg(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 tg(t){var e=t.length;if(e<=1)return[t];for(var r=[],n,i,o=0;o<e;o++){var a=rg(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 rg(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 xs=we((tP,Dc)=>{"use strict";var ng=gs();Dc.exports=Lc;function Lc(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(ig,this,e),this.length=this._features.length}function ig(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(og(r))}function og(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}Lc.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 ng(this._pbf,e,this.extent,this._keys,this._values)}});var Bc=we((rP,Vc)=>{"use strict";var ag=xs();Vc.exports=sg;function sg(t,e){this.layers=t.readFields(lg,{},e)}function lg(t,e,r){if(t===3){var n=new ag(r,r.readVarint()+r.pos);n.length&&(e[n.name]=n)}}});var It=we((nP,To)=>{To.exports.VectorTile=Bc();To.exports.VectorTileFeature=gs();To.exports.VectorTileLayer=xs()});var np=we(ws=>{ws.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)};ws.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,d=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]|=d*128}});var $n=we((RS,lp)=>{"use strict";lp.exports=J;var Do=np();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 As=65536*65536,ip=1/As,Cg=12,sp=typeof TextDecoder>"u"?null:new TextDecoder("utf8");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=Vo(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=ap(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=Vo(this.buf,this.pos)+Vo(this.buf,this.pos+4)*As;return this.pos+=8,t},readSFixed64:function(){var t=Vo(this.buf,this.pos)+ap(this.buf,this.pos+4)*As;return this.pos+=8,t},readFloat:function(){var t=Do.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=Do.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,kg(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>=Cg&&sp?$g(this.buf,e,t):Ug(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=ut(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=ut(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=ut(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=ut(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=ut(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=ut(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=ut(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=ut(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=ut(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),kr(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),kr(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),kr(this.buf,t&-1,this.pos),kr(this.buf,Math.floor(t*ip),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),kr(this.buf,t&-1,this.pos),kr(this.buf,Math.floor(t*ip),this.pos+4),this.pos+=8},writeVarint:function(t){if(t=+t||0,t>268435455||t<0){Tg(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=Gg(this.buf,t,this.pos);var r=this.pos-e;r>=128&&op(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),Do.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),Do.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&&op(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,Mg,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,Lg,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,Bg,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,Dg,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,Vg,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,zg,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,Rg,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,Og,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,Ng,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 kg(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 Cr(t,i,e);throw new Error("Expected varint not more than 10 bytes")}function ut(t){return t.type===J.Bytes?t.readVarint()+t.pos:t.pos+1}function Cr(t,e,r){return r?e*4294967296+(t>>>0):(e>>>0)*4294967296+(t>>>0)}function Tg(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),Eg(r,n,e),Fg(n,e)}function Eg(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 Fg(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 op(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 Mg(t,e){for(var r=0;r<t.length;r++)e.writeVarint(t[r])}function Lg(t,e){for(var r=0;r<t.length;r++)e.writeSVarint(t[r])}function Dg(t,e){for(var r=0;r<t.length;r++)e.writeFloat(t[r])}function Vg(t,e){for(var r=0;r<t.length;r++)e.writeDouble(t[r])}function Bg(t,e){for(var r=0;r<t.length;r++)e.writeBoolean(t[r])}function zg(t,e){for(var r=0;r<t.length;r++)e.writeFixed32(t[r])}function Rg(t,e){for(var r=0;r<t.length;r++)e.writeSFixed32(t[r])}function Og(t,e){for(var r=0;r<t.length;r++)e.writeFixed64(t[r])}function Ng(t,e){for(var r=0;r<t.length;r++)e.writeSFixed64(t[r])}function Vo(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+t[e+3]*16777216}function kr(t,e,r){t[r]=e,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function ap(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function Ug(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 $g(t,e,r){return sp.decode(t.subarray(e,r))}function Gg(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 nf=we((k_,rf)=>{rf.exports=na;function na(t,e){var r=t&&t.type,n;if(r==="FeatureCollection")for(n=0;n<t.features.length;n++)na(t.features[n],e);else if(r==="GeometryCollection")for(n=0;n<t.geometries.length;n++)na(t.geometries[n],e);else if(r==="Feature")na(t.geometry,e);else if(r==="Polygon")ef(t.coordinates,e);else if(r==="MultiPolygon")for(n=0;n<t.coordinates.length;n++)ef(t.coordinates[n],e);return t}function ef(t,e){if(t.length!==0){tf(t[0],e);for(var r=1;r<t.length;r++)tf(t[r],!e)}}function tf(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 lf=we((F_,sf)=>{"use strict";var Ix=he(),Cx=It().VectorTileFeature;sf.exports=af;function af(t,e){this.options=e||{},this.features=t,this.length=t.length}af.prototype.feature=function(t){return new oa(this.features[t],this.options.extent)};function oa(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}oa.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 Ix(r[i][0],r[i][1]));this.geometry.push(n)}return this.geometry};oa.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]};oa.prototype.toGeoJSON=Cx.prototype.toGeoJSON});var pf=we((M_,oi)=>{var kx=$n(),cf=lf();oi.exports=Us;oi.exports.fromVectorTileJs=Us;oi.exports.fromGeojsonVt=Tx;oi.exports.GeoJSONWrapper=cf;function Us(t){var e=new kx;return Ex(t,e),e.finish()}function Tx(t,e){e=e||{};var r={};for(var n in t)r[n]=new cf(t[n].features,e),r[n].name=n,r[n].version=e.version,r[n].extent=e.extent;return Us({layers:r})}function Ex(t,e){for(var r in t.layers)e.writeMessage(3,Fx,t.layers[r])}function Fx(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,Mx,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,Vx,o[r])}function Mx(t,e){var r=t.feature;r.id!==void 0&&e.writeVarintField(1,r.id),e.writeMessage(2,Lx,t),e.writeVarintField(3,r.type),e.writeMessage(4,Dx,r)}function Lx(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 Ns(t,e){return(e<<3)+(t&7)}function uf(t){return t<<1^t>>31}function Dx(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(Ns(1,u));for(var c=n===3?l.length-1:l.length,p=0;p<c;p++){p===1&&n!==1&&e.writeVarint(Ns(2,c-1));var f=l[p].x-i,y=l[p].y-o;e.writeVarint(uf(f)),e.writeVarint(uf(y)),i+=f,o+=y}n===3&&e.writeVarint(Ns(7,1))}}function Vx(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 Vf=Z(he(),1),fl=Z(ga(),1);function yl(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 Bf(t,e,r,n){let i=new fl.default(t,e,r,n);return function(o){return i.solve(o)}}var Xx=Bf(.25,.1,.25,1);function rt(t,e,r){return Math.min(r,Math.max(e,t))}function ml(t,e,r){let n=r-e,i=((t-e)%n+n)%n+e;return i===e?r:i}function Ae(t,...e){for(let r of e)for(let n in r)t[n]=r[n];return t}function hl(t){return Math.log(t)/Math.LN2%1===0}function Rr(t,e,r){let n={};for(let i in t)n[i]=e.call(r||this,t[i],i,t);return n}function dl(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 tt(t){return Array.isArray(t)?t.map(tt):typeof t=="object"&&t?Rr(t,tt):t}function gl(t,e){for(let r=0;r<t.length;r++)if(e.indexOf(t[r])>=0)return!0;return!1}var pl={};function ce(t){pl[t]||(typeof console<"u"&&console.warn(t),pl[t]=!0)}function nt(t,e,r){return(r.y-t.y)*(e.x-t.x)>(e.y-t.y)*(r.x-t.x)}function xl(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}function Ie(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}var xa=null;function ba(t){if(xa==null){let e=t.navigator?t.navigator.userAgent:null;xa=!!t.safari||!!(e&&(/\\b(iPad|iPhone|iPod)\\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return xa}function Or(t){return typeof ImageBitmap<"u"&&t instanceof ImageBitmap}var Ft=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 d=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,d,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 Ll=Z(ga(),1),zf=8,Rf={version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},Of={"*":{type:"source"}},Nf=["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],Uf={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:"*"}},$f={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:"*"}},Gf={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:{}},default:"mapbox"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},qf={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"}},jf={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"}}},Zf={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"}}},Jf={id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},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"}},Wf=["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],Hf={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Kf={"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"}},Yf={"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"}},Xf={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Qf={"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"}},ey={"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"}},ty={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},ry={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},ny={type:"array",value:"*"},iy={type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},oy={type:"enum",values:{Point:{},LineString:{},Polygon:{}}},ay={type:"array",minimum:0,maximum:24,value:["number","color"],length:2},sy={type:"array",value:"*",minimum:1},ly={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}},uy={source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},cy=["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],py={"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"}},fy={"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"}},yy={"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"}},my={"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"}},hy={"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"}},dy={"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"}},gy={"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,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:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",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"}},xy={"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"}},by={duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},vy={"*":{type:"string"}},S={$version:zf,$root:Rf,sources:Of,source:Nf,source_vector:Uf,source_raster:$f,source_raster_dem:Gf,source_geojson:qf,source_video:jf,source_image:Zf,layer:Jf,layout:Wf,layout_background:Hf,layout_fill:Kf,layout_circle:Yf,layout_heatmap:Xf,"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:Qf,layout_symbol:ey,layout_raster:ty,layout_hillshade:ry,filter:ny,filter_operator:iy,geometry_type:oy,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:ay,expression:sy,light:ly,terrain:uy,paint:cy,paint_fill:py,"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:fy,paint_circle:yy,paint_heatmap:my,paint_symbol:hy,paint_raster:dy,paint_hillshade:gy,paint_background:xy,transition:by,"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:vy},Py=["type","source","source-layer","minzoom","maxzoom","filter","layout"];var D=class{constructor(e,r,n,i){this.message=(e?"".concat(e,": "):"")+n,i&&(this.identifier=i),r!=null&&r.__line__&&(this.line=r.__line__)}};function sr(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}},Ca=class t{constructor(e,r=[]){this.parent=e,this.bindings={};for(let[n,i]of r)this.bindings[n]=i}concat(e){return new t(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error("".concat(e," not found in scope."))}has(e){return this.bindings[e]?!0:this.parent?this.parent.has(e):!1}},cr={kind:"null"},L={kind:"number"},G={kind:"string"},U={kind:"boolean"},ze={kind:"color"},or={kind:"object"},$={kind:"value"},Sy={kind:"error"},Fi={kind:"collator"},pr={kind:"formatted"},Mi={kind:"padding"},Xr={kind:"resolvedImage"},Li={kind:"variableAnchorOffsetCollection"};function Fe(t,e){return{kind:"array",itemType:t,N:e}}function ne(t){if(t.kind==="array"){let e=ne(t.itemType);return typeof t.N=="number"?"array<".concat(e,", ").concat(t.N,">"):t.itemType.kind==="value"?"array":"array<".concat(e,">")}else return t.kind}var wy=[cr,L,G,U,ze,pr,or,Fe($),Mi,Xr,Li];function Gr(t,e){if(e.kind==="error")return null;if(t.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!Gr(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 wy)if(!Gr(r,e))return null}}return"Expected ".concat(ne(t)," but found ").concat(ne(e)," instead.")}function Oa(t,e){return e.some(r=>r.kind===t.kind)}function qr(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 Nr(t,e){return t.kind==="array"&&e.kind==="array"?t.itemType.kind===e.itemType.kind&&typeof t.N=="number":t.kind===e.kind}var Dl=.96422,Vl=1,Bl=.82521,zl=4/29,ar=6/29,Rl=3*ar*ar,Ay=ar*ar*ar,_y=Math.PI/180,Iy=180/Math.PI;function Ol(t){return t=t%360,t<0&&(t+=360),t}function Nl([t,e,r,n]){t=va(t),e=va(e),r=va(r);let i,o,a=Pa((.2225045*t+.7168786*e+.0606169*r)/Vl);t===e&&e===r?i=o=a:(i=Pa((.4360747*t+.3850649*e+.1430804*r)/Dl),o=Pa((.0139322*t+.0971045*e+.7141733*r)/Bl));let s=116*a-16;return[s<0?0:s,500*(i-a),200*(a-o),n]}function va(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Pa(t){return t>Ay?Math.pow(t,1/3):t/Rl+zl}function Ul([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=Vl*wa(i),o=Dl*wa(o),a=Bl*wa(a),[Sa(3.1338561*o-1.6168667*i-.4906146*a),Sa(-.9787684*o+1.9161415*i+.033454*a),Sa(.0719453*o-.2289914*i+1.4052427*a),n]}function Sa(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 wa(t){return t>ar?t*t*t:Rl*(t-zl)}function Cy(t){let[e,r,n,i]=Nl(t),o=Math.sqrt(r*r+n*n);return[Math.round(o*1e4)?Ol(Math.atan2(n,r)*Iy):NaN,o,e,i]}function ky([t,e,r,n]){return t=isNaN(t)?0:t*_y,Ul([r,Math.cos(t)*e,Math.sin(t)*e,n])}function Ty([t,e,r,n]){t=Ol(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]}function Ey(t){if(t=t.toLowerCase().trim(),t==="transparent")return[0,0,0,0];let e=Fy[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[di(t.slice(a,a+=o)),di(t.slice(a,a+=o)),di(t.slice(a,a+=o)),di(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,d,h,g]=o,v=[u||" ",f||" ",d].join("");if(v===" "||v===" /"||v===",,"||v===",,,"){let b=[l,p,m].join(""),x=b==="%%%"?100:b===""?255:0;if(x){let P=[nr(+s/x,0,1),nr(+c/x,0,1),nr(+y/x,0,1),h?bl(+h,g):1];if(vl(P))return P}}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,nr(+s,0,100),nr(+u,0,100),p?bl(+p,f):1];if(vl(m))return Ty(m)}}}function di(t){return parseInt(t.padEnd(2,t),16)/255}function bl(t,e){return nr(e?t/100:t,0,1)}function nr(t,e,r){return Math.min(Math.max(e,t),r)}function vl(t){return!t.some(Number.isNaN)}var Fy={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]},W=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=Ey(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",Cy(this.rgb))}get lab(){return this.overwriteGetter("lab",Nl(this.rgb))}overwriteGetter(e,r){return Object.defineProperty(this,e,{value:r}),r}toString(){let[e,r,n,i]=this.rgb;return"rgba(".concat([e,r,n].map(o=>Math.round(o*255)).join(","),",").concat(i,")")}};W.black=new W(0,0,0,1);W.white=new W(1,1,1,1);W.transparent=new W(0,0,0,0);W.red=new W(1,0,0,1);var jr=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}},Zr=class{constructor(e,r,n,i,o){this.text=e,this.image=r,this.scale=n,this.fontStack=i,this.textColor=o}},Me=class t{constructor(e){this.sections=e}static fromString(e){return new t([new Zr(e,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("")}},je=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)}},My=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]),it=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"||!My.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)}},Ce=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}};function $l(t,e,r,n){if(!(typeof t=="number"&&t>=0&&t<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof r=="number"&&r>=0&&r<=255)){let i=typeof n=="number"?[t,e,r,n]:[t,e,r];return"Invalid rgba value [".concat(i.join(", "),"]: \'r\', \'g\', and \'b\' must be between 0 and 255.")}return typeof n>"u"||typeof n=="number"&&n>=0&&n<=1?null:"Invalid rgba value [".concat([t,e,r,n].join(", "),"]: \'a\' must be between 0 and 1.")}function vi(t){if(t===null||typeof t=="string"||typeof t=="boolean"||typeof t=="number"||t instanceof W||t instanceof jr||t instanceof Me||t instanceof je||t instanceof it||t instanceof Ce)return!0;if(Array.isArray(t)){for(let e of t)if(!vi(e))return!1;return!0}else if(typeof t=="object"){for(let e in t)if(!vi(t[e]))return!1;return!0}else return!1}function fe(t){if(t===null)return cr;if(typeof t=="string")return G;if(typeof t=="boolean")return U;if(typeof t=="number")return L;if(t instanceof W)return ze;if(t instanceof jr)return Fi;if(t instanceof Me)return pr;if(t instanceof je)return Mi;if(t instanceof it)return Li;if(t instanceof Ce)return Xr;if(Array.isArray(t)){let e=t.length,r;for(let n of t){let i=fe(n);if(!r)r=i;else{if(r===i)continue;r=$;break}}return Fe(r||$,e)}else return or}function Ur(t){let e=typeof t;return t===null?"":e==="string"||e==="number"||e==="boolean"?String(t):t instanceof W||t instanceof Me||t instanceof je||t instanceof it||t instanceof Ce?t.toString():JSON.stringify(t)}var mt=class t{constructor(e,r){this.type=e,this.value=r}static parse(e,r){if(e.length!==2)return r.error("\'literal\' expression requires exactly one argument, but found ".concat(e.length-1," instead."));if(!vi(e[1]))return r.error("invalid value");let n=e[1],i=fe(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}},oe=class{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}},gi={string:G,number:L,boolean:U,object:or},Ge=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 gi)||u==="object")return r.error(\'The item type argument of "array" must be one of string, number, boolean\',1);s=gi[u],n++}else s=$;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=Fe(s,l)}else{if(!gi[o])throw new Error("Types doesn\'t contain name = ".concat(o));i=gi[o]}let a=[];for(;n<e.length;n++){let s=r.parse(e[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(Gr(this.type,fe(n))){if(r===this.args.length-1)throw new oe("Expected value to be of type ".concat(ne(this.type),", but found ").concat(ne(fe(n))," instead."))}else return n}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},Pl={"to-boolean":U,"to-color":ze,"to-number":L,"to-string":G},ft=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(!Pl[n])throw new Error("Can\'t parse ".concat(n," as it is not part of the known types"));if((n==="to-boolean"||n==="to-string")&&e.length!==2)return r.error("Expected one argument.");let i=Pl[n],o=[];for(let a=1;a<e.length;a++){let s=r.parse(e[a],a,$);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 W)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 rbga value ".concat(JSON.stringify(r),": expected an array containing either three or four numeric values."):n=$l(r[0],r[1],r[2],r[3]),!n))return new W(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new oe(n||"Could not parse color from value \'".concat(typeof r=="string"?r:JSON.stringify(r),"\'"))}case"padding":{let r;for(let n of this.args){r=n.evaluate(e);let i=je.parse(r);if(i)return i}throw new oe("Could not parse padding from value \'".concat(typeof r=="string"?r:JSON.stringify(r),"\'"))}case"variableAnchorOffsetCollection":{let r;for(let n of this.args){r=n.evaluate(e);let i=it.parse(r);if(i)return i}throw new oe("Could not parse variableAnchorOffsetCollection from value \'".concat(typeof r=="string"?r:JSON.stringify(r),"\'"))}case"number":{let r=null;for(let n of this.args){if(r=n.evaluate(e),r===null)return 0;let i=Number(r);if(!isNaN(i))return i}throw new oe("Could not convert ".concat(JSON.stringify(r)," to number."))}case"formatted":return Me.fromString(Ur(this.args[0].evaluate(e)));case"resolvedImage":return Ce.fromString(Ur(this.args[0].evaluate(e)));default:return Ur(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},Ly=["Unknown","Point","LineString","Polygon"],Pi=class{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},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"?Ly[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[e];return r||(r=this._parseColorCache[e]=W.parse(e)),r}},Si=class t{constructor(e,r,n=[],i,o=new Ca,a=[]){this.registry=e,this.path=n,this.key=n.map(s=>"[".concat(s,"]")).join(""),this.scope=o,this.errors=a,this.expectedType=i,this._isConstant=r}parse(e,r,n,i,o={}){return r?this.concat(r,n,i)._parse(e,o):this._parse(e,o)}_parse(e,r){(e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number")&&(e=["literal",e]);function n(i,o,a){return a==="assert"?new Ge(o,[i]):a==="coerce"?new ft(o,[i]):i}if(Array.isArray(e)){if(e.length===0)return this.error(\'Expected an array with at least one element. If you wanted a literal array, use ["literal", []].\');let i=e[0];if(typeof i!="string")return this.error("Expression name must be a string, but found ".concat(typeof i,\' instead. If you wanted a literal array, use ["literal", [...]].\'),0),null;let o=this.registry[i];if(o){let a=o.parse(e,this);if(!a)return null;if(this.expectedType){let s=this.expectedType,l=a.type;if((s.kind==="string"||s.kind==="number"||s.kind==="boolean"||s.kind==="object"||s.kind==="array")&&l.kind==="value")a=n(a,s,r.typeAnnotation||"assert");else if((s.kind==="color"||s.kind==="formatted"||s.kind==="resolvedImage")&&(l.kind==="value"||l.kind==="string"))a=n(a,s,r.typeAnnotation||"coerce");else if(s.kind==="padding"&&(l.kind==="value"||l.kind==="number"||l.kind==="array"))a=n(a,s,r.typeAnnotation||"coerce");else if(s.kind==="variableAnchorOffsetCollection"&&(l.kind==="value"||l.kind==="array"))a=n(a,s,r.typeAnnotation||"coerce");else if(this.checkSubtype(s,l))return null}if(!(a instanceof mt)&&a.type.kind!=="resolvedImage"&&this._isConstant(a)){let s=new Pi;try{a=new mt(a.type,a.evaluate(s))}catch(l){return this.error(l.message),null}}return a}return this.error(\'Unknown expression "\'.concat(i,\'". If you wanted a literal array, use ["literal", [...]].\'),0)}else return typeof e>"u"?this.error("\'undefined\' value invalid. Use null instead."):typeof e=="object"?this.error(\'Bare objects invalid. Use ["literal", {...}] instead.\'):this.error("Expected an array, but found ".concat(typeof e," instead."))}concat(e,r,n){let i=typeof e=="number"?this.path.concat(e):this.path,o=n?this.scope.concat(n):this.scope;return new t(this.registry,this._isConstant,i,r||null,o,this.errors)}error(e,...r){let n="".concat(this.key).concat(r.map(i=>"[".concat(i,"]")).join(""));this.errors.push(new Ve(n,e))}checkSubtype(e,r){let n=Gr(e,r);return n&&this.error(n),n}},wi=class t{constructor(e,r,n){this.type=Fi,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,G),!a)?null:new t(i,o,a)}evaluate(e){return new jr(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}},yt=8192;function Na(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 Dy(t){return(180+t)/360}function Vy(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function Ai(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function By(t,e){let r=Dy(t[0]),n=Vy(t[1]),i=Math.pow(2,e.z);return[Math.round(r*i*yt),Math.round(n*i*yt)]}function zy(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 Ry(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 Ua(t,e){let r=!1;for(let n=0,i=e.length;n<i;n++){let o=e[n];for(let a=0,s=o.length;a<s-1;a++){if(zy(t,o[a],o[a+1]))return!1;Ry(t,o[a],o[a+1])&&(r=!r)}}return r}function Oy(t,e){for(let r=0;r<e.length;r++)if(Ua(t,e[r]))return!0;return!1}function Ny(t,e){return t[0]*e[1]-t[1]*e[0]}function Sl(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 Uy(t,e,r,n){let i=[e[0]-t[0],e[1]-t[1]],o=[n[0]-r[0],n[1]-r[1]];return Ny(o,i)===0?!1:!!(Sl(t,e,r,n)&&Sl(r,n,t,e))}function $y(t,e,r){for(let n of r)for(let i=0;i<n.length-1;++i)if(Uy(t,e,n[i],n[i+1]))return!0;return!1}function Gl(t,e){for(let r=0;r<t.length;++r)if(!Ua(t[r],e))return!1;for(let r=0;r<t.length-1;++r)if($y(t[r],t[r+1],e))return!1;return!0}function Gy(t,e){for(let r=0;r<e.length;r++)if(Gl(t,e[r]))return!0;return!1}function $a(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=By(t[i][a],r);Na(e,s),o.push(s)}n.push(o)}return n}function ql(t,e,r){let n=[];for(let i=0;i<t.length;i++){let o=$a(t[i],e,r);n.push(o)}return n}function jl(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}Na(e,t)}function qy(t){t[0]=t[1]=1/0,t[2]=t[3]=-1/0}function wl(t,e,r,n){let i=Math.pow(2,n.z)*yt,o=[n.x*yt,n.y*yt],a=[];for(let s of t)for(let l of s){let u=[l.x+o[0],l.y+o[1]];jl(u,e,r,i),a.push(u)}return a}function Al(t,e,r,n){let i=Math.pow(2,n.z)*yt,o=[n.x*yt,n.y*yt],a=[];for(let s of t){let l=[];for(let u of s){let c=[u.x+o[0],u.y+o[1]];Na(e,c),l.push(c)}a.push(l)}if(e[2]-e[0]<=i/2){qy(e);for(let s of a)for(let l of s)jl(l,e,r,i)}return a}function jy(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=$a(e.coordinates,n,i),a=wl(t.geometry(),r,n,i);if(!Ai(r,n))return!1;for(let s of a)if(!Ua(s,o))return!1}if(e.type==="MultiPolygon"){let o=ql(e.coordinates,n,i),a=wl(t.geometry(),r,n,i);if(!Ai(r,n))return!1;for(let s of a)if(!Oy(s,o))return!1}return!0}function Zy(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=$a(e.coordinates,n,i),a=Al(t.geometry(),r,n,i);if(!Ai(r,n))return!1;for(let s of a)if(!Gl(s,o))return!1}if(e.type==="MultiPolygon"){let o=ql(e.coordinates,n,i),a=Al(t.geometry(),r,n,i);if(!Ai(r,n))return!1;for(let s of a)if(!Gy(s,o))return!1}return!0}var Jr=class t{constructor(e,r){this.type=U,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error("\'within\' expression requires exactly one argument, but found ".concat(e.length-1," instead."));if(vi(e[1])){let n=e[1];if(n.type==="FeatureCollection")for(let i=0;i<n.features.length;++i){let o=n.features[i].geometry.type;if(o==="Polygon"||o==="MultiPolygon")return new t(n,n.features[i].geometry)}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 jy(e,this.geometries);if(e.geometryType()==="LineString")return Zy(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}},_i=class t{constructor(e,r){this.type=r.type,this.name=e,this.boundExpression=r}static parse(e,r){if(e.length!==2||typeof e[1]!="string")return r.error("\'var\' expression requires exactly one string literal argument.");let n=e[1];return r.scope.has(n)?new t(n,r.scope.get(n)):r.error(\'Unknown variable "\'.concat(n,\'". Make sure "\').concat(n,\'" has been bound in an enclosing "let" expression before using it.\'),1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}},Ye=class t{constructor(e,r,n,i){this.name=e,this.type=r,this._evaluate=n,this.args=i}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,r){let n=e[0],i=t.definitions[n];if(!i)return r.error(\'Unknown expression "\'.concat(n,\'". If you wanted a literal array, use ["literal", [...]].\'),0);let o=Array.isArray(i)?i[0]:i.type,a=Array.isArray(i)?[[i[1],i[2]]]:i.overloads,s=a.filter(([u])=>!Array.isArray(u)||u.length===e.length-1),l=null;for(let[u,c]of s){l=new Si(r.registry,Ii,r.path,null,r.scope);let p=[],f=!1;for(let y=1;y<e.length;y++){let m=e[y],d=Array.isArray(u)?u[y-1]:u.type,h=l.parse(m,1+p.length,d);if(!h){f=!0;break}p.push(h)}if(!f){if(Array.isArray(u)&&u.length!==p.length){l.error("Expected ".concat(u.length," arguments, but found ").concat(p.length," instead."));continue}for(let y=0;y<p.length;y++){let m=Array.isArray(u)?u[y]:u.type,d=p[y];l.concat(y+1).checkSubtype(m,d.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])=>Jy(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(ne(y.type))}r.error("Expected arguments of type ".concat(c,", but found (").concat(p.join(", "),") instead."))}return null}static register(e,r){t.definitions=r;for(let n in r)e[n]=t}};function Jy(t){return Array.isArray(t)?"(".concat(t.map(ne).join(", "),")"):"(".concat(ne(t.type),"...)")}function Ii(t){if(t instanceof _i)return Ii(t.boundExpression);if(t instanceof Ye&&t.name==="error")return!1;if(t instanceof wi)return!1;if(t instanceof Jr)return!1;let e=t instanceof ft||t instanceof Ge,r=!0;return t.eachChild(n=>{e?r=r&&Ii(n):r=r&&n instanceof mt}),r?Di(t)&&Vi(t,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"]):!1}function Di(t){if(t instanceof Ye){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 Jr)return!1;let e=!0;return t.eachChild(r=>{e&&!Di(r)&&(e=!1)}),e}function Wr(t){if(t instanceof Ye&&t.name==="feature-state")return!1;let e=!0;return t.eachChild(r=>{e&&!Wr(r)&&(e=!1)}),e}function Vi(t,e){if(t instanceof Ye&&e.indexOf(t.name)>=0)return!1;let r=!0;return t.eachChild(n=>{r&&!Vi(n,e)&&(r=!1)}),r}function Bi(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 oe("Input is not a number.");return 0}var lr=class t{constructor(e,r,n){this.type=e,this.input=r,this.labels=[],this.outputs=[];for(let[i,o]of n)this.labels.push(i),this.outputs.push(o)}static parse(e,r){if(e.length-1<4)return r.error("Expected at least 4 arguments, but found only ".concat(e.length-1,"."));if((e.length-1)%2!==0)return r.error("Expected an even number of arguments.");let n=r.parse(e[1],1,L);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=Bi(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 Wy(t){return t==="rgb"||t==="hcl"||t==="lab"}function Lt(t,e,r){return t+r*(e-t)}function Hy(t,e,r,n="rgb"){switch(n){case"rgb":{let[i,o,a,s]=Ci(t.rgb,e.rgb,r);return new W(i,o,a,s,!1)}case"hcl":{let[i,o,a,s]=t.hcl,[l,u,c,p]=e.hcl,f,y;if(!isNaN(i)&&!isNaN(l)){let v=l-i;l>i&&v>180?v-=360:l<i&&i-l>180&&(v+=360),f=i+r*v}else isNaN(i)?isNaN(l)?f=NaN:(f=l,(a===1||a===0)&&(y=u)):(f=i,(c===1||c===0)&&(y=o));let[m,d,h,g]=ky([f,y!=null?y:Lt(o,u,r),Lt(a,c,r),Lt(s,p,r)]);return new W(m,d,h,g,!1)}case"lab":{let[i,o,a,s]=Ul(Ci(t.lab,e.lab,r));return new W(i,o,a,s,!1)}}}function Ci(t,e,r){return t.map((n,i)=>Lt(n,e[i],r))}function Ky(t,e,r){return new je(Ci(t.values,e.values,r))}function Yy(t,e,r){let n=t.values,i=e.values;if(n.length!==i.length)throw new oe("Cannot interpolate values of different length. from: ".concat(t.toString(),", to: ").concat(e.toString()));let o=[];for(let a=0;a<n.length;a+=2){if(n[a]!==i[a])throw new oe("Cannot interpolate values containing mismatched anchors. from[".concat(a,"]: ").concat(n[a],", to[").concat(a,"]: ").concat(i[a]));o.push(n[a]);let[s,l]=n[a+1],[u,c]=i[a+1];o.push([Lt(s,u,r),Lt(l,c,r)])}return new it(o)}var Re={number:Lt,color:Hy,array:Ci,padding:Ky,variableAnchorOffsetCollection:Yy},qe=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=Aa(r,e.base,n,i);else if(e.name==="linear")o=Aa(r,1,n,i);else if(e.name==="cubic-bezier"){let a=e.controlPoints;o=new Ll.default(a[0],a[1],a[2],a[3]).solve(Aa(r,1,n,i))}return o}static parse(e,r){let[n,i,o,...a]=e;if(!Array.isArray(i)||i.length===0)return r.error("Expected an interpolation type expression.",1);if(i[0]==="linear")i={name:"linear"};else if(i[0]==="exponential"){let u=i[1];if(typeof u!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);i={name:"exponential",base:u}}else if(i[0]==="cubic-bezier"){let u=i.slice(1);if(u.length!==4||u.some(c=>typeof c!="number"||c<0||c>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);i={name:"cubic-bezier",controlPoints:u}}else return r.error("Unknown interpolation type ".concat(String(i[0])),1,0);if(e.length-1<4)return r.error("Expected at least 4 arguments, but found only ".concat(e.length-1,"."));if((e.length-1)%2!==0)return r.error("Expected an even number of arguments.");if(o=r.parse(o,2,L),!o)return null;let s=[],l=null;n==="interpolate-hcl"||n==="interpolate-lab"?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!Nr(l,L)&&!Nr(l,ze)&&!Nr(l,Mi)&&!Nr(l,Li)&&!Nr(l,Fe(L))?r.error("Type ".concat(ne(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=Bi(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":return Re[this.type.kind](c,p,u);case"interpolate-hcl":return Re.color(c,p,u,"hcl");case"interpolate-lab":return Re.color(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 Aa(t,e,r,n){let i=n-r,o=t-r;return i===0?0:e===1?o/i:(Math.pow(e,o)-1)/(Math.pow(e,i)-1)}var ki=class t{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expectected 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=>Gr(i,s.type))?new t($,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 Ce&&!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())}},Ti=class t{constructor(e,r){this.type=r.type,this.bindings=[].concat(e),this.result=r}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(let r of this.bindings)e(r[1]);e(this.result)}static parse(e,r){if(e.length<4)return r.error("Expected at least 3 arguments, but found ".concat(e.length-1," instead."));let n=[];for(let o=1;o<e.length-1;o+=2){let a=e[o];if(typeof a!="string")return r.error("Expected string, but found ".concat(typeof a," instead."),o);if(/[^a-zA-Z0-9_]/.test(a))return r.error("Variable names must contain only alphanumeric characters or \'_\'.",o);let s=r.parse(e[o+1],o+1);if(!s)return null;n.push([a,s])}let i=r.parse(e[e.length-1],e.length-1,r.expectedType,n);return i?new t(n,i):null}outputDefined(){return this.result.outputDefined()}},ka=class t{constructor(e,r,n){this.type=e,this.index=r,this.input=n}static parse(e,r){if(e.length!==3)return r.error("Expected 2 arguments, but found ".concat(e.length-1," instead."));let n=r.parse(e[1],1,L),i=r.parse(e[2],2,Fe(r.expectedType||$));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 oe("Array index out of bounds: ".concat(r," < 0."));if(r>=n.length)throw new oe("Array index out of bounds: ".concat(r," > ").concat(n.length-1,"."));if(r!==Math.floor(r))throw new oe("Array index must be an integer, but found ".concat(r," instead."));return n[r]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}},Ta=class t{constructor(e,r){this.type=U,this.needle=e,this.haystack=r}static parse(e,r){if(e.length!==3)return r.error("Expected 2 arguments, but found ".concat(e.length-1," instead."));let n=r.parse(e[1],1,$),i=r.parse(e[2],2,$);return!n||!i?null:Oa(n.type,[U,G,L,cr,$])?new t(n,i):r.error("Expected first argument to be of type boolean, string, number or null, but found ".concat(ne(n.type)," instead"))}evaluate(e){let r=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!n)return!1;if(!qr(r,["boolean","string","number","null"]))throw new oe("Expected first argument to be of type boolean, string, number or null, but found ".concat(ne(fe(r))," instead."));if(!qr(n,["string","array"]))throw new oe("Expected second argument to be of type array or string, but found ".concat(ne(fe(n))," instead."));return n.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}},Ea=class t{constructor(e,r,n){this.type=L,this.needle=e,this.haystack=r,this.fromIndex=n}static parse(e,r){if(e.length<=2||e.length>=5)return r.error("Expected 3 or 4 arguments, but found ".concat(e.length-1," instead."));let n=r.parse(e[1],1,$),i=r.parse(e[2],2,$);if(!n||!i)return null;if(!Oa(n.type,[U,G,L,cr,$]))return r.error("Expected first argument to be of type boolean, string, number or null, but found ".concat(ne(n.type)," instead"));if(e.length===4){let o=r.parse(e[3],3,L);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(!qr(r,["boolean","string","number","null"]))throw new oe("Expected first argument to be of type boolean, string, number or null, but found ".concat(ne(fe(r))," instead."));if(!qr(n,["string","array"]))throw new oe("Expected second argument to be of type array or string, but found ".concat(ne(fe(n))," instead."));if(this.fromIndex){let i=this.fromIndex.evaluate(e);return n.indexOf(r,i)}return n.indexOf(r)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}},Fa=class t{constructor(e,r,n,i,o,a){this.inputType=e,this.type=r,this.input=n,this.cases=i,this.outputs=o,this.otherwise=a}static parse(e,r){if(e.length<5)return r.error("Expected at least 4 arguments, but found only ".concat(e.length-1,"."));if(e.length%2!==1)return r.error("Expected an even number of arguments.");let n,i;r.expectedType&&r.expectedType.kind!=="value"&&(i=r.expectedType);let o={},a=[];for(let u=2;u<e.length-1;u+=2){let c=e[u],p=e[u+1];Array.isArray(c)||(c=[c]);let f=r.concat(u);if(c.length===0)return f.error("Expected at least one branch label.");for(let m of c){if(typeof m!="number"&&typeof m!="string")return f.error("Branch labels must be numbers or strings.");if(typeof m=="number"&&Math.abs(m)>Number.MAX_SAFE_INTEGER)return f.error("Branch labels must be integers no larger than ".concat(Number.MAX_SAFE_INTEGER,"."));if(typeof m=="number"&&Math.floor(m)!==m)return f.error("Numeric branch labels must be integer values.");if(!n)n=fe(m);else if(f.checkSubtype(n,fe(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,$);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(fe(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()}},Ma=class t{constructor(e,r,n){this.type=e,this.branches=r,this.otherwise=n}static parse(e,r){if(e.length<4)return r.error("Expected at least 3 arguments, but found only ".concat(e.length-1,"."));if(e.length%2!==0)return r.error("Expected an odd number of arguments.");let n;r.expectedType&&r.expectedType.kind!=="value"&&(n=r.expectedType);let i=[];for(let a=1;a<e.length-1;a+=2){let s=r.parse(e[a],a,U);if(!s)return null;let l=r.parse(e[a+1],a+1,n);if(!l)return null;i.push([s,l]),n=n||l.type}let o=r.parse(e[e.length-1],e.length-1,n);if(!o)return null;if(!n)throw new Error("Can\'t infer output type");return new t(n,i,o)}evaluate(e){for(let[r,n]of this.branches)if(r.evaluate(e))return n.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(let[r,n]of this.branches)e(r),e(n);e(this.otherwise)}outputDefined(){return this.branches.every(([e,r])=>r.outputDefined())&&this.otherwise.outputDefined()}},La=class t{constructor(e,r,n,i){this.type=e,this.input=r,this.beginIndex=n,this.endIndex=i}static parse(e,r){if(e.length<=2||e.length>=5)return r.error("Expected 3 or 4 arguments, but found ".concat(e.length-1," instead."));let n=r.parse(e[1],1,$),i=r.parse(e[2],2,L);if(!n||!i)return null;if(!Oa(n.type,[Fe($),G,$]))return r.error("Expected first argument to be of type array or string, but found ".concat(ne(n.type)," instead"));if(e.length===4){let o=r.parse(e[3],3,L);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);if(!qr(r,["string","array"]))throw new oe("Expected first argument to be of type array or string, but found ".concat(ne(fe(r))," instead."));if(this.endIndex){let i=this.endIndex.evaluate(e);return r.slice(n,i)}return r.slice(n)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}};function _l(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 Xy(t,e,r){return e===r}function Qy(t,e,r){return e!==r}function em(t,e,r){return e<r}function tm(t,e,r){return e>r}function rm(t,e,r){return e<=r}function nm(t,e,r){return e>=r}function Zl(t,e,r,n){return n.compare(e,r)===0}function im(t,e,r,n){return!Zl(t,e,r,n)}function om(t,e,r,n){return n.compare(e,r)<0}function am(t,e,r,n){return n.compare(e,r)>0}function sm(t,e,r,n){return n.compare(e,r)<=0}function lm(t,e,r,n){return n.compare(e,r)>=0}function fr(t,e,r){let n=t!=="=="&&t!=="!=";return class Jl{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,$);if(!l)return null;if(!_l(s,l.type))return a.concat(1).error(\'"\'.concat(s,"\\" comparisons are not supported for type \'").concat(ne(l.type),"\'."));let u=a.parse(o[2],2,$);if(!u)return null;if(!_l(s,u.type))return a.concat(2).error(\'"\'.concat(s,"\\" comparisons are not supported for type \'").concat(ne(u.type),"\'."));if(l.type.kind!==u.type.kind&&l.type.kind!=="value"&&u.type.kind!=="value")return a.error("Cannot compare types \'".concat(ne(l.type),"\' and \'").concat(ne(u.type),"\'."));n&&(l.type.kind==="value"&&u.type.kind!=="value"?l=new Ge(u.type,[l]):l.type.kind!=="value"&&u.type.kind==="value"&&(u=new Ge(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,Fi),!c)return null}return new Jl(l,u,c)}evaluate(o){let a=this.lhs.evaluate(o),s=this.rhs.evaluate(o);if(n&&this.hasUntypedArgument){let l=fe(a),u=fe(s);if(l.kind!==u.kind||!(l.kind==="string"||l.kind==="number"))throw new oe(\'Expected arguments for "\'.concat(t,\'" to be (string, string) or (number, number), but found (\').concat(l.kind,", ").concat(u.kind,") instead."))}if(this.collator&&!n&&this.hasUntypedArgument){let l=fe(a),u=fe(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 um=fr("==",Xy,Zl),cm=fr("!=",Qy,im),pm=fr("<",em,om),fm=fr(">",tm,am),ym=fr("<=",rm,sm),mm=fr(">=",nm,lm),Da=class t{constructor(e,r,n,i,o){this.type=G,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,L);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,G),!o))return null;let a=null;if(i.currency&&(a=r.parse(i.currency,1,G),!a))return null;let s=null;if(i["min-fraction-digits"]&&(s=r.parse(i["min-fraction-digits"],1,L),!s))return null;let l=null;return i["max-fraction-digits"]&&(l=r.parse(i["max-fraction-digits"],1,L),!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}},Hr=class t{constructor(e){this.type=pr,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,L),!l))return null;let u=null;if(s["text-font"]&&(u=r.parse(s["text-font"],1,Fe(G)),!u))return null;let c=null;if(s["text-color"]&&(c=r.parse(s["text-color"],1,ze),!c))return null;let p=i[i.length-1];p.scale=l,p.font=u,p.textColor=c}else{let l=r.parse(e[a],1,$);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})}}return new t(i)}evaluate(e){let r=n=>{let i=n.content.evaluate(e);return fe(i)===Xr?new Zr("",i,null,null,null):new Zr(Ur(i),null,n.scale?n.scale.evaluate(e):null,n.font?n.font.evaluate(e).join(","):null,n.textColor?n.textColor.evaluate(e):null)};return new Me(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)}outputDefined(){return!1}},Va=class t{constructor(e){this.type=Xr,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");let n=r.parse(e[1],1,G);return n?new t(n):r.error("No image name provided.")}evaluate(e){let r=this.input.evaluate(e),n=Ce.fromString(r);return n&&e.availableImages&&(n.available=e.availableImages.indexOf(r)>-1),n}eachChild(e){e(this.input)}outputDefined(){return!1}},Ba=class t{constructor(e){this.type=L,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected 1 argument, but found ".concat(e.length-1," instead."));let n=r.parse(e[1],1);return n?n.type.kind!=="array"&&n.type.kind!=="string"&&n.type.kind!=="value"?r.error("Expected argument of type string or array, but found ".concat(ne(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 oe("Expected value to be of type string or array, but found ".concat(ne(fe(r))," instead."))}eachChild(e){e(this.input)}outputDefined(){return!1}},zt={"==":um,"!=":cm,">":fm,"<":pm,">=":mm,"<=":ym,array:Ge,at:ka,boolean:Ge,case:Ma,coalesce:ki,collator:wi,format:Hr,image:Va,in:Ta,"index-of":Ea,interpolate:qe,"interpolate-hcl":qe,"interpolate-lab":qe,length:Ba,let:Ti,literal:mt,match:Fa,number:Ge,"number-format":Da,object:Ge,slice:La,step:lr,string:Ge,"to-boolean":ft,"to-color":ft,"to-number":ft,"to-string":ft,var:_i,within:Jr};function Il(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=$l(e,r,n,o);if(a)throw new oe(a);return new W(e/255,r/255,n/255,o,!1)}function Cl(t,e){return t in e}function _a(t,e){let r=e[t];return typeof r>"u"?null:r}function hm(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 Mt(t){return{type:t}}Ye.register(zt,{error:[Sy,[G],(t,[e])=>{throw new oe(e.evaluate(t))}],typeof:[G,[$],(t,[e])=>ne(fe(e.evaluate(t)))],"to-rgba":[Fe(L,4),[ze],(t,[e])=>{let[r,n,i,o]=e.evaluate(t).rgb;return[r*255,n*255,i*255,o]}],rgb:[ze,[L,L,L],Il],rgba:[ze,[L,L,L,L],Il],has:{type:U,overloads:[[[G],(t,[e])=>Cl(e.evaluate(t),t.properties())],[[G,or],(t,[e,r])=>Cl(e.evaluate(t),r.evaluate(t))]]},get:{type:$,overloads:[[[G],(t,[e])=>_a(e.evaluate(t),t.properties())],[[G,or],(t,[e,r])=>_a(e.evaluate(t),r.evaluate(t))]]},"feature-state":[$,[G],(t,[e])=>_a(e.evaluate(t),t.featureState||{})],properties:[or,[],t=>t.properties()],"geometry-type":[G,[],t=>t.geometryType()],id:[$,[],t=>t.id()],zoom:[L,[],t=>t.globals.zoom],"heatmap-density":[L,[],t=>t.globals.heatmapDensity||0],"line-progress":[L,[],t=>t.globals.lineProgress||0],accumulated:[$,[],t=>t.globals.accumulated===void 0?null:t.globals.accumulated],"+":[L,Mt(L),(t,e)=>{let r=0;for(let n of e)r+=n.evaluate(t);return r}],"*":[L,Mt(L),(t,e)=>{let r=1;for(let n of e)r*=n.evaluate(t);return r}],"-":{type:L,overloads:[[[L,L],(t,[e,r])=>e.evaluate(t)-r.evaluate(t)],[[L],(t,[e])=>-e.evaluate(t)]]},"/":[L,[L,L],(t,[e,r])=>e.evaluate(t)/r.evaluate(t)],"%":[L,[L,L],(t,[e,r])=>e.evaluate(t)%r.evaluate(t)],ln2:[L,[],()=>Math.LN2],pi:[L,[],()=>Math.PI],e:[L,[],()=>Math.E],"^":[L,[L,L],(t,[e,r])=>Math.pow(e.evaluate(t),r.evaluate(t))],sqrt:[L,[L],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[L,[L],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[L,[L],(t,[e])=>Math.log(e.evaluate(t))],log2:[L,[L],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[L,[L],(t,[e])=>Math.sin(e.evaluate(t))],cos:[L,[L],(t,[e])=>Math.cos(e.evaluate(t))],tan:[L,[L],(t,[e])=>Math.tan(e.evaluate(t))],asin:[L,[L],(t,[e])=>Math.asin(e.evaluate(t))],acos:[L,[L],(t,[e])=>Math.acos(e.evaluate(t))],atan:[L,[L],(t,[e])=>Math.atan(e.evaluate(t))],min:[L,Mt(L),(t,e)=>Math.min(...e.map(r=>r.evaluate(t)))],max:[L,Mt(L),(t,e)=>Math.max(...e.map(r=>r.evaluate(t)))],abs:[L,[L],(t,[e])=>Math.abs(e.evaluate(t))],round:[L,[L],(t,[e])=>{let r=e.evaluate(t);return r<0?-Math.round(-r):Math.round(r)}],floor:[L,[L],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[L,[L],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[U,[G,$],(t,[e,r])=>t.properties()[e.value]===r.value],"filter-id-==":[U,[$],(t,[e])=>t.id()===e.value],"filter-type-==":[U,[G],(t,[e])=>t.geometryType()===e.value],"filter-<":[U,[G,$],(t,[e,r])=>{let n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n<i}],"filter-id-<":[U,[$],(t,[e])=>{let r=t.id(),n=e.value;return typeof r==typeof n&&r<n}],"filter->":[U,[G,$],(t,[e,r])=>{let n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>i}],"filter-id->":[U,[$],(t,[e])=>{let r=t.id(),n=e.value;return typeof r==typeof n&&r>n}],"filter-<=":[U,[G,$],(t,[e,r])=>{let n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n<=i}],"filter-id-<=":[U,[$],(t,[e])=>{let r=t.id(),n=e.value;return typeof r==typeof n&&r<=n}],"filter->=":[U,[G,$],(t,[e,r])=>{let n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>=i}],"filter-id->=":[U,[$],(t,[e])=>{let r=t.id(),n=e.value;return typeof r==typeof n&&r>=n}],"filter-has":[U,[$],(t,[e])=>e.value in t.properties()],"filter-has-id":[U,[],t=>t.id()!==null&&t.id()!==void 0],"filter-type-in":[U,[Fe(G)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[U,[Fe($)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[U,[G,Fe($)],(t,[e,r])=>r.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[U,[G,Fe($)],(t,[e,r])=>hm(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)],[Mt(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)],[Mt(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,[G],(t,[e])=>{let r=t.globals&&t.globals.isSupportedScript;return r?r(e.evaluate(t)):!0}],upcase:[G,[G],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[G,[G],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[G,Mt($),(t,e)=>e.map(r=>Ur(r.evaluate(t))).join("")],"resolved-locale":[G,[Fi],(t,[e])=>e.evaluate(t).resolvedLocale()]});function za(t){return{result:"success",value:t}}function ir(t){return{result:"error",value:t}}function ht(t){return t["property-type"]==="data-driven"||t["property-type"]==="cross-faded-data-driven"}function Wl(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function Ga(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 zi(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function dm(t){return t}function Hl(t,e){let r=e.type==="color",n=t.stops&&typeof t.stops[0][0]=="object",i=n||t.property!==void 0,o=n||!i,a=t.type||(Ga(e)?"exponential":"interval");if(r||e.type==="padding"){let c=r?W.parse:je.parse;t=sr({},t),t.stops&&(t.stops=t.stops.map(p=>[p[0],c(p[1])])),t.default?t.default=c(t.default):t.default=c(e.default)}if(t.colorSpace&&!Wy(t.colorSpace))throw new Error(\'Unknown color space: "\'.concat(t.colorSpace,\'"\'));let s,l,u;if(a==="exponential")s=kl;else if(a==="interval")s=xm;else if(a==="categorical"){s=gm,l=Object.create(null);for(let c of t.stops)l[c[0]]=c[1];u=typeof t.stops[0][0]}else if(a==="identity")s=bm;else throw new Error(\'Unknown function type "\'.concat(a,\'"\'));if(n){let c={},p=[];for(let m=0;m<t.stops.length;m++){let d=t.stops[m],h=d[0].zoom;c[h]===void 0&&(c[h]={zoom:h,type:t.type,property:t.property,default:t.default,stops:[]},p.push(h)),c[h].stops.push([d[0].value,d[1]])}let f=[];for(let m of p)f.push([c[m].zoom,Hl(c[m],e)]);let y={name:"linear"};return{kind:"composite",interpolationType:y,interpolationFactor:qe.interpolationFactor.bind(void 0,y),zoomStops:f.map(m=>m[0]),evaluate({zoom:m},d){return kl({stops:f,base:t.base},e,m).evaluate(m,d)}}}else if(o){let c=a==="exponential"?{name:"exponential",base:t.base!==void 0?t.base:1}:null;return{kind:"camera",interpolationType:c,interpolationFactor:qe.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?Qr(t.default,e.default):s(t,e,f,l,u)}}}function Qr(t,e,r){if(t!==void 0)return t;if(e!==void 0)return e;if(r!==void 0)return r}function gm(t,e,r,n,i){let o=typeof r===i?n[r]:void 0;return Qr(o,t.default,e.default)}function xm(t,e,r){if(j(r)!=="number")return Qr(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=Bi(t.stops.map(o=>o[0]),r);return t.stops[i][1]}function kl(t,e,r){let n=t.base!==void 0?t.base:1;if(j(r)!=="number")return Qr(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=Bi(t.stops.map(c=>c[0]),r),a=vm(r,n,t.stops[o][0],t.stops[o+1][0]),s=t.stops[o][1],l=t.stops[o+1][1],u=Re[e.type]||dm;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 bm(t,e,r){switch(e.type){case"color":r=W.parse(r);break;case"formatted":r=Me.fromString(r.toString());break;case"resolvedImage":r=Ce.fromString(r.toString());break;case"padding":r=je.parse(r);break;default:j(r)!==e.type&&(e.type!=="enum"||!e.values[r])&&(r=void 0)}return Qr(r,t.default,e.default)}function vm(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 Dt=class{constructor(e,r){this.expression=e,this._warningHistory={},this._evaluator=new Pi,this._defaultValue=r?Sm(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 oe("Expected value to be one of ".concat(Object.keys(this._enumValues).map(l=>JSON.stringify(l)).join(", "),", but found ").concat(JSON.stringify(s)," instead."));return s}catch(s){return this._warningHistory[s.message]||(this._warningHistory[s.message]=!0,typeof console<"u"&&console.warn(s.message)),this._defaultValue}}};function en(t){return Array.isArray(t)&&t.length>0&&typeof t[0]=="string"&&t[0]in zt}function Rt(t,e){let r=new Si(zt,Ii,[],e?Pm(e):void 0),n=r.parse(t,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return n?za(new Dt(n,e)):ir(r.errors)}var dt=class{constructor(e,r){this.kind=e,this._styleExpression=r,this.isStateDependent=e!=="constant"&&!Wr(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)}},gt=class{constructor(e,r,n,i){this.kind=e,this.zoomStops=n,this._styleExpression=r,this.isStateDependent=e!=="camera"&&!Wr(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?qe.interpolationFactor(this.interpolationType,e,r,n):0}};function Kl(t,e){let r=Rt(t,e);if(r.result==="error")return r;let n=r.value.expression,i=Di(n);if(!i&&!ht(e))return ir([new Ve("","data expressions not supported")]);let o=Vi(n,["zoom"]);if(!o&&!Wl(e))return ir([new Ve("","zoom expressions not supported")]);let a=bi(n);if(!a&&!o)return ir([new Ve("",\'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.\')]);if(a instanceof Ve)return ir([a]);if(a instanceof qe&&!Ga(e))return ir([new Ve("",\'"interpolate" expressions cannot be used with this property\')]);if(!a)return za(i?new dt("constant",r.value):new dt("source",r.value));let s=a instanceof qe?a.interpolation:void 0;return za(i?new gt("camera",r.value,a.labels,s):new gt("composite",r.value,a.labels,s))}var Kr=class t{constructor(e,r){this._parameters=e,this._specification=r,sr(this,Hl(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 Yl(t,e){if(zi(t))return new Kr(t,e);if(en(t)){let r=Kl(t,e);if(r.result==="error")throw new Error(r.value.map(n=>"".concat(n.key,": ").concat(n.message)).join(", "));return r.value}else{let r=t;return e.type==="color"&&typeof t=="string"?r=W.parse(t):e.type==="padding"&&(typeof t=="number"||Array.isArray(t))?r=je.parse(t):e.type==="variableAnchorOffsetCollection"&&Array.isArray(t)&&(r=it.parse(t)),{kind:"constant",evaluate:()=>r}}}function bi(t){let e=null;if(t instanceof Ti)e=bi(t.result);else if(t instanceof ki){for(let r of t.args)if(e=bi(r),e)break}else(t instanceof lr||t instanceof qe)&&t.input instanceof Ye&&t.input.name==="zoom"&&(e=t);return e instanceof Ve||t.eachChild(r=>{let n=bi(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 Pm(t){let e={color:ze,string:G,number:L,enum:G,boolean:U,formatted:pr,padding:Mi,resolvedImage:Xr,variableAnchorOffsetCollection:Li};return t.type==="array"?Fe(e[t.value]||$,t.length):e[t.type]}function Sm(t){return t.type==="color"&&zi(t.default)?new W(0,0,0,0):t.type==="color"?W.parse(t.default)||null:t.type==="padding"?je.parse(t.default)||null:t.type==="variableAnchorOffsetCollection"?it.parse(t.default)||null:t.default===void 0?null:t.default}function qa(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(!qa(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}var wm={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function tn(t){if(t==null)return{filter:()=>!0,needGeometry:!1};qa(t)||(t=Ei(t));let e=Rt(t,wm);if(e.result==="error")throw new Error(e.value.map(r=>"".concat(r.key,": ").concat(r.message)).join(", "));{let r=Xl(t);return{filter:(n,i,o)=>e.value.evaluate(n,i,{},o),needGeometry:r}}}function Am(t,e){return t<e?-1:t>e?1:0}function Xl(t){if(!Array.isArray(t))return!1;if(t[0]==="within")return!0;for(let e=1;e<t.length;e++)if(Xl(t[e]))return!0;return!1}function Ei(t){if(!t)return!0;let e=t[0];return t.length<=1?e!=="any":e==="=="?Ia(t[1],t[2],"=="):e==="!="?xi(Ia(t[1],t[2],"==")):e==="<"||e===">"||e==="<="||e===">="?Ia(t[1],t[2],e):e==="any"?_m(t.slice(1)):e==="all"?["all"].concat(t.slice(1).map(Ei)):e==="none"?["all"].concat(t.slice(1).map(Ei).map(xi)):e==="in"?Tl(t[1],t.slice(2)):e==="!in"?xi(Tl(t[1],t.slice(2))):e==="has"?El(t[1]):e==="!has"?xi(El(t[1])):e==="within"?t:!0}function Ia(t,e,r){switch(t){case"$type":return["filter-type-".concat(r),e];case"$id":return["filter-id-".concat(r),e];default:return["filter-".concat(r),t,e]}}function _m(t){return["any"].concat(t.map(Ei))}function Tl(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(Am)]]:["filter-in-small",t,["literal",e]]}}function El(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function xi(t){return["!",t]}function Ra(t){let e=typeof t;if(e==="number"||e==="boolean"||e==="string"||t===void 0||t===null)return JSON.stringify(t);if(Array.isArray(t)){let i="[";for(let o of t)i+="".concat(Ra(o),",");return"".concat(i,"]")}let r=Object.keys(t).sort(),n="{";for(let i=0;i<r.length;i++)n+="".concat(JSON.stringify(r[i]),":").concat(Ra(t[r[i]]),",");return"".concat(n,"}")}function Im(t){let e="";for(let r of Py)e+="/".concat(Ra(t[r]));return e}function Ql(t,e){let r={};for(let i=0;i<t.length;i++){let o=e&&e[t[i].id]||Im(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 eu(t){let e=t.key,r=t.value;return r?[new D(e,r,"constants have been deprecated as of v8")]:[]}function pe(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function Vt(t){if(Array.isArray(t))return t.map(Vt);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){let e={};for(let r in t)e[r]=Vt(t[r]);return e}return pe(t)}function Be(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 D(e,r,"object expected, ".concat(u," found"))];for(let c in r){let p=c.split(".")[0],f=n[p]||n["*"],y;if(i[p])y=i[p];else if(n[p])y=s;else if(i["*"])y=i["*"];else if(n["*"])y=s;else{l.push(new D(e,r[c],\'unknown property "\'.concat(c,\'"\')));continue}l=l.concat(y({key:(e&&"".concat(e,"."))+c,value:r[c],valueSpec:f,style:o,styleSpec:a,object:r,objectKey:c,validateSpec:s},r))}for(let c in n)i[c]||n[c].required&&n[c].default===void 0&&r[c]===void 0&&l.push(new D(e,r,\'missing required property "\'.concat(c,\'"\')));return l}function ja(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 D(a,e,"array expected, ".concat(j(e)," found"))];if(r.length&&e.length!==r.length)return[new D(a,e,"array length ".concat(r.length," expected, length ").concat(e.length," found"))];if(r["min-length"]&&e.length<r["min-length"])return[new D(a,e,"array length at least ".concat(r["min-length"]," expected, length ").concat(e.length," found"))];let l={type:r.value,values:r.values};o.$version<7&&(l.function=r.function),j(r.value)==="object"&&(l=r.value);let u=[];for(let c=0;c<e.length;c++)u=u.concat(s({array:e,arrayIndex:c,value:e[c],valueSpec:l,validateSpec:t.validateSpec,style:i,styleSpec:o,key:"".concat(a,"[").concat(c,"]")}));return u}function Za(t){let e=t.key,r=t.value,n=t.valueSpec,i=j(r);return i==="number"&&r!==r&&(i="NaN"),i!=="number"?[new D(e,r,"number expected, ".concat(i," found"))]:"minimum"in n&&r<n.minimum?[new D(e,r,"".concat(r," is less than the minimum value ").concat(n.minimum))]:"maximum"in n&&r>n.maximum?[new D(e,r,"".concat(r," is greater than the maximum value ").concat(n.maximum))]:[]}function tu(t){let e=t.valueSpec,r=pe(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=Be({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 D(t.key,t.value,\'missing required property "property"\')),r!=="identity"&&!t.value.stops&&c.push(new D(t.key,t.value,\'missing required property "stops"\')),r==="exponential"&&t.valueSpec.expression&&!Ga(t.valueSpec)&&c.push(new D(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!ht(t.valueSpec)?c.push(new D(t.key,t.value,"property functions not supported")):s&&!Wl(t.valueSpec)&&c.push(new D(t.key,t.value,"zoom functions not supported"))),(r==="categorical"||u)&&t.value.property===void 0&&c.push(new D(t.key,t.value,\'"property" property is required\')),c;function p(d){if(r==="identity")return[new D(d.key,d.value,\'identity function may not have a "stops" property\')];let h=[],g=d.value;return h=h.concat(ja({key:d.key,value:g,valueSpec:d.valueSpec,validateSpec:d.validateSpec,style:d.style,styleSpec:d.styleSpec,arrayElementValidator:f})),j(g)==="array"&&g.length===0&&h.push(new D(d.key,g,"array must have at least one stop")),h}function f(d){let h=[],g=d.value,v=d.key;if(j(g)!=="array")return[new D(v,g,"array expected, ".concat(j(g)," found"))];if(g.length!==2)return[new D(v,g,"array length 2 expected, length ".concat(g.length," found"))];if(u){if(j(g[0])!=="object")return[new D(v,g,"object expected, ".concat(j(g[0])," found"))];if(g[0].zoom===void 0)return[new D(v,g,"object stop key must have zoom")];if(g[0].value===void 0)return[new D(v,g,"object stop key must have value")];if(a&&a>pe(g[0].zoom))return[new D(v,g[0].zoom,"stop zoom values must appear in ascending order")];pe(g[0].zoom)!==a&&(a=pe(g[0].zoom),o=void 0,i={}),h=h.concat(Be({key:"".concat(v,"[0]"),value:g[0],valueSpec:{zoom:{}},validateSpec:d.validateSpec,style:d.style,styleSpec:d.styleSpec,objectElementValidators:{zoom:Za,value:y}}))}else h=h.concat(y({key:"".concat(v,"[0]"),value:g[0],valueSpec:{},validateSpec:d.validateSpec,style:d.style,styleSpec:d.styleSpec},g));return en(Vt(g[1]))?h.concat([new D("".concat(v,"[1]"),g[1],"expressions are not allowed in function stops.")]):h.concat(d.validateSpec({key:"".concat(v,"[1]"),value:g[1],valueSpec:e,validateSpec:d.validateSpec,style:d.style,styleSpec:d.styleSpec}))}function y(d,h){let g=j(d.value),v=pe(d.value),b=d.value!==null?d.value:h;if(!n)n=g;else if(g!==n)return[new D(d.key,b,"".concat(g," stop domain type must match previous stop domain type ").concat(n))];if(g!=="number"&&g!=="string"&&g!=="boolean")return[new D(d.key,b,"stop domain value must be a number, string, or boolean")];if(g!=="number"&&r!=="categorical"){let x="number expected, ".concat(g," found");return ht(e)&&r===void 0&&(x+=\'\\nIf you intended to use a categorical function, specify `"type": "categorical"`.\'),[new D(d.key,b,x)]}return r==="categorical"&&g==="number"&&(!isFinite(v)||Math.floor(v)!==v)?[new D(d.key,b,"integer expected, found ".concat(v))]:r!=="categorical"&&g==="number"&&o!==void 0&&v<o?[new D(d.key,b,"stop domain values must appear in ascending order")]:(o=v,r==="categorical"&&v in i?[new D(d.key,b,"stop domain values must be unique")]:(i[v]=!0,[]))}function m(d){return d.validateSpec({key:d.key,value:d.value,valueSpec:e,validateSpec:d.validateSpec,style:d.style,styleSpec:d.styleSpec})}}function ur(t){let e=(t.expressionContext==="property"?Kl:Rt)(Vt(t.value),t.valueSpec);if(e.result==="error")return e.value.map(n=>new D("".concat(t.key).concat(n.key),t.value,n.message));let r=e.value.expression||e.value._styleExpression.expression;if(t.expressionContext==="property"&&t.propertyKey==="text-font"&&!r.outputDefined())return[new D(t.key,t.value,\'Invalid data expression for "\'.concat(t.propertyKey,\'". Output values must be contained as literals within the expression.\'))];if(t.expressionContext==="property"&&t.propertyType==="layout"&&!Wr(r))return[new D(t.key,t.value,\'"feature-state" data expressions are not supported with layout properties.\')];if(t.expressionContext==="filter"&&!Wr(r))return[new D(t.key,t.value,\'"feature-state" data expressions are not supported with filters.\')];if(t.expressionContext&&t.expressionContext.indexOf("cluster")===0){if(!Vi(r,["zoom","feature-state"]))return[new D(t.key,t.value,\'"zoom" and "feature-state" expressions are not supported with cluster properties.\')];if(t.expressionContext==="cluster-initial"&&!Di(r))return[new D(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Cm(t){let e=t.value,r=t.key,n=j(e);return n!=="boolean"?[new D(r,e,"boolean expected, ".concat(n," found"))]:[]}function km(t){let e=t.key,r=t.value,n=j(r);return n!=="string"?[new D(e,r,"color expected, ".concat(n," found"))]:W.parse(String(r))?[]:[new D(e,r,\'color expected, "\'.concat(r,\'" found\'))]}function Yr(t){let e=t.key,r=t.value,n=t.valueSpec,i=[];return Array.isArray(n.values)?n.values.indexOf(pe(r))===-1&&i.push(new D(e,r,"expected one of [".concat(n.values.join(", "),"], ").concat(JSON.stringify(r)," found"))):Object.keys(n.values).indexOf(pe(r))===-1&&i.push(new D(e,r,"expected one of [".concat(Object.keys(n.values).join(", "),"], ").concat(JSON.stringify(r)," found"))),i}function Ja(t){return qa(Vt(t.value))?ur(sr({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):ru(t)}function ru(t){let e=t.value,r=t.key;if(j(e)!=="array")return[new D(r,e,"array expected, ".concat(j(e)," found"))];let n=t.styleSpec,i,o=[];if(e.length<1)return[new D(r,e,"filter array must have at least 1 element")];switch(o=o.concat(Yr({key:"".concat(r,"[0]"),value:e[0],valueSpec:n.filter_operator,style:t.style,styleSpec:t.styleSpec})),pe(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&pe(e[1])==="$type"&&o.push(new D(r,e,\'"$type" cannot be use with operator "\'.concat(e[0],\'"\')));case"==":case"!=":e.length!==3&&o.push(new D(r,e,\'filter array for operator "\'.concat(e[0],\'" must have 3 elements\')));case"in":case"!in":e.length>=2&&(i=j(e[1]),i!=="string"&&o.push(new D("".concat(r,"[1]"),e[1],"string expected, ".concat(i," found"))));for(let a=2;a<e.length;a++)i=j(e[a]),pe(e[1])==="$type"?o=o.concat(Yr({key:"".concat(r,"[").concat(a,"]"),value:e[a],valueSpec:n.geometry_type,style:t.style,styleSpec:t.styleSpec})):i!=="string"&&i!=="number"&&i!=="boolean"&&o.push(new D("".concat(r,"[").concat(a,"]"),e[a],"string, number, or boolean expected, ".concat(i," found")));break;case"any":case"all":case"none":for(let a=1;a<e.length;a++)o=o.concat(ru({key:"".concat(r,"[").concat(a,"]"),value:e[a],style:t.style,styleSpec:t.styleSpec}));break;case"has":case"!has":i=j(e[1]),e.length!==2?o.push(new D(r,e,\'filter array for "\'.concat(e[0],\'" operator must have 2 elements\'))):i!=="string"&&o.push(new D("".concat(r,"[1]"),e[1],"string expected, ".concat(i," found")));break;case"within":i=j(e[1]),e.length!==2?o.push(new D(r,e,\'filter array for "\'.concat(e[0],\'" operator must have 2 elements\'))):i!=="object"&&o.push(new D("".concat(r,"[1]"),e[1],"object expected, ".concat(i," found")));break}return o}function nu(t,e){let r=t.key,n=t.validateSpec,i=t.style,o=t.styleSpec,a=t.value,s=t.objectKey,l=o["".concat(e,"_").concat(t.layerType)];if(!l)return[];let u=s.match(/^(.*)-transition$/);if(e==="paint"&&u&&l[u[1]]&&l[u[1]].transition)return n({key:r,value:a,valueSpec:o.transition,style:i,styleSpec:o});let c=t.valueSpec||l[s];if(!c)return[new D(r,a,\'unknown property "\'.concat(s,\'"\'))];let p;if(j(a)==="string"&&ht(c)&&!c.tokens&&(p=/^{([^}]+)}$/.exec(a)))return[new D(r,a,\'"\'.concat(s,\'" does not support interpolation syntax\\n\')+\'Use an identity property function instead: `{ "type": "identity", "property": \'.concat(JSON.stringify(p[1])," }`."))];let f=[];return t.layerType==="symbol"&&(s==="text-field"&&i&&!i.glyphs&&f.push(new D(r,a,\'use of "text-field" requires a style "glyphs" property\')),s==="text-font"&&zi(Vt(a))&&pe(a.type)==="identity"&&f.push(new D(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 iu(t){return nu(t,"paint")}function ou(t){return nu(t,"layout")}function au(t){let e=[],r=t.value,n=t.key,i=t.style,o=t.styleSpec;!r.type&&!r.ref&&e.push(new D(n,r,\'either "type" or "ref" is required\'));let a=pe(r.type),s=pe(r.ref);if(r.id){let l=pe(r.id);for(let u=0;u<t.arrayIndex;u++){let c=i.layers[u];pe(c.id)===l&&e.push(new D(n,r.id,\'duplicate layer id "\'.concat(r.id,\'", previously used at line \').concat(c.id.__line__)))}}if("ref"in r){["type","source","source-layer","filter","layout"].forEach(u=>{u in r&&e.push(new D(n,r[u],\'"\'.concat(u,\'" is prohibited for ref layers\')))});let l;i.layers.forEach(u=>{pe(u.id)===s&&(l=u)}),l?l.ref?e.push(new D(n,r.ref,"ref cannot reference another ref layer")):a=pe(l.type):e.push(new D(n,r.ref,\'ref layer "\'.concat(s,\'" not found\')))}else if(a!=="background")if(!r.source)e.push(new D(n,r,\'missing required property "source"\'));else{let l=i.sources&&i.sources[r.source],u=l&&pe(l.type);l?u==="vector"&&a==="raster"?e.push(new D(n,r.source,\'layer "\'.concat(r.id,\'" requires a raster source\'))):u==="raster"&&a!=="raster"?e.push(new D(n,r.source,\'layer "\'.concat(r.id,\'" requires a vector source\'))):u==="vector"&&!r["source-layer"]?e.push(new D(n,r,\'layer "\'.concat(r.id,\'" must specify a "source-layer"\'))):u==="raster-dem"&&a!=="hillshade"?e.push(new D(n,r.source,"raster-dem source can only be used with layer type \'hillshade\'.")):a==="line"&&r.paint&&r.paint["line-gradient"]&&(u!=="geojson"||!l.lineMetrics)&&e.push(new D(n,r,\'layer "\'.concat(r.id,\'" specifies a line-gradient, which requires a GeoJSON source with `lineMetrics` enabled.\'))):e.push(new D(n,r.source,\'source "\'.concat(r.source,\'" not found\')))}return e=e.concat(Be({key:n,value:r,valueSpec:o.layer,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*"(){return[]},type(){return t.validateSpec({key:"".concat(n,".type"),value:r.type,valueSpec:o.layer.type,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,object:r,objectKey:"type"})},filter:Ja,layout(l){return Be({layer:r,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return ou(sr({layerType:a},u))}}})},paint(l){return Be({layer:r,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return iu(sr({layerType:a},u))}}})}}})),e}function Bt(t){let e=t.value,r=t.key,n=j(e);return n!=="string"?[new D(r,e,"string expected, ".concat(n," found"))]:[]}var Fl={promoteId:Tm};function su(t){let e=t.value,r=t.key,n=t.styleSpec,i=t.style,o=t.validateSpec;if(!e.type)return[new D(r,e,\'"type" is required\')];let a=pe(e.type),s;switch(a){case"vector":case"raster":case"raster-dem":return s=Be({key:r,value:e,valueSpec:n["source_".concat(a.replace("-","_"))],style:t.style,styleSpec:n,objectElementValidators:Fl,validateSpec:o}),s;case"geojson":if(s=Be({key:r,value:e,valueSpec:n.source_geojson,style:i,styleSpec:n,validateSpec:o,objectElementValidators:Fl}),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(...ur({key:"".concat(r,".").concat(l,".map"),value:c,validateSpec:o,expressionContext:"cluster-map"})),s.push(...ur({key:"".concat(r,".").concat(l,".reduce"),value:p,validateSpec:o,expressionContext:"cluster-reduce"}))}return s;case"video":return Be({key:r,value:e,valueSpec:n.source_video,style:i,validateSpec:o,styleSpec:n});case"image":return Be({key:r,value:e,valueSpec:n.source_image,style:i,validateSpec:o,styleSpec:n});case"canvas":return[new D(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Yr({key:"".concat(r,".type"),value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:i,validateSpec:o,styleSpec:n})}}function Tm({key:t,value:e}){if(j(e)==="string")return Bt({key:t,value:e});{let r=[];for(let n in e)r.push(...Bt({key:"".concat(t,".").concat(n),value:e[n]}));return r}}function lu(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 D("light",e,"object expected, ".concat(a," found"))]),o;for(let s in e){let l=s.match(/^(.*)-transition$/);l&&n[l[1]]&&n[l[1]].transition?o=o.concat(t.validateSpec({key:s,value:e[s],valueSpec:r.transition,validateSpec:t.validateSpec,style:i,styleSpec:r})):n[s]?o=o.concat(t.validateSpec({key:s,value:e[s],valueSpec:n[s],validateSpec:t.validateSpec,style:i,styleSpec:r})):o=o.concat([new D(s,e[s],\'unknown property "\'.concat(s,\'"\'))])}return o}function uu(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 D("terrain",e,"object expected, ".concat(a," found"))]),o;for(let s in e)n[s]?o=o.concat(t.validateSpec({key:s,value:e[s],valueSpec:n[s],validateSpec:t.validateSpec,style:i,styleSpec:r})):o=o.concat([new D(s,e[s],\'unknown property "\'.concat(s,\'"\'))]);return o}function Em(t){return Bt(t).length===0?[]:ur(t)}function Fm(t){return Bt(t).length===0?[]:ur(t)}function Mm(t){let e=t.key,r=t.value;if(j(r)==="array"){if(r.length<1||r.length>4)return[new D(e,r,"padding requires 1 to 4 values; ".concat(r.length," values found"))];let i={type:"number"},o=[];for(let a=0;a<r.length;a++)o=o.concat(t.validateSpec({key:"".concat(e,"[").concat(a,"]"),value:r[a],validateSpec:t.validateSpec,valueSpec:i}));return o}else return Za({key:e,value:r,valueSpec:{}})}function Lm(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 D(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(Yr({key:"".concat(e,"[").concat(a,"]"),value:r[a],valueSpec:i.layout_symbol["text-anchor"]})),o=o.concat(ja({key:"".concat(e,"[").concat(a+1,"]"),value:r[a+1],valueSpec:{length:2,value:"number"},validateSpec:t.validateSpec,style:t.style,styleSpec:i}));return o}function cu(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 D(n,r,"all the sprites\' ids must be unique, but ".concat(r[a].id," is duplicated"))),i.push(r[a].id),r[a].url&&o.includes(r[a].url)&&e.push(new D(n,r,"all the sprites\' URLs must be unique, but ".concat(r[a].url," is duplicated"))),o.push(r[a].url);let s={id:{type:"string",required:!0},url:{type:"string",required:!0}};e=e.concat(Be({key:"".concat(n,"[").concat(a,"]"),value:r[a],valueSpec:s,validateSpec:t.validateSpec}))}return e}else return Bt({key:n,value:r})}var Ml={"*"(){return[]},array:ja,boolean:Cm,number:Za,color:km,constants:eu,enum:Yr,filter:Ja,function:tu,layer:au,object:Be,source:su,light:lu,terrain:uu,string:Bt,formatted:Em,resolvedImage:Fm,padding:Mm,variableAnchorOffsetCollection:Lm,sprite:cu};function $r(t){let e=t.value,r=t.valueSpec,n=t.styleSpec;return t.validateSpec=$r,r.expression&&zi(pe(e))?tu(t):r.expression&&en(Vt(e))?ur(t):r.type&&Ml[r.type]?Ml[r.type](t):Be(sr({},t,{valueSpec:r.type?n[r.type]:r}))}function pu(t){let e=t.value,r=t.key,n=Bt(t);return n.length||(e.indexOf("{fontstack}")===-1&&n.push(new D(r,e,\'"glyphs" url must include a "{fontstack}" token\')),e.indexOf("{range}")===-1&&n.push(new D(r,e,\'"glyphs" url must include a "{range}" token\'))),n}function Ze(t,e=S){let r=[];return r=r.concat($r({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,validateSpec:$r,objectElementValidators:{glyphs:pu,"*"(){return[]}}})),t.constants&&(r=r.concat(eu({key:"constants",value:t.constants,style:t,styleSpec:e,validateSpec:$r}))),fu(r)}Ze.source=at(ot(su));Ze.sprite=at(ot(cu));Ze.glyphs=at(ot(pu));Ze.light=at(ot(lu));Ze.terrain=at(ot(uu));Ze.layer=at(ot(au));Ze.filter=at(ot(Ja));Ze.paintProperty=at(ot(iu));Ze.layoutProperty=at(ot(ou));function ot(t){return function(e){return t({...e,validateSpec:$r})}}function fu(t){return[].concat(t).sort((e,r)=>e.line-r.line)}function at(t){return function(...e){return fu(t.apply(this,e))}}var yu={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};var yr=class extends Error{constructor(e,r,n,i){super("AJAXError: ".concat(r," (").concat(e,"): ").concat(n)),this.status=e,this.statusText=r,this.url=n,this.body=i}},hu=Ie()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol==="blob:"?window.parent:window).location.href,Dm=t=>yu.REGISTERED_PROTOCOLS[t.substring(0,t.indexOf("://"))],Vm=t=>/^file:/.test(t)||/^file:/.test(hu())&&!/^\\w+:/.test(t);function mu(t,e){let r=new AbortController,n=new Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,referrer:hu(),signal:r.signal}),i=!1,o=!1;t.type==="json"&&n.headers.set("Accept","application/json");let a=(l,u,c)=>{if(!o){if(l&&l.message!=="SecurityError"&&ce(l),u&&c)return s(u);fetch(n).then(p=>p.ok?s(p):p.blob().then(f=>e(new yr(p.status,p.statusText,t.url,f)))).catch(p=>{p.code!==20&&e(new Error(p.message))})}},s=l=>{(t.type==="arrayBuffer"||t.type==="image"?l.arrayBuffer():t.type==="json"?l.json():l.text()).then(u=>{o||(i=!0,e(null,u,l.headers.get("Cache-Control"),l.headers.get("Expires")))}).catch(u=>{o||e(new Error(u.message))})};return a(null,null),{cancel:()=>{o=!0,i||r.abort()}}}function Bm(t,e){let r=new XMLHttpRequest;r.open(t.method||"GET",t.url,!0),(t.type==="arrayBuffer"||t.type==="image")&&(r.responseType="arraybuffer");for(let n in t.headers)r.setRequestHeader(n,t.headers[n]);return t.type==="json"&&(r.responseType="text",r.setRequestHeader("Accept","application/json")),r.withCredentials=t.credentials==="include",r.onerror=()=>{e(new Error(r.statusText))},r.onload=()=>{if((r.status>=200&&r.status<300||r.status===0)&&r.response!==null){let n=r.response;if(t.type==="json")try{n=JSON.parse(r.response)}catch(i){return e(i)}e(null,n,r.getResponseHeader("Cache-Control"),r.getResponseHeader("Expires"))}else{let n=new Blob([r.response],{type:r.getResponseHeader("Content-Type")});e(new yr(r.status,r.statusText,t.url,n))}},r.send(t.body),{cancel:()=>r.abort()}}var du=function(t,e){if(/:\\/\\//.test(t.url)&&!/^https?:|^file:/.test(t.url)){if(Ie()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e);if(!Ie())return(Dm(t.url)||mu)(t,e)}if(!Vm(t.url)){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return mu(t,e);if(Ie()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e,void 0,!0)}return Bm(t,e)},gu=function(t,e){return du(Ae(t,{type:"json"}),e)},Wa=function(t,e){return du(Ae(t,{type:"arrayBuffer"}),e)};var xt={};function k(t,e,r={}){if(xt[t])throw new Error("".concat(t," is already registered."));Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),xt[t]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}k("Object",Object);k("TransferableGridIndex",Ft);k("Color",W);k("Error",Error);k("AJAXError",yr);k("ResolvedImage",Ce);k("StylePropertyFunction",Kr);k("StyleExpression",Dt,{omit:["_evaluator"]});k("ZoomDependentExpression",gt);k("ZoomConstantExpression",dt);k("CompoundExpression",Ye,{omit:["_evaluate"]});for(let t in zt)zt[t]._classRegistryKey||k("Expression_".concat(t),zt[t]);function xu(t){return t&&typeof ArrayBuffer<"u"&&(t instanceof ArrayBuffer||t.constructor&&t.constructor.name==="ArrayBuffer")}function mr(t,e){if(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)return t;if(xu(t)||Or(t))return e&&e.push(t),t;if(ArrayBuffer.isView(t)){let r=t;return e&&e.push(r.buffer),r}if(t instanceof ImageData)return e&&e.push(t.data.buffer),t;if(Array.isArray(t)){let r=[];for(let n of t)r.push(mr(n,e));return r}if(typeof t=="object"){let r=t.constructor,n=r._classRegistryKey;if(!n)throw new Error("can\'t serialize object of unregistered class");if(!xt[n])throw new Error("".concat(n," is not registered."));let i=r.serialize?r.serialize(t,e):{};if(r.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)||xt[n].omit.indexOf(o)>=0)continue;let a=t[o];i[o]=xt[n].shallow.indexOf(o)>=0?a:mr(a,e)}t instanceof Error&&(i.message=t.message)}if(i.$name)throw new Error("$name property is reserved for worker serialization logic.");return n!=="Object"&&(i.$name=n),i}throw new Error("can\'t serialize object of type ".concat(typeof t))}function hr(t){if(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||xu(t)||Or(t)||ArrayBuffer.isView(t)||t instanceof ImageData)return t;if(Array.isArray(t))return t.map(hr);if(typeof t=="object"){let e=t.$name||"Object";if(!xt[e])throw new Error("can\'t deserialize unregistered class ".concat(e));let{klass:r}=xt[e];if(!r)throw new Error("can\'t deserialize unregistered class ".concat(e));if(r.deserialize)return r.deserialize(t);let n=Object.create(r.prototype);for(let i of Object.keys(t)){if(i==="$name")continue;let o=t[i];n[i]=xt[e].shallow.indexOf(i)>=0?o:hr(o)}return n}throw new Error("can\'t deserialize object of type ".concat(typeof t))}var Ri=class{constructor(e){this._callback=e,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){delete this._channel,this._callback=()=>{}}};var Oi=class{constructor(e,r,n){this.receive=e=>{let r=e.data,n=r.id;if(n&&!(r.targetMapId&&this.mapId!==r.targetMapId))if(r.type==="<cancel>"){delete this.tasks[n];let i=this.cancelCallbacks[n];delete this.cancelCallbacks[n],i&&i()}else Ie()||r.mustQueue?(this.tasks[n]=r,this.taskQueue.push(n),this.invoker.trigger()):this.processTask(n,r)};this.process=()=>{if(!this.taskQueue.length)return;let e=this.taskQueue.shift(),r=this.tasks[e];delete this.tasks[e],this.taskQueue.length&&this.invoker.trigger(),r&&this.processTask(e,r)};this.target=e,this.parent=r,this.mapId=n,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},this.invoker=new Ri(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=Ie()?e:window}send(e,r,n,i,o=!1){let a=Math.round(Math.random()*1e18).toString(36).substring(0,10);n&&(this.callbacks[a]=n);let s=ba(this.globalScope)?void 0:[];return this.target.postMessage({id:a,type:e,hasCallback:!!n,targetMapId:i,mustQueue:o,sourceMapId:this.mapId,data:mr(r,s)},s),{cancel:()=>{n&&delete this.callbacks[a],this.target.postMessage({id:a,type:"<cancel>",targetMapId:i,sourceMapId:this.mapId})}}}processTask(e,r){if(r.type==="<response>"){let n=this.callbacks[e];delete this.callbacks[e],n&&(r.error?n(hr(r.error)):n(null,hr(r.data)))}else{let n=!1,i=ba(this.globalScope)?void 0:[],o=r.hasCallback?(l,u)=>{n=!0,delete this.cancelCallbacks[e],this.target.postMessage({id:e,type:"<response>",sourceMapId:this.mapId,error:l?mr(l):null,data:mr(u,i)},i)}:l=>{n=!0},a=null,s=hr(r.data);if(this.parent[r.type])a=this.parent[r.type](r.sourceMapId,s,o);else if(this.parent.getWorkerSource){let l=r.type.split(".");a=this.parent.getWorkerSource(r.sourceMapId,l[0],s.source)[l[1]](s,o)}else o(new Error("Could not find function ".concat(r.type)));!n&&a&&a.cancel&&(this.cancelCallbacks[e]=a.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}};function bu(t,e,r){r[t]&&r[t].indexOf(e)!==-1||(r[t]=r[t]||[],r[t].push(e))}function Ha(t,e,r){if(r&&r[t]){let n=r[t].indexOf(e);n!==-1&&r[t].splice(n,1)}}var rn=class{constructor(e,r={}){Ae(this,r),this.type=e}},nn=class extends rn{constructor(e,r={}){super("error",Ae({error:e},r))}},dr=class{on(e,r){return this._listeners=this._listeners||{},bu(e,r,this._listeners),this}off(e,r){return Ha(e,r,this._listeners),Ha(e,r,this._oneTimeListeners),this}once(e,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},bu(e,r,this._oneTimeListeners),this):new Promise(n=>this.once(e,n))}fire(e,r){typeof e=="string"&&(e=new rn(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)Ha(n,s,this._oneTimeListeners),s.call(this,e);let a=this._eventedParent;a&&(Ae(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),a.fire(e))}else e instanceof nn&&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 bt=Ze,vb=bt.source,Pb=bt.light,Sb=bt.terrain,wb=bt.filter,vu=bt.paintProperty,Pu=bt.layoutProperty;function Su(t,e){let r=!1;if(e&&e.length)for(let n of e)t.fire(new nn(new Error(n.message))),r=!0;return r}var Ni=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 V={"Latin-1 Supplement":t=>t>=128&&t<=255,Arabic:t=>t>=1536&&t<=1791,"Arabic Supplement":t=>t>=1872&&t<=1919,"Arabic Extended-A":t=>t>=2208&&t<=2303,"Hangul Jamo":t=>t>=4352&&t<=4607,"Unified Canadian Aboriginal Syllabics":t=>t>=5120&&t<=5759,Khmer:t=>t>=6016&&t<=6143,"Unified Canadian Aboriginal Syllabics Extended":t=>t>=6320&&t<=6399,"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,"CJK Radicals Supplement":t=>t>=11904&&t<=12031,"Kangxi Radicals":t=>t>=12032&&t<=12255,"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,Bopomofo:t=>t>=12544&&t<=12591,"Hangul Compatibility Jamo":t=>t>=12592&&t<=12687,Kanbun:t=>t>=12688&&t<=12703,"Bopomofo Extended":t=>t>=12704&&t<=12735,"CJK Strokes":t=>t>=12736&&t<=12783,"Katakana Phonetic Extensions":t=>t>=12784&&t<=12799,"Enclosed CJK Letters and Months":t=>t>=12800&&t<=13055,"CJK Compatibility":t=>t>=13056&&t<=13311,"CJK Unified Ideographs Extension A":t=>t>=13312&&t<=19903,"Yijing Hexagram Symbols":t=>t>=19904&&t<=19967,"CJK Unified Ideographs":t=>t>=19968&&t<=40959,"Yi Syllables":t=>t>=40960&&t<=42127,"Yi Radicals":t=>t>=42128&&t<=42191,"Hangul Jamo Extended-A":t=>t>=43360&&t<=43391,"Hangul Syllables":t=>t>=44032&&t<=55215,"Hangul Jamo Extended-B":t=>t>=55216&&t<=55295,"Private Use Area":t=>t>=57344&&t<=63743,"CJK Compatibility Ideographs":t=>t>=63744&&t<=64255,"Arabic Presentation Forms-A":t=>t>=64336&&t<=65023,"Vertical Forms":t=>t>=65040&&t<=65055,"CJK Compatibility Forms":t=>t>=65072&&t<=65103,"Small Form Variants":t=>t>=65104&&t<=65135,"Arabic Presentation Forms-B":t=>t>=65136&&t<=65279,"Halfwidth and Fullwidth Forms":t=>t>=65280&&t<=65519};function on(t){for(let e of t)if(Ui(e.charCodeAt(0)))return!0;return!1}function wu(t){for(let e of t)if(!zm(e.charCodeAt(0)))return!1;return!0}function zm(t){return!(V.Arabic(t)||V["Arabic Supplement"](t)||V["Arabic Extended-A"](t)||V["Arabic Presentation Forms-A"](t)||V["Arabic Presentation Forms-B"](t))}function Au(t){return t<11904?!1:!!(V["Bopomofo Extended"](t)||V.Bopomofo(t)||V["CJK Compatibility Forms"](t)||V["CJK Compatibility Ideographs"](t)||V["CJK Compatibility"](t)||V["CJK Radicals Supplement"](t)||V["CJK Strokes"](t)||V["CJK Symbols and Punctuation"](t)||V["CJK Unified Ideographs Extension A"](t)||V["CJK Unified Ideographs"](t)||V["Enclosed CJK Letters and Months"](t)||V["Halfwidth and Fullwidth Forms"](t)||V.Hiragana(t)||V["Ideographic Description Characters"](t)||V["Kangxi Radicals"](t)||V["Katakana Phonetic Extensions"](t)||V.Katakana(t)||V["Vertical Forms"](t)||V["Yi Radicals"](t)||V["Yi Syllables"](t))}function Ui(t){return t===746||t===747?!0:t<4352?!1:!!(V["Bopomofo Extended"](t)||V.Bopomofo(t)||V["CJK Compatibility Forms"](t)&&!(t>=65097&&t<=65103)||V["CJK Compatibility Ideographs"](t)||V["CJK Compatibility"](t)||V["CJK Radicals Supplement"](t)||V["CJK Strokes"](t)||V["CJK Symbols and Punctuation"](t)&&!(t>=12296&&t<=12305)&&!(t>=12308&&t<=12319)&&t!==12336||V["CJK Unified Ideographs Extension A"](t)||V["CJK Unified Ideographs"](t)||V["Enclosed CJK Letters and Months"](t)||V["Hangul Compatibility Jamo"](t)||V["Hangul Jamo Extended-A"](t)||V["Hangul Jamo Extended-B"](t)||V["Hangul Jamo"](t)||V["Hangul Syllables"](t)||V.Hiragana(t)||V["Ideographic Description Characters"](t)||V.Kanbun(t)||V["Kangxi Radicals"](t)||V["Katakana Phonetic Extensions"](t)||V.Katakana(t)&&t!==12540||V["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)||V["Small Form Variants"](t)&&!(t>=65112&&t<=65118)&&!(t>=65123&&t<=65126)||V["Unified Canadian Aboriginal Syllabics"](t)||V["Unified Canadian Aboriginal Syllabics Extended"](t)||V["Vertical Forms"](t)||V["Yijing Hexagram Symbols"](t)||V["Yi Syllables"](t)||V["Yi Radicals"](t))}function Rm(t){return!!(V["Latin-1 Supplement"](t)&&(t===167||t===169||t===174||t===177||t===188||t===189||t===190||t===215||t===247)||V["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)||V["Letterlike Symbols"](t)||V["Number Forms"](t)||V["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)||V["Control Pictures"](t)&&t!==9251||V["Optical Character Recognition"](t)||V["Enclosed Alphanumerics"](t)||V["Geometric Shapes"](t)||V["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||V["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||V["CJK Symbols and Punctuation"](t)||V.Katakana(t)||V["Private Use Area"](t)||V["CJK Compatibility Forms"](t)||V["Small Form Variants"](t)||V["Halfwidth and Fullwidth Forms"](t)||t===8734||t===8756||t===8757||t>=9984&&t<=10087||t>=10102&&t<=10131||t===65532||t===65533)}function Ka(t){return!(Ui(t)||Rm(t))}function _u(t){return V.Arabic(t)||V["Arabic Supplement"](t)||V["Arabic Extended-A"](t)||V["Arabic Presentation Forms-A"](t)||V["Arabic Presentation Forms-B"](t)}function Iu(t){return t>=1424&&t<=2303||V["Arabic Presentation Forms-A"](t)||V["Arabic Presentation Forms-B"](t)}function Om(t,e){return!(!e&&Iu(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||V.Khmer(t))}function Cu(t){for(let e of t)if(Iu(e.charCodeAt(0)))return!0;return!1}function ku(t,e){for(let r of t)if(!Om(r.charCodeAt(0),e))return!1;return!0}var Nm=typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),$i,Ya,Um={now:Nm,frame(t){let e=requestAnimationFrame(t);return{cancel:()=>cancelAnimationFrame(e)}},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 $i||($i=document.createElement("a")),$i.href=t,$i.href},hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return matchMedia?(Ya==null&&(Ya=matchMedia("(prefers-reduced-motion: reduce)")),Ya.matches):!1}};var Xa={unavailable:"unavailable",deferred:"deferred",loading:"loading",loaded:"loaded",error:"error"};var Gi=Xa.unavailable,Tu=null;var Db=new dr,Eu=function(){return Gi};var ae={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded(){return Gi===Xa.loaded||ae.applyArabicShaping!=null},isLoading(){return Gi===Xa.loading},setState(t){if(!Ie())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");Gi=t.pluginStatus,Tu=t.pluginURL},isParsed(){if(!Ie())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return ae.applyArabicShaping!=null&&ae.processBidirectionalText!=null&&ae.processStyledBidirectionalText!=null},getPluginURL(){if(!Ie())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return Tu}};var q=class{constructor(e,r){this.zoom=e,r?(this.now=r.now,this.fadeDuration=r.fadeDuration,this.zoomHistory=r.zoomHistory,this.transition=r.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Ni,this.transition={})}isSupportedScript(e){return ku(e,ae.isLoaded())}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 gr=class{constructor(e,r){this.property=e,this.value=r,this.expression=Yl(r===void 0?e.specification.default:r,e.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,r,n){return this.property.possiblyEvaluate(this,e,r,n)}},an=class{constructor(e){this.property=e,this.value=new gr(e,void 0)}transitioned(e,r){return new ji(this.property,this.value,r,Ae({},e.transition,this.transition),e.now)}untransitioned(){return new ji(this.property,this.value,null,{},0)}},qi=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return tt(this._values[e].value.value)}setValue(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new an(this._values[e].property)),this._values[e].value=new gr(this._values[e].property,r===null?void 0:tt(r))}getTransition(e){return tt(this._values[e].transition)}setTransition(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new an(this._values[e].property)),this._values[e].transition=tt(r)||void 0}serialize(){let e={};for(let r of Object.keys(this._values)){let n=this.getValue(r);n!==void 0&&(e[r]=n);let i=this.getTransition(r);i!==void 0&&(e["".concat(r,"-transition")]=i)}return e}transitioned(e,r){let n=new Zi(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 Zi(this._properties);for(let r of Object.keys(this._values))e._values[r]=this._values[r].untransitioned();return e}},ji=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,yl(s))}}else return o}},Zi=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,r,n){let i=new vt(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}},Ji=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}getValue(e){return tt(this._values[e].value)}setValue(e,r){this._values[e]=new gr(this._values[e].property,r===null?void 0:tt(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 vt(this._properties);for(let o of Object.keys(this._values))i._values[o]=this._values[o].possiblyEvaluate(e,r,n);return i}},be=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)}},vt=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}},B=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=Re[i];return o?o(e,r,n):e}},R=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 be(this,{kind:"constant",value:e.expression.evaluate(r,null,{},n,i)},r):new be(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 be(this,{kind:"constant",value:void 0},e.parameters);let i=this.specification.type,o=Re[i];if(o){let a=o(e.value.value,r.value.value,n);return new be(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)}},st=class extends R{possiblyEvaluate(e,r,n,i){if(e.value===void 0)return new be(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 be(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 be(this,{kind:"constant",value:o},r)}else return new be(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}},Ot=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 q(Math.floor(r.zoom-1),r)),e.expression.evaluate(new q(Math.floor(r.zoom),r)),e.expression.evaluate(new q(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}},Nt=class{constructor(e){this.specification=e}possiblyEvaluate(e,r,n,i){return!!e.expression.evaluate(r,null,{},n,i)}interpolate(){return!1}},ie=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 gr(n,void 0),o=this.defaultTransitionablePropertyValues[r]=new an(n);this.defaultTransitioningPropertyValues[r]=o.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=i.possiblyEvaluate({})}}};k("DataDrivenProperty",R);k("DataConstantProperty",B);k("CrossFadedDataDrivenProperty",st);k("CrossFadedProperty",Ot);k("ColorRampProperty",Nt);var Wi="-transition",le=class extends dr{constructor(e,r){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1},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),r.layout&&(this._unevaluatedLayout=new Ji(r.layout)),r.paint)){this._transitionablePaint=new qi(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 vt(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,r,n={}){if(r!=null){let i="layers.".concat(this.id,".layout.").concat(e);if(this._validate(Pu,i,e,r,n))return}if(e==="visibility"){this.visibility=r;return}this._unevaluatedLayout.setValue(e,r)}getPaintProperty(e){return e.endsWith(Wi)?this._transitionablePaint.getTransition(e.slice(0,-Wi.length)):this._transitionablePaint.getValue(e)}setPaintProperty(e,r,n={}){if(r!=null){let i="layers.".concat(this.id,".paint.").concat(e);if(this._validate(vu,i,e,r,n))return!1}if(e.endsWith(Wi))return this._transitionablePaint.setTransition(e.slice(0,-Wi.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),dl(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:Su(this,e.call(bt,{key:r,layerType:this.type,objectKey:n,value:i,styleSpec:S,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 be)||!ht(r.property.specification))&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}};var $m={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},Ut=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}},Gm=128,qm=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*qm),Gm),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 ee(t,e=1){let r=0,n=0,i=t.map(a=>{let s=jm(a.type),l=r=Fu(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=Fu(r,Math.max(n,e));return{members:i,size:o,alignment:e}}function jm(t){return $m[t].BYTES_PER_ELEMENT}function Fu(t,e){return Math.ceil(t/e)*e}var Mu=Z(he(),1),$t=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}};$t.prototype.bytesPerElement=4;k("StructArrayLayout2i4",$t);var sn=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}};sn.prototype.bytesPerElement=6;k("StructArrayLayout3i6",sn);var Hi=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}};Hi.prototype.bytesPerElement=8;k("StructArrayLayout4i8",Hi);var ln=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}};ln.prototype.bytesPerElement=12;k("StructArrayLayout2i4i12",ln);var un=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}};un.prototype.bytesPerElement=8;k("StructArrayLayout2i4ub8",un);var Pt=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}};Pt.prototype.bytesPerElement=8;k("StructArrayLayout2f8",Pt);var cn=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}};cn.prototype.bytesPerElement=20;k("StructArrayLayout10ui20",cn);var pn=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}};pn.prototype.bytesPerElement=24;k("StructArrayLayout4i4ui4i24",pn);var fn=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}};fn.prototype.bytesPerElement=12;k("StructArrayLayout3f12",fn);var yn=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}};yn.prototype.bytesPerElement=4;k("StructArrayLayout1ul4",yn);var mn=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}};mn.prototype.bytesPerElement=20;k("StructArrayLayout6i1ul2ui20",mn);var hn=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}};hn.prototype.bytesPerElement=12;k("StructArrayLayout2i2i2i12",hn);var Ki=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}};Ki.prototype.bytesPerElement=16;k("StructArrayLayout2f1f2i16",Ki);var dn=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*12,s=e*3;return this.uint8[a+0]=r,this.uint8[a+1]=n,this.float32[s+1]=i,this.float32[s+2]=o,e}};dn.prototype.bytesPerElement=12;k("StructArrayLayout2ub2f12",dn);var gn=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}};gn.prototype.bytesPerElement=6;k("StructArrayLayout3ui6",gn);var xn=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,d,h,g){let v=this.length;return this.resize(v+1),this.emplace(v,e,r,n,i,o,a,s,l,u,c,p,f,y,m,d,h,g)}emplace(e,r,n,i,o,a,s,l,u,c,p,f,y,m,d,h,g,v){let b=e*24,x=e*12,P=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[x+2]=a,this.uint32[x+3]=s,this.uint32[x+4]=l,this.uint16[b+10]=u,this.uint16[b+11]=c,this.uint16[b+12]=p,this.float32[x+7]=f,this.float32[x+8]=y,this.uint8[P+36]=m,this.uint8[P+37]=d,this.uint8[P+38]=h,this.uint32[x+10]=g,this.int16[b+22]=v,e}};xn.prototype.bytesPerElement=48;k("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",xn);var bn=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,d,h,g,v,b,x,P,w,A,T,C,E,_,M){let F=this.length;return this.resize(F+1),this.emplace(F,e,r,n,i,o,a,s,l,u,c,p,f,y,m,d,h,g,v,b,x,P,w,A,T,C,E,_,M)}emplace(e,r,n,i,o,a,s,l,u,c,p,f,y,m,d,h,g,v,b,x,P,w,A,T,C,E,_,M,F){let I=e*34,z=e*17;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]=f,this.uint16[I+11]=y,this.uint16[I+12]=m,this.uint16[I+13]=d,this.uint16[I+14]=h,this.uint16[I+15]=g,this.uint16[I+16]=v,this.uint16[I+17]=b,this.uint16[I+18]=x,this.uint16[I+19]=P,this.uint16[I+20]=w,this.uint16[I+21]=A,this.uint16[I+22]=T,this.uint32[z+12]=C,this.float32[z+13]=E,this.float32[z+14]=_,this.float32[z+15]=M,this.float32[z+16]=F,e}};bn.prototype.bytesPerElement=68;k("StructArrayLayout8i15ui1ul4f68",bn);var Gt=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}};Gt.prototype.bytesPerElement=4;k("StructArrayLayout1f4",Gt);var vn=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}};vn.prototype.bytesPerElement=8;k("StructArrayLayout1ul2ui8",vn);var Pn=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}};Pn.prototype.bytesPerElement=4;k("StructArrayLayout2ui4",Pn);var Yi=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}};Yi.prototype.bytesPerElement=2;k("StructArrayLayout1ui2",Yi);var xr=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}};xr.prototype.bytesPerElement=16;k("StructArrayLayout4f16",xr);var Xi=class extends Ut{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 Mu.default(this.anchorPointX,this.anchorPointY)}};Xi.prototype.size=20;var Sn=class extends mn{get(e){return new Xi(this,e)}};k("CollisionBoxArray",Sn);var Qi=class extends Ut{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]}};Qi.prototype.size=48;var wn=class extends xn{get(e){return new Qi(this,e)}};k("PlacedSymbolArray",wn);var eo=class extends Ut{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 textOffset0(){return this._structArray.float32[this._pos4+14]}get textOffset1(){return this._structArray.float32[this._pos4+15]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+16]}};eo.prototype.size=68;var An=class extends bn{get(e){return new eo(this,e)}};k("SymbolInstanceArray",An);var _n=class extends Gt{getoffsetX(e){return this.float32[e*1+0]}};k("GlyphOffsetArray",_n);var In=class extends sn{getx(e){return this.int16[e*3+0]}gety(e){return this.int16[e*3+1]}gettileUnitDistanceFromAnchor(e){return this.int16[e*3+2]}};k("SymbolLineVertexArray",In);var to=class extends Ut{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]}};to.prototype.size=8;var Cn=class extends vn{get(e){return new to(this,e)}};k("FeatureIndexArray",Cn);var ro=class extends $t{};var no=class extends $t{},io=class extends $t{},oo=class extends ln{};var ao=class extends un{},so=class extends Pt{},lt=class extends cn{},lo=class extends pn{},uo=class extends fn{},co=class extends yn{},kn=class extends hn{};var po=class extends dn{};var Le=class extends gn{},St=class extends Pn{};var Zm=ee([{name:"a_pos",components:2,type:"Int16"}],4);var{members:Lu,size:y0,alignment:m0}=Zm;var me=class t{constructor(e=[]){this.segments=e}prepareSegment(e,r,n,i){let o=this.segments[this.segments.length-1];return e>t.MAX_VERTEX_ARRAY_LENGTH&&ce("Max vertices per segment is ".concat(t.MAX_VERTEX_ARRAY_LENGTH,": bucket requested ").concat(e)),(!o||o.vertexLength+e>t.MAX_VERTEX_ARRAY_LENGTH||o.sortKey!==i)&&(o={vertexOffset:r.length,primitiveOffset:n.length,vertexLength:0,primitiveLength:0},i!==void 0&&(o.sortKey=i),this.segments.push(o)),o}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}])}};me.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1;k("SegmentVector",me);function Qa(t,e){return t=rt(Math.floor(t),0,255),e=rt(Math.floor(e),0,255),256*t+e}var Tn=ee([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var Ru=Z(rs(),1);var En=class t{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,n,i){this.ids.push(zu(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=zu(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 ns(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 zu(t){let e=+t;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:(0,Ru.default)(String(t))}function ns(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;yo(t,o,a),yo(e,3*o,3*a),yo(e,3*o+1,3*a+1),yo(e,3*o+2,3*a+2)}a-r<n-a?(ns(t,e,r,a),r=a+1):(ns(t,e,a+1,n),n=a)}}function yo(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}k("FeaturePositionMap",En);var Fn=class{constructor(e,r){this.gl=e.gl,this.location=r}};var br=class extends Fn{constructor(e,r){super(e,r),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}};var mo=class extends Fn{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]))}},ho=class extends Fn{constructor(e,r){super(e,r),this.current=W.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))}},T0=new Float32Array(16);function is(t){return[Qa(255*t.r,255*t.g),Qa(255*t.b,255*t.a)]}var qt=class{constructor(e,r,n){this.value=e,this.uniformNames=r.map(i=>"u_".concat(i)),this.type=n}setUniform(e,r,n){e.set(n.constantOr(this.value))}getBinding(e,r,n){return this.type==="color"?new ho(e,r):new br(e,r)}},wt=class{constructor(e,r){this.uniformNames=r.map(n=>"u_".concat(n)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=e.tlbr}setUniform(e,r,n,i){let o=i==="u_pattern_to"?this.patternTo:i==="u_pattern_from"?this.patternFrom:i==="u_pixel_ratio_to"?this.pixelRatioTo:i==="u_pixel_ratio_from"?this.pixelRatioFrom:null;o&&e.set(o)}getBinding(e,r,n){return n.substr(0,9)==="u_pattern"?new mo(e,r):new br(e,r)}},Je=class{constructor(e,r,n,i){this.expression=e,this.type=n,this.maxValue=0,this.paintVertexAttributes=r.map(o=>({name:"a_".concat(o),type:"Float32",components:n==="color"?2:1,offset:0})),this.paintVertexArray=new i}populatePaintArray(e,r,n,i,o){let a=this.paintVertexArray.length,s=this.expression.evaluate(new q(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=is(n);for(let o=e;o<r;o++)this.paintVertexArray.emplace(o,i[0],i[1])}else{for(let i=e;i<r;i++)this.paintVertexArray.emplace(i,n);this.maxValue=Math.max(this.maxValue,Math.abs(n))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}},De=class{constructor(e,r,n,i,o,a){this.expression=e,this.uniformNames=r.map(s=>"u_".concat(s,"_t")),this.type=n,this.useIntegerZoom=i,this.zoom=o,this.maxValue=0,this.paintVertexAttributes=r.map(s=>({name:"a_".concat(s),type:"Float32",components:n==="color"?4:2,offset:0})),this.paintVertexArray=new a}populatePaintArray(e,r,n,i,o){let a=this.expression.evaluate(new q(this.zoom),r,{},i,[],o),s=this.expression.evaluate(new q(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=is(n),a=is(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=rt(this.expression.interpolationFactor(n,this.zoom,this.zoom+1),0,1);e.set(i)}getBinding(e,r,n){return new br(e,r)}},Xe=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,Tn.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,Tn.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}},go=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 be)||!ht(a.property.specification))continue;let s=Km(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 wt(l.value,s):new qt(l.value,s,u),i.push("/u_".concat(o));else if(l.kind==="source"||f){let y=Ou(o,u,"source");this.binders[o]=f?new Xe(l,u,c,r,y,e.id):new Je(l,s,u,y),i.push("/a_".concat(o))}else{let y=Ou(o,u,"composite");this.binders[o]=new De(l,s,u,c,r,y),i.push("/z_".concat(o))}}this.cacheKey=i.sort().join("")}getMaxValue(e){let r=this.binders[e];return r instanceof Je||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 Je||s instanceof De||s instanceof Xe)&&s.populatePaintArray(e,r,n,i,o)}}setConstantPatternPositions(e,r){for(let n in this.binders){let i=this.binders[n];i instanceof wt&&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 Je||f instanceof De||f instanceof Xe)&&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 qt||n instanceof wt)&&e.push(...n.uniformNames.map(i=>"#define HAS_UNIFORM_".concat(i)))}return e}getBinderAttributes(){let e=[];for(let r in this.binders){let n=this.binders[r];if(n instanceof Je||n instanceof De)for(let i=0;i<n.paintVertexAttributes.length;i++)e.push(n.paintVertexAttributes[i].name);else if(n instanceof Xe)for(let i=0;i<Tn.members.length;i++)e.push(Tn.members[i].name)}return e}getBinderUniforms(){let e=[];for(let r in this.binders){let n=this.binders[r];if(n instanceof qt||n instanceof wt||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 qt||o instanceof wt||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 Xe){let i=e.fromScale===2?n.zoomInPaintVertexBuffer:n.zoomOutPaintVertexBuffer;i&&this._buffers.push(i)}else(n instanceof Je||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 Je||n instanceof De||n instanceof Xe)&&n.upload(e)}this.updatePaintBuffers()}destroy(){for(let e in this.binders){let r=this.binders[e];(r instanceof Je||r instanceof De||r instanceof Xe)&&r.destroy()}}},ke=class{constructor(e,r,n=()=>!0){this.programConfigurations={};for(let i of e)this.programConfigurations[i.id]=new go(i,r,n);this.needsUpload=!1,this._featureMap=new En,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 Km(t,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[t]||[t.replace("".concat(e,"-"),"").replace(/-/g,"_")]}function Ym(t){return{"line-pattern":{source:lt,composite:lt},"fill-pattern":{source:lt,composite:lt},"fill-extrusion-pattern":{source:lt,composite:lt}}[t]}function Ou(t,e,r){let n={color:{source:Pt,composite:xr},number:{source:Gt,composite:Pt}},i=Ym(t);return i&&i[r]||n[e][r]}k("ConstantBinder",qt);k("CrossFadedConstantBinder",wt);k("SourceExpressionBinder",Je);k("CrossFadedCompositeBinder",Xe);k("CompositeExpressionBinder",De);k("ProgramConfiguration",go,{omit:["_buffers"]});k("ProgramConfigurationSet",ke);var Xm=15,os=Math.pow(2,Xm-1)-1,Nu=-os-1;function Te(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=rt(s,Nu,os),a.y=rt(l,Nu,os),(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 Oe(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?Te(t):[]}}function xo(t,e,r,n,i){t.emplaceBack(e*2+(n+1)/2,r*2+(i+1)/2)}var jt=class{constructor(e){this.zoom=e.zoom,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 no,this.indexArray=new Le,this.segments=new me,this.programConfigurations=new ke(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;i.type==="circle"&&(a=i.layout.get("circle-sort-key"),s=!a.isConstant());for(let{feature:l,id:u,index:c,sourceLayerIndex:p}of e){let f=this.layers[0]._featureFilter.needGeometry,y=Oe(l,f);if(!this.layers[0]._featureFilter.filter(new q(this.zoom),y,n))continue;let m=s?a.evaluate(y,{},n):void 0,d={id:u,properties:l.properties,type:l.type,sourceLayerIndex:p,index:c,geometry:f?y.geometry:Te(l),patterns:{},sortKey:m};o.push(d)}s&&o.sort((l,u)=>l.sortKey-u.sortKey);for(let l of o){let{geometry:u,index:c,sourceLayerIndex:p}=l,f=e[c].feature;this.addFeature(l,u,c,n),r.featureIndex.insert(f,u,c,p,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,Lu),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){for(let o of r)for(let a of o){let s=a.x,l=a.y;if(s<0||s>=8192||l<0||l>=8192)continue;let u=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),c=u.vertexLength;xo(this.layoutVertexArray,s,l,-1,-1),xo(this.layoutVertexArray,s,l,1,-1),xo(this.layoutVertexArray,s,l,1,1),xo(this.layoutVertexArray,s,l,-1,1),this.indexArray.emplaceBack(c,c+1,c+2),this.indexArray.emplaceBack(c,c+3,c+2),u.vertexLength+=4,u.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,{},i)}};k("CircleBucket",jt,{omit:["layers"]});var Mn=Z(he(),1);function $u(t,e){for(let r=0;r<t.length;r++)if(vr(e,t[r]))return!0;for(let r=0;r<e.length;r++)if(vr(t,e[r]))return!0;return!!ss(t,e)}function Gu(t,e,r){return!!(vr(t,e)||as(e,t,r))}function bo(t,e){if(t.length===1)return Uu(e,t[0]);for(let r=0;r<e.length;r++){let n=e[r];for(let i=0;i<n.length;i++)if(vr(t,n[i]))return!0}for(let r=0;r<t.length;r++)if(Uu(e,t[r]))return!0;for(let r=0;r<e.length;r++)if(ss(t,e[r]))return!0;return!1}function qu(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(vr(t,i[o]))return!0}if(Qm(t,i,r))return!0}return!1}function Qm(t,e,r){if(t.length>1){if(ss(t,e))return!0;for(let n=0;n<e.length;n++)if(as(e[n],t,r))return!0}for(let n=0;n<t.length;n++)if(as(t[n],e,r))return!0;return!1}function ss(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(eh(n,i,a,s))return!0}}return!1}function eh(t,e,r,n){return nt(t,r,n)!==nt(e,r,n)&&nt(t,e,r)!==nt(t,e,n)}function as(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(ls(t,o,a)<n)return!0}return!1}function ls(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 Uu(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 vr(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 ju(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 Mn.default(e,r),new Mn.default(e,i),new Mn.default(n,i),new Mn.default(n,r)];if(t.length>2){for(let a of o)if(vr(t,a))return!0}for(let a=0;a<t.length-1;a++){let s=t[a],l=t[a+1];if(th(s,l,o))return!0}return!1}function th(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=nt(t,e,r[0]);return o!==nt(t,e,r[1])||o!==nt(t,e,r[2])||o!==nt(t,e,r[3])}var vo=Z(he(),1);function Zt(t,e,r){let n=e.paint.get(t).value;return n.kind==="constant"?n.value:r.programConfigurations.get(e.id).getMaxValue(t)}function At(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function _t(t,e,r,n,i){if(!e[0]&&!e[1])return t;let o=vo.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 Zu(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 vo.default(0,0):l.sub(s)._unit()._perp(),p=a===i.length-1?new vo.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 Ju,rh=()=>Ju=Ju||new ie({"circle-sort-key":new R(S.layout_circle["circle-sort-key"])}),Wu,nh=()=>Wu=Wu||new ie({"circle-radius":new R(S.paint_circle["circle-radius"]),"circle-color":new R(S.paint_circle["circle-color"]),"circle-blur":new R(S.paint_circle["circle-blur"]),"circle-opacity":new R(S.paint_circle["circle-opacity"]),"circle-translate":new B(S.paint_circle["circle-translate"]),"circle-translate-anchor":new B(S.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new B(S.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new B(S.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new R(S.paint_circle["circle-stroke-width"]),"circle-stroke-color":new R(S.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new R(S.paint_circle["circle-stroke-opacity"])}),Hu={get paint(){return nh()},get layout(){return rh()}};var X=1e-6,Ne=typeof Float32Array<"u"?Float32Array:Array,Ln=Math.random;var Pv=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 Dn={};sl(Dn,{add:()=>Uh,adjoint:()=>ph,clone:()=>oh,copy:()=>ah,create:()=>ih,determinant:()=>fh,equals:()=>jh,exactEquals:()=>qh,frob:()=>Nh,fromQuat:()=>Eh,fromQuat2:()=>_h,fromRotation:()=>Ph,fromRotationTranslation:()=>Qu,fromRotationTranslationScale:()=>kh,fromRotationTranslationScaleOrigin:()=>Th,fromScaling:()=>vh,fromTranslation:()=>bh,fromValues:()=>sh,fromXRotation:()=>Sh,fromYRotation:()=>wh,fromZRotation:()=>Ah,frustum:()=>Fh,getRotation:()=>Ch,getScaling:()=>ec,getTranslation:()=>Ih,identity:()=>Yu,invert:()=>ch,lookAt:()=>zh,mul:()=>Zh,multiply:()=>Xu,multiplyScalar:()=>$h,multiplyScalarAndAdd:()=>Gh,ortho:()=>Vh,orthoNO:()=>rc,orthoZO:()=>Bh,perspective:()=>Mh,perspectiveFromFieldOfView:()=>Dh,perspectiveNO:()=>tc,perspectiveZO:()=>Lh,rotate:()=>hh,rotateX:()=>dh,rotateY:()=>gh,rotateZ:()=>xh,scale:()=>mh,set:()=>lh,str:()=>Oh,sub:()=>Jh,subtract:()=>nc,targetTo:()=>Rh,translate:()=>yh,transpose:()=>uh});function ih(){var t=new Ne(16);return Ne!=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 oh(t){var e=new Ne(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 ah(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 sh(t,e,r,n,i,o,a,s,l,u,c,p,f,y,m,d){var h=new Ne(16);return h[0]=t,h[1]=e,h[2]=r,h[3]=n,h[4]=i,h[5]=o,h[6]=a,h[7]=s,h[8]=l,h[9]=u,h[10]=c,h[11]=p,h[12]=f,h[13]=y,h[14]=m,h[15]=d,h}function lh(t,e,r,n,i,o,a,s,l,u,c,p,f,y,m,d,h){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]=f,t[12]=y,t[13]=m,t[14]=d,t[15]=h,t}function Yu(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 uh(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 ch(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],f=e[10],y=e[11],m=e[12],d=e[13],h=e[14],g=e[15],v=r*s-n*a,b=r*l-i*a,x=r*u-o*a,P=n*l-i*s,w=n*u-o*s,A=i*u-o*l,T=c*d-p*m,C=c*h-f*m,E=c*g-y*m,_=p*h-f*d,M=p*g-y*d,F=f*g-y*h,I=v*F-b*M+x*_+P*E-w*C+A*T;return I?(I=1/I,t[0]=(s*F-l*M+u*_)*I,t[1]=(i*M-n*F-o*_)*I,t[2]=(d*A-h*w+g*P)*I,t[3]=(f*w-p*A-y*P)*I,t[4]=(l*E-a*F-u*C)*I,t[5]=(r*F-i*E+o*C)*I,t[6]=(h*x-m*A-g*b)*I,t[7]=(c*A-f*x+y*b)*I,t[8]=(a*M-s*E+u*T)*I,t[9]=(n*E-r*M-o*T)*I,t[10]=(m*w-d*x+g*v)*I,t[11]=(p*x-c*w-y*v)*I,t[12]=(s*C-a*_-l*T)*I,t[13]=(r*_-n*C+i*T)*I,t[14]=(d*b-m*P-h*v)*I,t[15]=(c*P-p*b+f*v)*I,t):null}function ph(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],f=e[10],y=e[11],m=e[12],d=e[13],h=e[14],g=e[15];return t[0]=s*(f*g-y*h)-p*(l*g-u*h)+d*(l*y-u*f),t[1]=-(n*(f*g-y*h)-p*(i*g-o*h)+d*(i*y-o*f)),t[2]=n*(l*g-u*h)-s*(i*g-o*h)+d*(i*u-o*l),t[3]=-(n*(l*y-u*f)-s*(i*y-o*f)+p*(i*u-o*l)),t[4]=-(a*(f*g-y*h)-c*(l*g-u*h)+m*(l*y-u*f)),t[5]=r*(f*g-y*h)-c*(i*g-o*h)+m*(i*y-o*f),t[6]=-(r*(l*g-u*h)-a*(i*g-o*h)+m*(i*u-o*l)),t[7]=r*(l*y-u*f)-a*(i*y-o*f)+c*(i*u-o*l),t[8]=a*(p*g-y*d)-c*(s*g-u*d)+m*(s*y-u*p),t[9]=-(r*(p*g-y*d)-c*(n*g-o*d)+m*(n*y-o*p)),t[10]=r*(s*g-u*d)-a*(n*g-o*d)+m*(n*u-o*s),t[11]=-(r*(s*y-u*p)-a*(n*y-o*p)+c*(n*u-o*s)),t[12]=-(a*(p*h-f*d)-c*(s*h-l*d)+m*(s*f-l*p)),t[13]=r*(p*h-f*d)-c*(n*h-i*d)+m*(n*f-i*p),t[14]=-(r*(s*h-l*d)-a*(n*h-i*d)+m*(n*l-i*s)),t[15]=r*(s*f-l*p)-a*(n*f-i*p)+c*(n*l-i*s),t}function fh(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],f=t[11],y=t[12],m=t[13],d=t[14],h=t[15],g=e*a-r*o,v=e*s-n*o,b=e*l-i*o,x=r*s-n*a,P=r*l-i*a,w=n*l-i*s,A=u*m-c*y,T=u*d-p*y,C=u*h-f*y,E=c*d-p*m,_=c*h-f*m,M=p*h-f*d;return g*M-v*_+b*E+x*C-P*T+w*A}function Xu(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],f=e[9],y=e[10],m=e[11],d=e[12],h=e[13],g=e[14],v=e[15],b=r[0],x=r[1],P=r[2],w=r[3];return t[0]=b*n+x*s+P*p+w*d,t[1]=b*i+x*l+P*f+w*h,t[2]=b*o+x*u+P*y+w*g,t[3]=b*a+x*c+P*m+w*v,b=r[4],x=r[5],P=r[6],w=r[7],t[4]=b*n+x*s+P*p+w*d,t[5]=b*i+x*l+P*f+w*h,t[6]=b*o+x*u+P*y+w*g,t[7]=b*a+x*c+P*m+w*v,b=r[8],x=r[9],P=r[10],w=r[11],t[8]=b*n+x*s+P*p+w*d,t[9]=b*i+x*l+P*f+w*h,t[10]=b*o+x*u+P*y+w*g,t[11]=b*a+x*c+P*m+w*v,b=r[12],x=r[13],P=r[14],w=r[15],t[12]=b*n+x*s+P*p+w*d,t[13]=b*i+x*l+P*f+w*h,t[14]=b*o+x*u+P*y+w*g,t[15]=b*a+x*c+P*m+w*v,t}function yh(t,e,r){var n=r[0],i=r[1],o=r[2],a,s,l,u,c,p,f,y,m,d,h,g;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],f=e[6],y=e[7],m=e[8],d=e[9],h=e[10],g=e[11],t[0]=a,t[1]=s,t[2]=l,t[3]=u,t[4]=c,t[5]=p,t[6]=f,t[7]=y,t[8]=m,t[9]=d,t[10]=h,t[11]=g,t[12]=a*n+c*i+m*o+e[12],t[13]=s*n+p*i+d*o+e[13],t[14]=l*n+f*i+h*o+e[14],t[15]=u*n+y*i+g*o+e[15]),t}function mh(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 hh(t,e,r,n){var i=n[0],o=n[1],a=n[2],s=Math.hypot(i,o,a),l,u,c,p,f,y,m,d,h,g,v,b,x,P,w,A,T,C,E,_,M,F,I,z;return s<X?null:(s=1/s,i*=s,o*=s,a*=s,l=Math.sin(r),u=Math.cos(r),c=1-u,p=e[0],f=e[1],y=e[2],m=e[3],d=e[4],h=e[5],g=e[6],v=e[7],b=e[8],x=e[9],P=e[10],w=e[11],A=i*i*c+u,T=o*i*c+a*l,C=a*i*c-o*l,E=i*o*c-a*l,_=o*o*c+u,M=a*o*c+i*l,F=i*a*c+o*l,I=o*a*c-i*l,z=a*a*c+u,t[0]=p*A+d*T+b*C,t[1]=f*A+h*T+x*C,t[2]=y*A+g*T+P*C,t[3]=m*A+v*T+w*C,t[4]=p*E+d*_+b*M,t[5]=f*E+h*_+x*M,t[6]=y*E+g*_+P*M,t[7]=m*E+v*_+w*M,t[8]=p*F+d*I+b*z,t[9]=f*F+h*I+x*z,t[10]=y*F+g*I+P*z,t[11]=m*F+v*I+w*z,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)}function dh(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],f=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+f*n,t[8]=u*i-o*n,t[9]=c*i-a*n,t[10]=p*i-s*n,t[11]=f*i-l*n,t}function gh(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],f=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-f*n,t[8]=o*n+u*i,t[9]=a*n+c*i,t[10]=s*n+p*i,t[11]=l*n+f*i,t}function xh(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],f=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+f*n,t[4]=u*i-o*n,t[5]=c*i-a*n,t[6]=p*i-s*n,t[7]=f*i-l*n,t}function bh(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 vh(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 Ph(t,e,r){var n=r[0],i=r[1],o=r[2],a=Math.hypot(n,i,o),s,l,u;return a<X?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 Sh(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 wh(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 Ah(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 Qu(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,f=n*u,y=i*l,m=i*u,d=o*u,h=a*s,g=a*l,v=a*u;return t[0]=1-(y+d),t[1]=p+v,t[2]=f-g,t[3]=0,t[4]=p-v,t[5]=1-(c+d),t[6]=m+h,t[7]=0,t[8]=f+g,t[9]=m-h,t[10]=1-(c+y),t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t}function _h(t,e){var r=new Ne(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),Qu(t,e,r),t}function Ih(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t}function ec(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 Ch(t,e){var r=new Ne(3);ec(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,f=e[8]*n,y=e[9]*i,m=e[10]*o,d=a+c+m,h=0;return d>0?(h=Math.sqrt(d+1)*2,t[3]=.25*h,t[0]=(p-y)/h,t[1]=(f-l)/h,t[2]=(s-u)/h):a>c&&a>m?(h=Math.sqrt(1+a-c-m)*2,t[3]=(p-y)/h,t[0]=.25*h,t[1]=(s+u)/h,t[2]=(f+l)/h):c>m?(h=Math.sqrt(1+c-a-m)*2,t[3]=(f-l)/h,t[0]=(s+u)/h,t[1]=.25*h,t[2]=(p+y)/h):(h=Math.sqrt(1+m-a-c)*2,t[3]=(s-u)/h,t[0]=(f+l)/h,t[1]=(p+y)/h,t[2]=.25*h),t}function kh(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,f=i*u,y=i*c,m=o*u,d=o*c,h=a*c,g=s*l,v=s*u,b=s*c,x=n[0],P=n[1],w=n[2];return t[0]=(1-(m+h))*x,t[1]=(f+b)*x,t[2]=(y-v)*x,t[3]=0,t[4]=(f-b)*P,t[5]=(1-(p+h))*P,t[6]=(d+g)*P,t[7]=0,t[8]=(y+v)*w,t[9]=(d-g)*w,t[10]=(1-(p+m))*w,t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t}function Th(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,f=o*u,y=o*c,m=o*p,d=a*c,h=a*p,g=s*p,v=l*u,b=l*c,x=l*p,P=n[0],w=n[1],A=n[2],T=i[0],C=i[1],E=i[2],_=(1-(d+g))*P,M=(y+x)*P,F=(m-b)*P,I=(y-x)*w,z=(1-(f+g))*w,O=(h+v)*w,N=(m+b)*A,K=(h-v)*A,Y=(1-(f+d))*A;return t[0]=_,t[1]=M,t[2]=F,t[3]=0,t[4]=I,t[5]=z,t[6]=O,t[7]=0,t[8]=N,t[9]=K,t[10]=Y,t[11]=0,t[12]=r[0]+T-(_*T+I*C+N*E),t[13]=r[1]+C-(M*T+z*C+K*E),t[14]=r[2]+E-(F*T+O*C+Y*E),t[15]=1,t}function Eh(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,f=i*a,y=i*s,m=i*l,d=o*a,h=o*s,g=o*l;return t[0]=1-p-m,t[1]=c+g,t[2]=f-h,t[3]=0,t[4]=c-g,t[5]=1-u-m,t[6]=y+d,t[7]=0,t[8]=f+h,t[9]=y-d,t[10]=1-u-p,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Fh(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 tc(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 Mh=tc;function Lh(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 Dh(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 rc(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 Vh=rc;function Bh(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 zh(t,e,r,n){var i,o,a,s,l,u,c,p,f,y,m=e[0],d=e[1],h=e[2],g=n[0],v=n[1],b=n[2],x=r[0],P=r[1],w=r[2];return Math.abs(m-x)<X&&Math.abs(d-P)<X&&Math.abs(h-w)<X?Yu(t):(c=m-x,p=d-P,f=h-w,y=1/Math.hypot(c,p,f),c*=y,p*=y,f*=y,i=v*f-b*p,o=b*c-g*f,a=g*p-v*c,y=Math.hypot(i,o,a),y?(y=1/y,i*=y,o*=y,a*=y):(i=0,o=0,a=0),s=p*a-f*o,l=f*i-c*a,u=c*o-p*i,y=Math.hypot(s,l,u),y?(y=1/y,s*=y,l*=y,u*=y):(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]=f,t[11]=0,t[12]=-(i*m+o*d+a*h),t[13]=-(s*m+l*d+u*h),t[14]=-(c*m+p*d+f*h),t[15]=1,t)}function Rh(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],f=a-r[2],y=c*c+p*p+f*f;y>0&&(y=1/Math.sqrt(y),c*=y,p*=y,f*=y);var m=l*f-u*p,d=u*c-s*f,h=s*p-l*c;return y=m*m+d*d+h*h,y>0&&(y=1/Math.sqrt(y),m*=y,d*=y,h*=y),t[0]=m,t[1]=d,t[2]=h,t[3]=0,t[4]=p*h-f*d,t[5]=f*m-c*h,t[6]=c*d-p*m,t[7]=0,t[8]=c,t[9]=p,t[10]=f,t[11]=0,t[12]=i,t[13]=o,t[14]=a,t[15]=1,t}function Oh(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 Nh(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 Uh(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 nc(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 $h(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 Gh(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 qh(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 jh(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],f=t[10],y=t[11],m=t[12],d=t[13],h=t[14],g=t[15],v=e[0],b=e[1],x=e[2],P=e[3],w=e[4],A=e[5],T=e[6],C=e[7],E=e[8],_=e[9],M=e[10],F=e[11],I=e[12],z=e[13],O=e[14],N=e[15];return Math.abs(r-v)<=X*Math.max(1,Math.abs(r),Math.abs(v))&&Math.abs(n-b)<=X*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(i-x)<=X*Math.max(1,Math.abs(i),Math.abs(x))&&Math.abs(o-P)<=X*Math.max(1,Math.abs(o),Math.abs(P))&&Math.abs(a-w)<=X*Math.max(1,Math.abs(a),Math.abs(w))&&Math.abs(s-A)<=X*Math.max(1,Math.abs(s),Math.abs(A))&&Math.abs(l-T)<=X*Math.max(1,Math.abs(l),Math.abs(T))&&Math.abs(u-C)<=X*Math.max(1,Math.abs(u),Math.abs(C))&&Math.abs(c-E)<=X*Math.max(1,Math.abs(c),Math.abs(E))&&Math.abs(p-_)<=X*Math.max(1,Math.abs(p),Math.abs(_))&&Math.abs(f-M)<=X*Math.max(1,Math.abs(f),Math.abs(M))&&Math.abs(y-F)<=X*Math.max(1,Math.abs(y),Math.abs(F))&&Math.abs(m-I)<=X*Math.max(1,Math.abs(m),Math.abs(I))&&Math.abs(d-z)<=X*Math.max(1,Math.abs(d),Math.abs(z))&&Math.abs(h-O)<=X*Math.max(1,Math.abs(h),Math.abs(O))&&Math.abs(g-N)<=X*Math.max(1,Math.abs(g),Math.abs(N))}var Zh=Xu,Jh=nc;var Jt={};sl(Jt,{add:()=>Xh,ceil:()=>Qh,clone:()=>Wh,copy:()=>Kh,create:()=>ic,cross:()=>cd,dist:()=>Sd,distance:()=>lc,div:()=>Pd,divide:()=>sc,dot:()=>ud,equals:()=>xd,exactEquals:()=>gd,floor:()=>ed,forEach:()=>Id,fromValues:()=>Hh,inverse:()=>sd,len:()=>Ad,length:()=>cc,lerp:()=>pd,max:()=>rd,min:()=>td,mul:()=>vd,multiply:()=>ac,negate:()=>ad,normalize:()=>ld,random:()=>fd,round:()=>nd,scale:()=>id,scaleAndAdd:()=>od,set:()=>Yh,sqrDist:()=>wd,sqrLen:()=>_d,squaredDistance:()=>uc,squaredLength:()=>pc,str:()=>dd,sub:()=>bd,subtract:()=>oc,transformMat4:()=>yd,transformQuat:()=>md,zero:()=>hd});function ic(){var t=new Ne(4);return Ne!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function Wh(t){var e=new Ne(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function Hh(t,e,r,n){var i=new Ne(4);return i[0]=t,i[1]=e,i[2]=r,i[3]=n,i}function Kh(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function Yh(t,e,r,n,i){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t}function Xh(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 oc(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 ac(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 sc(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 Qh(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 ed(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 td(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 rd(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 nd(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 id(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 od(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 lc(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 uc(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 cc(t){var e=t[0],r=t[1],n=t[2],i=t[3];return Math.hypot(e,r,n,i)}function pc(t){var e=t[0],r=t[1],n=t[2],i=t[3];return e*e+r*r+n*n+i*i}function ad(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t}function sd(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 ld(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 ud(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}function cd(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 pd(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 fd(t,e){e=e||1;var r,n,i,o,a,s;do r=Ln()*2-1,n=Ln()*2-1,a=r*r+n*n;while(a>=1);do i=Ln()*2-1,o=Ln()*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 yd(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 md(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 hd(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t}function dd(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}function gd(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]}function xd(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)<=X*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(n-s)<=X*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-l)<=X*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(o-u)<=X*Math.max(1,Math.abs(o),Math.abs(u))}var bd=oc,vd=ac,Pd=sc,Sd=lc,wd=uc,Ad=cc,_d=pc,Id=function(){var t=ic();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}}();var fc=Z(he(),1),Po=class extends le{constructor(e){super(e,Hu)}createBucket(e){return new jt(e)}queryRadius(e){let r=e;return Zt("circle-radius",this,r)+Zt("circle-stroke-width",this,r)+At(this.paint.get("circle-translate"))}queryIntersectsFeature(e,r,n,i,o,a,s,l){let u=_t(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),a.angle,s),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:Cd(u,l),d=y?f*s:f;for(let h of i)for(let g of h){let v=y?g:yc(g,l),b=d,x=Jt.transformMat4([],[g.x,g.y,0,1],l);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?b*=x[3]/a.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(b*=a.cameraToCenterDistance/x[3]),Gu(m,v,b))return!0}return!1}};function yc(t,e){let r=Jt.transformMat4([],[t.x,t.y,0,1],e);return new fc.default(r[0]/r[3],r[1]/r[3])}function Cd(t,e){return t.map(r=>yc(r,e))}var Vn=class extends jt{};k("HeatmapBucket",Vn,{omit:["layers"]});var mc,kd=()=>mc=mc||new ie({"heatmap-radius":new R(S.paint_heatmap["heatmap-radius"]),"heatmap-weight":new R(S.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new B(S.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Nt(S.paint_heatmap["heatmap-color"]),"heatmap-opacity":new B(S.paint_heatmap["heatmap-opacity"])}),hc={get paint(){return kd()}};function us(t,{width:e,height:r},n,i){if(!i)i=new Uint8Array(e*r*n);else if(i instanceof Uint8ClampedArray)i=new Uint8Array(i.buffer);else if(i.length!==e*r*n)throw new RangeError("mismatched image size. expected: ".concat(i.length," but got: ").concat(e*r*n));return t.width=e,t.height=r,t.data=i,t}function dc(t,{width:e,height:r},n){if(e===t.width&&r===t.height)return;let i=us({},{width:e,height:r},n);cs(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 cs(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 Wt=class t{constructor(e,r){us(this,e,1,r)}resize(e){dc(this,e,1)}clone(){return new t({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,n,i,o){cs(e,r,n,i,o,1)}},de=class t{constructor(e,r){us(this,e,4,r)}resize(e){dc(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){cs(e,r,n,i,o,4)}};k("AlphaImage",Wt);k("RGBAImage",de);function gc(t){let e={},r=t.resolution||256,n=t.clips?t.clips.length:1,i=t.image||new de({width:r,height:n});if(!hl(r))throw new Error("width is not a power of 2 - ".concat(r));let o=(a,s,l)=>{e[t.evaluationKey]=l;let u=t.expression.evaluate(e);i.data[a+s+0]=Math.floor(u.r*255/u.a),i.data[a+s+1]=Math.floor(u.g*255/u.a),i.data[a+s+2]=Math.floor(u.b*255/u.a),i.data[a+s+3]=Math.floor(u.a*255)};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 So=class extends le{createBucket(e){return new Vn(e)}constructor(e){super(e,hc),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){e==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){let e=this._transitionablePaint._values["heatmap-color"].value.expression;this.colorRamp=gc({expression:e,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}};var xc,Td=()=>xc=xc||new ie({"hillshade-illumination-direction":new B(S.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new B(S.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new B(S.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new B(S.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new B(S.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new B(S.paint_hillshade["hillshade-accent-color"])}),bc={get paint(){return Td()}};var wo=class extends le{constructor(e){super(e,bc)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}};var Ed=ee([{name:"a_pos",components:2,type:"Int16"}],4);var{members:vc,size:m1,alignment:h1}=Ed;var Ic=Z(hs(),1);function ds(t,e,r,n,i){_c(t,e,r||0,n||t.length-1,i||Zd)}function _c(t,e,r,n,i){for(;n>r;){if(n-r>600){var o=n-r+1,a=e-r+1,s=Math.log(o),l=.5*Math.exp(2*s/3),u=.5*Math.sqrt(s*l*(o-l)/o)*(a-o/2<0?-1:1),c=Math.max(r,Math.floor(e-a*l/o+u)),p=Math.min(n,Math.floor(e+(o-a)*l/o+u));_c(t,e,c,p,i)}var f=t[e],y=r,m=n;for(On(t,r,e),i(t[n],f)>0&&On(t,r,n);y<m;){for(On(t,y,m),y++,m--;i(t[y],f)<0;)y++;for(;i(t[m],f)>0;)m--}i(t[r],f)===0?On(t,r,m):(m++,On(t,m,n)),m<=e&&(r=m+1),e<=m&&(n=m-1)}}function On(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function Zd(t,e){return t<e?-1:t>e?1:0}function Sr(t,e){let r=t.length;if(r<=1)return[t];let n=[],i,o;for(let a=0;a<r;a++){let s=xl(t[a]);s!==0&&(t[a].area=Math.abs(s),o===void 0&&(o=s<0),o===s<0?(i&&n.push(i),i=[t[a]]):i.push(t[a]))}if(i&&n.push(i),e>1)for(let a=0;a<n.length;a++)n[a].length<=e||(ds(n[a],e,1,n[a].length-1,Jd),n[a]=n[a].slice(0,e));return n}function Jd(t,e){return e.area-t.area}function wr(t,e,r){let n=r.patternDependencies,i=!1;for(let o of e){let a=o.paint.get("".concat(t,"-pattern"));a.isConstant()||(i=!0);let s=a.constantOr(null);s&&(i=!0,n[s.to]=!0,n[s.from]=!0)}return i}function Ar(t,e,r,n,i){let o=i.patternDependencies;for(let a of e){let l=a.paint.get("".concat(t,"-pattern")).value;if(l.kind!=="constant"){let u=l.evaluate({zoom:n-1},r,{},i.availableImages),c=l.evaluate({zoom:n},r,{},i.availableImages),p=l.evaluate({zoom:n+1},r,{},i.availableImages);u=u&&u.name?u.name:u,c=c&&c.name?c.name:c,p=p&&p.name?p.name:p,o[u]=!0,o[c]=!0,o[p]=!0,r.patterns[a.id]={min:u,mid:c,max:p}}}return r}var Wd=500,Kt=class{constructor(e){this.zoom=e.zoom,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 io,this.indexArray=new Le,this.indexArray2=new St,this.programConfigurations=new ke(e.layers,e.zoom),this.segments=new me,this.segments2=new me,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,n){this.hasPattern=wr("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=Oe(s,p);if(!this.layers[0]._featureFilter.filter(new q(this.zoom),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:Te(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=Ar("fill",this.layers,s,this.zoom,r);this.patternFeatures.push(f)}else this.addFeature(s,l,u,n,{});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)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,vc),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){for(let a of Sr(r,Wd)){let s=0;for(let y of a)s+=y.length;let l=this.segments.prepareSegment(s,this.layoutVertexArray,this.indexArray),u=l.vertexLength,c=[],p=[];for(let y of a){if(y.length===0)continue;y!==a[0]&&p.push(c.length/2);let m=this.segments2.prepareSegment(y.length,this.layoutVertexArray,this.indexArray2),d=m.vertexLength;this.layoutVertexArray.emplaceBack(y[0].x,y[0].y),this.indexArray2.emplaceBack(d+y.length-1,d),c.push(y[0].x),c.push(y[0].y);for(let h=1;h<y.length;h++)this.layoutVertexArray.emplaceBack(y[h].x,y[h].y),this.indexArray2.emplaceBack(d+h-1,d+h),c.push(y[h].x),c.push(y[h].y);m.vertexLength+=y.length,m.primitiveLength+=y.length}let f=(0,Ic.default)(c,p);for(let y=0;y<f.length;y+=3)this.indexArray.emplaceBack(u+f[y],u+f[y+1],u+f[y+2]);l.vertexLength+=s,l.primitiveLength+=f.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,o,i)}};k("FillBucket",Kt,{omit:["layers","patternFeatures"]});var Cc,Hd=()=>Cc=Cc||new ie({"fill-sort-key":new R(S.layout_fill["fill-sort-key"])}),kc,Kd=()=>kc=kc||new ie({"fill-antialias":new B(S.paint_fill["fill-antialias"]),"fill-opacity":new R(S.paint_fill["fill-opacity"]),"fill-color":new R(S.paint_fill["fill-color"]),"fill-outline-color":new R(S.paint_fill["fill-outline-color"]),"fill-translate":new B(S.paint_fill["fill-translate"]),"fill-translate-anchor":new B(S.paint_fill["fill-translate-anchor"]),"fill-pattern":new st(S.paint_fill["fill-pattern"])}),Tc={get paint(){return Kd()},get layout(){return Hd()}};var ko=class extends le{constructor(e){super(e,Tc)}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 Kt(e)}queryRadius(){return At(this.paint.get("fill-translate"))}queryIntersectsFeature(e,r,n,i,o,a,s){let l=_t(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),a.angle,s);return bo(l,i)}isTileClipped(){return!0}};var Yd=ee([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Ec=ee([{name:"a_centroid",components:2,type:"Int16"}],4);var{members:Fc,size:Y1,alignment:X1}=Yd;var zc=Z(hs(),1),Rc=Z(It(),1);var ug=Rc.default.VectorTileFeature.types,cg=500,bs=Math.pow(2,13);function Nn(t,e,r,n,i,o,a,s){t.emplaceBack(e,r,Math.floor(n*bs)*2+a,i*bs*2,o*bs*2,Math.round(s))}var Yt=class{constructor(e){this.zoom=e.zoom,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 oo,this.centroidVertexArray=new ro,this.indexArray=new Le,this.programConfigurations=new ke(e.layers,e.zoom),this.segments=new me,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,n){this.features=[],this.hasPattern=wr("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=Oe(i,l);if(!this.layers[0]._featureFilter.filter(new q(this.zoom),u,n))continue;let c={id:o,sourceLayerIndex:s,index:a,geometry:l?u.geometry:Te(i),properties:i.properties,type:i.type,patterns:{}};this.hasPattern?this.features.push(Ar("fill-extrusion",this.layers,c,this.zoom,r)):this.addFeature(c,c.geometry,a,n,{}),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)}}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,Fc),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,Ec.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){let a={x:0,y:0,vertexCount:0};for(let s of Sr(r,cg)){let l=0;for(let m of s)l+=m.length;let u=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(let m of s){if(m.length===0||fg(m))continue;let d=0;for(let h=0;h<m.length;h++){let g=m[h];if(h>=1){let v=m[h-1];if(!pg(g,v)){u.vertexLength+4>me.MAX_VERTEX_ARRAY_LENGTH&&(u=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let b=g.sub(v)._perp()._unit(),x=v.dist(g);d+x>32768&&(d=0),Nn(this.layoutVertexArray,g.x,g.y,b.x,b.y,0,0,d),Nn(this.layoutVertexArray,g.x,g.y,b.x,b.y,0,1,d),a.x+=2*g.x,a.y+=2*g.y,a.vertexCount+=2,d+=x,Nn(this.layoutVertexArray,v.x,v.y,b.x,b.y,0,0,d),Nn(this.layoutVertexArray,v.x,v.y,b.x,b.y,0,1,d),a.x+=2*v.x,a.y+=2*v.y,a.vertexCount+=2;let P=u.vertexLength;this.indexArray.emplaceBack(P,P+2,P+1),this.indexArray.emplaceBack(P+1,P+2,P+3),u.vertexLength+=4,u.primitiveLength+=2}}}}if(u.vertexLength+l>me.MAX_VERTEX_ARRAY_LENGTH&&(u=this.segments.prepareSegment(l,this.layoutVertexArray,this.indexArray)),ug[e.type]!=="Polygon")continue;let c=[],p=[],f=u.vertexLength;for(let m of s)if(m.length!==0){m!==s[0]&&p.push(c.length/2);for(let d=0;d<m.length;d++){let h=m[d];Nn(this.layoutVertexArray,h.x,h.y,0,0,1,1,0),a.x+=h.x,a.y+=h.y,a.vertexCount+=1,c.push(h.x),c.push(h.y)}}let y=(0,zc.default)(c,p);for(let m=0;m<y.length;m+=3)this.indexArray.emplaceBack(f+y[m],f+y[m+2],f+y[m+1]);u.primitiveLength+=y.length/3,u.vertexLength+=l}for(let s=0;s<a.vertexCount;s++)this.centroidVertexArray.emplaceBack(Math.floor(a.x/a.vertexCount),Math.floor(a.y/a.vertexCount));this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,o,i)}};k("FillExtrusionBucket",Yt,{omit:["layers","features"]});function pg(t,e){return t.x===e.x&&(t.x<0||t.x>8192)||t.y===e.y&&(t.y<0||t.y>8192)}function fg(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 Oc,yg=()=>Oc=Oc||new ie({"fill-extrusion-opacity":new B(S["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new R(S["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new B(S["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new B(S["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new st(S["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new R(S["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new R(S["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new B(S["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])}),Nc={get paint(){return yg()}};var Eo=Z(he(),1);var Fo=class extends le{constructor(e){super(e,Nc)}createBucket(e){return new Yt(e)}queryRadius(){return At(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(e,r,n,i,o,a,s,l){let u=_t(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),a.angle,s),c=this.paint.get("fill-extrusion-height").evaluate(r,n),p=this.paint.get("fill-extrusion-base").evaluate(r,n),f=dg(u,l,a,0),y=hg(i,p,c,l),m=y[0],d=y[1];return mg(m,d,f)}};function Un(t,e){return t.x*e.x+t.y*e.y}function Uc(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=Un(s,s),p=Un(s,l),f=Un(l,l),y=Un(u,s),m=Un(u,l),d=c*f-p*p,h=(f*y-p*m)/d,g=(c*m-p*y)/d,v=1-h-g,b=n.z*v+i.z*h+o.z*g;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 mg(t,e,r){let n=1/0;bo(r,e)&&(n=Uc(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];$u(r,f)&&(n=Math.min(n,Uc(r,f)))}}return n===1/0?!1:n}function hg(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 d=[],h=[];for(let g of m){let v=g.x,b=g.y,x=n[0]*v+n[4]*b+n[12],P=n[1]*v+n[5]*b+n[13],w=n[2]*v+n[6]*b+n[14],A=n[3]*v+n[7]*b+n[15],T=x+a,C=P+s,E=w+l,_=A+u,M=x+c,F=P+p,I=w+f,z=A+y,O=new Eo.default(T/_,C/_);O.z=E/_,d.push(O);let N=new Eo.default(M/z,F/z);N.z=I/z,h.push(N)}i.push(d),o.push(h)}return[i,o]}function dg(t,e,r,n){let i=[];for(let o of t){let a=[o.x,o.y,n,1];Jt.transformMat4(a,a,e),i.push(new Eo.default(a[0]/a[3],a[1]/a[3]))}return i}var gg=ee([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:$c,size:DP,alignment:VP}=gg;var xg=ee([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Gc,size:RP,alignment:OP}=xg;var Zc=Z(It(),1);var bg=Zc.default.VectorTileFeature.types,qc=63,vg=Math.cos(75/2*(Math.PI/180)),Pg=15,Sg=20,wg=15,Jc=1/2,jc=Math.pow(2,wg-1)/Jc,Xt=class{constructor(e){this.zoom=e.zoom,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 ao,this.layoutVertexArray2=new so,this.indexArray=new Le,this.programConfigurations=new ke(e.layers,e.zoom),this.segments=new me,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(e,r,n){this.hasPattern=wr("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=Oe(s,p);if(!this.layers[0]._featureFilter.filter(new q(this.zoom),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:Te(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=Ar("line",this.layers,s,this.zoom,r);this.patternFeatures.push(f)}else this.addFeature(s,l,u,n,{});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)}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,Gc)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,$c),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){let a=this.layers[0].layout,s=a.get("line-join").evaluate(e,{}),l=a.get("line-cap"),u=a.get("line-miter-limit"),c=a.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(let p of r)this.addLine(p,e,s,l,u,c);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,o,i)}addLine(e,r,n,i,o,a){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let g=0;g<e.length-1;g++)this.totalDistance+=e[g].dist(e[g+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let s=bg[r.type]==="Polygon",l=e.length;for(;l>=2&&e[l-1].equals(e[l-2]);)l--;let u=0;for(;u<l-1&&e[u].equals(e[u+1]);)u++;if(l<(s?3:2))return;n==="bevel"&&(o=1.05);let c=this.overscaling<=16?Pg*8192/(512*this.overscaling):0,p=this.segments.prepareSegment(l*10,this.layoutVertexArray,this.indexArray),f,y,m,d,h;this.e1=this.e2=-1,s&&(f=e[l-2],h=e[u].sub(f)._unit()._perp());for(let g=u;g<l;g++){if(m=g===l-1?s?e[u+1]:void 0:e[g+1],m&&e[g].equals(m))continue;h&&(d=h),f&&(y=f),f=e[g],h=m?m.sub(f)._unit()._perp():d,d=d||h;let v=d.add(h);(v.x!==0||v.y!==0)&&v._unit();let b=d.x*h.x+d.y*h.y,x=v.x*h.x+v.y*h.y,P=x!==0?1/x:1/0,w=2*Math.sqrt(2-2*x),A=x<vg&&y&&m,T=d.x*h.y-d.y*h.x>0;if(A&&g>u){let _=f.dist(y);if(_>2*c){let M=f.sub(f.sub(y)._mult(c/_)._round());this.updateDistance(y,M),this.addCurrentVertex(M,d,0,0,p),y=M}}let C=y&&m,E=C?n:s?"butt":i;if(C&&E==="round"&&(P<a?E="miter":P<=2&&(E="fakeround")),E==="miter"&&P>o&&(E="bevel"),E==="bevel"&&(P>2&&(E="flipbevel"),P<o&&(E="miter")),y&&this.updateDistance(y,f),E==="miter")v._mult(P),this.addCurrentVertex(f,v,0,0,p);else if(E==="flipbevel"){if(P>100)v=h.mult(-1);else{let _=P*d.add(h).mag()/d.sub(h).mag();v._perp()._mult(_*(T?-1:1))}this.addCurrentVertex(f,v,0,0,p),this.addCurrentVertex(f,v.mult(-1),0,0,p)}else if(E==="bevel"||E==="fakeround"){let _=-Math.sqrt(P*P-1),M=T?_:0,F=T?0:_;if(y&&this.addCurrentVertex(f,d,M,F,p),E==="fakeround"){let I=Math.round(w*180/Math.PI/Sg);for(let z=1;z<I;z++){let O=z/I;if(O!==.5){let K=O-.5,Y=1.0904+b*(-3.2452+b*(3.55645-b*1.43519)),Q=.848013+b*(-1.06021+b*.215638);O=O+O*K*(O-1)*(Y*K*K+Q)}let N=h.sub(d)._mult(O)._add(d)._unit()._mult(T?-1:1);this.addHalfVertex(f,N.x,N.y,!1,T,0,p)}}m&&this.addCurrentVertex(f,h,-M,-F,p)}else if(E==="butt")this.addCurrentVertex(f,v,0,0,p);else if(E==="square"){let _=y?1:-1;this.addCurrentVertex(f,v,_,_,p)}else E==="round"&&(y&&(this.addCurrentVertex(f,d,0,0,p),this.addCurrentVertex(f,d,1,1,p,!0)),m&&(this.addCurrentVertex(f,h,-1,-1,p,!0),this.addCurrentVertex(f,h,0,0,p)));if(A&&g<l-1){let _=f.dist(m);if(_>2*c){let M=f.add(m.sub(f)._mult(c/_)._round());this.updateDistance(f,M),this.addCurrentVertex(M,h,0,0,p),f=M}}}}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>jc/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*(jc-1):this.scaledDistance)*Jc;if(this.layoutVertexArray.emplaceBack((e<<1)+(o?1:0),(r<<1)+(a?1:0),Math.round(qc*n)+128,Math.round(qc*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,this.e2,p),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()}};k("LineBucket",Xt,{omit:["layers","patternFeatures"]});var Wc,Ag=()=>Wc=Wc||new ie({"line-cap":new B(S.layout_line["line-cap"]),"line-join":new R(S.layout_line["line-join"]),"line-miter-limit":new B(S.layout_line["line-miter-limit"]),"line-round-limit":new B(S.layout_line["line-round-limit"]),"line-sort-key":new R(S.layout_line["line-sort-key"])}),Hc,_g=()=>Hc=Hc||new ie({"line-opacity":new R(S.paint_line["line-opacity"]),"line-color":new R(S.paint_line["line-color"]),"line-translate":new B(S.paint_line["line-translate"]),"line-translate-anchor":new B(S.paint_line["line-translate-anchor"]),"line-width":new R(S.paint_line["line-width"]),"line-gap-width":new R(S.paint_line["line-gap-width"]),"line-offset":new R(S.paint_line["line-offset"]),"line-blur":new R(S.paint_line["line-blur"]),"line-dasharray":new Ot(S.paint_line["line-dasharray"]),"line-pattern":new st(S.paint_line["line-pattern"]),"line-gradient":new Nt(S.paint_line["line-gradient"])}),vs={get paint(){return _g()},get layout(){return Ag()}};var Ps=class extends R{possiblyEvaluate(e,r){return r=new q(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=Ae({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(e,r,n,i)}},Mo,Lo=class extends le{constructor(e){super(e,vs),this.gradientVersion=0,Mo||(Mo=new Ps(vs.paint.properties["line-width"].specification),Mo.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){let r=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=r._styleExpression.expression instanceof lr,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"]=Mo.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new Xt(e)}queryRadius(e){let r=e,n=Kc(Zt("line-width",this,r),Zt("line-gap-width",this,r)),i=Zt("line-offset",this,r);return n/2+Math.abs(i)+At(this.paint.get("line-translate"))}queryIntersectsFeature(e,r,n,i,o,a,s){let l=_t(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),a.angle,s),u=s/2*Kc(this.paint.get("line-width").evaluate(r,n),this.paint.get("line-gap-width").evaluate(r,n)),c=this.paint.get("line-offset").evaluate(r,n);return c&&(i=Zu(i,c*s)),qu(l,i,u)}isTileClipped(){return!0}};function Kc(t,e){return e>0?e+2*t:t}var Yc=ee([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Xc=ee([{name:"a_projected_pos",components:3,type:"Float32"}],4),SS=ee([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),Qc=ee([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]),wS=ee([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]),Ss=ee([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),AS=ee([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4),_S=ee([{name:"triangle",components:3,type:"Uint16"}]),IS=ee([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),CS=ee([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),kS=ee([{type:"Float32",name:"offsetX"}]),TS=ee([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);var Jn=Z(he(),1);function Ig(t,e,r){let n=e.layout.get("text-transform").evaluate(r,{});return n==="uppercase"?t=t.toLocaleUpperCase():n==="lowercase"&&(t=t.toLocaleLowerCase()),ae.applyArabicShaping&&(t=ae.applyArabicShaping(t)),t}function ep(t,e,r){return t.sections.forEach(n=>{n.text=Ig(n.text,e,r)}),t}function tp(t){let e={},r={},n=[],i=0;function o(u){n.push(t[u]),i++}function a(u,c,p){let f=r[u];return delete r[u],r[c]=f,n[f].geometry[0].pop(),n[f].geometry[0]=n[f].geometry[0].concat(p[0]),f}function s(u,c,p){let f=e[c];return delete e[c],e[u]=f,n[f].geometry[0].shift(),n[f].geometry[0]=p[0].concat(n[f].geometry[0]),f}function l(u,c,p){let f=p?c[0][c[0].length-1]:c[0][0];return"".concat(u,":").concat(f.x,":").concat(f.y)}for(let u=0;u<t.length;u++){let c=t[u],p=c.geometry,f=c.text?c.text.toString():null;if(!f){o(u);continue}let y=l(f,p),m=l(f,p,!0);if(y in r&&m in e&&r[y]!==e[m]){let d=s(y,m,p),h=a(y,m,n[d].geometry);delete e[y],delete r[m],r[l(f,n[h].geometry,!0)]=h,n[d].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 Ir={"!":"\\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 rp(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||!Ka(n)||Ir[t[r+1]])&&(!i||!Ka(i)||Ir[t[r-1]])&&Ir[t[r]]?e+=Ir[t[r]]:e+=t[r]}return e}var ue=24;var qg=Z($n(),1),jg=3;var Bo=jg;function Gn(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 ge=1;var zo=class{constructor(e,{pixelRatio:r,version:n,stretchX:i,stretchY:o,content:a}){this.paddedRect=e,this.pixelRatio=r,this.stretchX=i,this.stretchY=o,this.content=a,this.version=n}get tl(){return[this.paddedRect.x+ge,this.paddedRect.y+ge]}get br(){return[this.paddedRect.x+this.paddedRect.w-ge,this.paddedRect.y+this.paddedRect.h-ge]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-ge*2)/this.pixelRatio,(this.paddedRect.h-ge*2)/this.pixelRatio]}},qn=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}=Gn(o),l=new de({width:a||1,height:s||1});for(let u in e){let c=e[u],p=n[u].paddedRect;de.copy(c.data,l,{x:0,y:0},{x:p.x+ge,y:p.y+ge},c.data)}for(let u in r){let c=r[u],p=i[u].paddedRect,f=p.x+ge,y=p.y+ge,m=c.data.width,d=c.data.height;de.copy(c.data,l,{x:0,y:0},{x:f,y},c.data),de.copy(c.data,l,{x:0,y:d-1},{x:f,y:y-1},{width:m,height:1}),de.copy(c.data,l,{x:0,y:0},{x:f,y:y+d},{width:m,height:1}),de.copy(c.data,l,{x:m-1,y:0},{x:f-1,y},{width:1,height:d}),de.copy(c.data,l,{x:0,y:0},{x:f+m,y},{width:1,height:d})}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*ge,h:o.data.height+2*ge};n.push(a),r[i]=new zo(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})}};k("ImagePosition",zo);k("ImageAtlas",qn);var No=(i=>(i[i.none=0]="none",i[i.horizontal=1]="horizontal",i[i.vertical=2]="vertical",i[i.horizontalOnly=3]="horizontalOnly",i))(No||{}),Tr=-17;function Zg(t){for(let e of t)if(e.positionedGlyphs.length!==0)return!1;return!0}var up=57344,cp=63743,Ro=class t{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(e,r){let n=new t;return n.scale=e||1,n.fontStack=r,n}static forImage(e){let r=new t;return r.imageName=e,r}},jn=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=rp(this.text)}trim(){let e=0;for(let n=0;n<this.text.length&&Oo[this.text.charCodeAt(n)];n++)e++;let r=this.text.length;for(let n=this.text.length-1;n>=0&&n>=e&&Oo[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)}addTextSection(e,r){this.text+=e.text,this.sections.push(Ro.forText(e.scale,e.fontStack||r));let n=this.sections.length-1;for(let i=0;i<e.text.length;++i)this.sectionIndex.push(n)}addImageSection(e){let r=e.image?e.image.name:"";if(r.length===0){ce("Can\'t add FormattedSection with an empty image.");return}let n=this.getNextImageSectionCharCode();if(!n){ce("Reached maximum number of images ".concat(cp-up+2));return}this.text+=String.fromCharCode(n),this.sections.push(Ro.forImage(r)),this.sectionIndex.push(this.sections.length-1)}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=cp?null:++this.imageSectionID:(this.imageSectionID=up,this.imageSectionID)}};function Jg(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 Zn(t,e,r,n,i,o,a,s,l,u,c,p,f,y,m,d){let h=jn.fromFeature(t,i);p===2&&h.verticalizePunctuation();let g,{processBidirectionalText:v,processStyledBidirectionalText:b}=ae;if(v&&h.sections.length===1){g=[];let w=v(h.toString(),_s(h,u,o,e,n,y,m));for(let A of w){let T=new jn;T.text=A,T.sections=h.sections;for(let C=0;C<A.length;C++)T.sectionIndex.push(0);g.push(T)}}else if(b){g=[];let w=b(h.text,h.sectionIndex,_s(h,u,o,e,n,y,m));for(let A of w){let T=new jn;T.text=A[0],T.sectionIndex=A[1],T.sections=h.sections,g.push(T)}}else g=Jg(h,_s(h,u,o,e,n,y,m));let x=[],P={positionedLines:x,text:h.toString(),top:c[1],bottom:c[1],left:c[0],right:c[0],writingMode:p,iconsInText:!1,verticalizable:!1};return Yg(P,e,r,n,g,a,s,l,p,u,f,d),Zg(x)?!1:P}var Oo={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Wg={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function yp(t,e,r,n,i,o){if(e.imageName){let a=n[e.imageName];return a?a.displaySize[0]*e.scale*ue/o+i:0}else{let a=r[e.fontStack],s=a&&a[t];return s?s.metrics.advance*e.scale+i:0}}function Hg(t,e,r,n,i,o){let a=0;for(let l=0;l<t.length();l++){let u=t.getSection(l);a+=yp(t.getCharCode(l),u,n,i,e,o)}let s=Math.max(1,Math.ceil(a/r));return a/s}function pp(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 Kg(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 fp(t,e,r,n,i,o){let a=null,s=pp(e,r,i,o);for(let l of n){let u=e-l.x,c=pp(u,r,i,o)+l.badness;c<=s&&(a=l,s=c)}return{index:t,x:e,priorBreak:a,badness:s}}function mp(t){return t?mp(t.priorBreak).concat(t.index):[]}function _s(t,e,r,n,i,o,a){if(o!=="point")return[];if(!t)return[];let s=[],l=Hg(t,e,r,n,i,a),u=t.text.indexOf("\\u200B")>=0,c=0;for(let p=0;p<t.length();p++){let f=t.getSection(p),y=t.getCharCode(p);if(Oo[y]||(c+=yp(y,f,n,i,e,a)),p<t.length()-1){let m=Au(y);(Wg[y]||m||f.imageName)&&s.push(fp(p+1,c,l,s,Kg(y,t.getCharCode(p+1),m&&u),!1))}}return mp(fp(t.length(),c,l,s,0,!0))}function hp(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 Yg(t,e,r,n,i,o,a,s,l,u,c,p){let f=0,y=Tr,m=0,d=0,h=s==="right"?1:s==="left"?0:.5,g=0;for(let P of i){P.trim();let w=P.getMaxScale(),A=(w-1)*ue,T={positionedGlyphs:[],lineOffset:0};t.positionedLines[g]=T;let C=T.positionedGlyphs,E=0;if(!P.length()){y+=o,++g;continue}for(let M=0;M<P.length();M++){let F=P.getSection(M),I=P.getSectionIndex(M),z=P.getCharCode(M),O=0,N=null,K=null,Y=null,Q=ue,ye=!(l===1||!c&&!Ui(z)||c&&(Oo[z]||_u(z)));if(F.imageName){let _e=n[F.imageName];if(!_e)continue;Y=F.imageName,t.iconsInText=t.iconsInText||!0,K=_e.paddedRect;let re=_e.displaySize;F.scale=F.scale*ue/p,N={width:re[0],height:re[1],left:ge,top:-Bo,advance:ye?re[1]:re[0]};let Pe=ue-re[1]*F.scale;O=A+Pe,Q=N.advance;let $e=ye?re[0]*F.scale-ue*w:re[1]*F.scale-ue*w;$e>0&&$e>E&&(E=$e)}else{let _e=r[F.fontStack],re=_e&&_e[z];if(re&&re.rect)K=re.rect,N=re.metrics;else{let Pe=e[F.fontStack],$e=Pe&&Pe[z];if(!$e)continue;N=$e.metrics}O=(w-F.scale)*ue}ye?(t.verticalizable=!0,C.push({glyph:z,imageName:Y,x:f,y:y+O,vertical:ye,scale:F.scale,fontStack:F.fontStack,sectionIndex:I,metrics:N,rect:K}),f+=Q*F.scale+u):(C.push({glyph:z,imageName:Y,x:f,y:y+O,vertical:ye,scale:F.scale,fontStack:F.fontStack,sectionIndex:I,metrics:N,rect:K}),f+=N.advance*F.scale+u)}if(C.length!==0){let M=f-u;m=Math.max(M,m),Xg(C,0,C.length-1,h,E)}f=0;let _=o*w+E;T.lineOffset=Math.max(E,A),y+=_,d=Math.max(_,d),++g}let v=y-Tr,{horizontalAlign:b,verticalAlign:x}=hp(a);Qg(t.positionedLines,h,b,x,m,d,o,v,i.length),t.top+=-x*v,t.bottom=t.top+v,t.left+=-b*m,t.right=t.left+m}function Xg(t,e,r,n,i){if(!n&&!i)return;let o=t[r],a=o.metrics.advance*o.scale,s=(t[r].x+a)*n;for(let l=e;l<=r;l++)t[l].x-=s,t[l].y+=i}function Qg(t,e,r,n,i,o,a,s,l){let u=(e-r)*i,c=0;o!==a?c=-s*n-Tr:c=(-n*l+.5)*a;for(let p of t)for(let f of p.positionedGlyphs)f.x+=u,f.y+=c}function dp(t,e,r){let{horizontalAlign:n,verticalAlign:i}=hp(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 Is(t,e,r,n,i,o){let a=t.image,s;if(a.content){let h=a.content,g=a.pixelRatio||1;s=[h[0]/g,h[1]/g,a.displaySize[0]-h[2]/g,a.displaySize[1]-h[3]/g]}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,d=e.bottom*o;return r==="height"||r==="both"?(c=i[1]+m-n[0],f=i[1]+d+n[2]):(c=i[1]+(m+d-a.displaySize[1])/2,f=c+a.displaySize[1]),{image:a,top:c,right:p,bottom:f,left:y,collisionPadding:s}}var gp=Z(It(),1);var Er=255,Ct=128,Qe=Er*Ct;function Cs(t,e){let{expression:r}=e;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new q(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 q(s)),c=r.evaluate(new q(l));return{kind:"camera",minZoom:s,maxZoom:l,minSize:u,maxSize:c,interpolationType:i}}}function ks(t,e,r){let n="never",i=t.get(e);return i?n=i:t.get(r)&&(n="always"),n}var ex=gp.default.VectorTileFeature.types,tx=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Uo(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 xp(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 rx(t){for(let e of t.sections)if(Cu(e.text))return!0;return!1}var Wn=class{constructor(e){this.layoutVertexArray=new lo,this.indexArray=new Le,this.programConfigurations=e,this.segments=new me,this.dynamicLayoutVertexArray=new uo,this.opacityVertexArray=new co,this.hasVisibleVertices=!1,this.placedSymbolArray=new wn}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,r,n,i){this.isEmpty()||(n&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Yc.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,Xc.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,tx,!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())}};k("SymbolBuffers",Wn);var Hn=class{constructor(e,r,n){this.layoutVertexArray=new e,this.layoutAttributes=r,this.indexArray=new n,this.segments=new me,this.collisionVertexArray=new po}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,Qc.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}};k("CollisionBuffers",Hn);var We=class{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,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=[],this.placementInvProjMatrix=Dn.identity([]),this.placementViewportMatrix=Dn.identity([]);let n=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Cs(this.zoom,n["text-size"]),this.iconSizeData=Cs(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=ks(i,"text-overlap","text-allow-overlap")!=="never"||ks(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=>No[l])),this.stateDependentLayerIds=this.layers.filter(l=>l.isStateDependent()).map(l=>l.id),this.sourceID=e.sourceID}createArrays(){this.text=new Wn(new ke(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new Wn(new ke(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new _n,this.lineVertexArray=new In,this.symbolInstances=new An}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=Ir[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 Me&&!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,d=new q(this.zoom);for(let{feature:h,id:g,index:v,sourceLayerIndex:b}of e){let x=i._featureFilter.needGeometry,P=Oe(h,x);if(!i._featureFilter.filter(d,P,n))continue;x||(P.geometry=Te(h));let w;if(u){let E=i.getValueAndResolveTokens("text-field",P,n,m),_=Me.factory(E);rx(_)&&(this.hasRTLText=!0),(!this.hasRTLText||Eu()==="unavailable"||this.hasRTLText&&ae.isParsed())&&(w=ep(_,i,P))}let A;if(c){let E=i.getValueAndResolveTokens("icon-image",P,n,m);E instanceof Ce?A=E:A=Ce.fromString(E)}if(!w&&!A)continue;let T=this.sortFeaturesByKey?p.evaluate(P,{},n):void 0,C={id:g,text:w,icon:A,index:v,sourceLayerIndex:b,geometry:P.geometry,properties:h.properties,type:ex[h.type],sortKey:T};if(this.features.push(C),A&&(f[A.name]=!0),w){let E=a.evaluate(P,{},n).join(","),_=o.get("text-rotation-alignment")!=="viewport"&&o.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(2)>=0;for(let M of w.sections)if(M.image)f[M.image.name]=!0;else{let F=on(w.toString()),I=M.fontStack||E,z=y[I]=y[I]||{};this.calculateGlyphDependencies(M.text,z,_,this.allowVerticalPlacement,F)}}}o.get("symbol-placement")==="line"&&(this.features=tp(this.features)),this.sortFeaturesByKey&&this.features.sort((h,g)=>h.sortKey-g.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,d=e.segments.prepareSegment(4*r.length,m,y,this.canOverlap?a.sortKey:void 0),h=this.glyphOffsetArray.length,g=d.vertexLength,v=this.allowVerticalPlacement&&s===2?Math.PI/2:0,b=a.text&&a.text.sections;for(let x=0;x<r.length;x++){let{tl:P,tr:w,bl:A,br:T,tex:C,pixelOffsetTL:E,pixelOffsetBR:_,minFontScaleX:M,minFontScaleY:F,glyphOffset:I,isSDF:z,sectionIndex:O}=r[x],N=d.vertexLength,K=I[1];Uo(m,l.x,l.y,P.x,K+P.y,C.x,C.y,n,z,E.x,E.y,M,F),Uo(m,l.x,l.y,w.x,K+w.y,C.x+C.w,C.y,n,z,_.x,E.y,M,F),Uo(m,l.x,l.y,A.x,K+A.y,C.x,C.y+C.h,n,z,E.x,_.y,M,F),Uo(m,l.x,l.y,T.x,K+T.y,C.x+C.w,C.y+C.h,n,z,_.x,_.y,M,F),xp(e.dynamicLayoutVertexArray,l,v),y.emplaceBack(N,N+1,N+2),y.emplaceBack(N+1,N+2,N+3),d.vertexLength+=4,d.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(I[0]),(x===r.length-1||O!==r[x+1].sectionIndex)&&e.programConfigurations.populatePaintArrays(m.length,a,a.index,{},f,b&&b[O])}e.placedSymbolArray.emplaceBack(l.x,l.y,h,this.glyphOffsetArray.length-h,g,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 Jn.default(e,r)),this._addCollisionDebugVertex(c,p,a,f,y,new Jn.default(n,r)),this._addCollisionDebugVertex(c,p,a,f,y,new Jn.default(n,i)),this._addCollisionDebugVertex(c,p,a,f,y,new Jn.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 Hn(kn,Ss.members,St),this.iconCollisionBox=new Hn(kn,Ss.members,St);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+1,o+2),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)}}};k("SymbolBucket",We,{omit:["layers","collisionBoxArray","features","compareText"]});We.MAX_GLYPHS=65535;We.addDynamicAttributes=xp;function bp(t,e){return e.replace(/{([^{}]+)}/g,(r,n)=>n in t?String(t[n]):"")}var vp,nx=()=>vp=vp||new ie({"symbol-placement":new B(S.layout_symbol["symbol-placement"]),"symbol-spacing":new B(S.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new B(S.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new R(S.layout_symbol["symbol-sort-key"]),"symbol-z-order":new B(S.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new B(S.layout_symbol["icon-allow-overlap"]),"icon-overlap":new B(S.layout_symbol["icon-overlap"]),"icon-ignore-placement":new B(S.layout_symbol["icon-ignore-placement"]),"icon-optional":new B(S.layout_symbol["icon-optional"]),"icon-rotation-alignment":new B(S.layout_symbol["icon-rotation-alignment"]),"icon-size":new R(S.layout_symbol["icon-size"]),"icon-text-fit":new B(S.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new B(S.layout_symbol["icon-text-fit-padding"]),"icon-image":new R(S.layout_symbol["icon-image"]),"icon-rotate":new R(S.layout_symbol["icon-rotate"]),"icon-padding":new R(S.layout_symbol["icon-padding"]),"icon-keep-upright":new B(S.layout_symbol["icon-keep-upright"]),"icon-offset":new R(S.layout_symbol["icon-offset"]),"icon-anchor":new R(S.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new B(S.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new B(S.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new B(S.layout_symbol["text-rotation-alignment"]),"text-field":new R(S.layout_symbol["text-field"]),"text-font":new R(S.layout_symbol["text-font"]),"text-size":new R(S.layout_symbol["text-size"]),"text-max-width":new R(S.layout_symbol["text-max-width"]),"text-line-height":new B(S.layout_symbol["text-line-height"]),"text-letter-spacing":new R(S.layout_symbol["text-letter-spacing"]),"text-justify":new R(S.layout_symbol["text-justify"]),"text-radial-offset":new R(S.layout_symbol["text-radial-offset"]),"text-variable-anchor":new B(S.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new R(S.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new R(S.layout_symbol["text-anchor"]),"text-max-angle":new B(S.layout_symbol["text-max-angle"]),"text-writing-mode":new B(S.layout_symbol["text-writing-mode"]),"text-rotate":new R(S.layout_symbol["text-rotate"]),"text-padding":new B(S.layout_symbol["text-padding"]),"text-keep-upright":new B(S.layout_symbol["text-keep-upright"]),"text-transform":new R(S.layout_symbol["text-transform"]),"text-offset":new R(S.layout_symbol["text-offset"]),"text-allow-overlap":new B(S.layout_symbol["text-allow-overlap"]),"text-overlap":new B(S.layout_symbol["text-overlap"]),"text-ignore-placement":new B(S.layout_symbol["text-ignore-placement"]),"text-optional":new B(S.layout_symbol["text-optional"])}),Pp,ix=()=>Pp=Pp||new ie({"icon-opacity":new R(S.paint_symbol["icon-opacity"]),"icon-color":new R(S.paint_symbol["icon-color"]),"icon-halo-color":new R(S.paint_symbol["icon-halo-color"]),"icon-halo-width":new R(S.paint_symbol["icon-halo-width"]),"icon-halo-blur":new R(S.paint_symbol["icon-halo-blur"]),"icon-translate":new B(S.paint_symbol["icon-translate"]),"icon-translate-anchor":new B(S.paint_symbol["icon-translate-anchor"]),"text-opacity":new R(S.paint_symbol["text-opacity"]),"text-color":new R(S.paint_symbol["text-color"],{runtimeType:ze,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new R(S.paint_symbol["text-halo-color"]),"text-halo-width":new R(S.paint_symbol["text-halo-width"]),"text-halo-blur":new R(S.paint_symbol["text-halo-blur"]),"text-translate":new B(S.paint_symbol["text-translate"]),"text-translate-anchor":new B(S.paint_symbol["text-translate-anchor"])}),$o={get paint(){return ix()},get layout(){return nx()}};var Kn=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:cr,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}};k("FormatSectionOverride",Kn,{omit:["defaultValue"]});var Go=class t extends le{constructor(e){super(e,$o)}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()&&!en(a.value)&&o?bp(r.properties,o):o}createBucket(e){return new We(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let e of $o.paint.overridableProperties){if(!t.hasPaintOverride(this.layout,e))continue;let r=this.paint.get(e),n=new Kn(r),i=new Dt(n,r.property.specification),o=null;r.value.kind==="constant"||r.value.kind==="source"?o=new dt("source",i):o=new gt("composite",i,r.value.zoomStops),this.paint._values[e]=new be(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=$o.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 Me)a(n.value.value.sections);else if(n.value.kind==="source"){let s=u=>{if(!o)if(u instanceof mt&&fe(u.value)===pr){let c=u.value;a(c.sections)}else u instanceof Hr?a(u.sections):u.eachChild(s)},l=n.value;l._styleExpression&&s(l._styleExpression.expression)}return o}};function Sp(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 wp,ox=()=>wp=wp||new ie({"background-color":new B(S.paint_background["background-color"]),"background-pattern":new Ot(S.paint_background["background-pattern"]),"background-opacity":new B(S.paint_background["background-opacity"])}),Ap={get paint(){return ox()}};var qo=class extends le{constructor(e){super(e,Ap)}};var _p,ax=()=>_p=_p||new ie({"raster-opacity":new B(S.paint_raster["raster-opacity"]),"raster-hue-rotate":new B(S.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new B(S.paint_raster["raster-brightness-min"]),"raster-brightness-max":new B(S.paint_raster["raster-brightness-max"]),"raster-saturation":new B(S.paint_raster["raster-saturation"]),"raster-contrast":new B(S.paint_raster["raster-contrast"]),"raster-resampling":new B(S.paint_raster["raster-resampling"]),"raster-fade-duration":new B(S.paint_raster["raster-fade-duration"])}),Ip={get paint(){return ax()}};var jo=class extends le{constructor(e){super(e,Ip)}};var Zo=class extends le{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 Cp(t){if(t.type==="custom")return new Zo(t);switch(t.type){case"background":return new qo(t);case"circle":return new Po(t);case"fill":return new ko(t);case"fill-extrusion":return new Fo(t);case"heatmap":return new So(t);case"hillshade":return new wo(t);case"line":return new Lo(t);case"raster":return new jo(t);case"symbol":return new Go(t)}}var Jo=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]=Cp(i);o._featureFilter=tn(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=Ql(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 Xp=Z(It(),1),Qp=Z($n(),1);var Fr=class{constructor(e){this._stringToNumber={},this._numberToString=[];for(let r=0;r<e.length;r++){let n=e[r];this._stringToNumber[n]=r,this._numberToString[r]=n}}encode(e){return this._stringToNumber[e]}decode(e){if(e>=this._numberToString.length)throw new Error("Out of bounds. Index requested n=".concat(e," can\'t be >= this._numberToString.length ").concat(this._numberToString.length));return this._numberToString[e]}};var Ep=Z(It(),1),Fp=Z($n(),1);var Wo=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 Yn=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 Ft(8192,16,0),this.grid3D=new Ft(8192,16,0),this.featureIndexArray=new Cn,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 Ep.default.VectorTile(new Fp.default(this.rawTileData)).layers,this.sourceLayerCoder=new Fr(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=tn(o.filter),l=e.queryGeometry,u=e.queryPadding*a,c=Tp(l),p=this.grid.query(c.minX-u,c.minY-u,c.maxX+u,c.maxY+u),f=Tp(e.cameraQueryGeometry),y=this.grid3D.query(f.minX-u,f.minY-u,f.maxX+u,f.maxY+u,(h,g,v,b)=>ju(e.cameraQueryGeometry,h-u,g-u,v+u,b+u));for(let h of y)p.push(h);p.sort(sx);let m={},d;for(let h=0;h<p.length;h++){let g=p[h];if(g===d)continue;d=g;let v=this.featureIndexArray.get(g),b=null;this.loadMatchingFeature(m,v.bucketIndex,v.sourceLayerIndex,v.featureIndex,s,o.layers,o.availableImages,r,n,i,(x,P,w)=>(b||(b=Te(x)),P.queryIntersectsFeature(l,x,w,b,this.z,e.transform,a,e.pixelPosMatrix)))}return m}loadMatchingFeature(e,r,n,i,o,a,s,l,u,c,p){let f=this.bucketLayerIDs[r];if(a&&!gl(a,f))return;let y=this.sourceLayerCoder.decode(n),d=this.vtLayers[y].feature(i);if(o.needGeometry){let g=Oe(d,!0);if(!o.filter(new q(this.tileID.overscaledZ),g,this.tileID.canonical))return}else if(!o.filter(new q(this.tileID.overscaledZ),d))return;let h=this.getId(d,y);for(let g=0;g<f.length;g++){let v=f[g];if(a&&a.indexOf(v)<0)continue;let b=l[v];if(!b)continue;let x={};h&&c&&(x=c.getState(b.sourceLayer||"_geojsonTileLayer",h));let P=Ae({},u[v]);P.paint=kp(P.paint,b.paint,d,x,s),P.layout=kp(P.layout,b.layout,d,x,s);let w=!p||p(d,b,x);if(!w)continue;let A=new Wo(d,this.z,this.x,this.y,h);A.layer=P;let T=e[v];T===void 0&&(T=e[v]=[]),T.push({featureIndex:i,feature:A,intersectionZ:w})}}lookupSymbolFeatures(e,r,n,i,o,a,s,l){let u={};this.loadVTLayers();let c=tn(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))}return n}};k("FeatureIndex",Yn,{omit:["rawTileData","sourceLayerCoder"]});function kp(t,e,r,n,i){return Rr(t,(o,a)=>{let s=e instanceof vt?e.get(a):null;return s&&s.evaluate?s.evaluate(r,n,i):s})}function Tp(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{minX:e,minY:r,maxX:n,maxY:i}}function sx(t,e){return e-t}var Mp=Z(he(),1);var et=class t extends Mp.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)}};k("Anchor",et);function Ts(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 Lp(t){let e=0;for(let r=0;r<t.length-1;r++)e+=t[r].dist(t[r+1]);return e}function Dp(t,e,r){return t?3/5*e*r:0}function Vp(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function Bp(t,e,r,n,i,o){let a=Dp(r,i,o),s=Vp(r,n)*o,l=0,u=Lp(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,d=Re.number(p.x,f.x,m),h=Re.number(p.y,f.y,m),g=new et(d,h,f.angleTo(p),c);return g._round(),!a||Ts(t,g,s,a,e)?g:void 0}l+=y}}function zp(t,e,r,n,i,o,a,s,l){let u=Dp(n,o,a),c=Vp(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 Rp(t,m,e,u,r,p,f,!1,l)}function Rp(t,e,r,n,i,o,a,s,l){let u=o/2,c=Lp(t),p=0,f=e-r,y=[];for(let m=0;m<t.length-1;m++){let d=t[m],h=t[m+1],g=d.dist(h),v=h.angleTo(d);for(;f+r<p+g;){f+=r;let b=(f-p)/g,x=Re.number(d.x,h.x,b),P=Re.number(d.y,h.y,b);if(x>=0&&x<l&&P>=0&&P<l&&f-u>=0&&f+u<=c){let w=new et(x,P,v,m);w._round(),(!n||Ts(t,w,o,n,i))&&y.push(w)}}p+=g}return!s&&!y.length&&!a&&(y=Rp(t,p/2,r,n,i,o,a,!0,l)),y}var ct=Z(he(),1);function Op(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 ct.default(e,c.y+(p.y-c.y)*((e-c.x)/(p.x-c.x)))._round():p.x<e&&(p=new ct.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 ct.default(c.x+(p.x-c.x)*((r-c.y)/(p.y-c.y)),r)._round():p.y<r&&(p=new ct.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 ct.default(n,c.y+(p.y-c.y)*((n-c.x)/(p.x-c.x)))._round():p.x>=n&&(p=new ct.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 ct.default(c.x+(p.x-c.x)*((i-c.y)/(p.y-c.y)),i)._round():p.y>=i&&(p=new ct.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 ve=Z(he(),1);var Mr=ge;function Es(t,e,r,n){let i=[],o=t.image,a=o.pixelRatio,s=o.paddedRect.w-2*Mr,l=o.paddedRect.h-2*Mr,u=t.right-t.left,c=t.bottom-t.top,p=o.stretchX||[[0,s]],f=o.stretchY||[[0,l]],y=(_,M)=>_+M[1]-M[0],m=p.reduce(y,0),d=f.reduce(y,0),h=s-m,g=l-d,v=0,b=m,x=0,P=d,w=0,A=h,T=0,C=g;if(o.content&&n){let _=o.content;v=Ho(p,0,_[0]),x=Ho(f,0,_[1]),b=Ho(p,_[0],_[2]),P=Ho(f,_[1],_[3]),w=_[0]-v,T=_[1]-x,A=_[2]-_[0]-b,C=_[3]-_[1]-P}let E=(_,M,F,I)=>{let z=Ko(_.stretch-v,b,u,t.left),O=Yo(_.fixed-w,A,_.stretch,m),N=Ko(M.stretch-x,P,c,t.top),K=Yo(M.fixed-T,C,M.stretch,d),Y=Ko(F.stretch-v,b,u,t.left),Q=Yo(F.fixed-w,A,F.stretch,m),ye=Ko(I.stretch-x,P,c,t.top),_e=Yo(I.fixed-T,C,I.stretch,d),re=new ve.default(z,N),Pe=new ve.default(Y,N),$e=new ve.default(Y,ye),fi=new ve.default(z,ye),ya=new ve.default(O/a,K/a),ma=new ve.default(Q/a,_e/a),zr=e*Math.PI/180;if(zr){let xe=Math.sin(zr),He=Math.cos(zr),Ke=[He,-xe,xe,He];re._matMult(Ke),Pe._matMult(Ke),fi._matMult(Ke),$e._matMult(Ke)}let yi=_.stretch+_.fixed,ha=F.stretch+F.fixed,mi=M.stretch+M.fixed,Ee=I.stretch+I.fixed,tr={x:o.paddedRect.x+Mr+yi,y:o.paddedRect.y+Mr+mi,w:ha-yi,h:Ee-mi},hi=A/a/u,Se=C/a/c;return{tl:re,tr:Pe,bl:fi,br:$e,tex:tr,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:ya,pixelOffsetBR:ma,minFontScaleX:hi,minFontScaleY:Se,isSDF:r}};if(!n||!o.stretchX&&!o.stretchY)i.push(E({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:s+1},{fixed:0,stretch:l+1}));else{let _=Np(p,h,m),M=Np(f,g,d);for(let F=0;F<_.length-1;F++){let I=_[F],z=_[F+1];for(let O=0;O<M.length-1;O++){let N=M[O],K=M[O+1];i.push(E(I,N,z,K))}}}return i}function Ho(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 Np(t,e,r){let n=[{fixed:-Mr,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+Mr,stretch:r}),n}function Ko(t,e,r,n){return t/e*r+n}function Yo(t,e,r,n){return t-e*r/n}function Up(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=Bo+1,d=!0,h=1,g=0,v=(i||s)&&p.vertical,b=p.metrics.advance*p.scale/2;if(s&&e.verticalizable){let Y=(p.scale-1)*ue,Q=(ue-p.metrics.width*p.scale)/2;g=c.lineOffset/2-(p.imageName?-Q:Y)}if(p.imageName){let Y=a[p.imageName];d=Y.sdf,h=Y.pixelRatio,m=ge/h}let x=i?[p.x+b,p.y]:[0,0],P=i?[0,0]:[p.x+b+r[0],p.y+r[1]-g],w=[0,0];v&&(w=P,P=[0,0]);let A=(p.metrics.left-m)*p.scale-b+P[0],T=(-p.metrics.top-m)*p.scale+P[1],C=A+f.w*p.scale/h,E=T+f.h*p.scale/h,_=new ve.default(A,T),M=new ve.default(C,T),F=new ve.default(A,E),I=new ve.default(C,E);if(v){let Y=new ve.default(-b,b-Tr),Q=-Math.PI/2,ye=ue/2-b,_e=p.imageName?ye:0,re=new ve.default(5-Tr-ye,-_e),Pe=new ve.default(...w);_._rotateAround(Q,Y)._add(re)._add(Pe),M._rotateAround(Q,Y)._add(re)._add(Pe),F._rotateAround(Q,Y)._add(re)._add(Pe),I._rotateAround(Q,Y)._add(re)._add(Pe)}if(l){let Y=Math.sin(l),Q=Math.cos(l),ye=[Q,-Y,Y,Q];_._matMult(ye),M._matMult(ye),F._matMult(ye),I._matMult(ye)}let z=new ve.default(0,0),O=new ve.default(0,0);u.push({tl:_,tr:M,bl:F,br:I,tex:f,writingMode:e.writingMode,glyphOffset:x,sectionIndex:p.sectionIndex,isSDF:d,pixelOffsetTL:z,pixelOffsetBR:O,minFontScaleX:0,minFontScaleY:0})}return u}var Xn=Z(he(),1),Qt=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.top*s-l[0],f=a.bottom*s+l[2],y=a.left*s-l[3],m=a.right*s+l[1],d=a.collisionPadding;if(d&&(y-=d[0]*s,p-=d[1]*s,m+=d[2]*s,f+=d[3]*s),c){let h=new Xn.default(y,p),g=new Xn.default(m,p),v=new Xn.default(y,f),b=new Xn.default(m,f),x=c*Math.PI/180;h._rotate(x),g._rotate(x),v._rotate(x),b._rotate(x),y=Math.min(h.x,g.x,v.x,b.x),m=Math.max(h.x,g.x,v.x,b.x),p=Math.min(h.y,g.y,v.y,b.y),f=Math.max(h.y,g.y,v.y,b.y)}e.emplaceBack(r.x,r.y,y,p,m,f,n,i,o)}this.boxEndIndex=e.length}};var Qn=class{constructor(e=[],r=lx){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.length++,this._up(this.length-1)}pop(){if(this.length===0)return;let e=this.data[0],r=this.data.pop();return this.length--,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=r[a],l=a+1;if(l<this.length&&n(r[l],s)<0&&(a=l,s=r[l]),n(s,o)>=0)break;r[e]=s,e=a}r[e]=o}};function lx(t,e){return t<e?-1:t>e?1:0}var Fs=Z(he(),1);function $p(t,e=1,r=!1){let n=1/0,i=1/0,o=-1/0,a=-1/0,s=t[0];for(let d=0;d<s.length;d++){let h=s[d];(!d||h.x<n)&&(n=h.x),(!d||h.y<i)&&(i=h.y),(!d||h.x>o)&&(o=h.x),(!d||h.y>a)&&(a=h.y)}let l=o-n,u=a-i,c=Math.min(l,u),p=c/2,f=new Qn([],ux);if(c===0)return new Fs.default(n,i);for(let d=n;d<o;d+=c)for(let h=i;h<a;h+=c)f.push(new Lr(d+p,h+p,p,t));let y=px(t),m=f.length;for(;f.length;){let d=f.pop();(d.d>y.d||!y.d)&&(y=d,r&&console.log("found best %d after %d probes",Math.round(1e4*d.d)/1e4,m)),!(d.max-y.d<=e)&&(p=d.h/2,f.push(new Lr(d.p.x-p,d.p.y-p,p,t)),f.push(new Lr(d.p.x+p,d.p.y-p,p,t)),f.push(new Lr(d.p.x-p,d.p.y+p,p,t)),f.push(new Lr(d.p.x+p,d.p.y+p,p,t)),m+=4)}return r&&(console.log("num probes: ".concat(m)),console.log("best distance: ".concat(y.d))),y.p}function ux(t,e){return e.max-t.max}function Lr(t,e,r,n){this.p=new Fs.default(t,e),this.h=r,this.d=cx(this.p,n),this.max=this.d+this.h*Math.SQRT2}function cx(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,ls(t,u,c))}}return(r?1:-1)*Math.sqrt(n)}function px(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 Lr(r/e,n/e,0,t)}var Ms=Z(rs(),1);var Dr=7,Ls=Number.POSITIVE_INFINITY;function fx(t,e){function r(i,o){let a=0,s=0;o<0&&(o=0);let l=o/Math.sqrt(2);switch(i){case"top-right":case"top-left":s=l-Dr;break;case"bottom-right":case"bottom-left":s=-l+Dr;break;case"bottom":s=-o+Dr;break;case"top":s=o-Dr;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-Dr;break;case"bottom-right":case"bottom-left":case"bottom":l=-a+Dr;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]!==Ls?n(t,e[0],e[1]):r(t,e[0])}function jp(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].layout,n=t.bucket.layers[0]._unevaluatedLayout._values,i={layoutIconSize:n["icon-size"].possiblyEvaluate(new q(t.bucket.zoom+1),t.canonical),layoutTextSize:n["text-size"].possiblyEvaluate(new q(t.bucket.zoom+1),t.canonical),textMaxSize:n["text-size"].possiblyEvaluate(new q(18))};if(t.bucket.textSizeData.kind==="composite"){let{minZoom:u,maxZoom:c}=t.bucket.textSizeData;i.compositeTextSizes=[n["text-size"].possiblyEvaluate(new q(u),t.canonical),n["text-size"].possiblyEvaluate(new q(c),t.canonical)]}if(t.bucket.iconSizeData.kind==="composite"){let{minZoom:u,maxZoom:c}=t.bucket.iconSizeData;i.compositeIconSizes=[n["icon-size"].possiblyEvaluate(new q(u),t.canonical),n["icon-size"].possiblyEvaluate(new q(c),t.canonical)]}let o=r.get("text-line-height")*ue,a=r.get("text-rotation-alignment")!=="viewport"&&r.get("symbol-placement")!=="point",s=r.get("text-keep-upright"),l=r.get("text-size");for(let u of t.bucket.features){let c=r.get("text-font").evaluate(u,{},t.canonical).join(","),p=l.evaluate(u,{},t.canonical),f=i.layoutTextSize.evaluate(u,{},t.canonical),y=i.layoutIconSize.evaluate(u,{},t.canonical),m={horizontal:{},vertical:void 0},d=u.text,h=[0,0];if(d){let x=d.toString(),P=r.get("text-letter-spacing").evaluate(u,{},t.canonical)*ue,w=wu(x)?P:0,A=r.get("text-anchor").evaluate(u,{},t.canonical),T=r.get("text-variable-anchor");if(!T){let F=r.get("text-radial-offset").evaluate(u,{},t.canonical);F?h=fx(A,[F*ue,Ls]):h=r.get("text-offset").evaluate(u,{},t.canonical).map(I=>I*ue)}let C=a?"center":r.get("text-justify").evaluate(u,{},t.canonical),E=r.get("symbol-placement"),_=E==="point"?r.get("text-max-width").evaluate(u,{},t.canonical)*ue:0,M=()=>{t.bucket.allowVerticalPlacement&&on(x)&&(m.vertical=Zn(d,t.glyphMap,t.glyphPositions,t.imagePositions,c,_,o,A,"left",w,h,2,!0,E,f,p))};if(!a&&T){let F=C==="auto"?T.map(z=>Gp(z)):[C],I=!1;for(let z=0;z<F.length;z++){let O=F[z];if(!m.horizontal[O])if(I)m.horizontal[O]=m.horizontal[0];else{let N=Zn(d,t.glyphMap,t.glyphPositions,t.imagePositions,c,_,o,"center",O,w,h,1,!1,E,f,p);N&&(m.horizontal[O]=N,I=N.positionedLines.length===1)}}M()}else{C==="auto"&&(C=Gp(A));let F=Zn(d,t.glyphMap,t.glyphPositions,t.imagePositions,c,_,o,A,C,w,h,1,!1,E,f,p);F&&(m.horizontal[C]=F),M(),on(x)&&a&&s&&(m.vertical=Zn(d,t.glyphMap,t.glyphPositions,t.imagePositions,c,_,o,A,C,w,h,2,!1,E,f,p))}}let g,v=!1;if(u.icon&&u.icon.name){let x=t.imageMap[u.icon.name];x&&(g=dp(t.imagePositions[u.icon.name],r.get("icon-offset").evaluate(u,{},t.canonical),r.get("icon-anchor").evaluate(u,{},t.canonical)),v=!!x.sdf,t.bucket.sdfIcons===void 0?t.bucket.sdfIcons=v:t.bucket.sdfIcons!==v&&ce("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(x.pixelRatio!==t.bucket.pixelRatio||r.get("icon-rotate").constantOr(1)!==0)&&(t.bucket.iconsNeedLinear=!0))}let b=Zp(m.horizontal)||m.vertical;t.bucket.iconsInText=b?b.iconsInText:!1,(b||g)&&yx(t.bucket,u,m,g,t.imageMap,i,f,y,h,v,t.canonical)}t.showCollisionBoxes&&t.bucket.generateCollisionDebugBuffers()}function Gp(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 yx(t,e,r,n,i,o,a,s,l,u,c){let p=o.textMaxSize.evaluate(e,{});p===void 0&&(p=a);let f=t.layers[0].layout,y=f.get("icon-offset").evaluate(e,{},c),m=Zp(r.horizontal),d=24,h=a/d,g=t.tilePixelRatio*h,v=t.tilePixelRatio*p/d,b=t.tilePixelRatio*s,x=t.tilePixelRatio*f.get("symbol-spacing"),P=f.get("text-padding")*t.tilePixelRatio,w=Sp(f,e,c,t.tilePixelRatio),A=f.get("text-max-angle")/180*Math.PI,T=f.get("text-rotation-alignment")!=="viewport"&&f.get("symbol-placement")!=="point",C=f.get("icon-rotation-alignment")==="map"&&f.get("symbol-placement")!=="point",E=f.get("symbol-placement"),_=x/2,M=f.get("icon-text-fit"),F;n&&M!=="none"&&(t.allowVerticalPlacement&&r.vertical&&(F=Is(n,r.vertical,M,f.get("icon-text-fit-padding"),y,h)),m&&(n=Is(n,m,M,f.get("icon-text-fit-padding"),y,h)));let I=(z,O)=>{O.x<0||O.x>=8192||O.y<0||O.y>=8192||mx(t,O,z,r,n,i,F,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,g,[P,P,P,P],T,l,b,w,C,y,e,o,u,c,a)};if(E==="line")for(let z of Op(e.geometry,0,0,8192,8192)){let O=zp(z,x,A,r.vertical||m,n,d,v,t.overscaling,8192);for(let N of O){let K=m;(!K||!hx(t,K.text,_,N))&&I(z,N)}}else if(E==="line-center"){for(let z of e.geometry)if(z.length>1){let O=Bp(z,A,r.vertical||m,n,d,v);O&&I(z,O)}}else if(e.type==="Polygon")for(let z of Sr(e.geometry,0)){let O=$p(z,16);I(z[0],new et(O.x,O.y,0))}else if(e.type==="LineString")for(let z of e.geometry)I(z,new et(z[0].x,z[0].y,0));else if(e.type==="Point")for(let z of e.geometry)for(let O of z)I([O],new et(O.x,O.y,0))}function qp(t,e,r,n,i,o,a,s,l,u,c,p,f,y,m){let d=Up(e,r,s,i,o,a,n,t.allowVerticalPlacement),h=t.textSizeData,g=null;h.kind==="source"?(g=[Ct*i.layout.get("text-size").evaluate(a,{})],g[0]>Qe&&ce("".concat(t.layerIds[0],\': Value for "text-size" is >= \').concat(Er,\'. Reduce your "text-size".\'))):h.kind==="composite"&&(g=[Ct*y.compositeTextSizes[0].evaluate(a,{},m),Ct*y.compositeTextSizes[1].evaluate(a,{},m)],(g[0]>Qe||g[1]>Qe)&&ce("".concat(t.layerIds[0],\': Value for "text-size" is >= \').concat(Er,\'. Reduce your "text-size".\'))),t.addSymbols(t.text,d,g,s,o,a,u,e,l.lineStartIndex,l.lineLength,f,m);for(let v of c)p[v]=t.text.placedSymbolArray.length-1;return d.length*4}function Zp(t){for(let e in t)return t[e];return null}function mx(t,e,r,n,i,o,a,s,l,u,c,p,f,y,m,d,h,g,v,b,x,P,w,A,T){let C=t.addToLineVertexArray(e,r),E,_,M,F,I=0,z=0,O=0,N=0,K=-1,Y=-1,Q={},ye=(0,Ms.default)(""),_e=0,re=0;if(s._unevaluatedLayout.getValue("text-radial-offset")===void 0?[_e,re]=s.layout.get("text-offset").evaluate(x,{},A).map(Se=>Se*ue):(_e=s.layout.get("text-radial-offset").evaluate(x,{},A)*ue,re=Ls),t.allowVerticalPlacement&&n.vertical){let xe=s.layout.get("text-rotate").evaluate(x,{},A)+90,He=n.vertical;M=new Qt(l,e,u,c,p,He,f,y,m,xe),a&&(F=new Qt(l,e,u,c,p,a,h,g,m,xe))}if(i){let Se=s.layout.get("icon-rotate").evaluate(x,{}),xe=s.layout.get("icon-text-fit")!=="none",He=Es(i,Se,w,xe),Ke=a?Es(a,Se,w,xe):void 0;_=new Qt(l,e,u,c,p,i,h,g,!1,Se),I=He.length*4;let al=t.iconSizeData,Et=null;al.kind==="source"?(Et=[Ct*s.layout.get("icon-size").evaluate(x,{})],Et[0]>Qe&&ce("".concat(t.layerIds[0],\': Value for "icon-size" is >= \').concat(Er,\'. Reduce your "icon-size".\'))):al.kind==="composite"&&(Et=[Ct*P.compositeIconSizes[0].evaluate(x,{},A),Ct*P.compositeIconSizes[1].evaluate(x,{},A)],(Et[0]>Qe||Et[1]>Qe)&&ce("".concat(t.layerIds[0],\': Value for "icon-size" is >= \').concat(Er,\'. Reduce your "icon-size".\'))),t.addSymbols(t.icon,He,Et,b,v,x,0,e,C.lineStartIndex,C.lineLength,-1,A),K=t.icon.placedSymbolArray.length-1,Ke&&(z=Ke.length*4,t.addSymbols(t.icon,Ke,Et,b,v,x,2,e,C.lineStartIndex,C.lineLength,-1,A),Y=t.icon.placedSymbolArray.length-1)}let Pe=Object.keys(n.horizontal);for(let Se of Pe){let xe=n.horizontal[Se];if(!E){ye=(0,Ms.default)(xe.text);let Ke=s.layout.get("text-rotate").evaluate(x,{},A);E=new Qt(l,e,u,c,p,xe,f,y,m,Ke)}let He=xe.positionedLines.length===1;if(O+=qp(t,e,xe,o,s,m,x,d,C,n.vertical?1:3,He?Pe:[Se],Q,K,P,A),He)break}n.vertical&&(N+=qp(t,e,n.vertical,o,s,m,x,d,C,2,["vertical"],Q,Y,P,A));let $e=E?E.boxStartIndex:t.collisionBoxArray.length,fi=E?E.boxEndIndex:t.collisionBoxArray.length,ya=M?M.boxStartIndex:t.collisionBoxArray.length,ma=M?M.boxEndIndex:t.collisionBoxArray.length,zr=_?_.boxStartIndex:t.collisionBoxArray.length,yi=_?_.boxEndIndex:t.collisionBoxArray.length,ha=F?F.boxStartIndex:t.collisionBoxArray.length,mi=F?F.boxEndIndex:t.collisionBoxArray.length,Ee=-1,tr=(Se,xe)=>Se&&Se.circleDiameter?Math.max(Se.circleDiameter,xe):xe;Ee=tr(E,Ee),Ee=tr(M,Ee),Ee=tr(_,Ee),Ee=tr(F,Ee);let hi=Ee>-1?1:0;hi&&(Ee*=T/ue),t.glyphOffsetArray.length>=We.MAX_GLYPHS&&ce("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),x.sortKey!==void 0&&t.addToSortKeyRanges(t.symbolInstances.length,x.sortKey),t.symbolInstances.emplaceBack(e.x,e.y,Q.right>=0?Q.right:-1,Q.center>=0?Q.center:-1,Q.left>=0?Q.left:-1,Q.vertical||-1,K,Y,ye,$e,fi,ya,ma,zr,yi,ha,mi,u,O,N,I,z,hi,0,f,_e,re,Ee)}function hx(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 Xo=1,ei=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*Xo,h:p.bitmap.height+2*Xo};n.push(f),u[c]={rect:f,metrics:p.metrics}}}let{w:i,h:o}=Gn(n),a=new Wt({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;Wt.copy(c.bitmap,a,{x:0,y:0},{x:p.x+Xo,y:p.y+Xo},c.bitmap)}}this.image=a,this.positions=r}};k("GlyphAtlas",ei);function Wp(t,e,r){e=Math.pow(2,r)-e-1;var n=Jp(t*256,e*256,r),i=Jp((t+1)*256,(e+1)*256,r);return n[0]+","+n[1]+","+i[0]+","+i[1]}function Jp(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 Yp=Z(he(),1);var Ds=63710088e-1,ti=class t{constructor(e,r){if(isNaN(e)||isNaN(r))throw new Error("Invalid LngLat object: (".concat(e,", ").concat(r,")"));if(this.lng=+e,this.lat=+r,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new t(ml(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return"LngLat(".concat(this.lng,", ").concat(this.lat,")")}distanceTo(e){let r=Math.PI/180,n=this.lat*r,i=e.lat*r,o=Math.sin(n)*Math.sin(i)+Math.cos(n)*Math.cos(i)*Math.cos((e.lng-this.lng)*r);return Ds*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 Hp=2*Math.PI*Ds;function Kp(t){return Hp*Math.cos(t*Math.PI/180)}function dx(t){return(180+t)/360}function gx(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function xx(t,e){return t/Kp(e)}function bx(t){return t*360-180}function Vs(t){let e=180-t*360;return 360/Math.PI*Math.atan(Math.exp(e*Math.PI/180))-90}function vx(t,e){return t*Kp(Vs(e))}function Px(t){return 1/Math.cos(t*Math.PI/180)}var Qo=class t{constructor(e,r,n=0){this.x=+e,this.y=+r,this.z=+n}static fromLngLat(e,r=0){let n=ti.convert(e);return new t(dx(n.lng),gx(n.lat),xx(r,n.lat))}toLngLat(){return new ti(bx(this.x),Vs(this.y))}toAltitude(){return vx(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/Hp*Px(Vs(this.y))}};var ea=class{constructor(e,r,n){if(e<0||e>25||n<0||n>=Math.pow(2,e)||r<0||r>=Math.pow(2,e))throw new Error("x=".concat(r,", y=").concat(n,", z=").concat(e," outside of bounds. 0<=x<").concat(Math.pow(2,e),", 0<=y<").concat(Math.pow(2,e)," 0<=z<=25 "));this.z=e,this.x=r,this.y=n,this.key=ri(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=Wp(this.x,this.y,this.z),o=Sx(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 Yp.default((e.x*r-this.x)*8192,(e.y*r-this.y)*8192)}toString(){return"".concat(this.z,"/").concat(this.x,"/").concat(this.y)}},Bs=class{constructor(e,r){this.wrap=e,this.canonical=r,this.key=ri(e,r.z,r.z,r.x,r.y)}},ni=class t{constructor(e,r,n,i,o){if(e<n)throw new Error("overscaledZ should be >= z; overscaledZ = ".concat(e,"; z = ").concat(n));this.overscaledZ=e,this.wrap=r,this.canonical=new ea(n,+i,+o),this.key=ri(r,e,n,i,o)}clone(){return new t(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw new Error("targetZ > this.overscaledZ; targetZ = ".concat(e,"; overscaledZ = ").concat(this.overscaledZ));let r=this.canonical.z-e;return e>this.canonical.z?new t(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new t(e,this.wrap,e,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(e,r){if(e>this.overscaledZ)throw new Error("targetZ > this.overscaledZ; targetZ = ".concat(e,"; overscaledZ = ").concat(this.overscaledZ));let n=this.canonical.z-e;return e>this.canonical.z?ri(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):ri(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 Bs(this.wrap,this.canonical)}toString(){return"".concat(this.overscaledZ,"/").concat(this.canonical.x,"/").concat(this.canonical.y)}getTilePoint(e){return this.canonical.getTilePoint(new Qo(e.x-this.wrap,e.y))}};function ri(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 Sx(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}k("CanonicalTileID",ea);k("OverscaledTileID",ni,{omit:["posMatrix"]});var ta=class{constructor(e){this.tileID=new ni(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.dependencySentinel=-1}parse(e,r,n,i,o){this.status="parsing",this.data=e,this.collisionBoxArray=new Sn;let a=new Fr(Object.keys(e.layers).sort()),s=new Yn(this.tileID,this.promoteId);s.bucketLayerIDs=[];let l={},u={featureIndex:s,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:n},c=r.familiesBySource[this.source];for(let x in c){let P=e.layers[x];if(!P)continue;P.version===1&&ce(\'Vector tile source "\'.concat(this.source,\'" layer "\').concat(x,\'" \')+"does not use vector tile spec v2 and therefore may have some rendering errors.");let w=a.encode(x),A=[];for(let T=0;T<P.length;T++){let C=P.feature(T),E=s.getId(C,x);A.push({feature:C,id:E,index:T,sourceLayerIndex:w})}for(let T of c[x]){let C=T[0];if(C.source!==this.source&&ce("layer.source = ".concat(C.source," does not equal this.source = ").concat(this.source)),C.minzoom&&this.zoom<Math.floor(C.minzoom)||C.maxzoom&&this.zoom>=C.maxzoom||C.visibility==="none")continue;zs(T,this.zoom,n),(l[C.id]=C.createBucket({index:s.bucketLayerIDs.length,layers:T,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:w,sourceID:this.source})).populate(A,u,this.tileID.canonical),s.bucketLayerIDs.push(T.map(_=>_.id))}}let p,f,y,m,d=Rr(u.glyphDependencies,x=>Object.keys(x).map(Number));this.inFlightDependencies.forEach(x=>x==null?void 0:x.cancel()),this.inFlightDependencies=[];let h=++this.dependencySentinel;Object.keys(d).length?this.inFlightDependencies.push(i.send("getGlyphs",{uid:this.uid,stacks:d,source:this.source,tileID:this.tileID,type:"glyphs"},(x,P)=>{h===this.dependencySentinel&&(p||(p=x,f=P,b.call(this)))})):f={};let g=Object.keys(u.iconDependencies);g.length?this.inFlightDependencies.push(i.send("getImages",{icons:g,source:this.source,tileID:this.tileID,type:"icons"},(x,P)=>{h===this.dependencySentinel&&(p||(p=x,y=P,b.call(this)))})):y={};let v=Object.keys(u.patternDependencies);v.length?this.inFlightDependencies.push(i.send("getImages",{icons:v,source:this.source,tileID:this.tileID,type:"patterns"},(x,P)=>{h===this.dependencySentinel&&(p||(p=x,m=P,b.call(this)))})):m={},b.call(this);function b(){if(p)return o(p);if(f&&y&&m){let x=new ei(f),P=new qn(y,m);for(let w in l){let A=l[w];A instanceof We?(zs(A.layers,this.zoom,n),jp({bucket:A,glyphMap:f,glyphPositions:x.positions,imageMap:y,imagePositions:P.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):A.hasPattern&&(A instanceof Xt||A instanceof Kt||A instanceof Yt)&&(zs(A.layers,this.zoom,n),A.addFeatures(u,this.tileID.canonical,P.patternPositions))}this.status="done",o(null,{buckets:Object.values(l).filter(w=>!w.isEmpty()),featureIndex:s,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:x.image,imageAtlas:P,glyphMap:this.returnDependencies?f:null,iconMap:this.returnDependencies?y:null,glyphPositions:this.returnDependencies?x.positions:null})}}}};function zs(t,e,r){let n=new q(e);for(let i of t)i.recalculate(n,r)}var wx=60,f_=1e3/wx;var Vr=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}};function Ax(t,e){let r=Wa(t.request,(n,i,o,a)=>{n?e(n):i&&e(null,{vectorTile:new Xp.default.VectorTile(new Qp.default(i)),rawData:i,cacheControl:o,expires:a})});return()=>{r.cancel(),e()}}var Br=class{constructor(e,r,n,i){this.actor=e,this.layerIndex=r,this.availableImages=n,this.loadVectorData=i||Ax,this.loading={},this.loaded={}}loadTile(e,r){let n=e.uid;this.loading||(this.loading={});let i=e&&e.request&&e.request.collectResourceTiming?new Vr(e.request):!1,o=this.loading[n]=new ta(e);o.abort=this.loadVectorData(e,(a,s)=>{if(delete this.loading[n],a||!s)return o.status="done",this.loaded[n]=o,r(a);let l=s.rawData,u={};s.expires&&(u.expires=s.expires),s.cacheControl&&(u.cacheControl=s.cacheControl);let c={};if(i){let p=i.finish();p&&(c.resourceTiming=JSON.parse(JSON.stringify(p)))}o.vectorTile=s.vectorTile,o.parse(s.vectorTile,this.layerIndex,this.availableImages,this.actor,(p,f)=>{if(p||!f)return r(p);r(null,Ae({rawTileData:l.slice(0)},f,u,c))}),this.loaded=this.loaded||{},this.loaded[n]=o})}reloadTile(e,r){let n=this.loaded,i=e.uid,o=this;if(n&&n[i]){let a=n[i];a.showCollisionBoxes=e.showCollisionBoxes,a.status==="parsing"?a.parse(a.vectorTile,this.layerIndex,this.availableImages,this.actor,r):a.status==="done"&&(a.vectorTile?a.parse(a.vectorTile,this.layerIndex,this.availableImages,this.actor,r):r())}}abortTile(e,r){let n=this.loading,i=e.uid;n&&n[i]&&n[i].abort&&(n[i].abort(),delete n[i]),r()}removeTile(e,r){let n=this.loaded,i=e.uid;n&&n[i]&&delete n[i],r()}};var ii=class{constructor(e,r,n){if(this.uid=e,r.height!==r.width)throw new RangeError("DEM tiles must be square");if(n&&n!=="mapbox"&&n!=="terrarium"){ce(\'"\'.concat(n,\'" is not a valid encoding type. Valid types include "mapbox" and "terrarium".\'));return}this.stride=r.height;let i=this.dim=r.height-2;this.data=new Uint32Array(r.data.buffer),this.encoding=n||"mapbox";for(let o=0;o<i;o++)this.data[this._idx(-1,o)]=this.data[this._idx(0,o)],this.data[this._idx(i,o)]=this.data[this._idx(i-1,o)],this.data[this._idx(o,-1)]=this.data[this._idx(o,0)],this.data[this._idx(o,i)]=this.data[this._idx(o,i-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(i,-1)]=this.data[this._idx(i-1,0)],this.data[this._idx(-1,i)]=this.data[this._idx(0,i-1)],this.data[this._idx(i,i)]=this.data[this._idx(i-1,i-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let o=0;o<i;o++)for(let a=0;a<i;a++){let s=this.get(o,a);s>this.max&&(this.max=s),s<this.min&&(this.min=s)}}get(e,r){let n=new Uint8Array(this.data.buffer),i=this._idx(e,r)*4;return(this.encoding==="terrarium"?this._unpackTerrarium:this._unpackMapbox)(n[i],n[i+1],n[i+2])}getUnpackVector(){return this.encoding==="terrarium"?[256,1,1/256,32768]:[6553.6,25.6,.1,1e4]}_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)}_unpackMapbox(e,r,n){return(e*256*256+r*256+n)/10-1e4}_unpackTerrarium(e,r,n){return e*256+r+n/256-32768}getPixels(){return new de({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)]}};k("DEMData",ii);var ra=class{constructor(){this.loaded={}}loadTile(e,r){let{uid:n,encoding:i,rawImageData:o}=e,a=Or(o)?this.getImageData(o):o,s=new ii(n,a,i);this.loaded=this.loaded||{},this.loaded[n]=s,r(null,s)}getImageData(e){(!this.offscreenCanvas||!this.offscreenCanvasContext)&&(this.offscreenCanvas=new OffscreenCanvas(e.width,e.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=e.width,this.offscreenCanvas.height=e.height,this.offscreenCanvasContext.drawImage(e,0,0,e.width,e.height);let r=this.offscreenCanvasContext.getImageData(-1,-1,e.width+2,e.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new de({width:r.width,height:r.height},r.data)}removeTile(e){let r=this.loaded,n=e.uid;r&&r[n]&&delete r[n]}};var Cf=Z(nf(),1);var Rs=Z(he(),1),of=Z(It(),1);var _x=of.default.VectorTileFeature.prototype.toGeoJSON,Os=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 Rs.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 Rs.default(i[0],i[1]));e.push(n)}return e}}toGeoJSON(e,r,n){return _x.call(this,e,r,n)}},ia=class{constructor(e){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=8192,this.length=e.length,this._features=e}feature(e){return new Os(this._features[e])}};var kf=Z(pf(),1);var ff=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],$s=1,ai=8,li=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!==$s)throw new Error("Got v".concat(i," data when expected v").concat($s,"."));let o=ff[n&15];if(!o)throw new Error("Unrecognized array type.");let[a]=new Uint16Array(e,2,1),[s]=new Uint32Array(e,4,1);return new t(s,a,o,e)}constructor(e,r=64,n=Float64Array,i){if(isNaN(e)||e<0)throw new Error("Unpexpected numItems value: ".concat(e,"."));this.numItems=+e,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=n,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;let o=ff.indexOf(this.ArrayType),a=e*2*this.ArrayType.BYTES_PER_ELEMENT,s=e*this.IndexArrayType.BYTES_PER_ELEMENT,l=(8-s%8)%8;if(o<0)throw new Error("Unexpected typed array class: ".concat(n,"."));i&&i instanceof ArrayBuffer?(this.data=i,this.ids=new this.IndexArrayType(this.data,ai,e),this.coords=new this.ArrayType(this.data,ai+s+l,e*2),this._pos=e*2,this._finished=!0):(this.data=new ArrayBuffer(ai+a+s+l),this.ids=new this.IndexArrayType(this.data,ai,e),this.coords=new this.ArrayType(this.data,ai+s+l,e*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,($s<<4)+o]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=e)}add(e,r){let n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=e,this.coords[this._pos++]=r,n}finish(){let e=this._pos>>1;if(e!==this.numItems)throw new Error("Added ".concat(e," items when expected ").concat(this.numItems,"."));return qs(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 h=f;h<=p;h++){let g=a[2*h],v=a[2*h+1];g>=e&&g<=n&&v>=r&&v<=i&&u.push(o[h])}continue}let y=f+p>>1,m=a[2*y],d=a[2*y+1];m>=e&&m<=n&&d>=r&&d<=i&&u.push(o[y]),(c===0?e<=m:r<=d)&&(l.push(f),l.push(y-1),l.push(1-c)),(c===0?n>=m:i>=d)&&(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 h=f;h<=p;h++)yf(o[2*h],o[2*h+1],e,r)<=u&&l.push(i[h]);continue}let y=f+p>>1,m=o[2*y],d=o[2*y+1];yf(m,d,e,r)<=u&&l.push(i[y]),(c===0?e-n<=m:r-n<=d)&&(s.push(f),s.push(y-1),s.push(1-c)),(c===0?e+n>=m:r+n>=d)&&(s.push(y+1),s.push(p),s.push(1-c))}return l}};function qs(t,e,r,n,i,o){if(i-n<=r)return;let a=n+i>>1;mf(t,e,a,n,i,o),qs(t,e,r,n,a-1,1-o),qs(t,e,r,a+1,i,1-o)}function mf(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)),d=Math.min(i,Math.floor(r+(u-c)*f/u+y));mf(t,e,r,m,d,o)}let a=e[2*r+o],s=n,l=i;for(si(t,e,n,r),e[2*i+o]>a&&si(t,e,n,i);s<l;){for(si(t,e,s,l),s++,l--;e[2*s+o]<a;)s++;for(;e[2*l+o]>a;)l--}e[2*n+o]===a?si(t,e,n,l):(l++,si(t,e,l,i)),l<=r&&(n=l+1),r<=l&&(i=l-1)}}function si(t,e,r,n){Gs(t,r,n),Gs(e,2*r,2*n),Gs(e,2*r+1,2*n+1)}function Gs(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}function yf(t,e,r,n){let i=t-r,o=e-n;return i*i+o*o}var Bx={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},hf=Math.fround||(t=>e=>(t[0]=+e,t[0]))(new Float32Array(1)),er=2,Tt=3,js=4,kt=5,gf=6,ui=class{constructor(e){this.options=Object.assign(Object.create(Bx),e),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(e){let{log:r,minZoom:n,maxZoom:i}=this.options;r&&console.time("total time");let o="prepare ".concat(e.length," points");r&&console.time(o),this.points=e;let a=[];for(let l=0;l<e.length;l++){let u=e[l];if(!u.geometry)continue;let[c,p]=u.geometry.coordinates,f=hf(aa(c)),y=hf(sa(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(aa(n),sa(a),aa(o),sa(i)),u=s.data,c=[];for(let p of l){let f=this.stride*p;c.push(u[f+kt]>1?df(u,f,this.clusterProps):this.points[u[f+Tt]])}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+js]===e&&p.push(a[y+kt]>1?df(a,y,this.clusterProps):this.points[a[y+Tt]])}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 li(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+kt]>1,c,p,f;if(u)c=xf(r,l,this.clusterProps),p=r[l],f=r[l+1];else{let d=this.points[r[l+Tt]];c=d.properties;let[h,g]=d.geometry.coordinates;p=aa(h),f=sa(g)}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+Tt]:m=this.points[r[l+Tt]].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+er]<=r)continue;l[p+er]=r;let f=l[p],y=l[p+1],m=e.within(l[p],l[p+1],s),d=l[p+kt],h=d;for(let g of m){let v=g*c;l[v+er]>r&&(h+=l[v+kt])}if(h>d&&h>=a){let g=f*d,v=y*d,b,x=-1,P=((p/c|0)<<5)+(r+1)+this.points.length;for(let w of m){let A=w*c;if(l[A+er]<=r)continue;l[A+er]=r;let T=l[A+kt];g+=l[A]*T,v+=l[A+1]*T,l[A+js]=P,o&&(b||(b=this._map(l,p,!0),x=this.clusterProps.length,this.clusterProps.push(b)),o(b,this._map(l,A)))}l[p+js]=P,u.push(g/h,v/h,1/0,P,-1,h),o&&u.push(x)}else{for(let g=0;g<c;g++)u.push(l[p+g]);if(h>1)for(let g of m){let v=g*c;if(!(l[v+er]<=r)){l[v+er]=r;for(let b=0;b<c;b++)u.push(l[v+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+kt]>1){let a=this.clusterProps[e[r+gf]];return n?Object.assign({},a):a}let i=this.points[e[r+Tt]].properties,o=this.options.map(i);return n&&o===i?Object.assign({},o):o}};function df(t,e,r){return{type:"Feature",id:t[e+Tt],properties:xf(t,e,r),geometry:{type:"Point",coordinates:[zx(t[e]),Rx(t[e+1])]}}}function xf(t,e,r){let n=t[e+kt],i=n>=1e4?"".concat(Math.round(n/1e3),"k"):n>=1e3?"".concat(Math.round(n/100)/10,"k"):n,o=t[e+gf],a=o===-1?{}:Object.assign({},r[o]);return Object.assign(a,{cluster:!0,cluster_id:t[e+Tt],point_count:n,point_count_abbreviated:i})}function aa(t){return t/360+.5}function sa(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 zx(t){return(t-.5)*360}function Rx(t){let e=(180-t*360)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function ci(t,e,r,n){for(var i=n,o=r-e>>1,a=r-e,s,l=t[e],u=t[e+1],c=t[r],p=t[r+1],f=e+3;f<r;f+=3){var y=Ox(t[f],t[f+1],l,u,c,p);if(y>i)s=f,i=y;else if(y===i){var m=Math.abs(f-o);m<a&&(s=f,a=m)}}i>n&&(s-e>3&&ci(t,e,s,n),t[s+2]=i,r-s>3&&ci(t,s,r,n))}function Ox(t,e,r,n,i,o){var a=i-r,s=o-n;if(a!==0||s!==0){var 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 pt(t,e,r,n){var i={id:typeof t>"u"?null:t,type:e,geometry:r,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return Nx(i),i}function Nx(t){var e=t.geometry,r=t.type;if(r==="Point"||r==="MultiPoint"||r==="LineString")Zs(t,e);else if(r==="Polygon"||r==="MultiLineString")for(var n=0;n<e.length;n++)Zs(t,e[n]);else if(r==="MultiPolygon")for(n=0;n<e.length;n++)for(var i=0;i<e[n].length;i++)Zs(t,e[n][i])}function Zs(t,e){for(var r=0;r<e.length;r+=3)t.minX=Math.min(t.minX,e[r]),t.minY=Math.min(t.minY,e[r+1]),t.maxX=Math.max(t.maxX,e[r]),t.maxY=Math.max(t.maxY,e[r+1])}function Hs(t,e){var r=[];if(t.type==="FeatureCollection")for(var n=0;n<t.features.length;n++)la(r,t.features[n],e,n);else t.type==="Feature"?la(r,t,e):la(r,{geometry:t},e);return r}function la(t,e,r,n){if(e.geometry){var i=e.geometry.coordinates,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")bf(i,s);else if(o==="MultiPoint")for(var u=0;u<i.length;u++)bf(i[u],s);else if(o==="LineString")Ws(i,s,a,!1);else if(o==="MultiLineString")if(r.lineMetrics){for(u=0;u<i.length;u++)s=[],Ws(i[u],s,a,!1),t.push(pt(l,"LineString",s,e.properties));return}else Js(i,s,a,!1);else if(o==="Polygon")Js(i,s,a,!0);else if(o==="MultiPolygon")for(u=0;u<i.length;u++){var c=[];Js(i[u],c,a,!0),s.push(c)}else if(o==="GeometryCollection"){for(u=0;u<e.geometry.geometries.length;u++)la(t,{id:l,geometry:e.geometry.geometries[u],properties:e.properties},r,n);return}else throw new Error("Input data is not a valid GeoJSON object.");t.push(pt(l,o,s,e.properties))}}function bf(t,e){e.push(vf(t[0])),e.push(Pf(t[1])),e.push(0)}function Ws(t,e,r,n){for(var i,o,a=0,s=0;s<t.length;s++){var l=vf(t[s][0]),u=Pf(t[s][1]);e.push(l),e.push(u),e.push(0),s>0&&(n?a+=(i*u-l*o)/2:a+=Math.sqrt(Math.pow(l-i,2)+Math.pow(u-o,2))),i=l,o=u}var c=e.length-3;e[2]=1,ci(e,0,c,r),e[c+2]=1,e.size=Math.abs(a),e.start=0,e.end=e.size}function Js(t,e,r,n){for(var i=0;i<t.length;i++){var o=[];Ws(t[i],o,r,n),e.push(o)}}function vf(t){return t/360+.5}function Pf(t){var e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function 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;for(var l=[],u=0;u<t.length;u++){var c=t[u],p=c.geometry,f=c.type,y=i===0?c.minX:c.minY,m=i===0?c.maxX:c.maxY;if(y>=r&&m<n){l.push(c);continue}else if(m<r||y>=n)continue;var d=[];if(f==="Point"||f==="MultiPoint")Ux(p,d,r,n,i);else if(f==="LineString")wf(p,d,r,n,i,!1,s.lineMetrics);else if(f==="MultiLineString")Ks(p,d,r,n,i,!1);else if(f==="Polygon")Ks(p,d,r,n,i,!0);else if(f==="MultiPolygon")for(var h=0;h<p.length;h++){var g=[];Ks(p[h],g,r,n,i,!0),g.length&&d.push(g)}if(d.length){if(s.lineMetrics&&f==="LineString"){for(h=0;h<d.length;h++)l.push(pt(c.id,f,d[h],c.tags));continue}(f==="LineString"||f==="MultiLineString")&&(d.length===1?(f="LineString",d=d[0]):f="MultiLineString"),(f==="Point"||f==="MultiPoint")&&(f=d.length===3?"Point":"MultiPoint"),l.push(pt(c.id,f,d,c.tags))}}return l.length?l:null}function Ux(t,e,r,n,i){for(var o=0;o<t.length;o+=3){var a=t[o+i];a>=r&&a<=n&&(e.push(t[o]),e.push(t[o+1]),e.push(t[o+2]))}}function wf(t,e,r,n,i,o,a){for(var s=Sf(t),l=i===0?$x:Gx,u=t.start,c,p,f=0;f<t.length-3;f+=3){var y=t[f],m=t[f+1],d=t[f+2],h=t[f+3],g=t[f+4],v=i===0?y:m,b=i===0?h:g,x=!1;a&&(c=Math.sqrt(Math.pow(y-h,2)+Math.pow(m-g,2))),v<r?b>r&&(p=l(s,y,m,h,g,r),a&&(s.start=u+c*p)):v>n?b<n&&(p=l(s,y,m,h,g,n),a&&(s.start=u+c*p)):Ys(s,y,m,d),b<r&&v>=r&&(p=l(s,y,m,h,g,r),x=!0),b>n&&v<=n&&(p=l(s,y,m,h,g,n),x=!0),!o&&x&&(a&&(s.end=u+c*p),e.push(s),s=Sf(t)),a&&(u+=c)}var P=t.length-3;y=t[P],m=t[P+1],d=t[P+2],v=i===0?y:m,v>=r&&v<=n&&Ys(s,y,m,d),P=s.length-3,o&&P>=3&&(s[P]!==s[0]||s[P+1]!==s[1])&&Ys(s,s[0],s[1],s[2]),s.length&&e.push(s)}function Sf(t){var e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function Ks(t,e,r,n,i,o){for(var a=0;a<t.length;a++)wf(t[a],e,r,n,i,o,!1)}function Ys(t,e,r,n){t.push(e),t.push(r),t.push(n)}function $x(t,e,r,n,i,o){var a=(o-e)/(n-e);return t.push(o),t.push(r+(i-r)*a),t.push(1),a}function Gx(t,e,r,n,i,o){var a=(o-r)/(i-r);return t.push(e+(n-e)*a),t.push(o),t.push(1),a}function Qs(t,e){var 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=Af(i,1).concat(n)),o&&(n=n.concat(Af(o,-1)))),n}function Af(t,e){for(var r=[],n=0;n<t.length;n++){var i=t[n],o=i.type,a;if(o==="Point"||o==="MultiPoint"||o==="LineString")a=Xs(i.geometry,e);else if(o==="MultiLineString"||o==="Polygon"){a=[];for(var s=0;s<i.geometry.length;s++)a.push(Xs(i.geometry[s],e))}else if(o==="MultiPolygon")for(a=[],s=0;s<i.geometry.length;s++){for(var l=[],u=0;u<i.geometry[s].length;u++)l.push(Xs(i.geometry[s][u],e));a.push(l)}r.push(pt(i.id,o,a,i.tags))}return r}function Xs(t,e){var r=[];r.size=t.size,t.start!==void 0&&(r.start=t.start,r.end=t.end);for(var n=0;n<t.length;n+=3)r.push(t[n]+e,t[n+1],t[n+2]);return r}function ua(t,e){if(t.transformed)return t;var r=1<<t.z,n=t.x,i=t.y,o,a,s;for(o=0;o<t.features.length;o++){var l=t.features[o],u=l.geometry,c=l.type;if(l.geometry=[],c===1)for(a=0;a<u.length;a+=2)l.geometry.push(_f(u[a],u[a+1],e,r,n,i));else for(a=0;a<u.length;a++){var p=[];for(s=0;s<u[a].length;s+=2)p.push(_f(u[a][s],u[a][s+1],e,r,n,i));l.geometry.push(p)}}return t.transformed=!0,t}function _f(t,e,r,n,i,o){return[Math.round(r*(t*n-i)),Math.round(r*(e*n-o))]}function tl(t,e,r,n,i){for(var o=e===i.maxZoom?0:i.tolerance/((1<<e)*i.extent),a={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:r,y:n,z:e,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},s=0;s<t.length;s++){a.numFeatures++,qx(a,t[s],o,i);var l=t[s].minX,u=t[s].minY,c=t[s].maxX,p=t[s].maxY;l<a.minX&&(a.minX=l),u<a.minY&&(a.minY=u),c>a.maxX&&(a.maxX=c),p>a.maxY&&(a.maxY=p)}return a}function qx(t,e,r,n){var i=e.geometry,o=e.type,a=[];if(o==="Point"||o==="MultiPoint")for(var s=0;s<i.length;s+=3)a.push(i[s]),a.push(i[s+1]),t.numPoints++,t.numSimplified++;else if(o==="LineString")el(a,i,t,r,!1,!1);else if(o==="MultiLineString"||o==="Polygon")for(s=0;s<i.length;s++)el(a,i[s],t,r,o==="Polygon",s===0);else if(o==="MultiPolygon")for(var l=0;l<i.length;l++){var u=i[l];for(s=0;s<u.length;s++)el(a,u[s],t,r,!0,s===0)}if(a.length){var c=e.tags||null;if(o==="LineString"&&n.lineMetrics){c={};for(var p in e.tags)c[p]=e.tags[p];c.mapbox_clip_start=i.start/i.size,c.mapbox_clip_end=i.end/i.size}var f={geometry:a,type:o==="Polygon"||o==="MultiPolygon"?3:o==="LineString"||o==="MultiLineString"?2:1,tags:c};e.id!==null&&(f.id=e.id),t.features.push(f)}}function el(t,e,r,n,i,o){var a=n*n;if(n>0&&e.size<(i?a:n)){r.numPoints+=e.length/3;return}for(var s=[],l=0;l<e.length;l+=3)(n===0||e[l+2]>a)&&(r.numSimplified++,s.push(e[l]),s.push(e[l+1])),r.numPoints++;i&&jx(s,o),t.push(s)}function jx(t,e){for(var r=0,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(n=0,i=t.length;n<i/2;n+=2){var a=t[n],s=t[n+1];t[n]=t[i-2-n],t[n+1]=t[i-1-n],t[i-2-n]=a,t[i-1-n]=s}}function nl(t,e){return new ca(t,e)}function ca(t,e){e=this.options=Zx(Object.create(this.options),e);var r=e.debug;if(r&&console.time("preprocess data"),e.maxZoom<0||e.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw new Error("promoteId and generateId cannot be used together.");var n=Hs(t,e);this.tiles={},this.tileCoords=[],r&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",e.indexMaxZoom,e.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),n=Qs(n,e),n.length&&this.splitTile(n,0,0,0),r&&(n.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}ca.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};ca.prototype.splitTile=function(t,e,r,n,i,o,a){for(var s=[t,e,r,n],l=this.options,u=l.debug;s.length;){n=s.pop(),r=s.pop(),e=s.pop(),t=s.pop();var c=1<<e,p=rl(e,r,n),f=this.tiles[p];if(!f&&(u>1&&console.time("creation"),f=this.tiles[p]=tl(t,e,r,n,l),this.tileCoords.push({z:e,x:r,y:n}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,r,n,f.numFeatures,f.numPoints,f.numSimplified),console.timeEnd("creation"));var y="z"+e;this.stats[y]=(this.stats[y]||0)+1,this.total++}if(f.source=t,i){if(e===l.maxZoom||e===i)continue;var m=1<<i-e;if(r!==Math.floor(o/m)||n!==Math.floor(a/m))continue}else if(e===l.indexMaxZoom||f.numPoints<=l.indexMaxPoints)continue;if(f.source=null,t.length!==0){u>1&&console.time("clipping");var d=.5*l.buffer/l.extent,h=.5-d,g=.5+d,v=1+d,b,x,P,w,A,T;b=x=P=w=null,A=Ue(t,c,r-d,r+g,0,f.minX,f.maxX,l),T=Ue(t,c,r+h,r+v,0,f.minX,f.maxX,l),t=null,A&&(b=Ue(A,c,n-d,n+g,1,f.minY,f.maxY,l),x=Ue(A,c,n+h,n+v,1,f.minY,f.maxY,l),A=null),T&&(P=Ue(T,c,n-d,n+g,1,f.minY,f.maxY,l),w=Ue(T,c,n+h,n+v,1,f.minY,f.maxY,l),T=null),u>1&&console.timeEnd("clipping"),s.push(b||[],e+1,r*2,n*2),s.push(x||[],e+1,r*2,n*2+1),s.push(P||[],e+1,r*2+1,n*2),s.push(w||[],e+1,r*2+1,n*2+1)}}};ca.prototype.getTile=function(t,e,r){var n=this.options,i=n.extent,o=n.debug;if(t<0||t>24)return null;var a=1<<t;e=(e%a+a)%a;var s=rl(t,e,r);if(this.tiles[s])return ua(this.tiles[s],i);o>1&&console.log("drilling down to z%d-%d-%d",t,e,r);for(var l=t,u=e,c=r,p;!p&&l>0;)l--,u=Math.floor(u/2),c=Math.floor(c/2),p=this.tiles[rl(l,u,c)];return!p||!p.source?null:(o>1&&console.log("found parent tile z%d-%d-%d",l,u,c),o>1&&console.time("drilling down"),this.splitTile(p.source,l,u,c,t,e,r),o>1&&console.timeEnd("drilling down"),this.tiles[s]?ua(this.tiles[s],i):null)};function rl(t,e,r){return((1<<t)*r+e)*32+t}function Zx(t,e){for(var r in e)t[r]=e[r];return t}function pi(t,e){return e?t.properties[e]:t.id}function il(t,e){if(t==null)return!0;if(t.type==="Feature")return pi(t,e)!=null;if(t.type==="FeatureCollection"){let r=new Set;for(let n of t.features){let i=pi(n,e);if(i==null||r.has(i))return!1;r.add(i)}return!0}return!1}function ol(t,e){let r=new Map;if(t!=null)if(t.type==="Feature")r.set(pi(t,e),t);else for(let n of t.features)r.set(pi(n,e),n);return r}function If(t,e,r){var n,i,o,a;if(e.removeAll&&t.clear(),e.remove)for(let s of e.remove)t.delete(s);if(e.add)for(let s of e.add){let l=pi(s,r);l!=null&&t.set(l,s)}if(e.update)for(let s of e.update){let l=t.get(s.id);if(l==null)continue;let u=s.newGeometry||s.removeAllProperties,c=!s.removeAllProperties&&(((n=s.removeProperties)==null?void 0:n.length)>0||((i=s.addOrUpdateProperties)==null?void 0:i.length)>0);if((u||c)&&(l={...l},t.set(s.id,l),c&&(l.properties={...l.properties})),s.newGeometry&&(l.geometry=s.newGeometry),s.removeAllProperties)l.properties={};else if(((o=s.removeProperties)==null?void 0:o.length)>0)for(let p of s.removeProperties)Object.prototype.hasOwnProperty.call(l.properties,p)&&delete l.properties[p];if(((a=s.addOrUpdateProperties)==null?void 0:a.length)>0)for(let{key:p,value:f}of s.addOrUpdateProperties)l.properties[p]=f}}function Jx(t,e){let r=t.tileID.canonical;if(!this._geoJSONIndex)return e(null,null);let n=this._geoJSONIndex.getTile(r.z,r.x,r.y);if(!n)return e(null,null);let i=new ia(n.features),o=(0,kf.default)(i);(o.byteOffset!==0||o.byteLength!==o.buffer.byteLength)&&(o=new Uint8Array(o)),e(null,{vectorTile:i,rawData:o.buffer})}var pa=class extends Br{constructor(r,n,i,o){super(r,n,i,Jx);this._dataUpdateable=new Map;this.loadGeoJSON=(r,n)=>{let{promoteId:i}=r;if(r.request)return gu(r.request,(o,a,s,l)=>{this._dataUpdateable=il(a,i)?ol(a,i):void 0,n(o,a,s,l)});if(typeof r.data=="string")try{let o=JSON.parse(r.data);this._dataUpdateable=il(o,i)?ol(o,i):void 0,n(null,o)}catch{n(new Error("Input data given to \'".concat(r.source,"\' is not a valid GeoJSON object.")))}else r.dataDiff?this._dataUpdateable?(If(this._dataUpdateable,r.dataDiff,i),n(null,{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())})):n(new Error("Cannot update existing geojson data in ".concat(r.source))):n(new Error("Input data given to \'".concat(r.source,"\' is not a valid GeoJSON object.")));return{cancel:()=>{}}};o&&(this.loadGeoJSON=o)}loadData(r,n){var o;(o=this._pendingRequest)==null||o.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});let i=r&&r.request&&r.request.collectResourceTiming?new Vr(r.request):!1;this._pendingCallback=n,this._pendingRequest=this.loadGeoJSON(r,(a,s)=>{if(delete this._pendingCallback,delete this._pendingRequest,a||!s)return n(a);if(typeof s!="object")return n(new Error("Input data given to \'".concat(r.source,"\' is not a valid GeoJSON object.")));{(0,Cf.default)(s,!0);try{if(r.filter){let u=Rt(r.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(u.result==="error")throw new Error(u.value.map(p=>"".concat(p.key,": ").concat(p.message)).join(", "));s={type:"FeatureCollection",features:s.features.filter(p=>u.value.evaluate({zoom:0},p))}}this._geoJSONIndex=r.cluster?new ui(Wx(r)).load(s.features):nl(s,r.geojsonVtOptions)}catch(u){return n(u)}this.loaded={};let l={};if(i){let u=i.finish();u&&(l.resourceTiming={},l.resourceTiming[r.source]=JSON.parse(JSON.stringify(u)))}n(null,l)}})}reloadTile(r,n){let i=this.loaded,o=r.uid;return i&&i[o]?super.reloadTile(r,n):this.loadTile(r,n)}removeSource(r,n){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),n()}getClusterExpansionZoom(r,n){try{n(null,this._geoJSONIndex.getClusterExpansionZoom(r.clusterId))}catch(i){n(i)}}getClusterChildren(r,n){try{n(null,this._geoJSONIndex.getChildren(r.clusterId))}catch(i){n(i)}}getClusterLeaves(r,n){try{n(null,this._geoJSONIndex.getLeaves(r.clusterId,r.limit,r.offset))}catch(i){n(i)}}};function Wx({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=Rt(u),p=Rt(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 fa=class{constructor(e){this.self=e,this.actor=new Oi(e,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:Br,geojson:pa},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(r,n)=>{if(this.workerSourceTypes[r])throw new Error(\'Worker source with name "\'.concat(r,\'" already registered.\'));this.workerSourceTypes[r]=n},this.self.registerRTLTextPlugin=r=>{if(ae.isParsed())throw new Error("RTL text plugin already registered.");ae.applyArabicShaping=r.applyArabicShaping,ae.processBidirectionalText=r.processBidirectionalText,ae.processStyledBidirectionalText=r.processStyledBidirectionalText}}setReferrer(e,r){this.referrer=r}setImages(e,r,n){this.availableImages[e]=r;for(let i in this.workerSources[e]){let o=this.workerSources[e][i];for(let a in o)o[a].availableImages=r}n()}setLayers(e,r,n){this.getLayerIndex(e).replace(r),n()}updateLayers(e,r,n){this.getLayerIndex(e).update(r.layers,r.removedIds),n()}loadTile(e,r,n){this.getWorkerSource(e,r.type,r.source).loadTile(r,n)}loadDEMTile(e,r,n){this.getDEMWorkerSource(e,r.source).loadTile(r,n)}reloadTile(e,r,n){this.getWorkerSource(e,r.type,r.source).reloadTile(r,n)}abortTile(e,r,n){this.getWorkerSource(e,r.type,r.source).abortTile(r,n)}removeTile(e,r,n){this.getWorkerSource(e,r.type,r.source).removeTile(r,n)}removeDEMTile(e,r){this.getDEMWorkerSource(e,r.source).removeTile(r)}removeSource(e,r,n){if(!this.workerSources[e]||!this.workerSources[e][r.type]||!this.workerSources[e][r.type][r.source])return;let i=this.workerSources[e][r.type][r.source];delete this.workerSources[e][r.type][r.source],i.removeSource!==void 0?i.removeSource(r,n):n()}loadWorkerSource(e,r,n){try{this.self.importScripts(r.url),n()}catch(i){n(i.toString())}}syncRTLPluginState(e,r,n){try{ae.setState(r);let i=ae.getPluginURL();if(ae.isLoaded()&&!ae.isParsed()&&i!=null){this.self.importScripts(i);let o=ae.isParsed(),a=o?void 0:new Error("RTL Text Plugin failed to import scripts from ".concat(i));n(a,o)}}catch(i){n(i.toString())}}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 Jo),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={send:(o,a,s)=>{this.actor.send(o,a,s,e)}};this.workerSources[e][r][n]=new this.workerSourceTypes[r](i,this.getLayerIndex(e),this.getAvailableImages(e))}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 ra),this.demWorkerSources[e][r]}};Ie()&&(self.worker=new fa(self));})();\n/*! Bundled license information:\n\nieee754/index.js:\n (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)\n*/\n',kC=l((()=>""!==Je.WORKER_URL?Je.WORKER_URL:URL.createObjectURL(new Blob([gv],{type:"text/javascript"}))),"getWorkerURL");function xv(){return new Worker(kC())}l(xv,"workerFactory");var kl="mapboxgl_preloaded_worker_pool",El=class e{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<e.workerCount;)this.workers.push(xv());return this.active[t]=!0,this.workers.slice()}release(e){delete this.active[e],0===this.numActive()&&(this.workers.forEach((e=>{e.terminate()})),this.workers=null)}isPreloaded(){return!!this.active[kl]}numActive(){return Object.keys(this.active).length}};l(El,"WorkerPool");var Ja,Br=El,LC=Math.floor(ne.hardwareConcurrency/2);function Rm(){return Ja||(Ja=new Br),Ja}function bv(){Rm().acquire(kl)}function _v(){let e=Ja;e&&(e.isPreloaded()&&1===e.numActive()?(e.release(kl),Ja=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))}Br.workerCount=jr(globalThis)?Math.max(Math.min(LC,3),1):1,l(Rm,"getGlobalWorkerPool"),l(bv,"prewarm"),l(_v,"clearPrewarmedResources"),d(),d(),d();var Wt=se(Pe(),1);d();var lr=se(Pe(),1);function Om(e,t,r,i,a){let n=[];for(let s=0;s<e.length;s++){let o,l=e[s];for(let e=0;e<l.length-1;e++){let s=l[e],u=l[e+1];s.x<t&&u.x<t||(s.x<t?s=new lr.default(t,s.y+(u.y-s.y)*((t-s.x)/(u.x-s.x)))._round():u.x<t&&(u=new lr.default(t,s.y+(u.y-s.y)*((t-s.x)/(u.x-s.x)))._round()),!(s.y<r&&u.y<r)&&(s.y<r?s=new lr.default(s.x+(u.x-s.x)*((r-s.y)/(u.y-s.y)),r)._round():u.y<r&&(u=new lr.default(s.x+(u.x-s.x)*((r-s.y)/(u.y-s.y)),r)._round()),!(s.x>=i&&u.x>=i)&&(s.x>=i?s=new lr.default(i,s.y+(u.y-s.y)*((i-s.x)/(u.x-s.x)))._round():u.x>=i&&(u=new lr.default(i,s.y+(u.y-s.y)*((i-s.x)/(u.x-s.x)))._round()),!(s.y>=a&&u.y>=a)&&(s.y>=a?s=new lr.default(s.x+(u.x-s.x)*((a-s.y)/(u.y-s.y)),a)._round():u.y>=a&&(u=new lr.default(s.x+(u.x-s.x)*((a-s.y)/(u.y-s.y)),a)._round()),(!o||!s.equals(o[o.length-1]))&&(o=[s],n.push(o)),o.push(u)))))}}return n}l(Om,"clipLine"),d();var Vm=class{constructor(e,t){this.reset(e,t)}reset(e,t){this.points=e||[],this._distances=[0];for(let e=1;e<this.points.length;e++)this._distances[e]=this._distances[e-1]+this.points[e].dist(this.points[e-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(t||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(e){if(1===this.points.length)return this.points[0];e=Te(e,0,1);let t=1,r=this._distances[t],i=e*this.paddedLength+this.padding;for(;r<i&&t<this._distances.length;)r=this._distances[++t];let a=t-1,n=this._distances[a],s=r-n,o=s>0?(i-n)/s:0;return this.points[a].mult(1-o).add(this.points[t].mult(o))}};l(Vm,"PathInterpolator");var Ll=Vm;function Dl(e,t){let r=!0;return"always"===e||("never"===e||"never"===t)&&(r=!1),r}d(),l(Dl,"overlapAllowed");var Um=class{constructor(e,t,r){let i=this.boxCells=[],a=this.circleCells=[];this.xCellCount=Math.ceil(e/r),this.yCellCount=Math.ceil(t/r);for(let e=0;e<this.xCellCount*this.yCellCount;e++)i.push([]),a.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=t,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/t,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,t,r,i,a){this._forEachCell(t,r,i,a,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(t),this.bboxes.push(r),this.bboxes.push(i),this.bboxes.push(a)}insertCircle(e,t,r,i){this._forEachCell(t-i,r-i,t+i,r+i,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(t),this.circles.push(r),this.circles.push(i)}_insertBoxCell(e,t,r,i,a,n){this.boxCells[a].push(n)}_insertCircleCell(e,t,r,i,a,n){this.circleCells[a].push(n)}_query(e,t,r,i,a,n,s){if(r<0||e>this.width||i<0||t>this.height)return[];let o=[];if(e<=0&&t<=0&&this.width<=r&&this.height<=i){if(a)return[{key:null,x1:e,y1:t,x2:r,y2:i}];for(let e=0;e<this.boxKeys.length;e++)o.push({key:this.boxKeys[e],x1:this.bboxes[4*e],y1:this.bboxes[4*e+1],x2:this.bboxes[4*e+2],y2:this.bboxes[4*e+3]});for(let e=0;e<this.circleKeys.length;e++){let t=this.circles[3*e],r=this.circles[3*e+1],i=this.circles[3*e+2];o.push({key:this.circleKeys[e],x1:t-i,y1:r-i,x2:t+i,y2:r+i})}}else{let l={hitTest:a,overlapMode:n,seenUids:{box:{},circle:{}}};this._forEachCell(e,t,r,i,this._queryCell,o,l,s)}return o}query(e,t,r,i){return this._query(e,t,r,i,!1,null)}hitTest(e,t,r,i,a,n){return this._query(e,t,r,i,!0,a,n).length>0}hitTestCircle(e,t,r,i,a){let n=e-r,s=e+r,o=t-r,l=t+r;if(s<0||n>this.width||l<0||o>this.height)return!1;let u=[],c={hitTest:!0,overlapMode:i,circle:{x:e,y:t,radius:r},seenUids:{box:{},circle:{}}};return this._forEachCell(n,o,s,l,this._queryCellCircle,u,c,a),u.length>0}_queryCell(e,t,r,i,a,n,s,o){let{seenUids:l,hitTest:u,overlapMode:c}=s,h=this.boxCells[a];if(null!==h){let a=this.bboxes;for(let s of h)if(!l.box[s]){l.box[s]=!0;let h=4*s,p=this.boxKeys[s];if(e<=a[h+2]&&t<=a[h+3]&&r>=a[h+0]&&i>=a[h+1]&&(!o||o(p))&&(!u||!Dl(c,p.overlapMode))&&(n.push({key:p,x1:a[h],y1:a[h+1],x2:a[h+2],y2:a[h+3]}),u))return!0}}let p=this.circleCells[a];if(null!==p){let a=this.circles;for(let s of p)if(!l.circle[s]){l.circle[s]=!0;let h=3*s,p=this.circleKeys[s];if(this._circleAndRectCollide(a[h],a[h+1],a[h+2],e,t,r,i)&&(!o||o(p))&&(!u||!Dl(c,p.overlapMode))){let e=a[h],t=a[h+1],r=a[h+2];if(n.push({key:p,x1:e-r,y1:t-r,x2:e+r,y2:t+r}),u)return!0}}}return!1}_queryCellCircle(e,t,r,i,a,n,s,o){let{circle:l,seenUids:u,overlapMode:c}=s,h=this.boxCells[a];if(null!==h){let e=this.bboxes;for(let t of h)if(!u.box[t]){u.box[t]=!0;let r=4*t,i=this.boxKeys[t];if(this._circleAndRectCollide(l.x,l.y,l.radius,e[r+0],e[r+1],e[r+2],e[r+3])&&(!o||o(i))&&!Dl(c,i.overlapMode))return n.push(!0),!0}}let p=this.circleCells[a];if(null!==p){let e=this.circles;for(let t of p)if(!u.circle[t]){u.circle[t]=!0;let r=3*t,i=this.circleKeys[t];if(this._circlesCollide(e[r],e[r+1],e[r+2],l.x,l.y,l.radius)&&(!o||o(i))&&!Dl(c,i.overlapMode))return n.push(!0),!0}}}_forEachCell(e,t,r,i,a,n,s,o){let l=this._convertToXCellCoord(e),u=this._convertToYCellCoord(t),c=this._convertToXCellCoord(r),h=this._convertToYCellCoord(i);for(let p=l;p<=c;p++)for(let l=u;l<=h;l++){let u=this.xCellCount*l+p;if(a.call(this,e,t,r,i,u,n,s,o))return}}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,t,r,i,a,n){let s=i-e,o=a-t,l=r+n;return l*l>s*s+o*o}_circleAndRectCollide(e,t,r,i,a,n,s){let o=(n-i)/2,l=Math.abs(e-(i+o));if(l>o+r)return!1;let u=(s-a)/2,c=Math.abs(t-(a+u));if(c>u+r)return!1;if(l<=o||c<=u)return!0;let h=l-o,p=c-u;return h*h+p*p<=r*r}};l(Um,"GridIndex");var Qa=Um;d();var bn=se(Pe(),1);function eo(e,t,r,i,a){let n=G.create();return t?(G.scale(n,n,[1/a,1/a,1]),r||G.rotateZ(n,n,i.angle)):G.multiply(n,i.labelPlaneMatrix,e),n}function Fl(e,t,r,i,a){if(t){let t=G.clone(e);return G.scale(t,t,[a,a,1]),r||G.rotateZ(t,t,-i.angle),t}return i.glCoordMatrix}function _t(e,t,r){let i;r?(i=[e.x,e.y,r(e.x,e.y),1],Ke.transformMat4(i,i,t)):(i=[e.x,e.y,0,1],Bl(i,i,t));let a=i[3];return{point:new bn.default(i[0]/a,i[1]/a),signedDistanceFromCamera:a}}function to(e,t){return.5+e/t*.5}function DC(e,t){let r=e[0]/e[3],i=e[1]/e[3];return r>=-t[0]&&r<=t[0]&&i>=-t[1]&&i<=t[1]}function Sv(e,t,r,i,a,n,s,o,l,u){let c=i?e.textSizeData:e.iconSizeData,h=hi(c,r.transform.zoom),p=[256/r.width*2+1,256/r.height*2+1],d=i?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;d.clear();let f=e.lineVertexArray,m=i?e.text.placedSymbolArray:e.icon.placedSymbolArray,y=r.transform.width/r.transform.height,g=!1;for(let i=0;i<m.length;i++){let _,x=m.get(i);if(x.hidden||2===x.writingMode&&!g){xi(x.numGlyphs,d);continue}if(g=!1,u?(_=[x.anchorX,x.anchorY,u(x.anchorX,x.anchorY),1],Ke.transformMat4(_,_,t)):(_=[x.anchorX,x.anchorY,0,1],Bl(_,_,t)),!DC(_,p)){xi(x.numGlyphs,d);continue}let v=_[3],b=to(r.transform.cameraToCenterDistance,v),w=on(c,h,x),S=s?w/b:w*b,A=new bn.default(x.anchorX,x.anchorY),I=_t(A,a,u).point,M={projections:{},offsets:{}},T=wv(x,S,!1,o,t,a,n,e.glyphOffsetArray,f,d,I,A,M,y,l,u);g=T.useVertical,(T.notEnoughRoom||g||T.needsFlipping&&wv(x,S,!0,o,t,a,n,e.glyphOffsetArray,f,d,I,A,M,y,l,u).notEnoughRoom)&&xi(x.numGlyphs,d)}i?e.text.dynamicLayoutVertexBuffer.updateData(d):e.icon.dynamicLayoutVertexBuffer.updateData(d)}function qm(e,t,r,i,a,n,s,o,l,u,c,h,p){let d=o.glyphStartIndex+o.numGlyphs,f=o.lineStartIndex,m=o.lineStartIndex+o.lineLength,y=t.getoffsetX(o.glyphStartIndex),g=t.getoffsetX(d-1),_=zl(e*y,r,i,a,n,s,o.segment,f,m,l,u,c,h,p);if(!_)return null;let x=zl(e*g,r,i,a,n,s,o.segment,f,m,l,u,c,h,p);return x?{first:_,last:x}:null}function vv(e,t,r,i){if(1===e){if(Math.abs(r.y-t.y)>Math.abs(r.x-t.x)*i)return{useVertical:!0}}return(2===e?t.y<r.y:t.x>r.x)?{needsFlipping:!0}:null}function wv(e,t,r,i,a,n,s,o,l,u,c,h,p,d,f,m){let y,g=t/24,_=e.lineOffsetX*g,x=e.lineOffsetY*g;if(e.numGlyphs>1){let t=e.glyphStartIndex+e.numGlyphs,a=e.lineStartIndex,u=e.lineStartIndex+e.lineLength,v=qm(g,o,_,x,r,c,h,e,l,n,p,f,m);if(!v)return{notEnoughRoom:!0};let b=_t(v.first.point,s,m).point,w=_t(v.last.point,s,m).point;if(i&&!r){let t=vv(e.writingMode,b,w,d);if(t)return t}y=[v.first];for(let i=e.glyphStartIndex+1;i<t-1;i++){let t=zl(g*o.getoffsetX(i),_,x,r,c,h,e.segment,a,u,l,n,p,f,m);if(null==t)return{notEnoughRoom:!0};y.push(t)}y.push(v.last)}else{if(i&&!r){let t=_t(h,a,m).point,r=e.lineStartIndex+e.segment+1,i=new bn.default(l.getx(r),l.gety(r)),n=_t(i,a,m),s=n.signedDistanceFromCamera>0?n.point:Pv(h,i,t,1,a,m),o=vv(e.writingMode,t,s,d);if(o)return o}let t=zl(g*o.getoffsetX(e.glyphStartIndex),_,x,r,c,h,e.segment,e.lineStartIndex,e.lineStartIndex+e.lineLength,l,n,p,f,m);if(!t)return{notEnoughRoom:!0};y=[t]}for(let e of y)fi(u,e.point,e.angle);return{}}function Pv(e,t,r,i,a,n){let s=_t(e.add(e.sub(t)._unit()),a,n).point,o=r.sub(s);return r.add(o._mult(i/o.mag()))}function Nm(e,t){let{projectionCache:r,lineVertexArray:i,labelPlaneMatrix:a,tileAnchorPoint:n,distanceFromAnchor:s,getElevation:o,previousVertex:l,direction:u,absOffsetX:c}=t;if(r.projections[e])return r.projections[e];let h=new bn.default(i.getx(e),i.gety(e)),p=_t(h,a,o);if(p.signedDistanceFromCamera>0)return r.projections[e]=p.point,p.point;let d=e-u;return Pv(0===s?n:new bn.default(i.getx(d),i.gety(d)),h,l,c-s+1,a,o)}function Gm(e,t,r){return e._unit()._perp()._mult(t*r)}function zC(e,t,r,i,a,n,s,o){let{projectionCache:l,direction:u}=o;if(l.offsets[e])return l.offsets[e];let c=r.add(t);if(e+u<i||e+u>=a)return l.offsets[e]=c,c;let h=Nm(e+u,o),p=Gm(h.sub(r),s,u),d=r.add(p),f=h.add(p);return l.offsets[e]=pg(n,c,d,f)||c,l.offsets[e]}function zl(e,t,r,i,a,n,s,o,l,u,c,h,p,d){let f=i?e-t:e+t,m=f>0?1:-1,y=0;i&&(m*=-1,y=Math.PI),m<0&&(y+=Math.PI);let g,_,x,v=m>0?o+s:o+s+1,b=a,w=a,S=0,A=0,I=Math.abs(f),M=[];for(;S+A<=I;){if(v+=m,v<o||v>=l)return null;S+=A,w=b,_=g;let e={projectionCache:h,lineVertexArray:u,labelPlaneMatrix:c,tileAnchorPoint:n,distanceFromAnchor:S,getElevation:d,previousVertex:w,direction:m,absOffsetX:I};if(b=Nm(v,e),0===r)M.push(w),x=b.sub(w);else{let t,i=b.sub(w);if(0===i.mag()){t=Gm(Nm(v+m,e).sub(b),r,m)}else t=Gm(i,r,m);_||(_=w.add(t)),g=zC(v,t,b,o,l,_,r,e),M.push(_),x=g.sub(_)}A=x.mag()}let T=(I-S)/A,P=x._mult(T)._add(_||w),C=y+Math.atan2(b.y-w.y,b.x-w.x);return M.push(P),{point:P,angle:p?C:0,path:M}}l(eo,"getLabelPlaneMatrix"),l(Fl,"getGlCoordMatrix"),l(_t,"project"),l(to,"getPerspectiveRatio"),l(DC,"isVisible"),l(Sv,"updateLineLabels"),l(qm,"placeFirstAndLastGlyph"),l(vv,"requiresOrientationChange"),l(wv,"placeGlyphsAlongLine"),l(Pv,"projectTruncatedLineSegment"),l(Nm,"projectVertexToViewport"),l(Gm,"transformToOffsetNormal"),l(zC,"findOffsetIntersectionPoint"),l(zl,"placeGlyphAlongLine");var FC=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function xi(e,t){for(let r=0;r<e;r++){let e=t.length;t.resize(e+4),t.float32.set(FC,3*e)}}function Bl(e,t,r){let i=t[0],a=t[1];return e[0]=r[0]*i+r[4]*a+r[12],e[1]=r[1]*i+r[5]*a+r[13],e[3]=r[3]*i+r[7]*a+r[15],e}l(xi,"hideGlyphs"),l(Bl,"xyTransformMat4");var Qe=100,Zm=class{constructor(e,t=new Qa(e.width+2*Qe,e.height+2*Qe,25),r=new Qa(e.width+2*Qe,e.height+2*Qe,25)){this.transform=e,this.grid=t,this.ignoredGrid=r,this.pitchfactor=Math.cos(e._pitch)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+Qe,this.screenBottomBoundary=e.height+Qe,this.gridRightBoundary=e.width+2*Qe,this.gridBottomBoundary=e.height+2*Qe,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,t,r,i,a,n){let s=this.projectAndGetPerspectiveRatio(i,e.anchorPointX,e.anchorPointY,n),o=r*s.perspectiveRatio,l=e.x1*o+s.point.x,u=e.y1*o+s.point.y,c=e.x2*o+s.point.x,h=e.y2*o+s.point.y;return!this.isInsideGrid(l,u,c,h)||"always"!==t&&this.grid.hitTest(l,u,c,h,t,a)||s.perspectiveRatio<this.perspectiveRatioCutoff?{box:[],offscreen:!1}:{box:[l,u,c,h],offscreen:this.isOffscreen(l,u,c,h)}}placeCollisionCircles(e,t,r,i,a,n,s,o,l,u,c,h,p,d){let f=[],m=new Wt.default(t.anchorX,t.anchorY),y=_t(m,n,d),g=to(this.transform.cameraToCenterDistance,y.signedDistanceFromCamera),_=(u?a/g:a*g)/ci,x=_t(m,s,d).point,v=qm(_,i,t.lineOffsetX*_,t.lineOffsetY*_,!1,x,m,t,r,s,{projections:{},offsets:{}},!1,d),b=!1,w=!1,S=!0;if(v){let t=.5*h*g+p,r=new Wt.default(-Qe,-Qe),i=new Wt.default(this.screenRightBoundary,this.screenBottomBoundary),a=new Ll,n=v.first,s=v.last,u=[];for(let e=n.path.length-1;e>=1;e--)u.push(n.path[e]);for(let e=1;e<s.path.length;e++)u.push(s.path[e]);let m=2.5*t;if(o){let e=u.map((e=>_t(e,o,d)));u=e.some((e=>e.signedDistanceFromCamera<=0))?[]:e.map((e=>e.point))}let y=[];if(u.length>0){let e=u[0].clone(),t=u[0].clone();for(let r=1;r<u.length;r++)e.x=Math.min(e.x,u[r].x),e.y=Math.min(e.y,u[r].y),t.x=Math.max(t.x,u[r].x),t.y=Math.max(t.y,u[r].y);y=e.x>=r.x&&t.x<=i.x&&e.y>=r.y&&t.y<=i.y?[u]:t.x<r.x||e.x>i.x||t.y<r.y||e.y>i.y?[]:Om([u],r.x,r.y,i.x,i.y)}for(let r of y){a.reset(r,.25*t);let i=0;i=a.length<=.5*t?1:Math.ceil(a.paddedLength/m)+1;for(let r=0;r<i;r++){let n=r/Math.max(i-1,1),s=a.lerp(n),o=s.x+Qe,u=s.y+Qe;f.push(o,u,t,0);let h=o-t,p=u-t,d=o+t,m=u+t;if(S=S&&this.isOffscreen(h,p,d,m),w=w||this.isInsideGrid(h,p,d,m),"always"!==e&&this.grid.hitTestCircle(o,u,t,e,c)&&(b=!0,!l))return{circles:[],offscreen:!1,collisionDetected:b}}}}return{circles:!l&&b||!w||g<this.perspectiveRatioCutoff?[]:f,offscreen:S,collisionDetected:b}}queryRenderedSymbols(e){if(0===e.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};let t=[],r=1/0,i=1/0,a=-1/0,n=-1/0;for(let s of e){let e=new Wt.default(s.x+Qe,s.y+Qe);r=Math.min(r,e.x),i=Math.min(i,e.y),a=Math.max(a,e.x),n=Math.max(n,e.y),t.push(e)}let s=this.grid.query(r,i,a,n).concat(this.ignoredGrid.query(r,i,a,n)),o={},l={};for(let e of s){let r=e.key;(void 0===o[r.bucketInstanceId]&&(o[r.bucketInstanceId]={}),o[r.bucketInstanceId][r.featureIndex])||Ns(t,[new Wt.default(e.x1,e.y1),new Wt.default(e.x2,e.y1),new Wt.default(e.x2,e.y2),new Wt.default(e.x1,e.y2)])&&(o[r.bucketInstanceId][r.featureIndex]=!0,void 0===l[r.bucketInstanceId]&&(l[r.bucketInstanceId]=[]),l[r.bucketInstanceId].push(r.featureIndex))}return l}insertCollisionBox(e,t,r,i,a,n){let s={bucketInstanceId:i,featureIndex:a,collisionGroupID:n,overlapMode:t};(r?this.ignoredGrid:this.grid).insert(s,e[0],e[1],e[2],e[3])}insertCollisionCircles(e,t,r,i,a,n){let s=r?this.ignoredGrid:this.grid,o={bucketInstanceId:i,featureIndex:a,collisionGroupID:n,overlapMode:t};for(let t=0;t<e.length;t+=4)s.insertCircle(o,e[t],e[t+1],e[t+2])}projectAndGetPerspectiveRatio(e,t,r,i){let a;return i?(a=[t,r,i(t,r),1],Ke.transformMat4(a,a,e)):(a=[t,r,0,1],Bl(a,a,e)),{point:new Wt.default((a[0]/a[3]+1)/2*this.transform.width+Qe,(-a[1]/a[3]+1)/2*this.transform.height+Qe),perspectiveRatio:.5+this.transform.cameraToCenterDistance/a[3]*.5}}isOffscreen(e,t,r,i){return r<Qe||e>=this.screenRightBoundary||i<Qe||t>this.screenBottomBoundary}isInsideGrid(e,t,r,i){return r>=0&&e<this.gridRightBoundary&&i>=0&&t<this.gridBottomBoundary}getViewportMatrix(){let e=G.identity([]);return G.translate(e,e,[-Qe,-Qe,0]),e}};l(Zm,"CollisionIndex");var Rl=Zm;d(),d();var Tv=se(Pe(),1),Ol=class e extends Tv.default{constructor(e,t,r,i){super(e,t),this.angle=r,void 0!==i&&(this.segment=i)}clone(){return new e(this.x,this.y,this.angle,this.segment)}};l(Ol,"Anchor");var ro=Ol;N("Anchor",ro),d(),d(),d();var BC=se(Pe(),1);d();var RC=se(Pe(),1);d(),d();var OC=se(Pe(),1),VC=se(Xh(),1),_n=7,UC=Number.POSITIVE_INFINITY;function Vl(e,t){function r(e,t){let r=0,i=0;t<0&&(t=0);let a=t/Math.sqrt(2);switch(e){case"top-right":case"top-left":i=a-_n;break;case"bottom-right":case"bottom-left":i=-a+_n;break;case"bottom":i=-t+_n;break;case"top":i=t-_n}switch(e){case"top-right":case"bottom-right":r=-a;break;case"top-left":case"bottom-left":r=a;break;case"left":r=t;break;case"right":r=-t}return[r,i]}function i(e,t,r){let i=0,a=0;switch(t=Math.abs(t),r=Math.abs(r),e){case"top-right":case"top-left":case"top":a=r-_n;break;case"bottom-right":case"bottom-left":case"bottom":a=-r+_n}switch(e){case"top-right":case"bottom-right":case"right":i=-t;break;case"top-left":case"bottom-left":case"left":i=t}return[i,a]}return l(r,"fromRadialOffset"),l(i,"fromTextOffset"),t[1]!==UC?i(e,t[0],t[1]):r(e,t[0])}function Av(e){switch(e){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Ye(e,t,r){return t*(8192/(e.tileSize*Math.pow(2,r-e.tileID.overscaledZ)))}l(Vl,"evaluateVariableOffset"),l(Av,"getAnchorJustification"),d(),l(Ye,"pixelsToTileUnits");var jl=se(Pe(),1),Km=class{constructor(e,t,r,i){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?t:-t))):i&&r?1:0,this.placed=r}isHidden(){return 0===this.opacity&&!this.placed}};l(Km,"OpacityState");var Nl=Km,Ym=class{constructor(e,t,r,i,a){this.text=new Nl(e?e.text:null,t,r,a),this.icon=new Nl(e?e.icon:null,t,i,a)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}};l(Ym,"JointOpacityState");var bi=Ym,Jm=class{constructor(e,t,r){this.text=e,this.icon=t,this.skipFade=r}};l(Jm,"JointPlacement");var Gl=Jm,Qm=class{constructor(){this.invProjMatrix=G.create(),this.viewportMatrix=G.create(),this.circles=[]}};l(Qm,"CollisionCircleArray");var Hm=Qm,ed=class{constructor(e,t,r,i,a){this.bucketInstanceId=e,this.featureIndex=t,this.sourceLayerIndex=r,this.bucketIndex=i,this.tileID=a}};l(ed,"RetainedQueryData");var Wm=ed,td=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 t=++this.maxGroupID;this.collisionGroups[e]={ID:t,predicate:l((e=>e.collisionGroupID===t),"predicate")}}return this.collisionGroups[e]}};l(td,"CollisionGroups");var Xm=td;function Iv(e,t,r,i,a){let{horizontalAlign:n,verticalAlign:s}=ll(e),o=-(n-.5)*t,l=-(s-.5)*r,u=Vl(e,i);return new jl.default(o+u[0]*a,l+u[1]*a)}function $m(e,t,r,i,a,n){let{x1:s,x2:o,y1:l,y2:u,anchorPointX:c,anchorPointY:h}=e,p=new jl.default(t,r);return i&&p._rotate(a?n:-n),{x1:s+p.x,y1:l+p.y,x2:o+p.x,y2:u+p.y,anchorPointX:c,anchorPointY:h}}l(Iv,"calculateVariableLayoutShift"),l($m,"shiftVariableCollisionBox");var rd=class{constructor(e,t,r,i,a){this.transform=e.clone(),this.terrain=t,this.collisionIndex=new Rl(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=r,this.retainedQueryData={},this.collisionGroups=new Xm(i),this.collisionCircleArrays={},this.prevPlacement=a,a&&(a.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(e,t,r,i){let a=r.getBucket(t),n=r.latestFeatureIndex;if(!a||!n||t.id!==a.layerIds[0])return;let s=r.collisionBoxArray,o=a.layers[0].layout,l=Math.pow(2,this.transform.zoom-r.tileID.overscaledZ),u=r.tileSize/8192,c=this.transform.calculatePosMatrix(r.tileID.toUnwrapped()),h="map"===o.get("text-pitch-alignment"),p="map"===o.get("text-rotation-alignment"),d=Ye(r,1,this.transform.zoom),f=eo(c,h,p,this.transform,d),m=null;if(h){let e=Fl(c,h,p,this.transform,d);m=G.multiply([],this.transform.labelPlaneMatrix,e)}this.retainedQueryData[a.bucketInstanceId]=new Wm(a.bucketInstanceId,n,a.sourceLayerIndex,a.index,r.tileID);let y={bucket:a,layout:o,posMatrix:c,textLabelPlaneMatrix:f,labelToScreenMatrix:m,scale:l,textPixelRatio:u,holdingForFade:r.holdingForFade(),collisionBoxArray:s,partiallyEvaluatedTextSize:hi(a.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(a.sourceID)};if(i)for(let t of a.sortKeyRanges){let{sortKey:r,symbolInstanceStart:i,symbolInstanceEnd:a}=t;e.push({sortKey:r,symbolInstanceStart:i,symbolInstanceEnd:a,parameters:y})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:a.symbolInstances.length,parameters:y})}attemptAnchorPlacement(e,t,r,i,a,n,s,o,l,u,c,h,p,d,f,m){let y=[h.textOffset0,h.textOffset1],g=Iv(e,r,i,y,a),_=this.collisionIndex.placeCollisionBox($m(t,g.x,g.y,n,s,this.transform.angle),c,o,l,u.predicate,m);if((!f||0!==this.collisionIndex.placeCollisionBox($m(f,g.x,g.y,n,s,this.transform.angle),c,o,l,u.predicate,m).box.length)&&_.box.length>0){let t;if(this.prevPlacement&&this.prevPlacement.variableOffsets[h.crossTileID]&&this.prevPlacement.placements[h.crossTileID]&&this.prevPlacement.placements[h.crossTileID].text&&(t=this.prevPlacement.variableOffsets[h.crossTileID].anchor),0===h.crossTileID)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[h.crossTileID]={textOffset:y,width:r,height:i,anchor:e,textBoxScale:a,prevAnchor:t},this.markUsedJustification(p,e,h,d),p.allowVerticalPlacement&&(this.markUsedOrientation(p,d,h),this.placedOrientations[h.crossTileID]=d),{shift:g,placedGlyphBoxes:_}}}placeLayerBucketPart(e,t,r){let{bucket:i,layout:a,posMatrix:n,textLabelPlaneMatrix:s,labelToScreenMatrix:o,textPixelRatio:u,holdingForFade:c,collisionBoxArray:h,partiallyEvaluatedTextSize:p,collisionGroup:d}=e.parameters,f=a.get("text-optional"),m=a.get("icon-optional"),y=sn(a,"text-overlap","text-allow-overlap"),g="always"===y,_=sn(a,"icon-overlap","icon-allow-overlap"),x="always"===_,v="map"===a.get("text-rotation-alignment"),b="map"===a.get("text-pitch-alignment"),w="none"!==a.get("icon-text-fit"),S="viewport-y"===a.get("symbol-z-order"),A=g&&(x||!i.hasIconData()||m),I=x&&(g||!i.hasTextData()||f);!i.collisionArrays&&h&&i.deserializeCollisionBoxes(h);let M=this.retainedQueryData[i.bucketInstanceId].tileID,T=this.terrain?(e,t)=>this.terrain.getElevation(M,e,t):null,P=l(((e,h)=>{if(t[e.crossTileID])return;if(c)return void(this.placements[e.crossTileID]=new Gl(!1,!1,!1));let x=!1,S=!1,M=!0,P=null,C={box:null,offscreen:null},E={box:null,offscreen:null},k=null,z=null,D=null,B=0,F=0,L=0;h.textFeatureIndex?B=h.textFeatureIndex:e.useRuntimeCollisionCircles&&(B=e.featureIndex),h.verticalTextFeatureIndex&&(F=h.verticalTextFeatureIndex);let R=h.textBox;if(R){let t=l((t=>{let r=1;if(i.allowVerticalPlacement&&!t&&this.prevPlacement){let t=this.prevPlacement.placedOrientations[e.crossTileID];t&&(this.placedOrientations[e.crossTileID]=t,r=t,this.markUsedOrientation(i,r,e))}return r}),"updatePreviousOrientationIfNotPlaced"),r=l(((t,r)=>{if(i.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&h.verticalTextBox){for(let e of i.writingModes)if(2===e?(C=r(),E=C):C=t(),C&&C.box&&C.box.length)break}else C=t()}),"placeTextForPlacementModes");if(a.get("text-variable-anchor")){let s=a.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[e.crossTileID]){let t=this.prevPlacement.variableOffsets[e.crossTileID];s.indexOf(t.anchor)>0&&(s=s.filter((e=>e!==t.anchor)),s.unshift(t.anchor))}let o=l(((t,r,a)=>{let o=t.x2-t.x1,l=t.y2-t.y1,c=e.textBoxScale,h=w&&"never"===_?r:null,p={box:[],offscreen:!1},f="never"!==y?2*s.length:s.length;for(let r=0;r<f;++r){let f=s[r%s.length],m=r>=s.length?y:"never",g=this.attemptAnchorPlacement(f,t,o,l,c,v,b,u,n,d,m,e,i,a,h,T);if(g&&(p=g.placedGlyphBoxes,p&&p.box&&p.box.length)){x=!0,P=g.shift;break}}return p}),"placeBoxForVariableAnchors");r(l((()=>o(R,h.iconBox,1)),"placeHorizontal"),l((()=>{let t=h.verticalTextBox,r=C&&C.box&&C.box.length;return i.allowVerticalPlacement&&!r&&e.numVerticalGlyphVertices>0&&t?o(t,h.verticalIconBox,2):{box:null,offscreen:null}}),"placeVertical")),C&&(x=C.box,M=C.offscreen);let c=t(C&&C.box);if(!x&&this.prevPlacement){let t=this.prevPlacement.variableOffsets[e.crossTileID];t&&(this.variableOffsets[e.crossTileID]=t,this.markUsedJustification(i,t.anchor,e,c))}}else{let a=l(((t,r)=>{let a=this.collisionIndex.placeCollisionBox(t,y,u,n,d.predicate,T);return a&&a.box&&a.box.length&&(this.markUsedOrientation(i,r,e),this.placedOrientations[e.crossTileID]=r),a}),"placeBox");r(l((()=>a(R,1)),"placeHorizontal"),l((()=>{let t=h.verticalTextBox;return i.allowVerticalPlacement&&e.numVerticalGlyphVertices>0&&t?a(t,2):{box:null,offscreen:null}}),"placeVertical")),t(C&&C.box&&C.box.length)}}if(k=C,x=k&&k.box&&k.box.length>0,M=k&&k.offscreen,e.useRuntimeCollisionCircles){let t=i.text.placedSymbolArray.get(e.centerJustifiedTextSymbolIndex),l=on(i.textSizeData,p,t),u=a.get("text-padding"),c=e.collisionCircleDiameter;z=this.collisionIndex.placeCollisionCircles(y,t,i.lineVertexArray,i.glyphOffsetArray,l,n,s,o,r,b,d.predicate,c,u,T),z.circles.length&&z.collisionDetected&&!r&&Ce("Collisions detected, but collision boxes are not shown"),x=g||z.circles.length>0&&!z.collisionDetected,M=M&&z.offscreen}if(h.iconFeatureIndex&&(L=h.iconFeatureIndex),h.iconBox){let e=l((e=>{let t=w&&P?$m(e,P.x,P.y,v,b,this.transform.angle):e;return this.collisionIndex.placeCollisionBox(t,_,u,n,d.predicate,T)}),"placeIconFeature");E&&E.box&&E.box.length&&h.verticalIconBox?(D=e(h.verticalIconBox),S=D.box.length>0):(D=e(h.iconBox),S=D.box.length>0),M=M&&D.offscreen}let V=f||0===e.numHorizontalGlyphVertices&&0===e.numVerticalGlyphVertices,O=m||0===e.numIconVertices;if(V||O?O?V||(S=S&&x):x=S&&x:S=x=S&&x,x&&k&&k.box&&(E&&E.box&&F?this.collisionIndex.insertCollisionBox(k.box,y,a.get("text-ignore-placement"),i.bucketInstanceId,F,d.ID):this.collisionIndex.insertCollisionBox(k.box,y,a.get("text-ignore-placement"),i.bucketInstanceId,B,d.ID)),S&&D&&this.collisionIndex.insertCollisionBox(D.box,_,a.get("icon-ignore-placement"),i.bucketInstanceId,L,d.ID),z&&(x&&this.collisionIndex.insertCollisionCircles(z.circles,y,a.get("text-ignore-placement"),i.bucketInstanceId,B,d.ID),r)){let e=i.bucketInstanceId,t=this.collisionCircleArrays[e];void 0===t&&(t=this.collisionCircleArrays[e]=new Hm);for(let e=0;e<z.circles.length;e+=4)t.circles.push(z.circles[e+0]),t.circles.push(z.circles[e+1]),t.circles.push(z.circles[e+2]),t.circles.push(z.collisionDetected?1:0)}if(0===e.crossTileID)throw new Error("symbolInstance.crossTileID can't be 0");if(0===i.bucketInstanceId)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[e.crossTileID]=new Gl(x||A,S||I,M||i.justReloaded),t[e.crossTileID]=!0}),"placeSymbol");if(S){if(0!==e.symbolInstanceStart)throw new Error("bucket.bucketInstanceId should be 0");let t=i.getSortedSymbolIndexes(this.transform.angle);for(let e=t.length-1;e>=0;--e){let r=t[e];P(i.symbolInstances.get(r),i.collisionArrays[r])}}else for(let t=e.symbolInstanceStart;t<e.symbolInstanceEnd;t++)P(i.symbolInstances.get(t),i.collisionArrays[t]);if(r&&i.bucketInstanceId in this.collisionCircleArrays){let e=this.collisionCircleArrays[i.bucketInstanceId];G.invert(e.invProjMatrix,n),e.viewportMatrix=this.collisionIndex.getViewportMatrix()}i.justReloaded=!1}markUsedJustification(e,t,r,i){let a,n={left:r.leftJustifiedTextSymbolIndex,center:r.centerJustifiedTextSymbolIndex,right:r.rightJustifiedTextSymbolIndex};a=2===i?r.verticalPlacedTextSymbolIndex:n[Av(t)];let s=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex,r.verticalPlacedTextSymbolIndex];for(let t of s)t>=0&&(e.text.placedSymbolArray.get(t).crossTileID=a>=0&&t!==a?0:r.crossTileID)}markUsedOrientation(e,t,r){let i=1===t||3===t?t:0,a=2===t?t:0,n=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex];for(let t of n)e.text.placedSymbolArray.get(t).placedOrientation=i;r.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(r.verticalPlacedTextSymbolIndex).placedOrientation=a)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;let t=this.prevPlacement,r=!1;this.prevZoomAdjustment=t?t.zoomAdjustment(this.transform.zoom):0;let i=t?t.symbolFadeChange(e):1,a=t?t.opacities:{},n=t?t.variableOffsets:{},s=t?t.placedOrientations:{};for(let e in this.placements){let t=this.placements[e],n=a[e];n?(this.opacities[e]=new bi(n,i,t.text,t.icon),r=r||t.text!==n.text.placed||t.icon!==n.icon.placed):(this.opacities[e]=new bi(null,i,t.text,t.icon,t.skipFade),r=r||t.text||t.icon)}for(let e in a){let t=a[e];if(!this.opacities[e]){let a=new bi(t,i,!1,!1);a.isHidden()||(this.opacities[e]=a,r=r||t.text.placed||t.icon.placed)}}for(let e in n)!this.variableOffsets[e]&&this.opacities[e]&&!this.opacities[e].isHidden()&&(this.variableOffsets[e]=n[e]);for(let e in s)!this.placedOrientations[e]&&this.opacities[e]&&!this.opacities[e].isHidden()&&(this.placedOrientations[e]=s[e]);if(t&&void 0===t.lastPlacementChangeTime)throw new Error("Last placement time for previous placement is not defined");r?this.lastPlacementChangeTime=e:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e)}updateLayerOpacities(e,t){let r={};for(let i of t){let t=i.getBucket(e);t&&i.latestFeatureIndex&&e.id===t.layerIds[0]&&this.updateBucketOpacities(t,r,i.collisionBoxArray)}}updateBucketOpacities(e,t,r){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 i=e.layers[0].layout,a=new bi(null,0,!1,!1,!0),n=i.get("text-allow-overlap"),s=i.get("icon-allow-overlap"),o=i.get("text-variable-anchor"),u="map"===i.get("text-rotation-alignment"),c="map"===i.get("text-pitch-alignment"),h="none"!==i.get("icon-text-fit"),p=new bi(null,0,n&&(s||!e.hasIconData()||i.get("icon-optional")),s&&(n||!e.hasTextData()||i.get("text-optional")),!0);!e.collisionArrays&&r&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(r);let d=l(((e,t,r)=>{for(let i=0;i<t/4;i++)e.opacityVertexArray.emplaceBack(r);e.hasVisibleVertices=e.hasVisibleVertices||r!==io}),"addOpacities");for(let r=0;r<e.symbolInstances.length;r++){let i=e.symbolInstances.get(r),{numHorizontalGlyphVertices:n,numVerticalGlyphVertices:s,crossTileID:l}=i,f=t[l],m=this.opacities[l];f?m=a:m||(m=p,this.opacities[l]=m),t[l]=!0;let y=n>0||s>0,g=i.numIconVertices>0,_=this.placedOrientations[i.crossTileID],x=2===_,v=1===_||3===_;if(y){let t=Mv(m.text),r=x?io:t;d(e.text,n,r);let a=v?io:t;d(e.text,s,a);let o=m.text.isHidden();[i.rightJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.leftJustifiedTextSymbolIndex].forEach((t=>{t>=0&&(e.text.placedSymbolArray.get(t).hidden=o||x?1:0)})),i.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(i.verticalPlacedTextSymbolIndex).hidden=o||v?1:0);let l=this.variableOffsets[i.crossTileID];l&&this.markUsedJustification(e,l.anchor,i,_);let u=this.placedOrientations[i.crossTileID];u&&(this.markUsedJustification(e,"left",i,u),this.markUsedOrientation(e,u,i))}if(g){let t=Mv(m.icon),r=!(h&&i.verticalPlacedIconSymbolIndex&&x);if(i.placedIconSymbolIndex>=0){let a=r?t:io;d(e.icon,i.numIconVertices,a),e.icon.placedSymbolArray.get(i.placedIconSymbolIndex).hidden=m.icon.isHidden()}if(i.verticalPlacedIconSymbolIndex>=0){let a=r?io:t;d(e.icon,i.numVerticalIconVertices,a),e.icon.placedSymbolArray.get(i.verticalPlacedIconSymbolIndex).hidden=m.icon.isHidden()}}if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){let t=e.collisionArrays[r];if(t){let r=new jl.default(0,0);if(t.textBox||t.verticalTextBox){let i=!0;if(o){let e=this.variableOffsets[l];e?(r=Iv(e.anchor,e.width,e.height,e.textOffset,e.textBoxScale),u&&r._rotate(c?this.transform.angle:-this.transform.angle)):i=!1}t.textBox&&Ul(e.textCollisionBox.collisionVertexArray,m.text.placed,!i||x,r.x,r.y),t.verticalTextBox&&Ul(e.textCollisionBox.collisionVertexArray,m.text.placed,!i||v,r.x,r.y)}let i=!(v||!t.verticalIconBox);t.iconBox&&Ul(e.iconCollisionBox.collisionVertexArray,m.icon.placed,i,h?r.x:0,h?r.y:0),t.verticalIconBox&&Ul(e.iconCollisionBox.collisionVertexArray,m.icon.placed,!i,h?r.x:0,h?r.y:0)}}}if(e.sortFeatures(this.transform.angle),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.text.opacityVertexArray.length!==e.text.layoutVertexArray.length/4)throw new Error("bucket.text.opacityVertexArray.length (= ".concat(e.text.opacityVertexArray.length,") !== bucket.text.layoutVertexArray.length (= ").concat(e.text.layoutVertexArray.length,") / 4"));if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw new Error("bucket.icon.opacityVertexArray.length (= ".concat(e.icon.opacityVertexArray.length,") !== bucket.icon.layoutVertexArray.length (= ").concat(e.icon.layoutVertexArray.length,") / 4"));if(e.bucketInstanceId in this.collisionCircleArrays){let t=this.collisionCircleArrays[e.bucketInstanceId];e.placementInvProjMatrix=t.invProjMatrix,e.placementViewportMatrix=t.viewportMatrix,e.collisionCircleArray=t.circles,delete this.collisionCircleArrays[e.bucketInstanceId]}}symbolFadeChange(e){return 0===this.fadeDuration?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,t){let r=this.zoomAtLastRecencyCheck===t?1-this.zoomAdjustment(t):1;return this.zoomAtLastRecencyCheck=t,this.commitTime+this.fadeDuration*r>e}setStale(){this.stale=!0}};l(rd,"Placement");var ql=rd;function Ul(e,t,r,i,a){e.emplaceBack(t?1:0,r?1:0,i||0,a||0),e.emplaceBack(t?1:0,r?1:0,i||0,a||0),e.emplaceBack(t?1:0,r?1:0,i||0,a||0),e.emplaceBack(t?1:0,r?1:0,i||0,a||0)}l(Ul,"updateCollisionVertices");var NC=Math.pow(2,25),GC=Math.pow(2,24),qC=Math.pow(2,17),jC=Math.pow(2,16),ZC=Math.pow(2,9),$C=Math.pow(2,8),HC=Math.pow(2,1);function Mv(e){if(0===e.opacity&&!e.placed)return 0;if(1===e.opacity&&e.placed)return 4294967295;let t=e.placed?1:0,r=Math.floor(127*e.opacity);return r*NC+t*GC+r*qC+t*jC+r*ZC+t*$C+r*HC+t}l(Mv,"packOpacity");var io=0,nd=class{constructor(e){this._sortAcrossTiles="viewport-y"!==e.layout.get("symbol-z-order")&&!e.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,t,r,i,a){let n=this._bucketParts;for(;this._currentTileIndex<e.length;){let r=e[this._currentTileIndex];if(t.getBucketParts(n,i,r,this._sortAcrossTiles),this._currentTileIndex++,a())return!0}for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,n.sort(((e,t)=>e.sortKey-t.sortKey)));this._currentPartIndex<n.length;){let e=n[this._currentPartIndex];if(t.placeLayerBucketPart(e,this._seenCrossTileIDs,r),this._currentPartIndex++,a())return!0}return!1}};l(nd,"LayerPlacement");var id=nd,ad=class{constructor(e,t,r,i,a,n,s,o){this.placement=new ql(e,t,n,s,o),this._currentPlacementIndex=r.length-1,this._forceFullPlacement=i,this._showCollisionBoxes=a,this._done=!1}isDone(){return this._done}continuePlacement(e,t,r){let i=ne.now(),a=l((()=>!this._forceFullPlacement&&ne.now()-i>2),"shouldPausePlacement");for(;this._currentPlacementIndex>=0;){let i=t[e[this._currentPlacementIndex]],n=this.placement.collisionIndex.transform.zoom;if("symbol"===i.type&&(!i.minzoom||i.minzoom<=n)&&(!i.maxzoom||i.maxzoom>n)){if(this._inProgressLayer||(this._inProgressLayer=new id(i)),this._inProgressLayer.continuePlacement(r[i.source],this.placement,this._showCollisionBoxes,i,a))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}};l(ad,"PauseablePlacement");var Zl=ad;d(),d();var Cv=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],od=1,no=8,$l=class e{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");let[r,i]=new Uint8Array(t,0,2);if(219!==r)throw new Error("Data does not appear to be in a KDBush format.");let a=i>>4;if(a!==od)throw new Error("Got v".concat(a," data when expected v").concat(od,"."));let n=Cv[15&i];if(!n)throw new Error("Unrecognized array type.");let[s]=new Uint16Array(t,2,1),[o]=new Uint32Array(t,4,1);return new e(o,s,n,t)}constructor(e,t=64,r=Float64Array,i){if(isNaN(e)||e<0)throw new Error("Unpexpected numItems value: ".concat(e,"."));this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=r,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;let a=Cv.indexOf(this.ArrayType),n=2*e*this.ArrayType.BYTES_PER_ELEMENT,s=e*this.IndexArrayType.BYTES_PER_ELEMENT,o=(8-s%8)%8;if(a<0)throw new Error("Unexpected typed array class: ".concat(r,"."));i&&i instanceof ArrayBuffer?(this.data=i,this.ids=new this.IndexArrayType(this.data,no,e),this.coords=new this.ArrayType(this.data,no+s+o,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(no+n+s+o),this.ids=new this.IndexArrayType(this.data,no,e),this.coords=new this.ArrayType(this.data,no+s+o,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,(od<<4)+a]),new Uint16Array(this.data,2,1)[0]=t,new Uint32Array(this.data,4,1)[0]=e)}add(e,t){let r=this._pos>>1;return this.ids[r]=r,this.coords[this._pos++]=e,this.coords[this._pos++]=t,r}finish(){let e=this._pos>>1;if(e!==this.numItems)throw new Error("Added ".concat(e," items when expected ").concat(this.numItems,"."));return ld(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,r,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:a,coords:n,nodeSize:s}=this,o=[0,a.length-1,0],l=[];for(;o.length;){let u=o.pop()||0,c=o.pop()||0,h=o.pop()||0;if(c-h<=s){for(let s=h;s<=c;s++){let o=n[2*s],u=n[2*s+1];o>=e&&o<=r&&u>=t&&u<=i&&l.push(a[s])}continue}let p=h+c>>1,d=n[2*p],f=n[2*p+1];d>=e&&d<=r&&f>=t&&f<=i&&l.push(a[p]),(0===u?e<=d:t<=f)&&(o.push(h),o.push(p-1),o.push(1-u)),(0===u?r>=d:i>=f)&&(o.push(p+1),o.push(c),o.push(1-u))}return l}within(e,t,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:i,coords:a,nodeSize:n}=this,s=[0,i.length-1,0],o=[],l=r*r;for(;s.length;){let u=s.pop()||0,c=s.pop()||0,h=s.pop()||0;if(c-h<=n){for(let r=h;r<=c;r++)Ev(a[2*r],a[2*r+1],e,t)<=l&&o.push(i[r]);continue}let p=h+c>>1,d=a[2*p],f=a[2*p+1];Ev(d,f,e,t)<=l&&o.push(i[p]),(0===u?e-r<=d:t-r<=f)&&(s.push(h),s.push(p-1),s.push(1-u)),(0===u?e+r>=d:t+r>=f)&&(s.push(p+1),s.push(c),s.push(1-u))}return o}};l($l,"KDBush");var oo=$l;function ld(e,t,r,i,a,n){if(a-i<=r)return;let s=i+a>>1;kv(e,t,s,i,a,n),ld(e,t,r,i,s-1,1-n),ld(e,t,r,s+1,a,1-n)}function kv(e,t,r,i,a,n){for(;a>i;){if(a-i>600){let s=a-i+1,o=r-i+1,l=Math.log(s),u=.5*Math.exp(2*l/3),c=.5*Math.sqrt(l*u*(s-u)/s)*(o-s/2<0?-1:1);kv(e,t,r,Math.max(i,Math.floor(r-o*u/s+c)),Math.min(a,Math.floor(r+(s-o)*u/s+c)),n)}let s=t[2*r+n],o=i,l=a;for(ao(e,t,i,r),t[2*a+n]>s&&ao(e,t,i,a);o<l;){for(ao(e,t,o,l),o++,l--;t[2*o+n]<s;)o++;for(;t[2*l+n]>s;)l--}t[2*i+n]===s?ao(e,t,i,l):(l++,ao(e,t,l,a)),l<=r&&(i=l+1),r<=l&&(a=l-1)}}function ao(e,t,r,i){sd(e,r,i),sd(t,2*r,2*i),sd(t,2*r+1,2*i+1)}function sd(e,t,r){let i=e[t];e[t]=e[r],e[r]=i}function Ev(e,t,r,i){let a=e-r,n=t-i;return a*a+n*n}l(ld,"sort"),l(kv,"select"),l(ao,"swapItem"),l(sd,"swap"),l(Ev,"sqDist");var so=.03125,WC=128,hd=class{constructor(e,t,r){this.tileID=e,this.bucketInstanceId=r,this._symbolsByKey={};let i=new Map;for(let e=0;e<t.length;e++){let r=t.get(e),a=r.key,n=i.get(a);n?n.push(r):i.set(a,[r])}for(let[e,t]of i){let r={positions:t.map((e=>({x:Math.floor(e.anchorX*so),y:Math.floor(e.anchorY*so)}))),crossTileIDs:t.map((e=>e.crossTileID))};if(r.positions.length>WC){let e=new oo(r.positions.length,16,Uint16Array);for(let{x:t,y:i}of r.positions)e.add(t,i);e.finish(),delete r.positions,r.index=e}this._symbolsByKey[e]=r}}getScaledCoordinates(e,t){let{x:r,y:i,z:a}=this.tileID.canonical,{x:n,y:s,z:o}=t.canonical,l=o-a,u=so/Math.pow(2,l),c=(8192*n+e.anchorX)*u,h=(8192*s+e.anchorY)*u,p=8192*r*so,d=8192*i*so;return{x:Math.floor(c-p),y:Math.floor(h-d)}}findMatches(e,t,r){let i=this.tileID.canonical.z<t.canonical.z?1:Math.pow(2,this.tileID.canonical.z-t.canonical.z);for(let a=0;a<e.length;a++){let n=e.get(a);if(n.crossTileID)continue;let s=this._symbolsByKey[n.key];if(!s)continue;let o=this.getScaledCoordinates(n,t);if(s.index){let e=s.index.range(o.x-i,o.y-i,o.x+i,o.y+i).sort();for(let t of e){let e=s.crossTileIDs[t];if(!r[e]){r[e]=!0,n.crossTileID=e;break}}}else if(s.positions)for(let e=0;e<s.positions.length;e++){let t=s.positions[e],a=s.crossTileIDs[e];if(Math.abs(t.x-o.x)<=i&&Math.abs(t.y-o.y)<=i&&!r[a]){r[a]=!0,n.crossTileID=a;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map((({crossTileIDs:e})=>e))}};l(hd,"TileLayerIndex");var ud=hd,fd=class{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}};l(fd,"CrossTileIDs");var cd=fd,md=class{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){let t=Math.round((e-this.lng)/360);if(0!==t)for(let e in this.indexes){let r=this.indexes[e],i={};for(let e in r){let a=r[e];a.tileID=a.tileID.unwrapTo(a.tileID.wrap+t),i[a.tileID.key]=a}this.indexes[e]=i}this.lng=e}addBucket(e,t,r){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===t.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let e=0;e<t.symbolInstances.length;e++){t.symbolInstances.get(e).crossTileID=0}this.usedCrossTileIDs[e.overscaledZ]||(this.usedCrossTileIDs[e.overscaledZ]={});let i=this.usedCrossTileIDs[e.overscaledZ];for(let r in this.indexes){let a=this.indexes[r];if(Number(r)>e.overscaledZ)for(let r in a){let n=a[r];n.tileID.isChildOf(e)&&n.findMatches(t.symbolInstances,e,i)}else{let n=a[e.scaledTo(Number(r)).key];n&&n.findMatches(t.symbolInstances,e,i)}}for(let e=0;e<t.symbolInstances.length;e++){let a=t.symbolInstances.get(e);a.crossTileID||(a.crossTileID=r.generate(),i[a.crossTileID]=!0)}return void 0===this.indexes[e.overscaledZ]&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new ud(e,t.symbolInstances,t.bucketInstanceId),!0}removeBucketCrossTileIDs(e,t){for(let r of t.getCrossTileIDsLists())for(let t of r)delete this.usedCrossTileIDs[e][t]}removeStaleBuckets(e){let t=!1;for(let r in this.indexes){let i=this.indexes[r];for(let a in i)e[i[a].bucketInstanceId]||(this.removeBucketCrossTileIDs(r,i[a]),delete i[a],t=!0)}return t}};l(md,"CrossTileSymbolLayerIndex");var pd=md,dd=class{constructor(){this.layerIndexes={},this.crossTileIDs=new cd,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,t,r){let i=this.layerIndexes[e.id];void 0===i&&(i=this.layerIndexes[e.id]=new pd);let a=!1,n={};i.handleWrapJump(r);for(let r of t){let t=r.getBucket(e);!t||e.id!==t.layerIds[0]||(t.bucketInstanceId||(t.bucketInstanceId=++this.maxBucketInstanceId),i.addBucket(r.tileID,t,this.crossTileIDs)&&(a=!0),n[t.bucketInstanceId]=!0)}return i.removeStaleBuckets(n)&&(a=!0),a}pruneUnusedLayers(e){let t={};e.forEach((e=>{t[e]=!0}));for(let e in this.layerIndexes)t[e]||delete this.layerIndexes[e]}};l(dd,"CrossTileSymbolIndex");var vn=dd,Hl=l(((e,t)=>Vi(e,t&&t.filter((e=>"source.canvas"!==e.identifier)))),"emitValidationErrors"),XC=Rt(Ae,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setGlyphs","setSprite"]),KC=Rt(Ae,["setCenter","setZoom","setBearing","setPitch"]),YC=ox(),Wl=class e extends de{constructor(t,r={}){super(),this.map=t,this.dispatcher=new Ka(Rm(),this,t._getMapId()),this.imageManager=new xl,this.imageManager.setEventedParent(this),this.glyphManager=new bl(t._requestManager,r.localIdeographFontFamily),this.lineAtlas=new vl(256,512),this.crossTileSymbolIndex=new vn,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new Gi,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",So());let i=this;this._rtlTextPluginCallback=e.registerForPluginStateChange((e=>{let t={pluginStatus:e.pluginStatus,pluginURL:e.pluginURL};i.dispatcher.broadcast("syncRTLPluginState",t,((e,t)=>{if(Ep(e),t&&t.every((e=>e)))for(let e in i.sourceCaches){let t=i.sourceCaches[e].getSource().type;("vector"===t||"geojson"===t)&&i.sourceCaches[e].reload()}}))})),this.on("data",(e=>{if("source"!==e.dataType||"metadata"!==e.sourceDataType)return;let t=this.sourceCaches[e.sourceId];if(!t)return;let r=t.getSource();if(r&&r.vectorLayerIds)for(let e in this._layers){let t=this._layers[e];t.source===r.id&&this._validateLayer(t)}}))}loadURL(e,t={},r){this.fire(new z("dataloading",{dataType:"style"})),t.validate="boolean"!=typeof t.validate||t.validate;let i=this.map._requestManager.transformRequest(e,"Style");this._request=mr(i,((e,i)=>{this._request=null,e?this.fire(new H(e)):i&&this._load(i,t,r)}))}loadJSON(e,t={},r){this.fire(new z("dataloading",{dataType:"style"})),this._request=ne.frame((()=>{this._request=null,t.validate=!1!==t.validate,this._load(e,t,r)}))}loadEmpty(){this.fire(new z("dataloading",{dataType:"style"})),this._load(YC,{validate:!1})}_load(e,t,r){let i=t.transformStyle?t.transformStyle(r,e):e;if(!t.validate||!Hl(this,je(i))){this._loaded=!0,this.stylesheet=i;for(let e in i.sources)this.addSource(e,i.sources[e],{validate:!1});i.sprite?this._loadSprite(i.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(i.glyphs),this._createLayers(),this.light=new _l(this.stylesheet.light),this.map.setTerrain(this.stylesheet.terrain),this.fire(new z("data",{dataType:"style"})),this.fire(new z("style.load"))}}_createLayers(){let e=op(this.stylesheet.layers);this.dispatcher.broadcast("setLayers",e),this._order=e.map((e=>e.id)),this._layers={},this._serializedLayers=null;for(let t of e){let e=yl(t);e.setEventedParent(this,{layer:{id:t.id}}),this._layers[t.id]=e}}_loadSprite(e,t=!1,r=void 0){this.imageManager.setLoaded(!1),this._spriteRequest=Z_(e,this.map._requestManager,this.map.getPixelRatio(),((e,i)=>{if(this._spriteRequest=null,e)this.fire(new H(e));else if(i)for(let e in i){this._spritesImagesIds[e]=[];let r=this._spritesImagesIds[e]?this._spritesImagesIds[e].filter((e=>!(e in i))):[];for(let e of r)this.imageManager.removeImage(e),this._changedImages[e]=!0;for(let r in i[e]){let a="default"===e?r:"".concat(e,":").concat(r);this._spritesImagesIds[e].push(a),a in this.imageManager.images?this.imageManager.updateImage(a,i[e][r],!1):this.imageManager.addImage(a,i[e][r]),t&&(this._changedImages[a]=!0)}}this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),t&&(this._changed=!0),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new z("data",{dataType:"style"})),r&&r(e)}))}_unloadSprite(){for(let e of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(e),this._changedImages[e]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new z("data",{dataType:"style"}))}_validateLayer(e){let t=this.sourceCaches[e.source];if(!t)return;let r=e.sourceLayer;if(!r)return;let i=t.getSource();("geojson"===i.type||i.vectorLayerIds&&-1===i.vectorLayerIds.indexOf(r))&&this.fire(new H(new Error('Source layer "'.concat(r,'" ')+'does not exist on source "'.concat(i.id,'" ')+'as specified by style layer "'.concat(e.id,'".'))))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let e in this.sourceCaches)if(!this.sourceCaches[e].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(e){let t=this._serializedAllLayers();if(!e||0===e.length)return Object.values(t);let r=[];for(let i of e)t[i]&&r.push(t[i]);return r}_serializedAllLayers(){let e=this._serializedLayers;if(e)return e;e=this._serializedLayers={};let t=Object.keys(this._layers);for(let r of t){let t=this._layers[r];"custom"!==t.type&&(e[r]=t.serialize())}return e}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(let e in this.sourceCaches)if(this.sourceCaches[e].hasTransition())return!0;for(let e in this._layers)if(this._layers[e].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(e){if(!this._loaded)return;let t=this._changed;if(this._changed){let t=Object.keys(this._updatedLayers),r=Object.keys(this._removedLayers);(t.length||r.length)&&this._updateWorkerLayers(t,r);for(let e in this._updatedSources){let t=this._updatedSources[e];if("reload"===t)this._reloadSource(e);else{if("clear"!==t)throw new Error("Invalid action ".concat(t));this._clearSource(e)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(let t in this._updatedPaintProps)this._layers[t].updateTransitions(e);this.light.updateTransitions(e),this._resetUpdates()}let r={};for(let e in this.sourceCaches){let t=this.sourceCaches[e];r[e]=t.used,t.used=!1}for(let t of this._order){let r=this._layers[t];r.recalculate(e,this._availableImages),!r.isHidden(e.zoom)&&r.source&&(this.sourceCaches[r.source].used=!0)}for(let e in r){let t=this.sourceCaches[e];r[e]!==t.used&&t.fire(new z("data",{sourceDataType:"visibility",dataType:"source",sourceId:e}))}this.light.recalculate(e),this.z=e.zoom,t&&this.fire(new z("data",{dataType:"style"}))}_updateTilesForChangedImages(){let e=Object.keys(this._changedImages);if(e.length){for(let t in this.sourceCaches)this.sourceCaches[t].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(let e in this.sourceCaches)this.sourceCaches[e].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(e,t){this.dispatcher.broadcast("updateLayers",{layers:this._serializeByIds(e),removedIds:t})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(e,t={}){this._checkLoaded();let r=this.serialize();if(e=t.transformStyle?t.transformStyle(r,e):e,Hl(this,je(e)))return!1;(e=ct(e)).layers=op(e.layers);let i=Ng(r,e).filter((e=>!(e.command in KC)));if(0===i.length)return!1;let a=i.filter((e=>!(e.command in XC)));if(a.length>0)throw new Error("Unimplemented: ".concat(a.map((e=>e.command)).join(", "),"."));for(let e of i)"setTransition"!==e.command&&this[e.command].apply(this,e.args);return this.stylesheet=e,!0}addImage(e,t){if(this.getImage(e))return this.fire(new H(new Error('An image named "'.concat(e,'" already exists.'))));this.imageManager.addImage(e,t),this._afterImageUpdated(e)}updateImage(e,t){this.imageManager.updateImage(e,t)}getImage(e){return this.imageManager.getImage(e)}removeImage(e){if(!this.getImage(e))return this.fire(new H(new Error('An image named "'.concat(e,'" does not exist.'))));this.imageManager.removeImage(e),this._afterImageUpdated(e)}_afterImageUpdated(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new z("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,t,r={}){if(this._checkLoaded(),void 0!==this.sourceCaches[e])throw new Error('Source "'.concat(e,'" already exists.'));if(!t.type)throw new Error("The type property must be defined, but only the following properties were given: ".concat(Object.keys(t).join(", "),"."));if(["vector","raster","geojson","video","image"].indexOf(t.type)>=0&&this._validate(je.source,"sources.".concat(e),t,null,r))return;this.map&&this.map._collectResourceTiming&&(t.collectResourceTiming=!0);let i=this.sourceCaches[e]=new sr(e,t,this.dispatcher);i.style=this,i.setEventedParent(this,(()=>({isSourceLoaded:i.loaded(),source:i.serialize(),sourceId:e}))),i.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),void 0===this.sourceCaches[e])throw new Error("There is no source with this ID");for(let t in this._layers)if(this._layers[t].source===e)return this.fire(new H(new Error('Source "'.concat(e,'" cannot be removed while layer "').concat(t,'" is using it.'))));let t=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],t.fire(new z("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),t.setEventedParent(null),t.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,t){if(this._checkLoaded(),void 0===this.sourceCaches[e])throw new Error("There is no source with this ID=".concat(e));let r=this.sourceCaches[e].getSource();if("geojson"!==r.type)throw new Error("geojsonSource.type is ".concat(r.type,", which is !== 'geojson"));r.setData(t),this._changed=!0}getSource(e){return this.sourceCaches[e]&&this.sourceCaches[e].getSource()}addLayer(e,t,r={}){this._checkLoaded();let i,a=e.id;if(this.getLayer(a))return void this.fire(new H(new Error('Layer "'.concat(a,'" already exists on this map.'))));if("custom"===e.type){if(Hl(this,q_(e)))return;i=yl(e)}else{if("object"==typeof e.source&&(this.addSource(a,e.source),e=R(e=ct(e),{source:a})),this._validate(je.layer,"layers.".concat(a),e,{arrayIndex:-1},r))return;i=yl(e),this._validateLayer(i),i.setEventedParent(this,{layer:{id:a}})}let n=t?this._order.indexOf(t):this._order.length;if(t&&-1===n)this.fire(new H(new Error('Cannot add layer "'.concat(a,'" before non-existing layer "').concat(t,'".'))));else{if(this._order.splice(n,0,a),this._layerOrderChanged=!0,this._layers[a]=i,this._removedLayers[a]&&i.source&&"custom"!==i.type){let e=this._removedLayers[a];delete this._removedLayers[a],e.type!==i.type?this._updatedSources[i.source]="clear":(this._updatedSources[i.source]="reload",this.sourceCaches[i.source].pause())}this._updateLayer(i),i.onAdd&&i.onAdd(this.map)}}moveLayer(e,t){if(this._checkLoaded(),this._changed=!0,!this._layers[e])return void this.fire(new H(new Error("The layer '".concat(e,"' does not exist in the map's style and cannot be moved."))));if(e===t)return;let r=this._order.indexOf(e);this._order.splice(r,1);let i=t?this._order.indexOf(t):this._order.length;t&&-1===i?this.fire(new H(new Error('Cannot move layer "'.concat(e,'" before non-existing layer "').concat(t,'".')))):(this._order.splice(i,0,e),this._layerOrderChanged=!0)}removeLayer(e){this._checkLoaded();let t=this._layers[e];if(!t)return void this.fire(new H(new Error('Cannot remove non-existing layer "'.concat(e,'".'))));t.setEventedParent(null);let r=this._order.indexOf(e);this._order.splice(r,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=t,delete this._layers[e],this._serializedLayers&&delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],t.onRemove&&t.onRemove(this.map)}getLayer(e){return this._layers[e]}hasLayer(e){return e in this._layers}setLayerZoomRange(e,t,r){this._checkLoaded();let i=this.getLayer(e);i?i.minzoom===t&&i.maxzoom===r||(null!=t&&(i.minzoom=t),null!=r&&(i.maxzoom=r),this._updateLayer(i)):this.fire(new H(new Error('Cannot set the zoom range of non-existing layer "'.concat(e,'".'))))}setFilter(e,t,r={}){this._checkLoaded();let i=this.getLayer(e);if(i){if(!Yt(i.filter,t)){if(null==t)return i.filter=void 0,void this._updateLayer(i);this._validate(je.filter,"layers.".concat(i.id,".filter"),t,null,r)||(i.filter=ct(t),this._updateLayer(i))}}else this.fire(new H(new Error('Cannot filter non-existing layer "'.concat(e,'".'))))}getFilter(e){return ct(this.getLayer(e).filter)}setLayoutProperty(e,t,r,i={}){this._checkLoaded();let a=this.getLayer(e);a?Yt(a.getLayoutProperty(t),r)||(a.setLayoutProperty(t,r,i),this._updateLayer(a)):this.fire(new H(new Error('Cannot style non-existing layer "'.concat(e,'".'))))}getLayoutProperty(e,t){let r=this.getLayer(e);if(r)return r.getLayoutProperty(t);this.fire(new H(new Error('Cannot get style of non-existing layer "'.concat(e,'".'))))}setPaintProperty(e,t,r,i={}){this._checkLoaded();let a=this.getLayer(e);a?Yt(a.getPaintProperty(t),r)||(a.setPaintProperty(t,r,i)&&this._updateLayer(a),this._changed=!0,this._updatedPaintProps[e]=!0):this.fire(new H(new Error('Cannot style non-existing layer "'.concat(e,'".'))))}getPaintProperty(e,t){return this.getLayer(e).getPaintProperty(t)}setFeatureState(e,t){this._checkLoaded();let r=e.source,i=e.sourceLayer,a=this.sourceCaches[r];if(void 0===a)return void this.fire(new H(new Error("The source '".concat(r,"' does not exist in the map's style."))));let n=a.getSource().type;"geojson"===n&&i?this.fire(new H(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):"vector"!==n||i?(void 0===e.id&&this.fire(new H(new Error("The feature id parameter must be provided."))),a.setFeatureState(i,e.id,t)):this.fire(new H(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(e,t){this._checkLoaded();let r=e.source,i=this.sourceCaches[r];if(void 0===i)return void this.fire(new H(new Error("The source '".concat(r,"' does not exist in the map's style."))));let a=i.getSource().type,n="vector"===a?e.sourceLayer:void 0;"vector"!==a||n?t&&"string"!=typeof e.id&&"number"!=typeof e.id?this.fire(new H(new Error("A feature id is required to remove its specific state property."))):i.removeFeatureState(n,e.id,t):this.fire(new H(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(e){this._checkLoaded();let t=e.source,r=e.sourceLayer,i=this.sourceCaches[t];if(void 0!==i){if("vector"!==i.getSource().type||r)return void 0===e.id&&this.fire(new H(new Error("The feature id parameter must be provided."))),i.getFeatureState(r,e.id);this.fire(new H(new Error("The sourceLayer parameter must be provided for vector source types.")))}else this.fire(new H(new Error("The source '".concat(t,"' does not exist in the map's style."))))}getTransition(){return R({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;let e=Mn(this.sourceCaches,(e=>e.serialize())),t=this._serializeByIds(this._order),r=this.stylesheet;return vo({version:r.version,name:r.name,metadata:r.metadata,light:r.light,center:r.center,zoom:r.zoom,bearing:r.bearing,pitch:r.pitch,sprite:r.sprite,glyphs:r.glyphs,transition:r.transition,sources:e,layers:t},(e=>void 0!==e))}_updateLayer(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&"raster"!==this.sourceCaches[e.source].getSource().type&&(this._updatedSources[e.source]="reload",this.sourceCaches[e.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(e){let t=l((e=>"fill-extrusion"===this._layers[e].type),"isLayer3D"),r={},i=[];for(let a=this._order.length-1;a>=0;a--){let n=this._order[a];if(t(n)){r[n]=a;for(let t of e){let e=t[n];if(e)for(let t of e)i.push(t)}}}i.sort(((e,t)=>t.intersectionZ-e.intersectionZ));let a=[];for(let n=this._order.length-1;n>=0;n--){let s=this._order[n];if(t(s))for(let e=i.length-1;e>=0;e--){let t=i[e].feature;if(r[t.layer.id]<n)break;a.push(t),i.pop()}else for(let t of e){let e=t[s];if(e)for(let t of e)a.push(t.feature)}}return a}queryRenderedFeatures(e,t,r){t&&t.filter&&this._validate(je.filter,"queryRenderedFeatures.filter",t.filter,null,t);let i={};if(t&&t.layers){if(!Array.isArray(t.layers))return this.fire(new H(new Error("parameters.layers must be an Array."))),[];for(let e of t.layers){let t=this._layers[e];if(!t)return this.fire(new H(new Error("The layer '".concat(e,"' does not exist in the map's style and cannot be queried for features.")))),[];i[t.source]=!0}}let a=[];t.availableImages=this._availableImages;let n=this._serializedAllLayers();for(let s in this.sourceCaches)t.layers&&!i[s]||a.push(ov(this.sourceCaches[s],this._layers,n,e,t,r));return this.placement&&a.push(sv(this._layers,n,this.sourceCaches,e,t,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(a)}querySourceFeatures(e,t){t&&t.filter&&this._validate(je.filter,"querySourceFeatures.filter",t.filter,null,t);let r=this.sourceCaches[e];return r?lv(r,t):[]}addSourceType(e,t,r){return Mm(e)?r(new Error('A source type called "'.concat(e,'" already exists.'))):(av(e,t),t.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:e,url:t.workerSourceURL},r):r(null,null))}getLight(){return this.light.getLight()}setLight(e,t={}){this._checkLoaded();let r=this.light.getLight(),i=!1;for(let t in e)if(!Yt(e[t],r[t])){i=!0;break}if(!i)return;let a={now:ne.now(),transition:R({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,t),this.light.updateTransitions(a)}_validate(e,t,r,i,a={}){return(!a||!1!==a.validate)&&Hl(this,e.call(je,R({key:t,style:this.serialize(),value:r,styleSpec:M},i)))}_remove(e=!0){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),ds.off("pluginStateChange",this._rtlTextPluginCallback);for(let e in this._layers)this._layers[e].setEventedParent(null);for(let e in this.sourceCaches){let t=this.sourceCaches[e];t.setEventedParent(null),t.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove(e)}_clearSource(e){this.sourceCaches[e].clearTiles()}_reloadSource(e){this.sourceCaches[e].resume(),this.sourceCaches[e].reload()}_updateSources(e){for(let t in this.sourceCaches)this.sourceCaches[t].update(e,this.map.terrain)}_generateCollisionBoxes(){for(let e in this.sourceCaches)this._reloadSource(e)}_updatePlacement(e,t,r,i,a=!1){let n=!1,s=!1,o={};for(let t of this._order){let r=this._layers[t];if("symbol"!==r.type)continue;if(!o[r.source]){let e=this.sourceCaches[r.source];o[r.source]=e.getRenderableIds(!0).map((t=>e.getTileByID(t))).sort(((e,t)=>t.tileID.overscaledZ-e.tileID.overscaledZ||(e.tileID.isLessThan(t.tileID)?-1:1)))}let i=this.crossTileSymbolIndex.addLayer(r,o[r.source],e.center.lng);n=n||i}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((a=a||this._layerOrderChanged||0===r)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(ne.now(),e.zoom))&&(this.pauseablePlacement=new Zl(e,this.map.terrain,this._order,a,t,r,i,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,o),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(ne.now()),s=!0),n&&this.pauseablePlacement.placement.setStale()),s||n)for(let e of this._order){let t=this._layers[e];"symbol"===t.type&&this.placement.updateLayerOpacities(t,o[t.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(ne.now())}_releaseSymbolFadeTiles(){for(let e in this.sourceCaches)this.sourceCaches[e].releaseSymbolFadeTiles()}getImages(e,t,r){this.imageManager.getImages(t.icons,r),this._updateTilesForChangedImages();let i=this.sourceCaches[t.source];i&&i.setDependencies(t.tileID.key,t.type,t.icons)}getGlyphs(e,t,r){this.glyphManager.getGlyphs(t.stacks,r);let i=this.sourceCaches[t.source];i&&i.setDependencies(t.tileID.key,t.type,[""])}getResource(e,t,r){return Pi(t,r)}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,t={}){this._checkLoaded(),(!e||!this._validate(je.glyphs,"glyphs",e,null,t))&&(this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}addSprite(e,t,r={},i){this._checkLoaded();let a=[{id:e,url:t}],n=[...ln(this.stylesheet.sprite),...a];this._validate(je.sprite,"sprite",n,null,r)||(this.stylesheet.sprite=n,this._loadSprite(a,!0,i))}removeSprite(e){this._checkLoaded();let t=ln(this.stylesheet.sprite);if(t.find((t=>t.id===e))){if(this._spritesImagesIds[e])for(let t of this._spritesImagesIds[e])this.imageManager.removeImage(t),this._changedImages[t]=!0;t.splice(t.findIndex((t=>t.id===e)),1),this.stylesheet.sprite=t.length>0?t:void 0,delete this._spritesImagesIds[e],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new z("data",{dataType:"style"}))}else this.fire(new H(new Error('Sprite "'.concat(e,"\" doesn't exists on this map."))))}getSprite(){return ln(this.stylesheet.sprite)}setSprite(e,t={},r){this._checkLoaded(),(!e||!this._validate(je.sprite,"sprite",e,null,t))&&(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,r):(this._unloadSprite(),r&&r(null)))}};l(Wl,"Style");var Rr=Wl;Rr.registerForPluginStateChange=Mx,d(),d();var Xl=ve([{name:"a_pos",type:"Int16",components:2}]);d(),d();var Lv="#ifdef GL_ES\nprecision mediump float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\n";d();var Dv="#ifdef GL_ES\nprecision highp float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}\n#ifdef TERRAIN3D\nuniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;\n#endif\nconst highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {\n#ifdef TERRAIN3D\nhighp float d=unpack(texture2D(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));\n#else\nreturn 1.0;\n#endif\n}float calculate_visibility(vec4 pos) {\n#ifdef TERRAIN3D\nvec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;\n#else\nreturn 1.0;\n#endif\n}float ele(vec2 pos) {\n#ifdef TERRAIN3D\nvec4 rgb=(texture2D(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;\n#else\nreturn 0.0;\n#endif\n}float get_elevation(vec2 pos) {\n#ifdef TERRAIN3D\nvec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;\n#else\nreturn 0.0;\n#endif\n}";d();var zv="uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var Fv="attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}";d();var Bv="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;varying vec2 v_pos_a;varying 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=texture2D(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=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var Rv="uniform mat4 u_matrix;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;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);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);}";d();var Ov="varying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);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));gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var Vv="uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);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;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}";d();var Uv="void main() {gl_FragColor=vec4(1.0);}";d();var Nv="attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}";d();var Gv="uniform highp float u_intensity;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var qv="uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 unscaled_extrude=vec2(mod(a_pos,2.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;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}";d();var jv="uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(0.0);\n#endif\n}";d();var Zv="uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying 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;}";d();var $v="varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}";d();var Hv="attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}";d();var Wv="varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);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);gl_FragColor=color*alpha*opacity_t;}";d();var Xv="attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;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;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}";d();var Kv="uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}";d();var Yv="attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,get_elevation(a_pos),1);}";d();var Jv="#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_FragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var Qv="attribute vec2 a_pos;uniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);}";d();var e0="varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var t0="attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}";d();var r0="uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(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=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var i0="uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);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;}";d();var n0="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(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=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var a0="uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);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);}";d();var o0="varying vec4 v_color;void main() {gl_FragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var s0="uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;\n#ifdef TERRAIN3D\nattribute vec2 a_centroid;\n#endif\nvarying vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 normal=a_normal_ed.xyz;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);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;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);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;}";d();var l0="uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(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=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var u0="uniform mat4 u_matrix;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 vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;\n#ifdef TERRAIN3D\nattribute vec2 a_centroid;\n#endif\nvarying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,z*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;}";d();var c0="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;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))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var p0="uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying 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;}";d();var h0="uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;\n#define PI 3.141592653589793\nvoid main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;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_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var f0="uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}";d();var m0="uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var d0="\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}";d();var y0="uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var g0="\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}";d();var x0="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var b0="\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}";d();var _0="uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(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);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var v0="\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;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;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}";d();var w0="uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying 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=texture2D(u_image0,v_pos0);vec4 color1=texture2D(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);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var S0="uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}";d();var P0="uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var T0="const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute 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_matrix;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;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);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=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),z,1.0);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));}";d();var A0="#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float 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=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var I0="const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute 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_matrix;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;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);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=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),z,1.0);float gamma_scale=gl_Position.w;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);}";d();var M0="#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";d();var C0="const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute 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_matrix;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;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);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=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;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);}";d();var E0="varying 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() {gl_FragColor=pack(v_depth);}";d();var k0="precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}";d();var L0="uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}";d();var Kl="attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_depth;void main() {float extent=8192.0;float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/extent;gl_Position=u_matrix*vec4(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}",_i={prelude:Le(Lv,Dv),background:Le(zv,Fv),backgroundPattern:Le(Bv,Rv),circle:Le(Ov,Vv),clippingMask:Le(Uv,Nv),heatmap:Le(Gv,qv),heatmapTexture:Le(jv,Zv),collisionBox:Le($v,Hv),collisionCircle:Le(Wv,Xv),debug:Le(Kv,Yv),fill:Le(Jv,Qv),fillOutline:Le(e0,t0),fillOutlinePattern:Le(r0,i0),fillPattern:Le(n0,a0),fillExtrusion:Le(o0,s0),fillExtrusionPattern:Le(l0,u0),hillshadePrepare:Le(c0,p0),hillshade:Le(h0,f0),line:Le(m0,d0),lineGradient:Le(y0,g0),linePattern:Le(x0,b0),lineSDF:Le(_0,v0),raster:Le(w0,S0),symbolIcon:Le(P0,T0),symbolSDF:Le(A0,I0),symbolTextAndIcon:Le(M0,C0),terrain:Le(L0,Kl),terrainDepth:Le(E0,Kl),terrainCoords:Le(k0,Kl)};function Le(e,t){let r=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,i=t.match(/attribute ([\w]+) ([\w]+)/g),a=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),n=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),s=n?n.concat(a):a,o={};return{fragmentSource:e=e.replace(r,((e,t,r,i,a)=>(o[a]=!0,"define"===t?"\n#ifndef HAS_UNIFORM_u_".concat(a,"\nvarying ").concat(r," ").concat(i," ").concat(a,";\n#else\nuniform ").concat(r," ").concat(i," u_").concat(a,";\n#endif\n"):"\n#ifdef HAS_UNIFORM_u_".concat(a,"\n ").concat(r," ").concat(i," ").concat(a," = u_").concat(a,";\n#endif\n")))),vertexSource:t=t.replace(r,((e,t,r,i,a)=>{let n="float"===i?"vec2":"vec4",s=a.match(/color/)?"color":n;return o[a]?"define"===t?"\n#ifndef HAS_UNIFORM_u_".concat(a,"\nuniform lowp float u_").concat(a,"_t;\nattribute ").concat(r," ").concat(n," a_").concat(a,";\nvarying ").concat(r," ").concat(i," ").concat(a,";\n#else\nuniform ").concat(r," ").concat(i," u_").concat(a,";\n#endif\n"):"vec4"===s?"\n#ifndef HAS_UNIFORM_u_".concat(a,"\n ").concat(a," = a_").concat(a,";\n#else\n ").concat(r," ").concat(i," ").concat(a," = u_").concat(a,";\n#endif\n"):"\n#ifndef HAS_UNIFORM_u_".concat(a,"\n ").concat(a," = unpack_mix_").concat(s,"(a_").concat(a,", u_").concat(a,"_t);\n#else\n ").concat(r," ").concat(i," ").concat(a," = u_").concat(a,";\n#endif\n"):"define"===t?"\n#ifndef HAS_UNIFORM_u_".concat(a,"\nuniform lowp float u_").concat(a,"_t;\nattribute ").concat(r," ").concat(n," a_").concat(a,";\n#else\nuniform ").concat(r," ").concat(i," u_").concat(a,";\n#endif\n"):"vec4"===s?"\n#ifndef HAS_UNIFORM_u_".concat(a,"\n ").concat(r," ").concat(i," ").concat(a," = a_").concat(a,";\n#else\n ").concat(r," ").concat(i," ").concat(a," = u_").concat(a,";\n#endif\n"):"\n#ifndef HAS_UNIFORM_u_".concat(a,"\n ").concat(r," ").concat(i," ").concat(a," = unpack_mix_").concat(s,"(a_").concat(a,", u_").concat(a,"_t);\n#else\n ").concat(r," ").concat(i," ").concat(a," = u_").concat(a,";\n#endif\n")})),staticAttributes:i,staticUniforms:s}}l(Le,"compile"),d(),d();var yd=class{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(e,t,r,i,a,n,s,o,l){this.context=e;let u=this.boundPaintVertexBuffers.length!==i.length;for(let e=0;!u&&e<i.length;e++)this.boundPaintVertexBuffers[e]!==i[e]&&(u=!0);!this.vao||this.boundProgram!==t||this.boundLayoutVertexBuffer!==r||u||this.boundIndexBuffer!==a||this.boundVertexOffset!==n||this.boundDynamicVertexBuffer!==s||this.boundDynamicVertexBuffer2!==o||this.boundDynamicVertexBuffer3!==l?this.freshBind(t,r,i,a,n,s,o,l):(e.bindVertexArray.set(this.vao),s&&s.bind(),a&&a.dynamicDraw&&a.bind(),o&&o.bind(),l&&l.bind())}freshBind(e,t,r,i,a,n,s,o){let l=e.numAttributes,u=this.context,c=u.gl;this.vao&&this.destroy(),this.vao=u.createVertexArray(),u.bindVertexArray.set(this.vao),this.boundProgram=e,this.boundLayoutVertexBuffer=t,this.boundPaintVertexBuffers=r,this.boundIndexBuffer=i,this.boundVertexOffset=a,this.boundDynamicVertexBuffer=n,this.boundDynamicVertexBuffer2=s,this.boundDynamicVertexBuffer3=o,t.enableAttributes(c,e);for(let t of r)t.enableAttributes(c,e);n&&n.enableAttributes(c,e),s&&s.enableAttributes(c,e),o&&o.enableAttributes(c,e),t.bind(),t.setVertexAttribPointers(c,e,a);for(let t of r)t.bind(),t.setVertexAttribPointers(c,e,a);n&&(n.bind(),n.setVertexAttribPointers(c,e,a)),i&&i.bind(),s&&(s.bind(),s.setVertexAttribPointers(c,e,a)),o&&(o.bind(),o.setVertexAttribPointers(c,e,a)),u.currentNumAttributes=l}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}};l(yd,"VertexArrayObject");var Yl=yd;d();var D0=l(((e,t)=>({u_depth:new Y(e,t.u_depth),u_terrain:new Y(e,t.u_terrain),u_terrain_dim:new V(e,t.u_terrain_dim),u_terrain_matrix:new te(e,t.u_terrain_matrix),u_terrain_unpack:new Ir(e,t.u_terrain_unpack),u_terrain_exaggeration:new V(e,t.u_terrain_exaggeration)})),"terrainPreludeUniforms"),z0=l(((e,t)=>({u_matrix:new te(e,t.u_matrix),u_texture:new Y(e,t.u_texture),u_ele_delta:new V(e,t.u_ele_delta)})),"terrainUniforms"),F0=l(((e,t)=>({u_matrix:new te(e,t.u_matrix),u_ele_delta:new V(e,t.u_ele_delta)})),"terrainDepthUniforms"),B0=l(((e,t)=>({u_matrix:new te(e,t.u_matrix),u_texture:new Y(e,t.u_texture),u_terrain_coords_id:new V(e,t.u_terrain_coords_id),u_ele_delta:new V(e,t.u_ele_delta)})),"terrainCoordsUniforms"),R0=l(((e,t)=>({u_matrix:e,u_texture:0,u_ele_delta:t})),"terrainUniformValues"),O0=l(((e,t)=>({u_matrix:e,u_ele_delta:t})),"terrainDepthUniformValues"),V0=l(((e,t,r)=>({u_matrix:e,u_terrain_coords_id:t/255,u_texture:0,u_ele_delta:r})),"terrainCoordsUniformValues");function gd(e){let t=[];for(let r=0;r<e.length;r++){if(null===e[r])continue;let i=e[r].split(" ");t.push(i.pop())}return t}l(gd,"getTokenizedAttributesAndUniforms");var xd=class{constructor(e,t,r,i,a,n){let s=e.gl;this.program=s.createProgram();let o=gd(t.staticAttributes),l=r?r.getBinderAttributes():[],u=o.concat(l),c=_i.prelude.staticUniforms?gd(_i.prelude.staticUniforms):[],h=t.staticUniforms?gd(t.staticUniforms):[],p=r?r.getBinderUniforms():[],d=c.concat(h).concat(p),f=[];for(let e of d)f.indexOf(e)<0&&f.push(e);let m=r?r.defines():[];a&&m.push("#define OVERDRAW_INSPECTOR;"),n&&m.push("#define TERRAIN3D;");let y=m.concat(_i.prelude.fragmentSource,t.fragmentSource).join("\n"),g=m.concat(_i.prelude.vertexSource,t.vertexSource).join("\n"),_=s.createShader(s.FRAGMENT_SHADER);if(s.isContextLost())return void(this.failedToCreate=!0);s.shaderSource(_,y),s.compileShader(_),s.attachShader(this.program,_);let x=s.createShader(s.VERTEX_SHADER);if(s.isContextLost())return void(this.failedToCreate=!0);s.shaderSource(x,g),s.compileShader(x),s.attachShader(this.program,x),this.attributes={};let v={};this.numAttributes=u.length;for(let e=0;e<this.numAttributes;e++)u[e]&&(s.bindAttribLocation(this.program,e,u[e]),this.attributes[u[e]]=e);s.linkProgram(this.program),s.deleteShader(x),s.deleteShader(_);for(let e=0;e<f.length;e++){let t=f[e];if(t&&!v[t]){let e=s.getUniformLocation(this.program,t);e&&(v[t]=e)}}this.fixedUniforms=i(e,v),this.terrainUniforms=D0(e,v),this.binderUniforms=r?r.getUniforms(e,v):[]}draw(e,t,r,i,a,n,s,o,l,u,c,h,p,d,f,m,y,g){let _=e.gl;if(this.failedToCreate)return;e.program.set(this.program),e.setDepthMode(r),e.setStencilMode(i),e.setColorMode(a),e.setCullFace(n);for(let e in this.fixedUniforms)this.fixedUniforms[e].set(s[e]);f&&f.setUniforms(e,this.binderUniforms,p,{zoom:d});let x=0;switch(t){case _.LINES:x=2;break;case _.TRIANGLES:x=3;break;case _.LINE_STRIP:x=1}for(let r of h.get()){let i=r.vaos||(r.vaos={});(i[l]||(i[l]=new Yl)).bind(e,this,u,f?f.getPaintVertexBuffers():[],c,r.vertexOffset,m,y,g),_.drawElements(t,r.primitiveLength*x,_.UNSIGNED_SHORT,r.primitiveOffset*x*2)}}};l(xd,"Program");var Jl=xd;function Ql(e,t,r){let i=1/Ye(r,1,t.transform.tileZoom),a=Math.pow(2,r.tileID.overscaledZ),n=r.tileSize*Math.pow(2,t.transform.tileZoom)/a,s=n*(r.tileID.canonical.x+r.tileID.wrap*a),o=n*r.tileID.canonical.y;return{u_image:0,u_texsize:r.imageAtlasTexture.size,u_scale:[i,e.fromScale,e.toScale],u_fade:e.t,u_pixel_coord_upper:[s>>16,o>>16],u_pixel_coord_lower:[65535&s,65535&o]}}function U0(e,t,r,i){let a=r.imageManager.getPattern(e.from.toString()),n=r.imageManager.getPattern(e.to.toString()),{width:s,height:o}=r.imageManager.getPixelSize(),l=Math.pow(2,i.tileID.overscaledZ),u=i.tileSize*Math.pow(2,r.transform.tileZoom)/l,c=u*(i.tileID.canonical.x+i.tileID.wrap*l),h=u*i.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:a.tl,u_pattern_br_a:a.br,u_pattern_tl_b:n.tl,u_pattern_br_b:n.br,u_texsize:[s,o],u_mix:t.t,u_pattern_size_a:a.displaySize,u_pattern_size_b:n.displaySize,u_scale_a:t.fromScale,u_scale_b:t.toScale,u_tile_units_to_pixels:1/Ye(i,1,r.transform.tileZoom),u_pixel_coord_upper:[c>>16,h>>16],u_pixel_coord_lower:[65535&c,65535&h]}}d(),d(),d(),l(Ql,"patternUniformValues"),l(U0,"bgPatternUniformValues");var N0=l(((e,t)=>({u_matrix:new te(e,t.u_matrix),u_lightpos:new lt(e,t.u_lightpos),u_lightintensity:new V(e,t.u_lightintensity),u_lightcolor:new lt(e,t.u_lightcolor),u_vertical_gradient:new V(e,t.u_vertical_gradient),u_opacity:new V(e,t.u_opacity)})),"fillExtrusionUniforms"),G0=l(((e,t)=>({u_matrix:new te(e,t.u_matrix),u_lightpos:new lt(e,t.u_lightpos),u_lightintensity:new V(e,t.u_lightintensity),u_lightcolor:new lt(e,t.u_lightcolor),u_vertical_gradient:new V(e,t.u_vertical_gradient),u_height_factor:new V(e,t.u_height_factor),u_image:new Y(e,t.u_image),u_texsize:new ee(e,t.u_texsize),u_pixel_coord_upper:new ee(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new ee(e,t.u_pixel_coord_lower),u_scale:new lt(e,t.u_scale),u_fade:new V(e,t.u_fade),u_opacity:new V(e,t.u_opacity)})),"fillExtrusionPatternUniforms"),bd=l(((e,t,r,i)=>{let a=t.style.light,n=a.properties.get("position"),s=[n.x,n.y,n.z],o=Ca.create();"viewport"===a.properties.get("anchor")&&Ca.fromRotation(o,-t.transform.angle),xt.transformMat3(s,s,o);let l=a.properties.get("color");return{u_matrix:e,u_lightpos:s,u_lightintensity:a.properties.get("intensity"),u_lightcolor:[l.r,l.g,l.b],u_vertical_gradient:+r,u_opacity:i}}),"fillExtrusionUniformValues"),q0=l(((e,t,r,i,a,n,s)=>R(bd(e,t,r,i),Ql(n,t,s),{u_height_factor:-Math.pow(2,a.overscaledZ)/s.tileSize/8})),"fillExtrusionPatternUniformValues");d();var j0=l(((e,t)=>({u_matrix:new te(e,t.u_matrix)})),"fillUniforms"),Z0=l(((e,t)=>({u_matrix:new te(e,t.u_matrix),u_image:new Y(e,t.u_image),u_texsize:new ee(e,t.u_texsize),u_pixel_coord_upper:new ee(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new ee(e,t.u_pixel_coord_lower),u_scale:new lt(e,t.u_scale),u_fade:new V(e,t.u_fade)})),"fillPatternUniforms"),$0=l(((e,t)=>({u_matrix:new te(e,t.u_matrix),u_world:new ee(e,t.u_world)})),"fillOutlineUniforms"),H0=l(((e,t)=>({u_matrix:new te(e,t.u_matrix),u_world:new ee(e,t.u_world),u_image:new Y(e,t.u_image),u_texsize:new ee(e,t.u_texsize),u_pixel_coord_upper:new ee(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new ee(e,t.u_pixel_coord_lower),u_scale:new lt(e,t.u_scale),u_fade:new V(e,t.u_fade)})),"fillOutlinePatternUniforms"),_d=l((e=>({u_matrix:e})),"fillUniformValues"),vd=l(((e,t,r,i)=>R(_d(e),Ql(r,t,i))),"fillPatternUniformValues"),W0=l(((e,t)=>({u_matrix:e,u_world:t})),"fillOutlineUniformValues"),X0=l(((e,t,r,i,a)=>R(vd(e,t,r,i),{u_world:a})),"fillOutlinePatternUniformValues");d();var K0=l(((e,t)=>({u_camera_to_center_distance:new V(e,t.u_camera_to_center_distance),u_scale_with_map:new Y(e,t.u_scale_with_map),u_pitch_with_map:new Y(e,t.u_pitch_with_map),u_extrude_scale:new ee(e,t.u_extrude_scale),u_device_pixel_ratio:new V(e,t.u_device_pixel_ratio),u_matrix:new te(e,t.u_matrix)})),"circleUniforms"),Y0=l(((e,t,r,i)=>{let a,n,s=e.transform;if("map"===i.paint.get("circle-pitch-alignment")){let e=Ye(r,1,s.zoom);a=!0,n=[e,e]}else a=!1,n=s.pixelsToGLUnits;return{u_camera_to_center_distance:s.cameraToCenterDistance,u_scale_with_map:+("map"===i.paint.get("circle-pitch-scale")),u_matrix:e.translatePosMatrix(t.posMatrix,r,i.paint.get("circle-translate"),i.paint.get("circle-translate-anchor")),u_pitch_with_map:+a,u_device_pixel_ratio:e.pixelRatio,u_extrude_scale:n}}),"circleUniformValues");d();var J0=l(((e,t)=>({u_matrix:new te(e,t.u_matrix),u_camera_to_center_distance:new V(e,t.u_camera_to_center_distance),u_pixels_to_tile_units:new V(e,t.u_pixels_to_tile_units),u_extrude_scale:new ee(e,t.u_extrude_scale),u_overscale_factor:new V(e,t.u_overscale_factor)})),"collisionUniforms"),Q0=l(((e,t)=>({u_matrix:new te(e,t.u_matrix),u_inv_matrix:new te(e,t.u_inv_matrix),u_camera_to_center_distance:new V(e,t.u_camera_to_center_distance),u_viewport_size:new ee(e,t.u_viewport_size)})),"collisionCircleUniforms"),e1=l(((e,t,r)=>{let i=Ye(r,1,t.zoom),a=Math.pow(2,t.zoom-r.tileID.overscaledZ),n=r.tileID.overscaleFactor();return{u_matrix:e,u_camera_to_center_distance:t.cameraToCenterDistance,u_pixels_to_tile_units:i,u_extrude_scale:[t.pixelsToGLUnits[0]/(i*a),t.pixelsToGLUnits[1]/(i*a)],u_overscale_factor:n}}),"collisionUniformValues"),t1=l(((e,t,r)=>({u_matrix:e,u_inv_matrix:t,u_camera_to_center_distance:r.cameraToCenterDistance,u_viewport_size:[r.width,r.height]})),"collisionCircleUniformValues");d();var r1=l(((e,t)=>({u_color:new Ft(e,t.u_color),u_matrix:new te(e,t.u_matrix),u_overlay:new Y(e,t.u_overlay),u_overlay_scale:new V(e,t.u_overlay_scale)})),"debugUniforms"),wd=l(((e,t,r=1)=>({u_matrix:e,u_color:t,u_overlay:0,u_overlay_scale:r})),"debugUniformValues");d();var i1=l(((e,t)=>({u_matrix:new te(e,t.u_matrix)})),"clippingMaskUniforms"),Sd=l((e=>({u_matrix:e})),"clippingMaskUniformValues");d();var n1=l(((e,t)=>({u_extrude_scale:new V(e,t.u_extrude_scale),u_intensity:new V(e,t.u_intensity),u_matrix:new te(e,t.u_matrix)})),"heatmapUniforms"),a1=l(((e,t)=>({u_matrix:new te(e,t.u_matrix),u_world:new ee(e,t.u_world),u_image:new Y(e,t.u_image),u_color_ramp:new Y(e,t.u_color_ramp),u_opacity:new V(e,t.u_opacity)})),"heatmapTextureUniforms"),o1=l(((e,t,r,i)=>({u_matrix:e,u_extrude_scale:Ye(t,1,r),u_intensity:i})),"heatmapUniformValues"),s1=l(((e,t,r,i)=>{let a=G.create();G.ortho(a,0,e.width,e.height,0,0,1);let n=e.context.gl;return{u_matrix:a,u_world:[n.drawingBufferWidth,n.drawingBufferHeight],u_image:r,u_color_ramp:i,u_opacity:t.paint.get("heatmap-opacity")}}),"heatmapTextureUniformValues");d();var l1=l(((e,t)=>({u_matrix:new te(e,t.u_matrix),u_image:new Y(e,t.u_image),u_latrange:new ee(e,t.u_latrange),u_light:new ee(e,t.u_light),u_shadow:new Ft(e,t.u_shadow),u_highlight:new Ft(e,t.u_highlight),u_accent:new Ft(e,t.u_accent)})),"hillshadeUniforms"),u1=l(((e,t)=>({u_matrix:new te(e,t.u_matrix),u_image:new Y(e,t.u_image),u_dimension:new ee(e,t.u_dimension),u_zoom:new V(e,t.u_zoom),u_unpack:new Ir(e,t.u_unpack)})),"hillshadePrepareUniforms"),c1=l(((e,t,r,i)=>{let a=r.paint.get("hillshade-shadow-color"),n=r.paint.get("hillshade-highlight-color"),s=r.paint.get("hillshade-accent-color"),o=r.paint.get("hillshade-illumination-direction")*(Math.PI/180);"viewport"===r.paint.get("hillshade-illumination-anchor")&&(o-=e.transform.angle);let l=!e.options.moving;return{u_matrix:i?i.posMatrix:e.transform.calculatePosMatrix(t.tileID.toUnwrapped(),l),u_image:0,u_latrange:JC(e,t.tileID),u_light:[r.paint.get("hillshade-exaggeration"),o],u_shadow:a,u_highlight:n,u_accent:s}}),"hillshadeUniformValues"),p1=l(((e,t)=>{let r=t.stride,i=G.create();return G.ortho(i,0,8192,-8192,0,0,1),G.translate(i,i,[0,-8192,0]),{u_matrix:i,u_image:1,u_dimension:[r,r],u_zoom:e.overscaledZ,u_unpack:t.getUnpackVector()}}),"hillshadeUniformPrepareValues");function JC(e,t){let r=Math.pow(2,t.canonical.z),i=t.canonical.y;return[new ze(0,i/r).toLngLat().lat,new ze(0,(i+1)/r).toLngLat().lat]}l(JC,"getTileLatRange"),d();var h1=l(((e,t)=>({u_matrix:new te(e,t.u_matrix),u_ratio:new V(e,t.u_ratio),u_device_pixel_ratio:new V(e,t.u_device_pixel_ratio),u_units_to_pixels:new ee(e,t.u_units_to_pixels)})),"lineUniforms"),f1=l(((e,t)=>({u_matrix:new te(e,t.u_matrix),u_ratio:new V(e,t.u_ratio),u_device_pixel_ratio:new V(e,t.u_device_pixel_ratio),u_units_to_pixels:new ee(e,t.u_units_to_pixels),u_image:new Y(e,t.u_image),u_image_height:new V(e,t.u_image_height)})),"lineGradientUniforms"),m1=l(((e,t)=>({u_matrix:new te(e,t.u_matrix),u_texsize:new ee(e,t.u_texsize),u_ratio:new V(e,t.u_ratio),u_device_pixel_ratio:new V(e,t.u_device_pixel_ratio),u_image:new Y(e,t.u_image),u_units_to_pixels:new ee(e,t.u_units_to_pixels),u_scale:new lt(e,t.u_scale),u_fade:new V(e,t.u_fade)})),"linePatternUniforms"),d1=l(((e,t)=>({u_matrix:new te(e,t.u_matrix),u_ratio:new V(e,t.u_ratio),u_device_pixel_ratio:new V(e,t.u_device_pixel_ratio),u_units_to_pixels:new ee(e,t.u_units_to_pixels),u_patternscale_a:new ee(e,t.u_patternscale_a),u_patternscale_b:new ee(e,t.u_patternscale_b),u_sdfgamma:new V(e,t.u_sdfgamma),u_image:new Y(e,t.u_image),u_tex_y_a:new V(e,t.u_tex_y_a),u_tex_y_b:new V(e,t.u_tex_y_b),u_mix:new V(e,t.u_mix)})),"lineSDFUniforms"),eu=l(((e,t,r,i)=>{let a=e.transform;return{u_matrix:_1(e,t,r,i),u_ratio:1/Ye(t,1,a.zoom),u_device_pixel_ratio:e.pixelRatio,u_units_to_pixels:[1/a.pixelsToGLUnits[0],1/a.pixelsToGLUnits[1]]}}),"lineUniformValues"),y1=l(((e,t,r,i,a)=>R(eu(e,t,r,a),{u_image:0,u_image_height:i})),"lineGradientUniformValues"),g1=l(((e,t,r,i,a)=>{let n=e.transform,s=b1(t,n);return{u_matrix:_1(e,t,r,a),u_texsize:t.imageAtlasTexture.size,u_ratio:1/Ye(t,1,n.zoom),u_device_pixel_ratio:e.pixelRatio,u_image:0,u_scale:[s,i.fromScale,i.toScale],u_fade:i.t,u_units_to_pixels:[1/n.pixelsToGLUnits[0],1/n.pixelsToGLUnits[1]]}}),"linePatternUniformValues"),x1=l(((e,t,r,i,a,n)=>{let s=e.transform,o=e.lineAtlas,l=b1(t,s),u="round"===r.layout.get("line-cap"),c=o.getDash(i.from,u),h=o.getDash(i.to,u),p=c.width*a.fromScale,d=h.width*a.toScale;return R(eu(e,t,r,n),{u_patternscale_a:[l/p,-c.height/2],u_patternscale_b:[l/d,-h.height/2],u_sdfgamma:o.width/(256*Math.min(p,d)*e.pixelRatio)/2,u_image:0,u_tex_y_a:c.y,u_tex_y_b:h.y,u_mix:a.t})}),"lineSDFUniformValues");function b1(e,t){return 1/Ye(e,1,t.tileZoom)}function _1(e,t,r,i){return e.translatePosMatrix(i?i.posMatrix:t.tileID.posMatrix,t,r.paint.get("line-translate"),r.paint.get("line-translate-anchor"))}l(b1,"calculateTileRatio"),l(_1,"calculateMatrix"),d();var v1=l(((e,t)=>({u_matrix:new te(e,t.u_matrix),u_tl_parent:new ee(e,t.u_tl_parent),u_scale_parent:new V(e,t.u_scale_parent),u_buffer_scale:new V(e,t.u_buffer_scale),u_fade_t:new V(e,t.u_fade_t),u_opacity:new V(e,t.u_opacity),u_image0:new Y(e,t.u_image0),u_image1:new Y(e,t.u_image1),u_brightness_low:new V(e,t.u_brightness_low),u_brightness_high:new V(e,t.u_brightness_high),u_saturation_factor:new V(e,t.u_saturation_factor),u_contrast_factor:new V(e,t.u_contrast_factor),u_spin_weights:new lt(e,t.u_spin_weights)})),"rasterUniforms"),w1=l(((e,t,r,i,a)=>({u_matrix:e,u_tl_parent:t,u_scale_parent:r,u_buffer_scale:1,u_fade_t:i.mix,u_opacity:i.opacity*a.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:a.paint.get("raster-brightness-min"),u_brightness_high:a.paint.get("raster-brightness-max"),u_saturation_factor:tE(a.paint.get("raster-saturation")),u_contrast_factor:eE(a.paint.get("raster-contrast")),u_spin_weights:QC(a.paint.get("raster-hue-rotate"))})),"rasterUniformValues");function QC(e){e*=Math.PI/180;let t=Math.sin(e),r=Math.cos(e);return[(2*r+1)/3,(-Math.sqrt(3)*t-r+1)/3,(Math.sqrt(3)*t-r+1)/3]}function eE(e){return e>0?1/(1-e):1+e}function tE(e){return e>0?1-1/(1.001-e):-e}l(QC,"spinWeights"),l(eE,"contrastFactor"),l(tE,"saturationFactor"),d();var S1=l(((e,t)=>({u_is_size_zoom_constant:new Y(e,t.u_is_size_zoom_constant),u_is_size_feature_constant:new Y(e,t.u_is_size_feature_constant),u_size_t:new V(e,t.u_size_t),u_size:new V(e,t.u_size),u_camera_to_center_distance:new V(e,t.u_camera_to_center_distance),u_pitch:new V(e,t.u_pitch),u_rotate_symbol:new Y(e,t.u_rotate_symbol),u_aspect_ratio:new V(e,t.u_aspect_ratio),u_fade_change:new V(e,t.u_fade_change),u_matrix:new te(e,t.u_matrix),u_label_plane_matrix:new te(e,t.u_label_plane_matrix),u_coord_matrix:new te(e,t.u_coord_matrix),u_is_text:new Y(e,t.u_is_text),u_pitch_with_map:new Y(e,t.u_pitch_with_map),u_texsize:new ee(e,t.u_texsize),u_texture:new Y(e,t.u_texture)})),"symbolIconUniforms"),P1=l(((e,t)=>({u_is_size_zoom_constant:new Y(e,t.u_is_size_zoom_constant),u_is_size_feature_constant:new Y(e,t.u_is_size_feature_constant),u_size_t:new V(e,t.u_size_t),u_size:new V(e,t.u_size),u_camera_to_center_distance:new V(e,t.u_camera_to_center_distance),u_pitch:new V(e,t.u_pitch),u_rotate_symbol:new Y(e,t.u_rotate_symbol),u_aspect_ratio:new V(e,t.u_aspect_ratio),u_fade_change:new V(e,t.u_fade_change),u_matrix:new te(e,t.u_matrix),u_label_plane_matrix:new te(e,t.u_label_plane_matrix),u_coord_matrix:new te(e,t.u_coord_matrix),u_is_text:new Y(e,t.u_is_text),u_pitch_with_map:new Y(e,t.u_pitch_with_map),u_texsize:new ee(e,t.u_texsize),u_texture:new Y(e,t.u_texture),u_gamma_scale:new V(e,t.u_gamma_scale),u_device_pixel_ratio:new V(e,t.u_device_pixel_ratio),u_is_halo:new Y(e,t.u_is_halo)})),"symbolSDFUniforms"),T1=l(((e,t)=>({u_is_size_zoom_constant:new Y(e,t.u_is_size_zoom_constant),u_is_size_feature_constant:new Y(e,t.u_is_size_feature_constant),u_size_t:new V(e,t.u_size_t),u_size:new V(e,t.u_size),u_camera_to_center_distance:new V(e,t.u_camera_to_center_distance),u_pitch:new V(e,t.u_pitch),u_rotate_symbol:new Y(e,t.u_rotate_symbol),u_aspect_ratio:new V(e,t.u_aspect_ratio),u_fade_change:new V(e,t.u_fade_change),u_matrix:new te(e,t.u_matrix),u_label_plane_matrix:new te(e,t.u_label_plane_matrix),u_coord_matrix:new te(e,t.u_coord_matrix),u_is_text:new Y(e,t.u_is_text),u_pitch_with_map:new Y(e,t.u_pitch_with_map),u_texsize:new ee(e,t.u_texsize),u_texsize_icon:new ee(e,t.u_texsize_icon),u_texture:new Y(e,t.u_texture),u_texture_icon:new Y(e,t.u_texture_icon),u_gamma_scale:new V(e,t.u_gamma_scale),u_device_pixel_ratio:new V(e,t.u_device_pixel_ratio),u_is_halo:new Y(e,t.u_is_halo)})),"symbolTextAndIconUniforms"),Pd=l(((e,t,r,i,a,n,s,o,l,u)=>{let c=a.transform;return{u_is_size_zoom_constant:+("constant"===e||"source"===e),u_is_size_feature_constant:+("constant"===e||"camera"===e),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:c.cameraToCenterDistance,u_pitch:c.pitch/360*2*Math.PI,u_rotate_symbol:+r,u_aspect_ratio:c.width/c.height,u_fade_change:a.options.fadeDuration?a.symbolFadeChange:1,u_matrix:n,u_label_plane_matrix:s,u_coord_matrix:o,u_is_text:+l,u_pitch_with_map:+i,u_texsize:u,u_texture:0}}),"symbolIconUniformValues"),Td=l(((e,t,r,i,a,n,s,o,l,u,c)=>{let h=a.transform;return R(Pd(e,t,r,i,a,n,s,o,l,u),{u_gamma_scale:i?Math.cos(h._pitch)*h.cameraToCenterDistance:1,u_device_pixel_ratio:a.pixelRatio,u_is_halo:+c})}),"symbolSDFUniformValues"),A1=l(((e,t,r,i,a,n,s,o,l,u)=>R(Td(e,t,r,i,a,n,s,o,!0,l,!0),{u_texsize_icon:u,u_texture_icon:1})),"symbolTextAndIconUniformValues");d();var I1=l(((e,t)=>({u_matrix:new te(e,t.u_matrix),u_opacity:new V(e,t.u_opacity),u_color:new Ft(e,t.u_color)})),"backgroundUniforms"),M1=l(((e,t)=>({u_matrix:new te(e,t.u_matrix),u_opacity:new V(e,t.u_opacity),u_image:new Y(e,t.u_image),u_pattern_tl_a:new ee(e,t.u_pattern_tl_a),u_pattern_br_a:new ee(e,t.u_pattern_br_a),u_pattern_tl_b:new ee(e,t.u_pattern_tl_b),u_pattern_br_b:new ee(e,t.u_pattern_br_b),u_texsize:new ee(e,t.u_texsize),u_mix:new V(e,t.u_mix),u_pattern_size_a:new ee(e,t.u_pattern_size_a),u_pattern_size_b:new ee(e,t.u_pattern_size_b),u_scale_a:new V(e,t.u_scale_a),u_scale_b:new V(e,t.u_scale_b),u_pixel_coord_upper:new ee(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new ee(e,t.u_pixel_coord_lower),u_tile_units_to_pixels:new V(e,t.u_tile_units_to_pixels)})),"backgroundPatternUniforms"),C1=l(((e,t,r)=>({u_matrix:e,u_opacity:t,u_color:r})),"backgroundUniformValues"),E1=l(((e,t,r,i,a,n)=>R(U0(i,n,r,a),{u_matrix:e,u_opacity:t})),"backgroundPatternUniformValues"),k1={fillExtrusion:N0,fillExtrusionPattern:G0,fill:j0,fillPattern:Z0,fillOutline:$0,fillOutlinePattern:H0,circle:K0,collisionBox:J0,collisionCircle:Q0,debug:r1,clippingMask:i1,heatmap:n1,heatmapTexture:a1,hillshade:l1,hillshadePrepare:u1,line:h1,lineGradient:f1,linePattern:m1,lineSDF:d1,raster:v1,symbolIcon:S1,symbolSDF:P1,symbolTextAndIcon:T1,background:I1,backgroundPattern:M1,terrain:z0,terrainDepth:F0,terrainCoords:B0};d(),d();var Ad=class{constructor(e,t,r){this.context=e;let i=e.gl;this.buffer=i.createBuffer(),this.dynamicDraw=!!r,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),i.bufferData(i.ELEMENT_ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?i.DYNAMIC_DRAW:i.STATIC_DRAW),this.dynamicDraw||delete t.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){let t=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),t.bufferSubData(t.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){let e=this.context.gl;this.buffer&&(e.deleteBuffer(this.buffer),delete this.buffer)}};l(Ad,"IndexBuffer");var tu=Ad;d();var rE={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"},Id=class{constructor(e,t,r,i){this.length=t.length,this.attributes=r,this.itemSize=t.bytesPerElement,this.dynamicDraw=i,this.context=e;let a=e.gl;this.buffer=a.createBuffer(),e.bindVertexBuffer.set(this.buffer),a.bufferData(a.ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?a.DYNAMIC_DRAW:a.STATIC_DRAW),this.dynamicDraw||delete t.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){if(e.length!==this.length)throw new Error("Length of new data is ".concat(e.length,", which doesn't match current length of ").concat(this.length));let t=this.context.gl;this.bind(),t.bufferSubData(t.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,t){for(let r=0;r<this.attributes.length;r++){let i=this.attributes[r],a=t.attributes[i.name];void 0!==a&&e.enableVertexAttribArray(a)}}setVertexAttribPointers(e,t,r){for(let i=0;i<this.attributes.length;i++){let a=this.attributes[i],n=t.attributes[a.name];void 0!==n&&e.vertexAttribPointer(n,a.components,e[rE[a.type]],!1,this.itemSize,a.offset+this.itemSize*(r||0))}}destroy(){let e=this.context.gl;this.buffer&&(e.deleteBuffer(this.buffer),delete this.buffer)}};l(Id,"VertexBuffer");var ru=Id;d(),d(),d();var Md=new WeakMap;function wn(e){if(Md.has(e))return Md.get(e);{let t=e.getParameter(e.VERSION).startsWith("WebGL 2.0");return Md.set(e,t),t}}l(wn,"isWebGL2");var Cd=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)}};l(Cd,"BaseValue");var xe=Cd,Ed=class extends xe{getDefault(){return X.transparent}set(e){let t=this.current;e.r===t.r&&e.g===t.g&&e.b===t.b&&e.a===t.a&&!this.dirty||(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}};l(Ed,"ClearColor");var iu=Ed,kd=class extends xe{getDefault(){return 1}set(e){e===this.current&&!this.dirty||(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}};l(kd,"ClearDepth");var nu=kd,Ld=class extends xe{getDefault(){return 0}set(e){e===this.current&&!this.dirty||(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}};l(Ld,"ClearStencil");var au=Ld,Dd=class extends xe{getDefault(){return[!0,!0,!0,!0]}set(e){let t=this.current;e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&!this.dirty||(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}};l(Dd,"ColorMask");var ou=Dd,zd=class extends xe{getDefault(){return!0}set(e){e===this.current&&!this.dirty||(this.gl.depthMask(e),this.current=e,this.dirty=!1)}};l(zd,"DepthMask");var su=zd,Fd=class extends xe{getDefault(){return 255}set(e){e===this.current&&!this.dirty||(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}};l(Fd,"StencilMask");var lu=Fd,Bd=class extends xe{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){let t=this.current;e.func===t.func&&e.ref===t.ref&&e.mask===t.mask&&!this.dirty||(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}};l(Bd,"StencilFunc");var uu=Bd,Rd=class extends xe{getDefault(){let e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){let t=this.current;e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&!this.dirty||(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}};l(Rd,"StencilOp");var cu=Rd,Od=class extends xe{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.STENCIL_TEST):t.disable(t.STENCIL_TEST),this.current=e,this.dirty=!1}};l(Od,"StencilTest");var pu=Od,Vd=class extends xe{getDefault(){return[0,1]}set(e){let t=this.current;e[0]===t[0]&&e[1]===t[1]&&!this.dirty||(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}};l(Vd,"DepthRange");var hu=Vd,Ud=class extends xe{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.DEPTH_TEST):t.disable(t.DEPTH_TEST),this.current=e,this.dirty=!1}};l(Ud,"DepthTest");var fu=Ud,Nd=class extends xe{getDefault(){return this.gl.LESS}set(e){e===this.current&&!this.dirty||(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}};l(Nd,"DepthFunc");var mu=Nd,Gd=class extends xe{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.BLEND):t.disable(t.BLEND),this.current=e,this.dirty=!1}};l(Gd,"Blend");var du=Gd,qd=class extends xe{getDefault(){let e=this.gl;return[e.ONE,e.ZERO]}set(e){let t=this.current;e[0]===t[0]&&e[1]===t[1]&&!this.dirty||(this.gl.blendFunc(e[0],e[1]),this.current=e,this.dirty=!1)}};l(qd,"BlendFunc");var yu=qd,jd=class extends xe{getDefault(){return X.transparent}set(e){let t=this.current;e.r===t.r&&e.g===t.g&&e.b===t.b&&e.a===t.a&&!this.dirty||(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}};l(jd,"BlendColor");var gu=jd,Zd=class extends xe{getDefault(){return this.gl.FUNC_ADD}set(e){e===this.current&&!this.dirty||(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}};l(Zd,"BlendEquation");var xu=Zd,$d=class extends xe{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.CULL_FACE):t.disable(t.CULL_FACE),this.current=e,this.dirty=!1}};l($d,"CullFace");var bu=$d,Hd=class extends xe{getDefault(){return this.gl.BACK}set(e){e===this.current&&!this.dirty||(this.gl.cullFace(e),this.current=e,this.dirty=!1)}};l(Hd,"CullFaceSide");var _u=Hd,Wd=class extends xe{getDefault(){return this.gl.CCW}set(e){e===this.current&&!this.dirty||(this.gl.frontFace(e),this.current=e,this.dirty=!1)}};l(Wd,"FrontFace");var vu=Wd,Xd=class extends xe{getDefault(){return null}set(e){e===this.current&&!this.dirty||(this.gl.useProgram(e),this.current=e,this.dirty=!1)}};l(Xd,"ProgramValue");var wu=Xd,Kd=class extends xe{getDefault(){return this.gl.TEXTURE0}set(e){e===this.current&&!this.dirty||(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}};l(Kd,"ActiveTextureUnit");var Su=Kd,Yd=class extends xe{getDefault(){let e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){let t=this.current;e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&!this.dirty||(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}};l(Yd,"Viewport");var Pu=Yd,Jd=class extends xe{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,e),this.current=e,this.dirty=!1}};l(Jd,"BindFramebuffer");var Tu=Jd,Qd=class extends xe{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindRenderbuffer(t.RENDERBUFFER,e),this.current=e,this.dirty=!1}};l(Qd,"BindRenderbuffer");var Au=Qd,ey=class extends xe{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindTexture(t.TEXTURE_2D,e),this.current=e,this.dirty=!1}};l(ey,"BindTexture");var Iu=ey,ty=class extends xe{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindBuffer(t.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}};l(ty,"BindVertexBuffer");var Mu=ty,ry=class extends xe{getDefault(){return null}set(e){let t=this.gl;t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}};l(ry,"BindElementBuffer");var Cu=ry,iy=class extends xe{getDefault(){return null}set(e){var t;if(e===this.current&&!this.dirty)return;let r=this.gl;wn(r)?r.bindVertexArray(e):null==(t=r.getExtension("OES_vertex_array_object"))||t.bindVertexArrayOES(e),this.current=e,this.dirty=!1}};l(iy,"BindVertexArray");var Eu=iy,ny=class extends xe{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.pixelStorei(t.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}};l(ny,"PixelStoreUnpack");var ku=ny,ay=class extends xe{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}};l(ay,"PixelStoreUnpackPremultiplyAlpha");var Lu=ay,oy=class extends xe{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}};l(oy,"PixelStoreUnpackFlipY");var Du=oy,sy=class extends xe{constructor(e,t){super(e),this.context=e,this.parent=t}getDefault(){return null}};l(sy,"FramebufferAttachment");var lo=sy,ly=class extends lo{setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let t=this.gl;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}};l(ly,"ColorAttachment");var zu=ly,uy=class extends lo{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let t=this.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,e),this.current=e,this.dirty=!1}};l(uy,"DepthAttachment");var Fu=uy,cy=class extends lo{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let t=this.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,e),this.current=e,this.dirty=!1}};l(cy,"DepthStencilAttachment");var Bu=cy,py=class{constructor(e,t,r,i,a){this.context=e,this.width=t,this.height=r;let n=e.gl,s=this.framebuffer=n.createFramebuffer();if(this.colorAttachment=new zu(e,s),i)this.depthAttachment=a?new Bu(e,s):new Fu(e,s);else if(a)throw new Error("Stencil cannot be setted without depth");if(n.checkFramebufferStatus(n.FRAMEBUFFER)!==n.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){let e=this.context.gl,t=this.colorAttachment.get();if(t&&e.deleteTexture(t),this.depthAttachment){let t=this.depthAttachment.get();t&&e.deleteRenderbuffer(t)}e.deleteFramebuffer(this.framebuffer)}};l(py,"Framebuffer");var Ru=py;d();var iE=0,L1=1,nE=771,hy=class{constructor(e,t,r){this.blendFunction=e,this.blendColor=t,this.mask=r}};l(hy,"ColorMode");var De=hy;De.Replace=[L1,iE],De.disabled=new De(De.Replace,X.transparent,[!1,!1,!1,!1]),De.unblended=new De(De.Replace,X.transparent,[!0,!0,!0,!0]),De.alphaBlended=new De([L1,nE],X.transparent,[!0,!0,!0,!0]);var fy=class{constructor(e){var t,r;if(this.gl=e,this.clearColor=new iu(this),this.clearDepth=new nu(this),this.clearStencil=new au(this),this.colorMask=new ou(this),this.depthMask=new su(this),this.stencilMask=new lu(this),this.stencilFunc=new uu(this),this.stencilOp=new cu(this),this.stencilTest=new pu(this),this.depthRange=new hu(this),this.depthTest=new fu(this),this.depthFunc=new mu(this),this.blend=new du(this),this.blendFunc=new yu(this),this.blendColor=new gu(this),this.blendEquation=new xu(this),this.cullFace=new bu(this),this.cullFaceSide=new _u(this),this.frontFace=new vu(this),this.program=new wu(this),this.activeTexture=new Su(this),this.viewport=new Pu(this),this.bindFramebuffer=new Tu(this),this.bindRenderbuffer=new Au(this),this.bindTexture=new Iu(this),this.bindVertexBuffer=new Mu(this),this.bindElementBuffer=new Cu(this),this.bindVertexArray=new Eu(this),this.pixelStoreUnpack=new ku(this),this.pixelStoreUnpackPremultiplyAlpha=new Lu(this),this.pixelStoreUnpackFlipY=new Du(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),wn(e)){this.HALF_FLOAT=e.HALF_FLOAT;let i=e.getExtension("EXT_color_buffer_half_float");this.RGBA16F=null!=(t=e.RGBA16F)?t:null==i?void 0:i.RGBA16F_EXT,this.RGB16F=null!=(r=e.RGB16F)?r:null==i?void 0:i.RGB16F_EXT,e.getExtension("EXT_color_buffer_float")}else{e.getExtension("EXT_color_buffer_half_float"),e.getExtension("OES_texture_half_float_linear");let t=e.getExtension("OES_texture_half_float");this.HALF_FLOAT=null==t?void 0:t.HALF_FLOAT_OES}}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(e,t){return new tu(this,e,t)}createVertexBuffer(e,t,r){return new ru(this,e,t,r)}createRenderbuffer(e,t,r){let i=this.gl,a=i.createRenderbuffer();return this.bindRenderbuffer.set(a),i.renderbufferStorage(i.RENDERBUFFER,e,t,r),this.bindRenderbuffer.set(null),a}createFramebuffer(e,t,r,i){return new Ru(this,e,t,r,i)}clear({color:e,depth:t,stencil:r}){let i=this.gl,a=0;e&&(a|=i.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),typeof t<"u"&&(a|=i.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(t),this.depthMask.set(!0)),typeof r<"u"&&(a|=i.STENCIL_BUFFER_BIT,this.clearStencil.set(r),this.stencilMask.set(255)),i.clear(a)}setCullFace(e){!1===e.enable?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(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range)):this.depthTest.set(!1)}setStencilMode(e){e.test.func!==this.gl.ALWAYS||e.mask?(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})):this.stencilTest.set(!1)}setColorMode(e){Yt(e.blendFunction,De.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)}createVertexArray(){var e;return wn(this.gl)?this.gl.createVertexArray():null==(e=this.gl.getExtension("OES_vertex_array_object"))?void 0:e.createVertexArrayOES()}deleteVertexArray(e){var t;return wn(this.gl)?this.gl.deleteVertexArray(e):null==(t=this.gl.getExtension("OES_vertex_array_object"))?void 0:t.deleteVertexArrayOES(e)}unbindVAO(){this.bindVertexArray.set(null)}};l(fy,"Context");var Ou=fy;d();var my=class{constructor(e,t,r){this.func=e,this.mask=t,this.range=r}};l(my,"DepthMode");var Q=my;Q.ReadOnly=!1,Q.ReadWrite=!0,Q.disabled=new Q(519,Q.ReadOnly,[0,1]),d();var dy=class{constructor(e,t,r,i,a,n){this.test=e,this.ref=t,this.mask=r,this.fail=i,this.depthFail=a,this.pass=n}};l(dy,"StencilMode");var he=dy;he.disabled=new he({func:519,mask:0},0,0,7680,7680,7680),d();var yy=class{constructor(e,t,r){this.enable=e,this.mode=t,this.frontFace=r}};l(yy,"CullFaceMode");var le=yy;le.disabled=new le(!1,1029,2305),le.backCCW=new le(!0,1029,2305),d();var Vu,xy=se(Pe(),1);function gy(e,t,r,i,a,n,s){let o=e.context,l=o.gl,u=e.useProgram("collisionBox"),c=[],h=0,p=0;for(let d=0;d<i.length;d++){let f=i[d],m=t.getTile(f),y=m.getBucket(r);if(!y)continue;let g=f.posMatrix;(0!==a[0]||0!==a[1])&&(g=e.translatePosMatrix(f.posMatrix,m,a,n));let _=s?y.textCollisionBox:y.iconCollisionBox,x=y.collisionCircleArray;if(x.length>0){let t=G.create(),r=g;G.mul(t,y.placementInvProjMatrix,e.transform.glCoordMatrix),G.mul(t,t,y.placementViewportMatrix),c.push({circleArray:x,circleOffset:p,transform:r,invTransform:t,coord:f}),h+=x.length/4,p=h}_&&u.draw(o,l.LINES,Q.disabled,he.disabled,e.colorModeForRenderPass(),le.disabled,e1(g,e.transform,m),e.style.map.terrain&&e.style.map.terrain.getTerrainData(f),r.id,_.layoutVertexBuffer,_.indexBuffer,_.segments,null,e.transform.zoom,null,null,_.collisionVertexBuffer)}if(!s||!c.length)return;let d=e.useProgram("collisionCircle"),f=new Ds;f.resize(4*h),f._trim();let m=0;for(let e of c)for(let t=0;t<e.circleArray.length/4;t++){let r=4*t,i=e.circleArray[r+0],a=e.circleArray[r+1],n=e.circleArray[r+2],s=e.circleArray[r+3];f.emplace(m++,i,a,n,s,0),f.emplace(m++,i,a,n,s,1),f.emplace(m++,i,a,n,s,2),f.emplace(m++,i,a,n,s,3)}(!Vu||Vu.length<2*h)&&(Vu=aE(h));let y=o.createIndexBuffer(Vu,!0),g=o.createVertexBuffer(f,__.members,!0);for(let t of c){let i=t1(t.transform,t.invTransform,e.transform);d.draw(o,l.TRIANGLES,Q.disabled,he.disabled,e.colorModeForRenderPass(),le.disabled,i,e.style.map.terrain&&e.style.map.terrain.getTerrainData(t.coord),r.id,g,y,me.simpleSegment(0,2*t.circleOffset,t.circleArray.length,t.circleArray.length/2),null,e.transform.zoom,null,null,null)}g.destroy(),y.destroy()}function aE(e){let t=2*e,r=new Fs;r.resize(t),r._trim();for(let e=0;e<t;e++){let t=6*e;r.uint16[t+0]=4*e+0,r.uint16[t+1]=4*e+1,r.uint16[t+2]=4*e+2,r.uint16[t+3]=4*e+2,r.uint16[t+4]=4*e+3,r.uint16[t+5]=4*e+0}return r}d(),l(gy,"drawCollisionDebug"),l(aE,"createQuadTriangles");var oE=G.identity(new Float32Array(16));function F1(e,t,r,i,a){if("translucent"!==e.renderPass)return;let n=he.disabled,s=e.colorModeForRenderPass();r.layout.get("text-variable-anchor")&&lE(i,e,r,t,r.layout.get("text-rotation-alignment"),r.layout.get("text-pitch-alignment"),a),0!==r.paint.get("icon-opacity").constantOr(1)&&D1(e,t,r,i,!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"),n,s),0!==r.paint.get("text-opacity").constantOr(1)&&D1(e,t,r,i,!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"),n,s),t.map.showCollisionBoxes&&(gy(e,t,r,i,r.paint.get("text-translate"),r.paint.get("text-translate-anchor"),!0),gy(e,t,r,i,r.paint.get("icon-translate"),r.paint.get("icon-translate-anchor"),!1))}function sE(e,t,r,i,a,n){let{horizontalAlign:s,verticalAlign:o}=ll(e),l=-(s-.5)*t,u=-(o-.5)*r,c=Vl(e,i);return new xy.default((l/a+c[0])*n,(u/a+c[1])*n)}function lE(e,t,r,i,a,n,s){let o=t.transform,l="map"===a,u="map"===n;for(let a of e){let e=i.getTile(a),n=e.getBucket(r);if(!n||!n.text||!n.text.segments.get().length)continue;let c=hi(n.textSizeData,o.zoom),h=Ye(e,1,t.transform.zoom),p=eo(a.posMatrix,u,l,t.transform,h),d="none"!==r.layout.get("icon-text-fit")&&n.hasIconData();if(c){let r=Math.pow(2,o.zoom-e.tileID.overscaledZ),i=t.style.map.terrain?(e,r)=>t.style.map.terrain.getElevation(a,e,r):null;uE(n,l,u,s,o,p,a.posMatrix,r,c,d,i)}}}function uE(e,t,r,i,a,n,s,o,l,u,c){let h=e.text.placedSymbolArray,p=e.text.dynamicLayoutVertexArray,d=e.icon.dynamicLayoutVertexArray,f={};p.clear();for(let d=0;d<h.length;d++){let m=h.get(d),y=e.allowVerticalPlacement&&!m.placedOrientation,g=m.hidden||!m.crossTileID||y?null:i[m.crossTileID];if(g){let i=new xy.default(m.anchorX,m.anchorY),h=_t(i,r?s:n,c),d=to(a.cameraToCenterDistance,h.signedDistanceFromCamera),y=on(e.textSizeData,l,m)*d/ci;r&&(y*=e.tilePixelRatio/o);let{width:_,height:x,anchor:v,textOffset:b,textBoxScale:w}=g,S=sE(v,_,x,b,w,y),A=r?_t(i.add(S),n,c).point:h.point.add(t?S.rotate(-a.angle):S),I=e.allowVerticalPlacement&&2===m.placedOrientation?Math.PI/2:0;for(let e=0;e<m.numGlyphs;e++)fi(p,A,I);u&&m.associatedIconIndex>=0&&(f[m.associatedIconIndex]={shiftedAnchor:A,angle:I})}else xi(m.numGlyphs,p)}if(u){d.clear();let t=e.icon.placedSymbolArray;for(let e=0;e<t.length;e++){let r=t.get(e);if(r.hidden)xi(r.numGlyphs,d);else{let t=f[e];if(t)for(let e=0;e<r.numGlyphs;e++)fi(d,t.shiftedAnchor,t.angle);else xi(r.numGlyphs,d)}}e.icon.dynamicLayoutVertexBuffer.updateData(d)}e.text.dynamicLayoutVertexBuffer.updateData(p)}function cE(e,t,r){return r.iconsInText&&t?"symbolTextAndIcon":e?"symbolSDF":"symbolIcon"}function D1(e,t,r,i,a,n,s,o,l,u,c,h){let p=e.context,d=p.gl,f=e.transform,m="map"===o,y="map"===l,g="viewport"!==o&&"point"!==r.layout.get("symbol-placement"),_=m&&!y&&!g,x=!r.layout.get("symbol-sort-key").isConstant(),v=!1,b=e.depthModeForSublayer(0,Q.ReadOnly),w=r.layout.get("text-variable-anchor"),S=[];for(let o of i){let i=t.getTile(o),l=i.getBucket(r);if(!l)continue;let c=a?l.text:l.icon;if(!c||!c.segments.get().length||!c.hasVisibleVertices)continue;let h,p,b,A,I=c.programConfigurations.get(r.id),M=a||l.sdfIcons,T=a?l.textSizeData:l.iconSizeData,P=y||0!==f.pitch,C=e.useProgram(cE(M,a,l),I),E=hi(T,f.zoom),k=e.style.map.terrain&&e.style.map.terrain.getTerrainData(o),z=[0,0],D=null;if(a){if(p=i.glyphAtlasTexture,b=d.LINEAR,h=i.glyphAtlasTexture.size,l.iconsInText){z=i.imageAtlasTexture.size,D=i.imageAtlasTexture;let t="composite"===T.kind||"camera"===T.kind;A=P||e.options.rotating||e.options.zooming||t?d.LINEAR:d.NEAREST}}else{let t=1!==r.layout.get("icon-size").constantOr(0)||l.iconsNeedLinear;p=i.imageAtlasTexture,b=M||e.options.rotating||e.options.zooming||t||P?d.LINEAR:d.NEAREST,h=i.imageAtlasTexture.size}let B=Ye(i,1,e.transform.zoom),F=eo(o.posMatrix,y,m,e.transform,B),L=Fl(o.posMatrix,y,m,e.transform,B),R=w&&l.hasTextData(),V="none"!==r.layout.get("icon-text-fit")&&R&&l.hasIconData();if(g){let t=e.style.map.terrain?(t,r)=>e.style.map.terrain.getElevation(o,t,r):null,i="map"===r.layout.get("text-rotation-alignment");Sv(l,o.posMatrix,e,a,F,L,y,u,i,t)}let O,U=e.translatePosMatrix(o.posMatrix,i,n,s),N=g||a&&w||V?oE:F,q=e.translatePosMatrix(L,i,n,s,!0),j=M&&0!==r.paint.get(a?"text-halo-width":"icon-halo-width").constantOr(1);O=M?l.iconsInText?A1(T.kind,E,_,y,e,U,N,q,h,z):Td(T.kind,E,_,y,e,U,N,q,a,h,!0):Pd(T.kind,E,_,y,e,U,N,q,a,h);let G={program:C,buffers:c,uniformValues:O,atlasTexture:p,atlasTextureIcon:D,atlasInterpolation:b,atlasInterpolationIcon:A,isSDF:M,hasHalo:j};if(x&&l.canOverlap){v=!0;let e=c.segments.get();for(let t of e)S.push({segments:new me([t]),sortKey:t.sortKey,state:G,terrainData:k})}else S.push({segments:c.segments,sortKey:0,state:G,terrainData:k})}v&&S.sort(((e,t)=>e.sortKey-t.sortKey));for(let t of S){let i=t.state;if(p.activeTexture.set(d.TEXTURE0),i.atlasTexture.bind(i.atlasInterpolation,d.CLAMP_TO_EDGE),i.atlasTextureIcon&&(p.activeTexture.set(d.TEXTURE1),i.atlasTextureIcon&&i.atlasTextureIcon.bind(i.atlasInterpolationIcon,d.CLAMP_TO_EDGE)),i.isSDF){let a=i.uniformValues;i.hasHalo&&(a.u_is_halo=1,z1(i.buffers,t.segments,r,e,i.program,b,c,h,a,t.terrainData)),a.u_is_halo=0}z1(i.buffers,t.segments,r,e,i.program,b,c,h,i.uniformValues,t.terrainData)}}function z1(e,t,r,i,a,n,s,o,l,u){let c=i.context,h=c.gl;a.draw(c,h.TRIANGLES,n,s,o,le.disabled,l,u,r.id,e.layoutVertexBuffer,e.indexBuffer,t,r.paint,i.transform.zoom,e.programConfigurations.get(r.id),e.dynamicLayoutVertexBuffer,e.opacityVertexBuffer)}function B1(e,t,r,i){if("translucent"!==e.renderPass)return;let a=r.paint.get("circle-opacity"),n=r.paint.get("circle-stroke-width"),s=r.paint.get("circle-stroke-opacity"),o=!r.layout.get("circle-sort-key").isConstant();if(0===a.constantOr(1)&&(0===n.constantOr(1)||0===s.constantOr(1)))return;let l=e.context,u=l.gl,c=e.depthModeForSublayer(0,Q.ReadOnly),h=he.disabled,p=e.colorModeForRenderPass(),d=[];for(let a=0;a<i.length;a++){let n=i[a],s=t.getTile(n),l=s.getBucket(r);if(!l)continue;let u=l.programConfigurations.get(r.id),c=e.useProgram("circle",u),h=l.layoutVertexBuffer,p=l.indexBuffer,f=e.style.map.terrain&&e.style.map.terrain.getTerrainData(n),m={programConfiguration:u,program:c,layoutVertexBuffer:h,indexBuffer:p,uniformValues:Y0(e,n,s,r),terrainData:f};if(o){let e=l.segments.get();for(let t of e)d.push({segments:new me([t]),sortKey:t.sortKey,state:m})}else d.push({segments:l.segments,sortKey:0,state:m})}o&&d.sort(((e,t)=>e.sortKey-t.sortKey));for(let t of d){let{programConfiguration:i,program:a,layoutVertexBuffer:n,indexBuffer:s,uniformValues:o,terrainData:d}=t.state,f=t.segments;a.draw(l,u.TRIANGLES,c,h,p,le.disabled,o,d,r.id,n,s,f,r.paint,e.transform.zoom,i)}}function R1(e,t,r,i){if(0!==r.paint.get("heatmap-opacity"))if("offscreen"===e.renderPass){let a=e.context,n=a.gl,s=he.disabled,o=new De([n.ONE,n.ONE],X.transparent,[!0,!0,!0,!0]);pE(a,e,r),a.clear({color:X.transparent});for(let l=0;l<i.length;l++){let u=i[l];if(t.hasRenderableParent(u))continue;let c=t.getTile(u),h=c.getBucket(r);if(!h)continue;let p=h.programConfigurations.get(r.id),d=e.useProgram("heatmap",p),{zoom:f}=e.transform;d.draw(a,n.TRIANGLES,Q.disabled,s,o,le.disabled,o1(u.posMatrix,c,f,r.paint.get("heatmap-intensity")),null,r.id,h.layoutVertexBuffer,h.indexBuffer,h.segments,r.paint,e.transform.zoom,p)}a.viewport.set([0,0,e.width,e.height])}else"translucent"===e.renderPass&&(e.context.setColorMode(e.colorModeForRenderPass()),fE(e,r))}function pE(e,t,r){let i=e.gl;e.activeTexture.set(i.TEXTURE1),e.viewport.set([0,0,t.width/4,t.height/4]);let a=r.heatmapFbo;if(a)i.bindTexture(i.TEXTURE_2D,a.colorAttachment.get()),e.bindFramebuffer.set(a.framebuffer);else{let n=i.createTexture();i.bindTexture(i.TEXTURE_2D,n),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),a=r.heatmapFbo=e.createFramebuffer(t.width/4,t.height/4,!1,!1),hE(e,t,n,a)}}function hE(e,t,r,i){var a,n;let s=e.gl,o=null!=(a=e.HALF_FLOAT)?a:s.UNSIGNED_BYTE,l=null!=(n=e.RGBA16F)?n:s.RGBA;s.texImage2D(s.TEXTURE_2D,0,l,t.width/4,t.height/4,0,s.RGBA,o,null),i.colorAttachment.set(r)}function fE(e,t){let r=e.context,i=r.gl,a=t.heatmapFbo;if(!a)return;r.activeTexture.set(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,a.colorAttachment.get()),r.activeTexture.set(i.TEXTURE1);let n=t.colorRampTexture;n||(n=t.colorRampTexture=new be(r,t.colorRamp,i.RGBA)),n.bind(i.LINEAR,i.CLAMP_TO_EDGE),e.useProgram("heatmapTexture").draw(r,i.TRIANGLES,Q.disabled,he.disabled,e.colorModeForRenderPass(),le.disabled,s1(e,t,0,1),null,t.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,t.paint,e.transform.zoom)}function O1(e,t,r,i){if("translucent"!==e.renderPass)return;let a=r.paint.get("line-opacity"),n=r.paint.get("line-width");if(0===a.constantOr(1)||0===n.constantOr(1))return;let s=e.depthModeForSublayer(0,Q.ReadOnly),o=e.colorModeForRenderPass(),l=r.paint.get("line-dasharray"),u=r.paint.get("line-pattern"),c=u.constantOr(1),h=r.paint.get("line-gradient"),p=r.getCrossfadeParameters(),d=c?"linePattern":l?"lineSDF":h?"lineGradient":"line",f=e.context,m=f.gl,y=!0;for(let a of i){let i=t.getTile(a);if(c&&!i.patternsLoaded())continue;let n=i.getBucket(r);if(!n)continue;let g=n.programConfigurations.get(r.id),_=e.context.program.get(),x=e.useProgram(d,g),v=y||x.program!==_,b=e.style.map.terrain&&e.style.map.terrain.getTerrainData(a),w=u.constantOr(null);if(w&&i.imageAtlas){let e=i.imageAtlas,t=e.patternPositions[w.to.toString()],r=e.patternPositions[w.from.toString()];t&&r&&g.setConstantPatternPositions(t,r)}let S=b?a:null,A=c?g1(e,i,r,p,S):l?x1(e,i,r,l,p,S):h?y1(e,i,r,n.lineClipsArray.length,S):eu(e,i,r,S);if(c)f.activeTexture.set(m.TEXTURE0),i.imageAtlasTexture.bind(m.LINEAR,m.CLAMP_TO_EDGE),g.updatePaintBuffers(p);else if(l&&(v||e.lineAtlas.dirty))f.activeTexture.set(m.TEXTURE0),e.lineAtlas.bind(f);else if(h){let i=n.gradients[r.id],s=i.texture;if(r.gradientVersion!==i.version){let o=256;if(r.stepInterpolant){let r=t.getSource().maxzoom,i=a.canonical.z===r?Math.ceil(1<<e.transform.maxZoom-a.canonical.z):1;o=Te(ug(n.maxLineLength/8192*1024*i),256,f.maxTextureSize)}i.gradient=Hs({expression:r.gradientExpression(),evaluationKey:"lineProgress",resolution:o,image:i.gradient||void 0,clips:n.lineClipsArray}),i.texture?i.texture.update(i.gradient):i.texture=new be(f,i.gradient,m.RGBA),i.version=r.gradientVersion,s=i.texture}f.activeTexture.set(m.TEXTURE0),s.bind(r.stepInterpolant?m.NEAREST:m.LINEAR,m.CLAMP_TO_EDGE)}x.draw(f,m.TRIANGLES,s,e.stencilModeForClipping(a),o,le.disabled,A,b,r.id,n.layoutVertexBuffer,n.indexBuffer,n.segments,r.paint,e.transform.zoom,g,n.layoutVertexBuffer2),y=!1}}function Uu(e,t,r,i,a){if(!r||!i||!i.imageAtlas)return;let n=i.imageAtlas.patternPositions,s=n[r.to.toString()],o=n[r.from.toString()];if(!s||!o){let e=a.getPaintProperty(t);s=n[e],o=n[e]}s&&o&&e.setConstantPatternPositions(s,o)}function U1(e,t,r,i){let a=r.paint.get("fill-color"),n=r.paint.get("fill-opacity");if(0===n.constantOr(1))return;let s=e.colorModeForRenderPass(),o=r.paint.get("fill-pattern"),l=e.opaquePassEnabledForLayer()&&!o.constantOr(1)&&1===a.constantOr(X.transparent).a&&1===n.constantOr(0)?"opaque":"translucent";if(e.renderPass===l){let a=e.depthModeForSublayer(1,"opaque"===e.renderPass?Q.ReadWrite:Q.ReadOnly);V1(e,t,r,i,a,s,!1)}if("translucent"===e.renderPass&&r.paint.get("fill-antialias")){let a=e.depthModeForSublayer(r.getPaintProperty("fill-outline-color")?2:0,Q.ReadOnly);V1(e,t,r,i,a,s,!0)}}function V1(e,t,r,i,a,n,s){let o,l,u,c,h,p=e.context.gl,d="fill-pattern",f=r.paint.get(d),m=f&&f.constantOr(1),y=r.getCrossfadeParameters();s?(l=m&&!r.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",o=p.LINES):(l=m?"fillPattern":"fill",o=p.TRIANGLES);let g=f.constantOr(null);for(let f of i){let i=t.getTile(f);if(m&&!i.patternsLoaded())continue;let _=i.getBucket(r);if(!_)continue;let x=_.programConfigurations.get(r.id),v=e.useProgram(l,x),b=e.style.map.terrain&&e.style.map.terrain.getTerrainData(f);m&&(e.context.activeTexture.set(p.TEXTURE0),i.imageAtlasTexture.bind(p.LINEAR,p.CLAMP_TO_EDGE),x.updatePaintBuffers(y)),Uu(x,d,g,i,r);let w=b?f:null,S=w?w.posMatrix:f.posMatrix,A=e.translatePosMatrix(S,i,r.paint.get("fill-translate"),r.paint.get("fill-translate-anchor"));if(s){c=_.indexBuffer2,h=_.segments2;let t=[p.drawingBufferWidth,p.drawingBufferHeight];u="fillOutlinePattern"===l&&m?X0(A,e,y,i,t):W0(A,t)}else c=_.indexBuffer,h=_.segments,u=m?vd(A,e,y,i):_d(A);v.draw(e.context,o,a,e.stencilModeForClipping(f),n,le.disabled,u,b,r.id,_.layoutVertexBuffer,c,h,r.paint,e.transform.zoom,x)}}function N1(e,t,r,i){let a=r.paint.get("fill-extrusion-opacity");if(0!==a&&"translucent"===e.renderPass){let n=new Q(e.context.gl.LEQUAL,Q.ReadWrite,e.depthRangeFor3D);if(1!==a||r.paint.get("fill-extrusion-pattern").constantOr(1))by(e,t,r,i,n,he.disabled,De.disabled),by(e,t,r,i,n,e.stencilModeFor3D(),e.colorModeForRenderPass());else{let a=e.colorModeForRenderPass();by(e,t,r,i,n,he.disabled,a)}}}function by(e,t,r,i,a,n,s){let o=e.context,l=o.gl,u="fill-extrusion-pattern",c=r.paint.get(u),h=c.constantOr(1),p=r.getCrossfadeParameters(),d=r.paint.get("fill-extrusion-opacity"),f=c.constantOr(null);for(let c of i){let i=t.getTile(c),m=i.getBucket(r);if(!m)continue;let y=e.style.map.terrain&&e.style.map.terrain.getTerrainData(c),g=m.programConfigurations.get(r.id),_=e.useProgram(h?"fillExtrusionPattern":"fillExtrusion",g);h&&(e.context.activeTexture.set(l.TEXTURE0),i.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),g.updatePaintBuffers(p)),Uu(g,u,f,i,r);let x=e.translatePosMatrix(c.posMatrix,i,r.paint.get("fill-extrusion-translate"),r.paint.get("fill-extrusion-translate-anchor")),v=r.paint.get("fill-extrusion-vertical-gradient"),b=h?q0(x,e,v,d,c,p,i):bd(x,e,v,d);_.draw(o,o.gl.TRIANGLES,a,n,s,le.backCCW,b,y,r.id,m.layoutVertexBuffer,m.indexBuffer,m.segments,r.paint,e.transform.zoom,g,e.style.map.terrain&&m.centroidVertexBuffer)}}function G1(e,t,r,i){if("offscreen"!==e.renderPass&&"translucent"!==e.renderPass)return;let a=e.context,n=e.depthModeForSublayer(0,Q.ReadOnly),s=e.colorModeForRenderPass(),[o,l]="translucent"===e.renderPass?e.stencilConfigForOverlap(i):[{},i];for(let i of l){let a=t.getTile(i);typeof a.needsHillshadePrepare<"u"&&a.needsHillshadePrepare&&"offscreen"===e.renderPass?dE(e,a,r,n,he.disabled,s):"translucent"===e.renderPass&&mE(e,i,a,r,n,o[i.overscaledZ],s)}a.viewport.set([0,0,e.width,e.height])}function mE(e,t,r,i,a,n,s){let o=e.context,l=o.gl,u=r.fbo;if(!u)return;let c=e.useProgram("hillshade"),h=e.style.map.terrain&&e.style.map.terrain.getTerrainData(t);o.activeTexture.set(l.TEXTURE0),l.bindTexture(l.TEXTURE_2D,u.colorAttachment.get());let p=h?t:null;c.draw(o,l.TRIANGLES,a,n,s,le.disabled,c1(e,r,i,p),h,i.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments)}function dE(e,t,r,i,a,n){let s=e.context,o=s.gl,l=t.dem;if(l&&l.data){let u=l.dim,c=l.stride,h=l.getPixels();if(s.activeTexture.set(o.TEXTURE1),s.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||e.getTileTexture(c),t.demTexture){let e=t.demTexture;e.update(h,{premultiply:!1}),e.bind(o.NEAREST,o.CLAMP_TO_EDGE)}else t.demTexture=new be(s,h,o.RGBA,{premultiply:!1}),t.demTexture.bind(o.NEAREST,o.CLAMP_TO_EDGE);s.activeTexture.set(o.TEXTURE0);let p=t.fbo;if(!p){let e=new be(s,{width:u,height:u,data:null},o.RGBA);e.bind(o.LINEAR,o.CLAMP_TO_EDGE),p=t.fbo=s.createFramebuffer(u,u,!0,!1),p.colorAttachment.set(e.texture)}s.bindFramebuffer.set(p.framebuffer),s.viewport.set([0,0,u,u]),e.useProgram("hillshadePrepare").draw(s,o.TRIANGLES,i,a,n,le.disabled,p1(t.tileID,l),null,r.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments),t.needsHillshadePrepare=!1}}function q1(e,t,r,i){if("translucent"!==e.renderPass||0===r.paint.get("raster-opacity")||!i.length)return;let a=e.context,n=a.gl,s=t.getSource(),o=e.useProgram("raster"),l=e.colorModeForRenderPass(),[u,c]=s instanceof It?[{},i]:e.stencilConfigForOverlap(i),h=c[c.length-1].overscaledZ,p=!e.options.moving;for(let i of c){let c=e.depthModeForSublayer(i.overscaledZ-h,1===r.paint.get("raster-opacity")?Q.ReadWrite:Q.ReadOnly,n.LESS),d=t.getTile(i);d.registerFadeDuration(r.paint.get("raster-fade-duration"));let f,m,y=t.findLoadedParent(i,0),g=yE(d,y,t,r,e.transform,e.style.map.terrain),_="nearest"===r.paint.get("raster-resampling")?n.NEAREST:n.LINEAR;a.activeTexture.set(n.TEXTURE0),d.texture.bind(_,n.CLAMP_TO_EDGE,n.LINEAR_MIPMAP_NEAREST),a.activeTexture.set(n.TEXTURE1),y?(y.texture.bind(_,n.CLAMP_TO_EDGE,n.LINEAR_MIPMAP_NEAREST),f=Math.pow(2,y.tileID.overscaledZ-d.tileID.overscaledZ),m=[d.tileID.canonical.x*f%1,d.tileID.canonical.y*f%1]):d.texture.bind(_,n.CLAMP_TO_EDGE,n.LINEAR_MIPMAP_NEAREST);let x=e.style.map.terrain&&e.style.map.terrain.getTerrainData(i),v=x?i:null,b=v?v.posMatrix:e.transform.calculatePosMatrix(i.toUnwrapped(),p),w=w1(b,m||[0,0],f||1,g,r);s instanceof It?o.draw(a,n.TRIANGLES,c,he.disabled,l,le.disabled,w,x,r.id,s.boundsBuffer,e.quadTriangleIndexBuffer,s.boundsSegments):o.draw(a,n.TRIANGLES,c,u[i.overscaledZ],l,le.disabled,w,x,r.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments)}}function yE(e,t,r,i,a,n){let s=i.paint.get("raster-fade-duration");if(!n&&s>0){let i=ne.now(),n=(i-e.timeAdded)/s,o=t?(i-t.timeAdded)/s:-1,l=r.getSource(),u=a.coveringZoomLevel({tileSize:l.tileSize,roundZoom:l.roundZoom}),c=!t||Math.abs(t.tileID.overscaledZ-u)>Math.abs(e.tileID.overscaledZ-u),h=c&&e.refreshedUponExpiration?1:Te(c?n:1-o,0,1);return e.refreshedUponExpiration&&n>=1&&(e.refreshedUponExpiration=!1),t?{opacity:1,mix:1-h}:{opacity:h,mix:0}}return{opacity:1,mix:0}}function j1(e,t,r,i){let a=r.paint.get("background-color"),n=r.paint.get("background-opacity");if(0===n)return;let s=e.context,o=s.gl,l=e.transform,u=l.tileSize,c=r.paint.get("background-pattern");if(e.isPatternMissing(c))return;let h=!c&&1===a.a&&1===n&&e.opaquePassEnabledForLayer()?"opaque":"translucent";if(e.renderPass!==h)return;let p=he.disabled,d=e.depthModeForSublayer(0,"opaque"===h?Q.ReadWrite:Q.ReadOnly),f=e.colorModeForRenderPass(),m=e.useProgram(c?"backgroundPattern":"background"),y=i||l.coveringTiles({tileSize:u,terrain:e.style.map.terrain});c&&(s.activeTexture.set(o.TEXTURE0),e.imageManager.bind(e.context));let g=r.getCrossfadeParameters();for(let t of y){let l=i?t.posMatrix:e.transform.calculatePosMatrix(t.toUnwrapped()),h=c?E1(l,n,e,c,{tileID:t,tileSize:u},g):C1(l,n,a),y=e.style.map.terrain&&e.style.map.terrain.getTerrainData(t);m.draw(s,o.TRIANGLES,d,p,f,le.disabled,h,y,r.id,e.tileExtentBuffer,e.quadTriangleIndexBuffer,e.tileExtentSegments)}}l(F1,"drawSymbols"),l(sE,"calculateVariableRenderShift"),l(lE,"updateVariableAnchors"),l(uE,"updateVariableAnchorsForBucket"),l(cE,"getSymbolProgramName"),l(D1,"drawLayerSymbols"),l(z1,"drawSymbolElements"),d(),l(B1,"drawCircles"),d(),l(R1,"drawHeatmap"),l(pE,"bindFramebuffer"),l(hE,"bindTextureToFramebuffer"),l(fE,"renderTextureToMap"),d(),l(O1,"drawLine"),d(),d(),l(Uu,"updatePatternPositionsInProgram"),l(U1,"drawFill"),l(V1,"drawFillTiles"),d(),l(N1,"drawFillExtrusion"),l(by,"drawExtrusionTiles"),d(),l(G1,"drawHillshade"),l(mE,"renderHillshade"),l(dE,"prepareHillshade"),d(),l(q1,"drawRaster"),l(yE,"getFadeValues"),d(),l(j1,"drawBackground"),d();var gE=new X(1,0,0,1),xE=new X(0,1,0,1),bE=new X(0,0,1,1),_E=new X(1,0,1,1),vE=new X(0,1,1,1);function H1(e){let t=e.transform.padding;Z1(e,e.transform.height-(t.top||0),3,gE),Z1(e,t.bottom||0,3,xE),$1(e,t.left||0,3,bE),$1(e,e.transform.width-(t.right||0),3,_E);let r=e.transform.centerPoint;wE(e,r.x,e.transform.height-r.y,vE)}function wE(e,t,r,i){Nu(e,t-1,r-10,2,20,i),Nu(e,t-10,r-1,20,2,i)}function Z1(e,t,r,i){Nu(e,0,t+r/2,e.transform.width,r,i)}function $1(e,t,r,i){Nu(e,t-r/2,0,r,e.transform.height,i)}function Nu(e,t,r,i,a,n){let s=e.context,o=s.gl;o.enable(o.SCISSOR_TEST),o.scissor(t*e.pixelRatio,r*e.pixelRatio,i*e.pixelRatio,a*e.pixelRatio),s.clear({color:n}),o.disable(o.SCISSOR_TEST)}function W1(e,t,r){for(let i=0;i<r.length;i++)SE(e,t,r[i])}function SE(e,t,r){let i=e.context,a=i.gl,n=r.posMatrix,s=e.useProgram("debug"),o=Q.disabled,l=he.disabled,u=e.colorModeForRenderPass(),c="$debug",h=e.style.map.terrain&&e.style.map.terrain.getTerrainData(r);i.activeTexture.set(a.TEXTURE0);let p=t.getTileByID(r.key).latestRawTileData,d=p&&p.byteLength||0,f=Math.floor(d/1024),m=t.getTile(r).tileSize,y=512/Math.min(m,512)*(r.overscaledZ/e.transform.zoom)*.5,g=r.canonical.toString();r.overscaledZ!==r.canonical.z&&(g+=" => ".concat(r.overscaledZ)),PE(e,"".concat(g," ").concat(f,"kB")),s.draw(i,a.TRIANGLES,o,l,De.alphaBlended,le.disabled,wd(n,X.transparent,y),null,c,e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments),s.draw(i,a.LINE_STRIP,o,l,u,le.disabled,wd(n,X.red),h,c,e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments)}function PE(e,t){e.initDebugOverlayCanvas();let r=e.debugOverlayCanvas,i=e.context.gl,a=e.debugOverlayCanvas.getContext("2d");a.clearRect(0,0,r.width,r.height),a.shadowColor="white",a.shadowBlur=2,a.lineWidth=1.5,a.strokeStyle="white",a.textBaseline="top",a.font="bold 36px Open Sans, sans-serif",a.fillText(t,5,5),a.strokeText(t,5,5),e.debugOverlayTexture.update(r),e.debugOverlayTexture.bind(i.LINEAR,i.CLAMP_TO_EDGE)}function X1(e,t){let r=null,i=Object.values(e._layers).flatMap((r=>r.source&&!r.isHidden(t)?[e.sourceCaches[r.source]]:[])),a=i.filter((e=>"vector"===e.getSource().type)),n=i.filter((e=>"vector"!==e.getSource().type)),s=l((e=>{(!r||r.getSource().maxzoom<e.getSource().maxzoom)&&(r=e)}),"considerSource");return a.forEach((e=>s(e))),r||n.forEach((e=>s(e))),r}function K1(e,t,r){let i=e.context,a=r.implementation;if("offscreen"===e.renderPass){let t=a.prerender;t&&(e.setCustomLayerDefaults(),i.setColorMode(e.colorModeForRenderPass()),t.call(a,i.gl,e.transform.customLayerMatrix()),i.setDirty(),e.setBaseState())}else if("translucent"===e.renderPass){e.setCustomLayerDefaults(),i.setColorMode(e.colorModeForRenderPass()),i.setStencilMode(he.disabled);let t="3d"===a.renderingMode?new Q(e.context.gl.LEQUAL,Q.ReadWrite,e.depthRangeFor3D):e.depthModeForSublayer(0,Q.ReadOnly);i.setDepthMode(t),a.render(i.gl,e.transform.customLayerMatrix()),i.setDirty(),e.setBaseState(),i.bindFramebuffer.set(null)}}function Y1(e,t){let r=e.context,i=r.gl,a=De.unblended,n=new Q(i.LEQUAL,Q.ReadWrite,[0,1]),s=t.getTerrainMesh(),o=t.sourceCache.getRenderableTiles(),l=e.useProgram("terrainDepth");r.bindFramebuffer.set(t.getFramebuffer("depth").framebuffer),r.viewport.set([0,0,e.width/devicePixelRatio,e.height/devicePixelRatio]),r.clear({color:X.transparent,depth:1});for(let u of o){let o=t.getTerrainData(u.tileID),c=e.transform.calculatePosMatrix(u.tileID.toUnwrapped()),h=O0(c,t.getMeshFrameDelta(e.transform.zoom));l.draw(r,i.TRIANGLES,n,he.disabled,a,le.backCCW,h,o,"terrain",s.vertexBuffer,s.indexBuffer,s.segments)}r.bindFramebuffer.set(null),r.viewport.set([0,0,e.width,e.height])}function J1(e,t){let r=e.context,i=r.gl,a=De.unblended,n=new Q(i.LEQUAL,Q.ReadWrite,[0,1]),s=t.getTerrainMesh(),o=t.getCoordsTexture(),l=t.sourceCache.getRenderableTiles(),u=e.useProgram("terrainCoords");r.bindFramebuffer.set(t.getFramebuffer("coords").framebuffer),r.viewport.set([0,0,e.width/devicePixelRatio,e.height/devicePixelRatio]),r.clear({color:X.transparent,depth:1}),t.coordsIndex=[];for(let c of l){let l=t.getTerrainData(c.tileID);r.activeTexture.set(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,o.texture);let h=e.transform.calculatePosMatrix(c.tileID.toUnwrapped()),p=V0(h,255-t.coordsIndex.length,t.getMeshFrameDelta(e.transform.zoom));u.draw(r,i.TRIANGLES,n,he.disabled,a,le.backCCW,p,l,"terrain",s.vertexBuffer,s.indexBuffer,s.segments),t.coordsIndex.push(c.tileID.key)}r.bindFramebuffer.set(null),r.viewport.set([0,0,e.width,e.height])}function _y(e,t,r){let i=e.context,a=i.gl,n=e.colorModeForRenderPass(),s=new Q(a.LEQUAL,Q.ReadWrite,e.depthRangeFor3D),o=e.useProgram("terrain"),l=t.getTerrainMesh();i.bindFramebuffer.set(null),i.viewport.set([0,0,e.width,e.height]);for(let u of r){let r=e.renderToTexture.getTexture(u),c=t.getTerrainData(u.tileID);i.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,r.texture);let h=e.transform.calculatePosMatrix(u.tileID.toUnwrapped()),p=R0(h,t.getMeshFrameDelta(e.transform.zoom));o.draw(i,a.TRIANGLES,s,he.disabled,n,le.backCCW,p,c,"terrain",l.vertexBuffer,l.indexBuffer,l.segments)}}l(H1,"drawDebugPadding"),l(wE,"drawCrosshair"),l(Z1,"drawHorizontalLine"),l($1,"drawVerticalLine"),l(Nu,"drawDebugSSRect"),l(W1,"drawDebug"),l(SE,"drawDebugTile"),l(PE,"drawTextToOverlay"),l(X1,"selectDebugSource"),d(),l(K1,"drawCustom"),d(),l(Y1,"drawDepth"),l(J1,"drawCoords"),l(_y,"drawTerrain");var vy=class{constructor(e,t){this.context=new Ou(e),this.transform=t,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:G.create(),renderTime:0},this.setup(),this.numSublayers=sr.maxUnderzooming+sr.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new vn}resize(e,t,r){if(0!==e&&0!==t&&(this.width=Math.floor(e*r),this.height=Math.floor(t*r),this.pixelRatio=r,0!==this.width&&0!==this.height&&(this.context.viewport.set([0,0,this.width,this.height]),this.setupRemoteFrameRendering(this.width,this.height),this.style)))for(let e of this.style._order)this.style._layers[e].resize()}setup(){let e=this.context,t=new Tr;t.emplaceBack(0,0),t.emplaceBack(8192,0),t.emplaceBack(0,8192),t.emplaceBack(8192,8192),this.tileExtentBuffer=e.createVertexBuffer(t,Xl.members),this.tileExtentSegments=me.simpleSegment(0,0,4,2);let r=new Tr;r.emplaceBack(0,0),r.emplaceBack(8192,0),r.emplaceBack(0,8192),r.emplaceBack(8192,8192),this.debugBuffer=e.createVertexBuffer(r,Xl.members),this.debugSegments=me.simpleSegment(0,0,4,5);let i=new Wi;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,Fr.members),this.rasterBoundsSegments=me.simpleSegment(0,0,4,2);let a=new Tr;a.emplaceBack(0,0),a.emplaceBack(1,0),a.emplaceBack(0,1),a.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(a,Xl.members),this.viewportSegments=me.simpleSegment(0,0,4,2);let n=new Pa;n.emplaceBack(0),n.emplaceBack(1),n.emplaceBack(3),n.emplaceBack(2),n.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(n);let s=new at;s.emplaceBack(0,1,2),s.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(s);let o=this.context.gl;this.stencilClearMode=new he({func:o.ALWAYS,mask:0},0,255,o.ZERO,o.ZERO,o.ZERO),this.setupRemoteFrameRendering(this.width,this.height)}setupRemoteFrameRendering(e,t){if(null==e||null==t||0==e||0==t)return;let r=this.context.gl;r.bindFramebuffer(r.FRAMEBUFFER,null),this.webGLRenderTargetFrameBuffer&&(r.deleteFramebuffer(this.webGLRenderTargetFrameBuffer),r.deleteRenderbuffer(this.webGLRenderTargetRenderBuffer),r.deleteTexture(this.webGLRenderTargetTexture)),this.webGLRenderTargetFrameBuffer=r.createFramebuffer(),this.webGLRenderTargetRenderBuffer=r.createRenderbuffer(),r.bindFramebuffer(r.FRAMEBUFFER,this.webGLRenderTargetFrameBuffer),this.webGLRenderTargetTexture=r.createTexture(),r.bindTexture(r.TEXTURE_2D,this.webGLRenderTargetTexture),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,e,t,0,r.RGBA,r.UNSIGNED_BYTE,null),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,this.webGLRenderTargetTexture,0),r.bindRenderbuffer(r.RENDERBUFFER,this.webGLRenderTargetRenderBuffer),r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,e,t),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.RENDERBUFFER,this.webGLRenderTargetRenderBuffer),r.checkFramebufferStatus(r.FRAMEBUFFER)!==r.FRAMEBUFFER_COMPLETE&&console.error("Framebuffer is not complete")}clearStencil(){let e=this.context,t=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let r=G.create();G.ortho(r,0,this.width,this.height,0,0,1),G.scale(r,r,[t.drawingBufferWidth,t.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(e,t.TRIANGLES,Q.disabled,this.stencilClearMode,De.disabled,le.disabled,Sd(r),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(e,t){if(this.currentStencilSource===e.source||!e.isTileClipped()||!t||!t.length)return;this.currentStencilSource=e.source;let r=this.context,i=r.gl;this.nextStencilID+t.length>256&&this.clearStencil(),r.setColorMode(De.disabled),r.setDepthMode(Q.disabled);let a=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(let e of t){let t=this._tileClippingMaskIDs[e.key]=this.nextStencilID++,n=this.style.map.terrain&&this.style.map.terrain.getTerrainData(e);a.draw(r,i.TRIANGLES,Q.disabled,new he({func:i.ALWAYS,mask:0},t,255,i.KEEP,i.KEEP,i.REPLACE),De.disabled,le.disabled,Sd(e.posMatrix),n,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let e=this.nextStencilID++,t=this.context.gl;return new he({func:t.NOTEQUAL,mask:255},e,255,t.KEEP,t.KEEP,t.REPLACE)}stencilModeForClipping(e){let t=this.context.gl;return new he({func:t.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,t.KEEP,t.KEEP,t.REPLACE)}stencilConfigForOverlap(e){let t=this.context.gl,r=e.sort(((e,t)=>t.overscaledZ-e.overscaledZ)),i=r[r.length-1].overscaledZ,a=r[0].overscaledZ-i+1;if(a>1){this.currentStencilSource=void 0,this.nextStencilID+a>256&&this.clearStencil();let e={};for(let r=0;r<a;r++)e[r+i]=new he({func:t.GEQUAL,mask:255},r+this.nextStencilID,255,t.KEEP,t.KEEP,t.REPLACE);return this.nextStencilID+=a,[e,r]}return[{[i]:he.disabled},r]}colorModeForRenderPass(){let e=this.context.gl;return this._showOverdrawInspector?new De([e.CONSTANT_COLOR,e.ONE],new X(.125,.125,.125,0),[!0,!0,!0,!0]):"opaque"===this.renderPass?De.unblended:De.alphaBlended}depthModeForSublayer(e,t,r){if(!this.opaquePassEnabledForLayer())return Q.disabled;let i=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new Q(r||this.context.gl.LEQUAL,t,[i,i])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(e,t){this.style=e,this.options=t,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(ne.now()),this.imageManager.beginFrame();let r=this.style._order,i=this.style.sourceCaches,a={},n={},s={};for(let e in i){let t=i[e];t.used&&t.prepare(this.context),a[e]=t.getVisibleCoordinates(),n[e]=a[e].slice().reverse(),s[e]=t.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let e=0;e<r.length;e++){let t=r[e];if(this.style._layers[t].is3D()){this.opaquePassCutoff=e;break}}if(this.renderToTexture){this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0;let e=this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime);(this.terrainFacilitator.dirty||!G.equals(this.terrainFacilitator.matrix,this.transform.projMatrix)||e.length)&&(G.copy(this.terrainFacilitator.matrix,this.transform.projMatrix),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,Y1(this,this.style.map.terrain),J1(this,this.style.map.terrain))}this.renderPass="offscreen";for(let e of r){let t=this.style._layers[e];if(!t.hasOffscreenPass()||t.isHidden(this.transform.zoom))continue;let r=n[t.source];"custom"!==t.type&&!r.length||this.renderLayer(this,i[t.source],t,r)}if(this.context.bindFramebuffer.set(this.webGLRenderTargetFrameBuffer),this.context.clear({color:t.showOverdrawInspector?X.black:X.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=t.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=r.length-1;this.currentLayer>=0;this.currentLayer--){let e=this.style._layers[r[this.currentLayer]],t=i[e.source],n=a[e.source];this._renderTileClippingMasks(e,n),this.renderLayer(this,t,e,n)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<r.length;this.currentLayer++){let e=this.style._layers[r[this.currentLayer]],t=i[e.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(e))continue;let o=("symbol"===e.type?s:n)[e.source];this._renderTileClippingMasks(e,a[e.source]),this.renderLayer(this,t,e,o)}if(this.options.showTileBoundaries){let e=X1(this.style,this.transform.zoom);e&&W1(this,e,e.getVisibleCoordinates())}this.options.showPadding&&H1(this),this.context.setDefault(),this.setCustomLayerDefaults(),this.context.gl.bindFramebuffer(this.context.gl.FRAMEBUFFER,null)}renderLayer(e,t,r,i){if(!r.isHidden(this.transform.zoom)&&("background"===r.type||"custom"===r.type||(i||[]).length))switch(this.id=r.id,r.type){case"symbol":F1(e,t,r,i,this.style.placement.variableOffsets);break;case"circle":B1(e,t,r,i);break;case"heatmap":R1(e,t,r,i);break;case"line":O1(e,t,r,i);break;case"fill":U1(e,t,r,i);break;case"fill-extrusion":N1(e,t,r,i);break;case"hillshade":G1(e,t,r,i);break;case"raster":q1(e,t,r,i);break;case"background":j1(e,t,r,i);break;case"custom":K1(e,t,r)}}translatePosMatrix(e,t,r,i,a){if(!r[0]&&!r[1])return e;let n=a?"map"===i?this.transform.angle:0:"viewport"===i?-this.transform.angle:0;if(n){let e=Math.sin(n),t=Math.cos(n);r=[r[0]*t-r[1]*e,r[0]*e+r[1]*t]}let s=[a?r[0]:Ye(t,r[0],this.transform.zoom),a?r[1]:Ye(t,r[1],this.transform.zoom),0],o=new Float32Array(16);return G.translate(o,e,s),o}saveTileTexture(e){let t=this._tileTextures[e.size[0]];t?t.push(e):this._tileTextures[e.size[0]]=[e]}getTileTexture(e){let t=this._tileTextures[e];return t&&t.length>0?t.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;let t=this.imageManager.getPattern(e.from.toString()),r=this.imageManager.getPattern(e.to.toString());return!t||!r}useProgram(e,t){this.cache=this.cache||{};let r=e+(t?t.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[r]||(this.cache[r]=new Jl(this.context,_i[e],t,k1[e],this._showOverdrawInspector,this.style.map.terrain)),this.cache[r]}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(null==this.debugOverlayCanvas){this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512;let e=this.context.gl;this.debugOverlayTexture=new be(this.context,this.debugOverlayCanvas,e.RGBA)}}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){let{drawingBufferWidth:e,drawingBufferHeight:t}=this.context.gl;return this.width!==e||this.height!==t}};l(vy,"Painter");var Gu=vy;d();var qe=se(Pe(),1);d();var ju=class e{constructor(e,t){this.points=e,this.planes=t}static fromInvProjectionMatrix(t,r,i){let a=Math.pow(2,i),n=[[-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]].map((e=>{let i=1/(e=Ke.transformMat4([],e,t))[3]/r*a;return Ke.mul(e,e,[i,i,1/e[3],i])})),s=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map((e=>{let t=xt.sub([],n[e[0]],n[e[1]]),r=xt.sub([],n[e[2]],n[e[1]]),i=xt.normalize([],xt.cross([],t,r)),a=-xt.dot(i,n[e[1]]);return i.concat(a)}));return new e(n,s)}};l(ju,"Frustum");var qu=ju,Zu=class e{constructor(e,t){this.min=e,this.max=t,this.center=xt.scale([],xt.add([],this.min,this.max),.5)}quadrant(t){let r=[t%2==0,t<2],i=xt.clone(this.min),a=xt.clone(this.max);for(let e=0;e<r.length;e++)i[e]=r[e]?this.min[e]:this.center[e],a[e]=r[e]?this.center[e]:this.max[e];return a[2]=this.max[2],new e(i,a)}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]}intersects(e){let t=[[this.min[0],this.min[1],this.min[2],1],[this.max[0],this.min[1],this.min[2],1],[this.max[0],this.max[1],this.min[2],1],[this.min[0],this.max[1],this.min[2],1],[this.min[0],this.min[1],this.max[2],1],[this.max[0],this.min[1],this.max[2],1],[this.max[0],this.max[1],this.max[2],1],[this.min[0],this.max[1],this.max[2],1]],r=!0;for(let i=0;i<e.planes.length;i++){let a=e.planes[i],n=0;for(let e=0;e<t.length;e++)Ke.dot(a,t[e])>=0&&n++;if(0===n)return 0;n!==t.length&&(r=!1)}if(r)return 2;for(let t=0;t<3;t++){let r=Number.MAX_VALUE,i=-Number.MAX_VALUE;for(let a=0;a<e.points.length;a++){let n=e.points[a][t]-this.min[t];r=Math.min(r,n),i=Math.max(i,n)}if(i<0||r>this.max[t]-this.min[t])return 0}return 1}};l(Zu,"Aabb");var uo=Zu;d();var Q1=se(Pe(),1),Hu=class e{constructor(e=0,t=0,r=0,i=0){if(isNaN(e)||e<0||isNaN(t)||t<0||isNaN(r)||r<0||isNaN(i)||i<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=e,this.bottom=t,this.left=r,this.right=i}interpolate(e,t,r){return null!=t.top&&null!=e.top&&(this.top=ke.number(e.top,t.top,r)),null!=t.bottom&&null!=e.bottom&&(this.bottom=ke.number(e.bottom,t.bottom,r)),null!=t.left&&null!=e.left&&(this.left=ke.number(e.left,t.left,r)),null!=t.right&&null!=e.right&&(this.right=ke.number(e.right,t.right,r)),this}getCenter(e,t){let r=Te((this.left+e-this.right)/2,0,e),i=Te((this.top+t-this.bottom)/2,0,t);return new Q1.default(r,i)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new e(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}};l(Hu,"EdgeInsets");var $u=Hu,Xu=class e{constructor(e,t,r,i,a){this.tileSize=512,this.maxValidLatitude=85.051129,this.freezeElevation=!1,this._renderWorldCopies=void 0===a||!!a,this._minZoom=e||0,this._maxZoom=t||22,this._minPitch=null==r?0:r,this._maxPitch=null==i?60:i,this.setMaxBounds(),this.width=0,this.height=0,this._center=new re(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.698132,this._pitch=0,this._unmodified=!0,this._edgeInsets=new $u,this._posMatrixCache={},this._alignedPosMatrixCache={}}clone(){let t=new e(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.apply(this),t}apply(e){this.tileSize=e.tileSize,this.latRange=e.latRange,this.width=e.width,this.height=e.height,this._center=e._center,this._elevation=e._elevation,this.zoom=e.zoom,this.angle=e.angle,this._fov=e._fov,this._pitch=e._pitch,this._unmodified=e._unmodified,this._edgeInsets=e._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(e){this._minZoom!==e&&(this._minZoom=e,this.zoom=Math.max(this.zoom,e))}get maxZoom(){return this._maxZoom}set maxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.zoom=Math.min(this.zoom,e))}get minPitch(){return this._minPitch}set minPitch(e){this._minPitch!==e&&(this._minPitch=e,this.pitch=Math.max(this.pitch,e))}get maxPitch(){return this._maxPitch}set maxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.pitch=Math.min(this.pitch,e))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(e){void 0===e?e=!0:null===e&&(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 qe.default(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(e){let t=-Jt(e,-180,180)*Math.PI/180;this.angle!==t&&(this._unmodified=!1,this.angle=t,this._calcMatrices(),this.rotationMatrix=Ma.create(),Ma.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(e){let t=Te(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==t&&(this._unmodified=!1,this._pitch=t,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(e){e=Math.max(.01,Math.min(60,e)),this._fov!==e&&(this._unmodified=!1,this._fov=e/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(e){let t=Math.min(Math.max(e,this.minZoom),this.maxZoom);this._zoom!==t&&(this._unmodified=!1,this._zoom=t,this.tileZoom=Math.max(0,Math.floor(t)),this.scale=this.zoomScale(t),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(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}set elevation(e){e!==this._elevation&&(this._elevation=e,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(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)}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,t,r){this._unmodified=!1,this._edgeInsets.interpolate(e,t,r),this._constrain(),this._calcMatrices()}coveringZoomLevel(e){let t=(e.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/e.tileSize));return Math.max(0,t)}getVisibleUnwrappedCoordinates(e){let t=[new hn(0,e)];if(this._renderWorldCopies){let r=this.pointCoordinate(new qe.default(0,0)),i=this.pointCoordinate(new qe.default(this.width,0)),a=this.pointCoordinate(new qe.default(this.width,this.height)),n=this.pointCoordinate(new qe.default(0,this.height)),s=Math.floor(Math.min(r.x,i.x,a.x,n.x)),o=Math.floor(Math.max(r.x,i.x,a.x,n.x)),l=1;for(let r=s-l;r<=o+l;r++)0!==r&&t.push(new hn(r,e))}return t}coveringTiles(e){var t,r;let i=this.coveringZoomLevel(e),a=i;if(void 0!==e.minzoom&&i<e.minzoom)return[];void 0!==e.maxzoom&&i>e.maxzoom&&(i=e.maxzoom);let n=this.pointCoordinate(this.getCameraPoint()),s=ze.fromLngLat(this.center),o=Math.pow(2,i),u=[o*n.x,o*n.y,0],c=[o*s.x,o*s.y,0],h=qu.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,i),p=e.minzoom||0;!e.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(p=i);let d=e.terrain?2/Math.min(this.tileSize,e.tileSize)*this.tileSize:3,f=l((e=>({aabb:new uo([e*o,0,0],[(e+1)*o,o,0]),zoom:0,x:0,y:0,wrap:e,fullyVisible:!1})),"newRootTile"),m=[],y=[],g=i,_=e.reparseOverscaled?a:i;if(this._renderWorldCopies)for(let e=1;e<=3;e++)m.push(f(-e)),m.push(f(e));for(m.push(f(0));m.length>0;){let i=m.pop(),a=i.x,n=i.y,s=i.fullyVisible;if(!s){let e=i.aabb.intersects(h);if(0===e)continue;s=2===e}let o=e.terrain?u:c,l=i.aabb.distanceX(o),f=i.aabb.distanceY(o),x=Math.max(Math.abs(l),Math.abs(f)),v=d+(1<<g-i.zoom)-2;if(i.zoom===g||x>v&&i.zoom>=p){let e=g-i.zoom,t=u[0]-.5-(a<<e),r=u[1]-.5-(n<<e);y.push({tileID:new nt(i.zoom===g?_:i.zoom,i.wrap,i.zoom,a,n),distanceSq:Yi.sqrLen([c[0]-.5-a,c[1]-.5-n]),tileDistanceToCamera:Math.sqrt(t*t+r*r)})}else for(let o=0;o<4;o++){let l=(a<<1)+o%2,u=(n<<1)+(o>>1),c=i.zoom+1,h=i.aabb.quadrant(o);if(e.terrain){let a=new nt(c,i.wrap,c,l,u),n=e.terrain.getMinMaxElevation(a),s=null!=(t=n.minElevation)?t:this.elevation,o=null!=(r=n.maxElevation)?r:this.elevation;h=new uo([h.min[0],h.min[1],s],[h.max[0],h.max[1],o])}m.push({aabb:h,zoom:c,x:l,y:u,wrap:i.wrap,fullyVisible:s})}}return y.sort(((e,t)=>e.distanceSq-t.distanceSq)).map((e=>e.tileID))}resize(e,t){this.width=e,this.height=t,this.pixelsToGLUnits=[2/e,-2/t],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(e){return Math.pow(2,e)}scaleZoom(e){return Math.log(e)/Math.LN2}project(e){let t=Te(e.lat,-this.maxValidLatitude,this.maxValidLatitude);return new qe.default(Lr(e.lng)*this.worldSize,Dr(t)*this.worldSize)}calculateZMercatorFromAltitude(e){let{lat:t}=this.center,r=yi,i=this.tileSize,a=t*Math.PI/180,n=(e+r)/(2*Math.cos(a)*Math.PI*r/(i*Math.pow(2,20))),s=Math.log2(i/n);return Math.abs(s)}unproject(e){return new ze(e.x/this.worldSize,e.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}updateElevation(e){this.freezeElevation||(this.elevation=this.getElevation())}getElevation(e,t){let r=ze.fromLngLat(e.wrap()),i=8192*(1<<this.tileZoom),a=r.x*i,n=r.y*i,s=Math.floor(a/8192),o=Math.floor(n/8192),l=new nt(this.tileZoom,0,this.tileZoom,s,o);return t.getElevation(l,a%8192,n%8192,8192)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(e){let t=this.pointLocation(this.centerPoint,e),r=this.getElevation(t,e);if(!(this.elevation-r))return;let i=this.getCameraPosition(),a=ze.fromLngLat(i.lngLat,i.altitude),n=ze.fromLngLat(t,r),s=a.x-n.x,o=a.y-n.y,l=a.z-n.z,u=Math.sqrt(s*s+o*o+l*l),c=this.scaleZoom(this.cameraToCenterDistance/u/this.tileSize);this._elevation=r,this._center=t,this.zoom=c}setLocationAtPoint(e,t){let r=this.pointCoordinate(t),i=this.pointCoordinate(this.centerPoint),a=this.locationCoordinate(e),n=new ze(a.x-(r.x-i.x),a.y-(r.y-i.y));this.center=this.coordinateLocation(n),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(e,t){return t?this.coordinatePoint(this.locationCoordinate(e),this.getElevation(e,t),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(e))}pointLocation(e,t){return this.coordinateLocation(this.pointCoordinate(e,t))}locationCoordinate(e){return ze.fromLngLat(e)}coordinateLocation(e){return e&&e.toLngLat()}pointCoordinate(e,t){if(t){let r=t.pointCoordinate(e);if(null!=r)return r}let r=[e.x,e.y,0,1],i=[e.x,e.y,1,1];Ke.transformMat4(r,r,this.pixelMatrixInverse),Ke.transformMat4(i,i,this.pixelMatrixInverse);let a=r[3],n=i[3],s=r[0]/a,o=i[0]/n,l=r[1]/a,u=i[1]/n,c=r[2]/a,h=i[2]/n,p=c===h?0:(0-c)/(h-c);return new ze(ke.number(s,o,p)/this.worldSize,ke.number(l,u,p)/this.worldSize)}coordinatePoint(e,t=0,r=this.pixelMatrix){let i=[e.x*this.worldSize,e.y*this.worldSize,t,1];return Ke.transformMat4(i,i,r),new qe.default(i[0]/i[3],i[1]/i[3])}getBounds(){let e=Math.max(0,this.height/2-this.getHorizon());return(new ut).extend(this.pointLocation(new qe.default(0,e))).extend(this.pointLocation(new qe.default(this.width,e))).extend(this.pointLocation(new qe.default(this.width,this.height))).extend(this.pointLocation(new qe.default(0,this.height)))}getMaxBounds(){return this.latRange&&2===this.latRange.length&&this.lngRange&&2===this.lngRange.length?new ut([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(e){e?(this.lngRange=[e.getWest(),e.getEast()],this.latRange=[e.getSouth(),e.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(e,t=!1){let r=e.key,i=t?this._alignedPosMatrixCache:this._posMatrixCache;if(i[r])return i[r];let a=e.canonical,n=this.worldSize/this.zoomScale(a.z),s=a.x+Math.pow(2,a.z)*e.wrap,o=G.identity(new Float64Array(16));return G.translate(o,o,[s*n,a.y*n,0]),G.scale(o,o,[n/8192,n/8192,1]),G.multiply(o,t?this.alignedProjMatrix:this.projMatrix,o),i[r]=new Float32Array(o),i[r]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let e,t,r,i,a=-90,n=90,s=-180,o=180,l=this.size,u=this._unmodified;if(this.latRange){let t=this.latRange;a=Dr(t[1])*this.worldSize,n=Dr(t[0])*this.worldSize,e=n-a<l.y?l.y/(n-a):0}if(this.lngRange){let e=this.lngRange;s=Jt(Lr(e[0])*this.worldSize,0,this.worldSize),o=Jt(Lr(e[1])*this.worldSize,0,this.worldSize),o<s&&(o+=this.worldSize),t=o-s<l.x?l.x/(o-s):0}let c=this.point,h=Math.max(t||0,e||0);if(h)return this.center=this.unproject(new qe.default(t?(o+s)/2:c.x,e?(n+a)/2:c.y)),this.zoom+=this.scaleZoom(h),this._unmodified=u,void(this._constraining=!1);if(this.latRange){let e=c.y,t=l.y/2;e-t<a&&(i=a+t),e+t>n&&(i=n-t)}if(this.lngRange){let e=(s+o)/2,t=Jt(c.x,e-this.worldSize/2,e+this.worldSize/2),i=l.x/2;t-i<s&&(r=s+i),t+i>o&&(r=o-i)}(void 0!==r||void 0!==i)&&(this.center=this.unproject(new qe.default(void 0!==r?r:c.x,void 0!==i?i:c.y)).wrap()),this._unmodified=u,this._constraining=!1}_calcMatrices(){if(!this.height)return;let e=this._fov/2,t=this.centerOffset,r=this.point.x,i=this.point.y;this.cameraToCenterDistance=.5/Math.tan(e)*this.height,this._pixelPerMeter=mm(1,this.center.lat)*this.worldSize;let a=G.identity(new Float64Array(16));G.scale(a,a,[this.width/2,-this.height/2,1]),G.translate(a,a,[1,-1,0]),this.labelPlaneMatrix=a,a=G.identity(new Float64Array(16)),G.scale(a,a,[1,-1,1]),G.translate(a,a,[-1,-1,0]),G.scale(a,a,[2/this.width,2/this.height,1]),this.glCoordMatrix=a,this.cameraToSeaLevelDistance=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch);let n=this._elevation<0?this.cameraToCenterDistance:this.cameraToSeaLevelDistance,s=Math.PI/2+this._pitch,o=this._fov*(.5+t.y/this.height),l=Math.sin(o)*n/Math.sin(Te(Math.PI-s-o,.01,Math.PI-.01)),u=this.getHorizon(),c=2*Math.atan(u/this.cameraToCenterDistance)*(.5+t.y/(2*u)),h=Math.sin(c)*n/Math.sin(Te(Math.PI-s-c,.01,Math.PI-.01)),p=Math.min(l,h),d=1.01*(Math.cos(Math.PI/2-this._pitch)*p+n),f=this.height/50;a=new Float64Array(16),G.perspective(a,this._fov,this.width/this.height,f,d),a[8]=2*-t.x/this.width,a[9]=2*t.y/this.height,G.scale(a,a,[1,-1,1]),G.translate(a,a,[0,0,-this.cameraToCenterDistance]),G.rotateX(a,a,this._pitch),G.rotateZ(a,a,this.angle),G.translate(a,a,[-r,-i,0]),this.mercatorMatrix=G.scale([],a,[this.worldSize,this.worldSize,this.worldSize]),G.scale(a,a,[1,1,this._pixelPerMeter]),this.pixelMatrix=G.multiply(new Float64Array(16),this.labelPlaneMatrix,a),G.translate(a,a,[0,0,-this.elevation]),this.projMatrix=a,this.invProjMatrix=G.invert([],a),this.pixelMatrix3D=G.multiply(new Float64Array(16),this.labelPlaneMatrix,a);let m=this.width%2/2,y=this.height%2/2,g=Math.cos(this.angle),_=Math.sin(this.angle),x=r-Math.round(r)+g*m+_*y,v=i-Math.round(i)+g*y+_*m,b=new Float64Array(a);if(G.translate(b,b,[x>.5?x-1:x,v>.5?v-1:v,0]),this.alignedProjMatrix=b,a=G.invert(new Float64Array(16),this.pixelMatrix),!a)throw new Error("failed to invert matrix");this.pixelMatrixInverse=a,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;let e=this.pointCoordinate(new qe.default(0,0)),t=[e.x*this.worldSize,e.y*this.worldSize,0,1];return Ke.transformMat4(t,t,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){let e=this._pitch,t=Math.tan(e)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new qe.default(0,t))}getCameraQueryGeometry(e){let t=this.getCameraPoint();if(1===e.length)return[e[0],t];{let r=t.x,i=t.y,a=t.x,n=t.y;for(let t of e)r=Math.min(r,t.x),i=Math.min(i,t.y),a=Math.max(a,t.x),n=Math.max(n,t.y);return[new qe.default(r,i),new qe.default(a,i),new qe.default(a,n),new qe.default(r,n),new qe.default(r,i)]}}setCameraPosition(e){let{lng:t,lat:r,altitude:i,pitch:a,bearing:n}=e,s=a*(Math.PI/180),o=.5/Math.tan(this._fov/2)*this.height,l=Math.abs(Math.cos(s)*o)/i*(2*Math.PI*6378137*Math.abs(Math.cos(r*(Math.PI/180)))),u=Math.tan(s)*o,c=new qe.default(this.width/2,this.height/2+u),h=new re(t,r);this.zoom=Math.log(l/this.tileSize)/Math.LN2,this.pitch=a,this.bearing=n,this.setLocationAtPoint(h,c)}getCameraAltitude(){let e=this._pitch,t=Math.cos(e)*this.cameraToCenterDistance,r=Math.tan(e)*this.cameraToCenterDistance,i=this.pointLocation(this.centerPoint.add(new qe.default(0,r))),a=2*Math.PI*6378137;return t/(this.worldSize/(a*Math.abs(Math.cos(i.lat*(Math.PI/180)))))}};l(Xu,"Transform");var Wu=Xu;function ew(e,t){let r=!1,i=null,a=l((()=>{i=null,r&&(e(),i=setTimeout(a,t),r=!1)}),"later");return()=>(r=!0,i||a(),i)}d(),d(),l(ew,"throttle");var wy=class{constructor(e){this._getCurrentHash=l((()=>{let e=window.location.hash.replace("#","");if(this._hashName){let t;return e.split("&").map((e=>e.split("="))).forEach((e=>{e[0]===this._hashName&&(t=e)})),(t&&t[1]||"").split("/")}return e.split("/")}),"_getCurrentHash"),this._onHashChange=l((()=>{let e=this._getCurrentHash();if(e.length>=3&&!e.some((e=>isNaN(e)))){let t=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(e[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+e[2],+e[1]],zoom:+e[0],bearing:t,pitch:+(e[4]||0)}),!0}return!1}),"_onHashChange"),this._updateHashUnthrottled=l((()=>{let e=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,e)}catch{}}),"_updateHashUnthrottled"),this._updateHash=ew(this._updateHashUnthrottled,300),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()),delete this._map,this}getHashString(e){let t=this._map.getCenter(),r=Math.round(100*this._map.getZoom())/100,i=Math.ceil((r*Math.LN2+Math.log(512/360/.5))/Math.LN10),a=Math.pow(10,i),n=Math.round(t.lng*a)/a,s=Math.round(t.lat*a)/a,o=this._map.getBearing(),l=this._map.getPitch(),u="";if(u+=e?"/".concat(n,"/").concat(s,"/").concat(r):"".concat(r,"/").concat(s,"/").concat(n),(o||l)&&(u+="/".concat(Math.round(10*o)/10)),l&&(u+="/".concat(Math.round(l))),this._hashName){let e=this._hashName,t=!1,r=window.location.hash.slice(1).split("&").map((r=>{let i=r.split("=")[0];return i===e?(t=!0,"".concat(i,"=").concat(u)):r})).filter((e=>e));return t||r.push("".concat(e,"=").concat(u)),"#".concat(r.join("&"))}return"#".concat(u)}};l(wy,"Hash");var Ku=wy;d(),d();var tw=se(Pe(),1),ec={linearity:.3,easing:Cc(0,0,.3,1)},TE=R({deceleration:2500,maxSpeed:1400},ec),AE=R({deceleration:20,maxSpeed:1400},ec),IE=R({deceleration:1e3,maxSpeed:360},ec),ME=R({deceleration:1e3,maxSpeed:90},ec),Sy=class{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:ne.now(),settings:e})}_drainInertiaBuffer(){let e=this._inertiaBuffer,t=ne.now();for(;e.length>0&&t-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;let t={zoom:0,bearing:0,pitch:0,pan:new tw.default(0,0),pinchAround:void 0,around:void 0};for(let{settings:e}of this._inertiaBuffer)t.zoom+=e.zoomDelta||0,t.bearing+=e.bearingDelta||0,t.pitch+=e.pitchDelta||0,e.panDelta&&t.pan._add(e.panDelta),e.around&&(t.around=e.around),e.pinchAround&&(t.pinchAround=e.pinchAround);let r=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,i={};if(t.pan.mag()){let a=Ju(t.pan.mag(),r,R({},TE,e||{}));i.offset=t.pan.mult(a.amount/t.pan.mag()),i.center=this._map.transform.center,Yu(i,a)}if(t.zoom){let e=Ju(t.zoom,r,AE);i.zoom=this._map.transform.zoom+e.amount,Yu(i,e)}if(t.bearing){let e=Ju(t.bearing,r,IE);i.bearing=this._map.transform.bearing+Te(e.amount,-179,179),Yu(i,e)}if(t.pitch){let e=Ju(t.pitch,r,ME);i.pitch=this._map.transform.pitch+e.amount,Yu(i,e)}if(i.zoom||i.bearing){let e=void 0===t.pinchAround?t.around:t.pinchAround;i.around=e?this._map.unproject(e):this._map.getCenter()}return this.clear(),R(i,{noMoveStart:!0})}};l(Sy,"HandlerInertia");var Qu=Sy;function Yu(e,t){(!e.duration||e.duration<t.duration)&&(e.duration=t.duration,e.easing=t.easing)}function Ju(e,t,r){let{maxSpeed:i,linearity:a,deceleration:n}=r,s=Te(e*a/(t/1e3),-i,i),o=Math.abs(s)/(n*a);return{easing:r.easing,duration:1e3*o,amount:s*(o/2)}}l(Yu,"extendDuration"),l(Ju,"calculateEasing");var rw=se(Pe(),1),tc=l((e=>e.zoom||e.drag||e.pitch||e.rotate),"isMoving"),Ay=class extends z{};l(Ay,"RenderFrameEvent");var Ty=Ay;function Py(e){return e.panDelta&&e.panDelta.mag()||e.zoomDelta||e.bearingDelta||e.pitchDelta}l(Py,"hasChange");var Iy=class{constructor(e,t){this.handleWindowEvent=l((e=>{this.handleEvent(e,"".concat(e.type,"Window"))}),"handleWindowEvent"),this.handleEvent=l(((e,t)=>{if("blur"===e.type)return void this.stop(!0);this._updatingCamera=!0;let r="renderFrame"===e.type?void 0:e,i={needsRenderFrame:!1},a={},n={},s=e.touches,o=s?this._getMapTouches(s):void 0,l=o?B.touchPos(this._el,o):B.mousePos(this._el,e);for(let{handlerName:s,handler:u,allowed:c}of this._handlers){if(!u.isEnabled())continue;let h;this._blockedByActive(n,c,s)?u.reset():u[t||e.type]&&(h=u[t||e.type](e,l,o),this.mergeHandlerResult(i,a,h,s,r),h&&h.needsRenderFrame&&this._triggerRenderFrame()),(h||u.isActive())&&(n[s]=u)}let u={};for(let e in this._previousActiveHandlers)n[e]||(u[e]=r);this._previousActiveHandlers=n,(Object.keys(u).length||Py(i))&&(this._changes.push([i,a,u]),this._triggerRenderFrame()),(Object.keys(n).length||Py(i))&&this._map._stop(!0),this._updatingCamera=!1;let{cameraAnimation:c}=i;c&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],c(this._map))}),"handleEvent"),this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Qu(e),this._bearingSnap=t.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={};let r=this._el;this._listeners=[[r,"touchstart",{passive:!0}],[r,"touchmove",{passive:!1}],[r,"touchend",void 0],[r,"touchcancel",void 0],[r,"mousedown",void 0],[r,"mousemove",void 0],[r,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[r,"mouseover",void 0],[r,"mouseout",void 0],[r,"dblclick",void 0],[r,"click",void 0],[r,"keydown",{capture:!1}],[r,"keyup",void 0],[r,"wheel",{passive:!1}],[r,"contextmenu",void 0],[window,"blur",void 0]]}destroy(){}_addDefaultHandlers(e){}_add(e,t,r){this._handlers.push({handlerName:e,handler:t,allowed:r}),this._handlersById[e]=t}stop(e){if(!this._updatingCamera){for(let{handler:e}of this._handlers)e.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||!1}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!tc(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,t,r){for(let i in e)if(i!==r&&(!t||t.indexOf(i)<0))return!0;return!1}_getMapTouches(e){let t=[];for(let r of e){let e=r.target;this._el.contains(e)&&t.push(r)}return t}mergeHandlerResult(e,t,r,i,a){if(!r)return;R(e,r);let n={handlerName:i,originalEvent:r.originalEvent||a};void 0!==r.zoomDelta&&(t.zoom=n),void 0!==r.panDelta&&(t.drag=n),void 0!==r.pitchDelta&&(t.pitch=n),void 0!==r.bearingDelta&&(t.rotate=n)}_applyChanges(){let e={},t={},r={};for(let[i,a,n]of this._changes)i.panDelta&&(e.panDelta=(e.panDelta||new rw.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),void 0!==i.around&&(e.around=i.around),void 0!==i.pinchAround&&(e.pinchAround=i.pinchAround),i.noInertia&&(e.noInertia=i.noInertia),R(t,a),R(r,n);this._updateMapTransform(e,t,r),this._changes=[]}_updateMapTransform(e,t,r){let i=this._map,a=i._getTransformForUpdate(),n=i.terrain;if(!(Py(e)||n&&this._terrainMovement))return this._fireEvents(t,r,!0);let{panDelta:s,zoomDelta:o,bearingDelta:l,pitchDelta:u,around:c,pinchAround:h}=e;void 0!==h&&(c=h),i._stop(!0),c=c||i.transform.centerPoint;let p=a.pointLocation(s?c.sub(s):c);l&&(a.bearing+=l),u&&(a.pitch+=u),o&&(a.zoom+=o),n?this._terrainMovement||!t.drag&&!t.zoom?t.drag&&this._terrainMovement?a.center=a.pointLocation(a.centerPoint.sub(s)):a.setLocationAtPoint(p,c):(this._terrainMovement=!0,a.freezeElevation=!0,a.setLocationAtPoint(p,c),this._map.once("moveend",(()=>{a.freezeElevation=!1,this._terrainMovement=!1,a.recalculateZoom(i.terrain)}))):a.setLocationAtPoint(p,c),i._applyUpdatedTransform(a),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(t,r,!0)}_fireEvents(e,t,r){let i=tc(this._eventsInProgress),a=tc(e),n={};for(let t in e){let{originalEvent:r}=e[t];this._eventsInProgress[t]||(n["".concat(t,"start")]=r),this._eventsInProgress[t]=e[t]}!i&&a&&this._fireEvent("movestart",a.originalEvent);for(let e in n)this._fireEvent(e,n[e]);a&&this._fireEvent("move",a.originalEvent);for(let t in e){let{originalEvent:r}=e[t];this._fireEvent(t,r)}let s,o={};for(let e in this._eventsInProgress){let{handlerName:r,originalEvent:i}=this._eventsInProgress[e];this._handlersById[r].isActive()||(delete this._eventsInProgress[e],s=t[r]||i,o["".concat(e,"end")]=s)}for(let e in o)this._fireEvent(e,o[e]);let u=tc(this._eventsInProgress);if(r&&(i||a)&&!u){this._updatingCamera=!0;let e=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),t=l((e=>0!==e&&-this._bearingSnap<e&&e<this._bearingSnap),"shouldSnapToNorth");e?(t(e.bearing||this._map.getBearing())&&(e.bearing=0),e.freezeElevation=!0,this._map.easeTo(e,{originalEvent:s})):(this._map.fire(new z("moveend",{originalEvent:s})),t(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(e,t){this._map.fire(new z(e,t?{originalEvent:t}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add((e=>{delete this._frameId,this.handleEvent(new Ty("renderFrame",{timeStamp:e})),this._applyChanges()}))}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}};l(Iy,"HandlerManager");var rc=Iy;d();var Xt=se(Pe(),1),My=class extends de{constructor(e,t){super(),this._renderFrameCallback=l((()=>{let e=Math.min((ne.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(e)),e<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}),"_renderFrameCallback"),this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=t.bearingSnap,this.on("moveend",(()=>{delete this._requestedCameraState}))}getCenter(){return new re(this.transform.center.lng,this.transform.center.lat)}setCenter(e,t){return this.jumpTo({center:e},t)}panBy(e,t,r){return e=Xt.default.convert(e).mult(-1),this.panTo(this.transform.center,R({offset:e},t),r)}panTo(e,t,r){return this.easeTo(R({center:e},t),r)}getZoom(){return this.transform.zoom}setZoom(e,t){return this.jumpTo({zoom:e},t),this}zoomTo(e,t,r){return this.easeTo(R({zoom:e},t),r)}zoomIn(e,t){return this.zoomTo(this.getZoom()+1,e,t),this}zoomOut(e,t){return this.zoomTo(this.getZoom()-1,e,t),this}getBearing(){return this.transform.bearing}setBearing(e,t){return this.jumpTo({bearing:e},t),this}getPadding(){return this.transform.padding}setPadding(e,t){return this.jumpTo({padding:e},t),this}rotateTo(e,t,r){return this.easeTo(R({bearing:e},t),r)}resetNorth(e,t){return this.rotateTo(0,R({duration:1e3},e),t),this}resetNorthPitch(e,t){return this.easeTo(R({bearing:0,pitch:0,duration:1e3},e),t),this}snapToNorth(e,t){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,t):this}getPitch(){return this.transform.pitch}setPitch(e,t){return this.jumpTo({pitch:e},t),this}cameraForBounds(e,t){e=ut.convert(e);let r=t&&t.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),r,t)}_cameraForBoxAndBearing(e,t,r,i){let a={top:0,bottom:0,right:0,left:0};if("number"==typeof(i=R({padding:a,offset:[0,0],maxZoom:this.transform.maxZoom},i)).padding){let e=i.padding;i.padding={top:e,bottom:e,right:e,left:e}}i.padding=R(a,i.padding);let n=this.transform,s=n.padding,o=n.project(re.convert(e)),l=n.project(re.convert(t)),u=o.rotate(-r*Math.PI/180),c=l.rotate(-r*Math.PI/180),h=new Xt.default(Math.max(u.x,c.x),Math.max(u.y,c.y)),p=new Xt.default(Math.min(u.x,c.x),Math.min(u.y,c.y)),d=h.sub(p),f=(n.width-(s.left+s.right+i.padding.left+i.padding.right))/d.x,m=(n.height-(s.top+s.bottom+i.padding.top+i.padding.bottom))/d.y;if(m<0||f<0)return void Ce("Map cannot fit within canvas with the given bounds, padding, and/or offset.");let y=Math.min(n.scaleZoom(n.scale*Math.min(f,m)),i.maxZoom),g=Xt.default.convert(i.offset),_=(i.padding.left-i.padding.right)/2,x=(i.padding.top-i.padding.bottom)/2,v=new Xt.default(_,x).rotate(r*Math.PI/180),b=g.add(v).mult(n.scale/n.zoomScale(y));return{center:n.unproject(o.add(l).div(2).sub(b)),zoom:y,bearing:r}}fitBounds(e,t,r){return this._fitInternal(this.cameraForBounds(e,t),t,r)}fitScreenCoordinates(e,t,r,i,a){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(Xt.default.convert(e)),this.transform.pointLocation(Xt.default.convert(t)),r,i),i,a)}_fitInternal(e,t,r){return e?(delete(t=R(e,t)).padding,t.linear?this.easeTo(t,r):this.flyTo(t,r)):this}jumpTo(e,t){this.stop();let r=this._getTransformForUpdate(),i=!1,a=!1,n=!1;return"zoom"in e&&r.zoom!==+e.zoom&&(i=!0,r.zoom=+e.zoom),void 0!==e.center&&(r.center=re.convert(e.center)),"bearing"in e&&r.bearing!==+e.bearing&&(a=!0,r.bearing=+e.bearing),"pitch"in e&&r.pitch!==+e.pitch&&(n=!0,r.pitch=+e.pitch),null!=e.padding&&!r.isPaddingEqual(e.padding)&&(r.padding=e.padding),this._applyUpdatedTransform(r),this.fire(new z("movestart",t)).fire(new z("move",t)),i&&this.fire(new z("zoomstart",t)).fire(new z("zoom",t)).fire(new z("zoomend",t)),a&&this.fire(new z("rotatestart",t)).fire(new z("rotate",t)).fire(new z("rotateend",t)),n&&this.fire(new z("pitchstart",t)).fire(new z("pitch",t)).fire(new z("pitchend",t)),this.fire(new z("moveend",t))}calculateCameraOptionsFromTo(e,t,r,i=0){let a=ze.fromLngLat(e,t),n=ze.fromLngLat(r,i),s=n.x-a.x,o=n.y-a.y,l=n.z-a.z,u=Math.hypot(s,o,l);if(0===u)throw new Error("Can't calculate camera options with same From and To");let c=Math.hypot(s,o),h=this.transform.scaleZoom(this.transform.cameraToCenterDistance/u/this.transform.tileSize),p=180*Math.atan2(s,-o)/Math.PI,d=180*Math.acos(c/u)/Math.PI;return d=l<0?90-d:90+d,{center:n.toLngLat(),zoom:h,pitch:d,bearing:p}}easeTo(e,t){this._stop(!1,e.easeId),(!1===(e=R({offset:[0,0],duration:500,easing:Ec},e)).animate||!e.essential&&ne.prefersReducedMotion)&&(e.duration=0);let r=this._getTransformForUpdate(),i=this.getZoom(),a=this.getBearing(),n=this.getPitch(),s=this.getPadding(),o="zoom"in e?+e.zoom:i,l="bearing"in e?this._normalizeBearing(e.bearing,a):a,u="pitch"in e?+e.pitch:n,c="padding"in e?e.padding:r.padding;console.log("aaaa",o),console.log("new zoom",o);let h=Xt.default.convert(e.offset),p=r.centerPoint.add(h),d=r.pointLocation(p),f=re.convert(e.center||d);this._normalizeCenter(f);let m,y,g=r.project(d),_=r.project(f).sub(g),x=r.zoomScale(o-i);e.around&&(m=re.convert(e.around),y=r.locationPoint(m));let v={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||o!==i,this._rotating=this._rotating||a!==l,this._pitching=this._pitching||u!==n,this._padding=!r.isPaddingEqual(c),this._easeId=e.easeId,this._prepareEase(t,e.noMoveStart,v),this.terrain&&this._prepareElevation(f),this._ease((d=>{if(this._zooming&&(r.zoom=ke.number(i,o,d)),this._rotating&&(r.bearing=ke.number(a,l,d)),this._pitching&&(r.pitch=Te(ke.number(n,u,d),this.transform.minPitch,this.transform.maxPitch)),this._padding&&(r.interpolatePadding(s,c,d),p=r.centerPoint.add(h)),this.terrain&&!e.freezeElevation&&this._updateElevation(d),m)r.setLocationAtPoint(m,y);else{let e=r.zoomScale(r.zoom-i),t=o>i?Math.min(2,x):Math.max(.5,x),a=Math.pow(t,1-d),n=r.unproject(g.add(_.mult(d*a)).mult(e));r.setLocationAtPoint(r.renderWorldCopies?n.wrap():n,p)}this._applyUpdatedTransform(r),this._fireMoveEvents(t)}),(e=>{this.terrain&&this._finalizeElevation(),this._afterEase(t,e)}),e),this}_prepareEase(e,t,r={}){this._moving=!0,!t&&!r.moving&&this.fire(new z("movestart",e)),this._zooming&&!r.zooming&&this.fire(new z("zoomstart",e)),this._rotating&&!r.rotating&&this.fire(new z("rotatestart",e)),this._pitching&&!r.pitching&&this.fire(new z("pitchstart",e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.transform.getElevation(e,this.terrain),this.transform.freezeElevation=!0}_updateElevation(e){let t=this.transform.getElevation(this._elevationCenter,this.terrain);if(e<1&&t!==this._elevationTarget){let r=this._elevationTarget-this._elevationStart,i=(t-(r*e+this._elevationStart))/(1-e);this._elevationStart+=e*(r-i),this._elevationTarget=t}this.transform.elevation=ke.number(this._elevationStart,this._elevationTarget,e)}_finalizeElevation(){this.transform.freezeElevation=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_applyUpdatedTransform(e){if(!this.transformCameraUpdate)return;let t=e.clone(),{center:r,zoom:i,pitch:a,bearing:n,elevation:s}=this.transformCameraUpdate(t);r&&(t.center=r),void 0!==i&&(t.zoom=i),void 0!==a&&(t.pitch=a),void 0!==n&&(t.bearing=n),void 0!==s&&(t.elevation=s),this.transform.apply(t)}_fireMoveEvents(e){this.fire(new z("move",e)),this._zooming&&this.fire(new z("zoom",e)),this._rotating&&this.fire(new z("rotate",e)),this._pitching&&this.fire(new z("pitch",e))}_afterEase(e,t){if(this._easeId&&t&&this._easeId===t)return;delete this._easeId;let r=this._zooming,i=this._rotating,a=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,r&&this.fire(new z("zoomend",e)),i&&this.fire(new z("rotateend",e)),a&&this.fire(new z("pitchend",e)),this.fire(new z("moveend",e))}flyTo(e,t){if(!e.essential&&ne.prefersReducedMotion){let r=Rt(e,["center","zoom","bearing","pitch","around"]);return this.jumpTo(r,t)}this.stop(),e=R({offset:[0,0],speed:1.2,curve:1.42,easing:Ec},e);let r=this._getTransformForUpdate(),i=this.getZoom(),a=this.getBearing(),n=this.getPitch(),s=this.getPadding(),o="zoom"in e?Te(+e.zoom,r.minZoom,r.maxZoom):i,u="bearing"in e?this._normalizeBearing(e.bearing,a):a,c="pitch"in e?+e.pitch:n,h="padding"in e?e.padding:r.padding,p=r.zoomScale(o-i),d=Xt.default.convert(e.offset),f=r.centerPoint.add(d),m=r.pointLocation(f),y=re.convert(e.center||m);this._normalizeCenter(y);let g=r.project(m),_=r.project(y).sub(g),x=e.curve,v=Math.max(r.width,r.height),b=v/p,w=_.mag();if("minZoom"in e){let t=Te(Math.min(e.minZoom,i,o),r.minZoom,r.maxZoom),a=v/r.zoomScale(t-i);x=Math.sqrt(a/w*2)}let S=x*x;function A(e){let t=(b*b-v*v+(e?-1:1)*S*S*w*w)/(2*(e?b:v)*S*w);return Math.log(Math.sqrt(t*t+1)-t)}function I(e){return(Math.exp(e)-Math.exp(-e))/2}function M(e){return(Math.exp(e)+Math.exp(-e))/2}function T(e){return I(e)/M(e)}l(A,"zoomOutFactor"),l(I,"sinh"),l(M,"cosh"),l(T,"tanh");let P=A(!1),C=l((function(e){return M(P)/M(P+x*e)}),"w"),E=l((function(e){return v*((M(P)*T(P+x*e)-I(P))/S)/w}),"u"),k=(A(!0)-P)/x;if(Math.abs(w)<1e-6||!isFinite(k)){if(Math.abs(v-b)<1e-6)return this.easeTo(e,t);let r=b<v?-1:1;k=Math.abs(Math.log(b/v))/x,E=l((function(){return 0}),"u"),C=l((function(e){return Math.exp(r*x*e)}),"w")}if("duration"in e)e.duration=+e.duration;else{let t="screenSpeed"in e?+e.screenSpeed/x:+e.speed;e.duration=1e3*k/t}return e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=a!==u,this._pitching=c!==n,this._padding=!r.isPaddingEqual(h),this._prepareEase(t,!1),this.terrain&&this._prepareElevation(y),this._ease((l=>{let p=l*k,m=1/C(p);r.zoom=1===l?o:i+r.scaleZoom(m),this._rotating&&(r.bearing=ke.number(a,u,l)),this._pitching&&(r.pitch=ke.number(n,c,l)),this._padding&&(r.interpolatePadding(s,h,l),f=r.centerPoint.add(d)),this.terrain&&!e.freezeElevation&&this._updateElevation(l);let x=1===l?y:r.unproject(g.add(_.mult(E(p))).mult(m));r.setLocationAtPoint(r.renderWorldCopies?x.wrap():x,f),this._applyUpdatedTransform(r),this._fireMoveEvents(t)}),(()=>{this.terrain&&this._finalizeElevation(),this._afterEase(t)}),e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,t){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let e=this._onEaseEnd;delete this._onEaseEnd,e.call(this,t)}if(!e){let e=this.handlers;e&&e.stop(!1)}return this}_ease(e,t,r){!1===r.animate||0===r.duration?(e(1),t()):(this._easeStart=ne.now(),this._easeOptions=r,this._onEaseFrame=e,this._onEaseEnd=t,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,t){e=Jt(e,-180,180);let r=Math.abs(e-t);return Math.abs(e-360-t)<r&&(e-=360),Math.abs(e+360-t)<r&&(e+=360),e}_normalizeCenter(e){let t=this.transform;if(!t.renderWorldCopies||t.lngRange)return;let r=e.lng-t.center.lng;e.lng+=r>180?-360:r<-180?360:0}queryTerrainElevation(e){return this.terrain?this.transform.getElevation(re.convert(e),this.terrain)-this.transform.elevation:null}};l(My,"Camera");var ic=My,ur=se(Pe(),1);d();var Cy=class{constructor(e={}){this._toggleAttribution=l((()=>{this._container.classList.contains("outdoor-compact")&&(this._container.classList.contains("outdoor-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("outdoor-compact-show")):(this._container.classList.add("outdoor-compact-show"),this._container.removeAttribute("open")))}),"_toggleAttribution"),this._updateData=l((e=>{e&&("metadata"===e.sourceDataType||"visibility"===e.sourceDataType||"style"===e.dataType||"terrain"===e.type)&&this._updateAttributions()}),"_updateData"),this._updateCompact=l((()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1===this._compact?this._container.setAttribute("open",""):!this._container.classList.contains("outdoor-compact")&&!this._container.classList.contains("outdoor-attrib-empty")&&(this._container.setAttribute("open",""),this._container.classList.add("outdoor-compact","outdoor-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("outdoor-compact")&&this._container.classList.remove("outdoor-compact","outdoor-compact-show"))}),"_updateCompact"),this._updateCompactMinimize=l((()=>{this._container.classList.contains("outdoor-compact")&&this._container.classList.contains("outdoor-compact-show")&&this._container.classList.remove("outdoor-compact-show")}),"_updateCompactMinimize"),this.options=e,this.position=this.options.position||this.getDefaultPosition()}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options&&this.options.compact,this._container=B.create("details","outdoor-ctrl-attrib outdoor-ctrl-attrib-".concat(this.position)),this._compactButton=B.create("summary","outdoor-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=B.create("div","outdoor-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._attributions=[],this._container}onRemove(){B.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(e,t){let r=this._map._getUIString("AttributionControl.".concat(t));e.title=r,e.setAttribute("aria-label",r)}get attributions(){return[...this._attributions]}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map((e=>"string"!=typeof e?"":e))):"string"==typeof this.options.customAttribution&&e.push(this.options.customAttribution)),this._map.style.stylesheet){let e=this._map.style.stylesheet;this.styleOwner=e.owner,this.styleId=e.id}let t=this._map.style.sourceCaches;for(let r in t){let i=t[r];if(i.used||i.usedForTerrain){let t=i.getSource();t.attribution&&e.indexOf(t.attribution)<0&&e.push(t.attribution)}}e=e.filter((e=>String(e).trim())),e.sort(((e,t)=>e.length-t.length)),e=e.filter(((t,r)=>{for(let i=r+1;i<e.length;i++)if(e[i].indexOf(t)>=0)return!1;return!0})),this._attributions=e;let r=e.join(" | ");r!==this._attribHTML&&(this._attribHTML=r,e.length?(this._innerContainer.innerHTML=r,this._container.classList.remove("outdoor-attrib-empty")):this._container.classList.add("outdoor-attrib-empty"),this._updateCompact(),this._editLink=null)}show(){this._container.classList.remove("outdoor-ctrl-attrib-hide")}hide(){this._container.classList.add("outdoor-ctrl-attrib-hide")}setPosition(e){this._container.classList.remove("outdoor-ctrl-attrib-".concat(this.position)),this.position=e,this._container.classList.add("outdoor-ctrl-attrib-".concat(this.position))}};l(Cy,"AttributionControl");var Sn=Cy;d();var Ey=class{constructor(e={}){this._updateCompact=l((()=>{let e=this._container.children;if(e.length){let t=e[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1!==this._compact&&t.classList.add("maplibregl-compact"):t.classList.remove("maplibregl-compact")}}),"_updateCompact"),this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){this._map=e,this._compact=this.options&&this.options.compact,this._container=B.create("div","maplibregl-ctrl");let t=B.create("a","maplibregl-ctrl-logo");return t.target="_blank",t.rel="noopener nofollow",t.href="https://maplibre.org/",t.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),t.setAttribute("rel","noopener nofollow"),this._container.appendChild(t),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){B.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}};l(Ey,"LogoControl");var Pn=Ey;d();var CE=se(Pe(),1),ky=class extends z{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,r,i={}){let a=B.mousePos(t.getCanvasContainer(),r);super(e,R({point:a,lngLat:t.unproject(a),originalEvent:r},i)),this._defaultPrevented=!1,this.target=t}};l(ky,"MapMouseEvent");var Tn=ky;d();var Ly=class{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){let t=++this._id;return this._queue.push({callback:e,id:t,cancelled:!1}),t}remove(e){let t=this._currentlyRunning,r=t?this._queue.concat(t):this._queue;for(let t of r)if(t.id===e)return void(t.cancelled=!0)}run(e=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");let t=this._currentlyRunning=this._queue;this._queue=[];for(let r of t)if(!r.cancelled&&(r.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}};l(Ly,"TaskQueue");var nc=Ly;d();var oc=(e=>(e.create="create",e.load="load",e.fullLoad="fullLoad",e))(oc||{}),ac=null,co=[],EE=60,Dy=1e3/EE,zy="loadTime",Fy="fullLoadTime",Or={mark(e){"mark"in performance&&performance.mark(e)},frame(e){let t=e;if(null!=ac){let e=t-ac;co.push(e)}ac=t},clearMetrics(){ac=null,co=[],performance.clearMeasures(zy),performance.clearMeasures(Fy);for(let e in oc)performance.clearMarks(oc[e])},getPerformanceMetrics(){performance.measure(zy,"create","load"),performance.measure(Fy,"create","fullLoad");let e=performance.getEntriesByName(zy)[0].duration,t=performance.getEntriesByName(Fy)[0].duration,r=co.length,i=1/(co.reduce(((e,t)=>e+t),0)/r/1e3),a=co.filter((e=>e>Dy)).reduce(((e,t)=>e+(t-Dy)/Dy),0);return{loadTime:e,fullLoadTime:t,fps:i,percentDroppedFrames:a/(r+a)*100,totalFrames:r}}};d();var iw={"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":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.enableTerrain":"Enable terrain","TerrainControl.disableTerrain":"Disable terrain"};d(),d();var nw=ve([{name:"a_pos3d",type:"Int16",components:3}]);d();var By=class extends de{constructor(e){super(),this.sourceCache=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,e.usedForTerrain=!0,e.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(e,t){this.sourceCache.update(e,t),this._renderableTilesKeys=[];let r={};for(let i of e.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:t}))r[i.key]=!0,this._renderableTilesKeys.push(i.key),this._tiles[i.key]||(i.posMatrix=new Float64Array(16),G.ortho(i.posMatrix,0,8192,0,8192,0,1),this._tiles[i.key]=new xn(i,this.tileSize));for(let e in this._tiles)r[e]||delete this._tiles[e]}freeRtt(e){for(let t in this._tiles){let r=this._tiles[t];(!e||r.tileID.equals(e)||r.tileID.isChildOf(e)||e.isChildOf(r.tileID))&&(r.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map((e=>this.getTileByID(e)))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e){let t={};for(let r of this._renderableTilesKeys){let i=this._tiles[r].tileID;if(i.canonical.equals(e.canonical)){let i=e.clone();i.posMatrix=new Float64Array(16),G.ortho(i.posMatrix,0,8192,0,8192,0,1),t[r]=i}else if(i.canonical.isChildOf(e.canonical)){let a=e.clone();a.posMatrix=new Float64Array(16);let n=i.canonical.z-e.canonical.z,s=i.canonical.x-(i.canonical.x>>n<<n),o=i.canonical.y-(i.canonical.y>>n<<n),l=8192>>n;G.ortho(a.posMatrix,0,l,0,l,0,1),G.translate(a.posMatrix,a.posMatrix,[-s*l,-o*l,0]),t[r]=a}else if(e.canonical.isChildOf(i.canonical)){let a=e.clone();a.posMatrix=new Float64Array(16);let n=e.canonical.z-i.canonical.z,s=e.canonical.x-(e.canonical.x>>n<<n),o=e.canonical.y-(e.canonical.y>>n<<n),l=8192>>n;G.ortho(a.posMatrix,0,8192,0,8192,0,1),G.translate(a.posMatrix,a.posMatrix,[s*l,o*l,0]),G.scale(a.posMatrix,a.posMatrix,[1/2**n,1/2**n,0]),t[r]=a}}return t}getSourceTile(e,t){let r=this.sourceCache._source,i=e.overscaledZ-this.deltaZoom;if(i>r.maxzoom&&(i=r.maxzoom),i<r.minzoom)return null;this._sourceTileCache[e.key]||(this._sourceTileCache[e.key]=e.scaledTo(i).key);let a=this.sourceCache.getTileByID(this._sourceTileCache[e.key]);if((!a||!a.dem)&&t)for(;i>=r.minzoom&&(!a||!a.dem);)a=this.sourceCache.getTileByID(e.scaledTo(i--).key);return a}tilesAfterTime(e=Date.now()){return Object.values(this._tiles).filter((t=>t.timeAdded>=e))}};l(By,"TerrainSourceCache");var sc=By,Ry=class{constructor(e,t,r){this.painter=e,this.sourceCache=new sc(t),this.options=r,this.exaggeration="number"==typeof r.exaggeration?r.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(e,t,r,i=8192){var a;if(!(t>=0&&t<i&&r>=0&&r<i))return 0;let n=this.getTerrainData(e),s=null==(a=n.tile)?void 0:a.dem;if(!s)return 0;let o=Yi.transformMat4([],[t/i*8192,r/i*8192],n.u_terrain_matrix),l=[o[0]*s.dim,o[1]*s.dim],u=Math.floor(l[0]),c=Math.floor(l[1]),h=l[0]-u,p=l[1]-c;return s.get(u,c)*(1-h)*(1-p)+s.get(u+1,c)*h*(1-p)+s.get(u,c+1)*(1-h)*p+s.get(u+1,c+1)*h*p}getElevation(e,t,r,i=8192){return this.getDEMElevation(e,t,r,i)*this.exaggeration}getTerrainData(e){if(!this._emptyDemTexture){let e=this.painter.context,t=new Ee({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new be(e,t,e.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new be(e,new Ee({width:1,height:1}),e.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=G.identity([])}let t=this.sourceCache.getSourceTile(e,!0);if(t&&t.dem&&(!t.demTexture||t.needsTerrainPrepare)){let e=this.painter.context;t.demTexture=this.painter.getTileTexture(t.dem.stride),t.demTexture?t.demTexture.update(t.dem.getPixels(),{premultiply:!1}):t.demTexture=new be(e,t.dem.getPixels(),e.gl.RGBA,{premultiply:!1}),t.demTexture.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),t.needsTerrainPrepare=!1}let r=t&&t+t.tileID.key+e.key;if(r&&!this._demMatrixCache[r]){let r=this.sourceCache.sourceCache._source.maxzoom,i=e.canonical.z-t.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=r?i=e.canonical.z-r:Ce("cannot calculate elevation if elevation maxzoom > source.maxzoom"));let a=e.canonical.x-(e.canonical.x>>i<<i),n=e.canonical.y-(e.canonical.y>>i<<i),s=G.fromScaling(new Float64Array(16),[1/(8192<<i),1/(8192<<i),0]);G.translate(s,s,[8192*a,8192*n,0]),this._demMatrixCache[e.key]={matrix:s,coord:e}}return{u_depth:2,u_terrain:3,u_terrain_dim:t&&t.dem&&t.dem.dim||1,u_terrain_matrix:r?this._demMatrixCache[e.key].matrix:this._emptyDemMatrix,u_terrain_unpack:t&&t.dem&&t.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(t&&t.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:t}}getFramebuffer(e){let t=this.painter,r=t.width/devicePixelRatio,i=t.height/devicePixelRatio;return this._fbo&&(this._fbo.width!==r||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 be(t.context,{width:r,height:i,data:null},t.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(t.context.gl.NEAREST,t.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new be(t.context,{width:r,height:i,data:null},t.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(t.context.gl.NEAREST,t.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=t.context.createFramebuffer(r,i,!0,!1),this._fbo.depthAttachment.set(t.context.createRenderbuffer(t.context.gl.DEPTH_COMPONENT16,r,i))),this._fbo.colorAttachment.set("coords"===e?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){let e=this.painter.context;if(this._coordsTexture)return this._coordsTexture;let t=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let e=0,r=0;e<this._coordsTextureSize;e++)for(let i=0;i<this._coordsTextureSize;i++,r+=4)t[r+0]=255&i,t[r+1]=255&e,t[r+2]=i>>8<<4|e>>8,t[r+3]=0;let r=new Ee({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(t.buffer)),i=new be(e,r,e.gl.RGBA,{premultiply:!1});return i.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=i,i}pointCoordinate(e){let t=new Uint8Array(4),r=this.painter.context,i=r.gl;r.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),i.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,i.RGBA,i.UNSIGNED_BYTE,t),r.bindFramebuffer.set(null);let a=t[0]+(t[2]>>4<<8),n=t[1]+((15&t[2])<<8),s=this.coordsIndex[255-t[3]],o=s&&this.sourceCache.getTileByID(s);if(!o)return null;let l=this._coordsTextureSize,u=(1<<o.tileID.canonical.z)*l;return new ze((o.tileID.canonical.x*l+a)/u,(o.tileID.canonical.y*l+n)/u,this.getElevation(o.tileID,a,n,l))}getTerrainMesh(){if(this._mesh)return this._mesh;let e=this.painter.context,t=new Ps,r=new at,i=this.meshSize,a=8192/i,n=i*i;for(let e=0;e<=i;e++)for(let r=0;r<=i;r++)t.emplaceBack(r*a,e*a,0);for(let e=0;e<n;e+=i+1)for(let t=0;t<i;t++)r.emplaceBack(t+e,i+t+e+1,i+t+e+2),r.emplaceBack(t+e,i+t+e+2,t+e+1);let s=t.length,o=s+2*(i+1);for(let e of[0,1])for(let r=0;r<=i;r++)for(let i of[0,1])t.emplaceBack(r*a,8192*e,i);for(let e=0;e<2*i;e+=2)r.emplaceBack(o+e,o+e+1,o+e+3),r.emplaceBack(o+e,o+e+3,o+e+2),r.emplaceBack(s+e,s+e+3,s+e+1),r.emplaceBack(s+e,s+e+2,s+e+3);let l=t.length,u=l+2*(i+1);for(let e of[0,1])for(let r=0;r<=i;r++)for(let i of[0,1])t.emplaceBack(8192*e,r*a,i);for(let e=0;e<2*i;e+=2)r.emplaceBack(l+e,l+e+1,l+e+3),r.emplaceBack(l+e,l+e+3,l+e+2),r.emplaceBack(u+e,u+e+3,u+e+1),r.emplaceBack(u+e,u+e+2,u+e+3);return this._mesh={indexBuffer:e.createIndexBuffer(r),vertexBuffer:e.createVertexBuffer(t,nw.members),segments:me.simpleSegment(0,0,t.length,r.length)},this._mesh}getMeshFrameDelta(e){return 2*Math.PI*yi/Math.pow(2,e)/5}getMinMaxElevation(e){let t=this.getTerrainData(e).tile,r={minElevation:null,maxElevation:null};return t&&t.dem&&(r.minElevation=t.dem.min*this.exaggeration,r.maxElevation=t.dem.max*this.exaggeration),r}};l(Ry,"Terrain");var lc=Ry;d(),d();var Oy=class{constructor(e,t,r){this._context=e,this._size=t,this._tileSize=r,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(let e of this._objects)e.texture.destroy(),e.fbo.destroy()}_createObject(e){let t=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),r=new be(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return r.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),t.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),t.colorAttachment.set(r.texture),{id:e,fbo:t,texture:r,stamp:-1,inUse:!1}}getObjectForId(e){return this._objects[e]}useObject(e){e.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter((t=>e.id!==t)),this._recentlyUsed.push(e.id)}stampObject(e){e.stamp=++this._stamp}getOrCreateFreeObject(){for(let e of this._recentlyUsed)if(!this._objects[e].inUse)return this._objects[e];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))}};l(Oy,"RenderPool");var uc=Oy,An={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0},Vy=class{constructor(e,t){this.painter=e,this.terrain=t,this.pool=new uc(e.context,30,t.sourceCache.tileSize*t.qualityFactor)}destruct(){this.pool.destruct()}getTexture(e){return this.pool.getObjectForId(e.rtt[this._stacks.length-1].id).texture}prepareForRender(e,t){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=e._order.filter((r=>!e._layers[r].isHidden(t))),this._coordsDescendingInv={};for(let t in e.sourceCaches){this._coordsDescendingInv[t]={};let r=e.sourceCaches[t].getVisibleCoordinates();for(let e of r){let r=this.terrain.sourceCache.getTerrainCoords(e);for(let e in r)this._coordsDescendingInv[t][e]||(this._coordsDescendingInv[t][e]=[]),this._coordsDescendingInv[t][e].push(r[e])}}this._coordsDescendingInvStr={};for(let t of e._order){let r=e._layers[t],i=r.source;if(An[r.type]&&!this._coordsDescendingInvStr[i]){this._coordsDescendingInvStr[i]={};for(let e in this._coordsDescendingInv[i])this._coordsDescendingInvStr[i][e]=this._coordsDescendingInv[i][e].map((e=>e.key)).sort().join()}}for(let e of this._renderableTiles)for(let t in this._coordsDescendingInvStr){let r=this._coordsDescendingInvStr[t][e.tileID.key];r&&r!==e.rttCoords[t]&&(e.rtt=[])}}renderLayer(e){if(e.isHidden(this.painter.transform.zoom))return!1;let t=e.type,r=this.painter,i=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(An[t]&&((!this._prevType||!An[this._prevType])&&this._stacks.push([]),this._prevType=t,this._stacks[this._stacks.length-1].push(e.id),!i))return!0;if(An[this._prevType]||An[t]&&i){this._prevType=t;let e=this._stacks.length-1,i=this._stacks[e]||[];for(let t of this._renderableTiles){if(this.pool.isFull()&&(_y(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(t),t.rtt[e]){let r=this.pool.getObjectForId(t.rtt[e].id);if(r.stamp===t.rtt[e].stamp){this.pool.useObject(r);continue}}let a=this.pool.getOrCreateFreeObject();this.pool.useObject(a),this.pool.stampObject(a),t.rtt[e]={id:a.id,stamp:a.stamp},r.context.bindFramebuffer.set(a.fbo.framebuffer),r.context.clear({color:X.transparent,stencil:0}),r.currentStencilSource=void 0;for(let e=0;e<i.length;e++){let n=r.style._layers[i[e]],s=n.source?this._coordsDescendingInv[n.source][t.tileID.key]:[t.tileID];r.context.viewport.set([0,0,a.fbo.width,a.fbo.height]),r._renderTileClippingMasks(n,s),r.renderLayer(r,r.style.sourceCaches[n.source],n,s),n.source&&(t.rttCoords[n.source]=this._coordsDescendingInvStr[n.source][t.tileID.key])}}return _y(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),An[t]}return!1}};l(Vy,"RenderToTexture");var cc=Vy,kE=xo.version,hc=-2,aw=22,Vr=0,ow=90,pc=90,LE={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:hc,maxZoom:aw,minPitch:Vr,maxPitch:ow,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:void 0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:Je.MAX_TILE_CACHE_ZOOM_LEVELS,localIdeographFontFamily:"sans-serif",transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,validateStyle:!0,maxCanvasSize:[4096,4096]},Uy=class extends ic{constructor(e){if(Or.mark("create"),null!=(e=R({},LE,e)).minZoom&&null!=e.maxZoom&&e.minZoom>e.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(null!=e.minPitch&&null!=e.maxPitch&&e.minPitch>e.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(null!=e.minPitch&&e.minPitch<Vr)throw new Error("minPitch must be greater than or equal to ".concat(Vr));if(null!=e.maxPitch&&e.maxPitch>pc)throw new Error("maxPitch must be less than or equal to ".concat(pc));if(super(new Wu(e.minZoom,e.maxZoom,e.minPitch,e.maxPitch,e.renderWorldCopies),{bearingSnap:e.bearingSnap}),this._cooperativeGesturesOnWheel=l((e=>{this._onCooperativeGesture(e,e[this._metaKey],1)}),"_cooperativeGesturesOnWheel"),this._contextLost=l((e=>{e.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new z("webglcontextlost",{originalEvent:e}))}),"_contextLost"),this._contextRestored=l((e=>{this._setupPainter(),this.resize(),this._update(),this.fire(new z("webglcontextrestored",{originalEvent:e}))}),"_contextRestored"),this._onMapScroll=l((e=>{if(e.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}),"_onMapScroll"),this._onWindowOnline=l((()=>{this._update()}),"_onWindowOnline"),this._interactive=e.interactive,this._cooperativeGestures=e.cooperativeGestures,this._metaKey=0===navigator.platform.indexOf("Mac")?"metaKey":"ctrlKey",this._maxTileCacheSize=e.maxTileCacheSize,this._maxTileCacheZoomLevels=e.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=e.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=e.preserveDrawingBuffer,this._antialias=e.antialias,this._trackResize=e.trackResize,this._bearingSnap=e.bearingSnap,this._refreshExpiredTiles=e.refreshExpiredTiles,this._fadeDuration=e.fadeDuration,this._crossSourceCollisions=e.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=e.collectResourceTiming,this._renderTaskQueue=new nc,this._controls=[],this._mapId=_o(),this._locale=R({},iw,e.locale),this._clickTolerance=e.clickTolerance,this._overridePixelRatio=e.pixelRatio,this._maxCanvasSize=e.maxCanvasSize,this.transformCameraUpdate=e.transformCameraUpdate,this._imageQueueHandle=st.addThrottleControl((()=>this.isMoving())),this._requestManager=new To(e.transformRequest),this._canvas=e.canvas,this._canvasContainer=e.canvasContainer,"string"==typeof e.container){if(this._container=document.getElementById(e.container),!this._container)throw new Error("Container '".concat(e.container,"' not found."))}else{if(!(e.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=e.container}if(e.maxBounds&&this.setMaxBounds(e.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 e=!1;this._resizeObserver=new ResizeObserver((t=>{e?this._trackResize&&this.resize(t)._update():e=!0})),this._resizeObserver.observe(this._container)}this.handlers=new rc(this,e),this._cooperativeGestures&&this._setupCooperativeGestures();let t="string"==typeof e.hash&&e.hash||void 0;this._hash=e.hash&&new Ku(t).addTo(this),(!this._hash||!this._hash._onHashChange())&&(this.jumpTo({center:e.center,zoom:e.zoom,bearing:e.bearing,pitch:e.pitch}),e.bounds&&(this.resize(),this.fitBounds(e.bounds,R({},e.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=e.localIdeographFontFamily,this._validateStyle=e.validateStyle,e.style&&this.setStyle(e.style,{localIdeographFontFamily:e.localIdeographFontFamily}),e.attributionControl&&this.addControl(new Sn({customAttribution:e.customAttribution})),e.maplibreLogo&&this.addControl(new Pn,e.logoPosition),this.on("style.load",(()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)})),this.on("data",(e=>{this._update("style"===e.dataType),this.fire(new z("".concat(e.dataType,"data"),e))})),this.on("dataloading",(e=>{this.fire(new z("".concat(e.dataType,"dataloading"),e))})),this.on("dataabort",(e=>{this.fire(new z("sourcedataabort",e))}))}_getMapId(){return this._mapId}addControl(e,t){return void 0===t&&(t=e.getDefaultPosition?e.getDefaultPosition():"top-right"),e&&e.onAdd?this:this.fire(new H(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")))}removeControl(e){if(!e||!e.onRemove)return this.fire(new H(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let t=this._controls.indexOf(e);return t>-1&&this._controls.splice(t,1),e.onRemove(this),this}hasControl(e){return this._controls.indexOf(e)>-1}calculateCameraOptionsFromTo(e,t,r,i){return null==i&&this.terrain&&(i=this.transform.getElevation(r,this.terrain)),super.calculateCameraOptionsFromTo(e,t,r,i)}resize(e){var t;let r=this._containerDimensions(),i=r[0],a=r[1],n=this._getClampedPixelRatio(i,a);if(this.painter.resize(i,a,n),this.painter.overLimit()){let e=this.painter.context.gl;this._maxCanvasSize=[e.drawingBufferWidth,e.drawingBufferHeight];let t=this._getClampedPixelRatio(i,a);this._resizeCanvas(i,a,t),this.painter.resize(i,a,t)}this.transform.resize(i,a),null==(t=this._requestedCameraState)||t.resize(i,a);let s=!this._moving;return s&&(this.stop(),this.fire(new z("movestart",e)).fire(new z("move",e))),this.fire(new z("resize",e)),s&&this.fire(new z("moveend",e)),this}_getClampedPixelRatio(e,t){let{0:r,1:i}=this._maxCanvasSize,a=this.getPixelRatio(),n=e*a,s=t*a,o=n>r?r/n:1,l=s>i?i/s:1;return Math.min(o,l)*a}getPixelRatio(){var e;return null!=(e=this._overridePixelRatio)?e:devicePixelRatio}setPixelRatio(e){this._overridePixelRatio=e,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(e){return this.transform.setMaxBounds(ut.convert(e)),this._update()}setMinZoom(e){if((e=null==e?hc:e)>=hc&&e<=this.transform.maxZoom)return this.transform.minZoom=e,this._update(),this.getZoom()<e&&this.setZoom(e),this;throw new Error("minZoom must be between ".concat(hc," and the current maxZoom, inclusive"))}getMinZoom(){return this.transform.minZoom}setMaxZoom(e){if((e=null==e?aw:e)>=this.transform.minZoom)return this.transform.maxZoom=e,this._update(),this.getZoom()>e&&this.setZoom(e),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(e){if((e=null==e?Vr:e)<Vr)throw new Error("minPitch must be greater than or equal to ".concat(Vr));if(e>=Vr&&e<=this.transform.maxPitch)return this.transform.minPitch=e,this._update(),this.getPitch()<e&&this.setPitch(e),this;throw new Error("minPitch must be between ".concat(Vr," and the current maxPitch, inclusive"))}getMinPitch(){return this.transform.minPitch}setMaxPitch(e){if((e=null==e?ow:e)>pc)throw new Error("maxPitch must be less than or equal to ".concat(pc));if(e>=this.transform.minPitch)return this.transform.maxPitch=e,this._update(),this.getPitch()>e&&this.setPitch(e),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(e){return this.transform.renderWorldCopies=e,this._update()}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(e){return this._cooperativeGestures=e,this._cooperativeGestures?this._setupCooperativeGestures():this._destroyCooperativeGestures(),this}project(e){return this.transform.locationPoint(re.convert(e),this.style&&this.terrain)}unproject(e){return this.transform.pointLocation(ur.default.convert(e),this.terrain)}isMoving(){var e;return this._moving||(null==(e=this.handlers)?void 0:e.isMoving())}isZooming(){return this._zooming||!1}isRotating(){var e;return this._rotating||(null==(e=this.handlers)?void 0:e.isRotating())}_createDelegatedListener(e,t,r){if("mouseenter"===e||"mouseover"===e){let i=!1;return{layer:t,listener:r,delegates:{mousemove:l((a=>{let n=this.getLayer(t)?this.queryRenderedFeatures(a.point,{layers:[t]}):[];n.length?i||(i=!0,r.call(this,new Tn(e,this,a.originalEvent,{features:n}))):i=!1}),"mousemove"),mouseout:l((()=>{i=!1}),"mouseout")}}}if("mouseleave"===e||"mouseout"===e){let i=!1;return{layer:t,listener:r,delegates:{mousemove:l((a=>{(this.getLayer(t)?this.queryRenderedFeatures(a.point,{layers:[t]}):[]).length?i=!0:i&&(i=!1,r.call(this,new Tn(e,this,a.originalEvent)))}),"mousemove"),mouseout:l((t=>{i&&(i=!1,r.call(this,new Tn(e,this,t.originalEvent)))}),"mouseout")}}}{let i=l((e=>{let i=this.getLayer(t)?this.queryRenderedFeatures(e.point,{layers:[t]}):[];i.length&&(e.features=i,r.call(this,e),delete e.features)}),"delegate");return{layer:t,listener:r,delegates:{[e]:i}}}}on(e,t,r){if(void 0===r)return super.on(e,t);let i=this._createDelegatedListener(e,t,r);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[e]=this._delegatedListeners[e]||[],this._delegatedListeners[e].push(i);for(let e in i.delegates)this.on(e,i.delegates[e]);return this}once(e,t,r){if(void 0===r)return super.once(e,t);let i=this._createDelegatedListener(e,t,r);for(let e in i.delegates)this.once(e,i.delegates[e]);return this}off(e,t,r){if(void 0===r)return super.off(e,t);let i=l((i=>{let a=i[e];for(let e=0;e<a.length;e++){let i=a[e];if(i.layer===t&&i.listener===r){for(let e in i.delegates)this.off(e,i.delegates[e]);return a.splice(e,1),this}}}),"removeDelegatedListener");return this._delegatedListeners&&this._delegatedListeners[e]&&i(this._delegatedListeners),this}queryRenderedFeatures(e,t){if(!this.style)return[];let r,i=e instanceof ur.default||Array.isArray(e),a=i?e:[[0,0],[this.transform.width,this.transform.height]];if(t=t||(i?{}:e)||{},a instanceof ur.default||"number"==typeof a[0])r=[ur.default.convert(a)];else{let e=ur.default.convert(a[0]),t=ur.default.convert(a[1]);r=[e,new ur.default(t.x,e.y),t,new ur.default(e.x,t.y),e]}return this.style.queryRenderedFeatures(r,t,this.transform)}querySourceFeatures(e,t){return this.style.querySourceFeatures(e,t)}setStyle(e,t){return!1!==(t=R({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},t)).diff&&t.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&e?(this._diffStyle(e,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._updateStyle(e,t))}setTransformRequest(e){return this._requestManager.setTransformRequest(e),this}_getUIString(e){let t=this._locale[e];if(null==t)throw new Error("Missing UI string '".concat(e,"'"));return t}_updateStyle(e,t){if(t.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",(()=>this._updateStyle(e,t)));let r=this.style&&t.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!e)),e?(this.style=new Rr(this,t||{}),this.style.setEventedParent(this,{style:this.style}),"string"==typeof e?this.style.loadURL(e,t,r):this.style.loadJSON(e,t,r),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new Rr(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(e,t){if("string"==typeof e){let r=e,i=this._requestManager.transformRequest(r,"Style");mr(i,((e,r)=>{e?this.fire(new H(e)):r&&this._updateDiff(r,t)}))}else"object"==typeof e&&this._updateDiff(e,t)}_updateDiff(e,t){try{this.style.setState(e,t)&&this._update(!0)}catch(r){Ce("Unable to perform style diff: ".concat(r.message||r.error||r,". Rebuilding the style from scratch.")),this._updateStyle(e,t)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():Ce("There is no style added to the map.")}addSource(e,t){return this._lazyInitEmptyStyle(),this.style.addSource(e,t),this._update(!0)}isSourceLoaded(e){let t=this.style&&this.style.sourceCaches[e];if(void 0!==t)return t.loaded();this.fire(new H(new Error("There is no source with ID '".concat(e,"'"))))}setTerrain(e){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),e){let t=this.style.sourceCaches[e.source];if(!t)throw new Error("cannot load terrain, because there exists no source with ID: ".concat(e.source));for(let t in this.style._layers){let r=this.style._layers[t];"hillshade"===r.type&&r.source===e.source&&Ce("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new lc(this.painter,t,e),this.painter.renderToTexture=new cc(this.painter,this.terrain),this.transform.updateElevation(this.terrain),this._terrainDataCallback=t=>{"style"===t.dataType?this.terrain.sourceCache.freeRtt():"source"===t.dataType&&t.tile&&(t.sourceId===e.source&&this.transform.updateElevation(this.terrain),this.terrain.sourceCache.freeRtt(t.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.updateElevation(this.terrain);return this.fire(new z("terrain",{terrain:e})),this}getTerrain(){return this.terrain&&this.terrain.options}areTilesLoaded(){let e=this.style&&this.style.sourceCaches;for(let t in e){let r=e[t]._tiles;for(let e in r){let t=r[e];if("loaded"!==t.state&&"errored"!==t.state)return!1}}return!0}addSourceType(e,t,r){return this._lazyInitEmptyStyle(),this.style.addSourceType(e,t,r)}removeSource(e){return this.style.removeSource(e),this._update(!0)}getSource(e){return this.style.getSource(e)}addImage(e,t,r={}){let{pixelRatio:i=1,sdf:a=!1,stretchX:n,stretchY:s,content:o}=r;this._lazyInitEmptyStyle();if(!(t instanceof HTMLImageElement||kt(t))){if(void 0===t.width||void 0===t.height)return this.fire(new H(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:r,height:l,data:u}=t,c=t;return this.style.addImage(e,{data:new Ee({width:r,height:l},new Uint8Array(u)),pixelRatio:i,stretchX:n,stretchY:s,content:o,sdf:a,version:0,userImage:c}),c.onAdd&&c.onAdd(this,e),this}}{let{width:r,height:l,data:u}=ne.getImageData(t);this.style.addImage(e,{data:new Ee({width:r,height:l},u),pixelRatio:i,stretchX:n,stretchY:s,content:o,sdf:a,version:0})}}updateImage(e,t){let r=this.style.getImage(e);if(!r)return this.fire(new H(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let i=t instanceof HTMLImageElement||kt(t)?ne.getImageData(t):t,{width:a,height:n,data:s}=i;if(void 0===a||void 0===n)return this.fire(new H(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!==r.data.width||n!==r.data.height)return this.fire(new H(new Error("The width and height of the updated image must be that same as the previous version of the image")));let o=!(t instanceof HTMLImageElement||kt(t));return r.data.replace(s,o),this.style.updateImage(e,r),this}getImage(e){return this.style.getImage(e)}hasImage(e){return e?!!this.style.getImage(e):(this.fire(new H(new Error("Missing required image id"))),!1)}removeImage(e){this.style.removeImage(e)}loadImage(e,t){st.getImage(this._requestManager.transformRequest(e,"Image"),t)}listImages(){return this.style.listImages()}addLayer(e,t){return this._lazyInitEmptyStyle(),this.style.addLayer(e,t),this._update(!0)}moveLayer(e,t){return this.style.moveLayer(e,t),this._update(!0)}removeLayer(e){return this.style.removeLayer(e),this._update(!0)}getLayer(e){return this.style.getLayer(e)}setLayerZoomRange(e,t,r){return this.style.setLayerZoomRange(e,t,r),this._update(!0)}setFilter(e,t,r={}){return this.style.setFilter(e,t,r),this._update(!0)}getFilter(e){return this.style.getFilter(e)}setPaintProperty(e,t,r,i={}){return this.style.setPaintProperty(e,t,r,i),this._update(!0)}getPaintProperty(e,t){return this.style.getPaintProperty(e,t)}setLayoutProperty(e,t,r,i={}){return this.style.setLayoutProperty(e,t,r,i),this._update(!0)}getLayoutProperty(e,t){return this.style.getLayoutProperty(e,t)}setGlyphs(e,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(e,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(e,t,r={}){return this._lazyInitEmptyStyle(),this.style.addSprite(e,t,r,(e=>{e||this._update(!0)})),this}removeSprite(e){return this._lazyInitEmptyStyle(),this.style.removeSprite(e),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(e,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(e,t,(e=>{e||this._update(!0)})),this}setLight(e,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(e,t),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(e,t){return this.style.setFeatureState(e,t),this._update()}removeFeatureState(e,t){return this.style.removeFeatureState(e,t),this._update()}getFeatureState(e){return this.style.getFeatureState(e)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let e=0,t=0;return this._container&&(e=this._container.clientWidth||400,t=this._container.clientHeight||300),[e,t]}_setupContainer(){this._container;let e=this._containerDimensions(),t=this._getClampedPixelRatio(e[0],e[1]);this._resizeCanvas(e[0],e[1],t)}_setupCooperativeGestures(){let e=this._container;this._cooperativeGesturesScreen=B.create("div","maplibregl-cooperative-gesture-screen",e);let t="boolean"!=typeof this._cooperativeGestures&&this._cooperativeGestures.windowsHelpText?this._cooperativeGestures.windowsHelpText:"Use Ctrl + scroll to zoom the map";0===navigator.platform.indexOf("Mac")&&(t="boolean"!=typeof this._cooperativeGestures&&this._cooperativeGestures.macHelpText?this._cooperativeGestures.macHelpText:"Use ⌘ + scroll to zoom the map");let r="boolean"!=typeof this._cooperativeGestures&&this._cooperativeGestures.mobileHelpText?this._cooperativeGestures.mobileHelpText:"Use two fingers to move the map";this._cooperativeGesturesScreen.innerHTML='\n <div class="maplibregl-desktop-message">'.concat(t,'</div>\n <div class="maplibregl-mobile-message">').concat(r,"</div>\n "),this._cooperativeGesturesScreen.setAttribute("aria-hidden","true"),this._canvasContainer.addEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.add("maplibregl-cooperative-gestures")}_destroyCooperativeGestures(){B.remove(this._cooperativeGesturesScreen),this._canvasContainer.removeEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.remove("maplibregl-cooperative-gestures")}_resizeCanvas(e,t,r){}_setupPainter(){let e={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1},t=null;this._canvas.addEventListener("webglcontextcreationerror",(r=>{t={requestedAttributes:e},r&&(t.statusMessage=r.statusMessage,t.type=r.type)}),{once:!0});let r=this._canvas.getContext("webgl2",e)||this._canvas.getContext("webgl",e);if(!r){let e="Failed to initialize WebGL";throw t?(t.message=e,new Error(JSON.stringify(t))):new Error(e)}this.painter=new Gu(r,this.transform),En.testSupport(r)}_onCooperativeGesture(e,t,r){return!t&&r<2&&(this._cooperativeGesturesScreen.classList.add("maplibregl-show"),setTimeout((()=>{this._cooperativeGesturesScreen.classList.remove("maplibregl-show")}),100)),!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(e){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||e,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(e){return this._update(),this._renderTaskQueue.add(e)}_cancelRenderFrame(e){this._renderTaskQueue.remove(e)}_render(e){let t=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(e),this._removed)return;let r=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let e=this.transform.zoom,i=ne.now();this.style.zoomHistory.update(e,i);let a=new ye(e,{now:i,fadeDuration:t,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),n=a.crossFadingFactor();(1!==n||n!==this._crossFadingFactor)&&(r=!0,this._crossFadingFactor=n),this.style.update(a)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain&&this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.updateElevation(this.terrain),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,t,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:!1,zooming:!1,moving:!1,fadeDuration:t,showPadding:this.showPadding}),this.fire(new z("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,Or.mark("load"),this.fire(new z("load"))),this.style&&(this.style.hasTransitions()||r)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let i=this._sourcesDirty||this._styleDirty||this._placementDirty;return i||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new z("idle")),this._loaded&&!this._fullyLoaded&&!i&&(this._fullyLoaded=!0,Or.mark("fullLoad")),this._fullyLoaded=!0,this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){var e;this._hash&&this._hash.remove();for(let e of this._controls)e.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),st.removeThrottleControl(this._imageQueueHandle),null==(e=this._resizeObserver)||e.disconnect();let t=this.painter.context.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),B.remove(this._canvasContainer),B.remove(this._controlContainer),this._cooperativeGestures&&this._destroyCooperativeGestures(),this._container.classList.remove("maplibregl-map"),Or.clearMetrics(),this._removed=!0,this.fire(new z("remove"))}triggerRepaintSync(){this._render(performance.now())}triggerRepaint(){this.style&&!this._frame&&(this._frame=ne.frame((e=>{Or.frame(e),this._frame=null,this._render(e)})))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(e){this._showTileBoundaries!==e&&(this._showTileBoundaries=e,this._update())}get showPadding(){return!!this._showPadding}set showPadding(e){this._showPadding!==e&&(this._showPadding=e,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(e){this._showCollisionBoxes!==e&&(this._showCollisionBoxes=e,e?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(e){this._showOverdrawInspector!==e&&(this._showOverdrawInspector=e,this._update())}get repaint(){return!!this._repaint}set repaint(e){this._repaint!==e&&(this._repaint=e,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(e){this._vertices=e,this._update()}get version(){return kE}getCameraTargetElevation(){return this.transform.elevation}};l(Uy,"Map");var fc=Uy;d(),d(),d();var Ny=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 t=this._moveFunction(...e);if(t.bearingDelta||t.pitchDelta||t.around||t.panDelta)return this._active=!0,t}dragStart(e,t){!this.isEnabled()||this._lastPoint||this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=t.length?t[0]:t,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,t){if(!this.isEnabled())return;let r=this._lastPoint;if(!r)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e))return void this.reset(e);let i=t.length?t[0]:t;return!this._moved&&i.dist(r)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=i,this._move(r,i))}dragEnd(e){!this.isEnabled()||!this._lastPoint||this._moveStateManager.isValidEndEvent(e)&&(this._moved&&B.suppressClick(),this.reset(e))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}};l(Ny,"DragHandler");var Ur=Ny;d();var DE=0,zE=2,FE={[DE]:1,[zE]:2};function BE(e,t){let r=FE[t];return void 0===e.buttons||(e.buttons&r)!==r}l(BE,"buttonNoLongerPressed");var Gy=class{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){let t=B.mouseButton(e);this._eventButton=t}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!BE(e,this._eventButton)}isValidEndEvent(e){return B.mouseButton(e)===this._eventButton}};l(Gy,"MouseMoveStateManager");var po=Gy,qy=class{constructor(){this._firstTouch=void 0}_isOneFingerTouch(e){return 1===e.targetTouches.length}_isSameTouchEvent(e){return e.targetTouches[0].identifier===this._firstTouch}startMove(e){let t=e.targetTouches[0].identifier;this._firstTouch=t}endMove(e){delete this._firstTouch}isValidStartEvent(e){return this._isOneFingerTouch(e)}isValidMoveEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}isValidEndEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}};l(qy,"OneFingerTouchMoveStateManager");var ho=qy,sw=0,lw=2,uw=l((e=>{e.mousedown=e.dragStart,e.mousemoveWindow=e.dragMove,e.mouseup=e.dragEnd,e.contextmenu=function(e){e.preventDefault()}}),"assignEvents"),cw=l((({enable:e,clickTolerance:t,bearingDegreesPerPixelMoved:r=.8})=>{let i=new po({checkCorrectEvent:l((e=>B.mouseButton(e)===sw&&e.ctrlKey||B.mouseButton(e)===lw),"checkCorrectEvent")});return new Ur({clickTolerance:t,move:l(((e,t)=>({bearingDelta:(t.x-e.x)*r})),"move"),moveStateManager:i,enable:e,assignEvents:uw})}),"generateMouseRotationHandler"),pw=l((({enable:e,clickTolerance:t,pitchDegreesPerPixelMoved:r=-.5})=>{let i=new po({checkCorrectEvent:l((e=>B.mouseButton(e)===sw&&e.ctrlKey||B.mouseButton(e)===lw),"checkCorrectEvent")});return new Ur({clickTolerance:t,move:l(((e,t)=>({pitchDelta:(t.y-e.y)*r})),"move"),moveStateManager:i,enable:e,assignEvents:uw})}),"generateMousePitchHandler");d();var hw=l((e=>{e.touchstart=e.dragStart,e.touchmoveWindow=e.dragMove,e.touchend=e.dragEnd}),"assignEvents"),fw=l((({enable:e,clickTolerance:t,bearingDegreesPerPixelMoved:r=.8})=>{let i=new ho;return new Ur({clickTolerance:t,move:l(((e,t)=>({bearingDelta:(t.x-e.x)*r})),"move"),moveStateManager:i,enable:e,assignEvents:hw})}),"generateOneFingerTouchRotationHandler"),mw=l((({enable:e,clickTolerance:t,pitchDegreesPerPixelMoved:r=-.5})=>{let i=new ho;return new Ur({clickTolerance:t,move:l(((e,t)=>({pitchDelta:(t.y-e.y)*r})),"move"),moveStateManager:i,enable:e,assignEvents:hw})}),"generateOneFingerTouchPitchHandler"),RE={showCompass:!0,showZoom:!0,visualizePitch:!1},Zy=class{constructor(e){this._updateZoomButtons=l((()=>{let e=this._map.getZoom(),t=e===this._map.getMaxZoom(),r=e===this._map.getMinZoom();this._zoomInButton.disabled=t,this._zoomOutButton.disabled=r,this._zoomInButton.setAttribute("aria-disabled",t.toString()),this._zoomOutButton.setAttribute("aria-disabled",r.toString())}),"_updateZoomButtons"),this._rotateCompassArrow=l((()=>{let e=this.options.visualizePitch?"scale(".concat(1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5),") rotateX(").concat(this._map.transform.pitch,"deg) rotateZ(").concat(this._map.transform.angle*(180/Math.PI),"deg)"):"rotate(".concat(this._map.transform.angle*(180/Math.PI),"deg)");this._compassIcon.style.transform=e}),"_rotateCompassArrow"),this._setButtonTitle=l(((e,t)=>{let r=this._map._getUIString("NavigationControl.".concat(t));e.title=r,e.setAttribute("aria-label",r)}),"_setButtonTitle"),this.options=R({},RE,e),this._container=B.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",(e=>e.preventDefault())),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",(e=>this._map.zoomIn({},{originalEvent:e}))),B.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",(e=>this._map.zoomOut({},{originalEvent:e}))),B.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",(e=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})})),this._compassIcon=B.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(e){return this._map=e,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new jy(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){B.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(e,t){let r=B.create("button",e,this._container);return r.type="button",r.addEventListener("click",t),r}};l(Zy,"NavigationControl");var mc=Zy,$y=class{constructor(e,t,r=!1){this.mousedown=l((e=>{this.startMouse(R({},e,{ctrlKey:!0,preventDefault:l((()=>e.preventDefault()),"preventDefault")}),B.mousePos(this.element,e)),B.addEventListener(window,"mousemove",this.mousemove),B.addEventListener(window,"mouseup",this.mouseup)}),"mousedown"),this.mousemove=l((e=>{this.moveMouse(e,B.mousePos(this.element,e))}),"mousemove"),this.mouseup=l((e=>{this.mouseRotate.dragEnd(e),this.mousePitch&&this.mousePitch.dragEnd(e),this.offTemp()}),"mouseup"),this.touchstart=l((e=>{1!==e.targetTouches.length?this.reset():(this._startPos=this._lastPos=B.touchPos(this.element,e.targetTouches)[0],this.startTouch(e,this._startPos),B.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),B.addEventListener(window,"touchend",this.touchend))}),"touchstart"),this.touchmove=l((e=>{1!==e.targetTouches.length?this.reset():(this._lastPos=B.touchPos(this.element,e.targetTouches)[0],this.moveTouch(e,this._lastPos))}),"touchmove"),this.touchend=l((e=>{0===e.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()}),"touchend"),this.reset=l((()=>{this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()}),"reset"),this._clickTolerance=10;let i=e.dragRotate._mouseRotate.getClickTolerance(),a=e.dragRotate._mousePitch.getClickTolerance();this.element=t,this.mouseRotate=cw({clickTolerance:i,enable:!0}),this.touchRotate=fw({clickTolerance:i,enable:!0}),this.map=e,r&&(this.mousePitch=pw({clickTolerance:a,enable:!0}),this.touchPitch=mw({clickTolerance:a,enable:!0})),B.addEventListener(t,"mousedown",this.mousedown),B.addEventListener(t,"touchstart",this.touchstart,{passive:!1}),B.addEventListener(t,"touchcancel",this.reset)}startMouse(e,t){this.mouseRotate.dragStart(e,t),this.mousePitch&&this.mousePitch.dragStart(e,t),B.disableDrag()}startTouch(e,t){this.touchRotate.dragStart(e,t),this.touchPitch&&this.touchPitch.dragStart(e,t),B.disableDrag()}moveMouse(e,t){let r=this.map,{bearingDelta:i}=this.mouseRotate.dragMove(e,t)||{};if(i&&r.setBearing(r.getBearing()+i),this.mousePitch){let{pitchDelta:i}=this.mousePitch.dragMove(e,t)||{};i&&r.setPitch(r.getPitch()+i)}}moveTouch(e,t){let r=this.map,{bearingDelta:i}=this.touchRotate.dragMove(e,t)||{};if(i&&r.setBearing(r.getBearing()+i),this.touchPitch){let{pitchDelta:i}=this.touchPitch.dragMove(e,t)||{};i&&r.setPitch(r.getPitch()+i)}}off(){let e=this.element;B.removeEventListener(e,"mousedown",this.mousedown),B.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),B.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),B.removeEventListener(window,"touchend",this.touchend),B.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){B.enableDrag(),B.removeEventListener(window,"mousemove",this.mousemove),B.removeEventListener(window,"mouseup",this.mouseup),B.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),B.removeEventListener(window,"touchend",this.touchend)}};l($y,"MouseRotateWrapper");var Nr,jy=$y;function dw(e,t=!1){void 0===Nr||t?void 0!==window.navigator.permissions?window.navigator.permissions.query({name:"geolocation"}).then((t=>{Nr="denied"!==t.state,e(Nr)})).catch((()=>{Nr=!!window.navigator.geolocation,e(Nr)})):(Nr=!!window.navigator.geolocation,e(Nr)):e(Nr)}d(),d(),l(dw,"checkGeolocationSupport"),d();var gc=se(Pe(),1);function dc(e,t,r){if(e=new re(e.lng,e.lat),t){let i=new re(e.lng-360,e.lat),a=new re(e.lng+360,e.lat),n=r.locationPoint(e).distSqr(t);r.locationPoint(i).distSqr(t)<n?e=i:r.locationPoint(a).distSqr(t)<n&&(e=a)}for(;Math.abs(e.lng-r.center.lng)>180;){let t=r.locationPoint(e);if(t.x>=0&&t.y>=0&&t.x<=r.width&&t.y<=r.height)break;e.lng>r.center.lng?e.lng-=360:e.lng+=360}return e}d(),l(dc,"smartWrap"),d();var fo={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function yc(e,t,r){let i=e.classList;for(let e in fo)i.remove("maplibregl-".concat(r,"-anchor-").concat(e));i.add("maplibregl-".concat(r,"-anchor-").concat(t))}l(yc,"applyAnchorClass");var Hy=class extends de{constructor(e){if(super(),this._onKeyPress=l((e=>{let t=e.code,r=e.charCode||e.keyCode;("Space"===t||"Enter"===t||32===r||13===r)&&this.togglePopup()}),"_onKeyPress"),this._onMapClick=l((e=>{let t=e.originalEvent.target,r=this._element;this._popup&&(t===r||r.contains(t))&&this.togglePopup()}),"_onMapClick"),this._update=l((e=>{if(!this._map)return;this._map.transform.renderWorldCopies&&(this._lngLat=dc(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let t="";"viewport"===this._rotationAlignment||"auto"===this._rotationAlignment?t="rotateZ(".concat(this._rotation,"deg)"):"map"===this._rotationAlignment&&(t="rotateZ(".concat(this._rotation-this._map.getBearing(),"deg)"));let r="";"viewport"===this._pitchAlignment||"auto"===this._pitchAlignment?r="rotateX(0deg)":"map"===this._pitchAlignment&&(r="rotateX(".concat(this._map.getPitch(),"deg)")),(!e||"moveend"===e.type)&&(this._pos=this._pos.round()),B.setTransform(this._element,"".concat(fo[this._anchor]," translate(").concat(this._pos.x,"px, ").concat(this._pos.y,"px) ").concat(r," ").concat(t)),this._map.terrain&&!this._opacityTimeout&&(this._opacityTimeout=setTimeout((()=>{let e=this._map.unproject(this._pos),t=40075016.686*Math.abs(Math.cos(this._lngLat.lat*Math.PI/180))/Math.pow(2,this._map.transform.tileZoom+8);this._element.style.opacity=e.distanceTo(this._lngLat)>20*t?"0.2":"1.0",this._opacityTimeout=null}),100))}),"_update"),this._onMove=l((e=>{if(!this._isDragging){let t=this._clickTolerance||this._map._clickTolerance;this._isDragging=e.point.dist(this._pointerdownPos)>=t}this._isDragging&&(this._pos=e.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new z("dragstart"))),this.fire(new z("drag")))}),"_onMove"),this._onUp=l((()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),"active"===this._state&&this.fire(new z("dragend")),this._state="inactive"}),"_onUp"),this._addDragHandler=l((e=>{this._element.contains(e.originalEvent.target)&&(e.preventDefault(),this._positionDelta=e.point.sub(this._pos).add(this._offset),this._pointerdownPos=e.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))}),"_addDragHandler"),this._anchor=e&&e.anchor||"center",this._color=e&&e.color||"#3FB1CE",this._scale=e&&e.scale||1,this._draggable=e&&e.draggable||!1,this._clickTolerance=e&&e.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=e&&e.rotation||0,this._rotationAlignment=e&&e.rotationAlignment||"auto",this._pitchAlignment=e&&e.pitchAlignment&&"auto"!==e.pitchAlignment?e.pitchAlignment:this._rotationAlignment,e&&e.element)this._element=e.element,this._offset=gc.default.convert(e&&e.offset||[0,0]);else{this._defaultMarker=!0,this._element=B.create("div"),this._element.setAttribute("aria-label","Map marker");let t=B.createNS("http://www.w3.org/2000/svg","svg"),r=41,i=27;t.setAttributeNS(null,"display","block"),t.setAttributeNS(null,"height","".concat(r,"px")),t.setAttributeNS(null,"width","".concat(i,"px")),t.setAttributeNS(null,"viewBox","0 0 ".concat(i," ").concat(r));let a=B.createNS("http://www.w3.org/2000/svg","g");a.setAttributeNS(null,"stroke","none"),a.setAttributeNS(null,"stroke-width","1"),a.setAttributeNS(null,"fill","none"),a.setAttributeNS(null,"fill-rule","evenodd");let n=B.createNS("http://www.w3.org/2000/svg","g");n.setAttributeNS(null,"fill-rule","nonzero");let s=B.createNS("http://www.w3.org/2000/svg","g");s.setAttributeNS(null,"transform","translate(3.0, 29.0)"),s.setAttributeNS(null,"fill","#000000");let o=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(let e of o){let t=B.createNS("http://www.w3.org/2000/svg","ellipse");t.setAttributeNS(null,"opacity","0.04"),t.setAttributeNS(null,"cx","10.5"),t.setAttributeNS(null,"cy","5.80029008"),t.setAttributeNS(null,"rx",e.rx),t.setAttributeNS(null,"ry",e.ry),s.appendChild(t)}let l=B.createNS("http://www.w3.org/2000/svg","g");l.setAttributeNS(null,"fill",this._color);let u=B.createNS("http://www.w3.org/2000/svg","path");u.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),l.appendChild(u);let c=B.createNS("http://www.w3.org/2000/svg","g");c.setAttributeNS(null,"opacity","0.25"),c.setAttributeNS(null,"fill","#000000");let h=B.createNS("http://www.w3.org/2000/svg","path");h.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),c.appendChild(h);let p=B.createNS("http://www.w3.org/2000/svg","g");p.setAttributeNS(null,"transform","translate(6.0, 7.0)"),p.setAttributeNS(null,"fill","#FFFFFF");let d=B.createNS("http://www.w3.org/2000/svg","g");d.setAttributeNS(null,"transform","translate(8.0, 8.0)");let f=B.createNS("http://www.w3.org/2000/svg","circle");f.setAttributeNS(null,"fill","#000000"),f.setAttributeNS(null,"opacity","0.25"),f.setAttributeNS(null,"cx","5.5"),f.setAttributeNS(null,"cy","5.5"),f.setAttributeNS(null,"r","5.4999962");let m=B.createNS("http://www.w3.org/2000/svg","circle");m.setAttributeNS(null,"fill","#FFFFFF"),m.setAttributeNS(null,"cx","5.5"),m.setAttributeNS(null,"cy","5.5"),m.setAttributeNS(null,"r","5.4999962"),d.appendChild(f),d.appendChild(m),n.appendChild(s),n.appendChild(l),n.appendChild(c),n.appendChild(p),n.appendChild(d),t.appendChild(n),t.setAttributeNS(null,"height","".concat(r*this._scale,"px")),t.setAttributeNS(null,"width","".concat(i*this._scale,"px")),this._element.appendChild(t),this._offset=gc.default.convert(e&&e.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",(e=>{e.preventDefault()})),this._element.addEventListener("mousedown",(e=>{e.preventDefault()})),yc(this._element,this._anchor,"marker"),e&&e.className)for(let t of e.className.split(" "))this._element.classList.add(t);this._popup=null}addTo(e){return this.remove(),this._map=e,e.getCanvasContainer().appendChild(this._element),e.on("move",this._update),e.on("moveend",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),B.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=re.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){let t=Math.sqrt(Math.pow(13.5,2)/2);e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[t,-1*(24.6+t)],"bottom-right":[-t,-1*(24.6+t)],left:[13.5,-24.6],right:[-13.5,-24.6]}:this._offset}this._popup=e,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}getPopup(){return this._popup}togglePopup(){let e=this._popup;return e?(e.isOpen()?e.remove():e.addTo(this._map),this):this}getOffset(){return this._offset}setOffset(e){return this._offset=gc.default.convert(e),this._update(),this}addClassName(e){this._element.classList.add(e)}removeClassName(e){this._element.classList.remove(e)}toggleClassName(e){return this._element.classList.toggle(e)}setDraggable(e){return this._draggable=!!e,this._map&&(e?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e&&"auto"!==e?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}};l(Hy,"Marker");var vi=Hy,OE={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},xc=0,mo=!1,Wy=class extends de{constructor(e){super(),this._onSuccess=l((e=>{if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new z("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error("Unexpected watchState ".concat(this._watchState))}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(e),(!this.options.trackUserLocation||"ACTIVE_LOCK"===this._watchState)&&this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new z("geolocate",e)),this._finish()}}),"_onSuccess"),this._updateCamera=l((e=>{let t=new re(e.coords.longitude,e.coords.latitude),r=e.coords.accuracy,i=R({bearing:this._map.getBearing()},this.options.fitBoundsOptions),a=ut.fromLngLat(t,r);this._map.fitBounds(a,i,{geolocateSource:!0})}),"_updateCamera"),this._updateMarker=l((e=>{if(e){let t=new re(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(t).addTo(this._map),this._userLocationDotMarker.setLngLat(t).addTo(this._map),this._accuracy=e.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}),"_updateMarker"),this._onZoom=l((()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}),"_onZoom"),this._onError=l((e=>{if(this._map){if(this.options.trackUserLocation)if(1===e.code){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;let e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===e.code&&mo)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new z("error",e)),this._finish()}}),"_onError"),this._finish=l((()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}),"_finish"),this._setupUI=l((e=>{if(this._map){if(this._container.addEventListener("contextmenu",(e=>e.preventDefault())),this._geolocateButton=B.create("button","maplibregl-ctrl-geolocate",this._container),B.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",!1===e){Ce("Geolocation support is not available so the GeolocateControl will be disabled.");let e=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}else{let e=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=e,this._geolocateButton.setAttribute("aria-label",e)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=B.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new vi({element:this._dotElement}),this._circleElement=B.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new vi({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",(e=>{let t=e.originalEvent&&"resize"===e.originalEvent.type;!e.geolocateSource&&"ACTIVE_LOCK"===this._watchState&&!t&&(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new z("trackuserlocationend")))}))}}),"_setupUI"),this.options=R({},OE,e)}onAdd(e){return this._map=e,this._container=B.create("div","maplibregl-ctrl maplibregl-ctrl-group"),dw(this._setupUI),this._container}onRemove(){void 0!==this._geolocationWatchID&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),B.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,xc=0,mo=!1}_isOutOfMapMaxBounds(e){let t=this._map.getMaxBounds(),r=e.coords;return t&&(r.longitude<t.getWest()||r.longitude>t.getEast()||r.latitude<t.getSouth()||r.latitude>t.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error("Unexpected watchState ".concat(this._watchState))}}_updateCircleRadius(){let e=this._map.getBounds(),t=e.getSouthEast(),r=e.getNorthEast(),i=t.distanceTo(r),a=this._map._container.clientHeight,n=Math.ceil(this._accuracy/(i/a)*2);this._circleElement.style.width="".concat(n,"px"),this._circleElement.style.height="".concat(n,"px")}trigger(){if(!this._setup)return Ce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new z("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":xc--,mo=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new z("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new z("trackuserlocationstart"));break;default:throw new Error("Unexpected watchState ".concat(this._watchState))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error("Unexpected watchState ".concat(this._watchState))}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let e;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),++xc>1?(e={maximumAge:6e5,timeout:0},mo=!0):(e=this.options.positionOptions,mo=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,e)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}};l(Wy,"GeolocateControl");var bc=Wy;d();var VE={maxWidth:100,unit:"metric"},Xy=class{constructor(e){this._onMove=l((()=>{yw(this._map,this._container,this.options)}),"_onMove"),this.setUnit=l((e=>{this.options.unit=e,yw(this._map,this._container,this.options)}),"setUnit"),this.options=R({},VE,e)}getDefaultPosition(){return"bottom-left"}onAdd(e){return this._map=e,this._container=B.create("div","maplibregl-ctrl maplibregl-ctrl-scale",e.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){B.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}};l(Xy,"ScaleControl");var _c=Xy;function yw(e,t,r){let i=r&&r.maxWidth||100,a=e._container.clientHeight/2,n=e.unproject([0,a]),s=e.unproject([i,a]),o=n.distanceTo(s);if(r&&"imperial"===r.unit){let r=3.2808*o;if(r>5280){yo(t,i,r/5280,e._getUIString("ScaleControl.Miles"))}else yo(t,i,r,e._getUIString("ScaleControl.Feet"))}else if(r&&"nautical"===r.unit){yo(t,i,o/1852,e._getUIString("ScaleControl.NauticalMiles"))}else o>=1e3?yo(t,i,o/1e3,e._getUIString("ScaleControl.Kilometers")):yo(t,i,o,e._getUIString("ScaleControl.Meters"))}function yo(e,t,r,i){let a=NE(r),n=a/r;e.style.width="".concat(t*n,"px"),e.innerHTML="".concat(a,"&nbsp;").concat(i)}function UE(e){let t=Math.pow(10,Math.ceil(-Math.log(e)/Math.LN10));return Math.round(e*t)/t}function NE(e){let t=Math.pow(10,"".concat(Math.floor(e)).length-1),r=e/t;return r=r>=10?10:r>=5?5:r>=3?3:r>=2?2:r>=1?1:UE(r),t*r}l(yw,"updateScale"),l(yo,"setScale"),l(UE,"getDecimalRoundNum"),l(NE,"getRoundNum"),d();var Ky=class extends de{constructor(e={}){super(),this._onFullscreenChange=l((()=>{(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&this._handleFullscreenChange()}),"_onFullscreenChange"),this._onClickFullscreen=l((()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()}),"_onClickFullscreen"),this._fullscreen=!1,e&&e.container&&(e.container instanceof HTMLElement?this._container=e.container:Ce("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(e){return this._map=e,this._container||(this._container=this._map.getContainer()),this._controlContainer=B.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){B.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){let e=this._fullscreenButton=B.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);B.create("span","maplibregl-ctrl-icon",e).setAttribute("aria-hidden","true"),e.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){let e=this._getTitle();this._fullscreenButton.setAttribute("aria-label",e),this._fullscreenButton.title=e}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new z("fullscreenstart")),this._map._cooperativeGestures&&(this._prevCooperativeGestures=this._map._cooperativeGestures,this._map.setCooperativeGestures())):(this.fire(new z("fullscreenend")),this._prevCooperativeGestures&&(this._map.setCooperativeGestures(this._prevCooperativeGestures),delete this._prevCooperativeGestures))}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}};l(Ky,"FullscreenControl");var vc=Ky;d();var Yy=class{constructor(e){this._toggleTerrain=l((()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()}),"_toggleTerrain"),this._updateTerrainIcon=l((()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))}),"_updateTerrainIcon"),this.options=e}onAdd(e){return this._map=e,this._container=B.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=B.create("button","maplibregl-ctrl-terrain",this._container),B.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){B.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}};l(Yy,"TerrainControl");var wc=Yy;d();var $e=se(Pe(),1),GE={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},qE=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", "),Jy=class extends de{constructor(e){super(),this.remove=l((()=>(this._content&&B.remove(this._content),this._container&&(B.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new z("close")),this)),"remove"),this._onMouseUp=l((e=>{this._update(e.point)}),"_onMouseUp"),this._onMouseMove=l((e=>{this._update(e.point)}),"_onMouseMove"),this._onDrag=l((e=>{this._update(e.point)}),"_onDrag"),this._update=l((e=>{let t=this._lngLat||this._trackPointer;if(!this._map||!t||!this._content)return;if(!this._container){if(this._container=B.create("div","maplibregl-popup",this._map.getContainer()),this._tip=B.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(let e of this.options.className.split(" "))this._container.classList.add(e);this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=dc(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!e)return;let r=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat),i=this.options.anchor,a=gw(this.options.offset);if(!i){let e,t=this._container.offsetWidth,n=this._container.offsetHeight;e=r.y+a.bottom.y<n?["top"]:r.y>this._map.transform.height-n?["bottom"]:[],r.x<t/2?e.push("left"):r.x>this._map.transform.width-t/2&&e.push("right"),i=0===e.length?"bottom":e.join("-")}let n=r.add(a[i]).round();B.setTransform(this._container,"".concat(fo[i]," translate(").concat(n.x,"px,").concat(n.y,"px)")),yc(this._container,i,"popup")}),"_update"),this._onClose=l((()=>{this.remove()}),"_onClose"),this.options=R(Object.create(GE),e)}addTo(e){return this._map&&this.remove(),this._map=e,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new z("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=re.convert(e),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(e){return this.setDOMContent(document.createTextNode(e))}setHTML(e){let t,r=document.createDocumentFragment(),i=document.createElement("body");for(i.innerHTML=e;t=i.firstChild,t;)r.appendChild(t);return this.setDOMContent(r)}getMaxWidth(){var e;return null==(e=this._container)?void 0:e.style.maxWidth}setMaxWidth(e){return this.options.maxWidth=e,this._update(),this}setDOMContent(e){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=B.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(e),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(e){this._container&&this._container.classList.add(e)}removeClassName(e){this._container&&this._container.classList.remove(e)}setOffset(e){return this.options.offset=e,this._update(),this}toggleClassName(e){if(this._container)return this._container.classList.toggle(e)}_createCloseButton(){this.options.closeButton&&(this._closeButton=B.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;let e=this._container.querySelector(qE);e&&e.focus()}};l(Jy,"Popup");var Sc=Jy;function gw(e){if(e){if("number"==typeof e){let t=Math.round(Math.sqrt(.5*Math.pow(e,2)));return{center:new $e.default(0,0),top:new $e.default(0,e),"top-left":new $e.default(t,t),"top-right":new $e.default(-t,t),bottom:new $e.default(0,-e),"bottom-left":new $e.default(t,-t),"bottom-right":new $e.default(-t,-t),left:new $e.default(e,0),right:new $e.default(-e,0)}}if(e instanceof $e.default||Array.isArray(e)){let t=$e.default.convert(e);return{center:t,top:t,"top-left":t,"top-right":t,bottom:t,"bottom-left":t,"bottom-right":t,left:t,right:t}}return{center:$e.default.convert(e.center||[0,0]),top:$e.default.convert(e.top||[0,0]),"top-left":$e.default.convert(e["top-left"]||[0,0]),"top-right":$e.default.convert(e["top-right"]||[0,0]),bottom:$e.default.convert(e.bottom||[0,0]),"bottom-left":$e.default.convert(e["bottom-left"]||[0,0]),"bottom-right":$e.default.convert(e["bottom-right"]||[0,0]),left:$e.default.convert(e.left||[0,0]),right:$e.default.convert(e.right||[0,0])}}return gw(new $e.default(0,0))}l(gw,"normalizeOffset");var bw=se(Pe(),1);d();var xw={extend:(e,...t)=>R(e,...t),run(e){e()},logToElement(e,t=!1,r="log"){let i=window.document.getElementById(r);i&&(t&&(i.innerHTML=""),i.innerHTML+="<br>".concat(e))}},jE=xo.version,Se=class{static get version(){return jE}static get workerCount(){return Br.workerCount}static set workerCount(e){Br.workerCount=e}static get maxParallelImageRequests(){return Je.MAX_PARALLEL_IMAGE_REQUESTS}static set maxParallelImageRequests(e){Je.MAX_PARALLEL_IMAGE_REQUESTS=e}static get workerUrl(){return Je.WORKER_URL}static set workerUrl(e){Je.WORKER_URL=e}static addProtocol(e,t){Je.REGISTERED_PROTOCOLS[e]=t}static removeProtocol(e){delete Je.REGISTERED_PROTOCOLS[e]}};l(Se,"MapLibreGL"),Se.Map=fc,Se.NavigationControl=mc,Se.GeolocateControl=bc,Se.AttributionControl=Sn,Se.LogoControl=Pn,Se.ScaleControl=_c,Se.FullscreenControl=vc,Se.TerrainControl=wc,Se.Popup=Sc,Se.Marker=vi,Se.Style=Rr,Se.LngLat=re,Se.LngLatBounds=ut,Se.Point=bw.default,Se.MercatorCoordinate=ze,Se.Evented=de,Se.AJAXError=fr,Se.config=Je,Se.CanvasSource=yn,Se.GeoJSONSource=mn,Se.ImageSource=It,Se.RasterDEMTileSource=fn,Se.RasterTileSource=zr,Se.VectorTileSource=cn,Se.VideoSource=dn,Se.setRTLTextPlugin=Cx,Se.getRTLTextPluginStatus=Qn,Se.prewarm=bv,Se.clearPrewarmedResources=_v;var Pc=Se;xw.extend(Pc,{isSafari:jr,getPerformanceMetrics:Or.getPerformanceMetrics});var rie=Pc;export{rie as default};