@mappedin/mappedin-js 6.0.1-beta.47 → 6.0.1-beta.49

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 (59) hide show
  1. package/THIRD_PARTY_LICENSES.txt +12048 -1731
  2. package/lib/esm/GLTFExporter-ESCDGZUC.js +2 -0
  3. package/lib/esm/GLTFExporter-ESCDGZUC.js.map +7 -0
  4. package/lib/esm/{GLTFLoader-YCEKYYW3.js → GLTFLoader-KRE6VVI2.js} +2 -1
  5. package/lib/esm/GLTFLoader-KRE6VVI2.js.map +7 -0
  6. package/lib/esm/{browser-6R2QCUOI.js → browser-BKM6BTVQ.js} +2 -1
  7. package/lib/esm/browser-BKM6BTVQ.js.map +7 -0
  8. package/lib/esm/{chunk-KR33DBLD.js → chunk-34JGYGBQ.js} +2 -1
  9. package/lib/esm/chunk-34JGYGBQ.js.map +7 -0
  10. package/lib/esm/chunk-5N73RBNE.js +2 -0
  11. package/lib/esm/chunk-5N73RBNE.js.map +7 -0
  12. package/lib/esm/chunk-AHC6OWNT.js +2 -0
  13. package/lib/esm/chunk-AHC6OWNT.js.map +7 -0
  14. package/lib/esm/chunk-BBNTGIFB.js +578 -0
  15. package/lib/esm/chunk-BBNTGIFB.js.map +7 -0
  16. package/lib/esm/chunk-EBEZBJTY.js +2 -0
  17. package/lib/esm/chunk-EBEZBJTY.js.map +7 -0
  18. package/lib/esm/chunk-QSDIHKLQ.js +3820 -0
  19. package/lib/esm/chunk-QSDIHKLQ.js.map +7 -0
  20. package/lib/esm/chunk-TQZZUEDW.js +2229 -0
  21. package/lib/esm/chunk-TQZZUEDW.js.map +7 -0
  22. package/lib/esm/fonts/roboto-regular.ttf +0 -0
  23. package/lib/esm/index.css +2 -1
  24. package/lib/esm/index.css.map +7 -0
  25. package/lib/esm/index.d.ts +235 -166
  26. package/lib/esm/index.js +2 -1
  27. package/lib/esm/index.js.map +7 -0
  28. package/lib/esm/inspector-S63NMDZZ.css +2 -0
  29. package/lib/esm/inspector-S63NMDZZ.css.map +7 -0
  30. package/lib/esm/inspector-UVCVD35T.js +483 -0
  31. package/lib/esm/inspector-UVCVD35T.js.map +7 -0
  32. package/lib/esm/internal-WH523TQS.css +2 -0
  33. package/lib/esm/internal-WH523TQS.css.map +7 -0
  34. package/lib/esm/internal-ZOHXUIA6.js +2 -0
  35. package/lib/esm/internal-ZOHXUIA6.js.map +7 -0
  36. package/lib/esm/outdoor-context-v4-B6ZFZFG7.js +2 -0
  37. package/lib/esm/outdoor-context-v4-B6ZFZFG7.js.map +7 -0
  38. package/lib/esm/{roboto-regular-JRVF4TIR.js → roboto-regular-25PMWR2T.js} +2 -1
  39. package/lib/esm/roboto-regular-25PMWR2T.js.map +7 -0
  40. package/lib/esm/text3d-ACVNKUMC.js +253 -0
  41. package/lib/esm/text3d-ACVNKUMC.js.map +7 -0
  42. package/lib/esm/workers/collision-worker.csp.js +1 -1
  43. package/lib/esm/workers/maplibre-worker.csp.js +2 -1
  44. package/lib/index-rn.js +649 -0
  45. package/lib/index.css +2 -1
  46. package/package.json +2 -2
  47. package/lib/esm/GLTFExporter-TZEIALSW.js +0 -1
  48. package/lib/esm/chunk-DNBHISVY.js +0 -1
  49. package/lib/esm/chunk-KVKD4E33.js +0 -1
  50. package/lib/esm/chunk-MENDLOSO.js +0 -1
  51. package/lib/esm/chunk-QRWMPXER.js +0 -1
  52. package/lib/esm/chunk-TVALVOG4.js +0 -1
  53. package/lib/esm/chunk-UIDBSU4C.js +0 -1
  54. package/lib/esm/inspector-CV34C4XG.js +0 -1
  55. package/lib/esm/inspector-WWR77OPX.css +0 -1
  56. package/lib/esm/internal-M7DPGYMI.css +0 -1
  57. package/lib/esm/internal-YXEVD377.js +0 -1
  58. package/lib/esm/outdoor-context-v4-IEFB4X2Q.js +0 -1
  59. package/lib/esm/text3d-RZEC5VQO.js +0 -1
@@ -0,0 +1,578 @@
1
+ import{a as m}from"./chunk-5N73RBNE.js";import{c as bt,d as xi,e as ne}from"./chunk-AHC6OWNT.js";var ye=bt((BM,Xh)=>{"use strict";m();Xh.exports=bi;function bi(r,e){this.x=r,this.y=e}bi.prototype={clone:function(){return new bi(this.x,this.y)},add:function(r){return this.clone()._add(r)},sub:function(r){return this.clone()._sub(r)},multByPoint:function(r){return this.clone()._multByPoint(r)},divByPoint:function(r){return this.clone()._divByPoint(r)},mult:function(r){return this.clone()._mult(r)},div:function(r){return this.clone()._div(r)},rotate:function(r){return this.clone()._rotate(r)},rotateAround:function(r,e){return this.clone()._rotateAround(r,e)},matMult:function(r){return this.clone()._matMult(r)},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(r){return this.x===r.x&&this.y===r.y},dist:function(r){return Math.sqrt(this.distSqr(r))},distSqr:function(r){var e=r.x-this.x,t=r.y-this.y;return e*e+t*t},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(r){return Math.atan2(this.y-r.y,this.x-r.x)},angleWith:function(r){return this.angleWithSep(r.x,r.y)},angleWithSep:function(r,e){return Math.atan2(this.x*e-this.y*r,this.x*r+this.y*e)},_matMult:function(r){var e=r[0]*this.x+r[1]*this.y,t=r[2]*this.x+r[3]*this.y;return this.x=e,this.y=t,this},_add:function(r){return this.x+=r.x,this.y+=r.y,this},_sub:function(r){return this.x-=r.x,this.y-=r.y,this},_mult:function(r){return this.x*=r,this.y*=r,this},_div:function(r){return this.x/=r,this.y/=r,this},_multByPoint:function(r){return this.x*=r.x,this.y*=r.y,this},_divByPoint:function(r){return this.x/=r.x,this.y/=r.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var r=this.y;return this.y=this.x,this.x=-r,this},_rotate:function(r){var e=Math.cos(r),t=Math.sin(r),i=e*this.x-t*this.y,n=t*this.x+e*this.y;return this.x=i,this.y=n,this},_rotateAround:function(r,e){var t=Math.cos(r),i=Math.sin(r),n=e.x+t*(this.x-e.x)-i*(this.y-e.y),o=e.y+i*(this.x-e.x)+t*(this.y-e.y);return this.x=n,this.y=o,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}};bi.convert=function(r){return r instanceof bi?r:Array.isArray(r)?new bi(r[0],r[1]):r}});var Yh=bt((VM,Jh)=>{"use strict";m();Jh.exports=Kh;function Kh(r,e,t,i){this.cx=3*r,this.bx=3*(t-r)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(i-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=r,this.p1y=e,this.p2x=t,this.p2y=i}Kh.prototype={sampleCurveX:function(r){return((this.ax*r+this.bx)*r+this.cx)*r},sampleCurveY:function(r){return((this.ay*r+this.by)*r+this.cy)*r},sampleCurveDerivativeX:function(r){return(3*this.ax*r+2*this.bx)*r+this.cx},solveCurveX:function(r,e){if(e===void 0&&(e=1e-6),r<0)return 0;if(r>1)return 1;for(var t=r,i=0;i<8;i++){var n=this.sampleCurveX(t)-r;if(Math.abs(n)<e)return t;var o=this.sampleCurveDerivativeX(t);if(Math.abs(o)<1e-6)break;t=t-n/o}var a=0,s=1;for(t=r,i=0;i<20&&(n=this.sampleCurveX(t),!(Math.abs(n-r)<e));i++)r>n?a=t:s=t,t=(s-a)*.5+a;return t},solve:function(r,e){return this.sampleCurveY(this.solveCurveX(r,e))}}});var $m=bt((tE,mp)=>{m();function _1(r,e){var t,i,n,o,a,s,l,u,c,p;for(t=r.length&3,i=r.length-t,n=e,a=3432918353,l=461845907,p=0;p<i;)c=r.charCodeAt(p)&255|(r.charCodeAt(++p)&255)<<8|(r.charCodeAt(++p)&255)<<16|(r.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,n^=c,n=n<<13|n>>>19,o=(n&65535)*5+(((n>>>16)*5&65535)<<16)&4294967295,n=(o&65535)+27492+(((o>>>16)+58964&65535)<<16);switch(c=0,t){case 3:c^=(r.charCodeAt(p+2)&255)<<16;case 2:c^=(r.charCodeAt(p+1)&255)<<8;case 1:c^=r.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,n^=c}return n^=r.length,n^=n>>>16,n=(n&65535)*2246822507+(((n>>>16)*2246822507&65535)<<16)&4294967295,n^=n>>>13,n=(n&65535)*3266489909+(((n>>>16)*3266489909&65535)<<16)&4294967295,n^=n>>>16,n>>>0}typeof mp<"u"&&(mp.exports=_1)});var qm=bt((iE,dp)=>{m();function v1(r,e){for(var t=r.length,i=e^t,n=0,o;t>=4;)o=r.charCodeAt(n)&255|(r.charCodeAt(++n)&255)<<8|(r.charCodeAt(++n)&255)<<16|(r.charCodeAt(++n)&255)<<24,o=(o&65535)*1540483477+(((o>>>16)*1540483477&65535)<<16),o^=o>>>24,o=(o&65535)*1540483477+(((o>>>16)*1540483477&65535)<<16),i=(i&65535)*1540483477+(((i>>>16)*1540483477&65535)<<16)^o,t-=4,++n;switch(t){case 3:i^=(r.charCodeAt(n+2)&255)<<16;case 2:i^=(r.charCodeAt(n+1)&255)<<8;case 1:i^=r.charCodeAt(n)&255,i=(i&65535)*1540483477+(((i>>>16)*1540483477&65535)<<16)}return i^=i>>>13,i=(i&65535)*1540483477+(((i>>>16)*1540483477&65535)<<16),i^=i>>>15,i>>>0}typeof dp!==void 0&&(dp.exports=v1)});var yp=bt((oE,Bs)=>{m();var jm=$m(),w1=qm();Bs.exports=jm;Bs.exports.murmur3=jm;Bs.exports.murmur2=w1});var Ip=bt((SL,Mp)=>{"use strict";m();Mp.exports=Ks;Mp.exports.default=Ks;function Ks(r,e,t){t=t||2;var i=e&&e.length,n=i?e[0]*t:r.length,o=Kd(r,0,n,t,!0),a=[];if(!o||o.next===o.prev)return a;var s,l,u,c,p,h,f;if(i&&(o=L2(r,e,o,t)),r.length>80*t){s=u=r[0],l=c=r[1];for(var d=t;d<n;d+=t)p=r[d],h=r[d+1],p<s&&(s=p),h<l&&(l=h),p>u&&(u=p),h>c&&(c=h);f=Math.max(u-s,c-l),f=f!==0?32767/f:0}return wo(o,a,t,s,l,f,0),a}function Kd(r,e,t,i,n){var o,a;if(n===Ap(r,e,t,i)>0)for(o=e;o<t;o+=i)a=Xd(o,r[o],r[o+1],a);else for(o=t-i;o>=e;o-=i)a=Xd(o,r[o],r[o+1],a);return a&&Js(a,a.next)&&(Po(a),a=a.next),a}function oi(r,e){if(!r)return r;e||(e=r);var t=r,i;do if(i=!1,!t.steiner&&(Js(t,t.next)||Be(t.prev,t,t.next)===0)){if(Po(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function wo(r,e,t,i,n,o,a){if(r){!a&&o&&B2(r,i,n,o);for(var s=r,l,u;r.prev!==r.next;){if(l=r.prev,u=r.next,o?C2(r,i,n,o):I2(r)){e.push(l.i/t|0),e.push(r.i/t|0),e.push(u.i/t|0),Po(r),r=u.next,s=u.next;continue}if(r=u,r===s){a?a===1?(r=E2(oi(r),e,t),wo(r,e,t,i,n,o,2)):a===2&&k2(r,e,t,i,n,o):wo(oi(r),e,t,i,n,o,1);break}}}}function I2(r){var e=r.prev,t=r,i=r.next;if(Be(e,t,i)>=0)return!1;for(var n=e.x,o=t.x,a=i.x,s=e.y,l=t.y,u=i.y,c=n<o?n<a?n:a:o<a?o:a,p=s<l?s<u?s:u:l<u?l:u,h=n>o?n>a?n:a:o>a?o:a,f=s>l?s>u?s:u:l>u?l:u,d=i.next;d!==e;){if(d.x>=c&&d.x<=h&&d.y>=p&&d.y<=f&&Zi(n,s,o,l,a,u,d.x,d.y)&&Be(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function C2(r,e,t,i){var n=r.prev,o=r,a=r.next;if(Be(n,o,a)>=0)return!1;for(var s=n.x,l=o.x,u=a.x,c=n.y,p=o.y,h=a.y,f=s<l?s<u?s:u:l<u?l:u,d=c<p?c<h?c:h:p<h?p:h,y=s>l?s>u?s:u:l>u?l:u,g=c>p?c>h?c:h:p>h?p:h,x=Pp(f,d,e,t,i),v=Pp(y,g,e,t,i),b=r.prevZ,w=r.nextZ;b&&b.z>=x&&w&&w.z<=v;){if(b.x>=f&&b.x<=y&&b.y>=d&&b.y<=g&&b!==n&&b!==a&&Zi(s,c,l,p,u,h,b.x,b.y)&&Be(b.prev,b,b.next)>=0||(b=b.prevZ,w.x>=f&&w.x<=y&&w.y>=d&&w.y<=g&&w!==n&&w!==a&&Zi(s,c,l,p,u,h,w.x,w.y)&&Be(w.prev,w,w.next)>=0))return!1;w=w.nextZ}for(;b&&b.z>=x;){if(b.x>=f&&b.x<=y&&b.y>=d&&b.y<=g&&b!==n&&b!==a&&Zi(s,c,l,p,u,h,b.x,b.y)&&Be(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;w&&w.z<=v;){if(w.x>=f&&w.x<=y&&w.y>=d&&w.y<=g&&w!==n&&w!==a&&Zi(s,c,l,p,u,h,w.x,w.y)&&Be(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function E2(r,e,t){var i=r;do{var n=i.prev,o=i.next.next;!Js(n,o)&&Jd(n,i,i.next,o)&&So(n,o)&&So(o,n)&&(e.push(n.i/t|0),e.push(i.i/t|0),e.push(o.i/t|0),Po(i),Po(i.next),i=r=o),i=i.next}while(i!==r);return oi(i)}function k2(r,e,t,i,n,o){var a=r;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&U2(a,s)){var l=Yd(a,s);a=oi(a,a.next),l=oi(l,l.next),wo(a,e,t,i,n,o,0),wo(l,e,t,i,n,o,0);return}s=s.next}a=a.next}while(a!==r)}function L2(r,e,t,i){var n=[],o,a,s,l,u;for(o=0,a=e.length;o<a;o++)s=e[o]*i,l=o<a-1?e[o+1]*i:r.length,u=Kd(r,s,l,i,!1),u===u.next&&(u.steiner=!0),n.push(V2(u));for(n.sort(D2),o=0;o<n.length;o++)t=z2(n[o],t);return t}function D2(r,e){return r.x-e.x}function z2(r,e){var t=F2(r,e);if(!t)return e;var i=Yd(t,r);return oi(i,i.next),oi(t,t.next)}function F2(r,e){var t=e,i=r.x,n=r.y,o=-1/0,a;do{if(n<=t.y&&n>=t.next.y&&t.next.y!==t.y){var s=t.x+(n-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(s<=i&&s>o&&(o=s,a=t.x<t.next.x?t:t.next,s===i))return a}t=t.next}while(t!==e);if(!a)return null;var l=a,u=a.x,c=a.y,p=1/0,h;t=a;do i>=t.x&&t.x>=u&&i!==t.x&&Zi(n<c?i:o,n,u,c,n<c?o:i,n,t.x,t.y)&&(h=Math.abs(n-t.y)/(i-t.x),So(t,r)&&(h<p||h===p&&(t.x>a.x||t.x===a.x&&R2(a,t)))&&(a=t,p=h)),t=t.next;while(t!==l);return a}function R2(r,e){return Be(r.prev,r,e.prev)<0&&Be(e.next,r,r.next)<0}function B2(r,e,t,i){var n=r;do n.z===0&&(n.z=Pp(n.x,n.y,e,t,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next;while(n!==r);n.prevZ.nextZ=null,n.prevZ=null,O2(n)}function O2(r){var e,t,i,n,o,a,s,l,u=1;do{for(t=r,r=null,o=null,a=0;t;){for(a++,i=t,s=0,e=0;e<u&&(s++,i=i.nextZ,!!i);e++);for(l=u;s>0||l>0&&i;)s!==0&&(l===0||!i||t.z<=i.z)?(n=t,t=t.nextZ,s--):(n=i,i=i.nextZ,l--),o?o.nextZ=n:r=n,n.prevZ=o,o=n;t=i}o.nextZ=null,u*=2}while(a>1);return r}function Pp(r,e,t,i,n){return r=(r-t)*n|0,e=(e-i)*n|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function V2(r){var e=r,t=r;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==r);return t}function Zi(r,e,t,i,n,o,a,s){return(n-a)*(e-s)>=(r-a)*(o-s)&&(r-a)*(i-s)>=(t-a)*(e-s)&&(t-a)*(o-s)>=(n-a)*(i-s)}function U2(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!N2(r,e)&&(So(r,e)&&So(e,r)&&G2(r,e)&&(Be(r.prev,r,e.prev)||Be(r,e.prev,e))||Js(r,e)&&Be(r.prev,r,r.next)>0&&Be(e.prev,e,e.next)>0)}function Be(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function Js(r,e){return r.x===e.x&&r.y===e.y}function Jd(r,e,t,i){var n=Xs(Be(r,e,t)),o=Xs(Be(r,e,i)),a=Xs(Be(t,i,r)),s=Xs(Be(t,i,e));return!!(n!==o&&a!==s||n===0&&Ws(r,t,e)||o===0&&Ws(r,i,e)||a===0&&Ws(t,r,i)||s===0&&Ws(t,e,i))}function Ws(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function Xs(r){return r>0?1:r<0?-1:0}function N2(r,e){var t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&Jd(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function So(r,e){return Be(r.prev,r,r.next)<0?Be(r,e,r.next)>=0&&Be(r,r.prev,e)>=0:Be(r,e,r.prev)<0||Be(r,r.next,e)<0}function G2(r,e){var t=r,i=!1,n=(r.x+e.x)/2,o=(r.y+e.y)/2;do t.y>o!=t.next.y>o&&t.next.y!==t.y&&n<(t.next.x-t.x)*(o-t.y)/(t.next.y-t.y)+t.x&&(i=!i),t=t.next;while(t!==r);return i}function Yd(r,e){var t=new Tp(r.i,r.x,r.y),i=new Tp(e.i,e.x,e.y),n=r.next,o=e.prev;return r.next=e,e.prev=r,t.next=n,n.prev=t,i.next=t,t.prev=i,o.next=i,i.prev=o,i}function Xd(r,e,t,i){var n=new Tp(r,e,t);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function Po(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function Tp(r,e,t){this.i=r,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Ks.deviation=function(r,e,t,i){var n=e&&e.length,o=n?e[0]*t:r.length,a=Math.abs(Ap(r,0,o,t));if(n)for(var s=0,l=e.length;s<l;s++){var u=e[s]*t,c=s<l-1?e[s+1]*t:r.length;a-=Math.abs(Ap(r,u,c,t))}var p=0;for(s=0;s<i.length;s+=3){var h=i[s]*t,f=i[s+1]*t,d=i[s+2]*t;p+=Math.abs((r[h]-r[d])*(r[f+1]-r[h+1])-(r[h]-r[f])*(r[d+1]-r[h+1]))}return a===0&&p===0?0:Math.abs((p-a)/a)};function Ap(r,e,t,i){for(var n=0,o=e,a=t-i;o<t;o+=i)n+=(r[a]-r[o])*(r[o+1]+r[a+1]),a=o;return n}Ks.flatten=function(r){for(var e=r[0][0].length,t={vertices:[],holes:[],dimensions:e},i=0,n=0;n<r.length;n++){for(var o=0;o<r[n].length;o++)for(var a=0;a<e;a++)t.vertices.push(r[n][o][a]);n>0&&(i+=r[n-1].length,t.holes.push(i))}return t}});var Ep=bt((mD,ay)=>{"use strict";m();var X2=ye();ay.exports=Xi;function Xi(r,e,t,i,n){this.properties={},this.extent=t,this.type=0,this._pbf=r,this._geometry=-1,this._keys=i,this._values=n,r.readFields(K2,this,e)}function K2(r,e,t){r==1?e.id=t.readVarint():r==2?J2(t,e):r==3?e.type=t.readVarint():r==4&&(e._geometry=t.pos)}function J2(r,e){for(var t=r.readVarint()+r.pos;r.pos<t;){var i=e._keys[r.readVarint()],n=e._values[r.readVarint()];e.properties[i]=n}}Xi.types=["Unknown","Point","LineString","Polygon"];Xi.prototype.loadGeometry=function(){var r=this._pbf;r.pos=this._geometry;for(var e=r.readVarint()+r.pos,t=1,i=0,n=0,o=0,a=[],s;r.pos<e;){if(i<=0){var l=r.readVarint();t=l&7,i=l>>3}if(i--,t===1||t===2)n+=r.readSVarint(),o+=r.readSVarint(),t===1&&(s&&a.push(s),s=[]),s.push(new X2(n,o));else if(t===7)s&&s.push(s[0].clone());else throw new Error("unknown command "+t)}return s&&a.push(s),a};Xi.prototype.bbox=function(){var r=this._pbf;r.pos=this._geometry;for(var e=r.readVarint()+r.pos,t=1,i=0,n=0,o=0,a=1/0,s=-1/0,l=1/0,u=-1/0;r.pos<e;){if(i<=0){var c=r.readVarint();t=c&7,i=c>>3}if(i--,t===1||t===2)n+=r.readSVarint(),o+=r.readSVarint(),n<a&&(a=n),n>s&&(s=n),o<l&&(l=o),o>u&&(u=o);else if(t!==7)throw new Error("unknown command "+t)}return[a,l,s,u]};Xi.prototype.toGeoJSON=function(r,e,t){var i=this.extent*Math.pow(2,t),n=this.extent*r,o=this.extent*e,a=this.loadGeometry(),s=Xi.types[this.type],l,u;function c(f){for(var d=0;d<f.length;d++){var y=f[d],g=180-(y.y+o)*360/i;f[d]=[(y.x+n)*360/i-180,360/Math.PI*Math.atan(Math.exp(g*Math.PI/180))-90]}}switch(this.type){case 1:var p=[];for(l=0;l<a.length;l++)p[l]=a[l][0];a=p,c(a);break;case 2:for(l=0;l<a.length;l++)c(a[l]);break;case 3:for(a=Y2(a),l=0;l<a.length;l++)for(u=0;u<a[l].length;u++)c(a[l][u]);break}a.length===1?a=a[0]:s="Multi"+s;var h={type:"Feature",geometry:{type:s,coordinates:a},properties:this.properties};return"id"in this&&(h.id=this.id),h};function Y2(r){var e=r.length;if(e<=1)return[r];for(var t=[],i,n,o=0;o<e;o++){var a=Q2(r[o]);a!==0&&(n===void 0&&(n=a<0),n===a<0?(i&&t.push(i),i=[r[o]]):i.push(r[o]))}return i&&t.push(i),t}function Q2(r){for(var e=0,t=0,i=r.length,n=i-1,o,a;t<i;n=t++)o=r[t],a=r[n],e+=(a.x-o.x)*(o.y+a.y);return e}});var kp=bt((yD,ly)=>{"use strict";m();var eT=Ep();ly.exports=sy;function sy(r,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=r,this._keys=[],this._values=[],this._features=[],r.readFields(tT,this,e),this.length=this._features.length}function tT(r,e,t){r===15?e.version=t.readVarint():r===1?e.name=t.readString():r===5?e.extent=t.readVarint():r===2?e._features.push(t.pos):r===3?e._keys.push(t.readString()):r===4&&e._values.push(rT(t))}function rT(r){for(var e=null,t=r.readVarint()+r.pos;r.pos<t;){var i=r.readVarint()>>3;e=i===1?r.readString():i===2?r.readFloat():i===3?r.readDouble():i===4?r.readVarint64():i===5?r.readVarint():i===6?r.readSVarint():i===7?r.readBoolean():null}return e}sy.prototype.feature=function(r){if(r<0||r>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[r];var e=this._pbf.readVarint()+this._pbf.pos;return new eT(this._pbf,e,this.extent,this._keys,this._values)}});var cy=bt((xD,uy)=>{"use strict";m();var iT=kp();uy.exports=nT;function nT(r,e){this.layers=r.readFields(oT,{},e)}function oT(r,e,t){if(r===3){var i=new iT(t,t.readVarint()+t.pos);i.length&&(e[i.name]=i)}}});var Io=bt((_D,Qs)=>{m();Qs.exports.VectorTile=cy();Qs.exports.VectorTileFeature=Ep();Qs.exports.VectorTileLayer=kp()});var Ly=bt(Rp=>{m();Rp.read=function(r,e,t,i,n){var o,a,s=n*8-i-1,l=(1<<s)-1,u=l>>1,c=-7,p=t?n-1:0,h=t?-1:1,f=r[e+p];for(p+=h,o=f&(1<<-c)-1,f>>=-c,c+=s;c>0;o=o*256+r[e+p],p+=h,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=i;c>0;a=a*256+r[e+p],p+=h,c-=8);if(o===0)o=1-u;else{if(o===l)return a?NaN:(f?-1:1)*(1/0);a=a+Math.pow(2,i),o=o-u}return(f?-1:1)*a*Math.pow(2,o-i)};Rp.write=function(r,e,t,i,n,o){var a,s,l,u=o*8-n-1,c=(1<<u)-1,p=c>>1,h=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,f=i?0:o-1,d=i?1:-1,y=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),a+p>=1?e+=h/l:e+=h*Math.pow(2,1-p),e*l>=2&&(a++,l/=2),a+p>=c?(s=0,a=c):a+p>=1?(s=(e*l-1)*Math.pow(2,n),a=a+p):(s=e*Math.pow(2,p-1)*Math.pow(2,n),a=0));n>=8;r[t+f]=s&255,f+=d,s/=256,n-=8);for(a=a<<n|s,u+=n;u>0;r[t+f]=a&255,f+=d,a/=256,u-=8);r[t+f-d]|=y*128}});var Op=bt((gF,By)=>{"use strict";m();By.exports=Pe;var nl=Ly();function Pe(r){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(r)?r:new Uint8Array(r||0),this.pos=0,this.type=0,this.length=this.buf.length}Pe.Varint=0;Pe.Fixed64=1;Pe.Bytes=2;Pe.Fixed32=5;var Bp=65536*65536,Dy=1/Bp,PT=12,Ry=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");Pe.prototype={destroy:function(){this.buf=null},readFields:function(r,e,t){for(t=t||this.length;this.pos<t;){var i=this.readVarint(),n=i>>3,o=this.pos;this.type=i&7,r(n,e,this),this.pos===o&&this.skip(i)}return e},readMessage:function(r,e){return this.readFields(r,e,this.readVarint()+this.pos)},readFixed32:function(){var r=ol(this.buf,this.pos);return this.pos+=4,r},readSFixed32:function(){var r=Fy(this.buf,this.pos);return this.pos+=4,r},readFixed64:function(){var r=ol(this.buf,this.pos)+ol(this.buf,this.pos+4)*Bp;return this.pos+=8,r},readSFixed64:function(){var r=ol(this.buf,this.pos)+Fy(this.buf,this.pos+4)*Bp;return this.pos+=8,r},readFloat:function(){var r=nl.read(this.buf,this.pos,!0,23,4);return this.pos+=4,r},readDouble:function(){var r=nl.read(this.buf,this.pos,!0,52,8);return this.pos+=8,r},readVarint:function(r){var e=this.buf,t,i;return i=e[this.pos++],t=i&127,i<128||(i=e[this.pos++],t|=(i&127)<<7,i<128)||(i=e[this.pos++],t|=(i&127)<<14,i<128)||(i=e[this.pos++],t|=(i&127)<<21,i<128)?t:(i=e[this.pos],t|=(i&15)<<28,TT(t,r,this))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var r=this.readVarint();return r%2===1?(r+1)/-2:r/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var r=this.readVarint()+this.pos,e=this.pos;return this.pos=r,r-e>=PT&&Ry?VT(this.buf,e,r):OT(this.buf,e,r)},readBytes:function(){var r=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,r);return this.pos=r,e},readPackedVarint:function(r,e){if(this.type!==Pe.Bytes)return r.push(this.readVarint(e));var t=or(this);for(r=r||[];this.pos<t;)r.push(this.readVarint(e));return r},readPackedSVarint:function(r){if(this.type!==Pe.Bytes)return r.push(this.readSVarint());var e=or(this);for(r=r||[];this.pos<e;)r.push(this.readSVarint());return r},readPackedBoolean:function(r){if(this.type!==Pe.Bytes)return r.push(this.readBoolean());var e=or(this);for(r=r||[];this.pos<e;)r.push(this.readBoolean());return r},readPackedFloat:function(r){if(this.type!==Pe.Bytes)return r.push(this.readFloat());var e=or(this);for(r=r||[];this.pos<e;)r.push(this.readFloat());return r},readPackedDouble:function(r){if(this.type!==Pe.Bytes)return r.push(this.readDouble());var e=or(this);for(r=r||[];this.pos<e;)r.push(this.readDouble());return r},readPackedFixed32:function(r){if(this.type!==Pe.Bytes)return r.push(this.readFixed32());var e=or(this);for(r=r||[];this.pos<e;)r.push(this.readFixed32());return r},readPackedSFixed32:function(r){if(this.type!==Pe.Bytes)return r.push(this.readSFixed32());var e=or(this);for(r=r||[];this.pos<e;)r.push(this.readSFixed32());return r},readPackedFixed64:function(r){if(this.type!==Pe.Bytes)return r.push(this.readFixed64());var e=or(this);for(r=r||[];this.pos<e;)r.push(this.readFixed64());return r},readPackedSFixed64:function(r){if(this.type!==Pe.Bytes)return r.push(this.readSFixed64());var e=or(this);for(r=r||[];this.pos<e;)r.push(this.readSFixed64());return r},skip:function(r){var e=r&7;if(e===Pe.Varint)for(;this.buf[this.pos++]>127;);else if(e===Pe.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Pe.Fixed32)this.pos+=4;else if(e===Pe.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+e)},writeTag:function(r,e){this.writeVarint(r<<3|e)},realloc:function(r){for(var e=this.length||16;e<this.pos+r;)e*=2;if(e!==this.length){var t=new Uint8Array(e);t.set(this.buf),this.buf=t,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(r){this.realloc(4),Ji(this.buf,r,this.pos),this.pos+=4},writeSFixed32:function(r){this.realloc(4),Ji(this.buf,r,this.pos),this.pos+=4},writeFixed64:function(r){this.realloc(8),Ji(this.buf,r&-1,this.pos),Ji(this.buf,Math.floor(r*Dy),this.pos+4),this.pos+=8},writeSFixed64:function(r){this.realloc(8),Ji(this.buf,r&-1,this.pos),Ji(this.buf,Math.floor(r*Dy),this.pos+4),this.pos+=8},writeVarint:function(r){if(r=+r||0,r>268435455||r<0){AT(r,this);return}this.realloc(4),this.buf[this.pos++]=r&127|(r>127?128:0),!(r<=127)&&(this.buf[this.pos++]=(r>>>=7)&127|(r>127?128:0),!(r<=127)&&(this.buf[this.pos++]=(r>>>=7)&127|(r>127?128:0),!(r<=127)&&(this.buf[this.pos++]=r>>>7&127)))},writeSVarint:function(r){this.writeVarint(r<0?-r*2-1:r*2)},writeBoolean:function(r){this.writeVarint(!!r)},writeString:function(r){r=String(r),this.realloc(r.length*4),this.pos++;var e=this.pos;this.pos=UT(this.buf,r,this.pos);var t=this.pos-e;t>=128&&zy(e,t,this),this.pos=e-1,this.writeVarint(t),this.pos+=t},writeFloat:function(r){this.realloc(4),nl.write(this.buf,r,this.pos,!0,23,4),this.pos+=4},writeDouble:function(r){this.realloc(8),nl.write(this.buf,r,this.pos,!0,52,8),this.pos+=8},writeBytes:function(r){var e=r.length;this.writeVarint(e),this.realloc(e);for(var t=0;t<e;t++)this.buf[this.pos++]=r[t]},writeRawMessage:function(r,e){this.pos++;var t=this.pos;r(e,this);var i=this.pos-t;i>=128&&zy(t,i,this),this.pos=t-1,this.writeVarint(i),this.pos+=i},writeMessage:function(r,e,t){this.writeTag(r,Pe.Bytes),this.writeRawMessage(e,t)},writePackedVarint:function(r,e){e.length&&this.writeMessage(r,CT,e)},writePackedSVarint:function(r,e){e.length&&this.writeMessage(r,ET,e)},writePackedBoolean:function(r,e){e.length&&this.writeMessage(r,DT,e)},writePackedFloat:function(r,e){e.length&&this.writeMessage(r,kT,e)},writePackedDouble:function(r,e){e.length&&this.writeMessage(r,LT,e)},writePackedFixed32:function(r,e){e.length&&this.writeMessage(r,zT,e)},writePackedSFixed32:function(r,e){e.length&&this.writeMessage(r,FT,e)},writePackedFixed64:function(r,e){e.length&&this.writeMessage(r,RT,e)},writePackedSFixed64:function(r,e){e.length&&this.writeMessage(r,BT,e)},writeBytesField:function(r,e){this.writeTag(r,Pe.Bytes),this.writeBytes(e)},writeFixed32Field:function(r,e){this.writeTag(r,Pe.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(r,e){this.writeTag(r,Pe.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(r,e){this.writeTag(r,Pe.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(r,e){this.writeTag(r,Pe.Fixed64),this.writeSFixed64(e)},writeVarintField:function(r,e){this.writeTag(r,Pe.Varint),this.writeVarint(e)},writeSVarintField:function(r,e){this.writeTag(r,Pe.Varint),this.writeSVarint(e)},writeStringField:function(r,e){this.writeTag(r,Pe.Bytes),this.writeString(e)},writeFloatField:function(r,e){this.writeTag(r,Pe.Fixed32),this.writeFloat(e)},writeDoubleField:function(r,e){this.writeTag(r,Pe.Fixed64),this.writeDouble(e)},writeBooleanField:function(r,e){this.writeVarintField(r,!!e)}};function TT(r,e,t){var i=t.buf,n,o;if(o=i[t.pos++],n=(o&112)>>4,o<128||(o=i[t.pos++],n|=(o&127)<<3,o<128)||(o=i[t.pos++],n|=(o&127)<<10,o<128)||(o=i[t.pos++],n|=(o&127)<<17,o<128)||(o=i[t.pos++],n|=(o&127)<<24,o<128)||(o=i[t.pos++],n|=(o&1)<<31,o<128))return Ki(r,n,e);throw new Error("Expected varint not more than 10 bytes")}function or(r){return r.type===Pe.Bytes?r.readVarint()+r.pos:r.pos+1}function Ki(r,e,t){return t?e*4294967296+(r>>>0):(e>>>0)*4294967296+(r>>>0)}function AT(r,e){var t,i;if(r>=0?(t=r%4294967296|0,i=r/4294967296|0):(t=~(-r%4294967296),i=~(-r/4294967296),t^4294967295?t=t+1|0:(t=0,i=i+1|0)),r>=18446744073709552e3||r<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),MT(t,i,e),IT(i,e)}function MT(r,e,t){t.buf[t.pos++]=r&127|128,r>>>=7,t.buf[t.pos++]=r&127|128,r>>>=7,t.buf[t.pos++]=r&127|128,r>>>=7,t.buf[t.pos++]=r&127|128,r>>>=7,t.buf[t.pos]=r&127}function IT(r,e){var t=(r&7)<<4;e.buf[e.pos++]|=t|((r>>>=3)?128:0),r&&(e.buf[e.pos++]=r&127|((r>>>=7)?128:0),r&&(e.buf[e.pos++]=r&127|((r>>>=7)?128:0),r&&(e.buf[e.pos++]=r&127|((r>>>=7)?128:0),r&&(e.buf[e.pos++]=r&127|((r>>>=7)?128:0),r&&(e.buf[e.pos++]=r&127)))))}function zy(r,e,t){var i=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(Math.LN2*7));t.realloc(i);for(var n=t.pos-1;n>=r;n--)t.buf[n+i]=t.buf[n]}function CT(r,e){for(var t=0;t<r.length;t++)e.writeVarint(r[t])}function ET(r,e){for(var t=0;t<r.length;t++)e.writeSVarint(r[t])}function kT(r,e){for(var t=0;t<r.length;t++)e.writeFloat(r[t])}function LT(r,e){for(var t=0;t<r.length;t++)e.writeDouble(r[t])}function DT(r,e){for(var t=0;t<r.length;t++)e.writeBoolean(r[t])}function zT(r,e){for(var t=0;t<r.length;t++)e.writeFixed32(r[t])}function FT(r,e){for(var t=0;t<r.length;t++)e.writeSFixed32(r[t])}function RT(r,e){for(var t=0;t<r.length;t++)e.writeFixed64(r[t])}function BT(r,e){for(var t=0;t<r.length;t++)e.writeSFixed64(r[t])}function ol(r,e){return(r[e]|r[e+1]<<8|r[e+2]<<16)+r[e+3]*16777216}function Ji(r,e,t){r[t]=e,r[t+1]=e>>>8,r[t+2]=e>>>16,r[t+3]=e>>>24}function Fy(r,e){return(r[e]|r[e+1]<<8|r[e+2]<<16)+(r[e+3]<<24)}function OT(r,e,t){for(var i="",n=e;n<t;){var o=r[n],a=null,s=o>239?4:o>223?3:o>191?2:1;if(n+s>t)break;var l,u,c;s===1?o<128&&(a=o):s===2?(l=r[n+1],(l&192)===128&&(a=(o&31)<<6|l&63,a<=127&&(a=null))):s===3?(l=r[n+1],u=r[n+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=r[n+1],u=r[n+2],c=r[n+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,i+=String.fromCharCode(a>>>10&1023|55296),a=56320|a&1023),i+=String.fromCharCode(a),n+=s}return i}function VT(r,e,t){return Ry.decode(r.subarray(e,t))}function UT(r,e,t){for(var i=0,n,o;i<e.length;i++){if(n=e.charCodeAt(i),n>55295&&n<57344)if(o)if(n<56320){r[t++]=239,r[t++]=191,r[t++]=189,o=n;continue}else n=o-55296<<10|n-56320|65536,o=null;else{n>56319||i+1===e.length?(r[t++]=239,r[t++]=191,r[t++]=189):o=n;continue}else o&&(r[t++]=239,r[t++]=191,r[t++]=189,o=null);n<128?r[t++]=n:(n<2048?r[t++]=n>>6|192:(n<65536?r[t++]=n>>12|224:(r[t++]=n>>18|240,r[t++]=n>>12&63|128),r[t++]=n>>6&63|128),r[t++]=n&63|128)}return t}});var Eg=bt((eh,th)=>{m();(function(r,e){typeof eh=="object"&&typeof th<"u"?th.exports=e():typeof define=="function"&&define.amd?define(e):(r=r||self,r.TinyQueue=e())})(eh,function(){"use strict";var r=function(i,n){if(i===void 0&&(i=[]),n===void 0&&(n=e),this.data=i,this.length=this.data.length,this.compare=n,this.length>0)for(var o=(this.length>>1)-1;o>=0;o--)this._down(o)};r.prototype.push=function(i){this.data.push(i),this.length++,this._up(this.length-1)},r.prototype.pop=function(){if(this.length!==0){var i=this.data[0],n=this.data.pop();return this.length--,this.length>0&&(this.data[0]=n,this._down(0)),i}},r.prototype.peek=function(){return this.data[0]},r.prototype._up=function(i){for(var n=this,o=n.data,a=n.compare,s=o[i];i>0;){var l=i-1>>1,u=o[l];if(a(s,u)>=0)break;o[i]=u,i=l}o[i]=s},r.prototype._down=function(i){for(var n=this,o=n.data,a=n.compare,s=this.length>>1,l=o[i];i<s;){var u=(i<<1)+1,c=o[u],p=u+1;if(p<this.length&&a(o[p],c)<0&&(u=p,c=o[p]),a(c,l)>=0)break;o[i]=c,i=u}o[i]=l};function e(t,i){return t<i?-1:t>i?1:0}return r})});m();var Da={name:"@packages/outdoor-context-v4",version:"6.0.1-beta.49",private:!0,main:"dist/maplibre-gl.js",style:"dist/maplibre-gl.css",license:"BSD-3-Clause",homepage:"https://maplibre.org/",funding:"https://github.com/maplibre/maplibre-gl-js?sponsor=1",bugs:{url:"https://github.com/maplibre/maplibre-gl-js/issues/"},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":"^20.1.1","@types/geojson":"^7946.0.14","@types/geojson-vt":"3.2.5","@types/junit-report-builder":"^3.0.2","@types/mapbox__point-geometry":"^0.1.4","@types/mapbox__vector-tile":"^1.3.4","@types/pbf":"^3.0.5","@types/supercluster":"^7.1.3",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.7","@rollup/plugin-json":"^6.1.0","@rollup/plugin-node-resolve":"^15.2.3","@rollup/plugin-replace":"^5.0.5","@rollup/plugin-strip":"^3.0.4","@rollup/plugin-terser":"^0.4.4","@rollup/plugin-typescript":"^11.1.6","@types/benchmark":"^2.1.5","@types/cssnano":"^5.0.0","@types/d3":"^7.4.3","@types/diff":"^5.2.0","@types/earcut":"^2.1.4","@types/eslint":"^8.56.7","@types/gl":"^6.0.5","@types/glob":"^8.1.0","@types/jest":"^29.5.12","@types/jsdom":"^21.1.6","@types/minimist":"^1.2.5","@types/murmurhash-js":"^1.0.6","@types/nise":"^1.4.4","@types/node":"^20.12.7","@types/offscreencanvas":"^2019.7.3","@types/pixelmatch":"^5.2.6","@types/pngjs":"^6.0.4","@types/react":"^18.2.79","@types/react-dom":"^18.2.25","@types/request":"^2.48.12","@types/shuffle-seed":"^1.1.3","@types/window-or-global":"^1.0.6","@typescript-eslint/eslint-plugin":"^7.7.1","@typescript-eslint/parser":"^7.7.1",address:"^2.0.2",benchmark:"^2.1.4",canvas:"^2.11.2",cssnano:"^6.1.2",d3:"^7.9.0","d3-queue":"^3.0.7","devtools-protocol":"^0.0.1291694",diff:"^5.2.0","dts-bundle-generator":"^9.5.1",eslint:"^8.57.0","eslint-config-mourner":"^3.0.0","eslint-plugin-html":"^8.1.1","eslint-plugin-import":"^2.29.1","eslint-plugin-jest":"^28.2.0","eslint-plugin-react":"^7.34.1","eslint-plugin-tsdoc":"0.2.17",expect:"^29.7.0",glob:"^10.3.12","is-builtin-module":"^3.2.1",jest:"^29.7.0","jest-environment-jsdom":"^29.7.0","jest-junit":"^16.0.0","jest-monocart-coverage":"^1.1.0","jest-webgl-canvas-mock":"^2.5.3",jsdom:"^24.0.0","json-stringify-pretty-compact":"^4.0.0","junit-report-builder":"^3.2.1",minimist:"^1.2.8","mock-geolocation":"^1.0.11","monocart-coverage-reports":"^2.7.9",nise:"^5.1.9","npm-font-open-sans":"^1.1.0","npm-run-all":"^4.1.5","pdf-merger-js":"^5.1.1",pixelmatch:"^5.3.0",pngjs:"^7.0.0",postcss:"^8.4.38","postcss-cli":"^11.0.0","postcss-inline-svg":"^6.0.0","pretty-bytes":"^6.1.1",puppeteer:"^22.7.0",react:"^18.2.0","react-dom":"^18.2.0",rollup:"^4.16.4","rollup-plugin-sourcemaps":"^0.6.3",rw:"^1.3.3",semver:"^7.6.0","shuffle-seed":"^1.1.6","source-map-explorer":"^2.5.3",st:"^3.0.0",stylelint:"^16.4.0","stylelint-config-standard":"^36.0.0","ts-jest":"^29.1.2","ts-node":"^10.9.2",tslib:"^2.6.2",typedoc:"^0.25.13","typedoc-plugin-markdown":"^3.17.1","typedoc-plugin-missing-exports":"^2.2.0",typescript:"^5.4.5"},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:{build:"tsc -b","generate-dist-package":"node --no-warnings --loader ts-node/esm build/generate-dist-package.js","generate-shaders":"node --no-warnings --loader ts-node/esm build/generate-shaders.ts","generate-struct-arrays":"node --no-warnings --loader ts-node/esm build/generate-struct-arrays.ts","generate-style-code":"node --no-warnings --loader ts-node/esm build/generate-style-code.ts","generate-typings":"dts-bundle-generator --export-referenced-types --umd-module-name=maplibregl -o ./dist/maplibre-gl.d.ts ./src/index.ts","generate-docs":"typedoc && node --no-warnings --loader ts-node/esm build/generate-docs.ts","generate-images":"node --no-warnings --loader ts-node/esm build/generate-doc-images.ts","build-dist":"npm run build-css && npm run generate-typings && npm run build-dev && npm run build-csp-dev && npm run build-prod && npm run build-csp","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","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-docs":"docker run --rm -it -p 8000:8000 -v ${PWD}:/docs squidfunk/mkdocs-material",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","test-build":"jest --selectProjects=build --reporters=default","test-build-ci":"jest --selectProjects=build","test-integration":"jest --selectProjects=integration --reporters=default","test-integration-ci":"jest --selectProjects=integration","test-render":"node --no-warnings --loader ts-node/esm test/integration/render/run_render_tests.ts","test-unit":"jest --selectProjects=unit --reporters=default","test-unit-ci":"jest --coverage --selectProjects unit","test-watch-roots":"jest --watch",codegen:"run-p --print-label generate-dist-package generate-style-code generate-struct-arrays generate-shaders && npm run generate-typings",benchmark:"node --no-warnings --loader ts-node/esm test/bench/run-benchmarks.ts","gl-stats":"node --no-warnings --loader ts-node/esm test/bench/gl-stats.ts","prepare:backup":"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"}};m();m();var tf=ne(ye(),1),rf=ne(Yh(),1);m();m();var _c;function za(){return _c==null&&(_c=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),_c}var Fa;function vc(){if(Fa==null&&(Fa=!1,za())){let t=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(t){for(let n=0;n<5*5;n++){let o=n*4;t.fillStyle=`rgb(${o},${o+1},${o+2})`,t.fillRect(n%5,Math.floor(n/5),1,1)}let i=t.getImageData(0,0,5,5).data;for(let n=0;n<5*5*4;n++)if(n%4!==3&&i[n]!==n){Fa=!0;break}}}return Fa||!1}function nf(r){if(r<=0)return 0;if(r>=1)return 1;let e=r*r,t=e*r;return 4*(r<.5?t:3*(r-e)+t-.75)}function gn(r,e,t,i){let n=new rf.default(r,e,t,i);return function(o){return n.solve(o)}}var xn=gn(.25,.1,.25,1);function Ae(r,e,t){return Math.min(t,Math.max(e,r))}function Kt(r,e,t){let i=t-e,n=((r-e)%i+i)%i+e;return n===e?t:n}function of(r,e){let t=[];for(let i in r)i in e||t.push(i);return t}function O(r,...e){for(let t of e)for(let i in t)r[i]=t[i];return r}function hr(r,e){let t={};for(let i=0;i<e.length;i++){let n=e[i];n in r&&(t[n]=r[n])}return t}var k_=1;function Ra(){return k_++}function af(r){return Math.log(r)/Math.LN2%1===0}function sf(r){return r<=1?1:Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function bn(r,e,t){let i={};for(let n in r)i[n]=e.call(t||this,r[n],n,r);return i}function Ba(r,e,t){let i={};for(let n in r)e.call(t||this,r[n],n,r)&&(i[n]=r[n]);return i}function Xt(r,e){if(Array.isArray(r)){if(!Array.isArray(e)||r.length!==e.length)return!1;for(let t=0;t<r.length;t++)if(!Xt(r[t],e[t]))return!1;return!0}if(typeof r=="object"&&r!==null&&e!==null){if(typeof e!="object"||Object.keys(r).length!==Object.keys(e).length)return!1;for(let i in r)if(!Xt(r[i],e[i]))return!1;return!0}return r===e}function ct(r){return Array.isArray(r)?r.map(ct):typeof r=="object"&&r?bn(r,ct):r}function lf(r,e){for(let t=0;t<r.length;t++)if(e.indexOf(r[t])>=0)return!0;return!1}var Qh={};function ke(r){Qh[r]||(typeof console<"u"&&console.warn(r),Qh[r]=!0)}function Jt(r,e,t){return(t.y-r.y)*(e.x-r.x)>(e.y-r.y)*(t.x-r.x)}function uf(r,e,t,i){let n=e.y-r.y,o=e.x-r.x,a=i.y-t.y,s=i.x-t.x,l=a*o-s*n;if(l===0)return null;let u=r.y-t.y,c=r.x-t.x,p=(s*u-a*c)/l;return new tf.default(r.x+p*o,r.y+p*n)}function cf(r){let e=0;for(let t=0,i=r.length,n=i-1,o,a;t<i;n=t++)o=r[t],a=r[n],e+=(a.x-o.x)*(o.y+a.y);return e}function pf([r,e,t]){return e+=90,e*=Math.PI/180,t*=Math.PI/180,{x:r*Math.cos(e)*Math.sin(t),y:r*Math.sin(e)*Math.sin(t),z:r*Math.cos(t)}}function Yt(r){return typeof WorkerGlobalScope<"u"&&typeof r<"u"&&r instanceof WorkerGlobalScope}function hf(r){let e=/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,t={};if(r.replace(e,(i,n,o,a)=>{let s=o||a;return t[n]=s?s.toLowerCase():!0,""}),t["max-age"]){let i=parseInt(t["max-age"],10);isNaN(i)?delete t["max-age"]:t["max-age"]=i}return t}var wc=null;function ff(r){if(wc==null){let e=r.navigator?r.navigator.userAgent:null;wc=!!r.safari||!!(e&&(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return wc}function pt(r){return typeof ImageBitmap<"u"&&r instanceof ImageBitmap}var mf=async r=>{if(r.byteLength===0)return createImageBitmap(new ImageData(1,1));let e=new Blob([new Uint8Array(r)],{type:"image/png"});try{return createImageBitmap(e)}catch(t){throw new Error(`Could not load image because of ${t.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}},ef="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=",df=r=>new Promise((e,t)=>{let i=new Image;i.onload=()=>{e(i),URL.revokeObjectURL(i.src),i.onload=null,window.requestAnimationFrame(()=>{i.src=ef})},i.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 n=new Blob([new Uint8Array(r)],{type:"image/png"});i.src=r.byteLength?URL.createObjectURL(n):ef});function L_(r,e,t,i,n){let o=Math.max(-e,0)*4,l=(Math.max(0,t)-t)*i*4+o,u=i*4,c=Math.max(0,e),p=Math.max(0,t),h=Math.min(r.width,e+i),f=Math.min(r.height,t+n);return{rect:{x:c,y:p,width:h-c,height:f-p},layout:[{offset:l,stride:u}]}}async function yf(r,e,t,i,n){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");let o=new VideoFrame(r,{timestamp:0});try{let a=o?.format;if(!a||!(a.startsWith("BGR")||a.startsWith("RGB")))throw new Error(`Unrecognized format ${a}`);let s=a.startsWith("BGR"),l=new Uint8ClampedArray(i*n*4);if(await o.copyTo(l,L_(r,e,t,i,n)),s)for(let u=0;u<l.length;u+=4){let c=l[u];l[u]=l[u+2],l[u+2]=c}return l}finally{o.close()}}function gf(r,e,t,i){return r.addEventListener(e,t,i),{unsubscribe:()=>{r.removeEventListener(e,t,i)}}}function Sc(r){return r*Math.PI/180}m();m();var D_="AbortError";function Or(){return new Error(D_)}var z_=typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),Oa,Pc,K={now:z_,frameAsync(r){return new Promise((e,t)=>{let i=requestAnimationFrame(e);r.signal.addEventListener("abort",()=>{cancelAnimationFrame(i),t(Or())})})},getImageData(r,e=0){return this.getImageCanvasContext(r).getImageData(-e,-e,r.width+2*e,r.height+2*e)},getImageCanvasContext(r){let e=window.document.createElement("canvas"),t=e.getContext("2d",{willReadFrequently:!0});if(!t)throw new Error("failed to create canvas 2d context");return e.width=r.width,e.height=r.height,t.drawImage(r,0,0,r.width,r.height),t},resolveURL(r){return Oa||(Oa=document.createElement("a")),Oa.href=r,Oa.href},hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return matchMedia?(Pc==null&&(Pc=matchMedia("(prefers-reduced-motion: reduce)")),Pc.matches):!1}};m();var xf=ne(ye(),1),Me=class Me{static testProp(e){if(!Me.docStyle)return e[0];for(let t=0;t<e.length;t++)if(e[t]in Me.docStyle)return e[t];return e[0]}static create(e,t,i){let n=window.document.createElement(e);return t!==void 0&&(n.className=t),i&&i.appendChild(n),n}static createNS(e,t){return window.document.createElementNS(e,t)}static disableDrag(){Me.docStyle&&Me.selectProp&&(Me.userSelect=Me.docStyle[Me.selectProp],Me.docStyle[Me.selectProp]="none")}static enableDrag(){Me.docStyle&&Me.selectProp&&(Me.docStyle[Me.selectProp]=Me.userSelect)}static setTransform(e,t){e.style[Me.transformProp]=t}static addEventListener(e,t,i,n={}){"passive"in n?e.addEventListener(t,i,n):e.addEventListener(t,i,n.capture)}static removeEventListener(e,t,i,n={}){"passive"in n?e.removeEventListener(t,i,n):e.removeEventListener(t,i,n.capture)}static suppressClickInternal(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener("click",Me.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",Me.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",Me.suppressClickInternal,!0)},0)}static getScale(e){let t=e.getBoundingClientRect();return{x:t.width/e.offsetWidth||1,y:t.height/e.offsetHeight||1,boundingClientRect:t}}static getPoint(e,t,i){let n=t.boundingClientRect;return new xf.default((i.clientX-n.left)/t.x-e.clientLeft,(i.clientY-n.top)/t.y-e.clientTop)}static mousePos(e,t){let i=Me.getScale(e);return Me.getPoint(e,i,t)}static touchPos(e,t){let i=[],n=Me.getScale(e);for(let o=0;o<t.length;o++)i.push(Me.getPoint(e,n,t[o]));return i}static mouseButton(e){return e.button}static remove(e){e.parentNode&&e.parentNode.removeChild(e)}};Me.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,Me.selectProp=Me.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),Me.transformProp=Me.testProp(["transform","WebkitTransform"]);var L=Me;m();m();m();var Je={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function Va(r){return Je.REGISTERED_PROTOCOLS[r.substring(0,r.indexOf("://"))]}function F_(r,e){Je.REGISTERED_PROTOCOLS[r]=e}function R_(r){delete Je.REGISTERED_PROTOCOLS[r]}m();var Ua="global-dispatcher",Vr=class extends Error{constructor(e,t,i,n){super(`AJAXError: ${t} (${e}): ${i}`),this.status=e,this.statusText=t,this.url=i,this.body=n}},Na=()=>Yt(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,B_=r=>/^file:/.test(r)||/^file:/.test(Na())&&!/^\w+:/.test(r);async function O_(r,e){let t=new Request(r.url,{method:r.method||"GET",body:r.body,credentials:r.credentials,headers:r.headers,cache:r.cache,referrer:Na(),signal:e.signal});r.type==="json"&&t.headers.set("Accept","application/json");let i=await fetch(t);if(!i.ok){let a=await i.blob();throw new Vr(i.status,i.statusText,r.url,a)}let n;r.type==="arrayBuffer"||r.type==="image"?n=i.arrayBuffer():r.type==="json"?n=i.json():n=i.text();let o=await n;if(e.signal.aborted)throw Or();return{data:o,cacheControl:i.headers.get("Cache-Control"),expires:i.headers.get("Expires")}}function V_(r,e){return new Promise((t,i)=>{let n=new XMLHttpRequest;n.open(r.method||"GET",r.url,!0),(r.type==="arrayBuffer"||r.type==="image")&&(n.responseType="arraybuffer");for(let o in r.headers)n.setRequestHeader(o,r.headers[o]);r.type==="json"&&(n.responseType="text",n.setRequestHeader("Accept","application/json")),n.withCredentials=r.credentials==="include",n.onerror=()=>{i(new Error(n.statusText))},n.onload=()=>{if(!e.signal.aborted)if((n.status>=200&&n.status<300||n.status===0)&&n.response!==null){let o=n.response;if(r.type==="json")try{o=JSON.parse(n.response)}catch(a){i(a);return}t({data:o,cacheControl:n.getResponseHeader("Cache-Control"),expires:n.getResponseHeader("Expires")})}else{let o=new Blob([n.response],{type:n.getResponseHeader("Content-Type")});i(new Vr(n.status,n.statusText,r.url,o))}},e.signal.addEventListener("abort",()=>{n.abort(),i(Or())}),n.send(r.body)})}var _i=function(r,e){if(/:\/\//.test(r.url)&&!/^https?:|^file:/.test(r.url)){let t=Va(r.url);if(t)return t(r,e);if(Yt(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:r,targetMapId:Ua},e)}if(!B_(r.url)){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return O_(r,e);if(Yt(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:r,mustQueue:!0,targetMapId:Ua},e)}return V_(r,e)},fr=(r,e)=>_i(O(r,{type:"json"}),e),bf=(r,e)=>_i(O(r,{type:"arrayBuffer"}),e);function Tc(r){if(!r||r.indexOf("://")<=0||r.indexOf("data:image/")===0||r.indexOf("blob:")===0)return!0;let e=new URL(r),t=window.location;return e.protocol===t.protocol&&e.host===t.host}var _f=r=>{let e=window.document.createElement("video");return e.muted=!0,new Promise(t=>{e.onloadstart=()=>{t(e)};for(let i of r){let n=window.document.createElement("source");Tc(i)||(e.crossOrigin="Anonymous"),n.src=i,e.appendChild(n)}})};m();m();var vn={supported:!1,testSupport:U_},_n,Ac=!1,vi,vf=!1;typeof document<"u"&&(vi=document.createElement("img"),vi.onload=function(){_n&&wf(_n),_n=null,vf=!0},vi.onerror=function(){Ac=!0,_n=null},vi.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");function U_(r){Ac||!vi||(vf?wf(r):_n=r)}function wf(r){let e=r.createTexture();r.bindTexture(r.TEXTURE_2D,e);try{if(r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,vi),r.isContextLost())return;vn.supported=!0}catch{}r.deleteTexture(e),Ac=!0}var st;(f=>{let r,e,t,i;f.resetRequestQueue=()=>{r=[],e=0,t=0,i={}},f.addThrottleControl=d=>{let y=t++;return i[y]=d,y},f.removeThrottleControl=d=>{delete i[d],p()};let s=()=>{for(let d of Object.keys(i))if(i[d]())return!0;return!1};f.getImage=(d,y,g=!0)=>new Promise((x,v)=>{vn.supported&&(d.headers||(d.headers={}),d.headers.accept="image/webp,*/*"),O(d,{type:"image"});let b={abortController:y,requestParameters:d,supportImageRefresh:g,state:"queued",onError:w=>{v(w)},onSuccess:w=>{x(w)}};r.push(b),p()});let u=d=>typeof createImageBitmap=="function"?mf(d):df(d),c=async d=>{d.state="running";let{requestParameters:y,supportImageRefresh:g,onError:x,onSuccess:v,abortController:b}=d,w=g===!1&&!Yt(self)&&!Va(y.url)&&(!y.headers||Object.keys(y.headers).reduce((P,I)=>P&&I==="accept",!0));e++;let S=w?h(y,b):_i(y,b);try{let P=await S;if(delete d.abortController,d.state="completed",P.data instanceof HTMLImageElement||pt(P.data))v(P);else if(P.data){let I=await u(P.data);v({data:I,cacheControl:P.cacheControl,expires:P.expires})}}catch(P){delete d.abortController,x(P)}finally{e--,p()}},p=()=>{let d=s()?Je.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:Je.MAX_PARALLEL_IMAGE_REQUESTS;for(let y=e;y<d&&r.length>0;y++){let g=r.shift();if(g.abortController.signal.aborted){y--;continue}c(g)}},h=(d,y)=>new Promise((g,x)=>{let v=new Image,b=d.url,w=d.credentials;w&&w==="include"?v.crossOrigin="use-credentials":(w&&w==="same-origin"||!Tc(b))&&(v.crossOrigin="anonymous"),y.signal.addEventListener("abort",()=>{v.src="",x(Or())}),v.fetchPriority="high",v.onload=()=>{v.onerror=v.onload=null,g({data:v})},v.onerror=()=>{v.onerror=v.onload=null,!y.signal.aborted&&x(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))},v.src=b})})(st||(st={}));st.resetRequestQueue();m();var Ga=class{constructor(e){this._transformRequestFn=e}transformRequest(e,t){return this._transformRequestFn?this._transformRequestFn(e,t)||{url:e}:{url:e}}normalizeSpriteURL(e,t,i){let n=G_(e);return n.path+=`${t}${i}`,$_(n)}setTransformRequest(e){this._transformRequestFn=e}},N_=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function G_(r){let e=r.match(N_);if(!e)throw new Error(`Unable to parse URL "${r}"`);return{protocol:e[1],authority:e[2],path:e[3]||"/",params:e[4]?e[4].split("&"):[]}}function $_(r){let e=r.params.length?`?${r.params.join("&")}`:"";return`${r.protocol}://${r.authority}${r.path}${e}`}m();m();function Sf(r,e,t){t[r]&&t[r].indexOf(e)!==-1||(t[r]=t[r]||[],t[r].push(e))}function Mc(r,e,t){if(t&&t[r]){let i=t[r].indexOf(e);i!==-1&&t[r].splice(i,1)}}var z=class{constructor(e,t={}){O(this,t),this.type=e}},Z=class extends z{constructor(e,t={}){super("error",O({error:e},t))}},me=class{on(e,t){return this._listeners=this._listeners||{},Sf(e,t,this._listeners),this}off(e,t){return Mc(e,t,this._listeners),Mc(e,t,this._oneTimeListeners),this}once(e,t){return t?(this._oneTimeListeners=this._oneTimeListeners||{},Sf(e,t,this._oneTimeListeners),this):new Promise(i=>this.once(e,i))}fire(e,t){typeof e=="string"&&(e=new z(e,t||{}));let i=e.type;if(this.listens(i)){e.target=this;let n=this._listeners&&this._listeners[i]?this._listeners[i].slice():[];for(let s of n)s.call(this,e);let o=this._oneTimeListeners&&this._oneTimeListeners[i]?this._oneTimeListeners[i].slice():[];for(let s of o)Mc(i,s,this._oneTimeListeners),s.call(this,e);let a=this._eventedParent;a&&(O(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),a.fire(e))}else e instanceof Z&&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}};m();m();m();m();var q_=8,j_={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"},roll:{type:"number",default:0,units:"degrees"},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},Z_={"*":{type:"source"}},H_=["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],W_={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:"*"}},X_={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:"*"}},K_={type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},J_={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"}},Y_={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"}}},Q_={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"}}},ev={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"}},tv=["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],rv={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},iv={"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"}},nv={"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"}},ov={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},av={"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"}},sv={"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"}},lv={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},uv={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},cv={type:"array",value:"*"},pv={type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},hv={type:"enum",values:{Point:{},LineString:{},Polygon:{}}},fv={type:"array",minimum:0,maximum:24,value:["number","color"],length:2},mv={type:"array",value:"*",minimum:1},dv={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}},yv={"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},gv={source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},xv={type:{type:"enum",default:"mercator",values:{mercator:{},globe:{}}}},bv=["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],_v={"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"}},vv={"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"}},wv={"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"}},Sv={"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"}},Pv={"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"}},Tv={"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"}},Av={"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"}},Mv={"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"}},Iv={duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},Cv={"*":{type:"string"}},M={$version:q_,$root:j_,sources:Z_,source:H_,source_vector:W_,source_raster:X_,source_raster_dem:K_,source_geojson:J_,source_video:Y_,source_image:Q_,layer:ev,layout:tv,layout_background:rv,layout_fill:iv,layout_circle:nv,layout_heatmap:ov,"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:av,layout_symbol:sv,layout_raster:lv,layout_hillshade:uv,filter:cv,filter_operator:pv,geometry_type:hv,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:fv,expression:mv,light:dv,sky:yv,terrain:gv,projection:xv,paint:bv,paint_fill:_v,"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:vv,paint_circle:wv,paint_heatmap:Sv,paint_symbol:Pv,paint_raster:Tv,paint_hillshade:Av,paint_background:Mv,transition:Iv,"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:Cv},Ev=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function kv(r,e){let t={};for(let i in r)i!=="ref"&&(t[i]=r[i]);return Ev.forEach(i=>{i in e&&(t[i]=e[i])}),t}function Qc(r){r=r.slice();let e=Object.create(null);for(let t=0;t<r.length;t++)e[r[t].id]=r[t];for(let t=0;t<r.length;t++)"ref"in r[t]&&(r[t]=kv(r[t],e[r[t].ref]));return r}function Ie(r,e){if(Array.isArray(r)){if(!Array.isArray(e)||r.length!==e.length)return!1;for(let t=0;t<r.length;t++)if(!Ie(r[t],e[t]))return!1;return!0}if(typeof r=="object"&&r!==null&&e!==null){if(typeof e!="object"||Object.keys(r).length!==Object.keys(e).length)return!1;for(let i in r)if(!Ie(r[i],e[i]))return!1;return!0}return r===e}function Tt(r,e){r.push(e)}function Hf(r,e,t){Tt(t,{command:"addSource",args:[r,e[r]]})}function Wf(r,e,t){Tt(e,{command:"removeSource",args:[r]}),t[r]=!0}function Lv(r,e,t,i){Wf(r,t,i),Hf(r,e,t)}function Dv(r,e,t){let i;for(i in r[t])if(Object.prototype.hasOwnProperty.call(r[t],i)&&i!=="data"&&!Ie(r[t][i],e[t][i]))return!1;for(i in e[t])if(Object.prototype.hasOwnProperty.call(e[t],i)&&i!=="data"&&!Ie(r[t][i],e[t][i]))return!1;return!0}function zv(r,e,t,i){r=r||{},e=e||{};let n;for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&(Object.prototype.hasOwnProperty.call(e,n)||Wf(n,t,i));for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&(Object.prototype.hasOwnProperty.call(r,n)?Ie(r[n],e[n])||(r[n].type==="geojson"&&e[n].type==="geojson"&&Dv(r,e,n)?Tt(t,{command:"setGeoJSONSourceData",args:[n,e[n].data]}):Lv(n,e,t,i)):Hf(n,e,t))}function $a(r,e,t,i,n,o){r=r||{},e=e||{};for(let a in r)Object.prototype.hasOwnProperty.call(r,a)&&(Ie(r[a],e[a])||t.push({command:o,args:[i,a,e[a],n]}));for(let a in e)!Object.prototype.hasOwnProperty.call(e,a)||Object.prototype.hasOwnProperty.call(r,a)||Ie(r[a],e[a])||t.push({command:o,args:[i,a,e[a],n]})}function Pf(r){return r.id}function Tf(r,e){return r[e.id]=e,r}function Fv(r,e,t){r=r||[],e=e||[];let i=r.map(Pf),n=e.map(Pf),o=r.reduce(Tf,{}),a=e.reduce(Tf,{}),s=i.slice(),l=Object.create(null),u,c,p,h,f;for(let d=0,y=0;d<i.length;d++)u=i[d],Object.prototype.hasOwnProperty.call(a,u)?y++:(Tt(t,{command:"removeLayer",args:[u]}),s.splice(s.indexOf(u,y),1));for(let d=0,y=0;d<n.length;d++)u=n[n.length-1-d],s[s.length-1-d]!==u&&(Object.prototype.hasOwnProperty.call(o,u)?(Tt(t,{command:"removeLayer",args:[u]}),s.splice(s.lastIndexOf(u,s.length-y),1)):y++,h=s[s.length-d],Tt(t,{command:"addLayer",args:[a[u],h]}),s.splice(s.length-d,0,u),l[u]=!0);for(let d=0;d<n.length;d++)if(u=n[d],c=o[u],p=a[u],!(l[u]||Ie(c,p))){if(!Ie(c.source,p.source)||!Ie(c["source-layer"],p["source-layer"])||!Ie(c.type,p.type)){Tt(t,{command:"removeLayer",args:[u]}),h=s[s.lastIndexOf(u)+1],Tt(t,{command:"addLayer",args:[p,h]});continue}$a(c.layout,p.layout,t,u,null,"setLayoutProperty"),$a(c.paint,p.paint,t,u,null,"setPaintProperty"),Ie(c.filter,p.filter)||Tt(t,{command:"setFilter",args:[u,p.filter]}),(!Ie(c.minzoom,p.minzoom)||!Ie(c.maxzoom,p.maxzoom))&&Tt(t,{command:"setLayerZoomRange",args:[u,p.minzoom,p.maxzoom]});for(f in c)Object.prototype.hasOwnProperty.call(c,f)&&(f==="layout"||f==="paint"||f==="filter"||f==="metadata"||f==="minzoom"||f==="maxzoom"||(f.indexOf("paint.")===0?$a(c[f],p[f],t,u,f.slice(6),"setPaintProperty"):Ie(c[f],p[f])||Tt(t,{command:"setLayerProperty",args:[u,f,p[f]]})));for(f in p)!Object.prototype.hasOwnProperty.call(p,f)||Object.prototype.hasOwnProperty.call(c,f)||f==="layout"||f==="paint"||f==="filter"||f==="metadata"||f==="minzoom"||f==="maxzoom"||(f.indexOf("paint.")===0?$a(c[f],p[f],t,u,f.slice(6),"setPaintProperty"):Ie(c[f],p[f])||Tt(t,{command:"setLayerProperty",args:[u,f,p[f]]}))}}function Xf(r,e){if(!r)return[{command:"setStyle",args:[e]}];let t=[];try{if(!Ie(r.version,e.version))return[{command:"setStyle",args:[e]}];Ie(r.center,e.center)||t.push({command:"setCenter",args:[e.center]}),Ie(r.zoom,e.zoom)||t.push({command:"setZoom",args:[e.zoom]}),Ie(r.bearing,e.bearing)||t.push({command:"setBearing",args:[e.bearing]}),Ie(r.pitch,e.pitch)||t.push({command:"setPitch",args:[e.pitch]}),Ie(r.roll,e.roll)||t.push({command:"setRoll",args:[e.roll]}),Ie(r.sprite,e.sprite)||t.push({command:"setSprite",args:[e.sprite]}),Ie(r.glyphs,e.glyphs)||t.push({command:"setGlyphs",args:[e.glyphs]}),Ie(r.transition,e.transition)||t.push({command:"setTransition",args:[e.transition]}),Ie(r.light,e.light)||t.push({command:"setLight",args:[e.light]}),Ie(r.terrain,e.terrain)||t.push({command:"setTerrain",args:[e.terrain]}),Ie(r.sky,e.sky)||t.push({command:"setSky",args:[e.sky]}),Ie(r.projection,e.projection)||t.push({command:"setProjection",args:[e.projection]});let i={},n=[];zv(r.sources,e.sources,n,i);let o=[];r.layers&&r.layers.forEach(a=>{"source"in a&&i[a.source]?t.push({command:"removeLayer",args:[a.id]}):o.push(a)}),t=t.concat(n),Fv(o,e.layers,t)}catch(i){console.warn("Unable to compute style diff:",i),t=[{command:"setStyle",args:[e]}]}return t}var R=class{constructor(e,t,i,n){this.message=(e?`${e}: `:"")+i,n&&(this.identifier=n),t!=null&&t.__line__&&(this.line=t.__line__)}};function Ai(r,...e){for(let t of e)for(let i in t)r[i]=t[i];return r}var At=class extends Error{constructor(e,t){super(t),this.message=t,this.key=e}},Bc=class r{constructor(e,t=[]){this.parent=e,this.bindings={};for(let[i,n]of t)this.bindings[i]=n}concat(e){return new r(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return this.bindings[e]?!0:this.parent?this.parent.has(e):!1}},Ci={kind:"null"},G={kind:"number"},ue={kind:"string"},oe={kind:"boolean"},It={kind:"color"},Pi={kind:"object"},ae={kind:"value"},Rv={kind:"error"},ls={kind:"collator"},Ei={kind:"formatted"},us={kind:"padding"},On={kind:"resolvedImage"},cs={kind:"variableAnchorOffsetCollection"};function _t(r,e){return{kind:"array",itemType:r,N:e}}function Fe(r){if(r.kind==="array"){let e=Fe(r.itemType);return typeof r.N=="number"?`array<${e}, ${r.N}>`:r.itemType.kind==="value"?"array":`array<${e}>`}else return r.kind}var Bv=[Ci,G,ue,oe,It,Ei,Pi,_t(ae),us,On,cs];function An(r,e){if(e.kind==="error")return null;if(r.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!An(r.itemType,e.itemType))&&(typeof r.N!="number"||r.N===e.N))return null}else{if(r.kind===e.kind)return null;if(r.kind==="value"){for(let t of Bv)if(!An(t,e))return null}}return`Expected ${Fe(r)} but found ${Fe(e)} instead.`}function ep(r,e){return e.some(t=>t.kind===r.kind)}function $r(r,e){return e.some(t=>t==="null"?r===null:t==="array"?Array.isArray(r):t==="object"?r&&!Array.isArray(r)&&typeof r=="object":t===typeof r)}function wn(r,e){return r.kind==="array"&&e.kind==="array"?r.itemType.kind===e.itemType.kind&&typeof r.N=="number":r.kind===e.kind}var Kf=.96422,Jf=1,Yf=.82521,Qf=4/29,Ti=6/29,em=3*Ti*Ti,Ov=Ti*Ti*Ti,Vv=Math.PI/180,Uv=180/Math.PI;function tm(r){return r=r%360,r<0&&(r+=360),r}function rm([r,e,t,i]){r=Ic(r),e=Ic(e),t=Ic(t);let n,o,a=Cc((.2225045*r+.7168786*e+.0606169*t)/Jf);r===e&&e===t?n=o=a:(n=Cc((.4360747*r+.3850649*e+.1430804*t)/Kf),o=Cc((.0139322*r+.0971045*e+.7141733*t)/Yf));let s=116*a-16;return[s<0?0:s,500*(n-a),200*(a-o),i]}function Ic(r){return r<=.04045?r/12.92:Math.pow((r+.055)/1.055,2.4)}function Cc(r){return r>Ov?Math.pow(r,1/3):r/em+Qf}function im([r,e,t,i]){let n=(r+16)/116,o=isNaN(e)?n:n+e/500,a=isNaN(t)?n:n-t/200;return n=Jf*kc(n),o=Kf*kc(o),a=Yf*kc(a),[Ec(3.1338561*o-1.6168667*n-.4906146*a),Ec(-.9787684*o+1.9161415*n+.033454*a),Ec(.0719453*o-.2289914*n+1.4052427*a),i]}function Ec(r){return r=r<=.00304?12.92*r:1.055*Math.pow(r,1/2.4)-.055,r<0?0:r>1?1:r}function kc(r){return r>Ti?r*r*r:em*(r-Qf)}function Nv(r){let[e,t,i,n]=rm(r),o=Math.sqrt(t*t+i*i);return[Math.round(o*1e4)?tm(Math.atan2(i,t)*Uv):NaN,o,e,n]}function Gv([r,e,t,i]){return r=isNaN(r)?0:r*Vv,im([t,Math.cos(r)*e,Math.sin(r)*e,i])}function $v([r,e,t,i]){r=tm(r),e/=100,t/=100;function n(o){let a=(o+r/30)%12,s=e*Math.min(t,1-t);return t-s*Math.max(-1,Math.min(a-3,9-a,1))}return[n(0),n(8),n(4),i]}function qv(r){if(r=r.toLowerCase().trim(),r==="transparent")return[0,0,0,0];let e=jv[r];if(e){let[n,o,a]=e;return[n/255,o/255,a/255,1]}if(r.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(r)){let o=r.length<6?1:2,a=1;return[qa(r.slice(a,a+=o)),qa(r.slice(a,a+=o)),qa(r.slice(a,a+=o)),qa(r.slice(a,a+o)||"ff")]}if(r.startsWith("rgb")){let n=/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,o=r.match(n);if(o){let[a,s,l,u,c,p,h,f,d,y,g,x]=o,v=[u||" ",h||" ",y].join("");if(v===" "||v===" /"||v===",,"||v===",,,"){let b=[l,p,d].join(""),w=b==="%%%"?100:b===""?255:0;if(w){let S=[wi(+s/w,0,1),wi(+c/w,0,1),wi(+f/w,0,1),g?Af(+g,x):1];if(Mf(S))return S}}return}}let t=/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/,i=r.match(t);if(i){let[n,o,a,s,l,u,c,p,h]=i,f=[a||" ",l||" ",c].join("");if(f===" "||f===" /"||f===",,"||f===",,,"){let d=[+o,wi(+s,0,100),wi(+u,0,100),p?Af(+p,h):1];if(Mf(d))return $v(d)}}}function qa(r){return parseInt(r.padEnd(2,r),16)/255}function Af(r,e){return wi(e?r/100:r,0,1)}function wi(r,e,t){return Math.min(Math.max(e,r),t)}function Mf(r){return!r.some(Number.isNaN)}var jv={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 r{constructor(e,t,i,n=1,o=!0){this.r=e,this.g=t,this.b=i,this.a=n,o||(this.r*=n,this.g*=n,this.b*=n,n||this.overwriteGetter("rgb",[e,t,i,n]))}static parse(e){if(e instanceof r)return e;if(typeof e!="string")return;let t=qv(e);if(t)return new r(...t,!1)}get rgb(){let{r:e,g:t,b:i,a:n}=this,o=n||1/0;return this.overwriteGetter("rgb",[e/o,t/o,i/o,n])}get hcl(){return this.overwriteGetter("hcl",Nv(this.rgb))}get lab(){return this.overwriteGetter("lab",rm(this.rgb))}overwriteGetter(e,t){return Object.defineProperty(this,e,{value:t}),t}toString(){let[e,t,i,n]=this.rgb;return`rgba(${[e,t,i].map(o=>Math.round(o*255)).join(",")},${n})`}};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 Mn=class{constructor(e,t,i){e?this.sensitivity=t?"variant":"case":this.sensitivity=t?"accent":"base",this.locale=i,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}},In=class{constructor(e,t,i,n,o){this.text=e,this.image=t,this.scale=i,this.fontStack=n,this.textColor=o}},wt=class r{constructor(e){this.sections=e}static fromString(e){return new r([new In(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 r?e:r.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}},Ft=class r{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof r)return e;if(typeof e=="number")return new r([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(let t of e)if(typeof t!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]];break}return new r(e)}}toString(){return JSON.stringify(this.values)}},Zv=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]),Qt=class r{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof r)return e;if(!(!Array.isArray(e)||e.length<1||e.length%2!==0)){for(let t=0;t<e.length;t+=2){let i=e[t],n=e[t+1];if(typeof i!="string"||!Zv.has(i)||!Array.isArray(n)||n.length!==2||typeof n[0]!="number"||typeof n[1]!="number")return}return new r(e)}}toString(){return JSON.stringify(this.values)}},ht=class r{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new r({name:e,available:!1}):null}};function nm(r,e,t,i){return typeof r=="number"&&r>=0&&r<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof t=="number"&&t>=0&&t<=255?typeof i>"u"||typeof i=="number"&&i>=0&&i<=1?null:`Invalid rgba value [${[r,e,t,i].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof i=="number"?[r,e,t,i]:[r,e,t]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Cn(r){if(r===null||typeof r=="string"||typeof r=="boolean"||typeof r=="number"||r instanceof W||r instanceof Mn||r instanceof wt||r instanceof Ft||r instanceof Qt||r instanceof ht)return!0;if(Array.isArray(r)){for(let e of r)if(!Cn(e))return!1;return!0}else if(typeof r=="object"){for(let e in r)if(!Cn(r[e]))return!1;return!0}else return!1}function qe(r){if(r===null)return Ci;if(typeof r=="string")return ue;if(typeof r=="boolean")return oe;if(typeof r=="number")return G;if(r instanceof W)return It;if(r instanceof Mn)return ls;if(r instanceof wt)return Ei;if(r instanceof Ft)return us;if(r instanceof Qt)return cs;if(r instanceof ht)return On;if(Array.isArray(r)){let e=r.length,t;for(let i of r){let n=qe(i);if(!t)t=n;else{if(t===n)continue;t=ae;break}}return _t(t||ae,e)}else return Pi}function Pn(r){let e=typeof r;return r===null?"":e==="string"||e==="number"||e==="boolean"?String(r):r instanceof W||r instanceof wt||r instanceof Ft||r instanceof Qt||r instanceof ht?r.toString():JSON.stringify(r)}var dr=class r{constructor(e,t){this.type=e,this.value=t}static parse(e,t){if(e.length!==2)return t.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!Cn(e[1]))return t.error("invalid value");let i=e[1],n=qe(i),o=t.expectedType;return n.kind==="array"&&n.N===0&&o&&o.kind==="array"&&(typeof o.N!="number"||o.N===0)&&(n=o),new r(n,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}},Re=class{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}},ja={string:ue,number:G,boolean:oe,object:Pi},zt=class r{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let i=1,n,o=e[0];if(o==="array"){let s;if(e.length>2){let u=e[1];if(typeof u!="string"||!(u in ja)||u==="object")return t.error('The item type argument of "array" must be one of string, number, boolean',1);s=ja[u],i++}else s=ae;let l;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return t.error('The length argument to "array" must be a positive integer literal',2);l=e[2],i++}n=_t(s,l)}else{if(!ja[o])throw new Error(`Types doesn't contain name = ${o}`);n=ja[o]}let a=[];for(;i<e.length;i++){let s=t.parse(e[i],i,ae);if(!s)return null;a.push(s)}return new r(n,a)}evaluate(e){for(let t=0;t<this.args.length;t++){let i=this.args[t].evaluate(e);if(An(this.type,qe(i))){if(t===this.args.length-1)throw new Re(`Expected value to be of type ${Fe(this.type)}, but found ${Fe(qe(i))} instead.`)}else return i}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},If={"to-boolean":oe,"to-color":It,"to-number":G,"to-string":ue},mr=class r{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let i=e[0];if(!If[i])throw new Error(`Can't parse ${i} as it is not part of the known types`);if((i==="to-boolean"||i==="to-string")&&e.length!==2)return t.error("Expected one argument.");let n=If[i],o=[];for(let a=1;a<e.length;a++){let s=t.parse(e[a],a,ae);if(!s)return null;o.push(s)}return new r(n,o)}evaluate(e){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(e);case"color":{let t,i;for(let n of this.args){if(t=n.evaluate(e),i=null,t instanceof W)return t;if(typeof t=="string"){let o=e.parseColor(t);if(o)return o}else if(Array.isArray(t)&&(t.length<3||t.length>4?i=`Invalid rgba value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:i=nm(t[0],t[1],t[2],t[3]),!i))return new W(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new Re(i||`Could not parse color from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"padding":{let t;for(let i of this.args){t=i.evaluate(e);let n=Ft.parse(t);if(n)return n}throw new Re(`Could not parse padding from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"variableAnchorOffsetCollection":{let t;for(let i of this.args){t=i.evaluate(e);let n=Qt.parse(t);if(n)return n}throw new Re(`Could not parse variableAnchorOffsetCollection from value '${typeof t=="string"?t:JSON.stringify(t)}'`)}case"number":{let t=null;for(let i of this.args){if(t=i.evaluate(e),t===null)return 0;let n=Number(t);if(!isNaN(n))return n}throw new Re(`Could not convert ${JSON.stringify(t)} to number.`)}case"formatted":return wt.fromString(Pn(this.args[0].evaluate(e)));case"resolvedImage":return ht.fromString(Pn(this.args[0].evaluate(e)));default:return Pn(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},Hv=["Unknown","Point","LineString","Polygon"],Xa=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"?Hv[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]=W.parse(e)),t}},Ka=class r{constructor(e,t,i=[],n,o=new Bc,a=[]){this.registry=e,this.path=i,this.key=i.map(s=>`[${s}]`).join(""),this.scope=o,this.errors=a,this.expectedType=n,this._isConstant=t}parse(e,t,i,n,o={}){return t?this.concat(t,i,n)._parse(e,o):this._parse(e,o)}_parse(e,t){(e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number")&&(e=["literal",e]);function i(n,o,a){return a==="assert"?new zt(o,[n]):a==="coerce"?new mr(o,[n]):n}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 n=e[0];if(typeof n!="string")return this.error(`Expression name must be a string, but found ${typeof n} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let o=this.registry[n];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=i(a,s,t.typeAnnotation||"assert");else if((s.kind==="color"||s.kind==="formatted"||s.kind==="resolvedImage")&&(l.kind==="value"||l.kind==="string"))a=i(a,s,t.typeAnnotation||"coerce");else if(s.kind==="padding"&&(l.kind==="value"||l.kind==="number"||l.kind==="array"))a=i(a,s,t.typeAnnotation||"coerce");else if(s.kind==="variableAnchorOffsetCollection"&&(l.kind==="value"||l.kind==="array"))a=i(a,s,t.typeAnnotation||"coerce");else if(this.checkSubtype(s,l))return null}if(!(a instanceof dr)&&a.type.kind!=="resolvedImage"&&this._isConstant(a)){let s=new Xa;try{a=new dr(a.type,a.evaluate(s))}catch(l){return this.error(l.message),null}}return a}return this.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0)}else return typeof e>"u"?this.error("'undefined' value invalid. Use null instead."):typeof e=="object"?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error(`Expected an array, but found ${typeof e} instead.`)}concat(e,t,i){let n=typeof e=="number"?this.path.concat(e):this.path,o=i?this.scope.concat(i):this.scope;return new r(this.registry,this._isConstant,n,t||null,o,this.errors)}error(e,...t){let i=`${this.key}${t.map(n=>`[${n}]`).join("")}`;this.errors.push(new At(i,e))}checkSubtype(e,t){let i=An(e,t);return i&&this.error(i),i}},Ja=class r{constructor(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(let t of this.bindings)e(t[1]);e(this.result)}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);let i=[];for(let o=1;o<e.length-1;o+=2){let a=e[o];if(typeof a!="string")return t.error(`Expected string, but found ${typeof a} instead.`,o);if(/[^a-zA-Z0-9_]/.test(a))return t.error("Variable names must contain only alphanumeric characters or '_'.",o);let s=t.parse(e[o+1],o+1);if(!s)return null;i.push([a,s])}let n=t.parse(e[e.length-1],e.length-1,t.expectedType,i);return n?new r(i,n):null}outputDefined(){return this.result.outputDefined()}},Ya=class r{constructor(e,t){this.type=t.type,this.name=e,this.boundExpression=t}static parse(e,t){if(e.length!==2||typeof e[1]!="string")return t.error("'var' expression requires exactly one string literal argument.");let i=e[1];return t.scope.has(i)?new r(i,t.scope.get(i)):t.error(`Unknown variable "${i}". Make sure "${i}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}},Oc=class r{constructor(e,t,i){this.type=e,this.index=t,this.input=i}static parse(e,t){if(e.length!==3)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let i=t.parse(e[1],1,G),n=t.parse(e[2],2,_t(t.expectedType||ae));if(!i||!n)return null;let o=n.type;return new r(o.itemType,i,n)}evaluate(e){let t=this.index.evaluate(e),i=this.input.evaluate(e);if(t<0)throw new Re(`Array index out of bounds: ${t} < 0.`);if(t>=i.length)throw new Re(`Array index out of bounds: ${t} > ${i.length-1}.`);if(t!==Math.floor(t))throw new Re(`Array index must be an integer, but found ${t} instead.`);return i[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}},Vc=class r{constructor(e,t){this.type=oe,this.needle=e,this.haystack=t}static parse(e,t){if(e.length!==3)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let i=t.parse(e[1],1,ae),n=t.parse(e[2],2,ae);return!i||!n?null:ep(i.type,[oe,ue,G,Ci,ae])?new r(i,n):t.error(`Expected first argument to be of type boolean, string, number or null, but found ${Fe(i.type)} instead`)}evaluate(e){let t=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!i)return!1;if(!$r(t,["boolean","string","number","null"]))throw new Re(`Expected first argument to be of type boolean, string, number or null, but found ${Fe(qe(t))} instead.`);if(!$r(i,["string","array"]))throw new Re(`Expected second argument to be of type array or string, but found ${Fe(qe(i))} instead.`);return i.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}},Uc=class r{constructor(e,t,i){this.type=G,this.needle=e,this.haystack=t,this.fromIndex=i}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);let i=t.parse(e[1],1,ae),n=t.parse(e[2],2,ae);if(!i||!n)return null;if(!ep(i.type,[oe,ue,G,Ci,ae]))return t.error(`Expected first argument to be of type boolean, string, number or null, but found ${Fe(i.type)} instead`);if(e.length===4){let o=t.parse(e[3],3,G);return o?new r(i,n,o):null}else return new r(i,n)}evaluate(e){let t=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!$r(t,["boolean","string","number","null"]))throw new Re(`Expected first argument to be of type boolean, string, number or null, but found ${Fe(qe(t))} instead.`);let n;if(this.fromIndex&&(n=this.fromIndex.evaluate(e)),$r(i,["string"])){let o=i.indexOf(t,n);return o===-1?-1:[...i.slice(0,o)].length}else{if($r(i,["array"]))return i.indexOf(t,n);throw new Re(`Expected second argument to be of type array or string, but found ${Fe(qe(i))} instead.`)}}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}},Nc=class r{constructor(e,t,i,n,o,a){this.inputType=e,this.type=t,this.input=i,this.cases=n,this.outputs=o,this.otherwise=a}static parse(e,t){if(e.length<5)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!==1)return t.error("Expected an even number of arguments.");let i,n;t.expectedType&&t.expectedType.kind!=="value"&&(n=t.expectedType);let o={},a=[];for(let u=2;u<e.length-1;u+=2){let c=e[u],p=e[u+1];Array.isArray(c)||(c=[c]);let h=t.concat(u);if(c.length===0)return h.error("Expected at least one branch label.");for(let d of c){if(typeof d!="number"&&typeof d!="string")return h.error("Branch labels must be numbers or strings.");if(typeof d=="number"&&Math.abs(d)>Number.MAX_SAFE_INTEGER)return h.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof d=="number"&&Math.floor(d)!==d)return h.error("Numeric branch labels must be integer values.");if(!i)i=qe(d);else if(h.checkSubtype(i,qe(d)))return null;if(typeof o[String(d)]<"u")return h.error("Branch labels must be unique.");o[String(d)]=a.length}let f=t.parse(p,u,n);if(!f)return null;n=n||f.type,a.push(f)}let s=t.parse(e[1],1,ae);if(!s)return null;let l=t.parse(e[e.length-1],e.length-1,n);return!l||s.type.kind!=="value"&&t.concat(1).checkSubtype(i,s.type)?null:new r(i,n,s,o,a,l)}evaluate(e){let t=this.input.evaluate(e);return(qe(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()}},Gc=class r{constructor(e,t,i){this.type=e,this.branches=t,this.otherwise=i}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!==0)return t.error("Expected an odd number of arguments.");let i;t.expectedType&&t.expectedType.kind!=="value"&&(i=t.expectedType);let n=[];for(let a=1;a<e.length-1;a+=2){let s=t.parse(e[a],a,oe);if(!s)return null;let l=t.parse(e[a+1],a+1,i);if(!l)return null;n.push([s,l]),i=i||l.type}let o=t.parse(e[e.length-1],e.length-1,i);if(!o)return null;if(!i)throw new Error("Can't infer output type");return new r(i,n,o)}evaluate(e){for(let[t,i]of this.branches)if(t.evaluate(e))return i.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(let[t,i]of this.branches)e(t),e(i);e(this.otherwise)}outputDefined(){return this.branches.every(([e,t])=>t.outputDefined())&&this.otherwise.outputDefined()}},$c=class r{constructor(e,t,i,n){this.type=e,this.input=t,this.beginIndex=i,this.endIndex=n}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);let i=t.parse(e[1],1,ae),n=t.parse(e[2],2,G);if(!i||!n)return null;if(!ep(i.type,[_t(ae),ue,ae]))return t.error(`Expected first argument to be of type array or string, but found ${Fe(i.type)} instead`);if(e.length===4){let o=t.parse(e[3],3,G);return o?new r(i.type,i,n,o):null}else return new r(i.type,i,n)}evaluate(e){let t=this.input.evaluate(e),i=this.beginIndex.evaluate(e),n;if(this.endIndex&&(n=this.endIndex.evaluate(e)),$r(t,["string"]))return[...t].slice(i,n).join("");if($r(t,["array"]))return t.slice(i,n);throw new Re(`Expected first argument to be of type array or string, but found ${Fe(qe(t))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}};function ps(r,e){let t=r.length-1,i=0,n=t,o=0,a,s;for(;i<=n;)if(o=Math.floor((i+n)/2),a=r[o],s=r[o+1],a<=e){if(o===t||e<s)return o;i=o+1}else if(a>e)n=o-1;else throw new Re("Input is not a number.");return 0}var Mi=class r{constructor(e,t,i){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(let[n,o]of i)this.labels.push(n),this.outputs.push(o)}static parse(e,t){if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!==0)return t.error("Expected an even number of arguments.");let i=t.parse(e[1],1,G);if(!i)return null;let n=[],o=null;t.expectedType&&t.expectedType.kind!=="value"&&(o=t.expectedType);for(let a=1;a<e.length;a+=2){let s=a===1?-1/0:e[a],l=e[a+1],u=a,c=a+1;if(typeof s!="number")return t.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',u);if(n.length&&n[n.length-1][0]>=s)return t.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',u);let p=t.parse(l,c,o);if(!p)return null;o=o||p.type,n.push([s,p])}return new r(o,i,n)}evaluate(e){let t=this.labels,i=this.outputs;if(t.length===1)return i[0].evaluate(e);let n=this.input.evaluate(e);if(n<=t[0])return i[0].evaluate(e);let o=t.length;if(n>=t[o-1])return i[o-1].evaluate(e);let a=ps(t,n);return i[a].evaluate(e)}eachChild(e){e(this.input);for(let t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}};function Wv(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Lc,Cf;function Xv(){if(Cf)return Lc;Cf=1,Lc=r;function r(e,t,i,n){this.cx=3*e,this.bx=3*(i-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(n-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=i,this.p2y=n}return r.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,t){if(t===void 0&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var i=e,n=0;n<8;n++){var o=this.sampleCurveX(i)-e;if(Math.abs(o)<t)return i;var a=this.sampleCurveDerivativeX(i);if(Math.abs(a)<1e-6)break;i=i-o/a}var s=0,l=1;for(i=e,n=0;n<20&&(o=this.sampleCurveX(i),!(Math.abs(o-e)<t));n++)e>o?s=i:l=i,i=(l-s)*.5+s;return i},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}},Lc}var Kv=Xv(),Jv=Wv(Kv);function Yv(r){return r==="rgb"||r==="hcl"||r==="lab"}function qr(r,e,t){return r+t*(e-r)}function Qv(r,e,t,i="rgb"){switch(i){case"rgb":{let[n,o,a,s]=Qa(r.rgb,e.rgb,t);return new W(n,o,a,s,!1)}case"hcl":{let[n,o,a,s]=r.hcl,[l,u,c,p]=e.hcl,h,f;if(!isNaN(n)&&!isNaN(l)){let v=l-n;l>n&&v>180?v-=360:l<n&&n-l>180&&(v+=360),h=n+t*v}else isNaN(n)?isNaN(l)?h=NaN:(h=l,(a===1||a===0)&&(f=u)):(h=n,(c===1||c===0)&&(f=o));let[d,y,g,x]=Gv([h,f??qr(o,u,t),qr(a,c,t),qr(s,p,t)]);return new W(d,y,g,x,!1)}case"lab":{let[n,o,a,s]=im(Qa(r.lab,e.lab,t));return new W(n,o,a,s,!1)}}}function Qa(r,e,t){return r.map((i,n)=>qr(i,e[n],t))}function e0(r,e,t){return new Ft(Qa(r.values,e.values,t))}function t0(r,e,t){let i=r.values,n=e.values;if(i.length!==n.length)throw new Re(`Cannot interpolate values of different length. from: ${r.toString()}, to: ${e.toString()}`);let o=[];for(let a=0;a<i.length;a+=2){if(i[a]!==n[a])throw new Re(`Cannot interpolate values containing mismatched anchors. from[${a}]: ${i[a]}, to[${a}]: ${n[a]}`);o.push(i[a]);let[s,l]=i[a+1],[u,c]=n[a+1];o.push([qr(s,u,t),qr(l,c,t)])}return new Qt(o)}var Se={number:qr,color:Qv,array:Qa,padding:e0,variableAnchorOffsetCollection:t0},vt=class r{constructor(e,t,i,n,o){this.type=e,this.operator=t,this.interpolation=i,this.input=n,this.labels=[],this.outputs=[];for(let[a,s]of o)this.labels.push(a),this.outputs.push(s)}static interpolationFactor(e,t,i,n){let o=0;if(e.name==="exponential")o=Dc(t,e.base,i,n);else if(e.name==="linear")o=Dc(t,1,i,n);else if(e.name==="cubic-bezier"){let a=e.controlPoints;o=new Jv(a[0],a[1],a[2],a[3]).solve(Dc(t,1,i,n))}return o}static parse(e,t){let[i,n,o,...a]=e;if(!Array.isArray(n)||n.length===0)return t.error("Expected an interpolation type expression.",1);if(n[0]==="linear")n={name:"linear"};else if(n[0]==="exponential"){let u=n[1];if(typeof u!="number")return t.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:u}}else if(n[0]==="cubic-bezier"){let u=n.slice(1);if(u.length!==4||u.some(c=>typeof c!="number"||c<0||c>1))return t.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:u}}else return t.error(`Unknown interpolation type ${String(n[0])}`,1,0);if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!==0)return t.error("Expected an even number of arguments.");if(o=t.parse(o,2,G),!o)return null;let s=[],l=null;i==="interpolate-hcl"||i==="interpolate-lab"?l=It:t.expectedType&&t.expectedType.kind!=="value"&&(l=t.expectedType);for(let u=0;u<a.length;u+=2){let c=a[u],p=a[u+1],h=u+3,f=u+4;if(typeof c!="number")return t.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',h);if(s.length&&s[s.length-1][0]>=c)return t.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',h);let d=t.parse(p,f,l);if(!d)return null;l=l||d.type,s.push([c,d])}return!wn(l,G)&&!wn(l,It)&&!wn(l,us)&&!wn(l,cs)&&!wn(l,_t(G))?t.error(`Type ${Fe(l)} is not interpolatable.`):new r(l,i,n,o,s)}evaluate(e){let t=this.labels,i=this.outputs;if(t.length===1)return i[0].evaluate(e);let n=this.input.evaluate(e);if(n<=t[0])return i[0].evaluate(e);let o=t.length;if(n>=t[o-1])return i[o-1].evaluate(e);let a=ps(t,n),s=t[a],l=t[a+1],u=r.interpolationFactor(this.interpolation,n,s,l),c=i[a].evaluate(e),p=i[a+1].evaluate(e);switch(this.operator){case"interpolate":return Se[this.type.kind](c,p,u);case"interpolate-hcl":return Se.color(c,p,u,"hcl");case"interpolate-lab":return Se.color(c,p,u,"lab")}}eachChild(e){e(this.input);for(let t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}};function Dc(r,e,t,i){let n=i-t,o=r-t;return n===0?0:e===1?o/n:(Math.pow(e,o)-1)/(Math.pow(e,n)-1)}var es=class r{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let i=null,n=t.expectedType;n&&n.kind!=="value"&&(i=n);let o=[];for(let s of e.slice(1)){let l=t.parse(s,1+o.length,i,void 0,{typeAnnotation:"omit"});if(!l)return null;i=i||l.type,o.push(l)}if(!i)throw new Error("No output type");return n&&o.some(s=>An(n,s.type))?new r(ae,o):new r(i,o)}evaluate(e){let t=null,i=0,n;for(let o of this.args)if(i++,t=o.evaluate(e),t&&t instanceof ht&&!t.available&&(n||(n=t.name),t=null,i===this.args.length&&(t=n)),t!==null)break;return t}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}};function Ef(r,e){return r==="=="||r==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function r0(r,e,t){return e===t}function i0(r,e,t){return e!==t}function n0(r,e,t){return e<t}function o0(r,e,t){return e>t}function a0(r,e,t){return e<=t}function s0(r,e,t){return e>=t}function om(r,e,t,i){return i.compare(e,t)===0}function l0(r,e,t,i){return!om(r,e,t,i)}function u0(r,e,t,i){return i.compare(e,t)<0}function c0(r,e,t,i){return i.compare(e,t)>0}function p0(r,e,t,i){return i.compare(e,t)<=0}function h0(r,e,t,i){return i.compare(e,t)>=0}function ki(r,e,t){let i=r!=="=="&&r!=="!=";return class am{constructor(o,a,s){this.type=oe,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,ae);if(!l)return null;if(!Ef(s,l.type))return a.concat(1).error(`"${s}" comparisons are not supported for type '${Fe(l.type)}'.`);let u=a.parse(o[2],2,ae);if(!u)return null;if(!Ef(s,u.type))return a.concat(2).error(`"${s}" comparisons are not supported for type '${Fe(u.type)}'.`);if(l.type.kind!==u.type.kind&&l.type.kind!=="value"&&u.type.kind!=="value")return a.error(`Cannot compare types '${Fe(l.type)}' and '${Fe(u.type)}'.`);i&&(l.type.kind==="value"&&u.type.kind!=="value"?l=new zt(u.type,[l]):l.type.kind!=="value"&&u.type.kind==="value"&&(u=new zt(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,ls),!c)return null}return new am(l,u,c)}evaluate(o){let a=this.lhs.evaluate(o),s=this.rhs.evaluate(o);if(i&&this.hasUntypedArgument){let l=qe(a),u=qe(s);if(l.kind!==u.kind||!(l.kind==="string"||l.kind==="number"))throw new Re(`Expected arguments for "${r}" to be (string, string) or (number, number), but found (${l.kind}, ${u.kind}) instead.`)}if(this.collator&&!i&&this.hasUntypedArgument){let l=qe(a),u=qe(s);if(l.kind!=="string"||u.kind!=="string")return e(o,a,s)}return this.collator?t(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 f0=ki("==",r0,om),m0=ki("!=",i0,l0),d0=ki("<",n0,u0),y0=ki(">",o0,c0),g0=ki("<=",a0,p0),x0=ki(">=",s0,h0),ts=class r{constructor(e,t,i){this.type=ls,this.locale=i,this.caseSensitive=e,this.diacriticSensitive=t}static parse(e,t){if(e.length!==2)return t.error("Expected one argument.");let i=e[1];if(typeof i!="object"||Array.isArray(i))return t.error("Collator options argument must be an object.");let n=t.parse(i["case-sensitive"]===void 0?!1:i["case-sensitive"],1,oe);if(!n)return null;let o=t.parse(i["diacritic-sensitive"]===void 0?!1:i["diacritic-sensitive"],1,oe);if(!o)return null;let a=null;return i.locale&&(a=t.parse(i.locale,1,ue),!a)?null:new r(n,o,a)}evaluate(e){return new Mn(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}},qc=class r{constructor(e,t,i,n,o){this.type=ue,this.number=e,this.locale=t,this.currency=i,this.minFractionDigits=n,this.maxFractionDigits=o}static parse(e,t){if(e.length!==3)return t.error("Expected two arguments.");let i=t.parse(e[1],1,G);if(!i)return null;let n=e[2];if(typeof n!="object"||Array.isArray(n))return t.error("NumberFormat options argument must be an object.");let o=null;if(n.locale&&(o=t.parse(n.locale,1,ue),!o))return null;let a=null;if(n.currency&&(a=t.parse(n.currency,1,ue),!a))return null;let s=null;if(n["min-fraction-digits"]&&(s=t.parse(n["min-fraction-digits"],1,G),!s))return null;let l=null;return n["max-fraction-digits"]&&(l=t.parse(n["max-fraction-digits"],1,G),!l)?null:new r(i,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}},En=class r{constructor(e){this.type=Ei,this.sections=e}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let i=e[1];if(!Array.isArray(i)&&typeof i=="object")return t.error("First argument must be an image or text section.");let n=[],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=t.parse(s["font-scale"],1,G),!l))return null;let u=null;if(s["text-font"]&&(u=t.parse(s["text-font"],1,_t(ue)),!u))return null;let c=null;if(s["text-color"]&&(c=t.parse(s["text-color"],1,It),!c))return null;let p=n[n.length-1];p.scale=l,p.font=u,p.textColor=c}else{let l=t.parse(e[a],1,ae);if(!l)return null;let u=l.type.kind;if(u!=="string"&&u!=="value"&&u!=="null"&&u!=="resolvedImage")return t.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");o=!0,n.push({content:l,scale:null,font:null,textColor:null})}}return new r(n)}evaluate(e){let t=i=>{let n=i.content.evaluate(e);return qe(n)===On?new In("",n,null,null,null):new In(Pn(n),null,i.scale?i.scale.evaluate(e):null,i.font?i.font.evaluate(e).join(","):null,i.textColor?i.textColor.evaluate(e):null)};return new wt(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}},jc=class r{constructor(e){this.type=On,this.input=e}static parse(e,t){if(e.length!==2)return t.error("Expected two arguments.");let i=t.parse(e[1],1,ue);return i?new r(i):t.error("No image name provided.")}evaluate(e){let t=this.input.evaluate(e),i=ht.fromString(t);return i&&e.availableImages&&(i.available=e.availableImages.indexOf(t)>-1),i}eachChild(e){e(this.input)}outputDefined(){return!1}},Zc=class r{constructor(e){this.type=G,this.input=e}static parse(e,t){if(e.length!==2)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`);let i=t.parse(e[1],1);return i?i.type.kind!=="array"&&i.type.kind!=="string"&&i.type.kind!=="value"?t.error(`Expected argument of type string or array, but found ${Fe(i.type)} instead.`):new r(i):null}evaluate(e){let t=this.input.evaluate(e);if(typeof t=="string")return[...t].length;if(Array.isArray(t))return t.length;throw new Re(`Expected value to be of type string or array, but found ${Fe(qe(t))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}},Vt=8192;function b0(r,e){let t=_0(r[0]),i=w0(r[1]),n=Math.pow(2,e.z);return[Math.round(t*n*Vt),Math.round(i*n*Vt)]}function tp(r,e){let t=Math.pow(2,e.z),i=(r[0]/Vt+e.x)/t,n=(r[1]/Vt+e.y)/t;return[v0(i),S0(n)]}function _0(r){return(180+r)/360}function v0(r){return r*360-180}function w0(r){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360}function S0(r){return 360/Math.PI*Math.atan(Math.exp((180-r*360)*Math.PI/180))-90}function Vn(r,e){r[0]=Math.min(r[0],e[0]),r[1]=Math.min(r[1],e[1]),r[2]=Math.max(r[2],e[0]),r[3]=Math.max(r[3],e[1])}function kn(r,e){return!(r[0]<=e[0]||r[2]>=e[2]||r[1]<=e[1]||r[3]>=e[3])}function P0(r,e,t){return e[1]>r[1]!=t[1]>r[1]&&r[0]<(t[0]-e[0])*(r[1]-e[1])/(t[1]-e[1])+e[0]}function T0(r,e,t){let i=r[0]-e[0],n=r[1]-e[1],o=r[0]-t[0],a=r[1]-t[1];return i*a-o*n===0&&i*o<=0&&n*a<=0}function hs(r,e,t,i){let n=[e[0]-r[0],e[1]-r[1]],o=[i[0]-t[0],i[1]-t[1]];return C0(o,n)===0?!1:!!(kf(r,e,t,i)&&kf(t,i,r,e))}function A0(r,e,t){for(let i of t)for(let n=0;n<i.length-1;++n)if(hs(r,e,i[n],i[n+1]))return!0;return!1}function Li(r,e,t=!1){let i=!1;for(let n of e)for(let o=0;o<n.length-1;o++){if(T0(r,n[o],n[o+1]))return t;P0(r,n[o],n[o+1])&&(i=!i)}return i}function M0(r,e){for(let t of e)if(Li(r,t))return!0;return!1}function sm(r,e){for(let t of r)if(!Li(t,e))return!1;for(let t=0;t<r.length-1;++t)if(A0(r[t],r[t+1],e))return!1;return!0}function I0(r,e){for(let t of e)if(sm(r,t))return!0;return!1}function C0(r,e){return r[0]*e[1]-r[1]*e[0]}function kf(r,e,t,i){let n=r[0]-t[0],o=r[1]-t[1],a=e[0]-t[0],s=e[1]-t[1],l=i[0]-t[0],u=i[1]-t[1],c=n*u-l*o,p=a*u-l*s;return c>0&&p<0||c<0&&p>0}function rp(r,e,t){let i=[];for(let n=0;n<r.length;n++){let o=[];for(let a=0;a<r[n].length;a++){let s=b0(r[n][a],t);Vn(e,s),o.push(s)}i.push(o)}return i}function lm(r,e,t){let i=[];for(let n=0;n<r.length;n++){let o=rp(r[n],e,t);i.push(o)}return i}function um(r,e,t,i){if(r[0]<t[0]||r[0]>t[2]){let n=i*.5,o=r[0]-t[0]>n?-i:t[0]-r[0]>n?i:0;o===0&&(o=r[0]-t[2]>n?-i:t[2]-r[0]>n?i:0),r[0]+=o}Vn(e,r)}function E0(r){r[0]=r[1]=1/0,r[2]=r[3]=-1/0}function Lf(r,e,t,i){let n=Math.pow(2,i.z)*Vt,o=[i.x*Vt,i.y*Vt],a=[];for(let s of r)for(let l of s){let u=[l.x+o[0],l.y+o[1]];um(u,e,t,n),a.push(u)}return a}function Df(r,e,t,i){let n=Math.pow(2,i.z)*Vt,o=[i.x*Vt,i.y*Vt],a=[];for(let s of r){let l=[];for(let u of s){let c=[u.x+o[0],u.y+o[1]];Vn(e,c),l.push(c)}a.push(l)}if(e[2]-e[0]<=n/2){E0(e);for(let s of a)for(let l of s)um(l,e,t,n)}return a}function k0(r,e){let t=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],n=r.canonicalID();if(e.type==="Polygon"){let o=rp(e.coordinates,i,n),a=Lf(r.geometry(),t,i,n);if(!kn(t,i))return!1;for(let s of a)if(!Li(s,o))return!1}if(e.type==="MultiPolygon"){let o=lm(e.coordinates,i,n),a=Lf(r.geometry(),t,i,n);if(!kn(t,i))return!1;for(let s of a)if(!M0(s,o))return!1}return!0}function L0(r,e){let t=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],n=r.canonicalID();if(e.type==="Polygon"){let o=rp(e.coordinates,i,n),a=Df(r.geometry(),t,i,n);if(!kn(t,i))return!1;for(let s of a)if(!sm(s,o))return!1}if(e.type==="MultiPolygon"){let o=lm(e.coordinates,i,n),a=Df(r.geometry(),t,i,n);if(!kn(t,i))return!1;for(let s of a)if(!I0(s,o))return!1}return!0}var Ln=class r{constructor(e,t){this.type=oe,this.geojson=e,this.geometries=t}static parse(e,t){if(e.length!==2)return t.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Cn(e[1])){let i=e[1];if(i.type==="FeatureCollection"){let n=[];for(let o of i.features){let{type:a,coordinates:s}=o.geometry;a==="Polygon"&&n.push(s),a==="MultiPolygon"&&n.push(...s)}if(n.length){let o={type:"MultiPolygon",coordinates:n};return new r(i,o)}}else if(i.type==="Feature"){let n=i.geometry.type;if(n==="Polygon"||n==="MultiPolygon")return new r(i,i.geometry)}else if(i.type==="Polygon"||i.type==="MultiPolygon")return new r(i,i)}return t.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return k0(e,this.geometries);if(e.geometryType()==="LineString")return L0(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}},rs=class{constructor(e=[],t=(i,n)=>i<n?-1:i>n?1:0){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let i=(this.length>>1)-1;i>=0;i--)this._down(i)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;let e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:t,compare:i}=this,n=t[e];for(;e>0;){let o=e-1>>1,a=t[o];if(i(n,a)>=0)break;t[e]=a,e=o}t[e]=n}_down(e){let{data:t,compare:i}=this,n=this.length>>1,o=t[e];for(;e<n;){let a=(e<<1)+1,s=a+1;if(s<this.length&&i(t[s],t[a])<0&&(a=s),i(t[a],o)>=0)break;t[e]=t[a],e=a}t[e]=o}};function D0(r,e,t,i,n){cm(r,e,t,i||r.length-1,n||z0)}function cm(r,e,t,i,n){for(;i>t;){if(i-t>600){var o=i-t+1,a=e-t+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(t,Math.floor(e-a*l/o+u)),p=Math.min(i,Math.floor(e+(o-a)*l/o+u));cm(r,e,c,p,n)}var h=r[e],f=t,d=i;for(Sn(r,t,e),n(r[i],h)>0&&Sn(r,t,i);f<d;){for(Sn(r,f,d),f++,d--;n(r[f],h)<0;)f++;for(;n(r[d],h)>0;)d--}n(r[t],h)===0?Sn(r,t,d):(d++,Sn(r,d,i)),d<=e&&(t=d+1),e<=d&&(i=d-1)}}function Sn(r,e,t){var i=r[e];r[e]=r[t],r[t]=i}function z0(r,e){return r<e?-1:r>e?1:0}function F0(r,e){if(r.length<=1)return[r];let i=[],n,o;for(let a of r){let s=B0(a);s!==0&&(a.area=Math.abs(s),o===void 0&&(o=s<0),o===s<0?(n&&i.push(n),n=[a]):n.push(a))}if(n&&i.push(n),e>1)for(let a=0;a<i.length;a++)i[a].length<=e||(D0(i[a],e,1,i[a].length-1,R0),i[a]=i[a].slice(0,e));return i}function R0(r,e){return e.area-r.area}function B0(r){let e=0;for(let t=0,i=r.length,n=i-1,o,a;t<i;n=t++)o=r[t],a=r[n],e+=(a.x-o.x)*(o.y+a.y);return e}var O0=6378.137,zf=1/298.257223563,Ff=zf*(2-zf),Rf=Math.PI/180,Dn=class{constructor(e){let t=Rf*O0*1e3,i=Math.cos(e*Rf),n=1/(1-Ff*(1-i*i)),o=Math.sqrt(n);this.kx=t*o*i,this.ky=t*o*n*(1-Ff)}distance(e,t){let i=this.wrap(e[0]-t[0])*this.kx,n=(e[1]-t[1])*this.ky;return Math.sqrt(i*i+n*n)}pointOnLine(e,t){let i=1/0,n,o,a,s;for(let l=0;l<e.length-1;l++){let u=e[l][0],c=e[l][1],p=this.wrap(e[l+1][0]-u)*this.kx,h=(e[l+1][1]-c)*this.ky,f=0;(p!==0||h!==0)&&(f=(this.wrap(t[0]-u)*this.kx*p+(t[1]-c)*this.ky*h)/(p*p+h*h),f>1?(u=e[l+1][0],c=e[l+1][1]):f>0&&(u+=p/this.kx*f,c+=h/this.ky*f)),p=this.wrap(t[0]-u)*this.kx,h=(t[1]-c)*this.ky;let d=p*p+h*h;d<i&&(i=d,n=u,o=c,a=l,s=f)}return{point:[n,o],index:a,t:Math.max(0,Math.min(1,s))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}},Hc=100,Wc=50;function pm(r,e){return e[0]-r[0]}function is(r){return r[1]-r[0]+1}function er(r,e){return r[1]>=r[0]&&r[1]<e}function Xc(r,e){if(r[0]>r[1])return[null,null];let t=is(r);if(e){if(t===2)return[r,null];let n=Math.floor(t/2);return[[r[0],r[0]+n],[r[0]+n,r[1]]]}if(t===1)return[r,null];let i=Math.floor(t/2)-1;return[[r[0],r[0]+i],[r[0]+i+1,r[1]]]}function Kc(r,e){if(!er(e,r.length))return[1/0,1/0,-1/0,-1/0];let t=[1/0,1/0,-1/0,-1/0];for(let i=e[0];i<=e[1];++i)Vn(t,r[i]);return t}function Jc(r){let e=[1/0,1/0,-1/0,-1/0];for(let t of r)for(let i of t)Vn(e,i);return e}function Bf(r){return r[0]!==-1/0&&r[1]!==-1/0&&r[2]!==1/0&&r[3]!==1/0}function ip(r,e,t){if(!Bf(r)||!Bf(e))return NaN;let i=0,n=0;return r[2]<e[0]&&(i=e[0]-r[2]),r[0]>e[2]&&(i=r[0]-e[2]),r[1]>e[3]&&(n=r[1]-e[3]),r[3]<e[1]&&(n=e[1]-r[3]),t.distance([0,0],[i,n])}function Gr(r,e,t){let i=t.pointOnLine(e,r);return t.distance(r,i.point)}function np(r,e,t,i,n){let o=Math.min(Gr(r,[t,i],n),Gr(e,[t,i],n)),a=Math.min(Gr(t,[r,e],n),Gr(i,[r,e],n));return Math.min(o,a)}function V0(r,e,t,i,n){if(!(er(e,r.length)&&er(i,t.length)))return 1/0;let a=1/0;for(let s=e[0];s<e[1];++s){let l=r[s],u=r[s+1];for(let c=i[0];c<i[1];++c){let p=t[c],h=t[c+1];if(hs(l,u,p,h))return 0;a=Math.min(a,np(l,u,p,h,n))}}return a}function U0(r,e,t,i,n){if(!(er(e,r.length)&&er(i,t.length)))return NaN;let a=1/0;for(let s=e[0];s<=e[1];++s)for(let l=i[0];l<=i[1];++l)if(a=Math.min(a,n.distance(r[s],t[l])),a===0)return a;return a}function N0(r,e,t){if(Li(r,e,!0))return 0;let i=1/0;for(let n of e){let o=n[0],a=n[n.length-1];if(o!==a&&(i=Math.min(i,Gr(r,[a,o],t)),i===0))return i;let s=t.pointOnLine(n,r);if(i=Math.min(i,t.distance(r,s.point)),i===0)return i}return i}function G0(r,e,t,i){if(!er(e,r.length))return NaN;for(let o=e[0];o<=e[1];++o)if(Li(r[o],t,!0))return 0;let n=1/0;for(let o=e[0];o<e[1];++o){let a=r[o],s=r[o+1];for(let l of t)for(let u=0,c=l.length,p=c-1;u<c;p=u++){let h=l[p],f=l[u];if(hs(a,s,h,f))return 0;n=Math.min(n,np(a,s,h,f,i))}}return n}function Of(r,e){for(let t of r)for(let i of t)if(Li(i,e,!0))return!0;return!1}function $0(r,e,t,i=1/0){let n=Jc(r),o=Jc(e);if(i!==1/0&&ip(n,o,t)>=i)return i;if(kn(n,o)){if(Of(r,e))return 0}else if(Of(e,r))return 0;let a=1/0;for(let s of r)for(let l=0,u=s.length,c=u-1;l<u;c=l++){let p=s[c],h=s[l];for(let f of e)for(let d=0,y=f.length,g=y-1;d<y;g=d++){let x=f[g],v=f[d];if(hs(p,h,x,v))return 0;a=Math.min(a,np(p,h,x,v,t))}}return a}function Vf(r,e,t,i,n,o){if(!o)return;let a=ip(Kc(i,o),n,t);a<e&&r.push([a,o,[0,0]])}function Za(r,e,t,i,n,o,a){if(!o||!a)return;let s=ip(Kc(i,o),Kc(n,a),t);s<e&&r.push([s,o,a])}function ns(r,e,t,i,n=1/0){let o=Math.min(i.distance(r[0],t[0][0]),n);if(o===0)return o;let a=new rs([[0,[0,r.length-1],[0,0]]],pm),s=Jc(t);for(;a.length>0;){let l=a.pop();if(l[0]>=o)continue;let u=l[1],c=e?Wc:Hc;if(is(u)<=c){if(!er(u,r.length))return NaN;if(e){let p=G0(r,u,t,i);if(isNaN(p)||p===0)return p;o=Math.min(o,p)}else for(let p=u[0];p<=u[1];++p){let h=N0(r[p],t,i);if(o=Math.min(o,h),o===0)return 0}}else{let p=Xc(u,e);Vf(a,o,i,r,s,p[0]),Vf(a,o,i,r,s,p[1])}}return o}function os(r,e,t,i,n,o=1/0){let a=Math.min(o,n.distance(r[0],t[0]));if(a===0)return a;let s=new rs([[0,[0,r.length-1],[0,t.length-1]]],pm);for(;s.length>0;){let l=s.pop();if(l[0]>=a)continue;let u=l[1],c=l[2],p=e?Wc:Hc,h=i?Wc:Hc;if(is(u)<=p&&is(c)<=h){if(!er(u,r.length)&&er(c,t.length))return NaN;let f;if(e&&i)f=V0(r,u,t,c,n),a=Math.min(a,f);else if(e&&!i){let d=r.slice(u[0],u[1]+1);for(let y=c[0];y<=c[1];++y)if(f=Gr(t[y],d,n),a=Math.min(a,f),a===0)return a}else if(!e&&i){let d=t.slice(c[0],c[1]+1);for(let y=u[0];y<=u[1];++y)if(f=Gr(r[y],d,n),a=Math.min(a,f),a===0)return a}else f=U0(r,u,t,c,n),a=Math.min(a,f)}else{let f=Xc(u,e),d=Xc(c,i);Za(s,a,n,r,t,f[0],d[0]),Za(s,a,n,r,t,f[0],d[1]),Za(s,a,n,r,t,f[1],d[0]),Za(s,a,n,r,t,f[1],d[1])}}return a}function q0(r,e){let t=r.geometry(),i=t.flat().map(a=>tp([a.x,a.y],r.canonical));if(t.length===0)return NaN;let n=new Dn(i[0][1]),o=1/0;for(let a of e){switch(a.type){case"Point":o=Math.min(o,os(i,!1,[a.coordinates],!1,n,o));break;case"LineString":o=Math.min(o,os(i,!1,a.coordinates,!0,n,o));break;case"Polygon":o=Math.min(o,ns(i,!1,a.coordinates,n,o));break}if(o===0)return o}return o}function j0(r,e){let t=r.geometry(),i=t.flat().map(a=>tp([a.x,a.y],r.canonical));if(t.length===0)return NaN;let n=new Dn(i[0][1]),o=1/0;for(let a of e){switch(a.type){case"Point":o=Math.min(o,os(i,!0,[a.coordinates],!1,n,o));break;case"LineString":o=Math.min(o,os(i,!0,a.coordinates,!0,n,o));break;case"Polygon":o=Math.min(o,ns(i,!0,a.coordinates,n,o));break}if(o===0)return o}return o}function Z0(r,e){let t=r.geometry();if(t.length===0||t[0].length===0)return NaN;let i=F0(t,0).map(a=>a.map(s=>s.map(l=>tp([l.x,l.y],r.canonical)))),n=new Dn(i[0][0][0][1]),o=1/0;for(let a of e)for(let s of i){switch(a.type){case"Point":o=Math.min(o,ns([a.coordinates],!1,s,n,o));break;case"LineString":o=Math.min(o,ns(a.coordinates,!0,s,n,o));break;case"Polygon":o=Math.min(o,$0(s,a.coordinates,n,o));break}if(o===0)return o}return o}function zc(r){return r.type==="MultiPolygon"?r.coordinates.map(e=>({type:"Polygon",coordinates:e})):r.type==="MultiLineString"?r.coordinates.map(e=>({type:"LineString",coordinates:e})):r.type==="MultiPoint"?r.coordinates.map(e=>({type:"Point",coordinates:e})):[r]}var zn=class r{constructor(e,t){this.type=G,this.geojson=e,this.geometries=t}static parse(e,t){if(e.length!==2)return t.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Cn(e[1])){let i=e[1];if(i.type==="FeatureCollection")return new r(i,i.features.map(n=>zc(n.geometry)).flat());if(i.type==="Feature")return new r(i,zc(i.geometry));if("type"in i&&"coordinates"in i)return new r(i,zc(i))}return t.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return q0(e,this.geometries);if(e.geometryType()==="LineString")return j0(e,this.geometries);if(e.geometryType()==="Polygon")return Z0(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}},Wr={"==":f0,"!=":m0,">":y0,"<":d0,">=":x0,"<=":g0,array:zt,at:Oc,boolean:zt,case:Gc,coalesce:es,collator:ts,format:En,image:jc,in:Vc,"index-of":Uc,interpolate:vt,"interpolate-hcl":vt,"interpolate-lab":vt,length:Zc,let:Ja,literal:dr,match:Nc,number:zt,"number-format":qc,object:zt,slice:$c,step:Mi,string:zt,"to-boolean":mr,"to-color":mr,"to-number":mr,"to-string":mr,var:Ya,within:Ln,distance:zn},Ut=class r{constructor(e,t,i,n){this.name=e,this.type=t,this._evaluate=i,this.args=n}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,t){let i=e[0],n=r.definitions[i];if(!n)return t.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);let o=Array.isArray(n)?n[0]:n.type,a=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,s=a.filter(([u])=>!Array.isArray(u)||u.length===e.length-1),l=null;for(let[u,c]of s){l=new Ka(t.registry,as,t.path,null,t.scope);let p=[],h=!1;for(let f=1;f<e.length;f++){let d=e[f],y=Array.isArray(u)?u[f-1]:u.type,g=l.parse(d,1+p.length,y);if(!g){h=!0;break}p.push(g)}if(!h){if(Array.isArray(u)&&u.length!==p.length){l.error(`Expected ${u.length} arguments, but found ${p.length} instead.`);continue}for(let f=0;f<p.length;f++){let d=Array.isArray(u)?u[f]:u.type,y=p[f];l.concat(f+1).checkSubtype(d,y.type)}if(l.errors.length===0)return new r(i,o,c,p)}}if(s.length===1)t.errors.push(...l.errors);else{let c=(s.length?s:a).map(([h])=>W0(h)).join(" | "),p=[];for(let h=1;h<e.length;h++){let f=t.parse(e[h],1+p.length);if(!f)return null;p.push(Fe(f.type))}t.error(`Expected arguments of type ${c}, but found (${p.join(", ")}) instead.`)}return null}static register(e,t){r.definitions=t;for(let i in t)e[i]=r}};function Uf(r,[e,t,i,n]){e=e.evaluate(r),t=t.evaluate(r),i=i.evaluate(r);let o=n?n.evaluate(r):1,a=nm(e,t,i,o);if(a)throw new Re(a);return new W(e/255,t/255,i/255,o,!1)}function Nf(r,e){return r in e}function Fc(r,e){let t=e[r];return typeof t>"u"?null:t}function H0(r,e,t,i){for(;t<=i;){let n=t+i>>1;if(e[n]===r)return!0;e[n]>r?i=n-1:t=n+1}return!1}function Nr(r){return{type:r}}Ut.register(Wr,{error:[Rv,[ue],(r,[e])=>{throw new Re(e.evaluate(r))}],typeof:[ue,[ae],(r,[e])=>Fe(qe(e.evaluate(r)))],"to-rgba":[_t(G,4),[It],(r,[e])=>{let[t,i,n,o]=e.evaluate(r).rgb;return[t*255,i*255,n*255,o]}],rgb:[It,[G,G,G],Uf],rgba:[It,[G,G,G,G],Uf],has:{type:oe,overloads:[[[ue],(r,[e])=>Nf(e.evaluate(r),r.properties())],[[ue,Pi],(r,[e,t])=>Nf(e.evaluate(r),t.evaluate(r))]]},get:{type:ae,overloads:[[[ue],(r,[e])=>Fc(e.evaluate(r),r.properties())],[[ue,Pi],(r,[e,t])=>Fc(e.evaluate(r),t.evaluate(r))]]},"feature-state":[ae,[ue],(r,[e])=>Fc(e.evaluate(r),r.featureState||{})],properties:[Pi,[],r=>r.properties()],"geometry-type":[ue,[],r=>r.geometryType()],id:[ae,[],r=>r.id()],zoom:[G,[],r=>r.globals.zoom],"heatmap-density":[G,[],r=>r.globals.heatmapDensity||0],"line-progress":[G,[],r=>r.globals.lineProgress||0],accumulated:[ae,[],r=>r.globals.accumulated===void 0?null:r.globals.accumulated],"+":[G,Nr(G),(r,e)=>{let t=0;for(let i of e)t+=i.evaluate(r);return t}],"*":[G,Nr(G),(r,e)=>{let t=1;for(let i of e)t*=i.evaluate(r);return t}],"-":{type:G,overloads:[[[G,G],(r,[e,t])=>e.evaluate(r)-t.evaluate(r)],[[G],(r,[e])=>-e.evaluate(r)]]},"/":[G,[G,G],(r,[e,t])=>e.evaluate(r)/t.evaluate(r)],"%":[G,[G,G],(r,[e,t])=>e.evaluate(r)%t.evaluate(r)],ln2:[G,[],()=>Math.LN2],pi:[G,[],()=>Math.PI],e:[G,[],()=>Math.E],"^":[G,[G,G],(r,[e,t])=>Math.pow(e.evaluate(r),t.evaluate(r))],sqrt:[G,[G],(r,[e])=>Math.sqrt(e.evaluate(r))],log10:[G,[G],(r,[e])=>Math.log(e.evaluate(r))/Math.LN10],ln:[G,[G],(r,[e])=>Math.log(e.evaluate(r))],log2:[G,[G],(r,[e])=>Math.log(e.evaluate(r))/Math.LN2],sin:[G,[G],(r,[e])=>Math.sin(e.evaluate(r))],cos:[G,[G],(r,[e])=>Math.cos(e.evaluate(r))],tan:[G,[G],(r,[e])=>Math.tan(e.evaluate(r))],asin:[G,[G],(r,[e])=>Math.asin(e.evaluate(r))],acos:[G,[G],(r,[e])=>Math.acos(e.evaluate(r))],atan:[G,[G],(r,[e])=>Math.atan(e.evaluate(r))],min:[G,Nr(G),(r,e)=>Math.min(...e.map(t=>t.evaluate(r)))],max:[G,Nr(G),(r,e)=>Math.max(...e.map(t=>t.evaluate(r)))],abs:[G,[G],(r,[e])=>Math.abs(e.evaluate(r))],round:[G,[G],(r,[e])=>{let t=e.evaluate(r);return t<0?-Math.round(-t):Math.round(t)}],floor:[G,[G],(r,[e])=>Math.floor(e.evaluate(r))],ceil:[G,[G],(r,[e])=>Math.ceil(e.evaluate(r))],"filter-==":[oe,[ue,ae],(r,[e,t])=>r.properties()[e.value]===t.value],"filter-id-==":[oe,[ae],(r,[e])=>r.id()===e.value],"filter-type-==":[oe,[ue],(r,[e])=>r.geometryType()===e.value],"filter-<":[oe,[ue,ae],(r,[e,t])=>{let i=r.properties()[e.value],n=t.value;return typeof i==typeof n&&i<n}],"filter-id-<":[oe,[ae],(r,[e])=>{let t=r.id(),i=e.value;return typeof t==typeof i&&t<i}],"filter->":[oe,[ue,ae],(r,[e,t])=>{let i=r.properties()[e.value],n=t.value;return typeof i==typeof n&&i>n}],"filter-id->":[oe,[ae],(r,[e])=>{let t=r.id(),i=e.value;return typeof t==typeof i&&t>i}],"filter-<=":[oe,[ue,ae],(r,[e,t])=>{let i=r.properties()[e.value],n=t.value;return typeof i==typeof n&&i<=n}],"filter-id-<=":[oe,[ae],(r,[e])=>{let t=r.id(),i=e.value;return typeof t==typeof i&&t<=i}],"filter->=":[oe,[ue,ae],(r,[e,t])=>{let i=r.properties()[e.value],n=t.value;return typeof i==typeof n&&i>=n}],"filter-id->=":[oe,[ae],(r,[e])=>{let t=r.id(),i=e.value;return typeof t==typeof i&&t>=i}],"filter-has":[oe,[ae],(r,[e])=>e.value in r.properties()],"filter-has-id":[oe,[],r=>r.id()!==null&&r.id()!==void 0],"filter-type-in":[oe,[_t(ue)],(r,[e])=>e.value.indexOf(r.geometryType())>=0],"filter-id-in":[oe,[_t(ae)],(r,[e])=>e.value.indexOf(r.id())>=0],"filter-in-small":[oe,[ue,_t(ae)],(r,[e,t])=>t.value.indexOf(r.properties()[e.value])>=0],"filter-in-large":[oe,[ue,_t(ae)],(r,[e,t])=>H0(r.properties()[e.value],t.value,0,t.value.length-1)],all:{type:oe,overloads:[[[oe,oe],(r,[e,t])=>e.evaluate(r)&&t.evaluate(r)],[Nr(oe),(r,e)=>{for(let t of e)if(!t.evaluate(r))return!1;return!0}]]},any:{type:oe,overloads:[[[oe,oe],(r,[e,t])=>e.evaluate(r)||t.evaluate(r)],[Nr(oe),(r,e)=>{for(let t of e)if(t.evaluate(r))return!0;return!1}]]},"!":[oe,[oe],(r,[e])=>!e.evaluate(r)],"is-supported-script":[oe,[ue],(r,[e])=>{let t=r.globals&&r.globals.isSupportedScript;return t?t(e.evaluate(r)):!0}],upcase:[ue,[ue],(r,[e])=>e.evaluate(r).toUpperCase()],downcase:[ue,[ue],(r,[e])=>e.evaluate(r).toLowerCase()],concat:[ue,Nr(ae),(r,e)=>e.map(t=>Pn(t.evaluate(r))).join("")],"resolved-locale":[ue,[ls],(r,[e])=>e.evaluate(r).resolvedLocale()]});function W0(r){return Array.isArray(r)?`(${r.map(Fe).join(", ")})`:`(${Fe(r.type)}...)`}function as(r){if(r instanceof Ya)return as(r.boundExpression);if(r instanceof Ut&&r.name==="error")return!1;if(r instanceof ts)return!1;if(r instanceof Ln)return!1;if(r instanceof zn)return!1;let e=r instanceof mr||r instanceof zt,t=!0;return r.eachChild(i=>{e?t=t&&as(i):t=t&&i instanceof dr}),t?fs(r)&&ms(r,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"]):!1}function fs(r){if(r instanceof Ut){if(r.name==="get"&&r.args.length===1)return!1;if(r.name==="feature-state")return!1;if(r.name==="has"&&r.args.length===1)return!1;if(r.name==="properties"||r.name==="geometry-type"||r.name==="id")return!1;if(/^filter-/.test(r.name))return!1}if(r instanceof Ln||r instanceof zn)return!1;let e=!0;return r.eachChild(t=>{e&&!fs(t)&&(e=!1)}),e}function Fn(r){if(r instanceof Ut&&r.name==="feature-state")return!1;let e=!0;return r.eachChild(t=>{e&&!Fn(t)&&(e=!1)}),e}function ms(r,e){if(r instanceof Ut&&e.indexOf(r.name)>=0)return!1;let t=!0;return r.eachChild(i=>{t&&!ms(i,e)&&(t=!1)}),t}function Yc(r){return{result:"success",value:r}}function Si(r){return{result:"error",value:r}}function yr(r){return r["property-type"]==="data-driven"||r["property-type"]==="cross-faded-data-driven"}function hm(r){return!!r.expression&&r.expression.parameters.indexOf("zoom")>-1}function op(r){return!!r.expression&&r.expression.interpolated}function ge(r){return r instanceof Number?"number":r instanceof String?"string":r instanceof Boolean?"boolean":Array.isArray(r)?"array":r===null?"null":typeof r}function ds(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}function X0(r){return r}function fm(r,e){let t=e.type==="color",i=r.stops&&typeof r.stops[0][0]=="object",n=i||r.property!==void 0,o=i||!n,a=r.type||(op(e)?"exponential":"interval");if(t||e.type==="padding"){let c=t?W.parse:Ft.parse;r=Ai({},r),r.stops&&(r.stops=r.stops.map(p=>[p[0],c(p[1])])),r.default?r.default=c(r.default):r.default=c(e.default)}if(r.colorSpace&&!Yv(r.colorSpace))throw new Error(`Unknown color space: "${r.colorSpace}"`);let s,l,u;if(a==="exponential")s=Gf;else if(a==="interval")s=J0;else if(a==="categorical"){s=K0,l=Object.create(null);for(let c of r.stops)l[c[0]]=c[1];u=typeof r.stops[0][0]}else if(a==="identity")s=Y0;else throw new Error(`Unknown function type "${a}"`);if(i){let c={},p=[];for(let d=0;d<r.stops.length;d++){let y=r.stops[d],g=y[0].zoom;c[g]===void 0&&(c[g]={zoom:g,type:r.type,property:r.property,default:r.default,stops:[]},p.push(g)),c[g].stops.push([y[0].value,y[1]])}let h=[];for(let d of p)h.push([c[d].zoom,fm(c[d],e)]);let f={name:"linear"};return{kind:"composite",interpolationType:f,interpolationFactor:vt.interpolationFactor.bind(void 0,f),zoomStops:h.map(d=>d[0]),evaluate({zoom:d},y){return Gf({stops:h,base:r.base},e,d).evaluate(d,y)}}}else if(o){let c=a==="exponential"?{name:"exponential",base:r.base!==void 0?r.base:1}:null;return{kind:"camera",interpolationType:c,interpolationFactor:vt.interpolationFactor.bind(void 0,c),zoomStops:r.stops.map(p=>p[0]),evaluate:({zoom:p})=>s(r,e,p,l,u)}}else return{kind:"source",evaluate(c,p){let h=p&&p.properties?p.properties[r.property]:void 0;return h===void 0?Un(r.default,e.default):s(r,e,h,l,u)}}}function Un(r,e,t){if(r!==void 0)return r;if(e!==void 0)return e;if(t!==void 0)return t}function K0(r,e,t,i,n){let o=typeof t===n?i[t]:void 0;return Un(o,r.default,e.default)}function J0(r,e,t){if(ge(t)!=="number")return Un(r.default,e.default);let i=r.stops.length;if(i===1||t<=r.stops[0][0])return r.stops[0][1];if(t>=r.stops[i-1][0])return r.stops[i-1][1];let n=ps(r.stops.map(o=>o[0]),t);return r.stops[n][1]}function Gf(r,e,t){let i=r.base!==void 0?r.base:1;if(ge(t)!=="number")return Un(r.default,e.default);let n=r.stops.length;if(n===1||t<=r.stops[0][0])return r.stops[0][1];if(t>=r.stops[n-1][0])return r.stops[n-1][1];let o=ps(r.stops.map(c=>c[0]),t),a=Q0(t,i,r.stops[o][0],r.stops[o+1][0]),s=r.stops[o][1],l=r.stops[o+1][1],u=Se[e.type]||X0;return typeof s.evaluate=="function"?{evaluate(...c){let p=s.evaluate.apply(void 0,c),h=l.evaluate.apply(void 0,c);if(!(p===void 0||h===void 0))return u(p,h,a,r.colorSpace)}}:u(s,l,a,r.colorSpace)}function Y0(r,e,t){switch(e.type){case"color":t=W.parse(t);break;case"formatted":t=wt.fromString(t.toString());break;case"resolvedImage":t=ht.fromString(t.toString());break;case"padding":t=Ft.parse(t);break;default:ge(t)!==e.type&&(e.type!=="enum"||!e.values[t])&&(t=void 0)}return Un(t,r.default,e.default)}function Q0(r,e,t,i){let n=i-t,o=r-t;return n===0?0:e===1?o/n:(Math.pow(e,o)-1)/(Math.pow(e,n)-1)}var jr=class{constructor(e,t){this.expression=e,this._warningHistory={},this._evaluator=new Xa,this._defaultValue=t?t1(t):null,this._enumValues=t&&t.type==="enum"?t.values:null}evaluateWithoutErrorHandling(e,t,i,n,o,a){return this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=i,this._evaluator.canonical=n,this._evaluator.availableImages=o||null,this._evaluator.formattedSection=a,this.expression.evaluate(this._evaluator)}evaluate(e,t,i,n,o,a){this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=i||null,this._evaluator.canonical=n,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 Re(`Expected value to be one of ${Object.keys(this._enumValues).map(l=>JSON.stringify(l)).join(", ")}, but found ${JSON.stringify(s)} instead.`);return s}catch(s){return this._warningHistory[s.message]||(this._warningHistory[s.message]=!0,typeof console<"u"&&console.warn(s.message)),this._defaultValue}}};function Xr(r){return Array.isArray(r)&&r.length>0&&typeof r[0]=="string"&&r[0]in Wr}function ap(r,e){let t=new Ka(Wr,as,[],e?e1(e):void 0),i=t.parse(r,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return i?Yc(new jr(i,e)):Si(t.errors)}var gr=class{constructor(e,t){this.kind=e,this._styleExpression=t,this.isStateDependent=e!=="constant"&&!Fn(t.expression)}evaluateWithoutErrorHandling(e,t,i,n,o,a){return this._styleExpression.evaluateWithoutErrorHandling(e,t,i,n,o,a)}evaluate(e,t,i,n,o,a){return this._styleExpression.evaluate(e,t,i,n,o,a)}},xr=class{constructor(e,t,i,n){this.kind=e,this.zoomStops=i,this._styleExpression=t,this.isStateDependent=e!=="camera"&&!Fn(t.expression),this.interpolationType=n}evaluateWithoutErrorHandling(e,t,i,n,o,a){return this._styleExpression.evaluateWithoutErrorHandling(e,t,i,n,o,a)}evaluate(e,t,i,n,o,a){return this._styleExpression.evaluate(e,t,i,n,o,a)}interpolationFactor(e,t,i){return this.interpolationType?vt.interpolationFactor(this.interpolationType,e,t,i):0}};function mm(r,e){let t=ap(r,e);if(t.result==="error")return t;let i=t.value.expression,n=fs(i);if(!n&&!yr(e))return Si([new At("","data expressions not supported")]);let o=ms(i,["zoom"]);if(!o&&!hm(e))return Si([new At("","zoom expressions not supported")]);let a=Wa(i);if(!a&&!o)return Si([new At("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(a instanceof At)return Si([a]);if(a instanceof vt&&!op(e))return Si([new At("",'"interpolate" expressions cannot be used with this property')]);if(!a)return Yc(n?new gr("constant",t.value):new gr("source",t.value));let s=a instanceof vt?a.interpolation:void 0;return Yc(n?new xr("camera",t.value,a.labels,s):new xr("composite",t.value,a.labels,s))}var Rn=class r{constructor(e,t){this._parameters=e,this._specification=t,Ai(this,fm(this._parameters,this._specification))}static deserialize(e){return new r(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}};function dm(r,e){if(ds(r))return new Rn(r,e);if(Xr(r)){let t=mm(r,e);if(t.result==="error")throw new Error(t.value.map(i=>`${i.key}: ${i.message}`).join(", "));return t.value}else{let t=r;return e.type==="color"&&typeof r=="string"?t=W.parse(r):e.type==="padding"&&(typeof r=="number"||Array.isArray(r))?t=Ft.parse(r):e.type==="variableAnchorOffsetCollection"&&Array.isArray(r)&&(t=Qt.parse(r)),{kind:"constant",evaluate:()=>t}}}function Wa(r){let e=null;if(r instanceof Ja)e=Wa(r.result);else if(r instanceof es){for(let t of r.args)if(e=Wa(t),e)break}else(r instanceof Mi||r instanceof vt)&&r.input instanceof Ut&&r.input.name==="zoom"&&(e=r);return e instanceof At||r.eachChild(t=>{let i=Wa(t);i instanceof At?e=i:!e&&i?e=new At("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&i&&e!==i&&(e=new At("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function e1(r){let e={color:It,string:ue,number:G,enum:ue,boolean:oe,formatted:Ei,padding:us,resolvedImage:On,variableAnchorOffsetCollection:cs};return r.type==="array"?_t(e[r.value]||ae,r.length):e[r.type]}function t1(r){return r.type==="color"&&ds(r.default)?new W(0,0,0,0):r.type==="color"?W.parse(r.default)||null:r.type==="padding"?Ft.parse(r.default)||null:r.type==="variableAnchorOffsetCollection"?Qt.parse(r.default)||null:r.default===void 0?null:r.default}function sp(r){if(r===!0||r===!1)return!0;if(!Array.isArray(r)||r.length===0)return!1;switch(r[0]){case"has":return r.length>=2&&r[1]!=="$id"&&r[1]!=="$type";case"in":return r.length>=3&&(typeof r[1]!="string"||Array.isArray(r[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return r.length!==3||Array.isArray(r[1])||Array.isArray(r[2]);case"any":case"all":for(let e of r.slice(1))if(!sp(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}var r1={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Nn(r){if(r==null)return{filter:()=>!0,needGeometry:!1};sp(r)||(r=ss(r));let e=ap(r,r1);if(e.result==="error")throw new Error(e.value.map(t=>`${t.key}: ${t.message}`).join(", "));{let t=ym(r);return{filter:(i,n,o)=>e.value.evaluate(i,n,{},o),needGeometry:t}}}function i1(r,e){return r<e?-1:r>e?1:0}function ym(r){if(!Array.isArray(r))return!1;if(r[0]==="within"||r[0]==="distance")return!0;for(let e=1;e<r.length;e++)if(ym(r[e]))return!0;return!1}function ss(r){if(!r)return!0;let e=r[0];return r.length<=1?e!=="any":e==="=="?Rc(r[1],r[2],"=="):e==="!="?Ha(Rc(r[1],r[2],"==")):e==="<"||e===">"||e==="<="||e===">="?Rc(r[1],r[2],e):e==="any"?n1(r.slice(1)):e==="all"?["all"].concat(r.slice(1).map(ss)):e==="none"?["all"].concat(r.slice(1).map(ss).map(Ha)):e==="in"?$f(r[1],r.slice(2)):e==="!in"?Ha($f(r[1],r.slice(2))):e==="has"?qf(r[1]):e==="!has"?Ha(qf(r[1])):!0}function Rc(r,e,t){switch(r){case"$type":return[`filter-type-${t}`,e];case"$id":return[`filter-id-${t}`,e];default:return[`filter-${t}`,r,e]}}function n1(r){return["any"].concat(r.map(ss))}function $f(r,e){if(e.length===0)return!1;switch(r){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(t=>typeof t!=typeof e[0])?["filter-in-large",r,["literal",e.sort(i1)]]:["filter-in-small",r,["literal",e]]}}function qf(r){switch(r){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",r]}}function Ha(r){return["!",r]}function gm(){let r={},e=M.$version;for(let t in M.$root){let i=M.$root[t];if(i.required){let n=null;t==="version"?n=e:i.type==="array"?n=[]:n={},n!=null&&(r[t]=n)}}return r}function xm(r){let e=r.key,t=r.value;return t?[new R(e,t,"constants have been deprecated as of v8")]:[]}function Oe(r){return r instanceof Number||r instanceof String||r instanceof Boolean?r.valueOf():r}function Zr(r){if(Array.isArray(r))return r.map(Zr);if(r instanceof Object&&!(r instanceof Number||r instanceof String||r instanceof Boolean)){let e={};for(let t in r)e[t]=Zr(r[t]);return e}return Oe(r)}function Mt(r){let e=r.key,t=r.value,i=r.valueSpec||{},n=r.objectElementValidators||{},o=r.style,a=r.styleSpec,s=r.validateSpec,l=[],u=ge(t);if(u!=="object")return[new R(e,t,`object expected, ${u} found`)];for(let c in t){let p=c.split(".")[0],h=i[p]||i["*"],f;if(n[p])f=n[p];else if(i[p])f=s;else if(n["*"])f=n["*"];else if(i["*"])f=s;else{l.push(new R(e,t[c],`unknown property "${c}"`));continue}l=l.concat(f({key:(e&&`${e}.`)+c,value:t[c],valueSpec:h,style:o,styleSpec:a,object:t,objectKey:c,validateSpec:s},t))}for(let c in i)n[c]||i[c].required&&i[c].default===void 0&&t[c]===void 0&&l.push(new R(e,t,`missing required property "${c}"`));return l}function lp(r){let e=r.value,t=r.valueSpec,i=r.validateSpec,n=r.style,o=r.styleSpec,a=r.key,s=r.arrayElementValidator||i;if(ge(e)!=="array")return[new R(a,e,`array expected, ${ge(e)} found`)];if(t.length&&e.length!==t.length)return[new R(a,e,`array length ${t.length} expected, length ${e.length} found`)];if(t["min-length"]&&e.length<t["min-length"])return[new R(a,e,`array length at least ${t["min-length"]} expected, length ${e.length} found`)];let l={type:t.value,values:t.values};o.$version<7&&(l.function=t.function),ge(t.value)==="object"&&(l=t.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:r.validateSpec,style:n,styleSpec:o,key:`${a}[${c}]`}));return u}function up(r){let e=r.key,t=r.value,i=r.valueSpec,n=ge(t);return n==="number"&&t!==t&&(n="NaN"),n!=="number"?[new R(e,t,`number expected, ${n} found`)]:"minimum"in i&&t<i.minimum?[new R(e,t,`${t} is less than the minimum value ${i.minimum}`)]:"maximum"in i&&t>i.maximum?[new R(e,t,`${t} is greater than the maximum value ${i.maximum}`)]:[]}function bm(r){let e=r.valueSpec,t=Oe(r.value.type),i,n={},o,a,s=t!=="categorical"&&r.value.property===void 0,l=!s,u=ge(r.value.stops)==="array"&&ge(r.value.stops[0])==="array"&&ge(r.value.stops[0][0])==="object",c=Mt({key:r.key,value:r.value,valueSpec:r.styleSpec.function,validateSpec:r.validateSpec,style:r.style,styleSpec:r.styleSpec,objectElementValidators:{stops:p,default:d}});return t==="identity"&&s&&c.push(new R(r.key,r.value,'missing required property "property"')),t!=="identity"&&!r.value.stops&&c.push(new R(r.key,r.value,'missing required property "stops"')),t==="exponential"&&r.valueSpec.expression&&!op(r.valueSpec)&&c.push(new R(r.key,r.value,"exponential functions not supported")),r.styleSpec.$version>=8&&(l&&!yr(r.valueSpec)?c.push(new R(r.key,r.value,"property functions not supported")):s&&!hm(r.valueSpec)&&c.push(new R(r.key,r.value,"zoom functions not supported"))),(t==="categorical"||u)&&r.value.property===void 0&&c.push(new R(r.key,r.value,'"property" property is required')),c;function p(y){if(t==="identity")return[new R(y.key,y.value,'identity function may not have a "stops" property')];let g=[],x=y.value;return g=g.concat(lp({key:y.key,value:x,valueSpec:y.valueSpec,validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec,arrayElementValidator:h})),ge(x)==="array"&&x.length===0&&g.push(new R(y.key,x,"array must have at least one stop")),g}function h(y){let g=[],x=y.value,v=y.key;if(ge(x)!=="array")return[new R(v,x,`array expected, ${ge(x)} found`)];if(x.length!==2)return[new R(v,x,`array length 2 expected, length ${x.length} found`)];if(u){if(ge(x[0])!=="object")return[new R(v,x,`object expected, ${ge(x[0])} found`)];if(x[0].zoom===void 0)return[new R(v,x,"object stop key must have zoom")];if(x[0].value===void 0)return[new R(v,x,"object stop key must have value")];if(a&&a>Oe(x[0].zoom))return[new R(v,x[0].zoom,"stop zoom values must appear in ascending order")];Oe(x[0].zoom)!==a&&(a=Oe(x[0].zoom),o=void 0,n={}),g=g.concat(Mt({key:`${v}[0]`,value:x[0],valueSpec:{zoom:{}},validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec,objectElementValidators:{zoom:up,value:f}}))}else g=g.concat(f({key:`${v}[0]`,value:x[0],valueSpec:{},validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec},x));return Xr(Zr(x[1]))?g.concat([new R(`${v}[1]`,x[1],"expressions are not allowed in function stops.")]):g.concat(y.validateSpec({key:`${v}[1]`,value:x[1],valueSpec:e,validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec}))}function f(y,g){let x=ge(y.value),v=Oe(y.value),b=y.value!==null?y.value:g;if(!i)i=x;else if(x!==i)return[new R(y.key,b,`${x} stop domain type must match previous stop domain type ${i}`)];if(x!=="number"&&x!=="string"&&x!=="boolean")return[new R(y.key,b,"stop domain value must be a number, string, or boolean")];if(x!=="number"&&t!=="categorical"){let w=`number expected, ${x} found`;return yr(e)&&t===void 0&&(w+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new R(y.key,b,w)]}return t==="categorical"&&x==="number"&&(!isFinite(v)||Math.floor(v)!==v)?[new R(y.key,b,`integer expected, found ${v}`)]:t!=="categorical"&&x==="number"&&o!==void 0&&v<o?[new R(y.key,b,"stop domain values must appear in ascending order")]:(o=v,t==="categorical"&&v in n?[new R(y.key,b,"stop domain values must be unique")]:(n[v]=!0,[]))}function d(y){return y.validateSpec({key:y.key,value:y.value,valueSpec:e,validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec})}}function Ii(r){let e=(r.expressionContext==="property"?mm:ap)(Zr(r.value),r.valueSpec);if(e.result==="error")return e.value.map(i=>new R(`${r.key}${i.key}`,r.value,i.message));let t=e.value.expression||e.value._styleExpression.expression;if(r.expressionContext==="property"&&r.propertyKey==="text-font"&&!t.outputDefined())return[new R(r.key,r.value,`Invalid data expression for "${r.propertyKey}". Output values must be contained as literals within the expression.`)];if(r.expressionContext==="property"&&r.propertyType==="layout"&&!Fn(t))return[new R(r.key,r.value,'"feature-state" data expressions are not supported with layout properties.')];if(r.expressionContext==="filter"&&!Fn(t))return[new R(r.key,r.value,'"feature-state" data expressions are not supported with filters.')];if(r.expressionContext&&r.expressionContext.indexOf("cluster")===0){if(!ms(t,["zoom","feature-state"]))return[new R(r.key,r.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(r.expressionContext==="cluster-initial"&&!fs(t))return[new R(r.key,r.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function o1(r){let e=r.value,t=r.key,i=ge(e);return i!=="boolean"?[new R(t,e,`boolean expected, ${i} found`)]:[]}function a1(r){let e=r.key,t=r.value,i=ge(t);return i!=="string"?[new R(e,t,`color expected, ${i} found`)]:W.parse(String(t))?[]:[new R(e,t,`color expected, "${t}" found`)]}function Bn(r){let e=r.key,t=r.value,i=r.valueSpec,n=[];return Array.isArray(i.values)?i.values.indexOf(Oe(t))===-1&&n.push(new R(e,t,`expected one of [${i.values.join(", ")}], ${JSON.stringify(t)} found`)):Object.keys(i.values).indexOf(Oe(t))===-1&&n.push(new R(e,t,`expected one of [${Object.keys(i.values).join(", ")}], ${JSON.stringify(t)} found`)),n}function cp(r){return sp(Zr(r.value))?Ii(Ai({},r,{expressionContext:"filter",valueSpec:{value:"boolean"}})):_m(r)}function _m(r){let e=r.value,t=r.key;if(ge(e)!=="array")return[new R(t,e,`array expected, ${ge(e)} found`)];let i=r.styleSpec,n,o=[];if(e.length<1)return[new R(t,e,"filter array must have at least 1 element")];switch(o=o.concat(Bn({key:`${t}[0]`,value:e[0],valueSpec:i.filter_operator,style:r.style,styleSpec:r.styleSpec})),Oe(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&Oe(e[1])==="$type"&&o.push(new R(t,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&o.push(new R(t,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(n=ge(e[1]),n!=="string"&&o.push(new R(`${t}[1]`,e[1],`string expected, ${n} found`)));for(let a=2;a<e.length;a++)n=ge(e[a]),Oe(e[1])==="$type"?o=o.concat(Bn({key:`${t}[${a}]`,value:e[a],valueSpec:i.geometry_type,style:r.style,styleSpec:r.styleSpec})):n!=="string"&&n!=="number"&&n!=="boolean"&&o.push(new R(`${t}[${a}]`,e[a],`string, number, or boolean expected, ${n} found`));break;case"any":case"all":case"none":for(let a=1;a<e.length;a++)o=o.concat(_m({key:`${t}[${a}]`,value:e[a],style:r.style,styleSpec:r.styleSpec}));break;case"has":case"!has":n=ge(e[1]),e.length!==2?o.push(new R(t,e,`filter array for "${e[0]}" operator must have 2 elements`)):n!=="string"&&o.push(new R(`${t}[1]`,e[1],`string expected, ${n} found`));break}return o}function vm(r,e){let t=r.key,i=r.validateSpec,n=r.style,o=r.styleSpec,a=r.value,s=r.objectKey,l=o[`${e}_${r.layerType}`];if(!l)return[];let u=s.match(/^(.*)-transition$/);if(e==="paint"&&u&&l[u[1]]&&l[u[1]].transition)return i({key:t,value:a,valueSpec:o.transition,style:n,styleSpec:o});let c=r.valueSpec||l[s];if(!c)return[new R(t,a,`unknown property "${s}"`)];let p;if(ge(a)==="string"&&yr(c)&&!c.tokens&&(p=/^{([^}]+)}$/.exec(a)))return[new R(t,a,`"${s}" does not support interpolation syntax
2
+ Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(p[1])} }\`.`)];let h=[];return r.layerType==="symbol"&&(s==="text-field"&&n&&!n.glyphs&&h.push(new R(t,a,'use of "text-field" requires a style "glyphs" property')),s==="text-font"&&ds(Zr(a))&&Oe(a.type)==="identity"&&h.push(new R(t,a,'"text-font" does not support identity functions'))),h.concat(i({key:r.key,value:a,valueSpec:c,style:n,styleSpec:o,expressionContext:"property",propertyType:e,propertyKey:s}))}function wm(r){return vm(r,"paint")}function Sm(r){return vm(r,"layout")}function Pm(r){let e=[],t=r.value,i=r.key,n=r.style,o=r.styleSpec;!t.type&&!t.ref&&e.push(new R(i,t,'either "type" or "ref" is required'));let a=Oe(t.type),s=Oe(t.ref);if(t.id){let l=Oe(t.id);for(let u=0;u<r.arrayIndex;u++){let c=n.layers[u];Oe(c.id)===l&&e.push(new R(i,t.id,`duplicate layer id "${t.id}", previously used at line ${c.id.__line__}`))}}if("ref"in t){["type","source","source-layer","filter","layout"].forEach(u=>{u in t&&e.push(new R(i,t[u],`"${u}" is prohibited for ref layers`))});let l;n.layers.forEach(u=>{Oe(u.id)===s&&(l=u)}),l?l.ref?e.push(new R(i,t.ref,"ref cannot reference another ref layer")):a=Oe(l.type):e.push(new R(i,t.ref,`ref layer "${s}" not found`))}else if(a!=="background")if(!t.source)e.push(new R(i,t,'missing required property "source"'));else{let l=n.sources&&n.sources[t.source],u=l&&Oe(l.type);l?u==="vector"&&a==="raster"?e.push(new R(i,t.source,`layer "${t.id}" requires a raster source`)):u!=="raster-dem"&&a==="hillshade"?e.push(new R(i,t.source,`layer "${t.id}" requires a raster-dem source`)):u==="raster"&&a!=="raster"?e.push(new R(i,t.source,`layer "${t.id}" requires a vector source`)):u==="vector"&&!t["source-layer"]?e.push(new R(i,t,`layer "${t.id}" must specify a "source-layer"`)):u==="raster-dem"&&a!=="hillshade"?e.push(new R(i,t.source,"raster-dem source can only be used with layer type 'hillshade'.")):a==="line"&&t.paint&&t.paint["line-gradient"]&&(u!=="geojson"||!l.lineMetrics)&&e.push(new R(i,t,`layer "${t.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new R(i,t.source,`source "${t.source}" not found`))}return e=e.concat(Mt({key:i,value:t,valueSpec:o.layer,style:r.style,styleSpec:r.styleSpec,validateSpec:r.validateSpec,objectElementValidators:{"*"(){return[]},type(){return r.validateSpec({key:`${i}.type`,value:t.type,valueSpec:o.layer.type,style:r.style,styleSpec:r.styleSpec,validateSpec:r.validateSpec,object:t,objectKey:"type"})},filter:cp,layout(l){return Mt({layer:t,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return Sm(Ai({layerType:a},u))}}})},paint(l){return Mt({layer:t,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return wm(Ai({layerType:a},u))}}})}}})),e}function Hr(r){let e=r.value,t=r.key,i=ge(e);return i!=="string"?[new R(t,e,`string expected, ${i} found`)]:[]}function s1(r){var e;let t=(e=r.sourceName)!==null&&e!==void 0?e:"",i=r.value,n=r.styleSpec,o=n.source_raster_dem,a=r.style,s=[],l=ge(i);if(i===void 0)return s;if(l!=="object")return s.push(new R("source_raster_dem",i,`object expected, ${l} found`)),s;let c=Oe(i.encoding)==="custom",p=["redFactor","greenFactor","blueFactor","baseShift"],h=r.value.encoding?`"${r.value.encoding}"`:"Default";for(let f in i)!c&&p.includes(f)?s.push(new R(f,i[f],`In "${t}": "${f}" is only valid when "encoding" is set to "custom". ${h} encoding found`)):o[f]?s=s.concat(r.validateSpec({key:f,value:i[f],valueSpec:o[f],validateSpec:r.validateSpec,style:a,styleSpec:n})):s.push(new R(f,i[f],`unknown property "${f}"`));return s}var jf={promoteId:l1};function Tm(r){let e=r.value,t=r.key,i=r.styleSpec,n=r.style,o=r.validateSpec;if(!e.type)return[new R(t,e,'"type" is required')];let a=Oe(e.type),s;switch(a){case"vector":case"raster":return s=Mt({key:t,value:e,valueSpec:i[`source_${a.replace("-","_")}`],style:r.style,styleSpec:i,objectElementValidators:jf,validateSpec:o}),s;case"raster-dem":return s=s1({sourceName:t,value:e,style:r.style,styleSpec:i,validateSpec:o}),s;case"geojson":if(s=Mt({key:t,value:e,valueSpec:i.source_geojson,style:n,styleSpec:i,validateSpec:o,objectElementValidators:jf}),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(...Ii({key:`${t}.${l}.map`,value:c,validateSpec:o,expressionContext:"cluster-map"})),s.push(...Ii({key:`${t}.${l}.reduce`,value:p,validateSpec:o,expressionContext:"cluster-reduce"}))}return s;case"video":return Mt({key:t,value:e,valueSpec:i.source_video,style:n,validateSpec:o,styleSpec:i});case"image":return Mt({key:t,value:e,valueSpec:i.source_image,style:n,validateSpec:o,styleSpec:i});case"canvas":return[new R(t,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Bn({key:`${t}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:n,validateSpec:o,styleSpec:i})}}function l1({key:r,value:e}){if(ge(e)==="string")return Hr({key:r,value:e});{let t=[];for(let i in e)t.push(...Hr({key:`${r}.${i}`,value:e[i]}));return t}}function Am(r){let e=r.value,t=r.styleSpec,i=t.light,n=r.style,o=[],a=ge(e);if(e===void 0)return o;if(a!=="object")return o=o.concat([new R("light",e,`object expected, ${a} found`)]),o;for(let s in e){let l=s.match(/^(.*)-transition$/);l&&i[l[1]]&&i[l[1]].transition?o=o.concat(r.validateSpec({key:s,value:e[s],valueSpec:t.transition,validateSpec:r.validateSpec,style:n,styleSpec:t})):i[s]?o=o.concat(r.validateSpec({key:s,value:e[s],valueSpec:i[s],validateSpec:r.validateSpec,style:n,styleSpec:t})):o=o.concat([new R(s,e[s],`unknown property "${s}"`)])}return o}function Mm(r){let e=r.value,t=r.styleSpec,i=t.sky,n=r.style,o=ge(e);if(e===void 0)return[];if(o!=="object")return[new R("sky",e,`object expected, ${o} found`)];let a=[];for(let s in e)i[s]?a=a.concat(r.validateSpec({key:s,value:e[s],valueSpec:i[s],style:n,styleSpec:t})):a=a.concat([new R(s,e[s],`unknown property "${s}"`)]);return a}function Im(r){let e=r.value,t=r.styleSpec,i=t.terrain,n=r.style,o=[],a=ge(e);if(e===void 0)return o;if(a!=="object")return o=o.concat([new R("terrain",e,`object expected, ${a} found`)]),o;for(let s in e)i[s]?o=o.concat(r.validateSpec({key:s,value:e[s],valueSpec:i[s],validateSpec:r.validateSpec,style:n,styleSpec:t})):o=o.concat([new R(s,e[s],`unknown property "${s}"`)]);return o}function u1(r){return Hr(r).length===0?[]:Ii(r)}function c1(r){return Hr(r).length===0?[]:Ii(r)}function p1(r){let e=r.key,t=r.value;if(ge(t)==="array"){if(t.length<1||t.length>4)return[new R(e,t,`padding requires 1 to 4 values; ${t.length} values found`)];let n={type:"number"},o=[];for(let a=0;a<t.length;a++)o=o.concat(r.validateSpec({key:`${e}[${a}]`,value:t[a],validateSpec:r.validateSpec,valueSpec:n}));return o}else return up({key:e,value:t,valueSpec:{}})}function h1(r){let e=r.key,t=r.value,i=ge(t),n=r.styleSpec;if(i!=="array"||t.length<1||t.length%2!==0)return[new R(e,t,"variableAnchorOffsetCollection requires a non-empty array of even length")];let o=[];for(let a=0;a<t.length;a+=2)o=o.concat(Bn({key:`${e}[${a}]`,value:t[a],valueSpec:n.layout_symbol["text-anchor"]})),o=o.concat(lp({key:`${e}[${a+1}]`,value:t[a+1],valueSpec:{length:2,value:"number"},validateSpec:r.validateSpec,style:r.style,styleSpec:n}));return o}function Cm(r){let e=[],t=r.value,i=r.key;if(Array.isArray(t)){let n=[],o=[];for(let a in t){t[a].id&&n.includes(t[a].id)&&e.push(new R(i,t,`all the sprites' ids must be unique, but ${t[a].id} is duplicated`)),n.push(t[a].id),t[a].url&&o.includes(t[a].url)&&e.push(new R(i,t,`all the sprites' URLs must be unique, but ${t[a].url} is duplicated`)),o.push(t[a].url);let s={id:{type:"string",required:!0},url:{type:"string",required:!0}};e=e.concat(Mt({key:`${i}[${a}]`,value:t[a],valueSpec:s,validateSpec:r.validateSpec}))}return e}else return Hr({key:i,value:t})}function f1(r){let e=r.value,t=r.styleSpec,i=t.projection,n=r.style,o=ge(e);if(e===void 0)return[];if(o!=="object")return[new R("projection",e,`object expected, ${o} found`)];let a=[];for(let s in e)i[s]?a=a.concat(r.validateSpec({key:s,value:e[s],valueSpec:i[s],style:n,styleSpec:t})):a=a.concat([new R(s,e[s],`unknown property "${s}"`)]);return a}var Zf={"*"(){return[]},array:lp,boolean:o1,number:up,color:a1,constants:xm,enum:Bn,filter:cp,function:bm,layer:Pm,object:Mt,source:Tm,light:Am,sky:Mm,terrain:Im,projection:f1,string:Hr,formatted:u1,resolvedImage:c1,padding:p1,variableAnchorOffsetCollection:h1,sprite:Cm};function Tn(r){let e=r.value,t=r.valueSpec,i=r.styleSpec;return r.validateSpec=Tn,t.expression&&ds(Oe(e))?bm(r):t.expression&&Xr(Zr(e))?Ii(r):t.type&&Zf[t.type]?Zf[t.type](r):Mt(Ai({},r,{valueSpec:t.type?i[t.type]:t}))}function Em(r){let e=r.value,t=r.key,i=Hr(r);return i.length||(e.indexOf("{fontstack}")===-1&&i.push(new R(t,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&i.push(new R(t,e,'"glyphs" url must include a "{range}" token'))),i}function Ct(r,e=M){let t=[];return t=t.concat(Tn({key:"",value:r,valueSpec:e.$root,styleSpec:e,style:r,validateSpec:Tn,objectElementValidators:{glyphs:Em,"*"(){return[]}}})),r.constants&&(t=t.concat(xm({key:"constants",value:r.constants,style:r,styleSpec:e,validateSpec:Tn}))),km(t)}Ct.source=Gt(Nt(Tm));Ct.sprite=Gt(Nt(Cm));Ct.glyphs=Gt(Nt(Em));Ct.light=Gt(Nt(Am));Ct.sky=Gt(Nt(Mm));Ct.terrain=Gt(Nt(Im));Ct.layer=Gt(Nt(Pm));Ct.filter=Gt(Nt(cp));Ct.paintProperty=Gt(Nt(wm));Ct.layoutProperty=Gt(Nt(Sm));function Nt(r){return function(e){return r({...e,validateSpec:Tn})}}function km(r){return[].concat(r).sort((e,t)=>e.line-t.line)}function Gt(r){return function(...e){return km(r.apply(this,e))}}m();var Ve=Ct,BI=Ve.source,Lm=Ve.light,OI=Ve.terrain,VI=Ve.filter,Dm=Ve.paintProperty,zm=Ve.layoutProperty;function Di(r,e){let t=!1;if(e&&e.length)for(let i of e)r.fire(new Z(new Error(i.message))),t=!0;return t}m();m();m();var Kr=class r{constructor(e,t,i){let n=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;let a=new Int32Array(this.arrayBuffer);e=a[0],t=a[1],i=a[2],this.d=t+2*i;for(let u=0;u<this.d*this.d;u++){let c=a[3+u],p=a[3+u+1];n.push(c===p?null:a.subarray(c,p))}let s=a[3+n.length],l=a[3+n.length+1];this.keys=a.subarray(s,l),this.bboxes=a.subarray(l),this.insert=this._insertReadonly}else{this.d=t+2*i;for(let a=0;a<this.d*this.d;a++)n.push([]);this.keys=[],this.bboxes=[]}this.n=t,this.extent=e,this.padding=i,this.scale=t/e,this.uid=0;let o=i/t*e;this.min=-o,this.max=e+o}insert(e,t,i,n,o){this._forEachCell(t,i,n,o,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(t),this.bboxes.push(i),this.bboxes.push(n),this.bboxes.push(o)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,t,i,n,o,a){this.cells[o].push(a)}query(e,t,i,n,o){let a=this.min,s=this.max;if(e<=a&&t<=a&&s<=i&&s<=n&&!o)return Array.prototype.slice.call(this.keys);{let l=[],u={};return this._forEachCell(e,t,i,n,this._queryCell,l,u,o),l}}_queryCell(e,t,i,n,o,a,s,l){let u=this.cells[o];if(u!==null){let c=this.keys,p=this.bboxes;for(let h=0;h<u.length;h++){let f=u[h];if(s[f]===void 0){let d=f*4;(l?l(p[d+0],p[d+1],p[d+2],p[d+3]):e<=p[d+2]&&t<=p[d+3]&&i>=p[d+0]&&n>=p[d+1])?(s[f]=!0,a.push(c[f])):s[f]=!1}}}}_forEachCell(e,t,i,n,o,a,s,l){let u=this._convertToCellCoord(e),c=this._convertToCellCoord(t),p=this._convertToCellCoord(i),h=this._convertToCellCoord(n);for(let f=u;f<=p;f++)for(let d=c;d<=h;d++){let y=this.d*d+f;if(!(l&&!l(this._convertFromCellCoord(f),this._convertFromCellCoord(d),this._convertFromCellCoord(f+1),this._convertFromCellCoord(d+1)))&&o.call(this,e,t,i,n,y,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,t=3+this.cells.length+1+1,i=0;for(let a=0;a<this.cells.length;a++)i+=this.cells[a].length;let n=new Int32Array(t+i+this.keys.length+this.bboxes.length);n[0]=this.extent,n[1]=this.n,n[2]=this.padding;let o=t;for(let a=0;a<e.length;a++){let s=e[a];n[3+a]=o,n.set(s,o),o+=s.length}return n[3+e.length]=o,n.set(this.keys,o),o+=this.keys.length,n[3+e.length+1]=o,n.set(this.bboxes,o),o+=this.bboxes.length,n.buffer}static serialize(e,t){let i=e.toArrayBuffer();return t&&t.push(i),{buffer:i}}static deserialize(e){return new r(e.buffer)}};var br={};function U(r,e,t={}){if(br[r])throw new Error(`${r} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:r,writeable:!1}),br[r]={klass:e,omit:t.omit||[],shallow:t.shallow||[]}}U("Object",Object);U("TransferableGridIndex",Kr);U("Color",W);U("Error",Error);U("AJAXError",Vr);U("ResolvedImage",ht);U("StylePropertyFunction",Rn);U("StyleExpression",jr,{omit:["_evaluator"]});U("ZoomDependentExpression",xr);U("ZoomConstantExpression",gr);U("CompoundExpression",Ut,{omit:["_evaluate"]});for(let r in Wr)Wr[r]._classRegistryKey||U(`Expression_${r}`,Wr[r]);function Fm(r){return r&&typeof ArrayBuffer<"u"&&(r instanceof ArrayBuffer||r.constructor&&r.constructor.name==="ArrayBuffer")}function zi(r,e){if(r==null||typeof r=="boolean"||typeof r=="number"||typeof r=="string"||r instanceof Boolean||r instanceof Number||r instanceof String||r instanceof Date||r instanceof RegExp||r instanceof Blob||r instanceof Error)return r;if(Fm(r)||pt(r))return e&&e.push(r),r;if(ArrayBuffer.isView(r)){let t=r;return e&&e.push(t.buffer),t}if(r instanceof ImageData)return e&&e.push(r.data.buffer),r;if(Array.isArray(r)){let t=[];for(let i of r)t.push(zi(i,e));return t}if(typeof r=="object"){let t=r.constructor,i=t._classRegistryKey;if(!i)throw new Error(`can't serialize object of unregistered class ${t.name}`);if(!br[i])throw new Error(`${i} is not registered.`);let n=t.serialize?t.serialize(r,e):{};if(t.serialize){if(e&&n===e[e.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(let o in r){if(!r.hasOwnProperty(o)||br[i].omit.indexOf(o)>=0)continue;let a=r[o];n[o]=br[i].shallow.indexOf(o)>=0?a:zi(a,e)}r instanceof Error&&(n.message=r.message)}if(n.$name)throw new Error("$name property is reserved for worker serialization logic.");return i!=="Object"&&(n.$name=i),n}throw new Error(`can't serialize object of type ${typeof r}`)}function Fi(r){if(r==null||typeof r=="boolean"||typeof r=="number"||typeof r=="string"||r instanceof Boolean||r instanceof Number||r instanceof String||r instanceof Date||r instanceof RegExp||r instanceof Blob||r instanceof Error||Fm(r)||pt(r)||ArrayBuffer.isView(r)||r instanceof ImageData)return r;if(Array.isArray(r))return r.map(Fi);if(typeof r=="object"){let e=r.$name||"Object";if(!br[e])throw new Error(`can't deserialize unregistered class ${e}`);let{klass:t}=br[e];if(!t)throw new Error(`can't deserialize unregistered class ${e}`);if(t.deserialize)return t.deserialize(r);let i=Object.create(t.prototype);for(let n of Object.keys(r)){if(n==="$name")continue;let o=r[n];i[n]=br[e].shallow.indexOf(n)>=0?o:Fi(o)}return i}throw new Error(`can't deserialize object of type ${typeof r}`)}m();m();var Ri=class{constructor(){this.first=!0}update(e,t){let i=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=i,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=i,!0):(this.lastFloorZoom>i?(this.lastIntegerZoom=i+1,this.lastIntegerZoomTime=t):this.lastFloorZoom<i&&(this.lastIntegerZoom=i,this.lastIntegerZoomTime=t),e!==this.lastZoom?(this.lastZoom=e,this.lastFloorZoom=i,!0):!1)}};m();m();var ce={"Latin-1 Supplement":r=>r>=128&&r<=255,Arabic:r=>r>=1536&&r<=1791,"Arabic Supplement":r=>r>=1872&&r<=1919,"Arabic Extended-A":r=>r>=2208&&r<=2303,"Hangul Jamo":r=>r>=4352&&r<=4607,"Unified Canadian Aboriginal Syllabics":r=>r>=5120&&r<=5759,Khmer:r=>r>=6016&&r<=6143,"Unified Canadian Aboriginal Syllabics Extended":r=>r>=6320&&r<=6399,"General Punctuation":r=>r>=8192&&r<=8303,"Letterlike Symbols":r=>r>=8448&&r<=8527,"Number Forms":r=>r>=8528&&r<=8591,"Miscellaneous Technical":r=>r>=8960&&r<=9215,"Control Pictures":r=>r>=9216&&r<=9279,"Optical Character Recognition":r=>r>=9280&&r<=9311,"Enclosed Alphanumerics":r=>r>=9312&&r<=9471,"Geometric Shapes":r=>r>=9632&&r<=9727,"Miscellaneous Symbols":r=>r>=9728&&r<=9983,"Miscellaneous Symbols and Arrows":r=>r>=11008&&r<=11263,"CJK Radicals Supplement":r=>r>=11904&&r<=12031,"Kangxi Radicals":r=>r>=12032&&r<=12255,"Ideographic Description Characters":r=>r>=12272&&r<=12287,"CJK Symbols and Punctuation":r=>r>=12288&&r<=12351,Hiragana:r=>r>=12352&&r<=12447,Katakana:r=>r>=12448&&r<=12543,Bopomofo:r=>r>=12544&&r<=12591,"Hangul Compatibility Jamo":r=>r>=12592&&r<=12687,Kanbun:r=>r>=12688&&r<=12703,"Bopomofo Extended":r=>r>=12704&&r<=12735,"CJK Strokes":r=>r>=12736&&r<=12783,"Katakana Phonetic Extensions":r=>r>=12784&&r<=12799,"Enclosed CJK Letters and Months":r=>r>=12800&&r<=13055,"CJK Compatibility":r=>r>=13056&&r<=13311,"CJK Unified Ideographs Extension A":r=>r>=13312&&r<=19903,"Yijing Hexagram Symbols":r=>r>=19904&&r<=19967,"CJK Unified Ideographs":r=>r>=19968&&r<=40959,"Yi Syllables":r=>r>=40960&&r<=42127,"Yi Radicals":r=>r>=42128&&r<=42191,"Hangul Jamo Extended-A":r=>r>=43360&&r<=43391,"Hangul Syllables":r=>r>=44032&&r<=55215,"Hangul Jamo Extended-B":r=>r>=55216&&r<=55295,"Private Use Area":r=>r>=57344&&r<=63743,"CJK Compatibility Ideographs":r=>r>=63744&&r<=64255,"Arabic Presentation Forms-A":r=>r>=64336&&r<=65023,"Vertical Forms":r=>r>=65040&&r<=65055,"CJK Compatibility Forms":r=>r>=65072&&r<=65103,"Small Form Variants":r=>r>=65104&&r<=65135,"Arabic Presentation Forms-B":r=>r>=65136&&r<=65279,"Halfwidth and Fullwidth Forms":r=>r>=65280&&r<=65519};function pp(r){for(let e of r)if(Rm(e.charCodeAt(0)))return!0;return!1}function Rm(r){return r===746||r===747?!0:r<4352?!1:!!(ce["Bopomofo Extended"](r)||ce.Bopomofo(r)||ce["CJK Compatibility Forms"](r)&&!(r>=65097&&r<=65103)||ce["CJK Compatibility Ideographs"](r)||ce["CJK Compatibility"](r)||ce["CJK Radicals Supplement"](r)||ce["CJK Strokes"](r)||ce["CJK Symbols and Punctuation"](r)&&!(r>=12296&&r<=12305)&&!(r>=12308&&r<=12319)&&r!==12336||ce["CJK Unified Ideographs Extension A"](r)||ce["CJK Unified Ideographs"](r)||ce["Enclosed CJK Letters and Months"](r)||ce["Hangul Compatibility Jamo"](r)||ce["Hangul Jamo Extended-A"](r)||ce["Hangul Jamo Extended-B"](r)||ce["Hangul Jamo"](r)||ce["Hangul Syllables"](r)||ce.Hiragana(r)||ce["Ideographic Description Characters"](r)||ce.Kanbun(r)||ce["Kangxi Radicals"](r)||ce["Katakana Phonetic Extensions"](r)||ce.Katakana(r)&&r!==12540||ce["Halfwidth and Fullwidth Forms"](r)&&r!==65288&&r!==65289&&r!==65293&&!(r>=65306&&r<=65310)&&r!==65339&&r!==65341&&r!==65343&&!(r>=65371&&r<=65503)&&r!==65507&&!(r>=65512&&r<=65519)||ce["Small Form Variants"](r)&&!(r>=65112&&r<=65118)&&!(r>=65123&&r<=65126)||ce["Unified Canadian Aboriginal Syllabics"](r)||ce["Unified Canadian Aboriginal Syllabics Extended"](r)||ce["Vertical Forms"](r)||ce["Yijing Hexagram Symbols"](r)||ce["Yi Syllables"](r)||ce["Yi Radicals"](r))}function Bm(r){return r>=1424&&r<=2303||ce["Arabic Presentation Forms-A"](r)||ce["Arabic Presentation Forms-B"](r)}function m1(r,e){return!(!e&&Bm(r)||r>=2304&&r<=3583||r>=3840&&r<=4255||ce.Khmer(r))}function Om(r){for(let e of r)if(Bm(e.charCodeAt(0)))return!0;return!1}function Vm(r,e){for(let t of r)if(!m1(t.charCodeAt(0),e))return!1;return!0}m();var hp=class{constructor(){this.applyArabicShaping=null;this.processBidirectionalText=null;this.processStyledBidirectionalText=null;this.pluginStatus="unavailable";this.pluginURL=null}setState(e){this.pluginStatus=e.pluginStatus,this.pluginURL=e.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(e){this.applyArabicShaping=e.applyArabicShaping,this.processBidirectionalText=e.processBidirectionalText,this.processStyledBidirectionalText=e.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}},tr=new hp;var de=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 Ri,this.transition={})}isSupportedScript(e){return Vm(e,tr.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let e=this.zoom,t=e-Math.floor(e),i=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:t+(1-t)*i}:{fromScale:.5,toScale:1,t:1-(1-i)*t}}};var Bi=class{constructor(e,t){this.property=e,this.value=t,this.expression=dm(t===void 0?e.specification.default:t,e.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,t,i){return this.property.possiblyEvaluate(this,e,t,i)}},Gn=class{constructor(e){this.property=e,this.value=new Bi(e,void 0)}transitioned(e,t){return new ys(this.property,this.value,t,O({},e.transition,this.transition),e.now)}untransitioned(){return new ys(this.property,this.value,null,{},0)}},Oi=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 Gn(this._values[e].property)),this._values[e].value=new Bi(this._values[e].property,t===null?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 Gn(this._values[e].property)),this._values[e].transition=ct(t)||void 0}serialize(){let e={};for(let t of Object.keys(this._values)){let i=this.getValue(t);i!==void 0&&(e[t]=i);let n=this.getTransition(t);n!==void 0&&(e[`${t}-transition`]=n)}return e}transitioned(e,t){let i=new gs(this._properties);for(let n of Object.keys(this._values))i._values[n]=this._values[n].transitioned(e,t._values[n]);return i}untransitioned(){let e=new gs(this._properties);for(let t of Object.keys(this._values))e._values[t]=this._values[t].untransitioned();return e}},ys=class{constructor(e,t,i,n,o){this.property=e,this.value=t,this.begin=o+n.delay||0,this.end=this.begin+n.duration||0,e.specification.transition&&(n.delay||n.duration)&&(this.prior=i)}possiblyEvaluate(e,t,i){let n=e.now||0,o=this.value.possiblyEvaluate(e,t,i),a=this.prior;if(a){if(n>this.end)return this.prior=null,o;if(this.value.isDataDriven())return this.prior=null,o;if(n<this.begin)return a.possiblyEvaluate(e,t,i);{let s=(n-this.begin)/(this.end-this.begin);return this.property.interpolate(a.possiblyEvaluate(e,t,i),o,nf(s))}}else return o}},gs=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,t,i){let n=new _r(this._properties);for(let o of Object.keys(this._values))n._values[o]=this._values[o].possiblyEvaluate(e,t,i);return n}hasTransition(){for(let e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}},xs=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}hasValue(e){return this._values[e].value!==void 0}getValue(e){return ct(this._values[e].value)}setValue(e,t){this._values[e]=new Bi(this._values[e].property,t===null?void 0:ct(t))}serialize(){let e={};for(let t of Object.keys(this._values)){let i=this.getValue(t);i!==void 0&&(e[t]=i)}return e}possiblyEvaluate(e,t,i){let n=new _r(this._properties);for(let o of Object.keys(this._values))n._values[o]=this._values[o].possiblyEvaluate(e,t,i);return n}},ot=class{constructor(e,t,i){this.property=e,this.value=t,this.parameters=i}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,t,i,n){return this.property.evaluate(this.value,this.parameters,e,t,i,n)}},_r=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}},q=class{constructor(e){this.specification=e}possiblyEvaluate(e,t){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(t)}interpolate(e,t,i){let n=this.specification.type,o=Se[n];return o?o(e,t,i):e}},H=class{constructor(e,t){this.specification=e,this.overrides=t}possiblyEvaluate(e,t,i,n){return e.expression.kind==="constant"||e.expression.kind==="camera"?new ot(this,{kind:"constant",value:e.expression.evaluate(t,null,{},i,n)},t):new ot(this,e.expression,t)}interpolate(e,t,i){if(e.value.kind!=="constant"||t.value.kind!=="constant")return e;if(e.value.value===void 0||t.value.value===void 0)return new ot(this,{kind:"constant",value:void 0},e.parameters);let n=this.specification.type,o=Se[n];if(o){let a=o(e.value.value,t.value.value,i);return new ot(this,{kind:"constant",value:a},e.parameters)}else return e}evaluate(e,t,i,n,o,a){return e.kind==="constant"?e.value:e.evaluate(t,i,n,o,a)}},rr=class extends H{possiblyEvaluate(e,t,i,n){if(e.value===void 0)return new ot(this,{kind:"constant",value:void 0},t);if(e.expression.kind==="constant"){let o=e.expression.evaluate(t,null,{},i,n),s=e.property.specification.type==="resolvedImage"&&typeof o!="string"?o.name:o,l=this._calculate(s,s,s,t);return new ot(this,{kind:"constant",value:l},t)}else if(e.expression.kind==="camera"){let o=this._calculate(e.expression.evaluate({zoom:t.zoom-1}),e.expression.evaluate({zoom:t.zoom}),e.expression.evaluate({zoom:t.zoom+1}),t);return new ot(this,{kind:"constant",value:o},t)}else return new ot(this,e.expression,t)}evaluate(e,t,i,n,o,a){if(e.kind==="source"){let s=e.evaluate(t,i,n,o,a);return this._calculate(s,s,s,t)}else return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(t.zoom)-1},i,n),e.evaluate({zoom:Math.floor(t.zoom)},i,n),e.evaluate({zoom:Math.floor(t.zoom)+1},i,n),t):e.value}_calculate(e,t,i,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:i,to:t}}interpolate(e){return e}},Jr=class{constructor(e){this.specification=e}possiblyEvaluate(e,t,i,n){if(e.value!==void 0)if(e.expression.kind==="constant"){let o=e.expression.evaluate(t,null,{},i,n);return this._calculate(o,o,o,t)}else return this._calculate(e.expression.evaluate(new de(Math.floor(t.zoom-1),t)),e.expression.evaluate(new de(Math.floor(t.zoom),t)),e.expression.evaluate(new de(Math.floor(t.zoom+1),t)),t)}_calculate(e,t,i,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:i,to:t}}interpolate(e){return e}},Yr=class{constructor(e){this.specification=e}possiblyEvaluate(e,t,i,n){return!!e.expression.evaluate(t,null,{},i,n)}interpolate(){return!1}},Le=class{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let t in e){let i=e[t];i.specification.overridable&&this.overridableProperties.push(t);let n=this.defaultPropertyValues[t]=new Bi(i,void 0),o=this.defaultTransitionablePropertyValues[t]=new Gn(i);this.defaultTransitioningPropertyValues[t]=o.untransitioned(),this.defaultPossiblyEvaluatedValues[t]=n.possiblyEvaluate({})}}};U("DataDrivenProperty",H);U("DataConstantProperty",q);U("CrossFadedDataDrivenProperty",rr);U("CrossFadedProperty",Jr);U("ColorRampProperty",Yr);var bs="-transition",Ue=class extends me{constructor(e,t){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),t.layout&&(this._unevaluatedLayout=new xs(t.layout)),t.paint)){this._transitionablePaint=new Oi(t.paint);for(let i in e.paint)this.setPaintProperty(i,e.paint[i],{validate:!1});for(let i in e.layout)this.setLayoutProperty(i,e.layout[i],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new _r(t.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,t,i={}){if(t!=null){let n=`layers.${this.id}.layout.${e}`;if(this._validate(zm,n,e,t,i))return}if(e==="visibility"){this.visibility=t;return}this._unevaluatedLayout.setValue(e,t)}getPaintProperty(e){return e.endsWith(bs)?this._transitionablePaint.getTransition(e.slice(0,-bs.length)):this._transitionablePaint.getValue(e)}setPaintProperty(e,t,i={}){if(t!=null){let n=`layers.${this.id}.paint.${e}`;if(this._validate(Dm,n,e,t,i))return!1}if(e.endsWith(bs))return this._transitionablePaint.setTransition(e.slice(0,-bs.length),t||void 0),!1;{let n=this._transitionablePaint._values[e],o=n.property.specification["property-type"]==="cross-faded-data-driven",a=n.value.isDataDriven(),s=n.value;this._transitionablePaint.setValue(e,t),this._handleSpecialPaintPropertyUpdate(e);let l=this._transitionablePaint._values[e].value;return l.isDataDriven()||a||o||this._handleOverridablePaintPropertyUpdate(e,s,l)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,t,i){return!1}isHidden(e){return this.minzoom&&e<this.minzoom||this.maxzoom&&e>=this.maxzoom?!0:this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,t){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,t)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,t)}serialize(){let e={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),Ba(e,(t,i)=>t!==void 0&&!(i==="layout"&&!Object.keys(t).length)&&!(i==="paint"&&!Object.keys(t).length))}_validate(e,t,i,n,o={}){return o&&o.validate===!1?!1:Di(this,e.call(Ve,{key:t,layerType:this.type,objectKey:i,value:n,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)||!yr(t.property.specification))&&(t.value.kind==="source"||t.value.kind==="composite")&&t.value.isStateDependent)return!0}return!1}};m();m();m();var d1={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},vr=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}},y1=128,g1=5,De=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*g1),y1),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")}};function be(r,e=1){let t=0,i=0,n=r.map(a=>{let s=x1(a.type),l=t=Um(t,Math.max(e,s)),u=a.components||1;return i=Math.max(i,s),t+=s*u,{name:a.name,type:a.type,components:u,offset:l}}),o=Um(t,Math.max(i,e));return{members:n,size:o,alignment:e}}function x1(r){return d1[r].BYTES_PER_ELEMENT}function Um(r,e){return Math.ceil(r/e)*e}var Nm=ne(ye(),1),Qr=class extends De{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t){let i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){let n=e*2;return this.int16[n+0]=t,this.int16[n+1]=i,e}};Qr.prototype.bytesPerElement=4;U("StructArrayLayout2i4",Qr);var Vi=class extends De{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i){let n=this.length;return this.resize(n+1),this.emplace(n,e,t,i)}emplace(e,t,i,n){let o=e*3;return this.int16[o+0]=t,this.int16[o+1]=i,this.int16[o+2]=n,e}};Vi.prototype.bytesPerElement=6;U("StructArrayLayout3i6",Vi);var $n=class extends De{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,n){let o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,n)}emplace(e,t,i,n,o){let a=e*4;return this.int16[a+0]=t,this.int16[a+1]=i,this.int16[a+2]=n,this.int16[a+3]=o,e}};$n.prototype.bytesPerElement=8;U("StructArrayLayout4i8",$n);var qn=class extends De{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,n,o,a){let s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,n,o,a)}emplace(e,t,i,n,o,a,s){let l=e*6;return this.int16[l+0]=t,this.int16[l+1]=i,this.int16[l+2]=n,this.int16[l+3]=o,this.int16[l+4]=a,this.int16[l+5]=s,e}};qn.prototype.bytesPerElement=12;U("StructArrayLayout2i4i12",qn);var jn=class extends De{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,n,o,a){let s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,n,o,a)}emplace(e,t,i,n,o,a,s){let l=e*4,u=e*8;return this.int16[l+0]=t,this.int16[l+1]=i,this.uint8[u+4]=n,this.uint8[u+5]=o,this.uint8[u+6]=a,this.uint8[u+7]=s,e}};jn.prototype.bytesPerElement=8;U("StructArrayLayout2i4ub8",jn);var wr=class extends De{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t){let i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){let n=e*2;return this.float32[n+0]=t,this.float32[n+1]=i,e}};wr.prototype.bytesPerElement=8;U("StructArrayLayout2f8",wr);var Zn=class extends De{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,n,o,a,s,l,u,c){let p=this.length;return this.resize(p+1),this.emplace(p,e,t,i,n,o,a,s,l,u,c)}emplace(e,t,i,n,o,a,s,l,u,c,p){let h=e*10;return this.uint16[h+0]=t,this.uint16[h+1]=i,this.uint16[h+2]=n,this.uint16[h+3]=o,this.uint16[h+4]=a,this.uint16[h+5]=s,this.uint16[h+6]=l,this.uint16[h+7]=u,this.uint16[h+8]=c,this.uint16[h+9]=p,e}};Zn.prototype.bytesPerElement=20;U("StructArrayLayout10ui20",Zn);var Hn=class extends De{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,n,o,a,s,l,u,c,p,h){let f=this.length;return this.resize(f+1),this.emplace(f,e,t,i,n,o,a,s,l,u,c,p,h)}emplace(e,t,i,n,o,a,s,l,u,c,p,h,f){let d=e*12;return this.int16[d+0]=t,this.int16[d+1]=i,this.int16[d+2]=n,this.int16[d+3]=o,this.uint16[d+4]=a,this.uint16[d+5]=s,this.uint16[d+6]=l,this.uint16[d+7]=u,this.int16[d+8]=c,this.int16[d+9]=p,this.int16[d+10]=h,this.int16[d+11]=f,e}};Hn.prototype.bytesPerElement=24;U("StructArrayLayout4i4ui4i24",Hn);var Wn=class extends De{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i){let n=this.length;return this.resize(n+1),this.emplace(n,e,t,i)}emplace(e,t,i,n){let o=e*3;return this.float32[o+0]=t,this.float32[o+1]=i,this.float32[o+2]=n,e}};Wn.prototype.bytesPerElement=12;U("StructArrayLayout3f12",Wn);var Xn=class extends De{_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 i=e*1;return this.uint32[i+0]=t,e}};Xn.prototype.bytesPerElement=4;U("StructArrayLayout1ul4",Xn);var Kn=class extends De{_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,i,n,o,a,s,l,u){let c=this.length;return this.resize(c+1),this.emplace(c,e,t,i,n,o,a,s,l,u)}emplace(e,t,i,n,o,a,s,l,u,c){let p=e*10,h=e*5;return this.int16[p+0]=t,this.int16[p+1]=i,this.int16[p+2]=n,this.int16[p+3]=o,this.int16[p+4]=a,this.int16[p+5]=s,this.uint32[h+3]=l,this.uint16[p+8]=u,this.uint16[p+9]=c,e}};Kn.prototype.bytesPerElement=20;U("StructArrayLayout6i1ul2ui20",Kn);var Jn=class extends De{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,n,o,a){let s=this.length;return this.resize(s+1),this.emplace(s,e,t,i,n,o,a)}emplace(e,t,i,n,o,a,s){let l=e*6;return this.int16[l+0]=t,this.int16[l+1]=i,this.int16[l+2]=n,this.int16[l+3]=o,this.int16[l+4]=a,this.int16[l+5]=s,e}};Jn.prototype.bytesPerElement=12;U("StructArrayLayout2i2i2i12",Jn);var Yn=class extends De{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,n,o){let a=this.length;return this.resize(a+1),this.emplace(a,e,t,i,n,o)}emplace(e,t,i,n,o,a){let s=e*4,l=e*8;return this.float32[s+0]=t,this.float32[s+1]=i,this.float32[s+2]=n,this.int16[l+6]=o,this.int16[l+7]=a,e}};Yn.prototype.bytesPerElement=16;U("StructArrayLayout2f1f2i16",Yn);var Qn=class extends De{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,n){let o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,n)}emplace(e,t,i,n,o){let a=e*12,s=e*3;return this.uint8[a+0]=t,this.uint8[a+1]=i,this.float32[s+1]=n,this.float32[s+2]=o,e}};Qn.prototype.bytesPerElement=12;U("StructArrayLayout2ub2f12",Qn);var Ui=class extends De{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i){let n=this.length;return this.resize(n+1),this.emplace(n,e,t,i)}emplace(e,t,i,n){let o=e*3;return this.uint16[o+0]=t,this.uint16[o+1]=i,this.uint16[o+2]=n,e}};Ui.prototype.bytesPerElement=6;U("StructArrayLayout3ui6",Ui);var eo=class extends De{_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,i,n,o,a,s,l,u,c,p,h,f,d,y,g,x){let v=this.length;return this.resize(v+1),this.emplace(v,e,t,i,n,o,a,s,l,u,c,p,h,f,d,y,g,x)}emplace(e,t,i,n,o,a,s,l,u,c,p,h,f,d,y,g,x,v){let b=e*24,w=e*12,S=e*48;return this.int16[b+0]=t,this.int16[b+1]=i,this.uint16[b+2]=n,this.uint16[b+3]=o,this.uint32[w+2]=a,this.uint32[w+3]=s,this.uint32[w+4]=l,this.uint16[b+10]=u,this.uint16[b+11]=c,this.uint16[b+12]=p,this.float32[w+7]=h,this.float32[w+8]=f,this.uint8[S+36]=d,this.uint8[S+37]=y,this.uint8[S+38]=g,this.uint32[w+10]=x,this.int16[b+22]=v,e}};eo.prototype.bytesPerElement=48;U("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",eo);var to=class extends De{_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,i,n,o,a,s,l,u,c,p,h,f,d,y,g,x,v,b,w,S,P,I,k,C,T,D,F){let E=this.length;return this.resize(E+1),this.emplace(E,e,t,i,n,o,a,s,l,u,c,p,h,f,d,y,g,x,v,b,w,S,P,I,k,C,T,D,F)}emplace(e,t,i,n,o,a,s,l,u,c,p,h,f,d,y,g,x,v,b,w,S,P,I,k,C,T,D,F,E){let A=e*32,$=e*16;return this.int16[A+0]=t,this.int16[A+1]=i,this.int16[A+2]=n,this.int16[A+3]=o,this.int16[A+4]=a,this.int16[A+5]=s,this.int16[A+6]=l,this.int16[A+7]=u,this.uint16[A+8]=c,this.uint16[A+9]=p,this.uint16[A+10]=h,this.uint16[A+11]=f,this.uint16[A+12]=d,this.uint16[A+13]=y,this.uint16[A+14]=g,this.uint16[A+15]=x,this.uint16[A+16]=v,this.uint16[A+17]=b,this.uint16[A+18]=w,this.uint16[A+19]=S,this.uint16[A+20]=P,this.uint16[A+21]=I,this.uint16[A+22]=k,this.uint32[$+12]=C,this.float32[$+13]=T,this.float32[$+14]=D,this.uint16[A+30]=F,this.uint16[A+31]=E,e}};to.prototype.bytesPerElement=64;U("StructArrayLayout8i15ui1ul2f2ui64",to);var ei=class extends De{_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 i=e*1;return this.float32[i+0]=t,e}};ei.prototype.bytesPerElement=4;U("StructArrayLayout1f4",ei);var ro=class extends De{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i){let n=this.length;return this.resize(n+1),this.emplace(n,e,t,i)}emplace(e,t,i,n){let o=e*6,a=e*3;return this.uint16[o+0]=t,this.float32[a+1]=i,this.float32[a+2]=n,e}};ro.prototype.bytesPerElement=12;U("StructArrayLayout1ui2f12",ro);var io=class extends De{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i){let n=this.length;return this.resize(n+1),this.emplace(n,e,t,i)}emplace(e,t,i,n){let o=e*2,a=e*4;return this.uint32[o+0]=t,this.uint16[a+2]=i,this.uint16[a+3]=n,e}};io.prototype.bytesPerElement=8;U("StructArrayLayout1ul2ui8",io);var no=class extends De{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t){let i=this.length;return this.resize(i+1),this.emplace(i,e,t)}emplace(e,t,i){let n=e*2;return this.uint16[n+0]=t,this.uint16[n+1]=i,e}};no.prototype.bytesPerElement=4;U("StructArrayLayout2ui4",no);var oo=class extends De{_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 i=e*1;return this.uint16[i+0]=t,e}};oo.prototype.bytesPerElement=2;U("StructArrayLayout1ui2",oo);var Ni=class extends De{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,n){let o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,n)}emplace(e,t,i,n,o){let a=e*4;return this.float32[a+0]=t,this.float32[a+1]=i,this.float32[a+2]=n,this.float32[a+3]=o,e}};Ni.prototype.bytesPerElement=16;U("StructArrayLayout4f16",Ni);var _s=class extends vr{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 Nm.default(this.anchorPointX,this.anchorPointY)}};_s.prototype.size=20;var ao=class extends Kn{get(e){return new _s(this,e)}};U("CollisionBoxArray",ao);var vs=class extends vr{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]}};vs.prototype.size=48;var so=class extends eo{get(e){return new vs(this,e)}};U("PlacedSymbolArray",so);var ws=class extends vr{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(e){this._structArray.uint32[this._pos4+12]=e}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}};ws.prototype.size=64;var lo=class extends to{get(e){return new ws(this,e)}};U("SymbolInstanceArray",lo);var uo=class extends ei{getoffsetX(e){return this.float32[e*1+0]}};U("GlyphOffsetArray",uo);var co=class extends Vi{getx(e){return this.int16[e*3+0]}gety(e){return this.int16[e*3+1]}gettileUnitDistanceFromAnchor(e){return this.int16[e*3+2]}};U("SymbolLineVertexArray",co);var Ss=class extends vr{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}};Ss.prototype.size=12;var po=class extends ro{get(e){return new Ss(this,e)}};U("TextAnchorOffsetArray",po);var Ps=class extends vr{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]}};Ps.prototype.size=8;var ho=class extends io{get(e){return new Ps(this,e)}};U("FeatureIndexArray",ho);var Sr=class extends Qr{},Ts=class extends Vi{},Gi=class extends $n{},As=class extends Qr{},Ms=class extends Qr{},Is=class extends qn{};var Cs=class extends jn{},Es=class extends wr{},ir=class extends Zn{},ks=class extends Hn{},Ls=class extends Wn{},Ds=class extends Xn{},fo=class extends Jn{},zs=class extends Yn{},Fs=class extends Qn{},Rs=class extends Ui{},rt=class extends Ui{},Pr=class extends no{},mo=class extends oo{};m();var b1=be([{name:"a_pos",components:2,type:"Int16"}],4);var{members:Gm,size:NC,alignment:GC}=b1;m();var he=class r{constructor(e=[]){this.segments=e}prepareSegment(e,t,i,n){let o=this.segments[this.segments.length-1];return e>r.MAX_VERTEX_ARRAY_LENGTH&&ke(`Max vertices per segment is ${r.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!o||o.vertexLength+e>r.MAX_VERTEX_ARRAY_LENGTH||o.sortKey!==n)&&(o={vertexOffset:t.length,primitiveOffset:i.length,vertexLength:0,primitiveLength:0},n!==void 0&&(o.sortKey=n),this.segments.push(o)),o}get(){return this.segments}destroy(){for(let e of this.segments)for(let t in e.vaos)e.vaos[t].destroy()}static simpleSegment(e,t,i,n){return new r([{vertexOffset:e,primitiveOffset:t,vertexLength:i,primitiveLength:n,vaos:{},sortKey:0}])}};he.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1;U("SegmentVector",he);m();m();function fp(r,e){return r=Ae(Math.floor(r),0,255),e=Ae(Math.floor(e),0,255),256*r+e}m();var yo=be([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);m();var Hm=ne(yp(),1);var go=class r{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,t,i,n){this.ids.push(Zm(e)),this.positions.push(t,i,n)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");let t=Zm(e),i=0,n=this.ids.length-1;for(;i<n;){let a=i+n>>1;this.ids[a]>=t?n=a:i=a+1}let o=[];for(;this.ids[i]===t;){let a=this.positions[3*i],s=this.positions[3*i+1],l=this.positions[3*i+2];o.push({index:a,start:s,end:l}),i++}return o}static serialize(e,t){let i=new Float64Array(e.ids),n=new Uint32Array(e.positions);return gp(i,n,0,i.length-1),t&&t.push(i.buffer,n.buffer),{ids:i,positions:n}}static deserialize(e){let t=new r;return t.ids=e.ids,t.positions=e.positions,t.indexed=!0,t}};function Zm(r){let e=+r;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:(0,Hm.default)(String(r))}function gp(r,e,t,i){for(;t<i;){let n=r[t+i>>1],o=t-1,a=i+1;for(;;){do o++;while(r[o]<n);do a--;while(r[a]>n);if(o>=a)break;Os(r,o,a),Os(e,3*o,3*a),Os(e,3*o+1,3*a+1),Os(e,3*o+2,3*a+2)}a-t<i-a?(gp(r,e,t,a),t=a+1):(gp(r,e,a+1,i),i=a)}}function Os(r,e,t){let i=r[e];r[e]=r[t],r[t]=i}U("FeaturePositionMap",go);m();var nr=class{constructor(e,t){this.gl=e.gl,this.location=t}},J=class extends nr{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1i(this.location,e))}},V=class extends nr{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}},ee=class extends nr{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]))}},lt=class extends nr{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]))}},Tr=class extends nr{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]))}},Et=class extends nr{constructor(e,t){super(e,t),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))}},S1=new Float32Array(16),te=class extends nr{constructor(e,t){super(e,t),this.current=S1}set(e){if(e[12]!==this.current[12]||e[0]!==this.current[0]){this.current=e,this.gl.uniformMatrix4fv(this.location,!1,e);return}for(let t=1;t<16;t++)if(e[t]!==this.current[t]){this.current=e,this.gl.uniformMatrix4fv(this.location,!1,e);break}}};function xp(r){return[fp(255*r.r,255*r.g),fp(255*r.b,255*r.a)]}var ti=class{constructor(e,t,i){this.value=e,this.uniformNames=t.map(n=>`u_${n}`),this.type=i}setUniform(e,t,i){e.set(i.constantOr(this.value))}getBinding(e,t,i){return this.type==="color"?new Et(e,t):new V(e,t)}},Ar=class{constructor(e,t){this.uniformNames=t.map(i=>`u_${i}`),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,i,n){let o=n==="u_pattern_to"?this.patternTo:n==="u_pattern_from"?this.patternFrom:n==="u_pixel_ratio_to"?this.pixelRatioTo:n==="u_pixel_ratio_from"?this.pixelRatioFrom:null;o&&e.set(o)}getBinding(e,t,i){return i.substr(0,9)==="u_pattern"?new Tr(e,t):new V(e,t)}},Rt=class{constructor(e,t,i,n){this.expression=e,this.type=i,this.maxValue=0,this.paintVertexAttributes=t.map(o=>({name:`a_${o}`,type:"Float32",components:i==="color"?2:1,offset:0})),this.paintVertexArray=new n}populatePaintArray(e,t,i,n,o){let a=this.paintVertexArray.length,s=this.expression.evaluate(new de(0),t,{},n,[],o);this.paintVertexArray.resize(e),this._setPaintValue(a,e,s)}updatePaintArray(e,t,i,n){let o=this.expression.evaluate({zoom:0},i,n);this._setPaintValue(e,t,o)}_setPaintValue(e,t,i){if(this.type==="color"){let n=xp(i);for(let o=e;o<t;o++)this.paintVertexArray.emplace(o,n[0],n[1])}else{for(let n=e;n<t;n++)this.paintVertexArray.emplace(n,i);this.maxValue=Math.max(this.maxValue,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()}},St=class{constructor(e,t,i,n,o,a){this.expression=e,this.uniformNames=t.map(s=>`u_${s}_t`),this.type=i,this.useIntegerZoom=n,this.zoom=o,this.maxValue=0,this.paintVertexAttributes=t.map(s=>({name:`a_${s}`,type:"Float32",components:i==="color"?4:2,offset:0})),this.paintVertexArray=new a}populatePaintArray(e,t,i,n,o){let a=this.expression.evaluate(new de(this.zoom),t,{},n,[],o),s=this.expression.evaluate(new de(this.zoom+1),t,{},n,[],o),l=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(l,e,a,s)}updatePaintArray(e,t,i,n){let o=this.expression.evaluate({zoom:this.zoom},i,n),a=this.expression.evaluate({zoom:this.zoom+1},i,n);this._setPaintValue(e,t,o,a)}_setPaintValue(e,t,i,n){if(this.type==="color"){let o=xp(i),a=xp(n);for(let s=e;s<t;s++)this.paintVertexArray.emplace(s,o[0],o[1],a[0],a[1])}else{for(let o=e;o<t;o++)this.paintVertexArray.emplace(o,i,n);this.maxValue=Math.max(this.maxValue,Math.abs(i),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()}setUniform(e,t){let i=this.useIntegerZoom?Math.floor(t.zoom):t.zoom,n=Ae(this.expression.interpolationFactor(i,this.zoom,this.zoom+1),0,1);e.set(n)}getBinding(e,t,i){return new V(e,t)}},$t=class{constructor(e,t,i,n,o,a){this.expression=e,this.type=t,this.useIntegerZoom=i,this.zoom=n,this.layerId=a,this.zoomInPaintVertexArray=new o,this.zoomOutPaintVertexArray=new o}populatePaintArray(e,t,i){let n=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(n,e,t.patterns&&t.patterns[this.layerId],i)}updatePaintArray(e,t,i,n,o){this._setPaintValues(e,t,i.patterns&&i.patterns[this.layerId],o)}_setPaintValues(e,t,i,n){if(!n||!i)return;let{min:o,mid:a,max:s}=i,l=n[o],u=n[a],c=n[s];if(!(!l||!u||!c))for(let p=e;p<t;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,yo.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,yo.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}},Vs=class{constructor(e,t,i){this.binders={},this._buffers=[];let n=[];for(let o in e.paint._values){if(!i(o))continue;let a=e.paint.get(o);if(!(a instanceof ot)||!yr(a.property.specification))continue;let s=P1(o,e.type),l=a.value,u=a.property.specification.type,c=a.property.useIntegerZoom,p=a.property.specification["property-type"],h=p==="cross-faded"||p==="cross-faded-data-driven";if(l.kind==="constant")this.binders[o]=h?new Ar(l.value,s):new ti(l.value,s,u),n.push(`/u_${o}`);else if(l.kind==="source"||h){let f=Wm(o,u,"source");this.binders[o]=h?new $t(l,u,c,t,f,e.id):new Rt(l,s,u,f),n.push(`/a_${o}`)}else{let f=Wm(o,u,"composite");this.binders[o]=new St(l,s,u,c,t,f),n.push(`/z_${o}`)}}this.cacheKey=n.sort().join("")}getMaxValue(e){let t=this.binders[e];return t instanceof Rt||t instanceof St?t.maxValue:0}populatePaintArrays(e,t,i,n,o){for(let a in this.binders){let s=this.binders[a];(s instanceof Rt||s instanceof St||s instanceof $t)&&s.populatePaintArray(e,t,i,n,o)}}setConstantPatternPositions(e,t){for(let i in this.binders){let n=this.binders[i];n instanceof Ar&&n.setConstantPatternPositions(e,t)}}updatePaintArrays(e,t,i,n,o){let a=!1;for(let s in e){let l=t.getPositions(s);for(let u of l){let c=i.feature(u.index);for(let p in this.binders){let h=this.binders[p];if((h instanceof Rt||h instanceof St||h instanceof $t)&&h.expression.isStateDependent===!0){let f=n.paint.get(p);h.expression=f.value,h.updatePaintArray(u.start,u.end,c,e[s],o),a=!0}}}}return a}defines(){let e=[];for(let t in this.binders){let i=this.binders[t];(i instanceof ti||i instanceof Ar)&&e.push(...i.uniformNames.map(n=>`#define HAS_UNIFORM_${n}`))}return e}getBinderAttributes(){let e=[];for(let t in this.binders){let i=this.binders[t];if(i instanceof Rt||i instanceof St)for(let n=0;n<i.paintVertexAttributes.length;n++)e.push(i.paintVertexAttributes[n].name);else if(i instanceof $t)for(let n=0;n<yo.members.length;n++)e.push(yo.members[n].name)}return e}getBinderUniforms(){let e=[];for(let t in this.binders){let i=this.binders[t];if(i instanceof ti||i instanceof Ar||i instanceof St)for(let n of i.uniformNames)e.push(n)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,t){let i=[];for(let n in this.binders){let o=this.binders[n];if(o instanceof ti||o instanceof Ar||o instanceof St){for(let a of o.uniformNames)if(t[a]){let s=o.getBinding(e,t[a],a);i.push({name:a,property:n,binding:s})}}}return i}setUniforms(e,t,i,n){for(let{name:o,property:a,binding:s}of t)this.binders[a].setUniform(s,n,i.get(a),o)}updatePaintBuffers(e){this._buffers=[];for(let t in this.binders){let i=this.binders[t];if(e&&i instanceof $t){let n=e.fromScale===2?i.zoomInPaintVertexBuffer:i.zoomOutPaintVertexBuffer;n&&this._buffers.push(n)}else(i instanceof Rt||i instanceof St)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer)}}upload(e){for(let t in this.binders){let i=this.binders[t];(i instanceof Rt||i instanceof St||i instanceof $t)&&i.upload(e)}this.updatePaintBuffers()}destroy(){for(let e in this.binders){let t=this.binders[e];(t instanceof Rt||t instanceof St||t instanceof $t)&&t.destroy()}}},ft=class{constructor(e,t,i=()=>!0){this.programConfigurations={};for(let n of e)this.programConfigurations[n.id]=new Vs(n,t,i);this.needsUpload=!1,this._featureMap=new go,this._bufferOffset=0}populatePaintArrays(e,t,i,n,o,a){for(let s in this.programConfigurations)this.programConfigurations[s].populatePaintArrays(e,t,n,o,a);t.id!==void 0&&this._featureMap.add(t.id,i,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,t,i,n){for(let o of i)this.needsUpload=this.programConfigurations[o.id].updatePaintArrays(e,this._featureMap,t,o,n)||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()}};function P1(r,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[r]||[r.replace(`${e}-`,"").replace(/-/g,"_")]}function T1(r){return{"line-pattern":{source:ir,composite:ir},"fill-pattern":{source:ir,composite:ir},"fill-extrusion-pattern":{source:ir,composite:ir}}[r]}function Wm(r,e,t){let i={color:{source:wr,composite:Ni},number:{source:ei,composite:wr}},n=T1(r);return n&&n[t]||i[e][t]}U("ConstantBinder",ti);U("CrossFadedConstantBinder",Ar);U("SourceExpressionBinder",Rt);U("CrossFadedCompositeBinder",$t);U("CompositeExpressionBinder",St);U("ProgramConfiguration",Vs,{omit:["_buffers"]});U("ProgramConfigurationSet",ft);m();m();m();var A1=15,bp=Math.pow(2,A1-1)-1,Xm=-bp-1;function mt(r){let e=8192/r.extent,t=r.loadGeometry();for(let i=0;i<t.length;i++){let n=t[i];for(let o=0;o<n.length;o++){let a=n[o],s=Math.round(a.x*e),l=Math.round(a.y*e);a.x=Ae(s,Xm,bp),a.y=Ae(l,Xm,bp),(s<a.x||s>a.x+1||l<a.y||l>a.y+1)&&ke("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return t}m();function dt(r,e){return{type:r.type,id:r.id,properties:r.properties,geometry:e?mt(r):[]}}function Us(r,e,t,i,n){r.emplaceBack(e*2+(i+1)/2,t*2+(n+1)/2)}var ri=class{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(t=>t.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new As,this.indexArray=new rt,this.segments=new he,this.programConfigurations=new ft(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(e,t,i){let n=this.layers[0],o=[],a=null,s=!1;n.type==="circle"&&(a=n.layout.get("circle-sort-key"),s=!a.isConstant());for(let{feature:l,id:u,index:c,sourceLayerIndex:p}of e){let h=this.layers[0]._featureFilter.needGeometry,f=dt(l,h);if(!this.layers[0]._featureFilter.filter(new de(this.zoom),f,i))continue;let d=s?a.evaluate(f,{},i):void 0,y={id:u,properties:l.properties,type:l.type,sourceLayerIndex:p,index:c,geometry:h?f.geometry:mt(l),patterns:{},sortKey:d};o.push(y)}s&&o.sort((l,u)=>l.sortKey-u.sortKey);for(let l of o){let{geometry:u,index:c,sourceLayerIndex:p}=l,h=e[c].feature;this.addFeature(l,u,c,i),t.featureIndex.insert(h,u,c,p,this.index)}}update(e,t,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,i)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Gm),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,i,n){for(let o of t)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;Us(this.layoutVertexArray,s,l,-1,-1),Us(this.layoutVertexArray,s,l,1,-1),Us(this.layoutVertexArray,s,l,1,1),Us(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,i,{},n)}};U("CircleBucket",ri,{omit:["layers"]});m();var xo=ne(ye(),1);function Ns(r,e){for(let t=0;t<r.length;t++)if($i(e,r[t]))return!0;for(let t=0;t<e.length;t++)if($i(r,e[t]))return!0;return!!vp(r,e)}function Jm(r,e,t){return!!($i(r,e)||_p(e,r,t))}function Gs(r,e){if(r.length===1)return Km(e,r[0]);for(let t=0;t<e.length;t++){let i=e[t];for(let n=0;n<i.length;n++)if($i(r,i[n]))return!0}for(let t=0;t<r.length;t++)if(Km(e,r[t]))return!0;for(let t=0;t<e.length;t++)if(vp(r,e[t]))return!0;return!1}function Ym(r,e,t){for(let i=0;i<e.length;i++){let n=e[i];if(r.length>=3){for(let o=0;o<n.length;o++)if($i(r,n[o]))return!0}if(M1(r,n,t))return!0}return!1}function M1(r,e,t){if(r.length>1){if(vp(r,e))return!0;for(let i=0;i<e.length;i++)if(_p(e[i],r,t))return!0}for(let i=0;i<r.length;i++)if(_p(r[i],e,t))return!0;return!1}function vp(r,e){if(r.length===0||e.length===0)return!1;for(let t=0;t<r.length-1;t++){let i=r[t],n=r[t+1];for(let o=0;o<e.length-1;o++){let a=e[o],s=e[o+1];if(I1(i,n,a,s))return!0}}return!1}function I1(r,e,t,i){return Jt(r,t,i)!==Jt(e,t,i)&&Jt(r,e,t)!==Jt(r,e,i)}function _p(r,e,t){let i=t*t;if(e.length===1)return r.distSqr(e[0])<i;for(let n=1;n<e.length;n++){let o=e[n-1],a=e[n];if(Qm(r,o,a)<i)return!0}return!1}function Qm(r,e,t){let i=e.distSqr(t);if(i===0)return r.distSqr(e);let n=((r.x-e.x)*(t.x-e.x)+(r.y-e.y)*(t.y-e.y))/i;return n<0?r.distSqr(e):n>1?r.distSqr(t):r.distSqr(t.sub(e)._mult(n)._add(e))}function Km(r,e){let t=!1,i,n,o;for(let a=0;a<r.length;a++){i=r[a];for(let s=0,l=i.length-1;s<i.length;l=s++)n=i[s],o=i[l],n.y>e.y!=o.y>e.y&&e.x<(o.x-n.x)*(e.y-n.y)/(o.y-n.y)+n.x&&(t=!t)}return t}function $i(r,e){let t=!1;for(let i=0,n=r.length-1;i<r.length;n=i++){let o=r[i],a=r[n];o.y>e.y!=a.y>e.y&&e.x<(a.x-o.x)*(e.y-o.y)/(a.y-o.y)+o.x&&(t=!t)}return t}function ed(r,e,t,i,n){for(let a of r)if(e<=a.x&&t<=a.y&&i>=a.x&&n>=a.y)return!0;let o=[new xo.default(e,t),new xo.default(e,n),new xo.default(i,n),new xo.default(i,t)];if(r.length>2){for(let a of o)if($i(r,a))return!0}for(let a=0;a<r.length-1;a++){let s=r[a],l=r[a+1];if(C1(s,l,o))return!0}return!1}function C1(r,e,t){let i=t[0],n=t[2];if(r.x<i.x&&e.x<i.x||r.x>n.x&&e.x>n.x||r.y<i.y&&e.y<i.y||r.y>n.y&&e.y>n.y)return!1;let o=Jt(r,e,t[0]);return o!==Jt(r,e,t[1])||o!==Jt(r,e,t[2])||o!==Jt(r,e,t[3])}m();var $s=ne(ye(),1);function ii(r,e,t){let i=e.paint.get(r).value;return i.kind==="constant"?i.value:t.programConfigurations.get(e.id).getMaxValue(r)}function Mr(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function Ir(r,e,t,i,n){if(!e[0]&&!e[1])return r;let o=$s.default.convert(e)._mult(n);t==="viewport"&&o._rotate(-i);let a=[];for(let s=0;s<r.length;s++){let l=r[s];a.push(l.sub(o))}return a}function td(r,e){let t=[];for(let i=0;i<r.length;i++){let n=r[i],o=[];for(let a=0;a<n.length;a++){let s=n[a-1],l=n[a],u=n[a+1],c=a===0?new $s.default(0,0):l.sub(s)._unit()._perp(),p=a===n.length-1?new $s.default(0,0):u.sub(l)._unit()._perp(),h=c._add(p)._unit(),f=h.x*p.x+h.y*p.y;f!==0&&h._mult(1/f),o.push(h._mult(e)._add(l))}t.push(o)}return t}m();var rd,k1=()=>rd=rd||new Le({"circle-sort-key":new H(M.layout_circle["circle-sort-key"])}),id,L1=()=>id=id||new Le({"circle-radius":new H(M.paint_circle["circle-radius"]),"circle-color":new H(M.paint_circle["circle-color"]),"circle-blur":new H(M.paint_circle["circle-blur"]),"circle-opacity":new H(M.paint_circle["circle-opacity"]),"circle-translate":new q(M.paint_circle["circle-translate"]),"circle-translate-anchor":new q(M.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new q(M.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new q(M.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new H(M.paint_circle["circle-stroke-width"]),"circle-stroke-color":new H(M.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new H(M.paint_circle["circle-stroke-opacity"])}),nd={get paint(){return L1()},get layout(){return k1()}};m();m();var ie=1e-6,ve=typeof Float32Array<"u"?Float32Array:Array,qt=Math.random;var ck=Math.PI/180;Math.hypot||(Math.hypot=function(){for(var r=0,e=arguments.length;e--;)r+=arguments[e]*arguments[e];return Math.sqrt(r)});var bo={};xi(bo,{LDU:()=>X1,add:()=>K1,adjoint:()=>N1,clone:()=>z1,copy:()=>F1,create:()=>D1,determinant:()=>G1,equals:()=>Y1,exactEquals:()=>J1,frob:()=>W1,fromRotation:()=>j1,fromScaling:()=>Z1,fromValues:()=>B1,identity:()=>R1,invert:()=>U1,mul:()=>tw,multiply:()=>od,multiplyScalar:()=>Q1,multiplyScalarAndAdd:()=>ew,rotate:()=>$1,scale:()=>q1,set:()=>O1,str:()=>H1,sub:()=>rw,subtract:()=>ad,transpose:()=>V1});m();function D1(){var r=new ve(4);return ve!=Float32Array&&(r[1]=0,r[2]=0),r[0]=1,r[3]=1,r}function z1(r){var e=new ve(4);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e}function F1(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r}function R1(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=1,r}function B1(r,e,t,i){var n=new ve(4);return n[0]=r,n[1]=e,n[2]=t,n[3]=i,n}function O1(r,e,t,i,n){return r[0]=e,r[1]=t,r[2]=i,r[3]=n,r}function V1(r,e){if(r===e){var t=e[1];r[1]=e[2],r[2]=t}else r[0]=e[0],r[1]=e[2],r[2]=e[1],r[3]=e[3];return r}function U1(r,e){var t=e[0],i=e[1],n=e[2],o=e[3],a=t*o-n*i;return a?(a=1/a,r[0]=o*a,r[1]=-i*a,r[2]=-n*a,r[3]=t*a,r):null}function N1(r,e){var t=e[0];return r[0]=e[3],r[1]=-e[1],r[2]=-e[2],r[3]=t,r}function G1(r){return r[0]*r[3]-r[2]*r[1]}function od(r,e,t){var i=e[0],n=e[1],o=e[2],a=e[3],s=t[0],l=t[1],u=t[2],c=t[3];return r[0]=i*s+o*l,r[1]=n*s+a*l,r[2]=i*u+o*c,r[3]=n*u+a*c,r}function $1(r,e,t){var i=e[0],n=e[1],o=e[2],a=e[3],s=Math.sin(t),l=Math.cos(t);return r[0]=i*l+o*s,r[1]=n*l+a*s,r[2]=i*-s+o*l,r[3]=n*-s+a*l,r}function q1(r,e,t){var i=e[0],n=e[1],o=e[2],a=e[3],s=t[0],l=t[1];return r[0]=i*s,r[1]=n*s,r[2]=o*l,r[3]=a*l,r}function j1(r,e){var t=Math.sin(e),i=Math.cos(e);return r[0]=i,r[1]=t,r[2]=-t,r[3]=i,r}function Z1(r,e){return r[0]=e[0],r[1]=0,r[2]=0,r[3]=e[1],r}function H1(r){return"mat2("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+")"}function W1(r){return Math.hypot(r[0],r[1],r[2],r[3])}function X1(r,e,t,i){return r[2]=i[2]/i[0],t[0]=i[0],t[1]=i[1],t[3]=i[3]-r[2]*t[1],[r,e,t]}function K1(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r}function ad(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r[3]=e[3]-t[3],r}function J1(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]}function Y1(r,e){var t=r[0],i=r[1],n=r[2],o=r[3],a=e[0],s=e[1],l=e[2],u=e[3];return Math.abs(t-a)<=ie*Math.max(1,Math.abs(t),Math.abs(a))&&Math.abs(i-s)<=ie*Math.max(1,Math.abs(i),Math.abs(s))&&Math.abs(n-l)<=ie*Math.max(1,Math.abs(n),Math.abs(l))&&Math.abs(o-u)<=ie*Math.max(1,Math.abs(o),Math.abs(u))}function Q1(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r}function ew(r,e,t,i){return r[0]=e[0]+t[0]*i,r[1]=e[1]+t[1]*i,r[2]=e[2]+t[2]*i,r[3]=e[3]+t[3]*i,r}var tw=od,rw=ad;var _o={};xi(_o,{add:()=>Aw,adjoint:()=>hw,clone:()=>ow,copy:()=>aw,create:()=>iw,determinant:()=>fw,equals:()=>Ew,exactEquals:()=>Cw,frob:()=>Tw,fromMat2d:()=>_w,fromMat4:()=>nw,fromQuat:()=>vw,fromRotation:()=>xw,fromScaling:()=>bw,fromTranslation:()=>gw,fromValues:()=>sw,identity:()=>uw,invert:()=>pw,mul:()=>kw,multiply:()=>sd,multiplyScalar:()=>Mw,multiplyScalarAndAdd:()=>Iw,normalFromMat4:()=>ww,projection:()=>Sw,rotate:()=>dw,scale:()=>yw,set:()=>lw,str:()=>Pw,sub:()=>Lw,subtract:()=>ld,translate:()=>mw,transpose:()=>cw});m();function iw(){var r=new ve(9);return ve!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[5]=0,r[6]=0,r[7]=0),r[0]=1,r[4]=1,r[8]=1,r}function nw(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[4],r[4]=e[5],r[5]=e[6],r[6]=e[8],r[7]=e[9],r[8]=e[10],r}function ow(r){var e=new ve(9);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],e}function aw(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r}function sw(r,e,t,i,n,o,a,s,l){var u=new ve(9);return u[0]=r,u[1]=e,u[2]=t,u[3]=i,u[4]=n,u[5]=o,u[6]=a,u[7]=s,u[8]=l,u}function lw(r,e,t,i,n,o,a,s,l,u){return r[0]=e,r[1]=t,r[2]=i,r[3]=n,r[4]=o,r[5]=a,r[6]=s,r[7]=l,r[8]=u,r}function uw(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=1,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r}function cw(r,e){if(r===e){var t=e[1],i=e[2],n=e[5];r[1]=e[3],r[2]=e[6],r[3]=t,r[5]=e[7],r[6]=i,r[7]=n}else r[0]=e[0],r[1]=e[3],r[2]=e[6],r[3]=e[1],r[4]=e[4],r[5]=e[7],r[6]=e[2],r[7]=e[5],r[8]=e[8];return r}function pw(r,e){var t=e[0],i=e[1],n=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],c=e[8],p=c*a-s*u,h=-c*o+s*l,f=u*o-a*l,d=t*p+i*h+n*f;return d?(d=1/d,r[0]=p*d,r[1]=(-c*i+n*u)*d,r[2]=(s*i-n*a)*d,r[3]=h*d,r[4]=(c*t-n*l)*d,r[5]=(-s*t+n*o)*d,r[6]=f*d,r[7]=(-u*t+i*l)*d,r[8]=(a*t-i*o)*d,r):null}function hw(r,e){var t=e[0],i=e[1],n=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],c=e[8];return r[0]=a*c-s*u,r[1]=n*u-i*c,r[2]=i*s-n*a,r[3]=s*l-o*c,r[4]=t*c-n*l,r[5]=n*o-t*s,r[6]=o*u-a*l,r[7]=i*l-t*u,r[8]=t*a-i*o,r}function fw(r){var e=r[0],t=r[1],i=r[2],n=r[3],o=r[4],a=r[5],s=r[6],l=r[7],u=r[8];return e*(u*o-a*l)+t*(-u*n+a*s)+i*(l*n-o*s)}function sd(r,e,t){var i=e[0],n=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],p=e[8],h=t[0],f=t[1],d=t[2],y=t[3],g=t[4],x=t[5],v=t[6],b=t[7],w=t[8];return r[0]=h*i+f*a+d*u,r[1]=h*n+f*s+d*c,r[2]=h*o+f*l+d*p,r[3]=y*i+g*a+x*u,r[4]=y*n+g*s+x*c,r[5]=y*o+g*l+x*p,r[6]=v*i+b*a+w*u,r[7]=v*n+b*s+w*c,r[8]=v*o+b*l+w*p,r}function mw(r,e,t){var i=e[0],n=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],p=e[8],h=t[0],f=t[1];return r[0]=i,r[1]=n,r[2]=o,r[3]=a,r[4]=s,r[5]=l,r[6]=h*i+f*a+u,r[7]=h*n+f*s+c,r[8]=h*o+f*l+p,r}function dw(r,e,t){var i=e[0],n=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],p=e[8],h=Math.sin(t),f=Math.cos(t);return r[0]=f*i+h*a,r[1]=f*n+h*s,r[2]=f*o+h*l,r[3]=f*a-h*i,r[4]=f*s-h*n,r[5]=f*l-h*o,r[6]=u,r[7]=c,r[8]=p,r}function yw(r,e,t){var i=t[0],n=t[1];return r[0]=i*e[0],r[1]=i*e[1],r[2]=i*e[2],r[3]=n*e[3],r[4]=n*e[4],r[5]=n*e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r}function gw(r,e){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=1,r[5]=0,r[6]=e[0],r[7]=e[1],r[8]=1,r}function xw(r,e){var t=Math.sin(e),i=Math.cos(e);return r[0]=i,r[1]=t,r[2]=0,r[3]=-t,r[4]=i,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r}function bw(r,e){return r[0]=e[0],r[1]=0,r[2]=0,r[3]=0,r[4]=e[1],r[5]=0,r[6]=0,r[7]=0,r[8]=1,r}function _w(r,e){return r[0]=e[0],r[1]=e[1],r[2]=0,r[3]=e[2],r[4]=e[3],r[5]=0,r[6]=e[4],r[7]=e[5],r[8]=1,r}function vw(r,e){var t=e[0],i=e[1],n=e[2],o=e[3],a=t+t,s=i+i,l=n+n,u=t*a,c=i*a,p=i*s,h=n*a,f=n*s,d=n*l,y=o*a,g=o*s,x=o*l;return r[0]=1-p-d,r[3]=c-x,r[6]=h+g,r[1]=c+x,r[4]=1-u-d,r[7]=f-y,r[2]=h-g,r[5]=f+y,r[8]=1-u-p,r}function ww(r,e){var t=e[0],i=e[1],n=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],c=e[8],p=e[9],h=e[10],f=e[11],d=e[12],y=e[13],g=e[14],x=e[15],v=t*s-i*a,b=t*l-n*a,w=t*u-o*a,S=i*l-n*s,P=i*u-o*s,I=n*u-o*l,k=c*y-p*d,C=c*g-h*d,T=c*x-f*d,D=p*g-h*y,F=p*x-f*y,E=h*x-f*g,A=v*E-b*F+w*D+S*T-P*C+I*k;return A?(A=1/A,r[0]=(s*E-l*F+u*D)*A,r[1]=(l*T-a*E-u*C)*A,r[2]=(a*F-s*T+u*k)*A,r[3]=(n*F-i*E-o*D)*A,r[4]=(t*E-n*T+o*C)*A,r[5]=(i*T-t*F-o*k)*A,r[6]=(y*I-g*P+x*S)*A,r[7]=(g*w-d*I-x*b)*A,r[8]=(d*P-y*w+x*v)*A,r):null}function Sw(r,e,t){return r[0]=2/e,r[1]=0,r[2]=0,r[3]=0,r[4]=-2/t,r[5]=0,r[6]=-1,r[7]=1,r[8]=1,r}function Pw(r){return"mat3("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+", "+r[4]+", "+r[5]+", "+r[6]+", "+r[7]+", "+r[8]+")"}function Tw(r){return Math.hypot(r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8])}function Aw(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r[4]=e[4]+t[4],r[5]=e[5]+t[5],r[6]=e[6]+t[6],r[7]=e[7]+t[7],r[8]=e[8]+t[8],r}function ld(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r[3]=e[3]-t[3],r[4]=e[4]-t[4],r[5]=e[5]-t[5],r[6]=e[6]-t[6],r[7]=e[7]-t[7],r[8]=e[8]-t[8],r}function Mw(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r[4]=e[4]*t,r[5]=e[5]*t,r[6]=e[6]*t,r[7]=e[7]*t,r[8]=e[8]*t,r}function Iw(r,e,t,i){return r[0]=e[0]+t[0]*i,r[1]=e[1]+t[1]*i,r[2]=e[2]+t[2]*i,r[3]=e[3]+t[3]*i,r[4]=e[4]+t[4]*i,r[5]=e[5]+t[5]*i,r[6]=e[6]+t[6]*i,r[7]=e[7]+t[7]*i,r[8]=e[8]+t[8]*i,r}function Cw(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]&&r[4]===e[4]&&r[5]===e[5]&&r[6]===e[6]&&r[7]===e[7]&&r[8]===e[8]}function Ew(r,e){var t=r[0],i=r[1],n=r[2],o=r[3],a=r[4],s=r[5],l=r[6],u=r[7],c=r[8],p=e[0],h=e[1],f=e[2],d=e[3],y=e[4],g=e[5],x=e[6],v=e[7],b=e[8];return Math.abs(t-p)<=ie*Math.max(1,Math.abs(t),Math.abs(p))&&Math.abs(i-h)<=ie*Math.max(1,Math.abs(i),Math.abs(h))&&Math.abs(n-f)<=ie*Math.max(1,Math.abs(n),Math.abs(f))&&Math.abs(o-d)<=ie*Math.max(1,Math.abs(o),Math.abs(d))&&Math.abs(a-y)<=ie*Math.max(1,Math.abs(a),Math.abs(y))&&Math.abs(s-g)<=ie*Math.max(1,Math.abs(s),Math.abs(g))&&Math.abs(l-x)<=ie*Math.max(1,Math.abs(l),Math.abs(x))&&Math.abs(u-v)<=ie*Math.max(1,Math.abs(u),Math.abs(v))&&Math.abs(c-b)<=ie*Math.max(1,Math.abs(c),Math.abs(b))}var kw=sd,Lw=ld;var N={};xi(N,{add:()=>yS,adjoint:()=>Uw,clone:()=>zw,copy:()=>Fw,create:()=>Dw,determinant:()=>Nw,equals:()=>_S,exactEquals:()=>bS,frob:()=>dS,fromQuat:()=>oS,fromQuat2:()=>eS,fromRotation:()=>Kw,fromRotationTranslation:()=>pd,fromRotationTranslationScale:()=>iS,fromRotationTranslationScaleOrigin:()=>nS,fromScaling:()=>Xw,fromTranslation:()=>Ww,fromValues:()=>Rw,fromXRotation:()=>Jw,fromYRotation:()=>Yw,fromZRotation:()=>Qw,frustum:()=>aS,getRotation:()=>rS,getScaling:()=>hd,getTranslation:()=>tS,identity:()=>ud,invert:()=>Vw,lookAt:()=>hS,mul:()=>vS,multiply:()=>cd,multiplyScalar:()=>gS,multiplyScalarAndAdd:()=>xS,ortho:()=>cS,orthoNO:()=>md,orthoZO:()=>pS,perspective:()=>sS,perspectiveFromFieldOfView:()=>uS,perspectiveNO:()=>fd,perspectiveZO:()=>lS,rotate:()=>qw,rotateX:()=>jw,rotateY:()=>Zw,rotateZ:()=>Hw,scale:()=>$w,set:()=>Bw,str:()=>mS,sub:()=>wS,subtract:()=>dd,targetTo:()=>fS,translate:()=>Gw,transpose:()=>Ow});m();function Dw(){var r=new ve(16);return ve!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=0,r[12]=0,r[13]=0,r[14]=0),r[0]=1,r[5]=1,r[10]=1,r[15]=1,r}function zw(r){var e=new ve(16);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],e[9]=r[9],e[10]=r[10],e[11]=r[11],e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15],e}function Fw(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r}function Rw(r,e,t,i,n,o,a,s,l,u,c,p,h,f,d,y){var g=new ve(16);return g[0]=r,g[1]=e,g[2]=t,g[3]=i,g[4]=n,g[5]=o,g[6]=a,g[7]=s,g[8]=l,g[9]=u,g[10]=c,g[11]=p,g[12]=h,g[13]=f,g[14]=d,g[15]=y,g}function Bw(r,e,t,i,n,o,a,s,l,u,c,p,h,f,d,y,g){return r[0]=e,r[1]=t,r[2]=i,r[3]=n,r[4]=o,r[5]=a,r[6]=s,r[7]=l,r[8]=u,r[9]=c,r[10]=p,r[11]=h,r[12]=f,r[13]=d,r[14]=y,r[15]=g,r}function ud(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function Ow(r,e){if(r===e){var t=e[1],i=e[2],n=e[3],o=e[6],a=e[7],s=e[11];r[1]=e[4],r[2]=e[8],r[3]=e[12],r[4]=t,r[6]=e[9],r[7]=e[13],r[8]=i,r[9]=o,r[11]=e[14],r[12]=n,r[13]=a,r[14]=s}else r[0]=e[0],r[1]=e[4],r[2]=e[8],r[3]=e[12],r[4]=e[1],r[5]=e[5],r[6]=e[9],r[7]=e[13],r[8]=e[2],r[9]=e[6],r[10]=e[10],r[11]=e[14],r[12]=e[3],r[13]=e[7],r[14]=e[11],r[15]=e[15];return r}function Vw(r,e){var t=e[0],i=e[1],n=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],c=e[8],p=e[9],h=e[10],f=e[11],d=e[12],y=e[13],g=e[14],x=e[15],v=t*s-i*a,b=t*l-n*a,w=t*u-o*a,S=i*l-n*s,P=i*u-o*s,I=n*u-o*l,k=c*y-p*d,C=c*g-h*d,T=c*x-f*d,D=p*g-h*y,F=p*x-f*y,E=h*x-f*g,A=v*E-b*F+w*D+S*T-P*C+I*k;return A?(A=1/A,r[0]=(s*E-l*F+u*D)*A,r[1]=(n*F-i*E-o*D)*A,r[2]=(y*I-g*P+x*S)*A,r[3]=(h*P-p*I-f*S)*A,r[4]=(l*T-a*E-u*C)*A,r[5]=(t*E-n*T+o*C)*A,r[6]=(g*w-d*I-x*b)*A,r[7]=(c*I-h*w+f*b)*A,r[8]=(a*F-s*T+u*k)*A,r[9]=(i*T-t*F-o*k)*A,r[10]=(d*P-y*w+x*v)*A,r[11]=(p*w-c*P-f*v)*A,r[12]=(s*C-a*D-l*k)*A,r[13]=(t*D-i*C+n*k)*A,r[14]=(y*b-d*S-g*v)*A,r[15]=(c*S-p*b+h*v)*A,r):null}function Uw(r,e){var t=e[0],i=e[1],n=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],c=e[8],p=e[9],h=e[10],f=e[11],d=e[12],y=e[13],g=e[14],x=e[15];return r[0]=s*(h*x-f*g)-p*(l*x-u*g)+y*(l*f-u*h),r[1]=-(i*(h*x-f*g)-p*(n*x-o*g)+y*(n*f-o*h)),r[2]=i*(l*x-u*g)-s*(n*x-o*g)+y*(n*u-o*l),r[3]=-(i*(l*f-u*h)-s*(n*f-o*h)+p*(n*u-o*l)),r[4]=-(a*(h*x-f*g)-c*(l*x-u*g)+d*(l*f-u*h)),r[5]=t*(h*x-f*g)-c*(n*x-o*g)+d*(n*f-o*h),r[6]=-(t*(l*x-u*g)-a*(n*x-o*g)+d*(n*u-o*l)),r[7]=t*(l*f-u*h)-a*(n*f-o*h)+c*(n*u-o*l),r[8]=a*(p*x-f*y)-c*(s*x-u*y)+d*(s*f-u*p),r[9]=-(t*(p*x-f*y)-c*(i*x-o*y)+d*(i*f-o*p)),r[10]=t*(s*x-u*y)-a*(i*x-o*y)+d*(i*u-o*s),r[11]=-(t*(s*f-u*p)-a*(i*f-o*p)+c*(i*u-o*s)),r[12]=-(a*(p*g-h*y)-c*(s*g-l*y)+d*(s*h-l*p)),r[13]=t*(p*g-h*y)-c*(i*g-n*y)+d*(i*h-n*p),r[14]=-(t*(s*g-l*y)-a*(i*g-n*y)+d*(i*l-n*s)),r[15]=t*(s*h-l*p)-a*(i*h-n*p)+c*(i*l-n*s),r}function Nw(r){var e=r[0],t=r[1],i=r[2],n=r[3],o=r[4],a=r[5],s=r[6],l=r[7],u=r[8],c=r[9],p=r[10],h=r[11],f=r[12],d=r[13],y=r[14],g=r[15],x=e*a-t*o,v=e*s-i*o,b=e*l-n*o,w=t*s-i*a,S=t*l-n*a,P=i*l-n*s,I=u*d-c*f,k=u*y-p*f,C=u*g-h*f,T=c*y-p*d,D=c*g-h*d,F=p*g-h*y;return x*F-v*D+b*T+w*C-S*k+P*I}function cd(r,e,t){var i=e[0],n=e[1],o=e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],p=e[8],h=e[9],f=e[10],d=e[11],y=e[12],g=e[13],x=e[14],v=e[15],b=t[0],w=t[1],S=t[2],P=t[3];return r[0]=b*i+w*s+S*p+P*y,r[1]=b*n+w*l+S*h+P*g,r[2]=b*o+w*u+S*f+P*x,r[3]=b*a+w*c+S*d+P*v,b=t[4],w=t[5],S=t[6],P=t[7],r[4]=b*i+w*s+S*p+P*y,r[5]=b*n+w*l+S*h+P*g,r[6]=b*o+w*u+S*f+P*x,r[7]=b*a+w*c+S*d+P*v,b=t[8],w=t[9],S=t[10],P=t[11],r[8]=b*i+w*s+S*p+P*y,r[9]=b*n+w*l+S*h+P*g,r[10]=b*o+w*u+S*f+P*x,r[11]=b*a+w*c+S*d+P*v,b=t[12],w=t[13],S=t[14],P=t[15],r[12]=b*i+w*s+S*p+P*y,r[13]=b*n+w*l+S*h+P*g,r[14]=b*o+w*u+S*f+P*x,r[15]=b*a+w*c+S*d+P*v,r}function Gw(r,e,t){var i=t[0],n=t[1],o=t[2],a,s,l,u,c,p,h,f,d,y,g,x;return e===r?(r[12]=e[0]*i+e[4]*n+e[8]*o+e[12],r[13]=e[1]*i+e[5]*n+e[9]*o+e[13],r[14]=e[2]*i+e[6]*n+e[10]*o+e[14],r[15]=e[3]*i+e[7]*n+e[11]*o+e[15]):(a=e[0],s=e[1],l=e[2],u=e[3],c=e[4],p=e[5],h=e[6],f=e[7],d=e[8],y=e[9],g=e[10],x=e[11],r[0]=a,r[1]=s,r[2]=l,r[3]=u,r[4]=c,r[5]=p,r[6]=h,r[7]=f,r[8]=d,r[9]=y,r[10]=g,r[11]=x,r[12]=a*i+c*n+d*o+e[12],r[13]=s*i+p*n+y*o+e[13],r[14]=l*i+h*n+g*o+e[14],r[15]=u*i+f*n+x*o+e[15]),r}function $w(r,e,t){var i=t[0],n=t[1],o=t[2];return r[0]=e[0]*i,r[1]=e[1]*i,r[2]=e[2]*i,r[3]=e[3]*i,r[4]=e[4]*n,r[5]=e[5]*n,r[6]=e[6]*n,r[7]=e[7]*n,r[8]=e[8]*o,r[9]=e[9]*o,r[10]=e[10]*o,r[11]=e[11]*o,r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r}function qw(r,e,t,i){var n=i[0],o=i[1],a=i[2],s=Math.hypot(n,o,a),l,u,c,p,h,f,d,y,g,x,v,b,w,S,P,I,k,C,T,D,F,E,A,$;return s<ie?null:(s=1/s,n*=s,o*=s,a*=s,l=Math.sin(t),u=Math.cos(t),c=1-u,p=e[0],h=e[1],f=e[2],d=e[3],y=e[4],g=e[5],x=e[6],v=e[7],b=e[8],w=e[9],S=e[10],P=e[11],I=n*n*c+u,k=o*n*c+a*l,C=a*n*c-o*l,T=n*o*c-a*l,D=o*o*c+u,F=a*o*c+n*l,E=n*a*c+o*l,A=o*a*c-n*l,$=a*a*c+u,r[0]=p*I+y*k+b*C,r[1]=h*I+g*k+w*C,r[2]=f*I+x*k+S*C,r[3]=d*I+v*k+P*C,r[4]=p*T+y*D+b*F,r[5]=h*T+g*D+w*F,r[6]=f*T+x*D+S*F,r[7]=d*T+v*D+P*F,r[8]=p*E+y*A+b*$,r[9]=h*E+g*A+w*$,r[10]=f*E+x*A+S*$,r[11]=d*E+v*A+P*$,e!==r&&(r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r)}function jw(r,e,t){var i=Math.sin(t),n=Math.cos(t),o=e[4],a=e[5],s=e[6],l=e[7],u=e[8],c=e[9],p=e[10],h=e[11];return e!==r&&(r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[4]=o*n+u*i,r[5]=a*n+c*i,r[6]=s*n+p*i,r[7]=l*n+h*i,r[8]=u*n-o*i,r[9]=c*n-a*i,r[10]=p*n-s*i,r[11]=h*n-l*i,r}function Zw(r,e,t){var i=Math.sin(t),n=Math.cos(t),o=e[0],a=e[1],s=e[2],l=e[3],u=e[8],c=e[9],p=e[10],h=e[11];return e!==r&&(r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=o*n-u*i,r[1]=a*n-c*i,r[2]=s*n-p*i,r[3]=l*n-h*i,r[8]=o*i+u*n,r[9]=a*i+c*n,r[10]=s*i+p*n,r[11]=l*i+h*n,r}function Hw(r,e,t){var i=Math.sin(t),n=Math.cos(t),o=e[0],a=e[1],s=e[2],l=e[3],u=e[4],c=e[5],p=e[6],h=e[7];return e!==r&&(r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=o*n+u*i,r[1]=a*n+c*i,r[2]=s*n+p*i,r[3]=l*n+h*i,r[4]=u*n-o*i,r[5]=c*n-a*i,r[6]=p*n-s*i,r[7]=h*n-l*i,r}function Ww(r,e){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=e[0],r[13]=e[1],r[14]=e[2],r[15]=1,r}function Xw(r,e){return r[0]=e[0],r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=e[1],r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=e[2],r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function Kw(r,e,t){var i=t[0],n=t[1],o=t[2],a=Math.hypot(i,n,o),s,l,u;return a<ie?null:(a=1/a,i*=a,n*=a,o*=a,s=Math.sin(e),l=Math.cos(e),u=1-l,r[0]=i*i*u+l,r[1]=n*i*u+o*s,r[2]=o*i*u-n*s,r[3]=0,r[4]=i*n*u-o*s,r[5]=n*n*u+l,r[6]=o*n*u+i*s,r[7]=0,r[8]=i*o*u+n*s,r[9]=n*o*u-i*s,r[10]=o*o*u+l,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r)}function Jw(r,e){var t=Math.sin(e),i=Math.cos(e);return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=i,r[6]=t,r[7]=0,r[8]=0,r[9]=-t,r[10]=i,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function Yw(r,e){var t=Math.sin(e),i=Math.cos(e);return r[0]=i,r[1]=0,r[2]=-t,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=t,r[9]=0,r[10]=i,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function Qw(r,e){var t=Math.sin(e),i=Math.cos(e);return r[0]=i,r[1]=t,r[2]=0,r[3]=0,r[4]=-t,r[5]=i,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function pd(r,e,t){var i=e[0],n=e[1],o=e[2],a=e[3],s=i+i,l=n+n,u=o+o,c=i*s,p=i*l,h=i*u,f=n*l,d=n*u,y=o*u,g=a*s,x=a*l,v=a*u;return r[0]=1-(f+y),r[1]=p+v,r[2]=h-x,r[3]=0,r[4]=p-v,r[5]=1-(c+y),r[6]=d+g,r[7]=0,r[8]=h+x,r[9]=d-g,r[10]=1-(c+f),r[11]=0,r[12]=t[0],r[13]=t[1],r[14]=t[2],r[15]=1,r}function eS(r,e){var t=new ve(3),i=-e[0],n=-e[1],o=-e[2],a=e[3],s=e[4],l=e[5],u=e[6],c=e[7],p=i*i+n*n+o*o+a*a;return p>0?(t[0]=(s*a+c*i+l*o-u*n)*2/p,t[1]=(l*a+c*n+u*i-s*o)*2/p,t[2]=(u*a+c*o+s*n-l*i)*2/p):(t[0]=(s*a+c*i+l*o-u*n)*2,t[1]=(l*a+c*n+u*i-s*o)*2,t[2]=(u*a+c*o+s*n-l*i)*2),pd(r,e,t),r}function tS(r,e){return r[0]=e[12],r[1]=e[13],r[2]=e[14],r}function hd(r,e){var t=e[0],i=e[1],n=e[2],o=e[4],a=e[5],s=e[6],l=e[8],u=e[9],c=e[10];return r[0]=Math.hypot(t,i,n),r[1]=Math.hypot(o,a,s),r[2]=Math.hypot(l,u,c),r}function rS(r,e){var t=new ve(3);hd(t,e);var i=1/t[0],n=1/t[1],o=1/t[2],a=e[0]*i,s=e[1]*n,l=e[2]*o,u=e[4]*i,c=e[5]*n,p=e[6]*o,h=e[8]*i,f=e[9]*n,d=e[10]*o,y=a+c+d,g=0;return y>0?(g=Math.sqrt(y+1)*2,r[3]=.25*g,r[0]=(p-f)/g,r[1]=(h-l)/g,r[2]=(s-u)/g):a>c&&a>d?(g=Math.sqrt(1+a-c-d)*2,r[3]=(p-f)/g,r[0]=.25*g,r[1]=(s+u)/g,r[2]=(h+l)/g):c>d?(g=Math.sqrt(1+c-a-d)*2,r[3]=(h-l)/g,r[0]=(s+u)/g,r[1]=.25*g,r[2]=(p+f)/g):(g=Math.sqrt(1+d-a-c)*2,r[3]=(s-u)/g,r[0]=(h+l)/g,r[1]=(p+f)/g,r[2]=.25*g),r}function iS(r,e,t,i){var n=e[0],o=e[1],a=e[2],s=e[3],l=n+n,u=o+o,c=a+a,p=n*l,h=n*u,f=n*c,d=o*u,y=o*c,g=a*c,x=s*l,v=s*u,b=s*c,w=i[0],S=i[1],P=i[2];return r[0]=(1-(d+g))*w,r[1]=(h+b)*w,r[2]=(f-v)*w,r[3]=0,r[4]=(h-b)*S,r[5]=(1-(p+g))*S,r[6]=(y+x)*S,r[7]=0,r[8]=(f+v)*P,r[9]=(y-x)*P,r[10]=(1-(p+d))*P,r[11]=0,r[12]=t[0],r[13]=t[1],r[14]=t[2],r[15]=1,r}function nS(r,e,t,i,n){var o=e[0],a=e[1],s=e[2],l=e[3],u=o+o,c=a+a,p=s+s,h=o*u,f=o*c,d=o*p,y=a*c,g=a*p,x=s*p,v=l*u,b=l*c,w=l*p,S=i[0],P=i[1],I=i[2],k=n[0],C=n[1],T=n[2],D=(1-(y+x))*S,F=(f+w)*S,E=(d-b)*S,A=(f-w)*P,$=(1-(h+x))*P,X=(g+v)*P,j=(d+b)*I,fe=(g-v)*I,Q=(1-(h+y))*I;return r[0]=D,r[1]=F,r[2]=E,r[3]=0,r[4]=A,r[5]=$,r[6]=X,r[7]=0,r[8]=j,r[9]=fe,r[10]=Q,r[11]=0,r[12]=t[0]+k-(D*k+A*C+j*T),r[13]=t[1]+C-(F*k+$*C+fe*T),r[14]=t[2]+T-(E*k+X*C+Q*T),r[15]=1,r}function oS(r,e){var t=e[0],i=e[1],n=e[2],o=e[3],a=t+t,s=i+i,l=n+n,u=t*a,c=i*a,p=i*s,h=n*a,f=n*s,d=n*l,y=o*a,g=o*s,x=o*l;return r[0]=1-p-d,r[1]=c+x,r[2]=h-g,r[3]=0,r[4]=c-x,r[5]=1-u-d,r[6]=f+y,r[7]=0,r[8]=h+g,r[9]=f-y,r[10]=1-u-p,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function aS(r,e,t,i,n,o,a){var s=1/(t-e),l=1/(n-i),u=1/(o-a);return r[0]=o*2*s,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=o*2*l,r[6]=0,r[7]=0,r[8]=(t+e)*s,r[9]=(n+i)*l,r[10]=(a+o)*u,r[11]=-1,r[12]=0,r[13]=0,r[14]=a*o*2*u,r[15]=0,r}function fd(r,e,t,i,n){var o=1/Math.tan(e/2),a;return r[0]=o/t,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=o,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,n!=null&&n!==1/0?(a=1/(i-n),r[10]=(n+i)*a,r[14]=2*n*i*a):(r[10]=-1,r[14]=-2*i),r}var sS=fd;function lS(r,e,t,i,n){var o=1/Math.tan(e/2),a;return r[0]=o/t,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=o,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,n!=null&&n!==1/0?(a=1/(i-n),r[10]=n*a,r[14]=n*i*a):(r[10]=-1,r[14]=-i),r}function uS(r,e,t,i){var n=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/(n+o);return r[0]=l,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=u,r[6]=0,r[7]=0,r[8]=-((a-s)*l*.5),r[9]=(n-o)*u*.5,r[10]=i/(t-i),r[11]=-1,r[12]=0,r[13]=0,r[14]=i*t/(t-i),r[15]=0,r}function md(r,e,t,i,n,o,a){var s=1/(e-t),l=1/(i-n),u=1/(o-a);return r[0]=-2*s,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*l,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=2*u,r[11]=0,r[12]=(e+t)*s,r[13]=(n+i)*l,r[14]=(a+o)*u,r[15]=1,r}var cS=md;function pS(r,e,t,i,n,o,a){var s=1/(e-t),l=1/(i-n),u=1/(o-a);return r[0]=-2*s,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*l,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=u,r[11]=0,r[12]=(e+t)*s,r[13]=(n+i)*l,r[14]=o*u,r[15]=1,r}function hS(r,e,t,i){var n,o,a,s,l,u,c,p,h,f,d=e[0],y=e[1],g=e[2],x=i[0],v=i[1],b=i[2],w=t[0],S=t[1],P=t[2];return Math.abs(d-w)<ie&&Math.abs(y-S)<ie&&Math.abs(g-P)<ie?ud(r):(c=d-w,p=y-S,h=g-P,f=1/Math.hypot(c,p,h),c*=f,p*=f,h*=f,n=v*h-b*p,o=b*c-x*h,a=x*p-v*c,f=Math.hypot(n,o,a),f?(f=1/f,n*=f,o*=f,a*=f):(n=0,o=0,a=0),s=p*a-h*o,l=h*n-c*a,u=c*o-p*n,f=Math.hypot(s,l,u),f?(f=1/f,s*=f,l*=f,u*=f):(s=0,l=0,u=0),r[0]=n,r[1]=s,r[2]=c,r[3]=0,r[4]=o,r[5]=l,r[6]=p,r[7]=0,r[8]=a,r[9]=u,r[10]=h,r[11]=0,r[12]=-(n*d+o*y+a*g),r[13]=-(s*d+l*y+u*g),r[14]=-(c*d+p*y+h*g),r[15]=1,r)}function fS(r,e,t,i){var n=e[0],o=e[1],a=e[2],s=i[0],l=i[1],u=i[2],c=n-t[0],p=o-t[1],h=a-t[2],f=c*c+p*p+h*h;f>0&&(f=1/Math.sqrt(f),c*=f,p*=f,h*=f);var d=l*h-u*p,y=u*c-s*h,g=s*p-l*c;return f=d*d+y*y+g*g,f>0&&(f=1/Math.sqrt(f),d*=f,y*=f,g*=f),r[0]=d,r[1]=y,r[2]=g,r[3]=0,r[4]=p*g-h*y,r[5]=h*d-c*g,r[6]=c*y-p*d,r[7]=0,r[8]=c,r[9]=p,r[10]=h,r[11]=0,r[12]=n,r[13]=o,r[14]=a,r[15]=1,r}function mS(r){return"mat4("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+", "+r[4]+", "+r[5]+", "+r[6]+", "+r[7]+", "+r[8]+", "+r[9]+", "+r[10]+", "+r[11]+", "+r[12]+", "+r[13]+", "+r[14]+", "+r[15]+")"}function dS(r){return Math.hypot(r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8],r[9],r[10],r[11],r[12],r[13],r[14],r[15])}function yS(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r[4]=e[4]+t[4],r[5]=e[5]+t[5],r[6]=e[6]+t[6],r[7]=e[7]+t[7],r[8]=e[8]+t[8],r[9]=e[9]+t[9],r[10]=e[10]+t[10],r[11]=e[11]+t[11],r[12]=e[12]+t[12],r[13]=e[13]+t[13],r[14]=e[14]+t[14],r[15]=e[15]+t[15],r}function dd(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r[3]=e[3]-t[3],r[4]=e[4]-t[4],r[5]=e[5]-t[5],r[6]=e[6]-t[6],r[7]=e[7]-t[7],r[8]=e[8]-t[8],r[9]=e[9]-t[9],r[10]=e[10]-t[10],r[11]=e[11]-t[11],r[12]=e[12]-t[12],r[13]=e[13]-t[13],r[14]=e[14]-t[14],r[15]=e[15]-t[15],r}function gS(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r[4]=e[4]*t,r[5]=e[5]*t,r[6]=e[6]*t,r[7]=e[7]*t,r[8]=e[8]*t,r[9]=e[9]*t,r[10]=e[10]*t,r[11]=e[11]*t,r[12]=e[12]*t,r[13]=e[13]*t,r[14]=e[14]*t,r[15]=e[15]*t,r}function xS(r,e,t,i){return r[0]=e[0]+t[0]*i,r[1]=e[1]+t[1]*i,r[2]=e[2]+t[2]*i,r[3]=e[3]+t[3]*i,r[4]=e[4]+t[4]*i,r[5]=e[5]+t[5]*i,r[6]=e[6]+t[6]*i,r[7]=e[7]+t[7]*i,r[8]=e[8]+t[8]*i,r[9]=e[9]+t[9]*i,r[10]=e[10]+t[10]*i,r[11]=e[11]+t[11]*i,r[12]=e[12]+t[12]*i,r[13]=e[13]+t[13]*i,r[14]=e[14]+t[14]*i,r[15]=e[15]+t[15]*i,r}function bS(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]&&r[4]===e[4]&&r[5]===e[5]&&r[6]===e[6]&&r[7]===e[7]&&r[8]===e[8]&&r[9]===e[9]&&r[10]===e[10]&&r[11]===e[11]&&r[12]===e[12]&&r[13]===e[13]&&r[14]===e[14]&&r[15]===e[15]}function _S(r,e){var t=r[0],i=r[1],n=r[2],o=r[3],a=r[4],s=r[5],l=r[6],u=r[7],c=r[8],p=r[9],h=r[10],f=r[11],d=r[12],y=r[13],g=r[14],x=r[15],v=e[0],b=e[1],w=e[2],S=e[3],P=e[4],I=e[5],k=e[6],C=e[7],T=e[8],D=e[9],F=e[10],E=e[11],A=e[12],$=e[13],X=e[14],j=e[15];return Math.abs(t-v)<=ie*Math.max(1,Math.abs(t),Math.abs(v))&&Math.abs(i-b)<=ie*Math.max(1,Math.abs(i),Math.abs(b))&&Math.abs(n-w)<=ie*Math.max(1,Math.abs(n),Math.abs(w))&&Math.abs(o-S)<=ie*Math.max(1,Math.abs(o),Math.abs(S))&&Math.abs(a-P)<=ie*Math.max(1,Math.abs(a),Math.abs(P))&&Math.abs(s-I)<=ie*Math.max(1,Math.abs(s),Math.abs(I))&&Math.abs(l-k)<=ie*Math.max(1,Math.abs(l),Math.abs(k))&&Math.abs(u-C)<=ie*Math.max(1,Math.abs(u),Math.abs(C))&&Math.abs(c-T)<=ie*Math.max(1,Math.abs(c),Math.abs(T))&&Math.abs(p-D)<=ie*Math.max(1,Math.abs(p),Math.abs(D))&&Math.abs(h-F)<=ie*Math.max(1,Math.abs(h),Math.abs(F))&&Math.abs(f-E)<=ie*Math.max(1,Math.abs(f),Math.abs(E))&&Math.abs(d-A)<=ie*Math.max(1,Math.abs(d),Math.abs(A))&&Math.abs(y-$)<=ie*Math.max(1,Math.abs(y),Math.abs($))&&Math.abs(g-X)<=ie*Math.max(1,Math.abs(g),Math.abs(X))&&Math.abs(x-j)<=ie*Math.max(1,Math.abs(x),Math.abs(j))}var vS=cd,wS=dd;var yt={};xi(yt,{add:()=>MS,angle:()=>XS,bezier:()=>NS,ceil:()=>IS,clone:()=>SS,copy:()=>TS,create:()=>yd,cross:()=>OS,dist:()=>iP,distance:()=>vd,div:()=>rP,divide:()=>_d,dot:()=>Pd,equals:()=>QS,exactEquals:()=>YS,floor:()=>CS,forEach:()=>sP,fromValues:()=>PS,hermite:()=>US,inverse:()=>RS,len:()=>oP,length:()=>gd,lerp:()=>VS,max:()=>kS,min:()=>ES,mul:()=>tP,multiply:()=>bd,negate:()=>FS,normalize:()=>BS,random:()=>GS,rotateX:()=>ZS,rotateY:()=>HS,rotateZ:()=>WS,round:()=>LS,scale:()=>DS,scaleAndAdd:()=>zS,set:()=>AS,sqrDist:()=>nP,sqrLen:()=>aP,squaredDistance:()=>wd,squaredLength:()=>Sd,str:()=>JS,sub:()=>eP,subtract:()=>xd,transformMat3:()=>qS,transformMat4:()=>$S,transformQuat:()=>jS,zero:()=>KS});m();function yd(){var r=new ve(3);return ve!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function SS(r){var e=new ve(3);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e}function gd(r){var e=r[0],t=r[1],i=r[2];return Math.hypot(e,t,i)}function PS(r,e,t){var i=new ve(3);return i[0]=r,i[1]=e,i[2]=t,i}function TS(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r}function AS(r,e,t,i){return r[0]=e,r[1]=t,r[2]=i,r}function MS(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r}function xd(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r}function bd(r,e,t){return r[0]=e[0]*t[0],r[1]=e[1]*t[1],r[2]=e[2]*t[2],r}function _d(r,e,t){return r[0]=e[0]/t[0],r[1]=e[1]/t[1],r[2]=e[2]/t[2],r}function IS(r,e){return r[0]=Math.ceil(e[0]),r[1]=Math.ceil(e[1]),r[2]=Math.ceil(e[2]),r}function CS(r,e){return r[0]=Math.floor(e[0]),r[1]=Math.floor(e[1]),r[2]=Math.floor(e[2]),r}function ES(r,e,t){return r[0]=Math.min(e[0],t[0]),r[1]=Math.min(e[1],t[1]),r[2]=Math.min(e[2],t[2]),r}function kS(r,e,t){return r[0]=Math.max(e[0],t[0]),r[1]=Math.max(e[1],t[1]),r[2]=Math.max(e[2],t[2]),r}function LS(r,e){return r[0]=Math.round(e[0]),r[1]=Math.round(e[1]),r[2]=Math.round(e[2]),r}function DS(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r}function zS(r,e,t,i){return r[0]=e[0]+t[0]*i,r[1]=e[1]+t[1]*i,r[2]=e[2]+t[2]*i,r}function vd(r,e){var t=e[0]-r[0],i=e[1]-r[1],n=e[2]-r[2];return Math.hypot(t,i,n)}function wd(r,e){var t=e[0]-r[0],i=e[1]-r[1],n=e[2]-r[2];return t*t+i*i+n*n}function Sd(r){var e=r[0],t=r[1],i=r[2];return e*e+t*t+i*i}function FS(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r}function RS(r,e){return r[0]=1/e[0],r[1]=1/e[1],r[2]=1/e[2],r}function BS(r,e){var t=e[0],i=e[1],n=e[2],o=t*t+i*i+n*n;return o>0&&(o=1/Math.sqrt(o)),r[0]=e[0]*o,r[1]=e[1]*o,r[2]=e[2]*o,r}function Pd(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]}function OS(r,e,t){var i=e[0],n=e[1],o=e[2],a=t[0],s=t[1],l=t[2];return r[0]=n*l-o*s,r[1]=o*a-i*l,r[2]=i*s-n*a,r}function VS(r,e,t,i){var n=e[0],o=e[1],a=e[2];return r[0]=n+i*(t[0]-n),r[1]=o+i*(t[1]-o),r[2]=a+i*(t[2]-a),r}function US(r,e,t,i,n,o){var a=o*o,s=a*(2*o-3)+1,l=a*(o-2)+o,u=a*(o-1),c=a*(3-2*o);return r[0]=e[0]*s+t[0]*l+i[0]*u+n[0]*c,r[1]=e[1]*s+t[1]*l+i[1]*u+n[1]*c,r[2]=e[2]*s+t[2]*l+i[2]*u+n[2]*c,r}function NS(r,e,t,i,n,o){var a=1-o,s=a*a,l=o*o,u=s*a,c=3*o*s,p=3*l*a,h=l*o;return r[0]=e[0]*u+t[0]*c+i[0]*p+n[0]*h,r[1]=e[1]*u+t[1]*c+i[1]*p+n[1]*h,r[2]=e[2]*u+t[2]*c+i[2]*p+n[2]*h,r}function GS(r,e){e=e||1;var t=qt()*2*Math.PI,i=qt()*2-1,n=Math.sqrt(1-i*i)*e;return r[0]=Math.cos(t)*n,r[1]=Math.sin(t)*n,r[2]=i*e,r}function $S(r,e,t){var i=e[0],n=e[1],o=e[2],a=t[3]*i+t[7]*n+t[11]*o+t[15];return a=a||1,r[0]=(t[0]*i+t[4]*n+t[8]*o+t[12])/a,r[1]=(t[1]*i+t[5]*n+t[9]*o+t[13])/a,r[2]=(t[2]*i+t[6]*n+t[10]*o+t[14])/a,r}function qS(r,e,t){var i=e[0],n=e[1],o=e[2];return r[0]=i*t[0]+n*t[3]+o*t[6],r[1]=i*t[1]+n*t[4]+o*t[7],r[2]=i*t[2]+n*t[5]+o*t[8],r}function jS(r,e,t){var i=t[0],n=t[1],o=t[2],a=t[3],s=e[0],l=e[1],u=e[2],c=n*u-o*l,p=o*s-i*u,h=i*l-n*s,f=n*h-o*p,d=o*c-i*h,y=i*p-n*c,g=a*2;return c*=g,p*=g,h*=g,f*=2,d*=2,y*=2,r[0]=s+c+f,r[1]=l+p+d,r[2]=u+h+y,r}function ZS(r,e,t,i){var n=[],o=[];return n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],o[0]=n[0],o[1]=n[1]*Math.cos(i)-n[2]*Math.sin(i),o[2]=n[1]*Math.sin(i)+n[2]*Math.cos(i),r[0]=o[0]+t[0],r[1]=o[1]+t[1],r[2]=o[2]+t[2],r}function HS(r,e,t,i){var n=[],o=[];return n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],o[0]=n[2]*Math.sin(i)+n[0]*Math.cos(i),o[1]=n[1],o[2]=n[2]*Math.cos(i)-n[0]*Math.sin(i),r[0]=o[0]+t[0],r[1]=o[1]+t[1],r[2]=o[2]+t[2],r}function WS(r,e,t,i){var n=[],o=[];return n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],o[0]=n[0]*Math.cos(i)-n[1]*Math.sin(i),o[1]=n[0]*Math.sin(i)+n[1]*Math.cos(i),o[2]=n[2],r[0]=o[0]+t[0],r[1]=o[1]+t[1],r[2]=o[2]+t[2],r}function XS(r,e){var t=r[0],i=r[1],n=r[2],o=e[0],a=e[1],s=e[2],l=Math.sqrt(t*t+i*i+n*n),u=Math.sqrt(o*o+a*a+s*s),c=l*u,p=c&&Pd(r,e)/c;return Math.acos(Math.min(Math.max(p,-1),1))}function KS(r){return r[0]=0,r[1]=0,r[2]=0,r}function JS(r){return"vec3("+r[0]+", "+r[1]+", "+r[2]+")"}function YS(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]}function QS(r,e){var t=r[0],i=r[1],n=r[2],o=e[0],a=e[1],s=e[2];return Math.abs(t-o)<=ie*Math.max(1,Math.abs(t),Math.abs(o))&&Math.abs(i-a)<=ie*Math.max(1,Math.abs(i),Math.abs(a))&&Math.abs(n-s)<=ie*Math.max(1,Math.abs(n),Math.abs(s))}var eP=xd,tP=bd,rP=_d,iP=vd,nP=wd,oP=gd,aP=Sd,sP=function(){var r=yd();return function(e,t,i,n,o,a){var s,l;for(t||(t=3),i||(i=0),n?l=Math.min(n*t+i,e.length):l=e.length,s=i;s<l;s+=t)r[0]=e[s],r[1]=e[s+1],r[2]=e[s+2],o(r,r,a),e[s]=r[0],e[s+1]=r[1],e[s+2]=r[2];return e}}();var Ne={};xi(Ne,{add:()=>hP,ceil:()=>fP,clone:()=>lP,copy:()=>cP,create:()=>Td,cross:()=>PP,dist:()=>RP,distance:()=>Cd,div:()=>FP,divide:()=>Id,dot:()=>SP,equals:()=>LP,exactEquals:()=>kP,floor:()=>mP,forEach:()=>UP,fromValues:()=>uP,inverse:()=>vP,len:()=>OP,length:()=>kd,lerp:()=>TP,max:()=>yP,min:()=>dP,mul:()=>zP,multiply:()=>Md,negate:()=>_P,normalize:()=>wP,random:()=>AP,round:()=>gP,scale:()=>xP,scaleAndAdd:()=>bP,set:()=>pP,sqrDist:()=>BP,sqrLen:()=>VP,squaredDistance:()=>Ed,squaredLength:()=>Ld,str:()=>EP,sub:()=>DP,subtract:()=>Ad,transformMat4:()=>MP,transformQuat:()=>IP,zero:()=>CP});m();function Td(){var r=new ve(4);return ve!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0,r[3]=0),r}function lP(r){var e=new ve(4);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e}function uP(r,e,t,i){var n=new ve(4);return n[0]=r,n[1]=e,n[2]=t,n[3]=i,n}function cP(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r}function pP(r,e,t,i,n){return r[0]=e,r[1]=t,r[2]=i,r[3]=n,r}function hP(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r[3]=e[3]+t[3],r}function Ad(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r[3]=e[3]-t[3],r}function Md(r,e,t){return r[0]=e[0]*t[0],r[1]=e[1]*t[1],r[2]=e[2]*t[2],r[3]=e[3]*t[3],r}function Id(r,e,t){return r[0]=e[0]/t[0],r[1]=e[1]/t[1],r[2]=e[2]/t[2],r[3]=e[3]/t[3],r}function fP(r,e){return r[0]=Math.ceil(e[0]),r[1]=Math.ceil(e[1]),r[2]=Math.ceil(e[2]),r[3]=Math.ceil(e[3]),r}function mP(r,e){return r[0]=Math.floor(e[0]),r[1]=Math.floor(e[1]),r[2]=Math.floor(e[2]),r[3]=Math.floor(e[3]),r}function dP(r,e,t){return r[0]=Math.min(e[0],t[0]),r[1]=Math.min(e[1],t[1]),r[2]=Math.min(e[2],t[2]),r[3]=Math.min(e[3],t[3]),r}function yP(r,e,t){return r[0]=Math.max(e[0],t[0]),r[1]=Math.max(e[1],t[1]),r[2]=Math.max(e[2],t[2]),r[3]=Math.max(e[3],t[3]),r}function gP(r,e){return r[0]=Math.round(e[0]),r[1]=Math.round(e[1]),r[2]=Math.round(e[2]),r[3]=Math.round(e[3]),r}function xP(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r}function bP(r,e,t,i){return r[0]=e[0]+t[0]*i,r[1]=e[1]+t[1]*i,r[2]=e[2]+t[2]*i,r[3]=e[3]+t[3]*i,r}function Cd(r,e){var t=e[0]-r[0],i=e[1]-r[1],n=e[2]-r[2],o=e[3]-r[3];return Math.hypot(t,i,n,o)}function Ed(r,e){var t=e[0]-r[0],i=e[1]-r[1],n=e[2]-r[2],o=e[3]-r[3];return t*t+i*i+n*n+o*o}function kd(r){var e=r[0],t=r[1],i=r[2],n=r[3];return Math.hypot(e,t,i,n)}function Ld(r){var e=r[0],t=r[1],i=r[2],n=r[3];return e*e+t*t+i*i+n*n}function _P(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r[3]=-e[3],r}function vP(r,e){return r[0]=1/e[0],r[1]=1/e[1],r[2]=1/e[2],r[3]=1/e[3],r}function wP(r,e){var t=e[0],i=e[1],n=e[2],o=e[3],a=t*t+i*i+n*n+o*o;return a>0&&(a=1/Math.sqrt(a)),r[0]=t*a,r[1]=i*a,r[2]=n*a,r[3]=o*a,r}function SP(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]+r[3]*e[3]}function PP(r,e,t,i){var n=t[0]*i[1]-t[1]*i[0],o=t[0]*i[2]-t[2]*i[0],a=t[0]*i[3]-t[3]*i[0],s=t[1]*i[2]-t[2]*i[1],l=t[1]*i[3]-t[3]*i[1],u=t[2]*i[3]-t[3]*i[2],c=e[0],p=e[1],h=e[2],f=e[3];return r[0]=p*u-h*l+f*s,r[1]=-(c*u)+h*a-f*o,r[2]=c*l-p*a+f*n,r[3]=-(c*s)+p*o-h*n,r}function TP(r,e,t,i){var n=e[0],o=e[1],a=e[2],s=e[3];return r[0]=n+i*(t[0]-n),r[1]=o+i*(t[1]-o),r[2]=a+i*(t[2]-a),r[3]=s+i*(t[3]-s),r}function AP(r,e){e=e||1;var t,i,n,o,a,s;do t=qt()*2-1,i=qt()*2-1,a=t*t+i*i;while(a>=1);do n=qt()*2-1,o=qt()*2-1,s=n*n+o*o;while(s>=1);var l=Math.sqrt((1-a)/s);return r[0]=e*t,r[1]=e*i,r[2]=e*n*l,r[3]=e*o*l,r}function MP(r,e,t){var i=e[0],n=e[1],o=e[2],a=e[3];return r[0]=t[0]*i+t[4]*n+t[8]*o+t[12]*a,r[1]=t[1]*i+t[5]*n+t[9]*o+t[13]*a,r[2]=t[2]*i+t[6]*n+t[10]*o+t[14]*a,r[3]=t[3]*i+t[7]*n+t[11]*o+t[15]*a,r}function IP(r,e,t){var i=e[0],n=e[1],o=e[2],a=t[0],s=t[1],l=t[2],u=t[3],c=u*i+s*o-l*n,p=u*n+l*i-a*o,h=u*o+a*n-s*i,f=-a*i-s*n-l*o;return r[0]=c*u+f*-a+p*-l-h*-s,r[1]=p*u+f*-s+h*-a-c*-l,r[2]=h*u+f*-l+c*-s-p*-a,r[3]=e[3],r}function CP(r){return r[0]=0,r[1]=0,r[2]=0,r[3]=0,r}function EP(r){return"vec4("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+")"}function kP(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]}function LP(r,e){var t=r[0],i=r[1],n=r[2],o=r[3],a=e[0],s=e[1],l=e[2],u=e[3];return Math.abs(t-a)<=ie*Math.max(1,Math.abs(t),Math.abs(a))&&Math.abs(i-s)<=ie*Math.max(1,Math.abs(i),Math.abs(s))&&Math.abs(n-l)<=ie*Math.max(1,Math.abs(n),Math.abs(l))&&Math.abs(o-u)<=ie*Math.max(1,Math.abs(o),Math.abs(u))}var DP=Ad,zP=Md,FP=Id,RP=Cd,BP=Ed,OP=kd,VP=Ld,UP=function(){var r=Td();return function(e,t,i,n,o,a){var s,l;for(t||(t=4),i||(i=0),n?l=Math.min(n*t+i,e.length):l=e.length,s=i;s<l;s+=t)r[0]=e[s],r[1]=e[s+1],r[2]=e[s+2],r[3]=e[s+3],o(r,r,a),e[s]=r[0],e[s+1]=r[1],e[s+2]=r[2],e[s+3]=r[3];return e}}();var ji={};xi(ji,{add:()=>jP,angle:()=>p2,ceil:()=>ZP,clone:()=>NP,copy:()=>$P,create:()=>Dd,cross:()=>i2,dist:()=>_2,distance:()=>Bd,div:()=>b2,divide:()=>Rd,dot:()=>r2,equals:()=>d2,exactEquals:()=>m2,floor:()=>HP,forEach:()=>S2,fromValues:()=>GP,inverse:()=>e2,len:()=>y2,length:()=>Vd,lerp:()=>n2,max:()=>XP,min:()=>WP,mul:()=>x2,multiply:()=>Fd,negate:()=>QP,normalize:()=>t2,random:()=>o2,rotate:()=>c2,round:()=>KP,scale:()=>JP,scaleAndAdd:()=>YP,set:()=>qP,sqrDist:()=>v2,sqrLen:()=>w2,squaredDistance:()=>Od,squaredLength:()=>Ud,str:()=>f2,sub:()=>g2,subtract:()=>zd,transformMat2:()=>a2,transformMat2d:()=>s2,transformMat3:()=>l2,transformMat4:()=>u2,zero:()=>h2});m();function Dd(){var r=new ve(2);return ve!=Float32Array&&(r[0]=0,r[1]=0),r}function NP(r){var e=new ve(2);return e[0]=r[0],e[1]=r[1],e}function GP(r,e){var t=new ve(2);return t[0]=r,t[1]=e,t}function $P(r,e){return r[0]=e[0],r[1]=e[1],r}function qP(r,e,t){return r[0]=e,r[1]=t,r}function jP(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r}function zd(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r}function Fd(r,e,t){return r[0]=e[0]*t[0],r[1]=e[1]*t[1],r}function Rd(r,e,t){return r[0]=e[0]/t[0],r[1]=e[1]/t[1],r}function ZP(r,e){return r[0]=Math.ceil(e[0]),r[1]=Math.ceil(e[1]),r}function HP(r,e){return r[0]=Math.floor(e[0]),r[1]=Math.floor(e[1]),r}function WP(r,e,t){return r[0]=Math.min(e[0],t[0]),r[1]=Math.min(e[1],t[1]),r}function XP(r,e,t){return r[0]=Math.max(e[0],t[0]),r[1]=Math.max(e[1],t[1]),r}function KP(r,e){return r[0]=Math.round(e[0]),r[1]=Math.round(e[1]),r}function JP(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r}function YP(r,e,t,i){return r[0]=e[0]+t[0]*i,r[1]=e[1]+t[1]*i,r}function Bd(r,e){var t=e[0]-r[0],i=e[1]-r[1];return Math.hypot(t,i)}function Od(r,e){var t=e[0]-r[0],i=e[1]-r[1];return t*t+i*i}function Vd(r){var e=r[0],t=r[1];return Math.hypot(e,t)}function Ud(r){var e=r[0],t=r[1];return e*e+t*t}function QP(r,e){return r[0]=-e[0],r[1]=-e[1],r}function e2(r,e){return r[0]=1/e[0],r[1]=1/e[1],r}function t2(r,e){var t=e[0],i=e[1],n=t*t+i*i;return n>0&&(n=1/Math.sqrt(n)),r[0]=e[0]*n,r[1]=e[1]*n,r}function r2(r,e){return r[0]*e[0]+r[1]*e[1]}function i2(r,e,t){var i=e[0]*t[1]-e[1]*t[0];return r[0]=r[1]=0,r[2]=i,r}function n2(r,e,t,i){var n=e[0],o=e[1];return r[0]=n+i*(t[0]-n),r[1]=o+i*(t[1]-o),r}function o2(r,e){e=e||1;var t=qt()*2*Math.PI;return r[0]=Math.cos(t)*e,r[1]=Math.sin(t)*e,r}function a2(r,e,t){var i=e[0],n=e[1];return r[0]=t[0]*i+t[2]*n,r[1]=t[1]*i+t[3]*n,r}function s2(r,e,t){var i=e[0],n=e[1];return r[0]=t[0]*i+t[2]*n+t[4],r[1]=t[1]*i+t[3]*n+t[5],r}function l2(r,e,t){var i=e[0],n=e[1];return r[0]=t[0]*i+t[3]*n+t[6],r[1]=t[1]*i+t[4]*n+t[7],r}function u2(r,e,t){var i=e[0],n=e[1];return r[0]=t[0]*i+t[4]*n+t[12],r[1]=t[1]*i+t[5]*n+t[13],r}function c2(r,e,t,i){var n=e[0]-t[0],o=e[1]-t[1],a=Math.sin(i),s=Math.cos(i);return r[0]=n*s-o*a+t[0],r[1]=n*a+o*s+t[1],r}function p2(r,e){var t=r[0],i=r[1],n=e[0],o=e[1],a=Math.sqrt(t*t+i*i)*Math.sqrt(n*n+o*o),s=a&&(t*n+i*o)/a;return Math.acos(Math.min(Math.max(s,-1),1))}function h2(r){return r[0]=0,r[1]=0,r}function f2(r){return"vec2("+r[0]+", "+r[1]+")"}function m2(r,e){return r[0]===e[0]&&r[1]===e[1]}function d2(r,e){var t=r[0],i=r[1],n=e[0],o=e[1];return Math.abs(t-n)<=ie*Math.max(1,Math.abs(t),Math.abs(n))&&Math.abs(i-o)<=ie*Math.max(1,Math.abs(i),Math.abs(o))}var y2=Vd,g2=zd,x2=Fd,b2=Rd,_2=Bd,v2=Od,w2=Ud,S2=function(){var r=Dd();return function(e,t,i,n,o,a){var s,l;for(t||(t=2),i||(i=0),n?l=Math.min(n*t+i,e.length):l=e.length,s=i;s<l;s+=t)r[0]=e[s],r[1]=e[s+1],o(r,r,a),e[s]=r[0],e[s+1]=r[1];return e}}();var Nd=ne(ye(),1),qs=class extends Ue{constructor(e){super(e,nd)}createBucket(e){return new ri(e)}queryRadius(e){let t=e;return ii("circle-radius",this,t)+ii("circle-stroke-width",this,t)+Mr(this.paint.get("circle-translate"))}queryIntersectsFeature(e,t,i,n,o,a,s,l){let u=Ir(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),a.angle,s),c=this.paint.get("circle-radius").evaluate(t,i),p=this.paint.get("circle-stroke-width").evaluate(t,i),h=c+p,f=this.paint.get("circle-pitch-alignment")==="map",d=f?u:P2(u,l),y=f?h*s:h;for(let g of n)for(let x of g){let v=f?x:Gd(x,l),b=y,w=Ne.transformMat4([],[x.x,x.y,0,1],l);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?b*=w[3]/a.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(b*=a.cameraToCenterDistance/w[3]),Jm(d,v,b))return!0}return!1}};function Gd(r,e){let t=Ne.transformMat4([],[r.x,r.y,0,1],e);return new Nd.default(t[0]/t[3],t[1]/t[3])}function P2(r,e){return r.map(t=>Gd(t,e))}m();m();var vo=class extends ri{};U("HeatmapBucket",vo,{omit:["layers"]});m();var $d,T2=()=>$d=$d||new Le({"heatmap-radius":new H(M.paint_heatmap["heatmap-radius"]),"heatmap-weight":new H(M.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new q(M.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Yr(M.paint_heatmap["heatmap-color"]),"heatmap-opacity":new q(M.paint_heatmap["heatmap-opacity"])}),qd={get paint(){return T2()}};m();m();function wp(r,{width:e,height:t},i,n){if(!n)n=new Uint8Array(e*t*i);else if(n instanceof Uint8ClampedArray)n=new Uint8Array(n.buffer);else if(n.length!==e*t*i)throw new RangeError(`mismatched image size. expected: ${n.length} but got: ${e*t*i}`);return r.width=e,r.height=t,r.data=n,r}function jd(r,{width:e,height:t},i){if(e===r.width&&t===r.height)return;let n=wp({},{width:e,height:t},i);Sp(r,n,{x:0,y:0},{x:0,y:0},{width:Math.min(r.width,e),height:Math.min(r.height,t)},i),r.width=e,r.height=t,r.data=n.data}function Sp(r,e,t,i,n,o){if(n.width===0||n.height===0)return e;if(n.width>r.width||n.height>r.height||t.x>r.width-n.width||t.y>r.height-n.height)throw new RangeError("out of range source coordinates for image copy");if(n.width>e.width||n.height>e.height||i.x>e.width-n.width||i.y>e.height-n.height)throw new RangeError("out of range destination coordinates for image copy");let a=r.data,s=e.data;if(a===s)throw new Error("srcData equals dstData, so image is already copied");for(let l=0;l<n.height;l++){let u=((t.y+l)*r.width+t.x)*o,c=((i.y+l)*e.width+i.x)*o;for(let p=0;p<n.width*o;p++)s[c+p]=a[u+p]}return e}var ni=class r{constructor(e,t){wp(this,e,1,t)}resize(e){jd(this,e,1)}clone(){return new r({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,i,n,o){Sp(e,t,i,n,o,1)}},we=class r{constructor(e,t){wp(this,e,4,t)}resize(e){jd(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 r({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,i,n,o){Sp(e,t,i,n,o,4)}};U("AlphaImage",ni);U("RGBAImage",we);function js(r){let e={},t=r.resolution||256,i=r.clips?r.clips.length:1,n=r.image||new we({width:t,height:i});if(!af(t))throw new Error(`width is not a power of 2 - ${t}`);let o=(a,s,l)=>{e[r.evaluationKey]=l;let u=r.expression.evaluate(e);n.data[a+s+0]=Math.floor(u.r*255/u.a),n.data[a+s+1]=Math.floor(u.g*255/u.a),n.data[a+s+2]=Math.floor(u.b*255/u.a),n.data[a+s+3]=Math.floor(u.a*255)};if(r.clips)for(let a=0,s=0;a<i;++a,s+=t*4)for(let l=0,u=0;l<t;l++,u+=4){let c=l/(t-1),{start:p,end:h}=r.clips[a],f=p*(1-c)+h*c;o(s,u,f)}else for(let a=0,s=0;a<t;a++,s+=4){let l=a/(t-1);o(0,s,l)}return n}var Zs=class extends Ue{createBucket(e){return new vo(e)}constructor(e){super(e,qd),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){e==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){let e=this._transitionablePaint._values["heatmap-color"].value.expression;this.colorRamp=js({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"}};m();m();var Zd,A2=()=>Zd=Zd||new Le({"hillshade-illumination-direction":new q(M.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new q(M.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new q(M.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new q(M.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new q(M.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new q(M.paint_hillshade["hillshade-accent-color"])}),Hd={get paint(){return A2()}};var Hs=class extends Ue{constructor(e){super(e,Hd)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}};m();m();m();var M2=be([{name:"a_pos",components:2,type:"Int16"}],4);var{members:Wd,size:bL,alignment:_L}=M2;var ey=ne(Ip(),1);m();m();function Cp(r,e,t,i,n){Qd(r,e,t||0,i||r.length-1,n||$2)}function Qd(r,e,t,i,n){for(;i>t;){if(i-t>600){var o=i-t+1,a=e-t+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(t,Math.floor(e-a*l/o+u)),p=Math.min(i,Math.floor(e+(o-a)*l/o+u));Qd(r,e,c,p,n)}var h=r[e],f=t,d=i;for(To(r,t,e),n(r[i],h)>0&&To(r,t,i);f<d;){for(To(r,f,d),f++,d--;n(r[f],h)<0;)f++;for(;n(r[d],h)>0;)d--}n(r[t],h)===0?To(r,t,d):(d++,To(r,d,i)),d<=e&&(t=d+1),e<=d&&(i=d-1)}}function To(r,e,t){var i=r[e];r[e]=r[t],r[t]=i}function $2(r,e){return r<e?-1:r>e?1:0}function Ao(r,e){let t=r.length;if(t<=1)return[r];let i=[],n,o;for(let a=0;a<t;a++){let s=cf(r[a]);s!==0&&(r[a].area=Math.abs(s),o===void 0&&(o=s<0),o===s<0?(n&&i.push(n),n=[r[a]]):n.push(r[a]))}if(n&&i.push(n),e>1)for(let a=0;a<i.length;a++)i[a].length<=e||(Cp(i[a],e,1,i[a].length-1,q2),i[a]=i[a].slice(0,e));return i}function q2(r,e){return e.area-r.area}m();function Hi(r,e,t){let i=t.patternDependencies,n=!1;for(let o of e){let a=o.paint.get(`${r}-pattern`);a.isConstant()||(n=!0);let s=a.constantOr(null);s&&(n=!0,i[s.to]=!0,i[s.from]=!0)}return n}function Wi(r,e,t,i,n){let o=n.patternDependencies;for(let a of e){let l=a.paint.get(`${r}-pattern`).value;if(l.kind!=="constant"){let u=l.evaluate({zoom:i-1},t,{},n.availableImages),c=l.evaluate({zoom:i},t,{},n.availableImages),p=l.evaluate({zoom:i+1},t,{},n.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,t.patterns[a.id]={min:u,mid:c,max:p}}}return t}var j2=500,Mo=class{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(t=>t.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Ms,this.indexArray=new rt,this.indexArray2=new Pr,this.programConfigurations=new ft(e.layers,e.zoom),this.segments=new he,this.segments2=new he,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(e,t,i){this.hasPattern=Hi("fill",this.layers,t);let n=this.layers[0].layout.get("fill-sort-key"),o=!n.isConstant(),a=[];for(let{feature:s,id:l,index:u,sourceLayerIndex:c}of e){let p=this.layers[0]._featureFilter.needGeometry,h=dt(s,p);if(!this.layers[0]._featureFilter.filter(new de(this.zoom),h,i))continue;let f=o?n.evaluate(h,{},i,t.availableImages):void 0,d={id:l,properties:s.properties,type:s.type,sourceLayerIndex:c,index:u,geometry:p?h.geometry:mt(s),patterns:{},sortKey:f};a.push(d)}o&&a.sort((s,l)=>s.sortKey-l.sortKey);for(let s of a){let{geometry:l,index:u,sourceLayerIndex:c}=s;if(this.hasPattern){let h=Wi("fill",this.layers,s,this.zoom,t);this.patternFeatures.push(h)}else this.addFeature(s,l,u,i,{});let p=e[u].feature;t.featureIndex.insert(p,l,u,c,this.index)}}update(e,t,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,i)}addFeatures(e,t,i){for(let n of this.patternFeatures)this.addFeature(n,n.geometry,n.index,t,i)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Wd),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,i,n,o){for(let a of Ao(t,j2)){let s=0;for(let f of a)s+=f.length;let l=this.segments.prepareSegment(s,this.layoutVertexArray,this.indexArray),u=l.vertexLength,c=[],p=[];for(let f of a){if(f.length===0)continue;f!==a[0]&&p.push(c.length/2);let d=this.segments2.prepareSegment(f.length,this.layoutVertexArray,this.indexArray2),y=d.vertexLength;this.layoutVertexArray.emplaceBack(f[0].x,f[0].y),this.indexArray2.emplaceBack(y+f.length-1,y),c.push(f[0].x),c.push(f[0].y);for(let g=1;g<f.length;g++)this.layoutVertexArray.emplaceBack(f[g].x,f[g].y),this.indexArray2.emplaceBack(y+g-1,y+g),c.push(f[g].x),c.push(f[g].y);d.vertexLength+=f.length,d.primitiveLength+=f.length}let h=(0,ey.default)(c,p);for(let f=0;f<h.length;f+=3)this.indexArray.emplaceBack(u+h[f],u+h[f+1],u+h[f+2]);l.vertexLength+=s,l.primitiveLength+=h.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,o,n)}};U("FillBucket",Mo,{omit:["layers","patternFeatures"]});m();var ty,Z2=()=>ty=ty||new Le({"fill-sort-key":new H(M.layout_fill["fill-sort-key"])}),ry,H2=()=>ry=ry||new Le({"fill-antialias":new q(M.paint_fill["fill-antialias"]),"fill-opacity":new H(M.paint_fill["fill-opacity"]),"fill-color":new H(M.paint_fill["fill-color"]),"fill-outline-color":new H(M.paint_fill["fill-outline-color"]),"fill-translate":new q(M.paint_fill["fill-translate"]),"fill-translate-anchor":new q(M.paint_fill["fill-translate-anchor"]),"fill-pattern":new rr(M.paint_fill["fill-pattern"])}),iy={get paint(){return H2()},get layout(){return Z2()}};var Ys=class extends Ue{constructor(e){super(e,iy)}recalculate(e,t){super.recalculate(e,t);let i=this.paint._values["fill-outline-color"];i.value.kind==="constant"&&i.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new Mo(e)}queryRadius(){return Mr(this.paint.get("fill-translate"))}queryIntersectsFeature(e,t,i,n,o,a,s){let l=Ir(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),a.angle,s);return Gs(l,n)}isTileClipped(){return!0}};m();m();m();var W2=be([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),ny=be([{name:"a_centroid",components:2,type:"Int16"}],4);var{members:oy,size:cD,alignment:pD}=W2;var py=ne(Ip(),1),hy=ne(Io(),1);var aT=hy.default.VectorTileFeature.types,sT=500,Lp=Math.pow(2,13);function Co(r,e,t,i,n,o,a,s){r.emplaceBack(e,t,Math.floor(i*Lp)*2+a,n*Lp*2,o*Lp*2,Math.round(s))}var Eo=class{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(t=>t.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new Is,this.centroidVertexArray=new Sr,this.indexArray=new rt,this.programConfigurations=new ft(e.layers,e.zoom),this.segments=new he,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(e,t,i){this.features=[],this.hasPattern=Hi("fill-extrusion",this.layers,t);for(let{feature:n,id:o,index:a,sourceLayerIndex:s}of e){let l=this.layers[0]._featureFilter.needGeometry,u=dt(n,l);if(!this.layers[0]._featureFilter.filter(new de(this.zoom),u,i))continue;let c={id:o,sourceLayerIndex:s,index:a,geometry:l?u.geometry:mt(n),properties:n.properties,type:n.type,patterns:{}};this.hasPattern?this.features.push(Wi("fill-extrusion",this.layers,c,this.zoom,t)):this.addFeature(c,c.geometry,a,i,{}),t.featureIndex.insert(n,c.geometry,a,s,this.index,!0)}}addFeatures(e,t,i){for(let n of this.features){let{geometry:o}=n;this.addFeature(n,o,n.index,t,i)}}update(e,t,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,i)}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,oy),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,ny.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,i,n,o){let a={x:0,y:0,vertexCount:0};for(let s of Ao(t,sT)){let l=0;for(let d of s)l+=d.length;let u=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(let d of s){if(d.length===0||uT(d))continue;let y=0;for(let g=0;g<d.length;g++){let x=d[g];if(g>=1){let v=d[g-1];if(!lT(x,v)){u.vertexLength+4>he.MAX_VERTEX_ARRAY_LENGTH&&(u=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let b=x.sub(v)._perp()._unit(),w=v.dist(x);y+w>32768&&(y=0),Co(this.layoutVertexArray,x.x,x.y,b.x,b.y,0,0,y),Co(this.layoutVertexArray,x.x,x.y,b.x,b.y,0,1,y),a.x+=2*x.x,a.y+=2*x.y,a.vertexCount+=2,y+=w,Co(this.layoutVertexArray,v.x,v.y,b.x,b.y,0,0,y),Co(this.layoutVertexArray,v.x,v.y,b.x,b.y,0,1,y),a.x+=2*v.x,a.y+=2*v.y,a.vertexCount+=2;let S=u.vertexLength;this.indexArray.emplaceBack(S,S+2,S+1),this.indexArray.emplaceBack(S+1,S+2,S+3),u.vertexLength+=4,u.primitiveLength+=2}}}}if(u.vertexLength+l>he.MAX_VERTEX_ARRAY_LENGTH&&(u=this.segments.prepareSegment(l,this.layoutVertexArray,this.indexArray)),aT[e.type]!=="Polygon")continue;let c=[],p=[],h=u.vertexLength;for(let d of s)if(d.length!==0){d!==s[0]&&p.push(c.length/2);for(let y=0;y<d.length;y++){let g=d[y];Co(this.layoutVertexArray,g.x,g.y,0,0,1,1,0),a.x+=g.x,a.y+=g.y,a.vertexCount+=1,c.push(g.x),c.push(g.y)}}let f=(0,py.default)(c,p);for(let d=0;d<f.length;d+=3)this.indexArray.emplaceBack(h+f[d],h+f[d+2],h+f[d+1]);u.primitiveLength+=f.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,i,o,n)}};U("FillExtrusionBucket",Eo,{omit:["layers","features"]});function lT(r,e){return r.x===e.x&&(r.x<0||r.x>8192)||r.y===e.y&&(r.y<0||r.y>8192)}function uT(r){return r.every(e=>e.x<0)||r.every(e=>e.x>8192)||r.every(e=>e.y<0)||r.every(e=>e.y>8192)}m();var fy,cT=()=>fy=fy||new Le({"fill-extrusion-opacity":new q(M["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new H(M["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new q(M["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new q(M["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new rr(M["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new H(M["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new H(M["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new q(M["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])}),my={get paint(){return cT()}};var el=ne(ye(),1);var tl=class extends Ue{constructor(e){super(e,my)}createBucket(e){return new Eo(e)}queryRadius(){return Mr(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(e,t,i,n,o,a,s,l){let u=Ir(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(t,i),p=this.paint.get("fill-extrusion-base").evaluate(t,i),h=fT(u,l,a,0),f=hT(n,p,c,l),d=f[0],y=f[1];return pT(d,y,h)}};function ko(r,e){return r.x*e.x+r.y*e.y}function dy(r,e){if(r.length===1){let t=0,i=e[t++],n;for(;!n||i.equals(n);)if(n=e[t++],!n)return 1/0;for(;t<e.length;t++){let o=e[t],a=r[0],s=n.sub(i),l=o.sub(i),u=a.sub(i),c=ko(s,s),p=ko(s,l),h=ko(l,l),f=ko(u,s),d=ko(u,l),y=c*h-p*p,g=(h*f-p*d)/y,x=(c*d-p*f)/y,v=1-g-x,b=i.z*v+n.z*g+o.z*x;if(isFinite(b))return b}return 1/0}else{let t=1/0;for(let i of e)t=Math.min(t,i.z);return t}}function pT(r,e,t){let i=1/0;Gs(t,e)&&(i=dy(t,e[0]));for(let n=0;n<e.length;n++){let o=e[n],a=r[n];for(let s=0;s<o.length-1;s++){let l=o[s],u=o[s+1],c=a[s],p=a[s+1],h=[l,u,p,c,l];Ns(t,h)&&(i=Math.min(i,dy(t,h)))}}return i===1/0?!1:i}function hT(r,e,t,i){let n=[],o=[],a=i[8]*e,s=i[9]*e,l=i[10]*e,u=i[11]*e,c=i[8]*t,p=i[9]*t,h=i[10]*t,f=i[11]*t;for(let d of r){let y=[],g=[];for(let x of d){let v=x.x,b=x.y,w=i[0]*v+i[4]*b+i[12],S=i[1]*v+i[5]*b+i[13],P=i[2]*v+i[6]*b+i[14],I=i[3]*v+i[7]*b+i[15],k=w+a,C=S+s,T=P+l,D=I+u,F=w+c,E=S+p,A=P+h,$=I+f,X=new el.default(k/D,C/D);X.z=T/D,y.push(X);let j=new el.default(F/$,E/$);j.z=A/$,g.push(j)}n.push(y),o.push(g)}return[n,o]}function fT(r,e,t,i){let n=[];for(let o of r){let a=[o.x,o.y,i,1];Ne.transformMat4(a,a,e),n.push(new el.default(a[0]/a[3],a[1]/a[3]))}return n}m();m();m();var mT=be([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:yy,size:tz,alignment:rz}=mT;m();var dT=be([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:gy,size:az,alignment:sz}=dT;var _y=ne(Io(),1);var yT=_y.default.VectorTileFeature.types,xy=63,gT=Math.cos(75/2*(Math.PI/180)),xT=15,bT=20,_T=15,vy=1/2,by=Math.pow(2,_T-1)/vy,Lo=class{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(t=>t.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(t=>{this.gradients[t.id]={}}),this.layoutVertexArray=new Cs,this.layoutVertexArray2=new Es,this.indexArray=new rt,this.programConfigurations=new ft(e.layers,e.zoom),this.segments=new he,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(e,t,i){this.hasPattern=Hi("line",this.layers,t);let n=this.layers[0].layout.get("line-sort-key"),o=!n.isConstant(),a=[];for(let{feature:s,id:l,index:u,sourceLayerIndex:c}of e){let p=this.layers[0]._featureFilter.needGeometry,h=dt(s,p);if(!this.layers[0]._featureFilter.filter(new de(this.zoom),h,i))continue;let f=o?n.evaluate(h,{},i):void 0,d={id:l,properties:s.properties,type:s.type,sourceLayerIndex:c,index:u,geometry:p?h.geometry:mt(s),patterns:{},sortKey:f};a.push(d)}o&&a.sort((s,l)=>s.sortKey-l.sortKey);for(let s of a){let{geometry:l,index:u,sourceLayerIndex:c}=s;if(this.hasPattern){let h=Wi("line",this.layers,s,this.zoom,t);this.patternFeatures.push(h)}else this.addFeature(s,l,u,i,{});let p=e[u].feature;t.featureIndex.insert(p,l,u,c,this.index)}}update(e,t,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,i)}addFeatures(e,t,i){for(let n of this.patternFeatures)this.addFeature(n,n.geometry,n.index,t,i)}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,gy)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,yy),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_end")){let t=+e.properties.mapbox_clip_start,i=+e.properties.mapbox_clip_end;return{start:t,end:i}}}addFeature(e,t,i,n,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 t)this.addLine(p,e,s,l,u,c);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,o,n)}addLine(e,t,i,n,o,a){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let x=0;x<e.length-1;x++)this.totalDistance+=e[x].dist(e[x+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let s=yT[t.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;i==="bevel"&&(o=1.05);let c=this.overscaling<=16?xT*8192/(512*this.overscaling):0,p=this.segments.prepareSegment(l*10,this.layoutVertexArray,this.indexArray),h,f,d,y,g;this.e1=this.e2=-1,s&&(h=e[l-2],g=e[u].sub(h)._unit()._perp());for(let x=u;x<l;x++){if(d=x===l-1?s?e[u+1]:void 0:e[x+1],d&&e[x].equals(d))continue;g&&(y=g),h&&(f=h),h=e[x],g=d?d.sub(h)._unit()._perp():y,y=y||g;let v=y.add(g);(v.x!==0||v.y!==0)&&v._unit();let b=y.x*g.x+y.y*g.y,w=v.x*g.x+v.y*g.y,S=w!==0?1/w:1/0,P=2*Math.sqrt(2-2*w),I=w<gT&&f&&d,k=y.x*g.y-y.y*g.x>0;if(I&&x>u){let D=h.dist(f);if(D>2*c){let F=h.sub(h.sub(f)._mult(c/D)._round());this.updateDistance(f,F),this.addCurrentVertex(F,y,0,0,p),f=F}}let C=f&&d,T=C?i:s?"butt":n;if(C&&T==="round"&&(S<a?T="miter":S<=2&&(T="fakeround")),T==="miter"&&S>o&&(T="bevel"),T==="bevel"&&(S>2&&(T="flipbevel"),S<o&&(T="miter")),f&&this.updateDistance(f,h),T==="miter")v._mult(S),this.addCurrentVertex(h,v,0,0,p);else if(T==="flipbevel"){if(S>100)v=g.mult(-1);else{let D=S*y.add(g).mag()/y.sub(g).mag();v._perp()._mult(D*(k?-1:1))}this.addCurrentVertex(h,v,0,0,p),this.addCurrentVertex(h,v.mult(-1),0,0,p)}else if(T==="bevel"||T==="fakeround"){let D=-Math.sqrt(S*S-1),F=k?D:0,E=k?0:D;if(f&&this.addCurrentVertex(h,y,F,E,p),T==="fakeround"){let A=Math.round(P*180/Math.PI/bT);for(let $=1;$<A;$++){let X=$/A;if(X!==.5){let fe=X-.5,Q=1.0904+b*(-3.2452+b*(3.55645-b*1.43519)),nt=.848013+b*(-1.06021+b*.215638);X=X+X*fe*(X-1)*(Q*fe*fe+nt)}let j=g.sub(y)._mult(X)._add(y)._unit()._mult(k?-1:1);this.addHalfVertex(h,j.x,j.y,!1,k,0,p)}}d&&this.addCurrentVertex(h,g,-F,-E,p)}else if(T==="butt")this.addCurrentVertex(h,v,0,0,p);else if(T==="square"){let D=f?1:-1;this.addCurrentVertex(h,v,D,D,p)}else T==="round"&&(f&&(this.addCurrentVertex(h,y,0,0,p),this.addCurrentVertex(h,y,1,1,p,!0)),d&&(this.addCurrentVertex(h,g,-1,-1,p,!0),this.addCurrentVertex(h,g,0,0,p)));if(I&&x<l-1){let D=h.dist(d);if(D>2*c){let F=h.add(d.sub(h)._mult(c/D)._round());this.updateDistance(h,F),this.addCurrentVertex(F,g,0,0,p),h=F}}}}addCurrentVertex(e,t,i,n,o,a=!1){let s=t.x+t.y*i,l=t.y-t.x*i,u=-t.x+t.y*n,c=-t.y-t.x*n;this.addHalfVertex(e,s,l,a,!1,i,o),this.addHalfVertex(e,u,c,a,!0,-n,o),this.distance>by/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,t,i,n,o,a))}addHalfVertex({x:e,y:t},i,n,o,a,s,l){let c=(this.lineClips?this.scaledDistance*(by-1):this.scaledDistance)*vy;if(this.layoutVertexArray.emplaceBack((e<<1)+(o?1:0),(t<<1)+(a?1:0),Math.round(xy*i)+128,Math.round(xy*n)+128,(s===0?0:s<0?-1:1)+1|(c&63)<<2,c>>6),this.lineClips){let h=this.scaledDistance-this.lineClips.start,f=this.lineClips.end-this.lineClips.start,d=h/f;this.layoutVertexArray2.emplaceBack(d,this.lineClipsArray.length)}let p=l.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,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,t){this.distance+=e.dist(t),this.updateScaledDistance()}};U("LineBucket",Lo,{omit:["layers","patternFeatures"]});m();var wy,vT=()=>wy=wy||new Le({"line-cap":new q(M.layout_line["line-cap"]),"line-join":new H(M.layout_line["line-join"]),"line-miter-limit":new q(M.layout_line["line-miter-limit"]),"line-round-limit":new q(M.layout_line["line-round-limit"]),"line-sort-key":new H(M.layout_line["line-sort-key"])}),Sy,wT=()=>Sy=Sy||new Le({"line-opacity":new H(M.paint_line["line-opacity"]),"line-color":new H(M.paint_line["line-color"]),"line-translate":new q(M.paint_line["line-translate"]),"line-translate-anchor":new q(M.paint_line["line-translate-anchor"]),"line-width":new H(M.paint_line["line-width"]),"line-gap-width":new H(M.paint_line["line-gap-width"]),"line-offset":new H(M.paint_line["line-offset"]),"line-blur":new H(M.paint_line["line-blur"]),"line-dasharray":new Jr(M.paint_line["line-dasharray"]),"line-pattern":new rr(M.paint_line["line-pattern"]),"line-gradient":new Yr(M.paint_line["line-gradient"])}),Dp={get paint(){return wT()},get layout(){return vT()}};var zp=class extends H{possiblyEvaluate(e,t){return t=new de(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,zoomHistory:t.zoomHistory,transition:t.transition}),super.possiblyEvaluate(e,t)}evaluate(e,t,i,n){return t=O({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(e,t,i,n)}},rl,il=class extends Ue{constructor(e){super(e,Dp),this.gradientVersion=0,rl||(rl=new zp(Dp.paint.properties["line-width"].specification),rl.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){let t=this.gradientExpression();Xr(t)?this.stepInterpolant=t._styleExpression.expression instanceof Mi:this.stepInterpolant=!1,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,t){super.recalculate(e,t),this.paint._values["line-floorwidth"]=rl.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new Lo(e)}queryRadius(e){let t=e,i=Py(ii("line-width",this,t),ii("line-gap-width",this,t)),n=ii("line-offset",this,t);return i/2+Math.abs(n)+Mr(this.paint.get("line-translate"))}queryIntersectsFeature(e,t,i,n,o,a,s){let l=Ir(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),a.angle,s),u=s/2*Py(this.paint.get("line-width").evaluate(t,i),this.paint.get("line-gap-width").evaluate(t,i)),c=this.paint.get("line-offset").evaluate(t,i);return c&&(n=td(n,c*s)),Ym(l,n,u)}isTileClipped(){return!0}};function Py(r,e){return e>0?e+2*r:r}m();m();m();var Ty=be([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Ay=be([{name:"a_projected_pos",components:3,type:"Float32"}],4),Wz=be([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),My=be([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]),Xz=be([{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"}]),Fp=be([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Iy=be([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4),Kz=be([{name:"triangle",components:3,type:"Uint16"}]),Jz=be([{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"}]),Yz=be([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),Qz=be([{type:"Float32",name:"offsetX"}]),eF=be([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),tF=be([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);var Fo=ne(ye(),1);m();function ST(r,e,t){let i=e.layout.get("text-transform").evaluate(t,{});return i==="uppercase"?r=r.toLocaleUpperCase():i==="lowercase"&&(r=r.toLocaleLowerCase()),tr.applyArabicShaping&&(r=tr.applyArabicShaping(r)),r}function Cy(r,e,t){return r.sections.forEach(i=>{i.text=ST(i.text,e,t)}),r}m();function Ey(r){let e={},t={},i=[],n=0;function o(u){i.push(r[u]),n++}function a(u,c,p){let h=t[u];return delete t[u],t[c]=h,i[h].geometry[0].pop(),i[h].geometry[0]=i[h].geometry[0].concat(p[0]),h}function s(u,c,p){let h=e[c];return delete e[c],e[u]=h,i[h].geometry[0].shift(),i[h].geometry[0]=p[0].concat(i[h].geometry[0]),h}function l(u,c,p){let h=p?c[0][c[0].length-1]:c[0][0];return`${u}:${h.x}:${h.y}`}for(let u=0;u<r.length;u++){let c=r[u],p=c.geometry,h=c.text?c.text.toString():null;if(!h){o(u);continue}let f=l(h,p),d=l(h,p,!0);if(f in t&&d in e&&t[f]!==e[d]){let y=s(f,d,p),g=a(f,d,i[y].geometry);delete e[f],delete t[d],t[l(h,i[g].geometry,!0)]=g,i[y].geometry=null}else f in t?a(f,d,p):d in e?s(f,d,p):(o(u),e[f]=n-1,t[d]=n-1)}return i.filter(u=>u.geometry)}m();m();var ky={"!":"\uFE15","#":"\uFF03",$:"\uFF04","%":"\uFF05","&":"\uFF06","(":"\uFE35",")":"\uFE36","*":"\uFF0A","+":"\uFF0B",",":"\uFE10","-":"\uFE32",".":"\u30FB","/":"\uFF0F",":":"\uFE13",";":"\uFE14","<":"\uFE3F","=":"\uFF1D",">":"\uFE40","?":"\uFE16","@":"\uFF20","[":"\uFE47","\\":"\uFF3C","]":"\uFE48","^":"\uFF3E",_:"\uFE33","`":"\uFF40","{":"\uFE37","|":"\u2015","}":"\uFE38","~":"\uFF5E","\xA2":"\uFFE0","\xA3":"\uFFE1","\xA5":"\uFFE5","\xA6":"\uFFE4","\xAC":"\uFFE2","\xAF":"\uFFE3","\u2013":"\uFE32","\u2014":"\uFE31","\u2018":"\uFE43","\u2019":"\uFE44","\u201C":"\uFE41","\u201D":"\uFE42","\u2026":"\uFE19","\u2027":"\u30FB","\u20A9":"\uFFE6","\u3001":"\uFE11","\u3002":"\uFE12","\u3008":"\uFE3F","\u3009":"\uFE40","\u300A":"\uFE3D","\u300B":"\uFE3E","\u300C":"\uFE41","\u300D":"\uFE42","\u300E":"\uFE43","\u300F":"\uFE44","\u3010":"\uFE3B","\u3011":"\uFE3C","\u3014":"\uFE39","\u3015":"\uFE3A","\u3016":"\uFE17","\u3017":"\uFE18","\uFF01":"\uFE15","\uFF08":"\uFE35","\uFF09":"\uFE36","\uFF0C":"\uFE10","\uFF0D":"\uFE32","\uFF0E":"\u30FB","\uFF1A":"\uFE13","\uFF1B":"\uFE14","\uFF1C":"\uFE3F","\uFF1E":"\uFE40","\uFF1F":"\uFE16","\uFF3B":"\uFE47","\uFF3D":"\uFE48","\uFF3F":"\uFE33","\uFF5B":"\uFE37","\uFF5C":"\u2015","\uFF5D":"\uFE38","\uFF5F":"\uFE35","\uFF60":"\uFE36","\uFF61":"\uFE12","\uFF62":"\uFE41","\uFF63":"\uFE42"};m();var Cr=24;m();var Vy=ne(Op(),1),Oy=3;function NT(r,e,t){r===1&&t.readMessage(GT,e)}function GT(r,e,t){if(r===3){let{id:i,bitmap:n,width:o,height:a,left:s,top:l,advance:u}=t.readMessage($T,{});e.push({id:i,bitmap:new ni({width:o+2*Oy,height:a+2*Oy},n),metrics:{width:o,height:a,left:s,top:l,advance:u}})}}function $T(r,e,t){r===1?e.id=t.readVarint():r===2?e.bitmap=t.readBytes():r===3?e.width=t.readVarint():r===4?e.height=t.readVarint():r===5?e.left=t.readSVarint():r===6?e.top=t.readSVarint():r===7&&(e.advance=t.readVarint())}function Uy(r){return new Vy.default(r).readFields(NT,[])}m();m();function Do(r){let e=0,t=0;for(let s of r)e+=s.w*s.h,t=Math.max(t,s.w);r.sort((s,l)=>l.h-s.h);let n=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),t),h:1/0}],o=0,a=0;for(let s of r)for(let l=n.length-1;l>=0;l--){let u=n[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=n.pop();l<n.length&&(n[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):(n.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 gt=1;var Yi=class{constructor(e,{pixelRatio:t,version:i,stretchX:n,stretchY:o,content:a}){this.paddedRect=e,this.pixelRatio=t,this.stretchX=n,this.stretchY=o,this.content=a,this.version=i}get tl(){return[this.paddedRect.x+gt,this.paddedRect.y+gt]}get br(){return[this.paddedRect.x+this.paddedRect.w-gt,this.paddedRect.y+this.paddedRect.h-gt]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-gt*2)/this.pixelRatio,(this.paddedRect.h-gt*2)/this.pixelRatio]}},Vp=class{constructor(e,t){let i={},n={};this.haveRenderCallbacks=[];let o=[];this.addImages(e,i,o),this.addImages(t,n,o);let{w:a,h:s}=Do(o),l=new we({width:a||1,height:s||1});for(let u in e){let c=e[u],p=i[u].paddedRect;we.copy(c.data,l,{x:0,y:0},{x:p.x+gt,y:p.y+gt},c.data)}for(let u in t){let c=t[u],p=n[u].paddedRect,h=p.x+gt,f=p.y+gt,d=c.data.width,y=c.data.height;we.copy(c.data,l,{x:0,y:0},{x:h,y:f},c.data),we.copy(c.data,l,{x:0,y:y-1},{x:h,y:f-1},{width:d,height:1}),we.copy(c.data,l,{x:0,y:0},{x:h,y:f+y},{width:d,height:1}),we.copy(c.data,l,{x:d-1,y:0},{x:h-1,y:f},{width:1,height:y}),we.copy(c.data,l,{x:0,y:0},{x:h+d,y:f},{width:1,height:y})}this.image=l,this.iconPositions=i,this.patternPositions=n}addImages(e,t,i){for(let n in e){let o=e[n],a={x:0,y:0,w:o.data.width+2*gt,h:o.data.height+2*gt};i.push(a),t[n]=new Yi(a,o),o.hasRenderCallback&&this.haveRenderCallbacks.push(n)}}patchUpdatedImages(e,t){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(let i in e.updatedImages)this.patchUpdatedImage(this.iconPositions[i],e.getImage(i),t),this.patchUpdatedImage(this.patternPositions[i],e.getImage(i),t)}patchUpdatedImage(e,t,i){if(!e||!t||e.version===t.version)return;e.version=t.version;let[n,o]=e.tl;i.update(t.data,void 0,{x:n,y:o})}};U("ImagePosition",Yi);U("ImageAtlas",Vp);var ai=(n=>(n[n.none=0]="none",n[n.horizontal=1]="horizontal",n[n.vertical=2]="vertical",n[n.horizontalOnly=3]="horizontalOnly",n))(ai||{});function al(r){let e=.5,t=.5;switch(r){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0;break}switch(r){case"bottom":case"bottom-right":case"bottom-left":t=1;break;case"top":case"top-right":case"top-left":t=0;break}return{horizontalAlign:e,verticalAlign:t}}var $y=ne(Io(),1);m();var Ny=255,zo=128,sl=Ny*zo;function Up(r,e){let{expression:t}=e;if(t.kind==="constant")return{kind:"constant",layoutSize:t.evaluate(new de(r+1))};if(t.kind==="source")return{kind:"source"};{let{zoomStops:i,interpolationType:n}=t,o=0;for(;o<i.length&&i[o]<=r;)o++;o=Math.max(0,o-1);let a=o;for(;a<i.length&&i[a]<r+1;)a++;a=Math.min(i.length-1,a);let s=i[o],l=i[a];if(t.kind==="composite")return{kind:"composite",minZoom:s,maxZoom:l,interpolationType:n};let u=t.evaluate(new de(s)),c=t.evaluate(new de(l));return{kind:"camera",minZoom:s,maxZoom:l,minSize:u,maxSize:c,interpolationType:n}}}function Qi(r,{uSize:e,uSizeT:t},{lowerSize:i,upperSize:n}){return r.kind==="source"?i/zo:r.kind==="composite"?Se.number(i/zo,n/zo,t):e}function si(r,e){let t=0,i=0;if(r.kind==="constant")i=r.layoutSize;else if(r.kind!=="source"){let{interpolationType:n,minZoom:o,maxZoom:a}=r,s=n?Ae(vt.interpolationFactor(n,e,o,a),0,1):0;r.kind==="camera"?i=Se.number(r.minSize,r.maxSize,s):t=s}return{uSizeT:t,uSize:i}}m();function en(r,e,t){let i="never",n=r.get(e);return n?i=n:r.get(t)&&(i="always"),i}var jT=$y.default.VectorTileFeature.types,ZT=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function ll(r,e,t,i,n,o,a,s,l,u,c,p,h){let f=s?Math.min(sl,Math.round(s[0])):0,d=s?Math.min(sl,Math.round(s[1])):0;r.emplaceBack(e,t,Math.round(i*32),Math.round(n*32),o,a,(f<<1)+(l?1:0),d,u*16,c*16,p*256,h*256)}function li(r,e,t){r.emplaceBack(e.x,e.y,t),r.emplaceBack(e.x,e.y,t),r.emplaceBack(e.x,e.y,t),r.emplaceBack(e.x,e.y,t)}function HT(r){for(let e of r.sections)if(Om(e.text))return!0;return!1}var Ro=class{constructor(e){this.layoutVertexArray=new ks,this.indexArray=new rt,this.programConfigurations=e,this.segments=new he,this.dynamicLayoutVertexArray=new Ls,this.opacityVertexArray=new Ds,this.hasVisibleVertices=!1,this.placedSymbolArray=new so}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,t,i,n){this.isEmpty()||(i&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Ty.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,t),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,Ay.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,ZT,!0),this.opacityVertexBuffer.itemSize=1),(i||n)&&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())}};U("SymbolBuffers",Ro);var Bo=class{constructor(e,t,i){this.layoutVertexArray=new e,this.layoutAttributes=t,this.indexArray=new i,this.segments=new he,this.collisionVertexArray=new Fs}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,My.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}};U("CollisionBuffers",Bo);var Bt=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=N.identity([]),this.placementViewportMatrix=N.identity([]);let i=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Up(this.zoom,i["text-size"]),this.iconSizeData=Up(this.zoom,i["icon-size"]);let n=this.layers[0].layout,o=n.get("symbol-sort-key"),a=n.get("symbol-z-order");this.canOverlap=en(n,"text-overlap","text-allow-overlap")!=="never"||en(n,"icon-overlap","icon-allow-overlap")!=="never"||n.get("text-ignore-placement")||n.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,n.get("symbol-placement")==="point"&&(this.writingModes=n.get("text-writing-mode").map(l=>ai[l])),this.stateDependentLayerIds=this.layers.filter(l=>l.isStateDependent()).map(l=>l.id),this.sourceID=e.sourceID}createArrays(){this.text=new Ro(new ft(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new Ro(new ft(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new uo,this.lineVertexArray=new co,this.symbolInstances=new lo,this.textAnchorOffsets=new po}calculateGlyphDependencies(e,t,i,n,o){for(let a=0;a<e.length;a++)if(t[e.charCodeAt(a)]=!0,(i||n)&&o){let s=ky[e.charAt(a)];s&&(t[s.charCodeAt(0)]=!0)}}populate(e,t,i){let n=this.layers[0],o=n.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 wt&&!s.value.value.isEmpty()||s.value.value.toString().length>0)&&(a.value.kind!=="constant"||a.value.value.length>0),c=l.value.kind!=="constant"||!!l.value.value||Object.keys(l.parameters).length>0,p=o.get("symbol-sort-key");if(this.features=[],!u&&!c)return;let h=t.iconDependencies,f=t.glyphDependencies,d=t.availableImages,y=new de(this.zoom);for(let{feature:g,id:x,index:v,sourceLayerIndex:b}of e){let w=n._featureFilter.needGeometry,S=dt(g,w);if(!n._featureFilter.filter(y,S,i))continue;w||(S.geometry=mt(g));let P;if(u){let T=n.getValueAndResolveTokens("text-field",S,i,d),D=wt.factory(T),F=this.hasRTLText=this.hasRTLText||HT(D);(!F||tr.getRTLTextPluginStatus()==="unavailable"||F&&tr.isParsed())&&(P=Cy(D,n,S))}let I;if(c){let T=n.getValueAndResolveTokens("icon-image",S,i,d);T instanceof ht?I=T:I=ht.fromString(T)}if(!P&&!I)continue;let k=this.sortFeaturesByKey?p.evaluate(S,{},i):void 0,C={id:x,text:P,icon:I,index:v,sourceLayerIndex:b,geometry:S.geometry,properties:g.properties,type:jT[g.type],sortKey:k};if(this.features.push(C),I&&(h[I.name]=!0),P){let T=a.evaluate(S,{},i).join(","),D=o.get("text-rotation-alignment")!=="viewport"&&o.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(2)>=0;for(let F of P.sections)if(F.image)h[F.image.name]=!0;else{let E=pp(P.toString()),A=F.fontStack||T,$=f[A]=f[A]||{};this.calculateGlyphDependencies(F.text,$,D,this.allowVerticalPlacement,E)}}}o.get("symbol-placement")==="line"&&(this.features=Ey(this.features)),this.sortFeaturesByKey&&this.features.sort((g,x)=>g.sortKey-x.sortKey)}update(e,t,i){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,t,this.layers,i),this.icon.programConfigurations.updatePaintArrays(e,t,this.layers,i))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,t){let i=this.lineVertexArray.length;if(e.segment!==void 0){let n=e.dist(t[e.segment+1]),o=e.dist(t[e.segment]),a={};for(let s=e.segment+1;s<t.length;s++)a[s]={x:t[s].x,y:t[s].y,tileUnitDistanceFromAnchor:n},s<t.length-1&&(n+=t[s+1].dist(t[s]));for(let s=e.segment||0;s>=0;s--)a[s]={x:t[s].x,y:t[s].y,tileUnitDistanceFromAnchor:o},s>0&&(o+=t[s-1].dist(t[s]));for(let s=0;s<t.length;s++){let l=a[s];this.lineVertexArray.emplaceBack(l.x,l.y,l.tileUnitDistanceFromAnchor)}}return{lineStartIndex:i,lineLength:this.lineVertexArray.length-i}}addSymbols(e,t,i,n,o,a,s,l,u,c,p,h){let f=e.indexArray,d=e.layoutVertexArray,y=e.segments.prepareSegment(4*t.length,d,f,this.canOverlap?a.sortKey:void 0),g=this.glyphOffsetArray.length,x=y.vertexLength,v=this.allowVerticalPlacement&&s===2?Math.PI/2:0,b=a.text&&a.text.sections;for(let w=0;w<t.length;w++){let{tl:S,tr:P,bl:I,br:k,tex:C,pixelOffsetTL:T,pixelOffsetBR:D,minFontScaleX:F,minFontScaleY:E,glyphOffset:A,isSDF:$,sectionIndex:X}=t[w],j=y.vertexLength,fe=A[1];ll(d,l.x,l.y,S.x,fe+S.y,C.x,C.y,i,$,T.x,T.y,F,E),ll(d,l.x,l.y,P.x,fe+P.y,C.x+C.w,C.y,i,$,D.x,T.y,F,E),ll(d,l.x,l.y,I.x,fe+I.y,C.x,C.y+C.h,i,$,T.x,D.y,F,E),ll(d,l.x,l.y,k.x,fe+k.y,C.x+C.w,C.y+C.h,i,$,D.x,D.y,F,E),li(e.dynamicLayoutVertexArray,l,v),f.emplaceBack(j,j+1,j+2),f.emplaceBack(j+1,j+2,j+3),y.vertexLength+=4,y.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(A[0]),(w===t.length-1||X!==t[w+1].sectionIndex)&&e.programConfigurations.populatePaintArrays(d.length,a,a.index,{},h,b&&b[X])}e.placedSymbolArray.emplaceBack(l.x,l.y,g,this.glyphOffsetArray.length-g,x,u,c,l.segment,i?i[0]:0,i?i[1]:0,n[0],n[1],s,0,!1,0,p)}_addCollisionDebugVertex(e,t,i,n,o,a){return t.emplaceBack(0,0),e.emplaceBack(i.x,i.y,n,o,Math.round(a.x),Math.round(a.y))}addCollisionDebugVertices(e,t,i,n,o,a,s){let l=o.segments.prepareSegment(4,o.layoutVertexArray,o.indexArray),u=l.vertexLength,c=o.layoutVertexArray,p=o.collisionVertexArray,h=s.anchorX,f=s.anchorY;this._addCollisionDebugVertex(c,p,a,h,f,new Fo.default(e,t)),this._addCollisionDebugVertex(c,p,a,h,f,new Fo.default(i,t)),this._addCollisionDebugVertex(c,p,a,h,f,new Fo.default(i,n)),this._addCollisionDebugVertex(c,p,a,h,f,new Fo.default(e,n)),l.vertexLength+=4;let d=o.indexArray;d.emplaceBack(u,u+1),d.emplaceBack(u+1,u+2),d.emplaceBack(u+2,u+3),d.emplaceBack(u+3,u),l.primitiveLength+=4}addDebugCollisionBoxes(e,t,i,n){for(let o=e;o<t;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,n?this.textCollisionBox:this.iconCollisionBox,a.anchorPoint,i)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Bo(fo,Fp.members,Pr),this.iconCollisionBox=new Bo(fo,Fp.members,Pr);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,i,n,o,a,s,l,u){let c={};for(let p=t;p<i;p++){let h=e.get(p);c.textBox={x1:h.x1,y1:h.y1,x2:h.x2,y2:h.y2,anchorPointX:h.anchorPointX,anchorPointY:h.anchorPointY},c.textFeatureIndex=h.featureIndex;break}for(let p=n;p<o;p++){let h=e.get(p);c.verticalTextBox={x1:h.x1,y1:h.y1,x2:h.x2,y2:h.y2,anchorPointX:h.anchorPointX,anchorPointY:h.anchorPointY},c.verticalTextFeatureIndex=h.featureIndex;break}for(let p=a;p<s;p++){let h=e.get(p);c.iconBox={x1:h.x1,y1:h.y1,x2:h.x2,y2:h.y2,anchorPointX:h.anchorPointX,anchorPointY:h.anchorPointY},c.iconFeatureIndex=h.featureIndex;break}for(let p=l;p<u;p++){let h=e.get(p);c.verticalIconBox={x1:h.x1,y1:h.y1,x2:h.x2,y2:h.y2,anchorPointX:h.anchorPointX,anchorPointY:h.anchorPointY},c.verticalIconFeatureIndex=h.featureIndex;break}return c}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let t=0;t<this.symbolInstances.length;t++){let i=this.symbolInstances.get(t);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,i.textBoxStartIndex,i.textBoxEndIndex,i.verticalTextBoxStartIndex,i.verticalTextBoxEndIndex,i.iconBoxStartIndex,i.iconBoxEndIndex,i.verticalIconBoxStartIndex,i.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 i=e.placedSymbolArray.get(t),n=i.vertexStartIndex+i.numGlyphs*4;for(let o=i.vertexStartIndex;o<n;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 t=Math.sin(e),i=Math.cos(e),n=[],o=[],a=[];for(let s=0;s<this.symbolInstances.length;++s){a.push(s);let l=this.symbolInstances.get(s);n.push(Math.round(t*l.anchorX+i*l.anchorY)|0),o.push(l.featureIndex)}return a.sort((s,l)=>n[s]-n[l]||o[l]-o[s]),a}addToSortKeyRanges(e,t){let i=this.sortKeyRanges[this.sortKeyRanges.length-1];i&&i.sortKey===t?i.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:t,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let t of this.symbolInstanceIndexes){let i=this.symbolInstances.get(t);this.featureSortOrder.push(i.featureIndex),[i.rightJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.leftJustifiedTextSymbolIndex].forEach((n,o,a)=>{n>=0&&a.indexOf(n)===o&&this.addIndicesForPlacedSymbol(this.text,n)}),i.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,i.verticalPlacedTextSymbolIndex),i.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,i.placedIconSymbolIndex),i.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,i.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}};U("SymbolBucket",Bt,{omit:["layers","collisionBoxArray","features","compareText"]});Bt.MAX_GLYPHS=65535;Bt.addDynamicAttributes=li;m();function qy(r,e){return e.replace(/{([^{}]+)}/g,(t,i)=>r&&i in r?String(r[i]):"")}m();var jy,WT=()=>jy=jy||new Le({"symbol-placement":new q(M.layout_symbol["symbol-placement"]),"symbol-spacing":new q(M.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new q(M.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new H(M.layout_symbol["symbol-sort-key"]),"symbol-z-order":new q(M.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new q(M.layout_symbol["icon-allow-overlap"]),"icon-overlap":new q(M.layout_symbol["icon-overlap"]),"icon-ignore-placement":new q(M.layout_symbol["icon-ignore-placement"]),"icon-optional":new q(M.layout_symbol["icon-optional"]),"icon-rotation-alignment":new q(M.layout_symbol["icon-rotation-alignment"]),"icon-size":new H(M.layout_symbol["icon-size"]),"icon-text-fit":new q(M.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new q(M.layout_symbol["icon-text-fit-padding"]),"icon-image":new H(M.layout_symbol["icon-image"]),"icon-rotate":new H(M.layout_symbol["icon-rotate"]),"icon-padding":new H(M.layout_symbol["icon-padding"]),"icon-keep-upright":new q(M.layout_symbol["icon-keep-upright"]),"icon-offset":new H(M.layout_symbol["icon-offset"]),"icon-anchor":new H(M.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new q(M.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new q(M.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new q(M.layout_symbol["text-rotation-alignment"]),"text-field":new H(M.layout_symbol["text-field"]),"text-font":new H(M.layout_symbol["text-font"]),"text-size":new H(M.layout_symbol["text-size"]),"text-max-width":new H(M.layout_symbol["text-max-width"]),"text-line-height":new q(M.layout_symbol["text-line-height"]),"text-letter-spacing":new H(M.layout_symbol["text-letter-spacing"]),"text-justify":new H(M.layout_symbol["text-justify"]),"text-radial-offset":new H(M.layout_symbol["text-radial-offset"]),"text-variable-anchor":new q(M.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new H(M.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new H(M.layout_symbol["text-anchor"]),"text-max-angle":new q(M.layout_symbol["text-max-angle"]),"text-writing-mode":new q(M.layout_symbol["text-writing-mode"]),"text-rotate":new H(M.layout_symbol["text-rotate"]),"text-padding":new q(M.layout_symbol["text-padding"]),"text-keep-upright":new q(M.layout_symbol["text-keep-upright"]),"text-transform":new H(M.layout_symbol["text-transform"]),"text-offset":new H(M.layout_symbol["text-offset"]),"text-allow-overlap":new q(M.layout_symbol["text-allow-overlap"]),"text-overlap":new q(M.layout_symbol["text-overlap"]),"text-ignore-placement":new q(M.layout_symbol["text-ignore-placement"]),"text-optional":new q(M.layout_symbol["text-optional"])}),Zy,XT=()=>Zy=Zy||new Le({"icon-opacity":new H(M.paint_symbol["icon-opacity"]),"icon-color":new H(M.paint_symbol["icon-color"]),"icon-halo-color":new H(M.paint_symbol["icon-halo-color"]),"icon-halo-width":new H(M.paint_symbol["icon-halo-width"]),"icon-halo-blur":new H(M.paint_symbol["icon-halo-blur"]),"icon-translate":new q(M.paint_symbol["icon-translate"]),"icon-translate-anchor":new q(M.paint_symbol["icon-translate-anchor"]),"text-opacity":new H(M.paint_symbol["text-opacity"]),"text-color":new H(M.paint_symbol["text-color"],{runtimeType:It,getOverride:r=>r.textColor,hasOverride:r=>!!r.textColor}),"text-halo-color":new H(M.paint_symbol["text-halo-color"]),"text-halo-width":new H(M.paint_symbol["text-halo-width"]),"text-halo-blur":new H(M.paint_symbol["text-halo-blur"]),"text-translate":new q(M.paint_symbol["text-translate"]),"text-translate-anchor":new q(M.paint_symbol["text-translate-anchor"])}),ul={get paint(){return XT()},get layout(){return WT()}};m();var Oo=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:Ci,this.defaultValue=e}evaluate(e){if(e.formattedSection){let t=this.defaultValue.property.overrides;if(t&&t.hasOverride(e.formattedSection))return t.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){if(!this.defaultValue.isConstant()){let t=this.defaultValue.value;e(t._styleExpression.expression)}}outputDefined(){return!1}serialize(){return null}};U("FormatSectionOverride",Oo,{omit:["defaultValue"]});var cl=class r extends Ue{constructor(e){super(e,ul)}recalculate(e,t){if(super.recalculate(e,t),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout.get("symbol-placement")!=="point"?this.layout._values["icon-rotation-alignment"]="map":this.layout._values["icon-rotation-alignment"]="viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout.get("symbol-placement")!=="point"?this.layout._values["text-rotation-alignment"]="map":this.layout._values["text-rotation-alignment"]="viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){let i=this.layout.get("text-writing-mode");if(i){let n=[];for(let o of i)n.indexOf(o)<0&&n.push(o);this.layout._values["text-writing-mode"]=n}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,t,i,n){let o=this.layout.get(e).evaluate(t,{},i,n),a=this._unevaluatedLayout._values[e];return!a.isDataDriven()&&!Xr(a.value)&&o?qy(t.properties,o):o}createBucket(e){return new Bt(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let e of ul.paint.overridableProperties){if(!r.hasPaintOverride(this.layout,e))continue;let t=this.paint.get(e),i=new Oo(t),n=new jr(i,t.property.specification),o=null;t.value.kind==="constant"||t.value.kind==="source"?o=new gr("source",n):o=new xr("composite",n,t.value.zoomStops),this.paint._values[e]=new ot(t.property,o,t.parameters)}}_handleOverridablePaintPropertyUpdate(e,t,i){return!this.layout||t.isDataDriven()||i.isDataDriven()?!1:r.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,t){let i=e.get("text-field"),n=ul.paint.properties[t],o=!1,a=s=>{for(let l of s)if(n.overrides&&n.overrides.hasOverride(l)){o=!0;return}};if(i.value.kind==="constant"&&i.value.value instanceof wt)a(i.value.value.sections);else if(i.value.kind==="source"){let s=u=>{if(!o)if(u instanceof dr&&qe(u.value)===Ei){let c=u.value;a(c.sections)}else u instanceof En?a(u.sections):u.eachChild(s)},l=i.value;l._styleExpression&&s(l._styleExpression.expression)}return o}};m();m();var Hy,KT=()=>Hy=Hy||new Le({"background-color":new q(M.paint_background["background-color"]),"background-pattern":new Jr(M.paint_background["background-pattern"]),"background-opacity":new q(M.paint_background["background-opacity"])}),Wy={get paint(){return KT()}};var pl=class extends Ue{constructor(e){super(e,Wy)}};m();m();var Xy,JT=()=>Xy=Xy||new Le({"raster-opacity":new q(M.paint_raster["raster-opacity"]),"raster-hue-rotate":new q(M.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new q(M.paint_raster["raster-brightness-min"]),"raster-brightness-max":new q(M.paint_raster["raster-brightness-max"]),"raster-saturation":new q(M.paint_raster["raster-saturation"]),"raster-contrast":new q(M.paint_raster["raster-contrast"]),"raster-resampling":new q(M.paint_raster["raster-resampling"]),"raster-fade-duration":new q(M.paint_raster["raster-fade-duration"])}),Ky={get paint(){return JT()}};var hl=class extends Ue{constructor(e){super(e,Ky)}};m();function Jy(r){let e=[],t=r.id;return t===void 0&&e.push({message:`layers.${t}: missing required property "id"`}),r.render===void 0&&e.push({message:`layers.${t}: missing required method "render"`}),r.renderingMode&&r.renderingMode!=="2d"&&r.renderingMode!=="3d"&&e.push({message:`layers.${t}: property "renderingMode" must be either "2d" or "3d"`}),e}var fl=class extends Ue{constructor(t){super(t,{});this.onAdd=t=>{this.implementation.onAdd&&this.implementation.onAdd(t,t.painter.context.gl)};this.onRemove=t=>{this.implementation.onRemove&&this.implementation.onRemove(t,t.painter.context.gl)};this.implementation=t}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}};function ml(r){if(r.type==="custom")return new fl(r);switch(r.type){case"background":return new pl(r);case"circle":return new qs(r);case"fill":return new Ys(r);case"fill-extrusion":return new tl(r);case"heatmap":return new Zs(r);case"hillshade":return new Hs(r);case"line":return new il(r);case"raster":return new hl(r);case"symbol":return new cl(r)}}m();m();function tn(r){let e=[];if(typeof r=="string")e.push({id:"default",url:r});else if(r&&r.length>0){let t=[];for(let{id:i,url:n}of r){let o=`${i}${n}`;t.indexOf(o)===-1&&(t.push(o),e.push({id:i,url:n}))}}return e}async function Yy(r,e,t,i){let n=tn(r),o=t>1?"@2x":"",a={},s={};for(let{id:l,url:u}of n){let c=e.transformRequest(e.normalizeSpriteURL(u,o,".json"),"SpriteJSON");a[l]=fr(c,i);let p=e.transformRequest(e.normalizeSpriteURL(u,o,".png"),"SpriteImage");s[l]=st.getImage(p,i)}return await Promise.all([...Object.values(a),...Object.values(s)]),YT(a,s)}async function YT(r,e){let t={};for(let i in r){t[i]={};let n=K.getImageCanvasContext((await e[i]).data),o=(await r[i]).data;for(let a in o){let{width:s,height:l,x:u,y:c,sdf:p,pixelRatio:h,stretchX:f,stretchY:d,content:y}=o[a],g={width:s,height:l,x:u,y:c,context:n};t[i][a]={data:null,pixelRatio:h,sdf:p,stretchX:f,stretchY:d,content:y,spriteData:g}}}return t}m();m();var _e=class{constructor(e,t,i,n){this.context=e,this.format=i,this.texture=e.gl.createTexture(),this.update(t,n)}update(e,t,i){let{width:n,height:o}=e,a=(!this.size||this.size[0]!==n||this.size[1]!==o)&&!i,{context:s}=this,{gl:l}=s;if(this.useMipmap=!!(t&&t.useMipmap),l.bindTexture(l.TEXTURE_2D,this.texture),s.pixelStoreUnpackFlipY.set(!1),s.pixelStoreUnpack.set(1),s.pixelStoreUnpackPremultiplyAlpha.set(this.format===l.RGBA&&(!t||t.premultiply!==!1)),a)this.size=[n,o],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||pt(e)?l.texImage2D(l.TEXTURE_2D,0,this.format,this.format,l.UNSIGNED_BYTE,e):l.texImage2D(l.TEXTURE_2D,0,this.format,n,o,0,this.format,l.UNSIGNED_BYTE,e.data);else{let{x:u,y:c}=i||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||pt(e)?l.texSubImage2D(l.TEXTURE_2D,0,u,c,l.RGBA,l.UNSIGNED_BYTE,e):l.texSubImage2D(l.TEXTURE_2D,0,u,c,n,o,l.RGBA,l.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&l.generateMipmap(l.TEXTURE_2D)}bind(e,t,i){let{context:n}=this,{gl:o}=n;o.bindTexture(o.TEXTURE_2D,this.texture),i===o.LINEAR_MIPMAP_NEAREST&&!this.isSizePowerOfTwo()&&(i=o.LINEAR),e!==this.filter&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,e),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,i||e),this.filter=e),t!==this.wrap&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,t),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,t),this.wrap=t)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1===0}destroy(){let{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}};m();function Qy(r){let{userImage:e}=r;return e&&e.render&&e.render()?(r.data.replace(new Uint8Array(e.data.buffer)),!0):!1}var dl=1,yl=class extends me{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new we({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(let{ids:t,promiseResolve:i}of this.requestors)i(this._getImagesForIds(t));this.requestors=[]}}getImage(e){let t=this.images[e];if(t&&!t.data&&t.spriteData){let i=t.spriteData;t.data=new we({width:i.width,height:i.height},i.context.getImageData(i.x,i.y,i.width,i.height).data),t.spriteData=null}return t}addImage(e,t){if(this.images[e])throw new Error(`Image id ${e} already exist, use updateImage instead`);this._validate(e,t)&&(this.images[e]=t)}_validate(e,t){let i=!0,n=t.data||t.spriteData;return this._validateStretch(t.stretchX,n&&n.width)||(this.fire(new Z(new Error(`Image "${e}" has invalid "stretchX" value`))),i=!1),this._validateStretch(t.stretchY,n&&n.height)||(this.fire(new Z(new Error(`Image "${e}" has invalid "stretchY" value`))),i=!1),this._validateContent(t.content,t)||(this.fire(new Z(new Error(`Image "${e}" has invalid "content" value`))),i=!1),i}_validateStretch(e,t){if(!e)return!0;let i=0;for(let n of e){if(n[0]<i||n[1]<n[0]||t<n[1])return!1;i=n[1]}return!0}_validateContent(e,t){if(!e)return!0;if(e.length!==4)return!1;let i=t.spriteData,n=i&&i.width||t.data.width,o=i&&i.height||t.data.height;return!(e[0]<0||n<e[0]||e[1]<0||o<e[1]||e[2]<0||n<e[2]||e[3]<0||o<e[3]||e[2]<e[0]||e[3]<e[1])}updateImage(e,t,i=!0){let n=this.getImage(e);if(i&&(n.data.width!==t.data.width||n.data.height!==t.data.height))throw new Error(`size mismatch between old image (${n.data.width}x${n.data.height}) and new image (${t.data.width}x${t.data.height}).`);t.version=n.version+1,this.images[e]=t,this.updatedImages[e]=!0}removeImage(e){let t=this.images[e];delete this.images[e],delete this.patterns[e],t.userImage&&t.userImage.onRemove&&t.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(e){return new Promise((t,i)=>{let n=!0;if(!this.isLoaded())for(let o of e)this.images[o]||(n=!1);this.isLoaded()||n?t(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:t})})}_getImagesForIds(e){let t={};for(let i of e){let n=this.getImage(i);n||(this.fire(new z("styleimagemissing",{id:i})),n=this.getImage(i)),n?t[i]={data:n.data.clone(),pixelRatio:n.pixelRatio,sdf:n.sdf,version:n.version,stretchX:n.stretchX,stretchY:n.stretchY,content:n.content,hasRenderCallback:!!(n.userImage&&n.userImage.render)}:ke(`Image "${i}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return t}getPixelSize(){let{width:e,height:t}=this.atlasImage;return{width:e,height:t}}getPattern(e){let t=this.patterns[e],i=this.getImage(e);if(!i)return null;if(t&&t.position.version===i.version)return t.position;if(t)t.position.version=i.version;else{let n=i.data.width+dl*2,o=i.data.height+dl*2,a={w:n,h:o,x:0,y:0},s=new Yi(a,i);this.patterns[e]={bin:a,position:s}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){let t=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new _e(e,this.atlasImage,t.RGBA),this.atlasTexture.bind(t.LINEAR,t.CLAMP_TO_EDGE)}_updatePatternAtlas(){let e=[];for(let o in this.patterns)e.push(this.patterns[o].bin);let{w:t,h:i}=Do(e),n=this.atlasImage;n.resize({width:t||1,height:i||1});for(let o in this.patterns){let{bin:a}=this.patterns[o],s=a.x+dl,l=a.y+dl,u=this.getImage(o).data,c=u.width,p=u.height;we.copy(u,n,{x:0,y:0},{x:s,y:l},{width:c,height:p}),we.copy(u,n,{x:0,y:p-1},{x:s,y:l-1},{width:c,height:1}),we.copy(u,n,{x:0,y:0},{x:s,y:l+p},{width:c,height:1}),we.copy(u,n,{x:c-1,y:0},{x:s-1,y:l},{width:1,height:p}),we.copy(u,n,{x:0,y:0},{x:s+c,y:l},{width:1,height:p})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(let t of e){if(this.callbackDispatchedThisFrame[t])continue;this.callbackDispatchedThisFrame[t]=!0;let i=this.getImage(t);i||ke(`Image with ID: "${t}" was not found`),Qy(i)&&this.updateImage(t,i)}}};m();m();async function eg(r,e,t,i){let n=e*256,o=n+255,a=i.transformRequest(t.replace("{fontstack}",r).replace("{range}",`${n}-${o}`),"Glyphs"),s=await bf(a,new AbortController);if(!s||!s.data)throw new Error(`Could not load glyph range. range: ${e}, ${n}-${o}`);let l={};for(let u of Uy(s.data))l[u.id]=u;return l}m();var Vo=class{constructor({fontSize:e=24,buffer:t=3,radius:i=8,cutoff:n=.25,fontFamily:o="sans-serif",fontWeight:a="normal",fontStyle:s="normal"}={}){this.buffer=t,this.cutoff=n,this.radius=i;let l=this.size=e+t*4,u=this._createCanvas(l),c=this.ctx=u.getContext("2d",{willReadFrequently:!0});c.font=`${s} ${a} ${e}px ${o}`,c.textBaseline="alphabetic",c.textAlign="left",c.fillStyle="black",this.gridOuter=new Float64Array(l*l),this.gridInner=new Float64Array(l*l),this.f=new Float64Array(l),this.z=new Float64Array(l+1),this.v=new Uint16Array(l)}_createCanvas(e){let t=document.createElement("canvas");return t.width=t.height=e,t}draw(e){let{width:t,actualBoundingBoxAscent:i,actualBoundingBoxDescent:n,actualBoundingBoxLeft:o,actualBoundingBoxRight:a}=this.ctx.measureText(e),s=Math.ceil(i),l=0,u=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(a-o))),c=Math.min(this.size-this.buffer,s+Math.ceil(n)),p=u+2*this.buffer,h=c+2*this.buffer,f=Math.max(p*h,0),d=new Uint8ClampedArray(f),y={data:d,width:p,height:h,glyphWidth:u,glyphHeight:c,glyphTop:s,glyphLeft:l,glyphAdvance:t};if(u===0||c===0)return y;let{ctx:g,buffer:x,gridInner:v,gridOuter:b}=this;g.clearRect(x,x,u,c),g.fillText(e,x,x+s);let w=g.getImageData(x,x,u,c);b.fill(1e20,0,f),v.fill(0,0,f);for(let S=0;S<c;S++)for(let P=0;P<u;P++){let I=w.data[4*(S*u+P)+3]/255;if(I===0)continue;let k=(S+x)*p+P+x;if(I===1)b[k]=0,v[k]=1e20;else{let C=.5-I;b[k]=C>0?C*C:0,v[k]=C<0?C*C:0}}tg(b,0,0,p,h,p,this.f,this.v,this.z),tg(v,x,x,u,c,p,this.f,this.v,this.z);for(let S=0;S<f;S++){let P=Math.sqrt(b[S])-Math.sqrt(v[S]);d[S]=Math.round(255-255*(P/this.radius+this.cutoff))}return y}};function tg(r,e,t,i,n,o,a,s,l){for(let u=e;u<e+i;u++)rg(r,t*o+u,o,n,a,s,l);for(let u=t;u<t+n;u++)rg(r,u*o+e,1,i,a,s,l)}function rg(r,e,t,i,n,o,a){o[0]=0,a[0]=-1e20,a[1]=1e20,n[0]=r[e];for(let s=1,l=0,u=0;s<i;s++){n[s]=r[e+s*t];let c=s*s;do{let p=o[l];u=(n[s]-n[p]+c-p*p)/(s-p)/2}while(u<=a[l]&&--l>-1);l++,o[l]=s,a[l]=u,a[l+1]=1e20}for(let s=0,l=0;s<i;s++){for(;a[l+1]<s;)l++;let u=o[l],c=s-u;r[e+s*t]=n[u]+c*c}}var rn=class rn{constructor(e,t){this.requestManager=e,this.localIdeographFontFamily=t,this.entries={}}setURL(e){this.url=e}async getGlyphs(e){let t=[];for(let o in e)for(let a of e[o])t.push(this._getAndCacheGlyphsPromise(o,a));let i=await Promise.all(t),n={};for(let{stack:o,id:a,glyph:s}of i)n[o]||(n[o]={}),n[o][a]=s&&{id:s.id,bitmap:s.bitmap.clone(),metrics:s.metrics};return n}async _getAndCacheGlyphsPromise(e,t){let i=this.entries[e];i||(i=this.entries[e]={glyphs:{},requests:{},ranges:{}});let n=i.glyphs[t];if(n!==void 0)return{stack:e,id:t,glyph:n};if(n=this._tinySDF(i,e,t),n)return i.glyphs[t]=n,{stack:e,id:t,glyph:n};let o=Math.floor(t/256);if(o*256>65535)throw new Error("glyphs > 65535 not supported");if(i.ranges[o])return{stack:e,id:t,glyph:n};if(!this.url)throw new Error("glyphsUrl is not set");if(!i.requests[o]){let s=rn.loadGlyphRange(e,o,this.url,this.requestManager);i.requests[o]=s}let a=await i.requests[o];for(let s in a)this._doesCharSupportLocalGlyph(+s)||(i.glyphs[+s]=a[+s]);return i.ranges[o]=!0,{stack:e,id:t,glyph:a[t]||null}}_doesCharSupportLocalGlyph(e){return!!this.localIdeographFontFamily&&(ce["CJK Unified Ideographs"](e)||ce["Hangul Syllables"](e)||ce.Hiragana(e)||ce.Katakana(e))}_tinySDF(e,t,i){let n=this.localIdeographFontFamily;if(!n||!this._doesCharSupportLocalGlyph(i))return;let o=2,a=e.tinySDF;if(!a){let c="400";/bold/i.test(t)?c="900":/medium/i.test(t)?c="500":/light/i.test(t)&&(c="200"),a=e.tinySDF=new rn.TinySDF({fontSize:24*o,buffer:3*o,radius:8*o,cutoff:.25,fontFamily:n,fontWeight:c})}let s=a.draw(String.fromCharCode(i));return{id:i,bitmap:new ni({width:s.width||30*o,height:s.height||30*o},s.data),metrics:{width:s.glyphWidth/o||24,height:s.glyphHeight/o||24,left:s.glyphLeft/o+.5||0,top:s.glyphTop/o-27.5||-8,advance:s.glyphAdvance/o||24,isDoubleResolution:!0}}}};rn.loadGlyphRange=eg,rn.TinySDF=Vo;var gl=rn;m();var Gp=class{constructor(){this.specification=M.light.position}possiblyEvaluate(e,t){return pf(e.expression.evaluate(t))}interpolate(e,t,i){return{x:Se.number(e.x,t.x,i),y:Se.number(e.y,t.y,i),z:Se.number(e.z,t.z,i)}}},ig="-transition",Np,xl=class extends me{constructor(e){super(),Np=Np||new Le({anchor:new q(M.light.anchor),position:new Gp,color:new q(M.light.color),intensity:new q(M.light.intensity)}),this._transitionable=new Oi(Np),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,t={}){if(!this._validate(Lm,e,t))for(let i in e){let n=e[i];i.endsWith(ig)?this._transitionable.setTransition(i.slice(0,-ig.length),n):this._transitionable.setValue(i,n)}}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,i){return i&&i.validate===!1?!1:Di(this,e.call(Ve,{value:t,style:{glyphs:!0,sprite:!0},styleSpec:M}))}};m();var bl=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 i=e.join(",")+String(t);return this.dashEntry[i]||(this.dashEntry[i]=this.addDash(e,t)),this.dashEntry[i]}getDashRanges(e,t,i){let n=e.length%2===1,o=[],a=n?-e[e.length-1]*i:0,s=e[0]*i,l=!0;o.push({left:a,right:s,isDash:l,zeroLength:e[0]===0});let u=e[0];for(let c=1;c<e.length;c++){l=!l;let p=e[c];a=u*i,u+=p,s=u*i,o.push({left:a,right:s,isDash:l,zeroLength:p===0})}return o}addRoundDash(e,t,i){let n=t/2;for(let o=-i;o<=i;o++){let a=this.nextRow+i+o,s=this.width*a,l=0,u=e[l];for(let c=0;c<this.width;c++){c/u.right>1&&(u=e[++l]);let p=Math.abs(c-u.left),h=Math.abs(c-u.right),f=Math.min(p,h),d,y=o/i*(n+1);if(u.isDash){let g=n-Math.abs(y);d=Math.sqrt(f*f+g*g)}else d=n-Math.sqrt(f*f+y*y);this.data[s+c]=Math.max(0,Math.min(255,d+128))}}}addRegularDash(e){for(let s=e.length-1;s>=0;--s){let l=e[s],u=e[s+1];l.zeroLength?e.splice(s,1):u&&u.isDash===l.isDash&&(u.left=l.left,e.splice(s,1))}let t=e[0],i=e[e.length-1];t.isDash===i.isDash&&(t.left=i.left-this.width,i.right=t.right+this.width);let n=this.width*this.nextRow,o=0,a=e[o];for(let s=0;s<this.width;s++){s/a.right>1&&(a=e[++o]);let l=Math.abs(s-a.left),u=Math.abs(s-a.right),c=Math.min(l,u),p=a.isDash?c:-c;this.data[n+s]=Math.max(0,Math.min(255,p+128))}}addDash(e,t){let i=t?7:0,n=2*i+1;if(this.nextRow+n>this.height)return ke("LineAtlas out of space"),null;let o=0;for(let s=0;s<e.length;s++)o+=e[s];if(o!==0){let s=this.width/o,l=this.getDashRanges(e,this.width,s);t?this.addRoundDash(l,s,i):this.addRegularDash(l)}let a={y:(this.nextRow+i+.5)/this.height,height:2*i/this.height,width:o};return this.nextRow+=n,this.dirty=!0,a}bind(e){let t=e.gl;this.texture?(t.bindTexture(t.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,t.texSubImage2D(t.TEXTURE_2D,0,0,0,this.width,this.height,t.ALPHA,t.UNSIGNED_BYTE,this.data))):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.ALPHA,this.width,this.height,0,t.ALPHA,t.UNSIGNED_BYTE,this.data))}};m();m();m();var _l=class{constructor(e){this._methodToThrottle=e,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}};var vl=class{constructor(e,t){this.target=e,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new _l(()=>this.process()),this.subscription=gf(this.target,"message",i=>this.receive(i),!1),this.globalScope=Yt(self)?e:window}registerMessageHandler(e,t){this.messageHandlers[e]=t}sendAsync(e,t){return new Promise((i,n)=>{let o=Math.round(Math.random()*1e18).toString(36).substring(0,10);this.resolveRejects[o]={resolve:i,reject:n},t&&t.signal.addEventListener("abort",()=>{delete this.resolveRejects[o];let l={id:o,type:"<cancel>",origin:location.origin,targetMapId:e.targetMapId,sourceMapId:this.mapId};this.target.postMessage(l)},{once:!0});let a=[],s={...e,id:o,sourceMapId:this.mapId,origin:location.origin,data:zi(e.data,a)};this.target.postMessage(s,{transfer:a})})}receive(e){let t=e.data,i=t.id;if(!(t.origin!=="file://"&&location.origin!=="file://"&&t.origin!==location.origin)&&!(t.targetMapId&&this.mapId!==t.targetMapId)){if(t.type==="<cancel>"){delete this.tasks[i];let n=this.abortControllers[i];delete this.abortControllers[i],n&&n.abort();return}if(Yt(self)||t.mustQueue){this.tasks[i]=t,this.taskQueue.push(i),this.invoker.trigger();return}this.processTask(i,t)}}process(){if(this.taskQueue.length===0)return;let e=this.taskQueue.shift(),t=this.tasks[e];delete this.tasks[e],this.taskQueue.length>0&&this.invoker.trigger(),t&&this.processTask(e,t)}async processTask(e,t){if(t.type==="<response>"){let o=this.resolveRejects[e];if(delete this.resolveRejects[e],!o)return;t.error?o.reject(Fi(t.error)):o.resolve(Fi(t.data));return}if(!this.messageHandlers[t.type]){this.completeTask(e,new Error(`Could not find a registered handler for ${t.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));return}let i=Fi(t.data),n=new AbortController;this.abortControllers[e]=n;try{let o=await this.messageHandlers[t.type](t.sourceMapId,i,n);this.completeTask(e,null,o)}catch(o){this.completeTask(e,o)}}completeTask(e,t,i){let n=[];delete this.abortControllers[e];let o={id:e,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:t?zi(t):null,data:zi(i,n)};this.target.postMessage(o,{transfer:n})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}};m();m();m();m();var ng='(()=>{var vy=Object.create;var Ba=Object.defineProperty;var Py=Object.getOwnPropertyDescriptor;var Sy=Object.getOwnPropertyNames;var wy=Object.getPrototypeOf,Ay=Object.prototype.hasOwnProperty;var Ae=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Dl=(t,e)=>{for(var r in e)Ba(t,r,{get:e[r],enumerable:!0})},_y=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Sy(e))!Ay.call(t,i)&&i!==r&&Ba(t,i,{get:()=>e[i],enumerable:!(n=Py(e,i))||n.enumerable});return t};var Z=(t,e,r)=>(r=t!=null?vy(wy(t)):{},_y(e||!t||!t.__esModule?Ba(r,"default",{value:t,enumerable:!0}):r,t));var he=Ae((u0,Vl)=>{"use strict";Vl.exports=ar;function ar(t,e){this.x=t,this.y=e}ar.prototype={clone:function(){return new ar(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}};ar.convert=function(t){return t instanceof ar?t:Array.isArray(t)?new ar(t[0],t[1]):t}});var Rl=Ae((c0,zl)=>{"use strict";zl.exports=Bl;function Bl(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}Bl.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 _c=Ae((Gv,_s)=>{function ld(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 _s<"u"&&(_s.exports=ld)});var Ic=Ae((qv,Is)=>{function ud(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 Is!==void 0&&(Is.exports=ud)});var Ts=Ae((jv,Mo)=>{var Tc=_c(),cd=Ic();Mo.exports=Tc;Mo.exports.murmur3=Tc;Mo.exports.murmur2=cd});var Ns=Ae((zP,Os)=>{"use strict";Os.exports=Go;Os.exports.default=Go;function Go(t,e,r){r=r||2;var n=e&&e.length,i=n?e[0]*r:t.length,o=yp(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=Xg(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 Zn(o,a,r,s,l,y,0),a}function yp(t,e,r,n,i){var o,a;if(i===Rs(t,e,r,n)>0)for(o=e;o<r;o+=n)a=fp(o,t[o],t[o+1],a);else for(o=r-n;o>=e;o-=n)a=fp(o,t[o],t[o+1],a);return a&&qo(a,a.next)&&(Hn(a),a=a.next),a}function er(t,e){if(!t)return t;e||(e=t);var r=t,n;do if(n=!1,!r.steiner&&(qo(r,r.next)||oe(r.prev,r,r.next)===0)){if(Hn(r),r=e=r.prev,r===r.next)break;n=!0}else r=r.next;while(n||r!==e);return e}function Zn(t,e,r,n,i,o,a){if(t){!a&&o&&tx(t,n,i,o);for(var s=t,l,u;t.prev!==t.next;){if(l=t.prev,u=t.next,o?Zg(t,n,i,o):Jg(t)){e.push(l.i/r|0),e.push(t.i/r|0),e.push(u.i/r|0),Hn(t),t=u.next,s=u.next;continue}if(t=u,t===s){a?a===1?(t=Wg(er(t),e,r),Zn(t,e,r,n,i,o,2)):a===2&&Hg(t,e,r,n,i,o):Zn(er(t),e,r,n,i,o,1);break}}}}function Jg(t){var e=t.prev,r=t,n=t.next;if(oe(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&&_r(i,s,o,l,a,u,m.x,m.y)&&oe(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function Zg(t,e,r,n){var i=t.prev,o=t,a=t.next;if(oe(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,h=s>l?s>u?s:u:l>u?l:u,d=c>p?c>f?c:f:p>f?p:f,g=Bs(y,m,e,r,n),b=Bs(h,d,e,r,n),x=t.prevZ,v=t.nextZ;x&&x.z>=g&&v&&v.z<=b;){if(x.x>=y&&x.x<=h&&x.y>=m&&x.y<=d&&x!==i&&x!==a&&_r(s,c,l,p,u,f,x.x,x.y)&&oe(x.prev,x,x.next)>=0||(x=x.prevZ,v.x>=y&&v.x<=h&&v.y>=m&&v.y<=d&&v!==i&&v!==a&&_r(s,c,l,p,u,f,v.x,v.y)&&oe(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;x&&x.z>=g;){if(x.x>=y&&x.x<=h&&x.y>=m&&x.y<=d&&x!==i&&x!==a&&_r(s,c,l,p,u,f,x.x,x.y)&&oe(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;v&&v.z<=b;){if(v.x>=y&&v.x<=h&&v.y>=m&&v.y<=d&&v!==i&&v!==a&&_r(s,c,l,p,u,f,v.x,v.y)&&oe(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function Wg(t,e,r){var n=t;do{var i=n.prev,o=n.next.next;!qo(i,o)&&mp(i,n,n.next,o)&&Wn(i,o)&&Wn(o,i)&&(e.push(i.i/r|0),e.push(n.i/r|0),e.push(o.i/r|0),Hn(n),Hn(n.next),n=t=o),n=n.next}while(n!==t);return er(n)}function Hg(t,e,r,n,i,o){var a=t;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&ix(a,s)){var l=hp(a,s);a=er(a,a.next),l=er(l,l.next),Zn(a,e,r,n,i,o,0),Zn(l,e,r,n,i,o,0);return}s=s.next}a=a.next}while(a!==t)}function Xg(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=yp(t,s,l,n,!1),u===u.next&&(u.steiner=!0),i.push(nx(u));for(i.sort(Kg),o=0;o<i.length;o++)r=Yg(i[o],r);return r}function Kg(t,e){return t.x-e.x}function Yg(t,e){var r=Qg(t,e);if(!r)return e;var n=hp(r,t);return er(n,n.next),er(r,r.next)}function Qg(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&&_r(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),Wn(r,t)&&(f<p||f===p&&(r.x>a.x||r.x===a.x&&ex(a,r)))&&(a=r,p=f)),r=r.next;while(r!==l);return a}function ex(t,e){return oe(t.prev,t,e.prev)<0&&oe(e.next,t,t.next)<0}function tx(t,e,r,n){var i=t;do i.z===0&&(i.z=Bs(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,rx(i)}function rx(t){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 Bs(t,e,r,n,i){return t=(t-r)*i|0,e=(e-n)*i|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1}function nx(t){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 _r(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 ix(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!ox(t,e)&&(Wn(t,e)&&Wn(e,t)&&ax(t,e)&&(oe(t.prev,t,e.prev)||oe(t,e.prev,e))||qo(t,e)&&oe(t.prev,t,t.next)>0&&oe(e.prev,e,e.next)>0)}function oe(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function qo(t,e){return t.x===e.x&&t.y===e.y}function mp(t,e,r,n){var i=$o(oe(t,e,r)),o=$o(oe(t,e,n)),a=$o(oe(r,n,t)),s=$o(oe(r,n,e));return!!(i!==o&&a!==s||i===0&&Uo(t,r,e)||o===0&&Uo(t,n,e)||a===0&&Uo(r,t,n)||s===0&&Uo(r,e,n))}function Uo(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 ox(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&&mp(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}function Wn(t,e){return oe(t.prev,t,t.next)<0?oe(t,e,t.next)>=0&&oe(t,t.prev,e)>=0:oe(t,e,t.prev)<0||oe(t,t.next,e)<0}function ax(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 hp(t,e){var r=new zs(t.i,t.x,t.y),n=new zs(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 fp(t,e,r,n){var i=new zs(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 Hn(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 zs(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}Go.deviation=function(t,e,r,n){var i=e&&e.length,o=i?e[0]*r:t.length,a=Math.abs(Rs(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(Rs(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 Rs(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}Go.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 $s=Ae((vS,wp)=>{"use strict";var yx=he();wp.exports=kr;function kr(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(mx,this,e)}function mx(t,e,r){t==1?e.id=r.readVarint():t==2?hx(r,e):t==3?e.type=r.readVarint():t==4&&(e._geometry=r.pos)}function hx(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}}kr.types=["Unknown","Point","LineString","Polygon"];kr.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 yx(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};kr.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]};kr.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=kr.types[this.type],l,u;function c(y){for(var m=0;m<y.length;m++){var h=y[m],d=180-(h.y+o)*360/n;y[m]=[(h.x+i)*360/n-180,360/Math.PI*Math.atan(Math.exp(d*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=dx(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 dx(t){var e=t.length;if(e<=1)return[t];for(var r=[],n,i,o=0;o<e;o++){var a=gx(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 gx(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 Gs=Ae((PS,_p)=>{"use strict";var xx=$s();_p.exports=Ap;function Ap(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(bx,this,e),this.length=this._features.length}function bx(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(vx(r))}function vx(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}Ap.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 xx(this._pbf,e,this.extent,this._keys,this._values)}});var Tp=Ae((SS,Ip)=>{"use strict";var Px=Gs();Ip.exports=Sx;function Sx(t,e){this.layers=t.readFields(wx,{},e)}function wx(t,e,r){if(t===3){var n=new Px(r,r.readVarint()+r.pos);n.length&&(e[n.name]=n)}}});var Tt=Ae((wS,Jo)=>{Jo.exports.VectorTile=Tp();Jo.exports.VectorTileFeature=$s();Jo.exports.VectorTileLayer=Gs()});var Wp=Ae(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,h=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),a+p>=1?e+=f/l:e+=f*Math.pow(2,1-p),e*l>=2&&(a++,l/=2),a+p>=c?(s=0,a=c):a+p>=1?(s=(e*l-1)*Math.pow(2,i),a=a+p):(s=e*Math.pow(2,p-1)*Math.pow(2,i),a=0));i>=8;t[r+y]=s&255,y+=m,s/=256,i-=8);for(a=a<<i|s,u+=i;u>0;t[r+y]=a&255,y+=m,a/=256,u-=8);t[r+y-m]|=h*128}});var Qn=Ae((o2,Qp)=>{"use strict";Qp.exports=J;var Ko=Wp();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 Hs=65536*65536,Hp=1/Hs,$x=12,Yp=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");J.prototype={destroy:function(){this.buf=null},readFields:function(t,e,r){for(r=r||this.length;this.pos<r;){var n=this.readVarint(),i=n>>3,o=this.pos;this.type=n&7,t(i,e,this),this.pos===o&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=Yo(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=Kp(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=Yo(this.buf,this.pos)+Yo(this.buf,this.pos+4)*Hs;return this.pos+=8,t},readSFixed64:function(){var t=Yo(this.buf,this.pos)+Kp(this.buf,this.pos+4)*Hs;return this.pos+=8,t},readFloat:function(){var t=Ko.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=Ko.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,Gx(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>=$x&&Yp?nb(this.buf,e,t):rb(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=ct(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=ct(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=ct(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=ct(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=ct(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=ct(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=ct(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=ct(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=ct(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),Fr(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),Fr(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),Fr(this.buf,t&-1,this.pos),Fr(this.buf,Math.floor(t*Hp),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),Fr(this.buf,t&-1,this.pos),Fr(this.buf,Math.floor(t*Hp),this.pos+4),this.pos+=8},writeVarint:function(t){if(t=+t||0,t>268435455||t<0){qx(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=ib(this.buf,t,this.pos);var r=this.pos-e;r>=128&&Xp(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),Ko.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),Ko.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&&Xp(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,Zx,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,Wx,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,Kx,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,Hx,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,Xx,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,Yx,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,Qx,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,eb,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,tb,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 Gx(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 Er(t,i,e);throw new Error("Expected varint not more than 10 bytes")}function ct(t){return t.type===J.Bytes?t.readVarint()+t.pos:t.pos+1}function Er(t,e,r){return r?e*4294967296+(t>>>0):(e>>>0)*4294967296+(t>>>0)}function qx(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),jx(r,n,e),Jx(n,e)}function jx(t,e,r){r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos]=t&127}function Jx(t,e){var r=(t&7)<<4;e.buf[e.pos++]|=r|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127)))))}function Xp(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 Zx(t,e){for(var r=0;r<t.length;r++)e.writeVarint(t[r])}function Wx(t,e){for(var r=0;r<t.length;r++)e.writeSVarint(t[r])}function Hx(t,e){for(var r=0;r<t.length;r++)e.writeFloat(t[r])}function Xx(t,e){for(var r=0;r<t.length;r++)e.writeDouble(t[r])}function Kx(t,e){for(var r=0;r<t.length;r++)e.writeBoolean(t[r])}function Yx(t,e){for(var r=0;r<t.length;r++)e.writeFixed32(t[r])}function Qx(t,e){for(var r=0;r<t.length;r++)e.writeSFixed32(t[r])}function eb(t,e){for(var r=0;r<t.length;r++)e.writeFixed64(t[r])}function tb(t,e){for(var r=0;r<t.length;r++)e.writeSFixed64(t[r])}function Yo(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+t[e+3]*16777216}function Fr(t,e,r){t[r]=e,t[r+1]=e>>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function Kp(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}function rb(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 nb(t,e,r){return Yp.decode(t.subarray(e,r))}function ib(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 Hf=Ae((rT,Wf)=>{Wf.exports=Pa;function Pa(t,e){var r=t&&t.type,n;if(r==="FeatureCollection")for(n=0;n<t.features.length;n++)Pa(t.features[n],e);else if(r==="GeometryCollection")for(n=0;n<t.geometries.length;n++)Pa(t.geometries[n],e);else if(r==="Feature")Pa(t.geometry,e);else if(r==="Polygon")Jf(t.coordinates,e);else if(r==="MultiPolygon")for(n=0;n<t.coordinates.length;n++)Jf(t.coordinates[n],e);return t}function Jf(t,e){if(t.length!==0){Zf(t[0],e);for(var r=1;r<t.length;r++)Zf(t[r],!e)}}function Zf(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 Qf=Ae((oT,Yf)=>{"use strict";var Nb=he(),Ub=Tt().VectorTileFeature;Yf.exports=Kf;function Kf(t,e){this.options=e||{},this.features=t,this.length=t.length}Kf.prototype.feature=function(t){return new wa(this.features[t],this.options.extent)};function wa(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}wa.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 Nb(r[i][0],r[i][1]));this.geometry.push(n)}return this.geometry};wa.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]};wa.prototype.toGeoJSON=Ub.prototype.toGeoJSON});var ry=Ae((aT,di)=>{var $b=Qn(),ty=Qf();di.exports=ml;di.exports.fromVectorTileJs=ml;di.exports.fromGeojsonVt=Gb;di.exports.GeoJSONWrapper=ty;function ml(t){var e=new $b;return qb(t,e),e.finish()}function Gb(t,e){e=e||{};var r={};for(var n in t)r[n]=new ty(t[n].features,e),r[n].name=n,r[n].version=e.version,r[n].extent=e.extent;return ml({layers:r})}function qb(t,e){for(var r in t.layers)e.writeMessage(3,jb,t.layers[r])}function jb(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,Jb,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,Hb,o[r])}function Jb(t,e){var r=t.feature;r.id!==void 0&&e.writeVarintField(1,r.id),e.writeMessage(2,Zb,t),e.writeVarintField(3,r.type),e.writeMessage(4,Wb,r)}function Zb(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 yl(t,e){return(e<<3)+(t&7)}function ey(t){return t<<1^t>>31}function Wb(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(yl(1,u));for(var c=n===3?l.length-1:l.length,p=0;p<c;p++){p===1&&n!==1&&e.writeVarint(yl(2,c-1));var f=l[p].x-i,y=l[p].y-o;e.writeVarint(ey(f)),e.writeVarint(ey(y)),i+=f,o+=y}n===3&&e.writeVarint(yl(7,1))}}function Hb(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 Iy=Z(he(),1),$l=Z(Rl(),1);var za;function Ol(){return za==null&&(za=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),za}var Ii;function Nl(){if(Ii==null&&(Ii=!1,Ol())){let r=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(r){for(let i=0;i<5*5;i++){let o=i*4;r.fillStyle=`rgb(${o},${o+1},${o+2})`,r.fillRect(i%5,Math.floor(i/5),1,1)}let n=r.getImageData(0,0,5,5).data;for(let i=0;i<5*5*4;i++)if(i%4!==3&&n[i]!==i){Ii=!0;break}}}return Ii||!1}function Gl(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 Ty(t,e,r,n){let i=new $l.default(t,e,r,n);return function(o){return i.solve(o)}}var h0=Ty(.25,.1,.25,1);function it(t,e,r){return Math.min(r,Math.max(e,t))}function ql(t,e,r){let n=r-e,i=((t-e)%n+n)%n+e;return i===e?r:i}function Pe(t,...e){for(let r of e)for(let n in r)t[n]=r[n];return t}function jl(t){return Math.log(t)/Math.LN2%1===0}function qr(t,e,r){let n={};for(let i in t)n[i]=e.call(r||this,t[i],i,t);return n}function Jl(t,e,r){let n={};for(let i in t)e.call(r||this,t[i],i,t)&&(n[i]=t[i]);return n}function nt(t){return Array.isArray(t)?t.map(nt):typeof t=="object"&&t?qr(t,nt):t}function Zl(t,e){for(let r=0;r<t.length;r++)if(e.indexOf(t[r])>=0)return!0;return!1}var Ul={};function fe(t){Ul[t]||(typeof console<"u"&&console.warn(t),Ul[t]=!0)}function ot(t,e,r){return(r.y-t.y)*(e.x-t.x)>(e.y-t.y)*(r.x-t.x)}function Wl(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 at(t){return typeof WorkerGlobalScope<"u"&&typeof t<"u"&&t instanceof WorkerGlobalScope}function jr(t){return typeof ImageBitmap<"u"&&t instanceof ImageBitmap}function Cy(t,e,r,n,i){let o=Math.max(-e,0)*4,l=(Math.max(0,r)-r)*n*4+o,u=n*4,c=Math.max(0,e),p=Math.max(0,r),f=Math.min(t.width,e+n),y=Math.min(t.height,r+i);return{rect:{x:c,y:p,width:f-c,height:y-p},layout:[{offset:l,stride:u}]}}async function ky(t,e,r,n,i){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");let o=new VideoFrame(t,{timestamp:0});try{let a=o?.format;if(!a||!(a.startsWith("BGR")||a.startsWith("RGB")))throw new Error(`Unrecognized format ${a}`);let s=a.startsWith("BGR"),l=new Uint8ClampedArray(n*i*4);if(await o.copyTo(l,Cy(t,e,r,n,i)),s)for(let u=0;u<l.length;u+=4){let c=l[u];l[u]=l[u+2],l[u+2]=c}return l}finally{o.close()}}var $r,Gr;function My(t,e,r,n,i){let o=t.width,a=t.height;(!$r||!Gr)&&($r=new OffscreenCanvas(o,a),Gr=$r.getContext("2d",{willReadFrequently:!0})),$r.width=o,$r.height=a,Gr.drawImage(t,0,0,o,a);let s=Gr.getImageData(e,r,n,i);return Gr.clearRect(0,0,o,a),s.data}async function Hl(t,e,r,n,i){if(Nl())try{return await ky(t,e,r,n,i)}catch{}return My(t,e,r,n,i)}function Xl(t,e,r,n){return t.addEventListener(e,r,n),{unsubscribe:()=>{t.removeEventListener(e,r,n)}}}var Dt=class t{constructor(e,r,n){let i=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;let a=new Int32Array(this.arrayBuffer);e=a[0],r=a[1],n=a[2],this.d=r+2*n;for(let u=0;u<this.d*this.d;u++){let c=a[3+u],p=a[3+u+1];i.push(c===p?null:a.subarray(c,p))}let s=a[3+i.length],l=a[3+i.length+1];this.keys=a.subarray(s,l),this.bboxes=a.subarray(l),this.insert=this._insertReadonly}else{this.d=r+2*n;for(let a=0;a<this.d*this.d;a++)i.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=e,this.padding=n,this.scale=r/e,this.uid=0;let o=n/r*e;this.min=-o,this.max=e+o}insert(e,r,n,i,o){this._forEachCell(r,n,i,o,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(r),this.bboxes.push(n),this.bboxes.push(i),this.bboxes.push(o)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,r,n,i,o,a){this.cells[o].push(a)}query(e,r,n,i,o){let a=this.min,s=this.max;if(e<=a&&r<=a&&s<=n&&s<=i&&!o)return Array.prototype.slice.call(this.keys);{let l=[],u={};return this._forEachCell(e,r,n,i,this._queryCell,l,u,o),l}}_queryCell(e,r,n,i,o,a,s,l){let u=this.cells[o];if(u!==null){let c=this.keys,p=this.bboxes;for(let f=0;f<u.length;f++){let y=u[f];if(s[y]===void 0){let m=y*4;(l?l(p[m+0],p[m+1],p[m+2],p[m+3]):e<=p[m+2]&&r<=p[m+3]&&n>=p[m+0]&&i>=p[m+1])?(s[y]=!0,a.push(c[y])):s[y]=!1}}}}_forEachCell(e,r,n,i,o,a,s,l){let u=this._convertToCellCoord(e),c=this._convertToCellCoord(r),p=this._convertToCellCoord(n),f=this._convertToCellCoord(i);for(let y=u;y<=p;y++)for(let m=c;m<=f;m++){let h=this.d*m+y;if(!(l&&!l(this._convertFromCellCoord(y),this._convertFromCellCoord(m),this._convertFromCellCoord(y+1),this._convertFromCellCoord(m+1)))&&o.call(this,e,r,n,i,h,a,s,l))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let e=this.cells,r=3+this.cells.length+1+1,n=0;for(let a=0;a<this.cells.length;a++)n+=this.cells[a].length;let i=new Int32Array(r+n+this.keys.length+this.bboxes.length);i[0]=this.extent,i[1]=this.n,i[2]=this.padding;let o=r;for(let a=0;a<e.length;a++){let s=e[a];i[3+a]=o,i.set(s,o),o+=s.length}return i[3+e.length]=o,i.set(this.keys,o),o+=this.keys.length,i[3+e.length+1]=o,i.set(this.bboxes,o),o+=this.bboxes.length,i.buffer}static serialize(e,r){let n=e.toArrayBuffer();return r&&r.push(n),{buffer:n}}static deserialize(e){return new t(e.buffer)}};var Ey=8,Fy={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"},roll:{type:"number",default:0,units:"degrees"},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},Ly={"*":{type:"source"}},Dy=["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],Vy={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:"*"}},By={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:"*"}},zy={type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},Ry={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"}},Oy={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"}}},Ny={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"}}},Uy={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"}},$y=["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],Gy={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},qy={"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"}},jy={"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"}},Jy={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Zy={"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"}},Wy={"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"}},Hy={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Xy={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Ky={type:"array",value:"*"},Yy={type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},Qy={type:"enum",values:{Point:{},LineString:{},Polygon:{}}},em={type:"array",minimum:0,maximum:24,value:["number","color"],length:2},tm={type:"array",value:"*",minimum:1},rm={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}},nm={"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},im={source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},om={type:{type:"enum",default:"mercator",values:{mercator:{},globe:{}}}},am=["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],sm={"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"}},lm={"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"}},um={"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"}},cm={"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"}},pm={"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"}},fm={"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"}},ym={"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"}},mm={"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"}},hm={duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},dm={"*":{type:"string"}},S={$version:Ey,$root:Fy,sources:Ly,source:Dy,source_vector:Vy,source_raster:By,source_raster_dem:zy,source_geojson:Ry,source_video:Oy,source_image:Ny,layer:Uy,layout:$y,layout_background:Gy,layout_fill:qy,layout_circle:jy,layout_heatmap:Jy,"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:Zy,layout_symbol:Wy,layout_raster:Hy,layout_hillshade:Xy,filter:Ky,filter_operator:Yy,geometry_type:Qy,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:em,expression:tm,light:rm,sky:nm,terrain:im,projection:om,paint:am,paint_fill:sm,"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:lm,paint_circle:um,paint_heatmap:cm,paint_symbol:pm,paint_raster:fm,paint_hillshade:ym,paint_background:mm,transition:hm,"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:dm},gm=["type","source","source-layer","minzoom","maxzoom","filter","layout"];var M=class{constructor(e,r,n,i){this.message=(e?`${e}: `:"")+n,i&&(this.identifier=i),r!=null&&r.__line__&&(this.line=r.__line__)}};function pr(t,...e){for(let r of e)for(let n in r)t[n]=r[n];return t}var Be=class extends Error{constructor(e,r){super(r),this.message=r,this.key=e}},Za=class t{constructor(e,r=[]){this.parent=e,this.bindings={};for(let[n,i]of r)this.bindings[n]=i}concat(e){return new t(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return this.bindings[e]?!0:this.parent?this.parent.has(e):!1}},mr={kind:"null"},L={kind:"number"},G={kind:"string"},U={kind:"boolean"},Re={kind:"color"},ur={kind:"object"},$={kind:"value"},xm={kind:"error"},ji={kind:"collator"},hr={kind:"formatted"},Ji={kind:"padding"},un={kind:"resolvedImage"},Zi={kind:"variableAnchorOffsetCollection"};function Ee(t,e){return{kind:"array",itemType:t,N:e}}function te(t){if(t.kind==="array"){let e=te(t.itemType);return typeof t.N=="number"?`array<${e}, ${t.N}>`:t.itemType.kind==="value"?"array":`array<${e}>`}else return t.kind}var bm=[mr,L,G,U,Re,hr,ur,Ee($),Ji,un,Zi];function Xr(t,e){if(e.kind==="error")return null;if(t.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!Xr(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 bm)if(!Xr(r,e))return null}}return`Expected ${te(t)} but found ${te(e)} instead.`}function cs(t,e){return e.some(r=>r.kind===t.kind)}function zt(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 Jr(t,e){return t.kind==="array"&&e.kind==="array"?t.itemType.kind===e.itemType.kind&&typeof t.N=="number":t.kind===e.kind}var xu=.96422,bu=1,vu=.82521,Pu=4/29,cr=6/29,Su=3*cr*cr,vm=cr*cr*cr,Pm=Math.PI/180,Sm=180/Math.PI;function wu(t){return t=t%360,t<0&&(t+=360),t}function Au([t,e,r,n]){t=Ra(t),e=Ra(e),r=Ra(r);let i,o,a=Oa((.2225045*t+.7168786*e+.0606169*r)/bu);t===e&&e===r?i=o=a:(i=Oa((.4360747*t+.3850649*e+.1430804*r)/xu),o=Oa((.0139322*t+.0971045*e+.7141733*r)/vu));let s=116*a-16;return[s<0?0:s,500*(i-a),200*(a-o),n]}function Ra(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Oa(t){return t>vm?Math.pow(t,1/3):t/Su+Pu}function _u([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=bu*Ua(i),o=xu*Ua(o),a=vu*Ua(a),[Na(3.1338561*o-1.6168667*i-.4906146*a),Na(-.9787684*o+1.9161415*i+.033454*a),Na(.0719453*o-.2289914*i+1.4052427*a),n]}function Na(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 Ua(t){return t>cr?t*t*t:Su*(t-Pu)}function wm(t){let[e,r,n,i]=Au(t),o=Math.sqrt(r*r+n*n);return[Math.round(o*1e4)?wu(Math.atan2(n,r)*Sm):NaN,o,e,i]}function Am([t,e,r,n]){return t=isNaN(t)?0:t*Pm,_u([r,Math.cos(t)*e,Math.sin(t)*e,n])}function _m([t,e,r,n]){t=wu(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 Im(t){if(t=t.toLowerCase().trim(),t==="transparent")return[0,0,0,0];let e=Tm[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[Ti(t.slice(a,a+=o)),Ti(t.slice(a,a+=o)),Ti(t.slice(a,a+=o)),Ti(t.slice(a,a+o)||"ff")]}if(t.startsWith("rgb")){let i=/^rgba?\\(\\s*([\\de.+-]+)(%)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)(%)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)(%)?(?:\\s*([,\\/])\\s*([\\de.+-]+)(%)?)?\\s*\\)$/,o=t.match(i);if(o){let[a,s,l,u,c,p,f,y,m,h,d,g]=o,b=[u||" ",f||" ",h].join("");if(b===" "||b===" /"||b===",,"||b===",,,"){let x=[l,p,m].join(""),v=x==="%%%"?100:x===""?255:0;if(v){let P=[sr(+s/v,0,1),sr(+c/v,0,1),sr(+y/v,0,1),d?Kl(+d,g):1];if(Yl(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,sr(+s,0,100),sr(+u,0,100),p?Kl(+p,f):1];if(Yl(m))return _m(m)}}}function Ti(t){return parseInt(t.padEnd(2,t),16)/255}function Kl(t,e){return sr(e?t/100:t,0,1)}function sr(t,e,r){return Math.min(Math.max(e,t),r)}function Yl(t){return!t.some(Number.isNaN)}var Tm={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=Im(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",wm(this.rgb))}get lab(){return this.overwriteGetter("lab",Au(this.rgb))}overwriteGetter(e,r){return Object.defineProperty(this,e,{value:r}),r}toString(){let[e,r,n,i]=this.rgb;return`rgba(${[e,r,n].map(o=>Math.round(o*255)).join(",")},${i})`}};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 Kr=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}},Yr=class{constructor(e,r,n,i,o){this.text=e,this.image=r,this.scale=n,this.fontStack=i,this.textColor=o}},Fe=class t{constructor(e){this.sections=e}static fromString(e){return new t([new Yr(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("")}},Ze=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)}},Cm=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]),Ne=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"||!Cm.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)}},Te=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 Iu(t,e,r,n){return typeof t=="number"&&t>=0&&t<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof r=="number"&&r>=0&&r<=255?typeof n>"u"||typeof n=="number"&&n>=0&&n<=1?null:`Invalid rgba value [${[t,e,r,n].join(", ")}]: \'a\' must be between 0 and 1.`:`Invalid rgba value [${(typeof n=="number"?[t,e,r,n]:[t,e,r]).join(", ")}]: \'r\', \'g\', and \'b\' must be between 0 and 255.`}function Qr(t){if(t===null||typeof t=="string"||typeof t=="boolean"||typeof t=="number"||t instanceof W||t instanceof Kr||t instanceof Fe||t instanceof Ze||t instanceof Ne||t instanceof Te)return!0;if(Array.isArray(t)){for(let e of t)if(!Qr(e))return!1;return!0}else if(typeof t=="object"){for(let e in t)if(!Qr(t[e]))return!1;return!0}else return!1}function ue(t){if(t===null)return mr;if(typeof t=="string")return G;if(typeof t=="boolean")return U;if(typeof t=="number")return L;if(t instanceof W)return Re;if(t instanceof Kr)return ji;if(t instanceof Fe)return hr;if(t instanceof Ze)return Ji;if(t instanceof Ne)return Zi;if(t instanceof Te)return un;if(Array.isArray(t)){let e=t.length,r;for(let n of t){let i=ue(n);if(!r)r=i;else{if(r===i)continue;r=$;break}}return Ee(r||$,e)}else return ur}function Wr(t){let e=typeof t;return t===null?"":e==="string"||e==="number"||e==="boolean"?String(t):t instanceof W||t instanceof Fe||t instanceof Ze||t instanceof Ne||t instanceof Te?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 ${e.length-1} instead.`);if(!Qr(e[1]))return r.error("invalid value");let n=e[1],i=ue(n),o=r.expectedType;return i.kind==="array"&&i.N===0&&o&&o.kind==="array"&&(typeof o.N!="number"||o.N===0)&&(i=o),new t(i,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}},ie=class{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}},Ci={string:G,number:L,boolean:U,object:ur},je=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 Ci)||u==="object")return r.error(\'The item type argument of "array" must be one of string, number, boolean\',1);s=Ci[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=Ee(s,l)}else{if(!Ci[o])throw new Error(`Types doesn\'t contain name = ${o}`);i=Ci[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(Xr(this.type,ue(n))){if(r===this.args.length-1)throw new ie(`Expected value to be of type ${te(this.type)}, but found ${te(ue(n))} instead.`)}else return n}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},Ql={"to-boolean":U,"to-color":Re,"to-number":L,"to-string":G},yt=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(!Ql[n])throw new Error(`Can\'t parse ${n} as it is not part of the known types`);if((n==="to-boolean"||n==="to-string")&&e.length!==2)return r.error("Expected one argument.");let i=Ql[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 rgba value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:n=Iu(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 ie(n||`Could not parse color from value \'${typeof r=="string"?r:JSON.stringify(r)}\'`)}case"padding":{let r;for(let n of this.args){r=n.evaluate(e);let i=Ze.parse(r);if(i)return i}throw new ie(`Could not parse padding from value \'${typeof r=="string"?r:JSON.stringify(r)}\'`)}case"variableAnchorOffsetCollection":{let r;for(let n of this.args){r=n.evaluate(e);let i=Ne.parse(r);if(i)return i}throw new ie(`Could not parse variableAnchorOffsetCollection from value \'${typeof r=="string"?r:JSON.stringify(r)}\'`)}case"number":{let r=null;for(let n of this.args){if(r=n.evaluate(e),r===null)return 0;let i=Number(r);if(!isNaN(i))return i}throw new ie(`Could not convert ${JSON.stringify(r)} to number.`)}case"formatted":return Fe.fromString(Wr(this.args[0].evaluate(e)));case"resolvedImage":return Te.fromString(Wr(this.args[0].evaluate(e)));default:return Wr(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},km=["Unknown","Point","LineString","Polygon"],Fi=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"?km[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}},Li=class t{constructor(e,r,n=[],i,o=new Za,a=[]){this.registry=e,this.path=n,this.key=n.map(s=>`[${s}]`).join(""),this.scope=o,this.errors=a,this.expectedType=i,this._isConstant=r}parse(e,r,n,i,o={}){return r?this.concat(r,n,i)._parse(e,o):this._parse(e,o)}_parse(e,r){(e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number")&&(e=["literal",e]);function n(i,o,a){return a==="assert"?new je(o,[i]):a==="coerce"?new yt(o,[i]):i}if(Array.isArray(e)){if(e.length===0)return this.error(\'Expected an array with at least one element. If you wanted a literal array, use ["literal", []].\');let i=e[0];if(typeof i!="string")return this.error(`Expression name must be a string, but found ${typeof i} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let o=this.registry[i];if(o){let a=o.parse(e,this);if(!a)return null;if(this.expectedType){let s=this.expectedType,l=a.type;if((s.kind==="string"||s.kind==="number"||s.kind==="boolean"||s.kind==="object"||s.kind==="array")&&l.kind==="value")a=n(a,s,r.typeAnnotation||"assert");else if((s.kind==="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 Fi;try{a=new mt(a.type,a.evaluate(s))}catch(l){return this.error(l.message),null}}return a}return this.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0)}else return typeof e>"u"?this.error("\'undefined\' value invalid. Use null instead."):typeof e=="object"?this.error(\'Bare objects invalid. Use ["literal", {...}] instead.\'):this.error(`Expected an array, but found ${typeof e} instead.`)}concat(e,r,n){let i=typeof e=="number"?this.path.concat(e):this.path,o=n?this.scope.concat(n):this.scope;return new t(this.registry,this._isConstant,i,r||null,o,this.errors)}error(e,...r){let n=`${this.key}${r.map(i=>`[${i}]`).join("")}`;this.errors.push(new Be(n,e))}checkSubtype(e,r){let n=Xr(e,r);return n&&this.error(n),n}},Di=class t{constructor(e,r){this.type=r.type,this.bindings=[].concat(e),this.result=r}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(let r of this.bindings)e(r[1]);e(this.result)}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);let n=[];for(let o=1;o<e.length-1;o+=2){let a=e[o];if(typeof a!="string")return r.error(`Expected string, but found ${typeof a} instead.`,o);if(/[^a-zA-Z0-9_]/.test(a))return r.error("Variable names must contain only alphanumeric characters or \'_\'.",o);let s=r.parse(e[o+1],o+1);if(!s)return null;n.push([a,s])}let i=r.parse(e[e.length-1],e.length-1,r.expectedType,n);return i?new t(n,i):null}outputDefined(){return this.result.outputDefined()}},Vi=class t{constructor(e,r){this.type=r.type,this.name=e,this.boundExpression=r}static parse(e,r){if(e.length!==2||typeof e[1]!="string")return r.error("\'var\' expression requires exactly one string literal argument.");let n=e[1];return r.scope.has(n)?new t(n,r.scope.get(n)):r.error(`Unknown variable "${n}". Make sure "${n}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}},Wa=class t{constructor(e,r,n){this.type=e,this.index=r,this.input=n}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let n=r.parse(e[1],1,L),i=r.parse(e[2],2,Ee(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 ie(`Array index out of bounds: ${r} < 0.`);if(r>=n.length)throw new ie(`Array index out of bounds: ${r} > ${n.length-1}.`);if(r!==Math.floor(r))throw new ie(`Array index must be an integer, but found ${r} instead.`);return n[r]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}},Ha=class t{constructor(e,r){this.type=U,this.needle=e,this.haystack=r}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let n=r.parse(e[1],1,$),i=r.parse(e[2],2,$);return!n||!i?null:cs(n.type,[U,G,L,mr,$])?new t(n,i):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${te(n.type)} instead`)}evaluate(e){let r=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!n)return!1;if(!zt(r,["boolean","string","number","null"]))throw new ie(`Expected first argument to be of type boolean, string, number or null, but found ${te(ue(r))} instead.`);if(!zt(n,["string","array"]))throw new ie(`Expected second argument to be of type array or string, but found ${te(ue(n))} instead.`);return n.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}},Xa=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 ${e.length-1} instead.`);let n=r.parse(e[1],1,$),i=r.parse(e[2],2,$);if(!n||!i)return null;if(!cs(n.type,[U,G,L,mr,$]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${te(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(!zt(r,["boolean","string","number","null"]))throw new ie(`Expected first argument to be of type boolean, string, number or null, but found ${te(ue(r))} instead.`);let i;if(this.fromIndex&&(i=this.fromIndex.evaluate(e)),zt(n,["string"])){let o=n.indexOf(r,i);return o===-1?-1:[...n.slice(0,o)].length}else{if(zt(n,["array"]))return n.indexOf(r,i);throw new ie(`Expected second argument to be of type array or string, but found ${te(ue(n))} instead.`)}}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}},Ka=class t{constructor(e,r,n,i,o,a){this.inputType=e,this.type=r,this.input=n,this.cases=i,this.outputs=o,this.otherwise=a}static parse(e,r){if(e.length<5)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!==1)return r.error("Expected an even number of arguments.");let n,i;r.expectedType&&r.expectedType.kind!=="value"&&(i=r.expectedType);let o={},a=[];for(let u=2;u<e.length-1;u+=2){let c=e[u],p=e[u+1];Array.isArray(c)||(c=[c]);let f=r.concat(u);if(c.length===0)return f.error("Expected at least one branch label.");for(let m of c){if(typeof m!="number"&&typeof m!="string")return f.error("Branch labels must be numbers or strings.");if(typeof m=="number"&&Math.abs(m)>Number.MAX_SAFE_INTEGER)return f.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof m=="number"&&Math.floor(m)!==m)return f.error("Numeric branch labels must be integer values.");if(!n)n=ue(m);else if(f.checkSubtype(n,ue(m)))return null;if(typeof o[String(m)]<"u")return f.error("Branch labels must be unique.");o[String(m)]=a.length}let y=r.parse(p,u,i);if(!y)return null;i=i||y.type,a.push(y)}let s=r.parse(e[1],1,$);if(!s)return null;let l=r.parse(e[e.length-1],e.length-1,i);return!l||s.type.kind!=="value"&&r.concat(1).checkSubtype(n,s.type)?null:new t(n,i,s,o,a,l)}evaluate(e){let r=this.input.evaluate(e);return(ue(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}},Ya=class t{constructor(e,r,n){this.type=e,this.branches=r,this.otherwise=n}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!==0)return r.error("Expected an odd number of arguments.");let n;r.expectedType&&r.expectedType.kind!=="value"&&(n=r.expectedType);let i=[];for(let a=1;a<e.length-1;a+=2){let s=r.parse(e[a],a,U);if(!s)return null;let l=r.parse(e[a+1],a+1,n);if(!l)return null;i.push([s,l]),n=n||l.type}let o=r.parse(e[e.length-1],e.length-1,n);if(!o)return null;if(!n)throw new Error("Can\'t infer output type");return new t(n,i,o)}evaluate(e){for(let[r,n]of this.branches)if(r.evaluate(e))return n.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(let[r,n]of this.branches)e(r),e(n);e(this.otherwise)}outputDefined(){return this.branches.every(([e,r])=>r.outputDefined())&&this.otherwise.outputDefined()}},Qa=class t{constructor(e,r,n,i){this.type=e,this.input=r,this.beginIndex=n,this.endIndex=i}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);let n=r.parse(e[1],1,$),i=r.parse(e[2],2,L);if(!n||!i)return null;if(!cs(n.type,[Ee($),G,$]))return r.error(`Expected first argument to be of type array or string, but found ${te(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),i;if(this.endIndex&&(i=this.endIndex.evaluate(e)),zt(r,["string"]))return[...r].slice(n,i).join("");if(zt(r,["array"]))return r.slice(n,i);throw new ie(`Expected first argument to be of type array or string, but found ${te(ue(r))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}};function Wi(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 ie("Input is not a number.");return 0}var fr=class t{constructor(e,r,n){this.type=e,this.input=r,this.labels=[],this.outputs=[];for(let[i,o]of n)this.labels.push(i),this.outputs.push(o)}static parse(e,r){if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!==0)return r.error("Expected an even number of arguments.");let n=r.parse(e[1],1,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=Wi(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 Mm(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var $a,eu;function Em(){if(eu)return $a;eu=1,$a=t;function t(e,r,n,i){this.cx=3*e,this.bx=3*(n-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*r,this.by=3*(i-r)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=r,this.p2x=n,this.p2y=i}return t.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,r){if(r===void 0&&(r=1e-6),e<0)return 0;if(e>1)return 1;for(var n=e,i=0;i<8;i++){var o=this.sampleCurveX(n)-e;if(Math.abs(o)<r)return n;var a=this.sampleCurveDerivativeX(n);if(Math.abs(a)<1e-6)break;n=n-o/a}var s=0,l=1;for(n=e,i=0;i<20&&(o=this.sampleCurveX(n),!(Math.abs(o-e)<r));i++)e>o?s=n:l=n,n=(l-s)*.5+s;return n},solve:function(e,r){return this.sampleCurveY(this.solveCurveX(e,r))}},$a}var Fm=Em(),Lm=Mm(Fm);function Dm(t){return t==="rgb"||t==="hcl"||t==="lab"}function Rt(t,e,r){return t+r*(e-t)}function Vm(t,e,r,n="rgb"){switch(n){case"rgb":{let[i,o,a,s]=Bi(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 b=l-i;l>i&&b>180?b-=360:l<i&&i-l>180&&(b+=360),f=i+r*b}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,h,d,g]=Am([f,y??Rt(o,u,r),Rt(a,c,r),Rt(s,p,r)]);return new W(m,h,d,g,!1)}case"lab":{let[i,o,a,s]=_u(Bi(t.lab,e.lab,r));return new W(i,o,a,s,!1)}}}function Bi(t,e,r){return t.map((n,i)=>Rt(n,e[i],r))}function Bm(t,e,r){return new Ze(Bi(t.values,e.values,r))}function zm(t,e,r){let n=t.values,i=e.values;if(n.length!==i.length)throw new ie(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${e.toString()}`);let o=[];for(let a=0;a<n.length;a+=2){if(n[a]!==i[a])throw new ie(`Cannot interpolate values containing mismatched anchors. from[${a}]: ${n[a]}, to[${a}]: ${i[a]}`);o.push(n[a]);let[s,l]=n[a+1],[u,c]=i[a+1];o.push([Rt(s,u,r),Rt(l,c,r)])}return new Ne(o)}var Oe={number:Rt,color:Vm,array:Bi,padding:Bm,variableAnchorOffsetCollection:zm},Je=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=Ga(r,e.base,n,i);else if(e.name==="linear")o=Ga(r,1,n,i);else if(e.name==="cubic-bezier"){let a=e.controlPoints;o=new Lm(a[0],a[1],a[2],a[3]).solve(Ga(r,1,n,i))}return o}static parse(e,r){let[n,i,o,...a]=e;if(!Array.isArray(i)||i.length===0)return r.error("Expected an interpolation type expression.",1);if(i[0]==="linear")i={name:"linear"};else if(i[0]==="exponential"){let u=i[1];if(typeof u!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);i={name:"exponential",base:u}}else if(i[0]==="cubic-bezier"){let u=i.slice(1);if(u.length!==4||u.some(c=>typeof c!="number"||c<0||c>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);i={name:"cubic-bezier",controlPoints:u}}else return r.error(`Unknown interpolation type ${String(i[0])}`,1,0);if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!==0)return r.error("Expected an even number of arguments.");if(o=r.parse(o,2,L),!o)return null;let s=[],l=null;n==="interpolate-hcl"||n==="interpolate-lab"?l=Re: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!Jr(l,L)&&!Jr(l,Re)&&!Jr(l,Ji)&&!Jr(l,Zi)&&!Jr(l,Ee(L))?r.error(`Type ${te(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=Wi(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 Oe[this.type.kind](c,p,u);case"interpolate-hcl":return Oe.color(c,p,u,"hcl");case"interpolate-lab":return Oe.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 Ga(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 zi=class t{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let n=null,i=r.expectedType;i&&i.kind!=="value"&&(n=i);let o=[];for(let s of e.slice(1)){let l=r.parse(s,1+o.length,n,void 0,{typeAnnotation:"omit"});if(!l)return null;n=n||l.type,o.push(l)}if(!n)throw new Error("No output type");return i&&o.some(s=>Xr(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 Te&&!r.available&&(i||(i=r.name),r=null,n===this.args.length&&(r=i)),r!==null)break;return r}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}};function tu(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 Rm(t,e,r){return e===r}function Om(t,e,r){return e!==r}function Nm(t,e,r){return e<r}function Um(t,e,r){return e>r}function $m(t,e,r){return e<=r}function Gm(t,e,r){return e>=r}function Tu(t,e,r,n){return n.compare(e,r)===0}function qm(t,e,r,n){return!Tu(t,e,r,n)}function jm(t,e,r,n){return n.compare(e,r)<0}function Jm(t,e,r,n){return n.compare(e,r)>0}function Zm(t,e,r,n){return n.compare(e,r)<=0}function Wm(t,e,r,n){return n.compare(e,r)>=0}function dr(t,e,r){let n=t!=="=="&&t!=="!=";return class Cu{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(!tu(s,l.type))return a.concat(1).error(`"${s}" comparisons are not supported for type \'${te(l.type)}\'.`);let u=a.parse(o[2],2,$);if(!u)return null;if(!tu(s,u.type))return a.concat(2).error(`"${s}" comparisons are not supported for type \'${te(u.type)}\'.`);if(l.type.kind!==u.type.kind&&l.type.kind!=="value"&&u.type.kind!=="value")return a.error(`Cannot compare types \'${te(l.type)}\' and \'${te(u.type)}\'.`);n&&(l.type.kind==="value"&&u.type.kind!=="value"?l=new je(u.type,[l]):l.type.kind!=="value"&&u.type.kind==="value"&&(u=new je(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,ji),!c)return null}return new Cu(l,u,c)}evaluate(o){let a=this.lhs.evaluate(o),s=this.rhs.evaluate(o);if(n&&this.hasUntypedArgument){let l=ue(a),u=ue(s);if(l.kind!==u.kind||!(l.kind==="string"||l.kind==="number"))throw new ie(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${l.kind}, ${u.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){let l=ue(a),u=ue(s);if(l.kind!=="string"||u.kind!=="string")return e(o,a,s)}return this.collator?r(o,a,s,this.collator.evaluate(o)):e(o,a,s)}eachChild(o){o(this.lhs),o(this.rhs),this.collator&&o(this.collator)}outputDefined(){return!0}}}var Hm=dr("==",Rm,Tu),Xm=dr("!=",Om,qm),Km=dr("<",Nm,jm),Ym=dr(">",Um,Jm),Qm=dr("<=",$m,Zm),eh=dr(">=",Gm,Wm),Ri=class t{constructor(e,r,n){this.type=ji,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 Kr(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}},es=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}},en=class t{constructor(e){this.type=hr,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,Ee(G)),!u))return null;let c=null;if(s["text-color"]&&(c=r.parse(s["text-color"],1,Re),!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 ue(i)===un?new Yr("",i,null,null,null):new Yr(Wr(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 Fe(this.sections.map(r))}eachChild(e){for(let r of this.sections)e(r.content),r.scale&&e(r.scale),r.font&&e(r.font),r.textColor&&e(r.textColor)}outputDefined(){return!1}},ts=class t{constructor(e){this.type=un,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=Te.fromString(r);return n&&e.availableImages&&(n.available=e.availableImages.indexOf(r)>-1),n}eachChild(e){e(this.input)}outputDefined(){return!1}},rs=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 ${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 ${te(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 ie(`Expected value to be of type string or array, but found ${te(ue(r))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}},Xe=8192;function th(t,e){let r=rh(t[0]),n=ih(t[1]),i=Math.pow(2,e.z);return[Math.round(r*i*Xe),Math.round(n*i*Xe)]}function ps(t,e){let r=Math.pow(2,e.z),n=(t[0]/Xe+e.x)/r,i=(t[1]/Xe+e.y)/r;return[nh(n),oh(i)]}function rh(t){return(180+t)/360}function nh(t){return t*360-180}function ih(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function oh(t){return 360/Math.PI*Math.atan(Math.exp((180-t*360)*Math.PI/180))-90}function cn(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 tn(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function ah(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 sh(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 Hi(t,e,r,n){let i=[e[0]-t[0],e[1]-t[1]],o=[n[0]-r[0],n[1]-r[1]];return ph(o,i)===0?!1:!!(ru(t,e,r,n)&&ru(r,n,t,e))}function lh(t,e,r){for(let n of r)for(let i=0;i<n.length-1;++i)if(Hi(t,e,n[i],n[i+1]))return!0;return!1}function gr(t,e,r=!1){let n=!1;for(let i of e)for(let o=0;o<i.length-1;o++){if(sh(t,i[o],i[o+1]))return r;ah(t,i[o],i[o+1])&&(n=!n)}return n}function uh(t,e){for(let r of e)if(gr(t,r))return!0;return!1}function ku(t,e){for(let r of t)if(!gr(r,e))return!1;for(let r=0;r<t.length-1;++r)if(lh(t[r],t[r+1],e))return!1;return!0}function ch(t,e){for(let r of e)if(ku(t,r))return!0;return!1}function ph(t,e){return t[0]*e[1]-t[1]*e[0]}function ru(t,e,r,n){let i=t[0]-r[0],o=t[1]-r[1],a=e[0]-r[0],s=e[1]-r[1],l=n[0]-r[0],u=n[1]-r[1],c=i*u-l*o,p=a*u-l*s;return c>0&&p<0||c<0&&p>0}function fs(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=th(t[i][a],r);cn(e,s),o.push(s)}n.push(o)}return n}function Mu(t,e,r){let n=[];for(let i=0;i<t.length;i++){let o=fs(t[i],e,r);n.push(o)}return n}function Eu(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}cn(e,t)}function fh(t){t[0]=t[1]=1/0,t[2]=t[3]=-1/0}function nu(t,e,r,n){let i=Math.pow(2,n.z)*Xe,o=[n.x*Xe,n.y*Xe],a=[];for(let s of t)for(let l of s){let u=[l.x+o[0],l.y+o[1]];Eu(u,e,r,i),a.push(u)}return a}function iu(t,e,r,n){let i=Math.pow(2,n.z)*Xe,o=[n.x*Xe,n.y*Xe],a=[];for(let s of t){let l=[];for(let u of s){let c=[u.x+o[0],u.y+o[1]];cn(e,c),l.push(c)}a.push(l)}if(e[2]-e[0]<=i/2){fh(e);for(let s of a)for(let l of s)Eu(l,e,r,i)}return a}function yh(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=fs(e.coordinates,n,i),a=nu(t.geometry(),r,n,i);if(!tn(r,n))return!1;for(let s of a)if(!gr(s,o))return!1}if(e.type==="MultiPolygon"){let o=Mu(e.coordinates,n,i),a=nu(t.geometry(),r,n,i);if(!tn(r,n))return!1;for(let s of a)if(!uh(s,o))return!1}return!0}function mh(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=fs(e.coordinates,n,i),a=iu(t.geometry(),r,n,i);if(!tn(r,n))return!1;for(let s of a)if(!ku(s,o))return!1}if(e.type==="MultiPolygon"){let o=Mu(e.coordinates,n,i),a=iu(t.geometry(),r,n,i);if(!tn(r,n))return!1;for(let s of a)if(!ch(s,o))return!1}return!0}var rn=class t{constructor(e,r){this.type=U,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`\'within\' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Qr(e[1])){let n=e[1];if(n.type==="FeatureCollection"){let i=[];for(let o of n.features){let{type:a,coordinates:s}=o.geometry;a==="Polygon"&&i.push(s),a==="MultiPolygon"&&i.push(...s)}if(i.length){let o={type:"MultiPolygon",coordinates:i};return new t(n,o)}}else if(n.type==="Feature"){let i=n.geometry.type;if(i==="Polygon"||i==="MultiPolygon")return new t(n,n.geometry)}else if(n.type==="Polygon"||n.type==="MultiPolygon")return new t(n,n)}return r.error("\'within\' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return yh(e,this.geometries);if(e.geometryType()==="LineString")return mh(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}},Oi=class{constructor(e=[],r=(n,i)=>n<i?-1:n>i?1:0){if(this.data=e,this.length=this.data.length,this.compare=r,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;let e=this.data[0],r=this.data.pop();return--this.length>0&&(this.data[0]=r,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:r,compare:n}=this,i=r[e];for(;e>0;){let o=e-1>>1,a=r[o];if(n(i,a)>=0)break;r[e]=a,e=o}r[e]=i}_down(e){let{data:r,compare:n}=this,i=this.length>>1,o=r[e];for(;e<i;){let a=(e<<1)+1,s=a+1;if(s<this.length&&n(r[s],r[a])<0&&(a=s),n(r[a],o)>=0)break;r[e]=r[a],e=a}r[e]=o}};function hh(t,e,r,n,i){Fu(t,e,r,n||t.length-1,i||dh)}function Fu(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));Fu(t,e,c,p,i)}var f=t[e],y=r,m=n;for(Zr(t,r,e),i(t[n],f)>0&&Zr(t,r,n);y<m;){for(Zr(t,y,m),y++,m--;i(t[y],f)<0;)y++;for(;i(t[m],f)>0;)m--}i(t[r],f)===0?Zr(t,r,m):(m++,Zr(t,m,n)),m<=e&&(r=m+1),e<=m&&(n=m-1)}}function Zr(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function dh(t,e){return t<e?-1:t>e?1:0}function gh(t,e){if(t.length<=1)return[t];let n=[],i,o;for(let a of t){let s=bh(a);s!==0&&(a.area=Math.abs(s),o===void 0&&(o=s<0),o===s<0?(i&&n.push(i),i=[a]):i.push(a))}if(i&&n.push(i),e>1)for(let a=0;a<n.length;a++)n[a].length<=e||(hh(n[a],e,1,n[a].length-1,xh),n[a]=n[a].slice(0,e));return n}function xh(t,e){return e.area-t.area}function bh(t){let e=0;for(let r=0,n=t.length,i=n-1,o,a;r<n;i=r++)o=t[r],a=t[i],e+=(a.x-o.x)*(o.y+a.y);return e}var vh=6378.137,ou=1/298.257223563,au=ou*(2-ou),su=Math.PI/180,nn=class{constructor(e){let r=su*vh*1e3,n=Math.cos(e*su),i=1/(1-au*(1-n*n)),o=Math.sqrt(i);this.kx=r*o*n,this.ky=r*o*i*(1-au)}distance(e,r){let n=this.wrap(e[0]-r[0])*this.kx,i=(e[1]-r[1])*this.ky;return Math.sqrt(n*n+i*i)}pointOnLine(e,r){let n=1/0,i,o,a,s;for(let l=0;l<e.length-1;l++){let u=e[l][0],c=e[l][1],p=this.wrap(e[l+1][0]-u)*this.kx,f=(e[l+1][1]-c)*this.ky,y=0;(p!==0||f!==0)&&(y=(this.wrap(r[0]-u)*this.kx*p+(r[1]-c)*this.ky*f)/(p*p+f*f),y>1?(u=e[l+1][0],c=e[l+1][1]):y>0&&(u+=p/this.kx*y,c+=f/this.ky*y)),p=this.wrap(r[0]-u)*this.kx,f=(r[1]-c)*this.ky;let m=p*p+f*f;m<n&&(n=m,i=u,o=c,a=l,s=y)}return{point:[i,o],index:a,t:Math.max(0,Math.min(1,s))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}},ns=100,is=50;function Lu(t,e){return e[0]-t[0]}function Ni(t){return t[1]-t[0]+1}function st(t,e){return t[1]>=t[0]&&t[1]<e}function os(t,e){if(t[0]>t[1])return[null,null];let r=Ni(t);if(e){if(r===2)return[t,null];let i=Math.floor(r/2);return[[t[0],t[0]+i],[t[0]+i,t[1]]]}if(r===1)return[t,null];let n=Math.floor(r/2)-1;return[[t[0],t[0]+n],[t[0]+n+1,t[1]]]}function as(t,e){if(!st(e,t.length))return[1/0,1/0,-1/0,-1/0];let r=[1/0,1/0,-1/0,-1/0];for(let n=e[0];n<=e[1];++n)cn(r,t[n]);return r}function ss(t){let e=[1/0,1/0,-1/0,-1/0];for(let r of t)for(let n of r)cn(e,n);return e}function lu(t){return t[0]!==-1/0&&t[1]!==-1/0&&t[2]!==1/0&&t[3]!==1/0}function ys(t,e,r){if(!lu(t)||!lu(e))return NaN;let n=0,i=0;return t[2]<e[0]&&(n=e[0]-t[2]),t[0]>e[2]&&(n=t[0]-e[2]),t[1]>e[3]&&(i=t[1]-e[3]),t[3]<e[1]&&(i=e[1]-t[3]),r.distance([0,0],[n,i])}function Bt(t,e,r){let n=r.pointOnLine(e,t);return r.distance(t,n.point)}function ms(t,e,r,n,i){let o=Math.min(Bt(t,[r,n],i),Bt(e,[r,n],i)),a=Math.min(Bt(r,[t,e],i),Bt(n,[t,e],i));return Math.min(o,a)}function Ph(t,e,r,n,i){if(!(st(e,t.length)&&st(n,r.length)))return 1/0;let a=1/0;for(let s=e[0];s<e[1];++s){let l=t[s],u=t[s+1];for(let c=n[0];c<n[1];++c){let p=r[c],f=r[c+1];if(Hi(l,u,p,f))return 0;a=Math.min(a,ms(l,u,p,f,i))}}return a}function Sh(t,e,r,n,i){if(!(st(e,t.length)&&st(n,r.length)))return NaN;let a=1/0;for(let s=e[0];s<=e[1];++s)for(let l=n[0];l<=n[1];++l)if(a=Math.min(a,i.distance(t[s],r[l])),a===0)return a;return a}function wh(t,e,r){if(gr(t,e,!0))return 0;let n=1/0;for(let i of e){let o=i[0],a=i[i.length-1];if(o!==a&&(n=Math.min(n,Bt(t,[a,o],r)),n===0))return n;let s=r.pointOnLine(i,t);if(n=Math.min(n,r.distance(t,s.point)),n===0)return n}return n}function Ah(t,e,r,n){if(!st(e,t.length))return NaN;for(let o=e[0];o<=e[1];++o)if(gr(t[o],r,!0))return 0;let i=1/0;for(let o=e[0];o<e[1];++o){let a=t[o],s=t[o+1];for(let l of r)for(let u=0,c=l.length,p=c-1;u<c;p=u++){let f=l[p],y=l[u];if(Hi(a,s,f,y))return 0;i=Math.min(i,ms(a,s,f,y,n))}}return i}function uu(t,e){for(let r of t)for(let n of r)if(gr(n,e,!0))return!0;return!1}function _h(t,e,r,n=1/0){let i=ss(t),o=ss(e);if(n!==1/0&&ys(i,o,r)>=n)return n;if(tn(i,o)){if(uu(t,e))return 0}else if(uu(e,t))return 0;let a=1/0;for(let s of t)for(let l=0,u=s.length,c=u-1;l<u;c=l++){let p=s[c],f=s[l];for(let y of e)for(let m=0,h=y.length,d=h-1;m<h;d=m++){let g=y[d],b=y[m];if(Hi(p,f,g,b))return 0;a=Math.min(a,ms(p,f,g,b,r))}}return a}function cu(t,e,r,n,i,o){if(!o)return;let a=ys(as(n,o),i,r);a<e&&t.push([a,o,[0,0]])}function ki(t,e,r,n,i,o,a){if(!o||!a)return;let s=ys(as(n,o),as(i,a),r);s<e&&t.push([s,o,a])}function Ui(t,e,r,n,i=1/0){let o=Math.min(n.distance(t[0],r[0][0]),i);if(o===0)return o;let a=new Oi([[0,[0,t.length-1],[0,0]]],Lu),s=ss(r);for(;a.length>0;){let l=a.pop();if(l[0]>=o)continue;let u=l[1],c=e?is:ns;if(Ni(u)<=c){if(!st(u,t.length))return NaN;if(e){let p=Ah(t,u,r,n);if(isNaN(p)||p===0)return p;o=Math.min(o,p)}else for(let p=u[0];p<=u[1];++p){let f=wh(t[p],r,n);if(o=Math.min(o,f),o===0)return 0}}else{let p=os(u,e);cu(a,o,n,t,s,p[0]),cu(a,o,n,t,s,p[1])}}return o}function $i(t,e,r,n,i,o=1/0){let a=Math.min(o,i.distance(t[0],r[0]));if(a===0)return a;let s=new Oi([[0,[0,t.length-1],[0,r.length-1]]],Lu);for(;s.length>0;){let l=s.pop();if(l[0]>=a)continue;let u=l[1],c=l[2],p=e?is:ns,f=n?is:ns;if(Ni(u)<=p&&Ni(c)<=f){if(!st(u,t.length)&&st(c,r.length))return NaN;let y;if(e&&n)y=Ph(t,u,r,c,i),a=Math.min(a,y);else if(e&&!n){let m=t.slice(u[0],u[1]+1);for(let h=c[0];h<=c[1];++h)if(y=Bt(r[h],m,i),a=Math.min(a,y),a===0)return a}else if(!e&&n){let m=r.slice(c[0],c[1]+1);for(let h=u[0];h<=u[1];++h)if(y=Bt(t[h],m,i),a=Math.min(a,y),a===0)return a}else y=Sh(t,u,r,c,i),a=Math.min(a,y)}else{let y=os(u,e),m=os(c,n);ki(s,a,i,t,r,y[0],m[0]),ki(s,a,i,t,r,y[0],m[1]),ki(s,a,i,t,r,y[1],m[0]),ki(s,a,i,t,r,y[1],m[1])}}return a}function Ih(t,e){let r=t.geometry(),n=r.flat().map(a=>ps([a.x,a.y],t.canonical));if(r.length===0)return NaN;let i=new nn(n[0][1]),o=1/0;for(let a of e){switch(a.type){case"Point":o=Math.min(o,$i(n,!1,[a.coordinates],!1,i,o));break;case"LineString":o=Math.min(o,$i(n,!1,a.coordinates,!0,i,o));break;case"Polygon":o=Math.min(o,Ui(n,!1,a.coordinates,i,o));break}if(o===0)return o}return o}function Th(t,e){let r=t.geometry(),n=r.flat().map(a=>ps([a.x,a.y],t.canonical));if(r.length===0)return NaN;let i=new nn(n[0][1]),o=1/0;for(let a of e){switch(a.type){case"Point":o=Math.min(o,$i(n,!0,[a.coordinates],!1,i,o));break;case"LineString":o=Math.min(o,$i(n,!0,a.coordinates,!0,i,o));break;case"Polygon":o=Math.min(o,Ui(n,!0,a.coordinates,i,o));break}if(o===0)return o}return o}function Ch(t,e){let r=t.geometry();if(r.length===0||r[0].length===0)return NaN;let n=gh(r,0).map(a=>a.map(s=>s.map(l=>ps([l.x,l.y],t.canonical)))),i=new nn(n[0][0][0][1]),o=1/0;for(let a of e)for(let s of n){switch(a.type){case"Point":o=Math.min(o,Ui([a.coordinates],!1,s,i,o));break;case"LineString":o=Math.min(o,Ui(a.coordinates,!0,s,i,o));break;case"Polygon":o=Math.min(o,_h(s,a.coordinates,i,o));break}if(o===0)return o}return o}function qa(t){return t.type==="MultiPolygon"?t.coordinates.map(e=>({type:"Polygon",coordinates:e})):t.type==="MultiLineString"?t.coordinates.map(e=>({type:"LineString",coordinates:e})):t.type==="MultiPoint"?t.coordinates.map(e=>({type:"Point",coordinates:e})):[t]}var on=class t{constructor(e,r){this.type=L,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`\'distance\' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Qr(e[1])){let n=e[1];if(n.type==="FeatureCollection")return new t(n,n.features.map(i=>qa(i.geometry)).flat());if(n.type==="Feature")return new t(n,qa(n.geometry));if("type"in n&&"coordinates"in n)return new t(n,qa(n))}return r.error("\'distance\' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return Ih(e,this.geometries);if(e.geometryType()==="LineString")return Th(e,this.geometries);if(e.geometryType()==="Polygon")return Ch(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}},$t={"==":Hm,"!=":Xm,">":Ym,"<":Km,">=":eh,"<=":Qm,array:je,at:Wa,boolean:je,case:Ya,coalesce:zi,collator:Ri,format:en,image:ts,in:Ha,"index-of":Xa,interpolate:Je,"interpolate-hcl":Je,"interpolate-lab":Je,length:rs,let:Di,literal:mt,match:Ka,number:je,"number-format":es,object:je,slice:Qa,step:fr,string:je,"to-boolean":yt,"to-color":yt,"to-number":yt,"to-string":yt,var:Vi,within:rn,distance:on},Ke=class t{constructor(e,r,n,i){this.name=e,this.type=r,this._evaluate=n,this.args=i}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,r){let n=e[0],i=t.definitions[n];if(!i)return r.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0);let o=Array.isArray(i)?i[0]:i.type,a=Array.isArray(i)?[[i[1],i[2]]]:i.overloads,s=a.filter(([u])=>!Array.isArray(u)||u.length===e.length-1),l=null;for(let[u,c]of s){l=new Li(r.registry,Gi,r.path,null,r.scope);let p=[],f=!1;for(let y=1;y<e.length;y++){let m=e[y],h=Array.isArray(u)?u[y-1]:u.type,d=l.parse(m,1+p.length,h);if(!d){f=!0;break}p.push(d)}if(!f){if(Array.isArray(u)&&u.length!==p.length){l.error(`Expected ${u.length} arguments, but found ${p.length} instead.`);continue}for(let y=0;y<p.length;y++){let m=Array.isArray(u)?u[y]:u.type,h=p[y];l.concat(y+1).checkSubtype(m,h.type)}if(l.errors.length===0)return new t(n,o,c,p)}}if(s.length===1)r.errors.push(...l.errors);else{let c=(s.length?s:a).map(([f])=>Mh(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(te(y.type))}r.error(`Expected arguments of type ${c}, but found (${p.join(", ")}) instead.`)}return null}static register(e,r){t.definitions=r;for(let n in r)e[n]=t}};function pu(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=Iu(e,r,n,o);if(a)throw new ie(a);return new W(e/255,r/255,n/255,o,!1)}function fu(t,e){return t in e}function ja(t,e){let r=e[t];return typeof r>"u"?null:r}function kh(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 Vt(t){return{type:t}}Ke.register($t,{error:[xm,[G],(t,[e])=>{throw new ie(e.evaluate(t))}],typeof:[G,[$],(t,[e])=>te(ue(e.evaluate(t)))],"to-rgba":[Ee(L,4),[Re],(t,[e])=>{let[r,n,i,o]=e.evaluate(t).rgb;return[r*255,n*255,i*255,o]}],rgb:[Re,[L,L,L],pu],rgba:[Re,[L,L,L,L],pu],has:{type:U,overloads:[[[G],(t,[e])=>fu(e.evaluate(t),t.properties())],[[G,ur],(t,[e,r])=>fu(e.evaluate(t),r.evaluate(t))]]},get:{type:$,overloads:[[[G],(t,[e])=>ja(e.evaluate(t),t.properties())],[[G,ur],(t,[e,r])=>ja(e.evaluate(t),r.evaluate(t))]]},"feature-state":[$,[G],(t,[e])=>ja(e.evaluate(t),t.featureState||{})],properties:[ur,[],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,Vt(L),(t,e)=>{let r=0;for(let n of e)r+=n.evaluate(t);return r}],"*":[L,Vt(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,Vt(L),(t,e)=>Math.min(...e.map(r=>r.evaluate(t)))],max:[L,Vt(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,[Ee(G)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[U,[Ee($)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[U,[G,Ee($)],(t,[e,r])=>r.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[U,[G,Ee($)],(t,[e,r])=>kh(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)],[Vt(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)],[Vt(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,Vt($),(t,e)=>e.map(r=>Wr(r.evaluate(t))).join("")],"resolved-locale":[G,[ji],(t,[e])=>e.evaluate(t).resolvedLocale()]});function Mh(t){return Array.isArray(t)?`(${t.map(te).join(", ")})`:`(${te(t.type)}...)`}function Gi(t){if(t instanceof Vi)return Gi(t.boundExpression);if(t instanceof Ke&&t.name==="error")return!1;if(t instanceof Ri)return!1;if(t instanceof rn)return!1;if(t instanceof on)return!1;let e=t instanceof yt||t instanceof je,r=!0;return t.eachChild(n=>{e?r=r&&Gi(n):r=r&&n instanceof mt}),r?Xi(t)&&Ki(t,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"]):!1}function Xi(t){if(t instanceof Ke){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 rn||t instanceof on)return!1;let e=!0;return t.eachChild(r=>{e&&!Xi(r)&&(e=!1)}),e}function an(t){if(t instanceof Ke&&t.name==="feature-state")return!1;let e=!0;return t.eachChild(r=>{e&&!an(r)&&(e=!1)}),e}function Ki(t,e){if(t instanceof Ke&&e.indexOf(t.name)>=0)return!1;let r=!0;return t.eachChild(n=>{r&&!Ki(n,e)&&(r=!1)}),r}function ls(t){return{result:"success",value:t}}function lr(t){return{result:"error",value:t}}function ht(t){return t["property-type"]==="data-driven"||t["property-type"]==="cross-faded-data-driven"}function Du(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function hs(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 Yi(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Eh(t){return t}function Vu(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||(hs(e)?"exponential":"interval");if(r||e.type==="padding"){let c=r?W.parse:Ze.parse;t=pr({},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&&!Dm(t.colorSpace))throw new Error(`Unknown color space: "${t.colorSpace}"`);let s,l,u;if(a==="exponential")s=yu;else if(a==="interval")s=Lh;else if(a==="categorical"){s=Fh,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=Dh;else throw new Error(`Unknown function type "${a}"`);if(n){let c={},p=[];for(let m=0;m<t.stops.length;m++){let h=t.stops[m],d=h[0].zoom;c[d]===void 0&&(c[d]={zoom:d,type:t.type,property:t.property,default:t.default,stops:[]},p.push(d)),c[d].stops.push([h[0].value,h[1]])}let f=[];for(let m of p)f.push([c[m].zoom,Vu(c[m],e)]);let y={name:"linear"};return{kind:"composite",interpolationType:y,interpolationFactor:Je.interpolationFactor.bind(void 0,y),zoomStops:f.map(m=>m[0]),evaluate({zoom:m},h){return yu({stops:f,base:t.base},e,m).evaluate(m,h)}}}else if(o){let c=a==="exponential"?{name:"exponential",base:t.base!==void 0?t.base:1}:null;return{kind:"camera",interpolationType:c,interpolationFactor:Je.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?pn(t.default,e.default):s(t,e,f,l,u)}}}function pn(t,e,r){if(t!==void 0)return t;if(e!==void 0)return e;if(r!==void 0)return r}function Fh(t,e,r,n,i){let o=typeof r===i?n[r]:void 0;return pn(o,t.default,e.default)}function Lh(t,e,r){if(j(r)!=="number")return pn(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=Wi(t.stops.map(o=>o[0]),r);return t.stops[i][1]}function yu(t,e,r){let n=t.base!==void 0?t.base:1;if(j(r)!=="number")return pn(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=Wi(t.stops.map(c=>c[0]),r),a=Vh(r,n,t.stops[o][0],t.stops[o+1][0]),s=t.stops[o][1],l=t.stops[o+1][1],u=Oe[e.type]||Eh;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 Dh(t,e,r){switch(e.type){case"color":r=W.parse(r);break;case"formatted":r=Fe.fromString(r.toString());break;case"resolvedImage":r=Te.fromString(r.toString());break;case"padding":r=Ze.parse(r);break;default:j(r)!==e.type&&(e.type!=="enum"||!e.values[r])&&(r=void 0)}return pn(r,t.default,e.default)}function Vh(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 Ot=class{constructor(e,r){this.expression=e,this._warningHistory={},this._evaluator=new Fi,this._defaultValue=r?zh(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 ie(`Expected value to be one of ${Object.keys(this._enumValues).map(l=>JSON.stringify(l)).join(", ")}, but found ${JSON.stringify(s)} instead.`);return s}catch(s){return this._warningHistory[s.message]||(this._warningHistory[s.message]=!0,typeof console<"u"&&console.warn(s.message)),this._defaultValue}}};function Gt(t){return Array.isArray(t)&&t.length>0&&typeof t[0]=="string"&&t[0]in $t}function qt(t,e){let r=new Li($t,Gi,[],e?Bh(e):void 0),n=r.parse(t,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return n?ls(new Ot(n,e)):lr(r.errors)}var dt=class{constructor(e,r){this.kind=e,this._styleExpression=r,this.isStateDependent=e!=="constant"&&!an(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"&&!an(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?Je.interpolationFactor(this.interpolationType,e,r,n):0}};function Bu(t,e){let r=qt(t,e);if(r.result==="error")return r;let n=r.value.expression,i=Xi(n);if(!i&&!ht(e))return lr([new Be("","data expressions not supported")]);let o=Ki(n,["zoom"]);if(!o&&!Du(e))return lr([new Be("","zoom expressions not supported")]);let a=Ei(n);if(!a&&!o)return lr([new Be("",\'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.\')]);if(a instanceof Be)return lr([a]);if(a instanceof Je&&!hs(e))return lr([new Be("",\'"interpolate" expressions cannot be used with this property\')]);if(!a)return ls(i?new dt("constant",r.value):new dt("source",r.value));let s=a instanceof Je?a.interpolation:void 0;return ls(i?new gt("camera",r.value,a.labels,s):new gt("composite",r.value,a.labels,s))}var sn=class t{constructor(e,r){this._parameters=e,this._specification=r,pr(this,Vu(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 zu(t,e){if(Yi(t))return new sn(t,e);if(Gt(t)){let r=Bu(t,e);if(r.result==="error")throw new Error(r.value.map(n=>`${n.key}: ${n.message}`).join(", "));return r.value}else{let r=t;return e.type==="color"&&typeof t=="string"?r=W.parse(t):e.type==="padding"&&(typeof t=="number"||Array.isArray(t))?r=Ze.parse(t):e.type==="variableAnchorOffsetCollection"&&Array.isArray(t)&&(r=Ne.parse(t)),{kind:"constant",evaluate:()=>r}}}function Ei(t){let e=null;if(t instanceof Di)e=Ei(t.result);else if(t instanceof zi){for(let r of t.args)if(e=Ei(r),e)break}else(t instanceof fr||t instanceof Je)&&t.input instanceof Ke&&t.input.name==="zoom"&&(e=t);return e instanceof Be||t.eachChild(r=>{let n=Ei(r);n instanceof Be?e=n:!e&&n?e=new Be("",\'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.\'):e&&n&&e!==n&&(e=new Be("",\'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.\'))}),e}function Bh(t){let e={color:Re,string:G,number:L,enum:G,boolean:U,formatted:hr,padding:Ji,resolvedImage:un,variableAnchorOffsetCollection:Zi};return t.type==="array"?Ee(e[t.value]||$,t.length):e[t.type]}function zh(t){return t.type==="color"&&Yi(t.default)?new W(0,0,0,0):t.type==="color"?W.parse(t.default)||null:t.type==="padding"?Ze.parse(t.default)||null:t.type==="variableAnchorOffsetCollection"?Ne.parse(t.default)||null:t.default===void 0?null:t.default}function ds(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(!ds(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}var Rh={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function fn(t){if(t==null)return{filter:()=>!0,needGeometry:!1};ds(t)||(t=qi(t));let e=qt(t,Rh);if(e.result==="error")throw new Error(e.value.map(r=>`${r.key}: ${r.message}`).join(", "));{let r=Ru(t);return{filter:(n,i,o)=>e.value.evaluate(n,i,{},o),needGeometry:r}}}function Oh(t,e){return t<e?-1:t>e?1:0}function Ru(t){if(!Array.isArray(t))return!1;if(t[0]==="within"||t[0]==="distance")return!0;for(let e=1;e<t.length;e++)if(Ru(t[e]))return!0;return!1}function qi(t){if(!t)return!0;let e=t[0];return t.length<=1?e!=="any":e==="=="?Ja(t[1],t[2],"=="):e==="!="?Mi(Ja(t[1],t[2],"==")):e==="<"||e===">"||e==="<="||e===">="?Ja(t[1],t[2],e):e==="any"?Nh(t.slice(1)):e==="all"?["all"].concat(t.slice(1).map(qi)):e==="none"?["all"].concat(t.slice(1).map(qi).map(Mi)):e==="in"?mu(t[1],t.slice(2)):e==="!in"?Mi(mu(t[1],t.slice(2))):e==="has"?hu(t[1]):e==="!has"?Mi(hu(t[1])):!0}function Ja(t,e,r){switch(t){case"$type":return[`filter-type-${r}`,e];case"$id":return[`filter-id-${r}`,e];default:return[`filter-${r}`,t,e]}}function Nh(t){return["any"].concat(t.map(qi))}function mu(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(Oh)]]:["filter-in-small",t,["literal",e]]}}function hu(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function Mi(t){return["!",t]}function us(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+=`${us(o)},`;return`${i}]`}let r=Object.keys(t).sort(),n="{";for(let i=0;i<r.length;i++)n+=`${JSON.stringify(r[i])}:${us(t[r[i]])},`;return`${n}}`}function Uh(t){let e="";for(let r of gm)e+=`/${us(t[r])}`;return e}function Ou(t,e){let r={};for(let i=0;i<t.length;i++){let o=e&&e[t[i].id]||Uh(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 Nu(t){let e=t.key,r=t.value;return r?[new M(e,r,"constants have been deprecated as of v8")]:[]}function ae(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function Nt(t){if(Array.isArray(t))return t.map(Nt);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){let e={};for(let r in t)e[r]=Nt(t[r]);return e}return ae(t)}function ze(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 M(e,r,`object expected, ${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 M(e,r[c],`unknown property "${c}"`));continue}l=l.concat(y({key:(e&&`${e}.`)+c,value:r[c],valueSpec:f,style:o,styleSpec:a,object:r,objectKey:c,validateSpec:s},r))}for(let c in n)i[c]||n[c].required&&n[c].default===void 0&&r[c]===void 0&&l.push(new M(e,r,`missing required property "${c}"`));return l}function gs(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 M(a,e,`array expected, ${j(e)} found`)];if(r.length&&e.length!==r.length)return[new M(a,e,`array length ${r.length} expected, length ${e.length} found`)];if(r["min-length"]&&e.length<r["min-length"])return[new M(a,e,`array length at least ${r["min-length"]} expected, length ${e.length} found`)];let l={type:r.value,values:r.values};o.$version<7&&(l.function=r.function),j(r.value)==="object"&&(l=r.value);let u=[];for(let c=0;c<e.length;c++)u=u.concat(s({array:e,arrayIndex:c,value:e[c],valueSpec:l,validateSpec:t.validateSpec,style:i,styleSpec:o,key:`${a}[${c}]`}));return u}function xs(t){let e=t.key,r=t.value,n=t.valueSpec,i=j(r);return i==="number"&&r!==r&&(i="NaN"),i!=="number"?[new M(e,r,`number expected, ${i} found`)]:"minimum"in n&&r<n.minimum?[new M(e,r,`${r} is less than the minimum value ${n.minimum}`)]:"maximum"in n&&r>n.maximum?[new M(e,r,`${r} is greater than the maximum value ${n.maximum}`)]:[]}function Uu(t){let e=t.valueSpec,r=ae(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=ze({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 M(t.key,t.value,\'missing required property "property"\')),r!=="identity"&&!t.value.stops&&c.push(new M(t.key,t.value,\'missing required property "stops"\')),r==="exponential"&&t.valueSpec.expression&&!hs(t.valueSpec)&&c.push(new M(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!ht(t.valueSpec)?c.push(new M(t.key,t.value,"property functions not supported")):s&&!Du(t.valueSpec)&&c.push(new M(t.key,t.value,"zoom functions not supported"))),(r==="categorical"||u)&&t.value.property===void 0&&c.push(new M(t.key,t.value,\'"property" property is required\')),c;function p(h){if(r==="identity")return[new M(h.key,h.value,\'identity function may not have a "stops" property\')];let d=[],g=h.value;return d=d.concat(gs({key:h.key,value:g,valueSpec:h.valueSpec,validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec,arrayElementValidator:f})),j(g)==="array"&&g.length===0&&d.push(new M(h.key,g,"array must have at least one stop")),d}function f(h){let d=[],g=h.value,b=h.key;if(j(g)!=="array")return[new M(b,g,`array expected, ${j(g)} found`)];if(g.length!==2)return[new M(b,g,`array length 2 expected, length ${g.length} found`)];if(u){if(j(g[0])!=="object")return[new M(b,g,`object expected, ${j(g[0])} found`)];if(g[0].zoom===void 0)return[new M(b,g,"object stop key must have zoom")];if(g[0].value===void 0)return[new M(b,g,"object stop key must have value")];if(a&&a>ae(g[0].zoom))return[new M(b,g[0].zoom,"stop zoom values must appear in ascending order")];ae(g[0].zoom)!==a&&(a=ae(g[0].zoom),o=void 0,i={}),d=d.concat(ze({key:`${b}[0]`,value:g[0],valueSpec:{zoom:{}},validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec,objectElementValidators:{zoom:xs,value:y}}))}else d=d.concat(y({key:`${b}[0]`,value:g[0],valueSpec:{},validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec},g));return Gt(Nt(g[1]))?d.concat([new M(`${b}[1]`,g[1],"expressions are not allowed in function stops.")]):d.concat(h.validateSpec({key:`${b}[1]`,value:g[1],valueSpec:e,validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec}))}function y(h,d){let g=j(h.value),b=ae(h.value),x=h.value!==null?h.value:d;if(!n)n=g;else if(g!==n)return[new M(h.key,x,`${g} stop domain type must match previous stop domain type ${n}`)];if(g!=="number"&&g!=="string"&&g!=="boolean")return[new M(h.key,x,"stop domain value must be a number, string, or boolean")];if(g!=="number"&&r!=="categorical"){let v=`number expected, ${g} found`;return ht(e)&&r===void 0&&(v+=\'\\nIf you intended to use a categorical function, specify `"type": "categorical"`.\'),[new M(h.key,x,v)]}return r==="categorical"&&g==="number"&&(!isFinite(b)||Math.floor(b)!==b)?[new M(h.key,x,`integer expected, found ${b}`)]:r!=="categorical"&&g==="number"&&o!==void 0&&b<o?[new M(h.key,x,"stop domain values must appear in ascending order")]:(o=b,r==="categorical"&&b in i?[new M(h.key,x,"stop domain values must be unique")]:(i[b]=!0,[]))}function m(h){return h.validateSpec({key:h.key,value:h.value,valueSpec:e,validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec})}}function yr(t){let e=(t.expressionContext==="property"?Bu:qt)(Nt(t.value),t.valueSpec);if(e.result==="error")return e.value.map(n=>new M(`${t.key}${n.key}`,t.value,n.message));let r=e.value.expression||e.value._styleExpression.expression;if(t.expressionContext==="property"&&t.propertyKey==="text-font"&&!r.outputDefined())return[new M(t.key,t.value,`Invalid data expression for "${t.propertyKey}". Output values must be contained as literals within the expression.`)];if(t.expressionContext==="property"&&t.propertyType==="layout"&&!an(r))return[new M(t.key,t.value,\'"feature-state" data expressions are not supported with layout properties.\')];if(t.expressionContext==="filter"&&!an(r))return[new M(t.key,t.value,\'"feature-state" data expressions are not supported with filters.\')];if(t.expressionContext&&t.expressionContext.indexOf("cluster")===0){if(!Ki(r,["zoom","feature-state"]))return[new M(t.key,t.value,\'"zoom" and "feature-state" expressions are not supported with cluster properties.\')];if(t.expressionContext==="cluster-initial"&&!Xi(r))return[new M(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function $h(t){let e=t.value,r=t.key,n=j(e);return n!=="boolean"?[new M(r,e,`boolean expected, ${n} found`)]:[]}function Gh(t){let e=t.key,r=t.value,n=j(r);return n!=="string"?[new M(e,r,`color expected, ${n} found`)]:W.parse(String(r))?[]:[new M(e,r,`color expected, "${r}" found`)]}function ln(t){let e=t.key,r=t.value,n=t.valueSpec,i=[];return Array.isArray(n.values)?n.values.indexOf(ae(r))===-1&&i.push(new M(e,r,`expected one of [${n.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(n.values).indexOf(ae(r))===-1&&i.push(new M(e,r,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(r)} found`)),i}function bs(t){return ds(Nt(t.value))?yr(pr({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}})):$u(t)}function $u(t){let e=t.value,r=t.key;if(j(e)!=="array")return[new M(r,e,`array expected, ${j(e)} found`)];let n=t.styleSpec,i,o=[];if(e.length<1)return[new M(r,e,"filter array must have at least 1 element")];switch(o=o.concat(ln({key:`${r}[0]`,value:e[0],valueSpec:n.filter_operator,style:t.style,styleSpec:t.styleSpec})),ae(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&ae(e[1])==="$type"&&o.push(new M(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&o.push(new M(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(i=j(e[1]),i!=="string"&&o.push(new M(`${r}[1]`,e[1],`string expected, ${i} found`)));for(let a=2;a<e.length;a++)i=j(e[a]),ae(e[1])==="$type"?o=o.concat(ln({key:`${r}[${a}]`,value:e[a],valueSpec:n.geometry_type,style:t.style,styleSpec:t.styleSpec})):i!=="string"&&i!=="number"&&i!=="boolean"&&o.push(new M(`${r}[${a}]`,e[a],`string, number, or boolean expected, ${i} found`));break;case"any":case"all":case"none":for(let a=1;a<e.length;a++)o=o.concat($u({key:`${r}[${a}]`,value:e[a],style:t.style,styleSpec:t.styleSpec}));break;case"has":case"!has":i=j(e[1]),e.length!==2?o.push(new M(r,e,`filter array for "${e[0]}" operator must have 2 elements`)):i!=="string"&&o.push(new M(`${r}[1]`,e[1],`string expected, ${i} found`));break}return o}function Gu(t,e){let r=t.key,n=t.validateSpec,i=t.style,o=t.styleSpec,a=t.value,s=t.objectKey,l=o[`${e}_${t.layerType}`];if(!l)return[];let u=s.match(/^(.*)-transition$/);if(e==="paint"&&u&&l[u[1]]&&l[u[1]].transition)return n({key:r,value:a,valueSpec:o.transition,style:i,styleSpec:o});let c=t.valueSpec||l[s];if(!c)return[new M(r,a,`unknown property "${s}"`)];let p;if(j(a)==="string"&&ht(c)&&!c.tokens&&(p=/^{([^}]+)}$/.exec(a)))return[new M(r,a,`"${s}" does not support interpolation syntax\nUse an identity property function instead: \\`{ "type": "identity", "property": ${JSON.stringify(p[1])} }\\`.`)];let f=[];return t.layerType==="symbol"&&(s==="text-field"&&i&&!i.glyphs&&f.push(new M(r,a,\'use of "text-field" requires a style "glyphs" property\')),s==="text-font"&&Yi(Nt(a))&&ae(a.type)==="identity"&&f.push(new M(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 qu(t){return Gu(t,"paint")}function ju(t){return Gu(t,"layout")}function Ju(t){let e=[],r=t.value,n=t.key,i=t.style,o=t.styleSpec;!r.type&&!r.ref&&e.push(new M(n,r,\'either "type" or "ref" is required\'));let a=ae(r.type),s=ae(r.ref);if(r.id){let l=ae(r.id);for(let u=0;u<t.arrayIndex;u++){let c=i.layers[u];ae(c.id)===l&&e.push(new M(n,r.id,`duplicate layer id "${r.id}", previously used at line ${c.id.__line__}`))}}if("ref"in r){["type","source","source-layer","filter","layout"].forEach(u=>{u in r&&e.push(new M(n,r[u],`"${u}" is prohibited for ref layers`))});let l;i.layers.forEach(u=>{ae(u.id)===s&&(l=u)}),l?l.ref?e.push(new M(n,r.ref,"ref cannot reference another ref layer")):a=ae(l.type):e.push(new M(n,r.ref,`ref layer "${s}" not found`))}else if(a!=="background")if(!r.source)e.push(new M(n,r,\'missing required property "source"\'));else{let l=i.sources&&i.sources[r.source],u=l&&ae(l.type);l?u==="vector"&&a==="raster"?e.push(new M(n,r.source,`layer "${r.id}" requires a raster source`)):u!=="raster-dem"&&a==="hillshade"?e.push(new M(n,r.source,`layer "${r.id}" requires a raster-dem source`)):u==="raster"&&a!=="raster"?e.push(new M(n,r.source,`layer "${r.id}" requires a vector source`)):u==="vector"&&!r["source-layer"]?e.push(new M(n,r,`layer "${r.id}" must specify a "source-layer"`)):u==="raster-dem"&&a!=="hillshade"?e.push(new M(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 M(n,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \\`lineMetrics\\` enabled.`)):e.push(new M(n,r.source,`source "${r.source}" not found`))}return e=e.concat(ze({key:n,value:r,valueSpec:o.layer,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*"(){return[]},type(){return t.validateSpec({key:`${n}.type`,value:r.type,valueSpec:o.layer.type,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,object:r,objectKey:"type"})},filter:bs,layout(l){return ze({layer:r,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return ju(pr({layerType:a},u))}}})},paint(l){return ze({layer:r,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return qu(pr({layerType:a},u))}}})}}})),e}function Ut(t){let e=t.value,r=t.key,n=j(e);return n!=="string"?[new M(r,e,`string expected, ${n} found`)]:[]}function qh(t){var e;let r=(e=t.sourceName)!==null&&e!==void 0?e:"",n=t.value,i=t.styleSpec,o=i.source_raster_dem,a=t.style,s=[],l=j(n);if(n===void 0)return s;if(l!=="object")return s.push(new M("source_raster_dem",n,`object expected, ${l} found`)),s;let c=ae(n.encoding)==="custom",p=["redFactor","greenFactor","blueFactor","baseShift"],f=t.value.encoding?`"${t.value.encoding}"`:"Default";for(let y in n)!c&&p.includes(y)?s.push(new M(y,n[y],`In "${r}": "${y}" is only valid when "encoding" is set to "custom". ${f} encoding found`)):o[y]?s=s.concat(t.validateSpec({key:y,value:n[y],valueSpec:o[y],validateSpec:t.validateSpec,style:a,styleSpec:i})):s.push(new M(y,n[y],`unknown property "${y}"`));return s}var du={promoteId:jh};function Zu(t){let e=t.value,r=t.key,n=t.styleSpec,i=t.style,o=t.validateSpec;if(!e.type)return[new M(r,e,\'"type" is required\')];let a=ae(e.type),s;switch(a){case"vector":case"raster":return s=ze({key:r,value:e,valueSpec:n[`source_${a.replace("-","_")}`],style:t.style,styleSpec:n,objectElementValidators:du,validateSpec:o}),s;case"raster-dem":return s=qh({sourceName:r,value:e,style:t.style,styleSpec:n,validateSpec:o}),s;case"geojson":if(s=ze({key:r,value:e,valueSpec:n.source_geojson,style:i,styleSpec:n,validateSpec:o,objectElementValidators:du}),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(...yr({key:`${r}.${l}.map`,value:c,validateSpec:o,expressionContext:"cluster-map"})),s.push(...yr({key:`${r}.${l}.reduce`,value:p,validateSpec:o,expressionContext:"cluster-reduce"}))}return s;case"video":return ze({key:r,value:e,valueSpec:n.source_video,style:i,validateSpec:o,styleSpec:n});case"image":return ze({key:r,value:e,valueSpec:n.source_image,style:i,validateSpec:o,styleSpec:n});case"canvas":return[new M(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return ln({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:i,validateSpec:o,styleSpec:n})}}function jh({key:t,value:e}){if(j(e)==="string")return Ut({key:t,value:e});{let r=[];for(let n in e)r.push(...Ut({key:`${t}.${n}`,value:e[n]}));return r}}function Wu(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 M("light",e,`object expected, ${a} found`)]),o;for(let s in e){let l=s.match(/^(.*)-transition$/);l&&n[l[1]]&&n[l[1]].transition?o=o.concat(t.validateSpec({key:s,value:e[s],valueSpec:r.transition,validateSpec:t.validateSpec,style:i,styleSpec:r})):n[s]?o=o.concat(t.validateSpec({key:s,value:e[s],valueSpec:n[s],validateSpec:t.validateSpec,style:i,styleSpec:r})):o=o.concat([new M(s,e[s],`unknown property "${s}"`)])}return o}function Hu(t){let e=t.value,r=t.styleSpec,n=r.sky,i=t.style,o=j(e);if(e===void 0)return[];if(o!=="object")return[new M("sky",e,`object expected, ${o} found`)];let a=[];for(let s in e)n[s]?a=a.concat(t.validateSpec({key:s,value:e[s],valueSpec:n[s],style:i,styleSpec:r})):a=a.concat([new M(s,e[s],`unknown property "${s}"`)]);return a}function Xu(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 M("terrain",e,`object expected, ${a} found`)]),o;for(let s in e)n[s]?o=o.concat(t.validateSpec({key:s,value:e[s],valueSpec:n[s],validateSpec:t.validateSpec,style:i,styleSpec:r})):o=o.concat([new M(s,e[s],`unknown property "${s}"`)]);return o}function Jh(t){return Ut(t).length===0?[]:yr(t)}function Zh(t){return Ut(t).length===0?[]:yr(t)}function Wh(t){let e=t.key,r=t.value;if(j(r)==="array"){if(r.length<1||r.length>4)return[new M(e,r,`padding requires 1 to 4 values; ${r.length} values found`)];let i={type:"number"},o=[];for(let a=0;a<r.length;a++)o=o.concat(t.validateSpec({key:`${e}[${a}]`,value:r[a],validateSpec:t.validateSpec,valueSpec:i}));return o}else return xs({key:e,value:r,valueSpec:{}})}function Hh(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 M(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(ln({key:`${e}[${a}]`,value:r[a],valueSpec:i.layout_symbol["text-anchor"]})),o=o.concat(gs({key:`${e}[${a+1}]`,value:r[a+1],valueSpec:{length:2,value:"number"},validateSpec:t.validateSpec,style:t.style,styleSpec:i}));return o}function Ku(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 M(n,r,`all the sprites\' ids must be unique, but ${r[a].id} is duplicated`)),i.push(r[a].id),r[a].url&&o.includes(r[a].url)&&e.push(new M(n,r,`all the sprites\' URLs must be unique, but ${r[a].url} is duplicated`)),o.push(r[a].url);let s={id:{type:"string",required:!0},url:{type:"string",required:!0}};e=e.concat(ze({key:`${n}[${a}]`,value:r[a],valueSpec:s,validateSpec:t.validateSpec}))}return e}else return Ut({key:n,value:r})}function Xh(t){let e=t.value,r=t.styleSpec,n=r.projection,i=t.style,o=j(e);if(e===void 0)return[];if(o!=="object")return[new M("projection",e,`object expected, ${o} found`)];let a=[];for(let s in e)n[s]?a=a.concat(t.validateSpec({key:s,value:e[s],valueSpec:n[s],style:i,styleSpec:r})):a=a.concat([new M(s,e[s],`unknown property "${s}"`)]);return a}var gu={"*"(){return[]},array:gs,boolean:$h,number:xs,color:Gh,constants:Nu,enum:ln,filter:bs,function:Uu,layer:Ju,object:ze,source:Zu,light:Wu,sky:Hu,terrain:Xu,projection:Xh,string:Ut,formatted:Jh,resolvedImage:Zh,padding:Wh,variableAnchorOffsetCollection:Hh,sprite:Ku};function Hr(t){let e=t.value,r=t.valueSpec,n=t.styleSpec;return t.validateSpec=Hr,r.expression&&Yi(ae(e))?Uu(t):r.expression&&Gt(Nt(e))?yr(t):r.type&&gu[r.type]?gu[r.type](t):ze(pr({},t,{valueSpec:r.type?n[r.type]:r}))}function Yu(t){let e=t.value,r=t.key,n=Ut(t);return n.length||(e.indexOf("{fontstack}")===-1&&n.push(new M(r,e,\'"glyphs" url must include a "{fontstack}" token\')),e.indexOf("{range}")===-1&&n.push(new M(r,e,\'"glyphs" url must include a "{range}" token\'))),n}function Ue(t,e=S){let r=[];return r=r.concat(Hr({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,validateSpec:Hr,objectElementValidators:{glyphs:Yu,"*"(){return[]}}})),t.constants&&(r=r.concat(Nu({key:"constants",value:t.constants,style:t,styleSpec:e,validateSpec:Hr}))),Qu(r)}Ue.source=Qe(Ye(Zu));Ue.sprite=Qe(Ye(Ku));Ue.glyphs=Qe(Ye(Yu));Ue.light=Qe(Ye(Wu));Ue.sky=Qe(Ye(Hu));Ue.terrain=Qe(Ye(Xu));Ue.layer=Qe(Ye(Ju));Ue.filter=Qe(Ye(bs));Ue.paintProperty=Qe(Ye(qu));Ue.layoutProperty=Qe(Ye(ju));function Ye(t){return function(e){return t({...e,validateSpec:Hr})}}function Qu(t){return[].concat(t).sort((e,r)=>e.line-r.line)}function Qe(t){return function(...e){return Qu(t.apply(this,e))}}var ec="AbortError";function tc(t){return t.message===ec}function vs(){return new Error(ec)}var Qi={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function rc(t){return Qi.REGISTERED_PROTOCOLS[t.substring(0,t.indexOf("://"))]}function nc(t,e){Qi.REGISTERED_PROTOCOLS[t]=e}function ic(t){delete Qi.REGISTERED_PROTOCOLS[t]}var oc="global-dispatcher",xr=class extends Error{constructor(e,r,n,i){super(`AJAXError: ${r} (${e}): ${n}`),this.status=e,this.statusText=r,this.url=n,this.body=i}},sc=()=>at(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,Kh=t=>/^file:/.test(t)||/^file:/.test(sc())&&!/^\\w+:/.test(t);async function Yh(t,e){let r=new Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,cache:t.cache,referrer:sc(),signal:e.signal});t.type==="json"&&r.headers.set("Accept","application/json");let n=await fetch(r);if(!n.ok){let a=await n.blob();throw new xr(n.status,n.statusText,t.url,a)}let i;t.type==="arrayBuffer"||t.type==="image"?i=n.arrayBuffer():t.type==="json"?i=n.json():i=n.text();let o=await i;if(e.signal.aborted)throw vs();return{data:o,cacheControl:n.headers.get("Cache-Control"),expires:n.headers.get("Expires")}}function Qh(t,e){return new Promise((r,n)=>{let i=new XMLHttpRequest;i.open(t.method||"GET",t.url,!0),(t.type==="arrayBuffer"||t.type==="image")&&(i.responseType="arraybuffer");for(let o in t.headers)i.setRequestHeader(o,t.headers[o]);t.type==="json"&&(i.responseType="text",i.setRequestHeader("Accept","application/json")),i.withCredentials=t.credentials==="include",i.onerror=()=>{n(new Error(i.statusText))},i.onload=()=>{if(!e.signal.aborted)if((i.status>=200&&i.status<300||i.status===0)&&i.response!==null){let o=i.response;if(t.type==="json")try{o=JSON.parse(i.response)}catch(a){n(a);return}r({data:o,cacheControl:i.getResponseHeader("Cache-Control"),expires:i.getResponseHeader("Expires")})}else{let o=new Blob([i.response],{type:i.getResponseHeader("Content-Type")});n(new xr(i.status,i.statusText,t.url,o))}},e.signal.addEventListener("abort",()=>{i.abort(),n(vs())}),i.send(t.body)})}var lc=function(t,e){if(/:\\/\\//.test(t.url)&&!/^https?:|^file:/.test(t.url)){let r=rc(t.url);if(r)return r(t,e);if(at(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:t,targetMapId:oc},e)}if(!Kh(t.url)){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return Yh(t,e);if(at(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:t,mustQueue:!0,targetMapId:oc},e)}return Qh(t,e)},uc=(t,e)=>lc(Pe(t,{type:"json"}),e),cc=(t,e)=>lc(Pe(t,{type:"arrayBuffer"}),e);var xt={};function C(t,e,r={}){if(xt[t])throw new Error(`${t} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),xt[t]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}C("Object",Object);C("TransferableGridIndex",Dt);C("Color",W);C("Error",Error);C("AJAXError",xr);C("ResolvedImage",Te);C("StylePropertyFunction",sn);C("StyleExpression",Ot,{omit:["_evaluator"]});C("ZoomDependentExpression",gt);C("ZoomConstantExpression",dt);C("CompoundExpression",Ke,{omit:["_evaluate"]});for(let t in $t)$t[t]._classRegistryKey||C(`Expression_${t}`,$t[t]);function pc(t){return t&&typeof ArrayBuffer<"u"&&(t instanceof ArrayBuffer||t.constructor&&t.constructor.name==="ArrayBuffer")}function br(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||t instanceof Error)return t;if(pc(t)||jr(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(br(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 ${r.name}`);if(!xt[n])throw new Error(`${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:br(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 ${typeof t}`)}function vr(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||t instanceof Error||pc(t)||jr(t)||ArrayBuffer.isView(t)||t instanceof ImageData)return t;if(Array.isArray(t))return t.map(vr);if(typeof t=="object"){let e=t.$name||"Object";if(!xt[e])throw new Error(`can\'t deserialize unregistered class ${e}`);let{klass:r}=xt[e];if(!r)throw new Error(`can\'t deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(t);let n=Object.create(r.prototype);for(let i of Object.keys(t)){if(i==="$name")continue;let o=t[i];n[i]=xt[e].shallow.indexOf(i)>=0?o:vr(o)}return n}throw new Error(`can\'t deserialize object of type ${typeof t}`)}var eo=class{constructor(e){this._methodToThrottle=e,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}};var to=class{constructor(e,r){this.target=e,this.mapId=r,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new eo(()=>this.process()),this.subscription=Xl(this.target,"message",n=>this.receive(n),!1),this.globalScope=at(self)?e:window}registerMessageHandler(e,r){this.messageHandlers[e]=r}sendAsync(e,r){return new Promise((n,i)=>{let o=Math.round(Math.random()*1e18).toString(36).substring(0,10);this.resolveRejects[o]={resolve:n,reject:i},r&&r.signal.addEventListener("abort",()=>{delete this.resolveRejects[o];let l={id:o,type:"<cancel>",origin:location.origin,targetMapId:e.targetMapId,sourceMapId:this.mapId};this.target.postMessage(l)},{once:!0});let a=[],s={...e,id:o,sourceMapId:this.mapId,origin:location.origin,data:br(e.data,a)};this.target.postMessage(s,{transfer:a})})}receive(e){let r=e.data,n=r.id;if(!(r.origin!=="file://"&&location.origin!=="file://"&&r.origin!==location.origin)&&!(r.targetMapId&&this.mapId!==r.targetMapId)){if(r.type==="<cancel>"){delete this.tasks[n];let i=this.abortControllers[n];delete this.abortControllers[n],i&&i.abort();return}if(at(self)||r.mustQueue){this.tasks[n]=r,this.taskQueue.push(n),this.invoker.trigger();return}this.processTask(n,r)}}process(){if(this.taskQueue.length===0)return;let e=this.taskQueue.shift(),r=this.tasks[e];delete this.tasks[e],this.taskQueue.length>0&&this.invoker.trigger(),r&&this.processTask(e,r)}async processTask(e,r){if(r.type==="<response>"){let o=this.resolveRejects[e];if(delete this.resolveRejects[e],!o)return;r.error?o.reject(vr(r.error)):o.resolve(vr(r.data));return}if(!this.messageHandlers[r.type]){this.completeTask(e,new Error(`Could not find a registered handler for ${r.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));return}let n=vr(r.data),i=new AbortController;this.abortControllers[e]=i;try{let o=await this.messageHandlers[r.type](r.sourceMapId,n,i);this.completeTask(e,null,o)}catch(o){this.completeTask(e,o)}}completeTask(e,r,n){let i=[];delete this.abortControllers[e];let o={id:e,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:r?br(r):null,data:br(n,i)};this.target.postMessage(o,{transfer:i})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}};function fc(t,e,r){r[t]&&r[t].indexOf(e)!==-1||(r[t]=r[t]||[],r[t].push(e))}function Ps(t,e,r){if(r&&r[t]){let n=r[t].indexOf(e);n!==-1&&r[t].splice(n,1)}}var ro=class{constructor(e,r={}){Pe(this,r),this.type=e}},yn=class extends ro{constructor(e,r={}){super("error",Pe({error:e},r))}},no=class{on(e,r){return this._listeners=this._listeners||{},fc(e,r,this._listeners),this}off(e,r){return Ps(e,r,this._listeners),Ps(e,r,this._oneTimeListeners),this}once(e,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},fc(e,r,this._oneTimeListeners),this):new Promise(n=>this.once(e,n))}fire(e,r){typeof e=="string"&&(e=new ro(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)Ps(n,s,this._oneTimeListeners),s.call(this,e);let a=this._eventedParent;a&&(Pe(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),a.fire(e))}else e instanceof yn&&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=Ue,J0=bt.source,Z0=bt.light,W0=bt.terrain,H0=bt.filter,yc=bt.paintProperty,mc=bt.layoutProperty;function hc(t,e){let r=!1;if(e&&e.length)for(let n of e)t.fire(new yn(new Error(n.message))),r=!0;return r}var io=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 D={"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 mn(t){for(let e of t)if(oo(e.charCodeAt(0)))return!0;return!1}function dc(t){for(let e of t)if(!ed(e.charCodeAt(0)))return!1;return!0}function ed(t){return!(D.Arabic(t)||D["Arabic Supplement"](t)||D["Arabic Extended-A"](t)||D["Arabic Presentation Forms-A"](t)||D["Arabic Presentation Forms-B"](t))}function gc(t){return t<11904?!1:!!(D["Bopomofo Extended"](t)||D.Bopomofo(t)||D["CJK Compatibility Forms"](t)||D["CJK Compatibility Ideographs"](t)||D["CJK Compatibility"](t)||D["CJK Radicals Supplement"](t)||D["CJK Strokes"](t)||D["CJK Symbols and Punctuation"](t)||D["CJK Unified Ideographs Extension A"](t)||D["CJK Unified Ideographs"](t)||D["Enclosed CJK Letters and Months"](t)||D["Halfwidth and Fullwidth Forms"](t)||D.Hiragana(t)||D["Ideographic Description Characters"](t)||D["Kangxi Radicals"](t)||D["Katakana Phonetic Extensions"](t)||D.Katakana(t)||D["Vertical Forms"](t)||D["Yi Radicals"](t)||D["Yi Syllables"](t))}function oo(t){return t===746||t===747?!0:t<4352?!1:!!(D["Bopomofo Extended"](t)||D.Bopomofo(t)||D["CJK Compatibility Forms"](t)&&!(t>=65097&&t<=65103)||D["CJK Compatibility Ideographs"](t)||D["CJK Compatibility"](t)||D["CJK Radicals Supplement"](t)||D["CJK Strokes"](t)||D["CJK Symbols and Punctuation"](t)&&!(t>=12296&&t<=12305)&&!(t>=12308&&t<=12319)&&t!==12336||D["CJK Unified Ideographs Extension A"](t)||D["CJK Unified Ideographs"](t)||D["Enclosed CJK Letters and Months"](t)||D["Hangul Compatibility Jamo"](t)||D["Hangul Jamo Extended-A"](t)||D["Hangul Jamo Extended-B"](t)||D["Hangul Jamo"](t)||D["Hangul Syllables"](t)||D.Hiragana(t)||D["Ideographic Description Characters"](t)||D.Kanbun(t)||D["Kangxi Radicals"](t)||D["Katakana Phonetic Extensions"](t)||D.Katakana(t)&&t!==12540||D["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)||D["Small Form Variants"](t)&&!(t>=65112&&t<=65118)&&!(t>=65123&&t<=65126)||D["Unified Canadian Aboriginal Syllabics"](t)||D["Unified Canadian Aboriginal Syllabics Extended"](t)||D["Vertical Forms"](t)||D["Yijing Hexagram Symbols"](t)||D["Yi Syllables"](t)||D["Yi Radicals"](t))}function td(t){return!!(D["Latin-1 Supplement"](t)&&(t===167||t===169||t===174||t===177||t===188||t===189||t===190||t===215||t===247)||D["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)||D["Letterlike Symbols"](t)||D["Number Forms"](t)||D["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)||D["Control Pictures"](t)&&t!==9251||D["Optical Character Recognition"](t)||D["Enclosed Alphanumerics"](t)||D["Geometric Shapes"](t)||D["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||D["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||D["CJK Symbols and Punctuation"](t)||D.Katakana(t)||D["Private Use Area"](t)||D["CJK Compatibility Forms"](t)||D["Small Form Variants"](t)||D["Halfwidth and Fullwidth Forms"](t)||t===8734||t===8756||t===8757||t>=9984&&t<=10087||t>=10102&&t<=10131||t===65532||t===65533)}function Ss(t){return!(oo(t)||td(t))}function xc(t){return D.Arabic(t)||D["Arabic Supplement"](t)||D["Arabic Extended-A"](t)||D["Arabic Presentation Forms-A"](t)||D["Arabic Presentation Forms-B"](t)}function bc(t){return t>=1424&&t<=2303||D["Arabic Presentation Forms-A"](t)||D["Arabic Presentation Forms-B"](t)}function rd(t,e){return!(!e&&bc(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||D.Khmer(t))}function vc(t){for(let e of t)if(bc(e.charCodeAt(0)))return!0;return!1}function Pc(t,e){for(let r of t)if(!rd(r.charCodeAt(0),e))return!1;return!0}var ws=class{constructor(){this.applyArabicShaping=null;this.processBidirectionalText=null;this.processStyledBidirectionalText=null;this.pluginStatus="unavailable";this.pluginURL=null}setState(e){this.pluginStatus=e.pluginStatus,this.pluginURL=e.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(e){this.applyArabicShaping=e.applyArabicShaping,this.processBidirectionalText=e.processBidirectionalText,this.processStyledBidirectionalText=e.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}},ye=new ws;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 io,this.transition={})}isSupportedScript(e){return Pc(e,ye.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let e=this.zoom,r=e-Math.floor(e),n=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*n}:{fromScale:.5,toScale:1,t:1-(1-n)*r}}};var Pr=class{constructor(e,r){this.property=e,this.value=r,this.expression=zu(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)}},hn=class{constructor(e){this.property=e,this.value=new Pr(e,void 0)}transitioned(e,r){return new so(this.property,this.value,r,Pe({},e.transition,this.transition),e.now)}untransitioned(){return new so(this.property,this.value,null,{},0)}},ao=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return nt(this._values[e].value.value)}setValue(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new hn(this._values[e].property)),this._values[e].value=new Pr(this._values[e].property,r===null?void 0:nt(r))}getTransition(e){return nt(this._values[e].transition)}setTransition(e,r){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new hn(this._values[e].property)),this._values[e].transition=nt(r)||void 0}serialize(){let e={};for(let r of Object.keys(this._values)){let n=this.getValue(r);n!==void 0&&(e[r]=n);let i=this.getTransition(r);i!==void 0&&(e[`${r}-transition`]=i)}return e}transitioned(e,r){let n=new lo(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 lo(this._properties);for(let r of Object.keys(this._values))e._values[r]=this._values[r].untransitioned();return e}},so=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,Gl(s))}}else return o}},lo=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}},uo=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}hasValue(e){return this._values[e].value!==void 0}getValue(e){return nt(this._values[e].value)}setValue(e,r){this._values[e]=new Pr(this._values[e].property,r===null?void 0:nt(r))}serialize(){let e={};for(let r of Object.keys(this._values)){let n=this.getValue(r);n!==void 0&&(e[r]=n)}return e}possiblyEvaluate(e,r,n){let i=new vt(this._properties);for(let o of Object.keys(this._values))i._values[o]=this._values[o].possiblyEvaluate(e,r,n);return i}},Se=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=Oe[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 Se(this,{kind:"constant",value:e.expression.evaluate(r,null,{},n,i)},r):new Se(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 Se(this,{kind:"constant",value:void 0},e.parameters);let i=this.specification.type,o=Oe[i];if(o){let a=o(e.value.value,r.value.value,n);return new Se(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)}},lt=class extends R{possiblyEvaluate(e,r,n,i){if(e.value===void 0)return new Se(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 Se(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 Se(this,{kind:"constant",value:o},r)}else return new Se(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}},jt=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}},Jt=class{constructor(e){this.specification=e}possiblyEvaluate(e,r,n,i){return!!e.expression.evaluate(r,null,{},n,i)}interpolate(){return!1}},re=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 Pr(n,void 0),o=this.defaultTransitionablePropertyValues[r]=new hn(n);this.defaultTransitioningPropertyValues[r]=o.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=i.possiblyEvaluate({})}}};C("DataDrivenProperty",R);C("DataConstantProperty",B);C("CrossFadedDataDrivenProperty",lt);C("CrossFadedProperty",jt);C("ColorRampProperty",Jt);var co="-transition",se=class extends no{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 uo(r.layout)),r.paint)){this._transitionablePaint=new ao(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.${this.id}.layout.${e}`;if(this._validate(mc,i,e,r,n))return}if(e==="visibility"){this.visibility=r;return}this._unevaluatedLayout.setValue(e,r)}getPaintProperty(e){return e.endsWith(co)?this._transitionablePaint.getTransition(e.slice(0,-co.length)):this._transitionablePaint.getValue(e)}setPaintProperty(e,r,n={}){if(r!=null){let i=`layers.${this.id}.paint.${e}`;if(this._validate(yc,i,e,r,n))return!1}if(e.endsWith(co))return this._transitionablePaint.setTransition(e.slice(0,-co.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),Jl(e,(r,n)=>r!==void 0&&!(n==="layout"&&!Object.keys(r).length)&&!(n==="paint"&&!Object.keys(r).length))}_validate(e,r,n,i,o={}){return o&&o.validate===!1?!1:hc(this,e.call(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 Se)||!ht(r.property.specification))&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}};var nd={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},Pt=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}},id=128,od=5,ee=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*od),id),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 Y(t,e=1){let r=0,n=0,i=t.map(a=>{let s=ad(a.type),l=r=Sc(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=Sc(r,Math.max(n,e));return{members:i,size:o,alignment:e}}function ad(t){return nd[t].BYTES_PER_ELEMENT}function Sc(t,e){return Math.ceil(t/e)*e}var wc=Z(he(),1),Zt=class extends ee{_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}};Zt.prototype.bytesPerElement=4;C("StructArrayLayout2i4",Zt);var dn=class extends ee{_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}};dn.prototype.bytesPerElement=6;C("StructArrayLayout3i6",dn);var po=class extends ee{_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}};po.prototype.bytesPerElement=8;C("StructArrayLayout4i8",po);var gn=class extends ee{_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}};gn.prototype.bytesPerElement=12;C("StructArrayLayout2i4i12",gn);var xn=class extends ee{_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}};xn.prototype.bytesPerElement=8;C("StructArrayLayout2i4ub8",xn);var St=class extends ee{_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}};St.prototype.bytesPerElement=8;C("StructArrayLayout2f8",St);var bn=class extends ee{_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}};bn.prototype.bytesPerElement=20;C("StructArrayLayout10ui20",bn);var vn=class extends ee{_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}};vn.prototype.bytesPerElement=24;C("StructArrayLayout4i4ui4i24",vn);var Pn=class extends ee{_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}};Pn.prototype.bytesPerElement=12;C("StructArrayLayout3f12",Pn);var Sn=class extends ee{_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}};Sn.prototype.bytesPerElement=4;C("StructArrayLayout1ul4",Sn);var wn=class extends ee{_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}};wn.prototype.bytesPerElement=20;C("StructArrayLayout6i1ul2ui20",wn);var An=class extends ee{_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}};An.prototype.bytesPerElement=12;C("StructArrayLayout2i2i2i12",An);var fo=class extends ee{_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}};fo.prototype.bytesPerElement=16;C("StructArrayLayout2f1f2i16",fo);var _n=class extends ee{_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}};_n.prototype.bytesPerElement=12;C("StructArrayLayout2ub2f12",_n);var In=class extends ee{_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}};In.prototype.bytesPerElement=6;C("StructArrayLayout3ui6",In);var Tn=class extends ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o,a,s,l,u,c,p,f,y,m,h,d,g){let b=this.length;return this.resize(b+1),this.emplace(b,e,r,n,i,o,a,s,l,u,c,p,f,y,m,h,d,g)}emplace(e,r,n,i,o,a,s,l,u,c,p,f,y,m,h,d,g,b){let x=e*24,v=e*12,P=e*48;return this.int16[x+0]=r,this.int16[x+1]=n,this.uint16[x+2]=i,this.uint16[x+3]=o,this.uint32[v+2]=a,this.uint32[v+3]=s,this.uint32[v+4]=l,this.uint16[x+10]=u,this.uint16[x+11]=c,this.uint16[x+12]=p,this.float32[v+7]=f,this.float32[v+8]=y,this.uint8[P+36]=m,this.uint8[P+37]=h,this.uint8[P+38]=d,this.uint32[v+10]=g,this.int16[x+22]=b,e}};Tn.prototype.bytesPerElement=48;C("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Tn);var Cn=class extends ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,n,i,o,a,s,l,u,c,p,f,y,m,h,d,g,b,x,v,P,w,T,F,E,_,I,k){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,h,d,g,b,x,v,P,w,T,F,E,_,I,k)}emplace(e,r,n,i,o,a,s,l,u,c,p,f,y,m,h,d,g,b,x,v,P,w,T,F,E,_,I,k,V){let A=e*32,z=e*16;return this.int16[A+0]=r,this.int16[A+1]=n,this.int16[A+2]=i,this.int16[A+3]=o,this.int16[A+4]=a,this.int16[A+5]=s,this.int16[A+6]=l,this.int16[A+7]=u,this.uint16[A+8]=c,this.uint16[A+9]=p,this.uint16[A+10]=f,this.uint16[A+11]=y,this.uint16[A+12]=m,this.uint16[A+13]=h,this.uint16[A+14]=d,this.uint16[A+15]=g,this.uint16[A+16]=b,this.uint16[A+17]=x,this.uint16[A+18]=v,this.uint16[A+19]=P,this.uint16[A+20]=w,this.uint16[A+21]=T,this.uint16[A+22]=F,this.uint32[z+12]=E,this.float32[z+13]=_,this.float32[z+14]=I,this.uint16[A+30]=k,this.uint16[A+31]=V,e}};Cn.prototype.bytesPerElement=64;C("StructArrayLayout8i15ui1ul2f2ui64",Cn);var Wt=class extends ee{_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}};Wt.prototype.bytesPerElement=4;C("StructArrayLayout1f4",Wt);var kn=class extends ee{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,n){let i=this.length;return this.resize(i+1),this.emplace(i,e,r,n)}emplace(e,r,n,i){let o=e*6,a=e*3;return this.uint16[o+0]=r,this.float32[a+1]=n,this.float32[a+2]=i,e}};kn.prototype.bytesPerElement=12;C("StructArrayLayout1ui2f12",kn);var Mn=class extends ee{_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}};Mn.prototype.bytesPerElement=8;C("StructArrayLayout1ul2ui8",Mn);var En=class extends ee{_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}};En.prototype.bytesPerElement=4;C("StructArrayLayout2ui4",En);var yo=class extends ee{_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}};yo.prototype.bytesPerElement=2;C("StructArrayLayout1ui2",yo);var Sr=class extends ee{_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}};Sr.prototype.bytesPerElement=16;C("StructArrayLayout4f16",Sr);var mo=class extends Pt{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 wc.default(this.anchorPointX,this.anchorPointY)}};mo.prototype.size=20;var Fn=class extends wn{get(e){return new mo(this,e)}};C("CollisionBoxArray",Fn);var ho=class extends Pt{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]}};ho.prototype.size=48;var Ln=class extends Tn{get(e){return new ho(this,e)}};C("PlacedSymbolArray",Ln);var go=class extends Pt{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(e){this._structArray.uint32[this._pos4+12]=e}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}};go.prototype.size=64;var Dn=class extends Cn{get(e){return new go(this,e)}};C("SymbolInstanceArray",Dn);var Vn=class extends Wt{getoffsetX(e){return this.float32[e*1+0]}};C("GlyphOffsetArray",Vn);var Bn=class extends dn{getx(e){return this.int16[e*3+0]}gety(e){return this.int16[e*3+1]}gettileUnitDistanceFromAnchor(e){return this.int16[e*3+2]}};C("SymbolLineVertexArray",Bn);var xo=class extends Pt{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}};xo.prototype.size=12;var zn=class extends kn{get(e){return new xo(this,e)}};C("TextAnchorOffsetArray",zn);var bo=class extends Pt{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]}};bo.prototype.size=8;var Rn=class extends Mn{get(e){return new bo(this,e)}};C("FeatureIndexArray",Rn);var vo=class extends Zt{};var Po=class extends Zt{},So=class extends Zt{},wo=class extends gn{};var Ao=class extends xn{},_o=class extends St{},ut=class extends bn{},Io=class extends vn{},To=class extends Pn{},Co=class extends Sn{},On=class extends An{};var ko=class extends _n{};var Le=class extends In{},wt=class extends En{};var sd=Y([{name:"a_pos",components:2,type:"Int16"}],4);var{members:Ac,size:Lv,alignment:Dv}=sd;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&&fe(`Max vertices per segment is ${t.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${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;C("SegmentVector",me);function As(t,e){return t=it(Math.floor(t),0,255),e=it(Math.floor(e),0,255),256*t+e}var Nn=Y([{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 kc=Z(Ts(),1);var Un=class t{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,n,i){this.ids.push(Cc(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=Cc(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 Cs(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 Cc(t){let e=+t;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:(0,kc.default)(String(t))}function Cs(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;Eo(t,o,a),Eo(e,3*o,3*a),Eo(e,3*o+1,3*a+1),Eo(e,3*o+2,3*a+2)}a-r<n-a?(Cs(t,e,r,a),r=a+1):(Cs(t,e,a+1,n),n=a)}}function Eo(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}C("FeaturePositionMap",Un);var $n=class{constructor(e,r){this.gl=e.gl,this.location=r}};var wr=class extends $n{constructor(e,r){super(e,r),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}};var Fo=class extends $n{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]))}},Lo=class extends $n{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))}},Hv=new Float32Array(16);function ks(t){return[As(255*t.r,255*t.g),As(255*t.b,255*t.a)]}var Ht=class{constructor(e,r,n){this.value=e,this.uniformNames=r.map(i=>`u_${i}`),this.type=n}setUniform(e,r,n){e.set(n.constantOr(this.value))}getBinding(e,r,n){return this.type==="color"?new Lo(e,r):new wr(e,r)}},At=class{constructor(e,r){this.uniformNames=r.map(n=>`u_${n}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=e.tlbr}setUniform(e,r,n,i){let o=i==="u_pattern_to"?this.patternTo:i==="u_pattern_from"?this.patternFrom:i==="u_pixel_ratio_to"?this.pixelRatioTo:i==="u_pixel_ratio_from"?this.pixelRatioFrom:null;o&&e.set(o)}getBinding(e,r,n){return n.substr(0,9)==="u_pattern"?new Fo(e,r):new wr(e,r)}},We=class{constructor(e,r,n,i){this.expression=e,this.type=n,this.maxValue=0,this.paintVertexAttributes=r.map(o=>({name:`a_${o}`,type:"Float32",components:n==="color"?2:1,offset:0})),this.paintVertexArray=new i}populatePaintArray(e,r,n,i,o){let a=this.paintVertexArray.length,s=this.expression.evaluate(new 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=ks(n);for(let o=e;o<r;o++)this.paintVertexArray.emplace(o,i[0],i[1])}else{for(let i=e;i<r;i++)this.paintVertexArray.emplace(i,n);this.maxValue=Math.max(this.maxValue,Math.abs(n))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}},De=class{constructor(e,r,n,i,o,a){this.expression=e,this.uniformNames=r.map(s=>`u_${s}_t`),this.type=n,this.useIntegerZoom=i,this.zoom=o,this.maxValue=0,this.paintVertexAttributes=r.map(s=>({name:`a_${s}`,type:"Float32",components:n==="color"?4:2,offset:0})),this.paintVertexArray=new a}populatePaintArray(e,r,n,i,o){let a=this.expression.evaluate(new 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=ks(n),a=ks(i);for(let s=e;s<r;s++)this.paintVertexArray.emplace(s,o[0],o[1],a[0],a[1])}else{for(let o=e;o<r;o++)this.paintVertexArray.emplace(o,n,i);this.maxValue=Math.max(this.maxValue,Math.abs(n),Math.abs(i))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,r){let n=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,i=it(this.expression.interpolationFactor(n,this.zoom,this.zoom+1),0,1);e.set(i)}getBinding(e,r,n){return new wr(e,r)}},et=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,Nn.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,Nn.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}},Do=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 Se)||!ht(a.property.specification))continue;let s=pd(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 At(l.value,s):new Ht(l.value,s,u),i.push(`/u_${o}`);else if(l.kind==="source"||f){let y=Mc(o,u,"source");this.binders[o]=f?new et(l,u,c,r,y,e.id):new We(l,s,u,y),i.push(`/a_${o}`)}else{let y=Mc(o,u,"composite");this.binders[o]=new De(l,s,u,c,r,y),i.push(`/z_${o}`)}}this.cacheKey=i.sort().join("")}getMaxValue(e){let r=this.binders[e];return r instanceof We||r instanceof De?r.maxValue:0}populatePaintArrays(e,r,n,i,o){for(let a in this.binders){let s=this.binders[a];(s instanceof We||s instanceof De||s instanceof et)&&s.populatePaintArray(e,r,n,i,o)}}setConstantPatternPositions(e,r){for(let n in this.binders){let i=this.binders[n];i instanceof At&&i.setConstantPatternPositions(e,r)}}updatePaintArrays(e,r,n,i,o){let a=!1;for(let s in e){let l=r.getPositions(s);for(let u of l){let c=n.feature(u.index);for(let p in this.binders){let f=this.binders[p];if((f instanceof We||f instanceof De||f instanceof et)&&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 Ht||n instanceof At)&&e.push(...n.uniformNames.map(i=>`#define HAS_UNIFORM_${i}`))}return e}getBinderAttributes(){let e=[];for(let r in this.binders){let n=this.binders[r];if(n instanceof We||n instanceof De)for(let i=0;i<n.paintVertexAttributes.length;i++)e.push(n.paintVertexAttributes[i].name);else if(n instanceof et)for(let i=0;i<Nn.members.length;i++)e.push(Nn.members[i].name)}return e}getBinderUniforms(){let e=[];for(let r in this.binders){let n=this.binders[r];if(n instanceof Ht||n instanceof At||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 Ht||o instanceof At||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 et){let i=e.fromScale===2?n.zoomInPaintVertexBuffer:n.zoomOutPaintVertexBuffer;i&&this._buffers.push(i)}else(n instanceof We||n instanceof De)&&n.paintVertexBuffer&&this._buffers.push(n.paintVertexBuffer)}}upload(e){for(let r in this.binders){let n=this.binders[r];(n instanceof We||n instanceof De||n instanceof et)&&n.upload(e)}this.updatePaintBuffers()}destroy(){for(let e in this.binders){let r=this.binders[e];(r instanceof We||r instanceof De||r instanceof et)&&r.destroy()}}},Ce=class{constructor(e,r,n=()=>!0){this.programConfigurations={};for(let i of e)this.programConfigurations[i.id]=new Do(i,r,n);this.needsUpload=!1,this._featureMap=new Un,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 pd(t,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[t]||[t.replace(`${e}-`,"").replace(/-/g,"_")]}function fd(t){return{"line-pattern":{source:ut,composite:ut},"fill-pattern":{source:ut,composite:ut},"fill-extrusion-pattern":{source:ut,composite:ut}}[t]}function Mc(t,e,r){let n={color:{source:St,composite:Sr},number:{source:Wt,composite:St}},i=fd(t);return i&&i[r]||n[e][r]}C("ConstantBinder",Ht);C("CrossFadedConstantBinder",At);C("SourceExpressionBinder",We);C("CrossFadedCompositeBinder",et);C("CompositeExpressionBinder",De);C("ProgramConfiguration",Do,{omit:["_buffers"]});C("ProgramConfigurationSet",Ce);var yd=15,Ms=Math.pow(2,yd-1)-1,Ec=-Ms-1;function ke(t){let e=8192/t.extent,r=t.loadGeometry();for(let n=0;n<r.length;n++){let i=r[n];for(let o=0;o<i.length;o++){let a=i[o],s=Math.round(a.x*e),l=Math.round(a.y*e);a.x=it(s,Ec,Ms),a.y=it(l,Ec,Ms),(s<a.x||s>a.x+1||l<a.y||l>a.y+1)&&fe("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function $e(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?ke(t):[]}}function Vo(t,e,r,n,i){t.emplaceBack(e*2+(n+1)/2,r*2+(i+1)/2)}var 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.layoutVertexArray=new Po,this.indexArray=new Le,this.segments=new me,this.programConfigurations=new Ce(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=$e(l,f);if(!this.layers[0]._featureFilter.filter(new q(this.zoom),y,n))continue;let m=s?a.evaluate(y,{},n):void 0,h={id:u,properties:l.properties,type:l.type,sourceLayerIndex:p,index:c,geometry:f?y.geometry:ke(l),patterns:{},sortKey:m};o.push(h)}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,Ac),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;Vo(this.layoutVertexArray,s,l,-1,-1),Vo(this.layoutVertexArray,s,l,1,-1),Vo(this.layoutVertexArray,s,l,1,1),Vo(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)}};C("CircleBucket",Xt,{omit:["layers"]});var Gn=Z(he(),1);function Lc(t,e){for(let r=0;r<t.length;r++)if(Ar(e,t[r]))return!0;for(let r=0;r<e.length;r++)if(Ar(t,e[r]))return!0;return!!Fs(t,e)}function Dc(t,e,r){return!!(Ar(t,e)||Es(e,t,r))}function Bo(t,e){if(t.length===1)return Fc(e,t[0]);for(let r=0;r<e.length;r++){let n=e[r];for(let i=0;i<n.length;i++)if(Ar(t,n[i]))return!0}for(let r=0;r<t.length;r++)if(Fc(e,t[r]))return!0;for(let r=0;r<e.length;r++)if(Fs(t,e[r]))return!0;return!1}function Vc(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(Ar(t,i[o]))return!0}if(md(t,i,r))return!0}return!1}function md(t,e,r){if(t.length>1){if(Fs(t,e))return!0;for(let n=0;n<e.length;n++)if(Es(e[n],t,r))return!0}for(let n=0;n<t.length;n++)if(Es(t[n],e,r))return!0;return!1}function Fs(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(hd(n,i,a,s))return!0}}return!1}function hd(t,e,r,n){return ot(t,r,n)!==ot(e,r,n)&&ot(t,e,r)!==ot(t,e,n)}function Es(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 Fc(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 Ar(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 Bc(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 Gn.default(e,r),new Gn.default(e,i),new Gn.default(n,i),new Gn.default(n,r)];if(t.length>2){for(let a of o)if(Ar(t,a))return!0}for(let a=0;a<t.length-1;a++){let s=t[a],l=t[a+1];if(dd(s,l,o))return!0}return!1}function dd(t,e,r){let n=r[0],i=r[2];if(t.x<n.x&&e.x<n.x||t.x>i.x&&e.x>i.x||t.y<n.y&&e.y<n.y||t.y>i.y&&e.y>i.y)return!1;let o=ot(t,e,r[0]);return o!==ot(t,e,r[1])||o!==ot(t,e,r[2])||o!==ot(t,e,r[3])}var zo=Z(he(),1);function Kt(t,e,r){let n=e.paint.get(t).value;return n.kind==="constant"?n.value:r.programConfigurations.get(e.id).getMaxValue(t)}function _t(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function It(t,e,r,n,i){if(!e[0]&&!e[1])return t;let o=zo.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 zc(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 zo.default(0,0):l.sub(s)._unit()._perp(),p=a===i.length-1?new zo.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 Rc,gd=()=>Rc=Rc||new re({"circle-sort-key":new R(S.layout_circle["circle-sort-key"])}),Oc,xd=()=>Oc=Oc||new re({"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"])}),Nc={get paint(){return xd()},get layout(){return gd()}};var Q=1e-6,Ge=typeof Float32Array<"u"?Float32Array:Array,qn=Math.random;var U1=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 jn={};Dl(jn,{add:()=>rg,adjoint:()=>Id,clone:()=>vd,copy:()=>Pd,create:()=>bd,determinant:()=>Td,equals:()=>ag,exactEquals:()=>og,frob:()=>tg,fromQuat:()=>jd,fromQuat2:()=>Nd,fromRotation:()=>Bd,fromRotationTranslation:()=>qc,fromRotationTranslationScale:()=>Gd,fromRotationTranslationScaleOrigin:()=>qd,fromScaling:()=>Vd,fromTranslation:()=>Dd,fromValues:()=>Sd,fromXRotation:()=>zd,fromYRotation:()=>Rd,fromZRotation:()=>Od,frustum:()=>Jd,getRotation:()=>$d,getScaling:()=>jc,getTranslation:()=>Ud,identity:()=>$c,invert:()=>_d,lookAt:()=>Yd,mul:()=>sg,multiply:()=>Gc,multiplyScalar:()=>ng,multiplyScalarAndAdd:()=>ig,ortho:()=>Xd,orthoNO:()=>Zc,orthoZO:()=>Kd,perspective:()=>Zd,perspectiveFromFieldOfView:()=>Hd,perspectiveNO:()=>Jc,perspectiveZO:()=>Wd,rotate:()=>Md,rotateX:()=>Ed,rotateY:()=>Fd,rotateZ:()=>Ld,scale:()=>kd,set:()=>wd,str:()=>eg,sub:()=>lg,subtract:()=>Wc,targetTo:()=>Qd,translate:()=>Cd,transpose:()=>Ad});function bd(){var t=new Ge(16);return Ge!=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 vd(t){var e=new Ge(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 Pd(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 Sd(t,e,r,n,i,o,a,s,l,u,c,p,f,y,m,h){var d=new Ge(16);return d[0]=t,d[1]=e,d[2]=r,d[3]=n,d[4]=i,d[5]=o,d[6]=a,d[7]=s,d[8]=l,d[9]=u,d[10]=c,d[11]=p,d[12]=f,d[13]=y,d[14]=m,d[15]=h,d}function wd(t,e,r,n,i,o,a,s,l,u,c,p,f,y,m,h,d){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]=h,t[15]=d,t}function $c(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 Ad(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 _d(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],h=e[13],d=e[14],g=e[15],b=r*s-n*a,x=r*l-i*a,v=r*u-o*a,P=n*l-i*s,w=n*u-o*s,T=i*u-o*l,F=c*h-p*m,E=c*d-f*m,_=c*g-y*m,I=p*d-f*h,k=p*g-y*h,V=f*g-y*d,A=b*V-x*k+v*I+P*_-w*E+T*F;return A?(A=1/A,t[0]=(s*V-l*k+u*I)*A,t[1]=(i*k-n*V-o*I)*A,t[2]=(h*T-d*w+g*P)*A,t[3]=(f*w-p*T-y*P)*A,t[4]=(l*_-a*V-u*E)*A,t[5]=(r*V-i*_+o*E)*A,t[6]=(d*v-m*T-g*x)*A,t[7]=(c*T-f*v+y*x)*A,t[8]=(a*k-s*_+u*F)*A,t[9]=(n*_-r*k-o*F)*A,t[10]=(m*w-h*v+g*b)*A,t[11]=(p*v-c*w-y*b)*A,t[12]=(s*E-a*I-l*F)*A,t[13]=(r*I-n*E+i*F)*A,t[14]=(h*x-m*P-d*b)*A,t[15]=(c*P-p*x+f*b)*A,t):null}function Id(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],h=e[13],d=e[14],g=e[15];return t[0]=s*(f*g-y*d)-p*(l*g-u*d)+h*(l*y-u*f),t[1]=-(n*(f*g-y*d)-p*(i*g-o*d)+h*(i*y-o*f)),t[2]=n*(l*g-u*d)-s*(i*g-o*d)+h*(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*d)-c*(l*g-u*d)+m*(l*y-u*f)),t[5]=r*(f*g-y*d)-c*(i*g-o*d)+m*(i*y-o*f),t[6]=-(r*(l*g-u*d)-a*(i*g-o*d)+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*h)-c*(s*g-u*h)+m*(s*y-u*p),t[9]=-(r*(p*g-y*h)-c*(n*g-o*h)+m*(n*y-o*p)),t[10]=r*(s*g-u*h)-a*(n*g-o*h)+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*d-f*h)-c*(s*d-l*h)+m*(s*f-l*p)),t[13]=r*(p*d-f*h)-c*(n*d-i*h)+m*(n*f-i*p),t[14]=-(r*(s*d-l*h)-a*(n*d-i*h)+m*(n*l-i*s)),t[15]=r*(s*f-l*p)-a*(n*f-i*p)+c*(n*l-i*s),t}function Td(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],h=t[14],d=t[15],g=e*a-r*o,b=e*s-n*o,x=e*l-i*o,v=r*s-n*a,P=r*l-i*a,w=n*l-i*s,T=u*m-c*y,F=u*h-p*y,E=u*d-f*y,_=c*h-p*m,I=c*d-f*m,k=p*d-f*h;return g*k-b*I+x*_+v*E-P*F+w*T}function Gc(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],h=e[12],d=e[13],g=e[14],b=e[15],x=r[0],v=r[1],P=r[2],w=r[3];return t[0]=x*n+v*s+P*p+w*h,t[1]=x*i+v*l+P*f+w*d,t[2]=x*o+v*u+P*y+w*g,t[3]=x*a+v*c+P*m+w*b,x=r[4],v=r[5],P=r[6],w=r[7],t[4]=x*n+v*s+P*p+w*h,t[5]=x*i+v*l+P*f+w*d,t[6]=x*o+v*u+P*y+w*g,t[7]=x*a+v*c+P*m+w*b,x=r[8],v=r[9],P=r[10],w=r[11],t[8]=x*n+v*s+P*p+w*h,t[9]=x*i+v*l+P*f+w*d,t[10]=x*o+v*u+P*y+w*g,t[11]=x*a+v*c+P*m+w*b,x=r[12],v=r[13],P=r[14],w=r[15],t[12]=x*n+v*s+P*p+w*h,t[13]=x*i+v*l+P*f+w*d,t[14]=x*o+v*u+P*y+w*g,t[15]=x*a+v*c+P*m+w*b,t}function Cd(t,e,r){var n=r[0],i=r[1],o=r[2],a,s,l,u,c,p,f,y,m,h,d,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],h=e[9],d=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]=h,t[10]=d,t[11]=g,t[12]=a*n+c*i+m*o+e[12],t[13]=s*n+p*i+h*o+e[13],t[14]=l*n+f*i+d*o+e[14],t[15]=u*n+y*i+g*o+e[15]),t}function kd(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 Md(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,h,d,g,b,x,v,P,w,T,F,E,_,I,k,V,A,z;return s<Q?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],h=e[4],d=e[5],g=e[6],b=e[7],x=e[8],v=e[9],P=e[10],w=e[11],T=i*i*c+u,F=o*i*c+a*l,E=a*i*c-o*l,_=i*o*c-a*l,I=o*o*c+u,k=a*o*c+i*l,V=i*a*c+o*l,A=o*a*c-i*l,z=a*a*c+u,t[0]=p*T+h*F+x*E,t[1]=f*T+d*F+v*E,t[2]=y*T+g*F+P*E,t[3]=m*T+b*F+w*E,t[4]=p*_+h*I+x*k,t[5]=f*_+d*I+v*k,t[6]=y*_+g*I+P*k,t[7]=m*_+b*I+w*k,t[8]=p*V+h*A+x*z,t[9]=f*V+d*A+v*z,t[10]=y*V+g*A+P*z,t[11]=m*V+b*A+w*z,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)}function Ed(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 Fd(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 Ld(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 Dd(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 Vd(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 Bd(t,e,r){var n=r[0],i=r[1],o=r[2],a=Math.hypot(n,i,o),s,l,u;return a<Q?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 zd(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 Rd(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 Od(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 qc(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,h=o*u,d=a*s,g=a*l,b=a*u;return t[0]=1-(y+h),t[1]=p+b,t[2]=f-g,t[3]=0,t[4]=p-b,t[5]=1-(c+h),t[6]=m+d,t[7]=0,t[8]=f+g,t[9]=m-d,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 Nd(t,e){var r=new Ge(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),qc(t,e,r),t}function Ud(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t}function jc(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 $d(t,e){var r=new Ge(3);jc(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,h=a+c+m,d=0;return h>0?(d=Math.sqrt(h+1)*2,t[3]=.25*d,t[0]=(p-y)/d,t[1]=(f-l)/d,t[2]=(s-u)/d):a>c&&a>m?(d=Math.sqrt(1+a-c-m)*2,t[3]=(p-y)/d,t[0]=.25*d,t[1]=(s+u)/d,t[2]=(f+l)/d):c>m?(d=Math.sqrt(1+c-a-m)*2,t[3]=(f-l)/d,t[0]=(s+u)/d,t[1]=.25*d,t[2]=(p+y)/d):(d=Math.sqrt(1+m-a-c)*2,t[3]=(s-u)/d,t[0]=(f+l)/d,t[1]=(p+y)/d,t[2]=.25*d),t}function Gd(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,h=o*c,d=a*c,g=s*l,b=s*u,x=s*c,v=n[0],P=n[1],w=n[2];return t[0]=(1-(m+d))*v,t[1]=(f+x)*v,t[2]=(y-b)*v,t[3]=0,t[4]=(f-x)*P,t[5]=(1-(p+d))*P,t[6]=(h+g)*P,t[7]=0,t[8]=(y+b)*w,t[9]=(h-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 qd(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,h=a*c,d=a*p,g=s*p,b=l*u,x=l*c,v=l*p,P=n[0],w=n[1],T=n[2],F=i[0],E=i[1],_=i[2],I=(1-(h+g))*P,k=(y+v)*P,V=(m-x)*P,A=(y-v)*w,z=(1-(f+g))*w,O=(d+b)*w,N=(m+x)*T,K=(d-b)*T,xe=(1-(f+h))*T;return t[0]=I,t[1]=k,t[2]=V,t[3]=0,t[4]=A,t[5]=z,t[6]=O,t[7]=0,t[8]=N,t[9]=K,t[10]=xe,t[11]=0,t[12]=r[0]+F-(I*F+A*E+N*_),t[13]=r[1]+E-(k*F+z*E+K*_),t[14]=r[2]+_-(V*F+O*E+xe*_),t[15]=1,t}function jd(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,h=o*a,d=o*s,g=o*l;return t[0]=1-p-m,t[1]=c+g,t[2]=f-d,t[3]=0,t[4]=c-g,t[5]=1-u-m,t[6]=y+h,t[7]=0,t[8]=f+d,t[9]=y-h,t[10]=1-u-p,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Jd(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 Jc(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 Zd=Jc;function Wd(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 Hd(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 Zc(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 Xd=Zc;function Kd(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 Yd(t,e,r,n){var i,o,a,s,l,u,c,p,f,y,m=e[0],h=e[1],d=e[2],g=n[0],b=n[1],x=n[2],v=r[0],P=r[1],w=r[2];return Math.abs(m-v)<Q&&Math.abs(h-P)<Q&&Math.abs(d-w)<Q?$c(t):(c=m-v,p=h-P,f=d-w,y=1/Math.hypot(c,p,f),c*=y,p*=y,f*=y,i=b*f-x*p,o=x*c-g*f,a=g*p-b*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*h+a*d),t[13]=-(s*m+l*h+u*d),t[14]=-(c*m+p*h+f*d),t[15]=1,t)}function Qd(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,h=u*c-s*f,d=s*p-l*c;return y=m*m+h*h+d*d,y>0&&(y=1/Math.sqrt(y),m*=y,h*=y,d*=y),t[0]=m,t[1]=h,t[2]=d,t[3]=0,t[4]=p*d-f*h,t[5]=f*m-c*d,t[6]=c*h-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 eg(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 tg(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 rg(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 Wc(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 ng(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 ig(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 og(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 ag(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],h=t[13],d=t[14],g=t[15],b=e[0],x=e[1],v=e[2],P=e[3],w=e[4],T=e[5],F=e[6],E=e[7],_=e[8],I=e[9],k=e[10],V=e[11],A=e[12],z=e[13],O=e[14],N=e[15];return Math.abs(r-b)<=Q*Math.max(1,Math.abs(r),Math.abs(b))&&Math.abs(n-x)<=Q*Math.max(1,Math.abs(n),Math.abs(x))&&Math.abs(i-v)<=Q*Math.max(1,Math.abs(i),Math.abs(v))&&Math.abs(o-P)<=Q*Math.max(1,Math.abs(o),Math.abs(P))&&Math.abs(a-w)<=Q*Math.max(1,Math.abs(a),Math.abs(w))&&Math.abs(s-T)<=Q*Math.max(1,Math.abs(s),Math.abs(T))&&Math.abs(l-F)<=Q*Math.max(1,Math.abs(l),Math.abs(F))&&Math.abs(u-E)<=Q*Math.max(1,Math.abs(u),Math.abs(E))&&Math.abs(c-_)<=Q*Math.max(1,Math.abs(c),Math.abs(_))&&Math.abs(p-I)<=Q*Math.max(1,Math.abs(p),Math.abs(I))&&Math.abs(f-k)<=Q*Math.max(1,Math.abs(f),Math.abs(k))&&Math.abs(y-V)<=Q*Math.max(1,Math.abs(y),Math.abs(V))&&Math.abs(m-A)<=Q*Math.max(1,Math.abs(m),Math.abs(A))&&Math.abs(h-z)<=Q*Math.max(1,Math.abs(h),Math.abs(z))&&Math.abs(d-O)<=Q*Math.max(1,Math.abs(d),Math.abs(O))&&Math.abs(g-N)<=Q*Math.max(1,Math.abs(g),Math.abs(N))}var sg=Gc,lg=Wc;var Yt={};Dl(Yt,{add:()=>yg,ceil:()=>mg,clone:()=>ug,copy:()=>pg,create:()=>Hc,cross:()=>_g,dist:()=>zg,distance:()=>Qc,div:()=>Bg,divide:()=>Yc,dot:()=>Ag,equals:()=>Lg,exactEquals:()=>Fg,floor:()=>hg,forEach:()=>Ug,fromValues:()=>cg,inverse:()=>Sg,len:()=>Og,length:()=>tp,lerp:()=>Ig,max:()=>gg,min:()=>dg,mul:()=>Vg,multiply:()=>Kc,negate:()=>Pg,normalize:()=>wg,random:()=>Tg,round:()=>xg,scale:()=>bg,scaleAndAdd:()=>vg,set:()=>fg,sqrDist:()=>Rg,sqrLen:()=>Ng,squaredDistance:()=>ep,squaredLength:()=>rp,str:()=>Eg,sub:()=>Dg,subtract:()=>Xc,transformMat4:()=>Cg,transformQuat:()=>kg,zero:()=>Mg});function Hc(){var t=new Ge(4);return Ge!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function ug(t){var e=new Ge(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function cg(t,e,r,n){var i=new Ge(4);return i[0]=t,i[1]=e,i[2]=r,i[3]=n,i}function pg(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function fg(t,e,r,n,i){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t}function yg(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 Xc(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 Kc(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 Yc(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 mg(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 hg(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 dg(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 gg(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 xg(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 bg(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 vg(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 Qc(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 ep(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 tp(t){var e=t[0],r=t[1],n=t[2],i=t[3];return Math.hypot(e,r,n,i)}function rp(t){var e=t[0],r=t[1],n=t[2],i=t[3];return e*e+r*r+n*n+i*i}function Pg(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t}function Sg(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 wg(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 Ag(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}function _g(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 Ig(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 Tg(t,e){e=e||1;var r,n,i,o,a,s;do r=qn()*2-1,n=qn()*2-1,a=r*r+n*n;while(a>=1);do i=qn()*2-1,o=qn()*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 Cg(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 kg(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 Mg(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t}function Eg(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"}function Fg(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]}function Lg(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)<=Q*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(n-s)<=Q*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-l)<=Q*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(o-u)<=Q*Math.max(1,Math.abs(o),Math.abs(u))}var Dg=Xc,Vg=Kc,Bg=Yc,zg=Qc,Rg=ep,Og=tp,Ng=rp,Ug=function(){var t=Hc();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 np=Z(he(),1),Ro=class extends se{constructor(e){super(e,Nc)}createBucket(e){return new Xt(e)}queryRadius(e){let r=e;return Kt("circle-radius",this,r)+Kt("circle-stroke-width",this,r)+_t(this.paint.get("circle-translate"))}queryIntersectsFeature(e,r,n,i,o,a,s,l){let u=It(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:$g(u,l),h=y?f*s:f;for(let d of i)for(let g of d){let b=y?g:ip(g,l),x=h,v=Yt.transformMat4([],[g.x,g.y,0,1],l);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?x*=v[3]/a.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(x*=a.cameraToCenterDistance/v[3]),Dc(m,b,x))return!0}return!1}};function ip(t,e){let r=Yt.transformMat4([],[t.x,t.y,0,1],e);return new np.default(r[0]/r[3],r[1]/r[3])}function $g(t,e){return t.map(r=>ip(r,e))}var Jn=class extends Xt{};C("HeatmapBucket",Jn,{omit:["layers"]});var op,Gg=()=>op=op||new re({"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 Jt(S.paint_heatmap["heatmap-color"]),"heatmap-opacity":new B(S.paint_heatmap["heatmap-opacity"])}),ap={get paint(){return Gg()}};function Ds(t,{width:e,height:r},n,i){if(!i)i=new Uint8Array(e*r*n);else if(i instanceof Uint8ClampedArray)i=new Uint8Array(i.buffer);else if(i.length!==e*r*n)throw new RangeError(`mismatched image size. expected: ${i.length} but got: ${e*r*n}`);return t.width=e,t.height=r,t.data=i,t}function sp(t,{width:e,height:r},n){if(e===t.width&&r===t.height)return;let i=Ds({},{width:e,height:r},n);Vs(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 Vs(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 Qt=class t{constructor(e,r){Ds(this,e,1,r)}resize(e){sp(this,e,1)}clone(){return new t({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,n,i,o){Vs(e,r,n,i,o,1)}},de=class t{constructor(e,r){Ds(this,e,4,r)}resize(e){sp(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){Vs(e,r,n,i,o,4)}};C("AlphaImage",Qt);C("RGBAImage",de);function lp(t){let e={},r=t.resolution||256,n=t.clips?t.clips.length:1,i=t.image||new de({width:r,height:n});if(!jl(r))throw new Error(`width is not a power of 2 - ${r}`);let o=(a,s,l)=>{e[t.evaluationKey]=l;let u=t.expression.evaluate(e);i.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 Oo=class extends se{createBucket(e){return new Jn(e)}constructor(e){super(e,ap),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){e==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){let e=this._transitionablePaint._values["heatmap-color"].value.expression;this.colorRamp=lp({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 up,qg=()=>up=up||new re({"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"])}),cp={get paint(){return qg()}};var No=class extends se{constructor(e){super(e,cp)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}};var jg=Y([{name:"a_pos",components:2,type:"Int16"}],4);var{members:pp,size:DP,alignment:VP}=jg;var gp=Z(Ns(),1);function Us(t,e,r,n,i){dp(t,e,r||0,n||t.length-1,i||sx)}function dp(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));dp(t,e,c,p,i)}var f=t[e],y=r,m=n;for(Xn(t,r,e),i(t[n],f)>0&&Xn(t,r,n);y<m;){for(Xn(t,y,m),y++,m--;i(t[y],f)<0;)y++;for(;i(t[m],f)>0;)m--}i(t[r],f)===0?Xn(t,r,m):(m++,Xn(t,m,n)),m<=e&&(r=m+1),e<=m&&(n=m-1)}}function Xn(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function sx(t,e){return t<e?-1:t>e?1:0}function Ir(t,e){let r=t.length;if(r<=1)return[t];let n=[],i,o;for(let a=0;a<r;a++){let s=Wl(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||(Us(n[a],e,1,n[a].length-1,lx),n[a]=n[a].slice(0,e));return n}function lx(t,e){return e.area-t.area}function Tr(t,e,r){let n=r.patternDependencies,i=!1;for(let o of e){let a=o.paint.get(`${t}-pattern`);a.isConstant()||(i=!0);let s=a.constantOr(null);s&&(i=!0,n[s.to]=!0,n[s.from]=!0)}return i}function Cr(t,e,r,n,i){let o=i.patternDependencies;for(let a of e){let l=a.paint.get(`${t}-pattern`).value;if(l.kind!=="constant"){let u=l.evaluate({zoom:n-1},r,{},i.availableImages),c=l.evaluate({zoom:n},r,{},i.availableImages),p=l.evaluate({zoom:n+1},r,{},i.availableImages);u=u&&u.name?u.name:u,c=c&&c.name?c.name:c,p=p&&p.name?p.name:p,o[u]=!0,o[c]=!0,o[p]=!0,r.patterns[a.id]={min:u,mid:c,max:p}}}return r}var ux=500,tr=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 So,this.indexArray=new Le,this.indexArray2=new wt,this.programConfigurations=new Ce(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=Tr("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=$e(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:ke(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=Cr("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,pp),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 Ir(r,ux)){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),h=m.vertexLength;this.layoutVertexArray.emplaceBack(y[0].x,y[0].y),this.indexArray2.emplaceBack(h+y.length-1,h),c.push(y[0].x),c.push(y[0].y);for(let d=1;d<y.length;d++)this.layoutVertexArray.emplaceBack(y[d].x,y[d].y),this.indexArray2.emplaceBack(h+d-1,h+d),c.push(y[d].x),c.push(y[d].y);m.vertexLength+=y.length,m.primitiveLength+=y.length}let f=(0,gp.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)}};C("FillBucket",tr,{omit:["layers","patternFeatures"]});var xp,cx=()=>xp=xp||new re({"fill-sort-key":new R(S.layout_fill["fill-sort-key"])}),bp,px=()=>bp=bp||new re({"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 lt(S.paint_fill["fill-pattern"])}),vp={get paint(){return px()},get layout(){return cx()}};var jo=class extends se{constructor(e){super(e,vp)}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 tr(e)}queryRadius(){return _t(this.paint.get("fill-translate"))}queryIntersectsFeature(e,r,n,i,o,a,s){let l=It(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),a.angle,s);return Bo(l,i)}isTileClipped(){return!0}};var fx=Y([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Pp=Y([{name:"a_centroid",components:2,type:"Int16"}],4);var{members:Sp,size:gS,alignment:xS}=fx;var Cp=Z(Ns(),1),kp=Z(Tt(),1);var Ax=kp.default.VectorTileFeature.types,_x=500,qs=Math.pow(2,13);function Kn(t,e,r,n,i,o,a,s){t.emplaceBack(e,r,Math.floor(n*qs)*2+a,i*qs*2,o*qs*2,Math.round(s))}var rr=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 wo,this.centroidVertexArray=new vo,this.indexArray=new Le,this.programConfigurations=new Ce(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=Tr("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=$e(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:ke(i),properties:i.properties,type:i.type,patterns:{}};this.hasPattern?this.features.push(Cr("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,Sp),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,Pp.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 Ir(r,_x)){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||Tx(m))continue;let h=0;for(let d=0;d<m.length;d++){let g=m[d];if(d>=1){let b=m[d-1];if(!Ix(g,b)){u.vertexLength+4>me.MAX_VERTEX_ARRAY_LENGTH&&(u=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let x=g.sub(b)._perp()._unit(),v=b.dist(g);h+v>32768&&(h=0),Kn(this.layoutVertexArray,g.x,g.y,x.x,x.y,0,0,h),Kn(this.layoutVertexArray,g.x,g.y,x.x,x.y,0,1,h),a.x+=2*g.x,a.y+=2*g.y,a.vertexCount+=2,h+=v,Kn(this.layoutVertexArray,b.x,b.y,x.x,x.y,0,0,h),Kn(this.layoutVertexArray,b.x,b.y,x.x,x.y,0,1,h),a.x+=2*b.x,a.y+=2*b.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)),Ax[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 h=0;h<m.length;h++){let d=m[h];Kn(this.layoutVertexArray,d.x,d.y,0,0,1,1,0),a.x+=d.x,a.y+=d.y,a.vertexCount+=1,c.push(d.x),c.push(d.y)}}let y=(0,Cp.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)}};C("FillExtrusionBucket",rr,{omit:["layers","features"]});function Ix(t,e){return t.x===e.x&&(t.x<0||t.x>8192)||t.y===e.y&&(t.y<0||t.y>8192)}function Tx(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 Mp,Cx=()=>Mp=Mp||new re({"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 lt(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"])}),Ep={get paint(){return Cx()}};var Zo=Z(he(),1);var Wo=class extends se{constructor(e){super(e,Ep)}createBucket(e){return new rr(e)}queryRadius(){return _t(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(e,r,n,i,o,a,s,l){let u=It(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=Ex(u,l,a,0),y=Mx(i,p,c,l),m=y[0],h=y[1];return kx(m,h,f)}};function Yn(t,e){return t.x*e.x+t.y*e.y}function Fp(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=Yn(s,s),p=Yn(s,l),f=Yn(l,l),y=Yn(u,s),m=Yn(u,l),h=c*f-p*p,d=(f*y-p*m)/h,g=(c*m-p*y)/h,b=1-d-g,x=n.z*b+i.z*d+o.z*g;if(isFinite(x))return x}return 1/0}else{let r=1/0;for(let n of e)r=Math.min(r,n.z);return r}}function kx(t,e,r){let n=1/0;Bo(r,e)&&(n=Fp(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];Lc(r,f)&&(n=Math.min(n,Fp(r,f)))}}return n===1/0?!1:n}function Mx(t,e,r,n){let i=[],o=[],a=n[8]*e,s=n[9]*e,l=n[10]*e,u=n[11]*e,c=n[8]*r,p=n[9]*r,f=n[10]*r,y=n[11]*r;for(let m of t){let h=[],d=[];for(let g of m){let b=g.x,x=g.y,v=n[0]*b+n[4]*x+n[12],P=n[1]*b+n[5]*x+n[13],w=n[2]*b+n[6]*x+n[14],T=n[3]*b+n[7]*x+n[15],F=v+a,E=P+s,_=w+l,I=T+u,k=v+c,V=P+p,A=w+f,z=T+y,O=new Zo.default(F/I,E/I);O.z=_/I,h.push(O);let N=new Zo.default(k/z,V/z);N.z=A/z,d.push(N)}i.push(h),o.push(d)}return[i,o]}function Ex(t,e,r,n){let i=[];for(let o of t){let a=[o.x,o.y,n,1];Yt.transformMat4(a,a,e),i.push(new Zo.default(a[0]/a[3],a[1]/a[3]))}return i}var Fx=Y([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:Lp,size:ew,alignment:tw}=Fx;var Lx=Y([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Dp,size:iw,alignment:ow}=Lx;var zp=Z(Tt(),1);var Dx=zp.default.VectorTileFeature.types,Vp=63,Vx=Math.cos(75/2*(Math.PI/180)),Bx=15,zx=20,Rx=15,Rp=1/2,Bp=Math.pow(2,Rx-1)/Rp,nr=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 _o,this.indexArray=new Le,this.programConfigurations=new Ce(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=Tr("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=$e(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:ke(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=Cr("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,Dp)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Lp),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=Dx[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?Bx*8192/(512*this.overscaling):0,p=this.segments.prepareSegment(l*10,this.layoutVertexArray,this.indexArray),f,y,m,h,d;this.e1=this.e2=-1,s&&(f=e[l-2],d=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;d&&(h=d),f&&(y=f),f=e[g],d=m?m.sub(f)._unit()._perp():h,h=h||d;let b=h.add(d);(b.x!==0||b.y!==0)&&b._unit();let x=h.x*d.x+h.y*d.y,v=b.x*d.x+b.y*d.y,P=v!==0?1/v:1/0,w=2*Math.sqrt(2-2*v),T=v<Vx&&y&&m,F=h.x*d.y-h.y*d.x>0;if(T&&g>u){let I=f.dist(y);if(I>2*c){let k=f.sub(f.sub(y)._mult(c/I)._round());this.updateDistance(y,k),this.addCurrentVertex(k,h,0,0,p),y=k}}let E=y&&m,_=E?n:s?"butt":i;if(E&&_==="round"&&(P<a?_="miter":P<=2&&(_="fakeround")),_==="miter"&&P>o&&(_="bevel"),_==="bevel"&&(P>2&&(_="flipbevel"),P<o&&(_="miter")),y&&this.updateDistance(y,f),_==="miter")b._mult(P),this.addCurrentVertex(f,b,0,0,p);else if(_==="flipbevel"){if(P>100)b=d.mult(-1);else{let I=P*h.add(d).mag()/h.sub(d).mag();b._perp()._mult(I*(F?-1:1))}this.addCurrentVertex(f,b,0,0,p),this.addCurrentVertex(f,b.mult(-1),0,0,p)}else if(_==="bevel"||_==="fakeround"){let I=-Math.sqrt(P*P-1),k=F?I:0,V=F?0:I;if(y&&this.addCurrentVertex(f,h,k,V,p),_==="fakeround"){let A=Math.round(w*180/Math.PI/zx);for(let z=1;z<A;z++){let O=z/A;if(O!==.5){let K=O-.5,xe=1.0904+x*(-3.2452+x*(3.55645-x*1.43519)),X=.848013+x*(-1.06021+x*.215638);O=O+O*K*(O-1)*(xe*K*K+X)}let N=d.sub(h)._mult(O)._add(h)._unit()._mult(F?-1:1);this.addHalfVertex(f,N.x,N.y,!1,F,0,p)}}m&&this.addCurrentVertex(f,d,-k,-V,p)}else if(_==="butt")this.addCurrentVertex(f,b,0,0,p);else if(_==="square"){let I=y?1:-1;this.addCurrentVertex(f,b,I,I,p)}else _==="round"&&(y&&(this.addCurrentVertex(f,h,0,0,p),this.addCurrentVertex(f,h,1,1,p,!0)),m&&(this.addCurrentVertex(f,d,-1,-1,p,!0),this.addCurrentVertex(f,d,0,0,p)));if(T&&g<l-1){let I=f.dist(m);if(I>2*c){let k=f.add(m.sub(f)._mult(c/I)._round());this.updateDistance(f,k),this.addCurrentVertex(k,d,0,0,p),f=k}}}}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>Bp/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*(Bp-1):this.scaledDistance)*Rp;if(this.layoutVertexArray.emplaceBack((e<<1)+(o?1:0),(r<<1)+(a?1:0),Math.round(Vp*n)+128,Math.round(Vp*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()}};C("LineBucket",nr,{omit:["layers","patternFeatures"]});var Op,Ox=()=>Op=Op||new re({"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"])}),Np,Nx=()=>Np=Np||new re({"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 jt(S.paint_line["line-dasharray"]),"line-pattern":new lt(S.paint_line["line-pattern"]),"line-gradient":new Jt(S.paint_line["line-gradient"])}),js={get paint(){return Nx()},get layout(){return Ox()}};var Js=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=Pe({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(e,r,n,i)}},Ho,Xo=class extends se{constructor(e){super(e,js),this.gradientVersion=0,Ho||(Ho=new Js(js.paint.properties["line-width"].specification),Ho.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){let r=this.gradientExpression();Gt(r)?this.stepInterpolant=r._styleExpression.expression instanceof fr:this.stepInterpolant=!1,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,r){super.recalculate(e,r),this.paint._values["line-floorwidth"]=Ho.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new nr(e)}queryRadius(e){let r=e,n=Up(Kt("line-width",this,r),Kt("line-gap-width",this,r)),i=Kt("line-offset",this,r);return n/2+Math.abs(i)+_t(this.paint.get("line-translate"))}queryIntersectsFeature(e,r,n,i,o,a,s){let l=It(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),a.angle,s),u=s/2*Up(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=zc(i,c*s)),Vc(l,i,u)}isTileClipped(){return!0}};function Up(t,e){return e>0?e+2*t:t}var $p=Y([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Gp=Y([{name:"a_projected_pos",components:3,type:"Float32"}],4),$w=Y([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),qp=Y([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]),Gw=Y([{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"}]),Zs=Y([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),qw=Y([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4),jw=Y([{name:"triangle",components:3,type:"Uint16"}]),Jw=Y([{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"}]),Zw=Y([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),Ww=Y([{type:"Float32",name:"offsetX"}]),Hw=Y([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),Xw=Y([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);var ii=Z(he(),1);function Ux(t,e,r){let n=e.layout.get("text-transform").evaluate(r,{});return n==="uppercase"?t=t.toLocaleUpperCase():n==="lowercase"&&(t=t.toLocaleLowerCase()),ye.applyArabicShaping&&(t=ye.applyArabicShaping(t)),t}function jp(t,e,r){return t.sections.forEach(n=>{n.text=Ux(n.text,e,r)}),t}function Jp(t){let e={},r={},n=[],i=0;function o(u){n.push(t[u]),i++}function a(u,c,p){let f=r[u];return delete r[u],r[c]=f,n[f].geometry[0].pop(),n[f].geometry[0]=n[f].geometry[0].concat(p[0]),f}function s(u,c,p){let f=e[c];return delete e[c],e[u]=f,n[f].geometry[0].shift(),n[f].geometry[0]=p[0].concat(n[f].geometry[0]),f}function l(u,c,p){let f=p?c[0][c[0].length-1]:c[0][0];return`${u}:${f.x}:${f.y}`}for(let u=0;u<t.length;u++){let c=t[u],p=c.geometry,f=c.text?c.text.toString():null;if(!f){o(u);continue}let y=l(f,p),m=l(f,p,!0);if(y in r&&m in e&&r[y]!==e[m]){let h=s(y,m,p),d=a(y,m,n[h].geometry);delete e[y],delete r[m],r[l(f,n[d].geometry,!0)]=d,n[h].geometry=null}else y in r?a(y,m,p):m in e?s(y,m,p):(o(u),e[y]=i-1,r[m]=i-1)}return n.filter(u=>u.geometry)}var Mr={"!":"\\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 Zp(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||!Ss(n)||Mr[t[r+1]])&&(!i||!Ss(i)||Mr[t[r-1]])&&Mr[t[r]]?e+=Mr[t[r]]:e+=t[r]}return e}var ne=24;var ob=Z(Qn(),1),ab=3;var Qo=ab;function ei(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 ea=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]}},ti=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}=ei(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,h=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:h-1},{x:f,y:y-1},{width:m,height:1}),de.copy(c.data,l,{x:0,y:0},{x:f,y:y+h},{width:m,height:1}),de.copy(c.data,l,{x:m-1,y:0},{x:f-1,y},{width:1,height:h}),de.copy(c.data,l,{x:0,y:0},{x:f+m,y},{width:1,height:h})}this.image=l,this.iconPositions=n,this.patternPositions=i}addImages(e,r,n){for(let i in e){let o=e[i],a={x:0,y:0,w:o.data.width+2*ge,h:o.data.height+2*ge};n.push(a),r[i]=new ea(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})}};C("ImagePosition",ea);C("ImageAtlas",ti);var na=(i=>(i[i.none=0]="none",i[i.horizontal=1]="horizontal",i[i.vertical=2]="vertical",i[i.horizontalOnly=3]="horizontalOnly",i))(na||{}),Lr=-17;function sb(t){for(let e of t)if(e.positionedGlyphs.length!==0)return!1;return!0}var ef=57344,tf=63743,ta=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}},ri=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=Zp(this.text)}trim(){let e=0;for(let n=0;n<this.text.length&&ra[this.text.charCodeAt(n)];n++)e++;let r=this.text.length;for(let n=this.text.length-1;n>=0&&n>=e&&ra[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(ta.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){fe("Can\'t add FormattedSection with an empty image.");return}let n=this.getNextImageSectionCharCode();if(!n){fe(`Reached maximum number of images ${tf-ef+2}`);return}this.text+=String.fromCharCode(n),this.sections.push(ta.forImage(r)),this.sectionIndex.push(this.sections.length-1)}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=tf?null:++this.imageSectionID:(this.imageSectionID=ef,this.imageSectionID)}};function lb(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 ni(t,e,r,n,i,o,a,s,l,u,c,p,f,y,m,h){let d=ri.fromFeature(t,i);p===2&&d.verticalizePunctuation();let g,{processBidirectionalText:b,processStyledBidirectionalText:x}=ye;if(b&&d.sections.length===1){g=[];let w=b(d.toString(),Xs(d,u,o,e,n,y,m));for(let T of w){let F=new ri;F.text=T,F.sections=d.sections;for(let E=0;E<T.length;E++)F.sectionIndex.push(0);g.push(F)}}else if(x){g=[];let w=x(d.text,d.sectionIndex,Xs(d,u,o,e,n,y,m));for(let T of w){let F=new ri;F.text=T[0],F.sectionIndex=T[1],F.sections=d.sections,g.push(F)}}else g=lb(d,Xs(d,u,o,e,n,y,m));let v=[],P={positionedLines:v,text:d.toString(),top:c[1],bottom:c[1],left:c[0],right:c[0],writingMode:p,iconsInText:!1,verticalizable:!1};return fb(P,e,r,n,g,a,s,l,p,u,f,h),sb(v)?!1:P}var ra={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},ub={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 of(t,e,r,n,i,o){if(e.imageName){let a=n[e.imageName];return a?a.displaySize[0]*e.scale*ne/o+i:0}else{let a=r[e.fontStack],s=a&&a[t];return s?s.metrics.advance*e.scale+i:0}}function cb(t,e,r,n,i,o){let a=0;for(let l=0;l<t.length();l++){let u=t.getSection(l);a+=of(t.getCharCode(l),u,n,i,e,o)}let s=Math.max(1,Math.ceil(a/r));return a/s}function rf(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 pb(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 nf(t,e,r,n,i,o){let a=null,s=rf(e,r,i,o);for(let l of n){let u=e-l.x,c=rf(u,r,i,o)+l.badness;c<=s&&(a=l,s=c)}return{index:t,x:e,priorBreak:a,badness:s}}function af(t){return t?af(t.priorBreak).concat(t.index):[]}function Xs(t,e,r,n,i,o,a){if(o!=="point")return[];if(!t)return[];let s=[],l=cb(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(ra[y]||(c+=of(y,f,n,i,e,a)),p<t.length()-1){let m=gc(y);(ub[y]||m||f.imageName)&&s.push(nf(p+1,c,l,s,pb(y,t.getCharCode(p+1),m&&u),!1))}}return af(nf(t.length(),c,l,s,0,!0))}function sf(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 fb(t,e,r,n,i,o,a,s,l,u,c,p){let f=0,y=Lr,m=0,h=0,d=s==="right"?1:s==="left"?0:.5,g=0;for(let P of i){P.trim();let w=P.getMaxScale(),T=(w-1)*ne,F={positionedGlyphs:[],lineOffset:0};t.positionedLines[g]=F;let E=F.positionedGlyphs,_=0;if(!P.length()){y+=o,++g;continue}for(let k=0;k<P.length();k++){let V=P.getSection(k),A=P.getSectionIndex(k),z=P.getCharCode(k),O=0,N=null,K=null,xe=null,X=ne,le=!(l===1||!c&&!oo(z)||c&&(ra[z]||xc(z)));if(V.imageName){let ce=n[V.imageName];if(!ce)continue;xe=V.imageName,t.iconsInText=t.iconsInText||!0,K=ce.paddedRect;let pe=ce.displaySize;V.scale=V.scale*ne/p,N={width:pe[0],height:pe[1],left:ge,top:-Qo,advance:le?pe[1]:pe[0]};let _e=ne-pe[1]*V.scale;O=T+_e,X=N.advance;let be=le?pe[0]*V.scale-ne*w:pe[1]*V.scale-ne*w;be>0&&be>_&&(_=be)}else{let ce=r[V.fontStack],pe=ce&&ce[z];if(pe&&pe.rect)K=pe.rect,N=pe.metrics;else{let _e=e[V.fontStack],be=_e&&_e[z];if(!be)continue;N=be.metrics}O=(w-V.scale)*ne}le?(t.verticalizable=!0,E.push({glyph:z,imageName:xe,x:f,y:y+O,vertical:le,scale:V.scale,fontStack:V.fontStack,sectionIndex:A,metrics:N,rect:K}),f+=X*V.scale+u):(E.push({glyph:z,imageName:xe,x:f,y:y+O,vertical:le,scale:V.scale,fontStack:V.fontStack,sectionIndex:A,metrics:N,rect:K}),f+=N.advance*V.scale+u)}if(E.length!==0){let k=f-u;m=Math.max(k,m),yb(E,0,E.length-1,d,_)}f=0;let I=o*w+_;F.lineOffset=Math.max(_,T),y+=I,h=Math.max(I,h),++g}let b=y-Lr,{horizontalAlign:x,verticalAlign:v}=sf(a);mb(t.positionedLines,d,x,v,m,h,o,b,i.length),t.top+=-v*b,t.bottom=t.top+b,t.left+=-x*m,t.right=t.left+m}function yb(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 mb(t,e,r,n,i,o,a,s,l){let u=(e-r)*i,c=0;o!==a?c=-s*n-Lr:c=(-n*l+.5)*a;for(let p of t)for(let f of p.positionedGlyphs)f.x+=u,f.y+=c}function lf(t,e,r){let{horizontalAlign:n,verticalAlign:i}=sf(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 Ks(t,e,r,n,i,o){let a=t.image,s;if(a.content){let d=a.content,g=a.pixelRatio||1;s=[d[0]/g,d[1]/g,a.displaySize[0]-d[2]/g,a.displaySize[1]-d[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,h=e.bottom*o;return r==="height"||r==="both"?(c=i[1]+m-n[0],f=i[1]+h+n[2]):(c=i[1]+(m+h-a.displaySize[1])/2,f=c+a.displaySize[1]),{image:a,top:c,right:p,bottom:f,left:y,collisionPadding:s}}var uf=Z(Tt(),1);var Dr=255,Ct=128,tt=Dr*Ct;function Ys(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 Qs(t,e,r){let n="never",i=t.get(e);return i?n=i:t.get(r)&&(n="always"),n}var hb=uf.default.VectorTileFeature.types,db=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function ia(t,e,r,n,i,o,a,s,l,u,c,p,f){let y=s?Math.min(tt,Math.round(s[0])):0,m=s?Math.min(tt,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 cf(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 gb(t){for(let e of t.sections)if(vc(e.text))return!0;return!1}var oi=class{constructor(e){this.layoutVertexArray=new Io,this.indexArray=new Le,this.programConfigurations=e,this.segments=new me,this.dynamicLayoutVertexArray=new To,this.opacityVertexArray=new Co,this.hasVisibleVertices=!1,this.placedSymbolArray=new Ln}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,$p.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,Gp.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,db,!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())}};C("SymbolBuffers",oi);var ai=class{constructor(e,r,n){this.layoutVertexArray=new e,this.layoutAttributes=r,this.indexArray=new n,this.segments=new me,this.collisionVertexArray=new ko}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,qp.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}};C("CollisionBuffers",ai);var He=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=jn.identity([]),this.placementViewportMatrix=jn.identity([]);let n=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Ys(this.zoom,n["text-size"]),this.iconSizeData=Ys(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=Qs(i,"text-overlap","text-allow-overlap")!=="never"||Qs(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=>na[l])),this.stateDependentLayerIds=this.layers.filter(l=>l.isStateDependent()).map(l=>l.id),this.sourceID=e.sourceID}createArrays(){this.text=new oi(new Ce(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new oi(new Ce(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new Vn,this.lineVertexArray=new Bn,this.symbolInstances=new Dn,this.textAnchorOffsets=new zn}calculateGlyphDependencies(e,r,n,i,o){for(let a=0;a<e.length;a++)if(r[e.charCodeAt(a)]=!0,(n||i)&&o){let s=Mr[e.charAt(a)];s&&(r[s.charCodeAt(0)]=!0)}}populate(e,r,n){let i=this.layers[0],o=i.layout,a=o.get("text-font"),s=o.get("text-field"),l=o.get("icon-image"),u=(s.value.kind!=="constant"||s.value.value instanceof Fe&&!s.value.value.isEmpty()||s.value.value.toString().length>0)&&(a.value.kind!=="constant"||a.value.value.length>0),c=l.value.kind!=="constant"||!!l.value.value||Object.keys(l.parameters).length>0,p=o.get("symbol-sort-key");if(this.features=[],!u&&!c)return;let f=r.iconDependencies,y=r.glyphDependencies,m=r.availableImages,h=new q(this.zoom);for(let{feature:d,id:g,index:b,sourceLayerIndex:x}of e){let v=i._featureFilter.needGeometry,P=$e(d,v);if(!i._featureFilter.filter(h,P,n))continue;v||(P.geometry=ke(d));let w;if(u){let _=i.getValueAndResolveTokens("text-field",P,n,m),I=Fe.factory(_),k=this.hasRTLText=this.hasRTLText||gb(I);(!k||ye.getRTLTextPluginStatus()==="unavailable"||k&&ye.isParsed())&&(w=jp(I,i,P))}let T;if(c){let _=i.getValueAndResolveTokens("icon-image",P,n,m);_ instanceof Te?T=_:T=Te.fromString(_)}if(!w&&!T)continue;let F=this.sortFeaturesByKey?p.evaluate(P,{},n):void 0,E={id:g,text:w,icon:T,index:b,sourceLayerIndex:x,geometry:P.geometry,properties:d.properties,type:hb[d.type],sortKey:F};if(this.features.push(E),T&&(f[T.name]=!0),w){let _=a.evaluate(P,{},n).join(","),I=o.get("text-rotation-alignment")!=="viewport"&&o.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(2)>=0;for(let k of w.sections)if(k.image)f[k.image.name]=!0;else{let V=mn(w.toString()),A=k.fontStack||_,z=y[A]=y[A]||{};this.calculateGlyphDependencies(k.text,z,I,this.allowVerticalPlacement,V)}}}o.get("symbol-placement")==="line"&&(this.features=Jp(this.features)),this.sortFeaturesByKey&&this.features.sort((d,g)=>d.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,h=e.segments.prepareSegment(4*r.length,m,y,this.canOverlap?a.sortKey:void 0),d=this.glyphOffsetArray.length,g=h.vertexLength,b=this.allowVerticalPlacement&&s===2?Math.PI/2:0,x=a.text&&a.text.sections;for(let v=0;v<r.length;v++){let{tl:P,tr:w,bl:T,br:F,tex:E,pixelOffsetTL:_,pixelOffsetBR:I,minFontScaleX:k,minFontScaleY:V,glyphOffset:A,isSDF:z,sectionIndex:O}=r[v],N=h.vertexLength,K=A[1];ia(m,l.x,l.y,P.x,K+P.y,E.x,E.y,n,z,_.x,_.y,k,V),ia(m,l.x,l.y,w.x,K+w.y,E.x+E.w,E.y,n,z,I.x,_.y,k,V),ia(m,l.x,l.y,T.x,K+T.y,E.x,E.y+E.h,n,z,_.x,I.y,k,V),ia(m,l.x,l.y,F.x,K+F.y,E.x+E.w,E.y+E.h,n,z,I.x,I.y,k,V),cf(e.dynamicLayoutVertexArray,l,b),y.emplaceBack(N,N+1,N+2),y.emplaceBack(N+1,N+2,N+3),h.vertexLength+=4,h.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(A[0]),(v===r.length-1||O!==r[v+1].sectionIndex)&&e.programConfigurations.populatePaintArrays(m.length,a,a.index,{},f,x&&x[O])}e.placedSymbolArray.emplaceBack(l.x,l.y,d,this.glyphOffsetArray.length-d,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 ii.default(e,r)),this._addCollisionDebugVertex(c,p,a,f,y,new ii.default(n,r)),this._addCollisionDebugVertex(c,p,a,f,y,new ii.default(n,i)),this._addCollisionDebugVertex(c,p,a,f,y,new ii.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 ai(On,Zs.members,wt),this.iconCollisionBox=new ai(On,Zs.members,wt);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)}}};C("SymbolBucket",He,{omit:["layers","collisionBoxArray","features","compareText"]});He.MAX_GLYPHS=65535;He.addDynamicAttributes=cf;function pf(t,e){return e.replace(/{([^{}]+)}/g,(r,n)=>t&&n in t?String(t[n]):"")}var ff,xb=()=>ff=ff||new re({"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"])}),yf,bb=()=>yf=yf||new re({"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:Re,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"])}),oa={get paint(){return bb()},get layout(){return xb()}};var si=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:mr,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}};C("FormatSectionOverride",si,{omit:["defaultValue"]});var aa=class t extends se{constructor(e){super(e,oa)}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()&&!Gt(a.value)&&o?pf(r.properties,o):o}createBucket(e){return new He(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let e of oa.paint.overridableProperties){if(!t.hasPaintOverride(this.layout,e))continue;let r=this.paint.get(e),n=new si(r),i=new Ot(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 Se(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=oa.paint.properties[r],o=!1,a=s=>{for(let l of s)if(i.overrides&&i.overrides.hasOverride(l)){o=!0;return}};if(n.value.kind==="constant"&&n.value.value instanceof Fe)a(n.value.value.sections);else if(n.value.kind==="source"){let s=u=>{if(!o)if(u instanceof mt&&ue(u.value)===hr){let c=u.value;a(c.sections)}else u instanceof en?a(u.sections):u.eachChild(s)},l=n.value;l._styleExpression&&s(l._styleExpression.expression)}return o}};function mf(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 hf,vb=()=>hf=hf||new re({"background-color":new B(S.paint_background["background-color"]),"background-pattern":new jt(S.paint_background["background-pattern"]),"background-opacity":new B(S.paint_background["background-opacity"])}),df={get paint(){return vb()}};var sa=class extends se{constructor(e){super(e,df)}};var gf,Pb=()=>gf=gf||new re({"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"])}),xf={get paint(){return Pb()}};var la=class extends se{constructor(e){super(e,xf)}};var ua=class extends se{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 bf(t){if(t.type==="custom")return new ua(t);switch(t.type){case"background":return new sa(t);case"circle":return new Ro(t);case"fill":return new jo(t);case"fill-extrusion":return new Wo(t);case"heatmap":return new Oo(t);case"hillshade":return new No(t);case"line":return new Xo(t);case"raster":return new la(t);case"symbol":return new aa(t)}}var ca=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]=bf(i);o._featureFilter=fn(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=Ou(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 qf=Z(Tt(),1),jf=Z(Qn(),1);var Vr=class{constructor(e){this._stringToNumber={},this._numberToString=[];for(let r=0;r<e.length;r++){let n=e[r];this._stringToNumber[n]=r,this._numberToString[r]=n}}encode(e){return this._stringToNumber[e]}decode(e){if(e>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${e} can\'t be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}};var Sf=Z(Tt(),1),wf=Z(Qn(),1);var pa=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 li=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 Dt(8192,16,0),this.grid3D=new Dt(8192,16,0),this.featureIndexArray=new Rn,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 Sf.default.VectorTile(new wf.default(this.rawTileData)).layers,this.sourceLayerCoder=new Vr(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=fn(o.filter),l=e.queryGeometry,u=e.queryPadding*a,c=Pf(l),p=this.grid.query(c.minX-u,c.minY-u,c.maxX+u,c.maxY+u),f=Pf(e.cameraQueryGeometry),y=this.grid3D.query(f.minX-u,f.minY-u,f.maxX+u,f.maxY+u,(d,g,b,x)=>Bc(e.cameraQueryGeometry,d-u,g-u,b+u,x+u));for(let d of y)p.push(d);p.sort(Sb);let m={},h;for(let d=0;d<p.length;d++){let g=p[d];if(g===h)continue;h=g;let b=this.featureIndexArray.get(g),x=null;this.loadMatchingFeature(m,b.bucketIndex,b.sourceLayerIndex,b.featureIndex,s,o.layers,o.availableImages,r,n,i,(v,P,w)=>(x||(x=ke(v)),P.queryIntersectsFeature(l,v,w,x,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&&!Zl(a,f))return;let y=this.sourceLayerCoder.decode(n),h=this.vtLayers[y].feature(i);if(o.needGeometry){let g=$e(h,!0);if(!o.filter(new q(this.tileID.overscaledZ),g,this.tileID.canonical))return}else if(!o.filter(new q(this.tileID.overscaledZ),h))return;let d=this.getId(h,y);for(let g=0;g<f.length;g++){let b=f[g];if(a&&a.indexOf(b)<0)continue;let x=l[b];if(!x)continue;let v={};d&&c&&(v=c.getState(x.sourceLayer||"_geojsonTileLayer",d));let P=Pe({},u[b]);P.paint=vf(P.paint,x.paint,h,v,s),P.layout=vf(P.layout,x.layout,h,v,s);let w=!p||p(h,x,v);if(!w)continue;let T=new pa(h,this.z,this.x,this.y,d);T.layer=P;let F=e[b];F===void 0&&(F=e[b]=[]),F.push({featureIndex:i,feature:T,intersectionZ:w})}}lookupSymbolFeatures(e,r,n,i,o,a,s,l){let u={};this.loadVTLayers();let c=fn(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}};C("FeatureIndex",li,{omit:["rawTileData","sourceLayerCoder"]});function vf(t,e,r,n,i){return qr(t,(o,a)=>{let s=e instanceof vt?e.get(a):null;return s&&s.evaluate?s.evaluate(r,n,i):s})}function Pf(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 Sb(t,e){return e-t}var Af=Z(he(),1);var rt=class t extends Af.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)}};C("Anchor",rt);function el(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 _f(t){let e=0;for(let r=0;r<t.length-1;r++)e+=t[r].dist(t[r+1]);return e}function If(t,e,r){return t?3/5*e*r:0}function Tf(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function Cf(t,e,r,n,i,o){let a=If(r,i,o),s=Tf(r,n)*o,l=0,u=_f(t)/2;for(let c=0;c<t.length-1;c++){let p=t[c],f=t[c+1],y=p.dist(f);if(l+y>u){let m=(u-l)/y,h=Oe.number(p.x,f.x,m),d=Oe.number(p.y,f.y,m),g=new rt(h,d,f.angleTo(p),c);return g._round(),!a||el(t,g,s,a,e)?g:void 0}l+=y}}function kf(t,e,r,n,i,o,a,s,l){let u=If(n,o,a),c=Tf(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 Mf(t,m,e,u,r,p,f,!1,l)}function Mf(t,e,r,n,i,o,a,s,l){let u=o/2,c=_f(t),p=0,f=e-r,y=[];for(let m=0;m<t.length-1;m++){let h=t[m],d=t[m+1],g=h.dist(d),b=d.angleTo(h);for(;f+r<p+g;){f+=r;let x=(f-p)/g,v=Oe.number(h.x,d.x,x),P=Oe.number(h.y,d.y,x);if(v>=0&&v<l&&P>=0&&P<l&&f-u>=0&&f+u<=c){let w=new rt(v,P,b,m);w._round(),(!n||el(t,w,o,n,i))&&y.push(w)}}p+=g}return!s&&!y.length&&!a&&(y=Mf(t,p/2,r,n,i,o,a,!0,l)),y}var pt=Z(he(),1);function Ef(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 pt.default(e,c.y+(p.y-c.y)*((e-c.x)/(p.x-c.x)))._round():p.x<e&&(p=new pt.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 pt.default(c.x+(p.x-c.x)*((r-c.y)/(p.y-c.y)),r)._round():p.y<r&&(p=new pt.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 pt.default(n,c.y+(p.y-c.y)*((n-c.x)/(p.x-c.x)))._round():p.x>=n&&(p=new pt.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 pt.default(c.x+(p.x-c.x)*((i-c.y)/(p.y-c.y)),i)._round():p.y>=i&&(p=new pt.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 we=Z(he(),1);var Br=ge;function tl(t,e,r,n){let i=[],o=t.image,a=o.pixelRatio,s=o.paddedRect.w-2*Br,l=o.paddedRect.h-2*Br,u=t.right-t.left,c=t.bottom-t.top,p=o.stretchX||[[0,s]],f=o.stretchY||[[0,l]],y=(I,k)=>I+k[1]-k[0],m=p.reduce(y,0),h=f.reduce(y,0),d=s-m,g=l-h,b=0,x=m,v=0,P=h,w=0,T=d,F=0,E=g;if(o.content&&n){let I=o.content;b=fa(p,0,I[0]),v=fa(f,0,I[1]),x=fa(p,I[0],I[2]),P=fa(f,I[1],I[3]),w=I[0]-b,F=I[1]-v,T=I[2]-I[0]-x,E=I[3]-I[1]-P}let _=(I,k,V,A)=>{let z=ya(I.stretch-b,x,u,t.left),O=ma(I.fixed-w,T,I.stretch,m),N=ya(k.stretch-v,P,c,t.top),K=ma(k.fixed-F,E,k.stretch,h),xe=ya(V.stretch-b,x,u,t.left),X=ma(V.fixed-w,T,V.stretch,m),le=ya(A.stretch-v,P,c,t.top),ce=ma(A.fixed-F,E,A.stretch,h),pe=new we.default(z,N),_e=new we.default(xe,N),be=new we.default(xe,le),wi=new we.default(z,le),Ea=new we.default(O/a,K/a),Fa=new we.default(X/a,ce/a),Nr=e*Math.PI/180;if(Nr){let Ie=Math.sin(Nr),ve=Math.cos(Nr),Ve=[ve,-Ie,Ie,ve];pe._matMult(Ve),_e._matMult(Ve),wi._matMult(Ve),be._matMult(Ve)}let Ai=I.stretch+I.fixed,Me=V.stretch+V.fixed,Ft=k.stretch+k.fixed,_i=A.stretch+A.fixed,La={x:o.paddedRect.x+Br+Ai,y:o.paddedRect.y+Br+Ft,w:Me-Ai,h:_i-Ft},Da=T/a/u,Va=E/a/c;return{tl:pe,tr:_e,bl:wi,br:be,tex:La,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Ea,pixelOffsetBR:Fa,minFontScaleX:Da,minFontScaleY:Va,isSDF:r}};if(!n||!o.stretchX&&!o.stretchY)i.push(_({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:s+1},{fixed:0,stretch:l+1}));else{let I=Ff(p,d,m),k=Ff(f,g,h);for(let V=0;V<I.length-1;V++){let A=I[V],z=I[V+1];for(let O=0;O<k.length-1;O++){let N=k[O],K=k[O+1];i.push(_(A,N,z,K))}}}return i}function fa(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 Ff(t,e,r){let n=[{fixed:-Br,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+Br,stretch:r}),n}function ya(t,e,r,n){return t/e*r+n}function ma(t,e,r,n){return t-e*r/n}function Lf(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=Qo+1,h=!0,d=1,g=0,b=(i||s)&&p.vertical,x=p.metrics.advance*p.scale/2;if(s&&e.verticalizable){let X=(p.scale-1)*ne,le=(ne-p.metrics.width*p.scale)/2;g=c.lineOffset/2-(p.imageName?-le:X)}if(p.imageName){let X=a[p.imageName];h=X.sdf,d=X.pixelRatio,m=ge/d}let v=i?[p.x+x,p.y]:[0,0],P=i?[0,0]:[p.x+x+r[0],p.y+r[1]-g],w=[0,0];b&&(w=P,P=[0,0]);let T=p.metrics.isDoubleResolution?2:1,F=(p.metrics.left-m)*p.scale-x+P[0],E=(-p.metrics.top-m)*p.scale+P[1],_=F+f.w/T*p.scale/d,I=E+f.h/T*p.scale/d,k=new we.default(F,E),V=new we.default(_,E),A=new we.default(F,I),z=new we.default(_,I);if(b){let X=new we.default(-x,x-Lr),le=-Math.PI/2,ce=ne/2-x,pe=p.imageName?ce:0,_e=new we.default(5-Lr-ce,-pe),be=new we.default(...w);k._rotateAround(le,X)._add(_e)._add(be),V._rotateAround(le,X)._add(_e)._add(be),A._rotateAround(le,X)._add(_e)._add(be),z._rotateAround(le,X)._add(_e)._add(be)}if(l){let X=Math.sin(l),le=Math.cos(l),ce=[le,-X,X,le];k._matMult(ce),V._matMult(ce),A._matMult(ce),z._matMult(ce)}let O=new we.default(0,0),N=new we.default(0,0);u.push({tl:k,tr:V,bl:A,br:z,tex:f,writingMode:e.writingMode,glyphOffset:v,sectionIndex:p.sectionIndex,isSDF:h,pixelOffsetTL:O,pixelOffsetBR:N,minFontScaleX:0,minFontScaleY:0})}return u}var ui=Z(he(),1),ir=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],h=a.collisionPadding;if(h&&(y-=h[0]*s,p-=h[1]*s,m+=h[2]*s,f+=h[3]*s),c){let d=new ui.default(y,p),g=new ui.default(m,p),b=new ui.default(y,f),x=new ui.default(m,f),v=c*Math.PI/180;d._rotate(v),g._rotate(v),b._rotate(v),x._rotate(v),y=Math.min(d.x,g.x,b.x,x.x),m=Math.max(d.x,g.x,b.x,x.x),p=Math.min(d.y,g.y,b.y,x.y),f=Math.max(d.y,g.y,b.y,x.y)}e.emplaceBack(r.x,r.y,y,p,m,f,n,i,o)}this.boxEndIndex=e.length}};var ci=class{constructor(e=[],r=wb){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 wb(t,e){return t<e?-1:t>e?1:0}var rl=Z(he(),1);function Df(t,e=1,r=!1){let n=1/0,i=1/0,o=-1/0,a=-1/0,s=t[0];for(let h=0;h<s.length;h++){let d=s[h];(!h||d.x<n)&&(n=d.x),(!h||d.y<i)&&(i=d.y),(!h||d.x>o)&&(o=d.x),(!h||d.y>a)&&(a=d.y)}let l=o-n,u=a-i,c=Math.min(l,u),p=c/2,f=new ci([],Ab);if(c===0)return new rl.default(n,i);for(let h=n;h<o;h+=c)for(let d=i;d<a;d+=c)f.push(new zr(h+p,d+p,p,t));let y=Ib(t),m=f.length;for(;f.length;){let h=f.pop();(h.d>y.d||!y.d)&&(y=h,r&&console.log("found best %d after %d probes",Math.round(1e4*h.d)/1e4,m)),!(h.max-y.d<=e)&&(p=h.h/2,f.push(new zr(h.p.x-p,h.p.y-p,p,t)),f.push(new zr(h.p.x+p,h.p.y-p,p,t)),f.push(new zr(h.p.x-p,h.p.y+p,p,t)),f.push(new zr(h.p.x+p,h.p.y+p,p,t)),m+=4)}return r&&(console.log(`num probes: ${m}`),console.log(`best distance: ${y.d}`)),y.p}function Ab(t,e){return e.max-t.max}function zr(t,e,r,n){this.p=new rl.default(t,e),this.h=r,this.d=_b(this.p,n),this.max=this.d+this.h*Math.SQRT2}function _b(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 Ib(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 zr(r/e,n/e,0,t)}var al=Z(Ts(),1);var nl=(o=>(o[o.center=1]="center",o[o.left=2]="left",o[o.right=3]="right",o[o.top=4]="top",o[o.bottom=5]="bottom",o[o["top-left"]=6]="top-left",o[o["top-right"]=7]="top-right",o[o["bottom-left"]=8]="bottom-left",o[o["bottom-right"]=9]="bottom-right",o))(nl||{}),kt=7,ha=Number.POSITIVE_INFINITY;function il(t,e){function r(i,o){let a=0,s=0;o<0&&(o=0);let l=o/Math.SQRT2;switch(i){case"top-right":case"top-left":s=l-kt;break;case"bottom-right":case"bottom-left":s=-l+kt;break;case"bottom":s=-o+kt;break;case"top":s=o-kt;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-kt;break;case"bottom-right":case"bottom-left":case"bottom":l=-a+kt;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]!==ha?n(t,e[0],e[1]):r(t,e[0])}function ol(t,e,r){let n=t.layout,i=n.get("text-variable-anchor-offset")?.evaluate(e,{},r);if(i){let a=i.values,s=[];for(let l=0;l<a.length;l+=2){let u=s[l]=a[l],c=a[l+1].map(p=>p*ne);u.startsWith("top")?c[1]-=kt:u.startsWith("bottom")&&(c[1]+=kt),s[l+1]=c}return new Ne(s)}let o=n.get("text-variable-anchor");if(o){let a;t._unevaluatedLayout.getValue("text-radial-offset")!==void 0?a=[n.get("text-radial-offset").evaluate(e,{},r)*ne,ha]:a=n.get("text-offset").evaluate(e,{},r).map(u=>u*ne);let l=[];for(let u of o)l.push(u,il(u,a));return new Ne(l)}return null}function zf(t){t.bucket.createArrays();let e=512*t.bucket.overscaling;t.bucket.tilePixelRatio=8192/e,t.bucket.compareText={},t.bucket.iconsNeedLinear=!1;let r=t.bucket.layers[0],n=r.layout,i=r._unevaluatedLayout._values,o={layoutIconSize:i["icon-size"].possiblyEvaluate(new q(t.bucket.zoom+1),t.canonical),layoutTextSize:i["text-size"].possiblyEvaluate(new q(t.bucket.zoom+1),t.canonical),textMaxSize:i["text-size"].possiblyEvaluate(new q(18))};if(t.bucket.textSizeData.kind==="composite"){let{minZoom:c,maxZoom:p}=t.bucket.textSizeData;o.compositeTextSizes=[i["text-size"].possiblyEvaluate(new q(c),t.canonical),i["text-size"].possiblyEvaluate(new q(p),t.canonical)]}if(t.bucket.iconSizeData.kind==="composite"){let{minZoom:c,maxZoom:p}=t.bucket.iconSizeData;o.compositeIconSizes=[i["icon-size"].possiblyEvaluate(new q(c),t.canonical),i["icon-size"].possiblyEvaluate(new q(p),t.canonical)]}let a=n.get("text-line-height")*ne,s=n.get("text-rotation-alignment")!=="viewport"&&n.get("symbol-placement")!=="point",l=n.get("text-keep-upright"),u=n.get("text-size");for(let c of t.bucket.features){let p=n.get("text-font").evaluate(c,{},t.canonical).join(","),f=u.evaluate(c,{},t.canonical),y=o.layoutTextSize.evaluate(c,{},t.canonical),m=o.layoutIconSize.evaluate(c,{},t.canonical),h={horizontal:{},vertical:void 0},d=c.text,g=[0,0];if(d){let P=d.toString(),w=n.get("text-letter-spacing").evaluate(c,{},t.canonical)*ne,T=dc(P)?w:0,F=n.get("text-anchor").evaluate(c,{},t.canonical),E=ol(r,c,t.canonical);if(!E){let A=n.get("text-radial-offset").evaluate(c,{},t.canonical);A?g=il(F,[A*ne,ha]):g=n.get("text-offset").evaluate(c,{},t.canonical).map(z=>z*ne)}let _=s?"center":n.get("text-justify").evaluate(c,{},t.canonical),I=n.get("symbol-placement"),k=I==="point"?n.get("text-max-width").evaluate(c,{},t.canonical)*ne:0,V=()=>{t.bucket.allowVerticalPlacement&&mn(P)&&(h.vertical=ni(d,t.glyphMap,t.glyphPositions,t.imagePositions,p,k,a,F,"left",T,g,2,!0,I,y,f))};if(!s&&E){let A=new Set;if(_==="auto")for(let O=0;O<E.values.length;O+=2)A.add(Vf(E.values[O]));else A.add(_);let z=!1;for(let O of A)if(!h.horizontal[O])if(z)h.horizontal[O]=h.horizontal[0];else{let N=ni(d,t.glyphMap,t.glyphPositions,t.imagePositions,p,k,a,"center",O,T,g,1,!1,I,y,f);N&&(h.horizontal[O]=N,z=N.positionedLines.length===1)}V()}else{_==="auto"&&(_=Vf(F));let A=ni(d,t.glyphMap,t.glyphPositions,t.imagePositions,p,k,a,F,_,T,g,1,!1,I,y,f);A&&(h.horizontal[_]=A),V(),mn(P)&&s&&l&&(h.vertical=ni(d,t.glyphMap,t.glyphPositions,t.imagePositions,p,k,a,F,_,T,g,2,!1,I,y,f))}}let b,x=!1;if(c.icon&&c.icon.name){let P=t.imageMap[c.icon.name];P&&(b=lf(t.imagePositions[c.icon.name],n.get("icon-offset").evaluate(c,{},t.canonical),n.get("icon-anchor").evaluate(c,{},t.canonical)),x=!!P.sdf,t.bucket.sdfIcons===void 0?t.bucket.sdfIcons=x:t.bucket.sdfIcons!==x&&fe("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(P.pixelRatio!==t.bucket.pixelRatio||n.get("icon-rotate").constantOr(1)!==0)&&(t.bucket.iconsNeedLinear=!0))}let v=Rf(h.horizontal)||h.vertical;t.bucket.iconsInText=v?v.iconsInText:!1,(v||b)&&Tb(t.bucket,c,h,b,t.imageMap,o,y,m,g,x,t.canonical)}t.showCollisionBoxes&&t.bucket.generateCollisionDebugBuffers()}function Vf(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 Tb(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=Rf(r.horizontal),h=24,d=a/h,g=t.tilePixelRatio*d,b=t.tilePixelRatio*p/h,x=t.tilePixelRatio*s,v=t.tilePixelRatio*f.get("symbol-spacing"),P=f.get("text-padding")*t.tilePixelRatio,w=mf(f,e,c,t.tilePixelRatio),T=f.get("text-max-angle")/180*Math.PI,F=f.get("text-rotation-alignment")!=="viewport"&&f.get("symbol-placement")!=="point",E=f.get("icon-rotation-alignment")==="map"&&f.get("symbol-placement")!=="point",_=f.get("symbol-placement"),I=v/2,k=f.get("icon-text-fit"),V;n&&k!=="none"&&(t.allowVerticalPlacement&&r.vertical&&(V=Ks(n,r.vertical,k,f.get("icon-text-fit-padding"),y,d)),m&&(n=Ks(n,m,k,f.get("icon-text-fit-padding"),y,d)));let A=(z,O)=>{O.x<0||O.x>=8192||O.y<0||O.y>=8192||kb(t,O,z,r,n,i,V,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,g,[P,P,P,P],F,l,x,w,E,y,e,o,u,c,a)};if(_==="line")for(let z of Ef(e.geometry,0,0,8192,8192)){let O=kf(z,v,T,r.vertical||m,n,h,b,t.overscaling,8192);for(let N of O){let K=m;(!K||!Mb(t,K.text,I,N))&&A(z,N)}}else if(_==="line-center"){for(let z of e.geometry)if(z.length>1){let O=Cf(z,T,r.vertical||m,n,h,b);O&&A(z,O)}}else if(e.type==="Polygon")for(let z of Ir(e.geometry,0)){let O=Df(z,16);A(z[0],new rt(O.x,O.y,0))}else if(e.type==="LineString")for(let z of e.geometry)A(z,new rt(z[0].x,z[0].y,0));else if(e.type==="Point")for(let z of e.geometry)for(let O of z)A([O],new rt(O.x,O.y,0))}function Cb(t,e){let r=t.length,n=e?.values;if(n?.length>0)for(let i=0;i<n.length;i+=2){let o=nl[n[i]],a=n[i+1];t.emplaceBack(o,a[0],a[1])}return[r,t.length]}function Bf(t,e,r,n,i,o,a,s,l,u,c,p,f,y,m){let h=Lf(e,r,s,i,o,a,n,t.allowVerticalPlacement),d=t.textSizeData,g=null;d.kind==="source"?(g=[Ct*i.layout.get("text-size").evaluate(a,{})],g[0]>tt&&fe(`${t.layerIds[0]}: Value for "text-size" is >= ${Dr}. Reduce your "text-size".`)):d.kind==="composite"&&(g=[Ct*y.compositeTextSizes[0].evaluate(a,{},m),Ct*y.compositeTextSizes[1].evaluate(a,{},m)],(g[0]>tt||g[1]>tt)&&fe(`${t.layerIds[0]}: Value for "text-size" is >= ${Dr}. Reduce your "text-size".`)),t.addSymbols(t.text,h,g,s,o,a,u,e,l.lineStartIndex,l.lineLength,f,m);for(let b of c)p[b]=t.text.placedSymbolArray.length-1;return h.length*4}function Rf(t){for(let e in t)return t[e];return null}function kb(t,e,r,n,i,o,a,s,l,u,c,p,f,y,m,h,d,g,b,x,v,P,w,T,F){let E=t.addToLineVertexArray(e,r),_,I,k,V,A=0,z=0,O=0,N=0,K=-1,xe=-1,X={},le=(0,al.default)("");if(t.allowVerticalPlacement&&n.vertical){let ve=s.layout.get("text-rotate").evaluate(v,{},T)+90,Ve=n.vertical;k=new ir(l,e,u,c,p,Ve,f,y,m,ve),a&&(V=new ir(l,e,u,c,p,a,d,g,m,ve))}if(i){let Ie=s.layout.get("icon-rotate").evaluate(v,{}),ve=s.layout.get("icon-text-fit")!=="none",Ve=tl(i,Ie,w,ve),Ur=a?tl(a,Ie,w,ve):void 0;I=new ir(l,e,u,c,p,i,d,g,!1,Ie),A=Ve.length*4;let Ll=t.iconSizeData,Lt=null;Ll.kind==="source"?(Lt=[Ct*s.layout.get("icon-size").evaluate(v,{})],Lt[0]>tt&&fe(`${t.layerIds[0]}: Value for "icon-size" is >= ${Dr}. Reduce your "icon-size".`)):Ll.kind==="composite"&&(Lt=[Ct*P.compositeIconSizes[0].evaluate(v,{},T),Ct*P.compositeIconSizes[1].evaluate(v,{},T)],(Lt[0]>tt||Lt[1]>tt)&&fe(`${t.layerIds[0]}: Value for "icon-size" is >= ${Dr}. Reduce your "icon-size".`)),t.addSymbols(t.icon,Ve,Lt,x,b,v,0,e,E.lineStartIndex,E.lineLength,-1,T),K=t.icon.placedSymbolArray.length-1,Ur&&(z=Ur.length*4,t.addSymbols(t.icon,Ur,Lt,x,b,v,2,e,E.lineStartIndex,E.lineLength,-1,T),xe=t.icon.placedSymbolArray.length-1)}let ce=Object.keys(n.horizontal);for(let Ie of ce){let ve=n.horizontal[Ie];if(!_){le=(0,al.default)(ve.text);let Ur=s.layout.get("text-rotate").evaluate(v,{},T);_=new ir(l,e,u,c,p,ve,f,y,m,Ur)}let Ve=ve.positionedLines.length===1;if(O+=Bf(t,e,ve,o,s,m,v,h,E,n.vertical?1:3,Ve?ce:[Ie],X,K,P,T),Ve)break}n.vertical&&(N+=Bf(t,e,n.vertical,o,s,m,v,h,E,2,["vertical"],X,xe,P,T));let pe=_?_.boxStartIndex:t.collisionBoxArray.length,_e=_?_.boxEndIndex:t.collisionBoxArray.length,be=k?k.boxStartIndex:t.collisionBoxArray.length,wi=k?k.boxEndIndex:t.collisionBoxArray.length,Ea=I?I.boxStartIndex:t.collisionBoxArray.length,Fa=I?I.boxEndIndex:t.collisionBoxArray.length,Nr=V?V.boxStartIndex:t.collisionBoxArray.length,Ai=V?V.boxEndIndex:t.collisionBoxArray.length,Me=-1,Ft=(Ie,ve)=>Ie&&Ie.circleDiameter?Math.max(Ie.circleDiameter,ve):ve;Me=Ft(_,Me),Me=Ft(k,Me),Me=Ft(I,Me),Me=Ft(V,Me);let _i=Me>-1?1:0;_i&&(Me*=F/ne),t.glyphOffsetArray.length>=He.MAX_GLYPHS&&fe("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),v.sortKey!==void 0&&t.addToSortKeyRanges(t.symbolInstances.length,v.sortKey);let La=ol(s,v,T),[Da,Va]=Cb(t.textAnchorOffsets,La);t.symbolInstances.emplaceBack(e.x,e.y,X.right>=0?X.right:-1,X.center>=0?X.center:-1,X.left>=0?X.left:-1,X.vertical||-1,K,xe,le,pe,_e,be,wi,Ea,Fa,Nr,Ai,u,O,N,A,z,_i,0,f,Me,Da,Va)}function Mb(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 da=1,pi=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*da,h:p.bitmap.height+2*da};n.push(f),u[c]={rect:f,metrics:p.metrics}}}let{w:i,h:o}=ei(n),a=new Qt({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;Qt.copy(c.bitmap,a,{x:0,y:0},{x:p.x+da,y:p.y+da},c.bitmap)}}this.image=a,this.positions=r}};C("GlyphAtlas",pi);function Nf(t,e,r){e=Math.pow(2,r)-e-1;var n=Of(t*256,e*256,r),i=Of((t+1)*256,(e+1)*256,r);return n[0]+","+n[1]+","+i[0]+","+i[1]}function Of(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 Gf=Z(he(),1);var sl=63710088e-1,fi=class t{constructor(e,r){if(isNaN(e)||isNaN(r))throw new Error(`Invalid LngLat object: (${e}, ${r})`);if(this.lng=+e,this.lat=+r,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new t(ql(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){let r=Math.PI/180,n=this.lat*r,i=e.lat*r,o=Math.sin(n)*Math.sin(i)+Math.cos(n)*Math.cos(i)*Math.cos((e.lng-this.lng)*r);return sl*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 Uf=2*Math.PI*sl;function $f(t){return Uf*Math.cos(t*Math.PI/180)}function Eb(t){return(180+t)/360}function Fb(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function Lb(t,e){return t/$f(e)}function Db(t){return t*360-180}function ll(t){let e=180-t*360;return 360/Math.PI*Math.atan(Math.exp(e*Math.PI/180))-90}function Vb(t,e){return t*$f(ll(e))}function Bb(t){return 1/Math.cos(t*Math.PI/180)}var ga=class t{constructor(e,r,n=0){this.x=+e,this.y=+r,this.z=+n}static fromLngLat(e,r=0){let n=fi.convert(e);return new t(Eb(n.lng),Fb(n.lat),Lb(r,n.lat))}toLngLat(){return new fi(Db(this.x),ll(this.y))}toAltitude(){return Vb(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/Uf*Bb(ll(this.y))}};var xa=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=${r}, y=${n}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} 0<=z<=25 `);this.z=e,this.x=r,this.y=n,this.key=yi(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=Nf(this.x,this.y,this.z),o=zb(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 Gf.default((e.x*r-this.x)*8192,(e.y*r-this.y)*8192)}toString(){return`${this.z}/${this.x}/${this.y}`}},ul=class{constructor(e,r){this.wrap=e,this.canonical=r,this.key=yi(e,r.z,r.z,r.x,r.y)}},mi=class t{constructor(e,r,n,i,o){if(e<n)throw new Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${n}`);this.overscaledZ=e,this.wrap=r,this.canonical=new xa(n,+i,+o),this.key=yi(r,e,n,i,o)}clone(){return new t(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);let r=this.canonical.z-e;return e>this.canonical.z?new t(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new t(e,this.wrap,e,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(e,r){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);let n=this.canonical.z-e;return e>this.canonical.z?yi(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):yi(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 ul(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new ga(e.x-this.wrap,e.y))}};function yi(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 zb(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}C("CanonicalTileID",xa);C("OverscaledTileID",mi,{omit:["posMatrix"]});var ba=class{constructor(e){this.tileID=new mi(e.tileID.overscaledZ,e.tileID.wrap,e.tileID.canonical.z,e.tileID.canonical.x,e.tileID.canonical.y),this.uid=e.uid,this.zoom=e.zoom,this.pixelRatio=e.pixelRatio,this.tileSize=e.tileSize,this.source=e.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=e.showCollisionBoxes,this.collectResourceTiming=!!e.collectResourceTiming,this.returnDependencies=!!e.returnDependencies,this.promoteId=e.promoteId,this.inFlightDependencies=[]}async parse(e,r,n,i){this.status="parsing",this.data=e,this.collisionBoxArray=new Fn;let o=new Vr(Object.keys(e.layers).sort()),a=new li(this.tileID,this.promoteId);a.bucketLayerIDs=[];let s={},l={featureIndex:a,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:n},u=r.familiesBySource[this.source];for(let P in u){let w=e.layers[P];if(!w)continue;w.version===1&&fe(`Vector tile source "${this.source}" layer "${P}" does not use vector tile spec v2 and therefore may have some rendering errors.`);let T=o.encode(P),F=[];for(let E=0;E<w.length;E++){let _=w.feature(E),I=a.getId(_,P);F.push({feature:_,id:I,index:E,sourceLayerIndex:T})}for(let E of u[P]){let _=E[0];if(_.source!==this.source&&fe(`layer.source = ${_.source} does not equal this.source = ${this.source}`),_.minzoom&&this.zoom<Math.floor(_.minzoom)||_.maxzoom&&this.zoom>=_.maxzoom||_.visibility==="none")continue;cl(E,this.zoom,n),(s[_.id]=_.createBucket({index:a.bucketLayerIDs.length,layers:E,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:T,sourceID:this.source})).populate(F,l,this.tileID.canonical),a.bucketLayerIDs.push(E.map(k=>k.id))}}let c=qr(l.glyphDependencies,P=>Object.keys(P).map(Number));this.inFlightDependencies.forEach(P=>P?.abort()),this.inFlightDependencies=[];let p=Promise.resolve({});if(Object.keys(c).length){let P=new AbortController;this.inFlightDependencies.push(P),p=i.sendAsync({type:"GG",data:{stacks:c,source:this.source,tileID:this.tileID,type:"glyphs"}},P)}let f=Object.keys(l.iconDependencies),y=Promise.resolve({});if(f.length){let P=new AbortController;this.inFlightDependencies.push(P),y=i.sendAsync({type:"GI",data:{icons:f,source:this.source,tileID:this.tileID,type:"icons"}},P)}let m=Object.keys(l.patternDependencies),h=Promise.resolve({});if(m.length){let P=new AbortController;this.inFlightDependencies.push(P),h=i.sendAsync({type:"GI",data:{icons:m,source:this.source,tileID:this.tileID,type:"patterns"}},P)}let[d,g,b]=await Promise.all([p,y,h]),x=new pi(d),v=new ti(g,b);for(let P in s){let w=s[P];w instanceof He?(cl(w.layers,this.zoom,n),zf({bucket:w,glyphMap:d,glyphPositions:x.positions,imageMap:g,imagePositions:v.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):w.hasPattern&&(w instanceof nr||w instanceof tr||w instanceof rr)&&(cl(w.layers,this.zoom,n),w.addFeatures(l,this.tileID.canonical,v.patternPositions))}return this.status="done",{buckets:Object.values(s).filter(P=>!P.isEmpty()),featureIndex:a,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:x.image,imageAtlas:v,glyphMap:this.returnDependencies?d:null,iconMap:this.returnDependencies?g:null,glyphPositions:this.returnDependencies?x.positions:null}}};function cl(t,e,r){let n=new q(e);for(let i of t)i.recalculate(n,r)}var Rb=60,NI=1e3/Rb;var Rr=class{constructor(e){this._marks={start:[e.url,"start"].join("#"),end:[e.url,"end"].join("#"),measure:e.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let e=performance.getEntriesByName(this._marks.measure);return e.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),e=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),e}};var Or=class{constructor(e,r,n){this.actor=e,this.layerIndex=r,this.availableImages=n,this.fetching={},this.loading={},this.loaded={}}async loadVectorTile(e,r){let n=await cc(e.request,r);try{return{vectorTile:new qf.default.VectorTile(new jf.default(n.data)),rawData:n.data,cacheControl:n.cacheControl,expires:n.expires}}catch(i){let o=new Uint8Array(n.data),a=o[0]===31&&o[1]===139,s=`Unable to parse the tile at ${e.request.url}, `;throw a?s+="please make sure the data is not gzipped and that you have configured the relevant header in the server":s+=`got error: ${i.messge}`,new Error(s)}}async loadTile(e){let r=e.uid,n=e&&e.request&&e.request.collectResourceTiming?new Rr(e.request):!1,i=new ba(e);this.loading[r]=i;let o=new AbortController;i.abort=o;try{let a=await this.loadVectorTile(e,o);if(delete this.loading[r],!a)return null;let s=a.rawData,l={};a.expires&&(l.expires=a.expires),a.cacheControl&&(l.cacheControl=a.cacheControl);let u={};if(n){let p=n.finish();p&&(u.resourceTiming=JSON.parse(JSON.stringify(p)))}i.vectorTile=a.vectorTile;let c=i.parse(a.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[r]=i,this.fetching[r]={rawTileData:s,cacheControl:l,resourceTiming:u};try{let p=await c;return Pe({rawTileData:s.slice(0)},p,l,u)}finally{delete this.fetching[r]}}catch(a){throw delete this.loading[r],i.status="done",this.loaded[r]=i,a}}async reloadTile(e){let r=e.uid;if(!this.loaded||!this.loaded[r])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");let n=this.loaded[r];if(n.showCollisionBoxes=e.showCollisionBoxes,n.status==="parsing"){let i=await n.parse(n.vectorTile,this.layerIndex,this.availableImages,this.actor),o;if(this.fetching[r]){let{rawTileData:a,cacheControl:s,resourceTiming:l}=this.fetching[r];delete this.fetching[r],o=Pe({rawTileData:a.slice(0)},i,s,l)}else o=i;return o}if(n.status==="done"&&n.vectorTile)return n.parse(n.vectorTile,this.layerIndex,this.availableImages,this.actor)}async abortTile(e){let r=this.loading,n=e.uid;r&&r[n]&&r[n].abort&&(r[n].abort.abort(),delete r[n])}async removeTile(e){this.loaded&&this.loaded[e.uid]&&delete this.loaded[e.uid]}};var hi=class{constructor(e,r,n,i=1,o=1,a=1,s=0){if(this.uid=e,r.height!==r.width)throw new RangeError("DEM tiles must be square");if(n&&!["mapbox","terrarium","custom"].includes(n)){fe(`"${n}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);return}this.stride=r.height;let l=this.dim=r.height-2;switch(this.data=new Uint32Array(r.data.buffer),n){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=i,this.greenFactor=o,this.blueFactor=a,this.baseShift=s;break;case"mapbox":default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4;break}for(let u=0;u<l;u++)this.data[this._idx(-1,u)]=this.data[this._idx(0,u)],this.data[this._idx(l,u)]=this.data[this._idx(l-1,u)],this.data[this._idx(u,-1)]=this.data[this._idx(u,0)],this.data[this._idx(u,l)]=this.data[this._idx(u,l-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(l,-1)]=this.data[this._idx(l-1,0)],this.data[this._idx(-1,l)]=this.data[this._idx(0,l-1)],this.data[this._idx(l,l)]=this.data[this._idx(l-1,l-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let u=0;u<l;u++)for(let c=0;c<l;c++){let p=this.get(u,c);p>this.max&&(this.max=p),p<this.min&&(this.min=p)}}get(e,r){let n=new Uint8Array(this.data.buffer),i=this._idx(e,r)*4;return this.unpack(n[i],n[i+1],n[i+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(e,r){if(e<-1||e>=this.dim+1||r<-1||r>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(e+1)}unpack(e,r,n){return e*this.redFactor+r*this.greenFactor+n*this.blueFactor-this.baseShift}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)]}};C("DEMData",hi);var va=class{constructor(){this.loaded={}}async loadTile(e){let{uid:r,encoding:n,rawImageData:i,redFactor:o,greenFactor:a,blueFactor:s,baseShift:l}=e,u=i.width+2,c=i.height+2,p=jr(i)?new de({width:u,height:c},await Hl(i,-1,-1,u,c)):i,f=new hi(r,p,n,o,a,s,l);return this.loaded=this.loaded||{},this.loaded[r]=f,f}removeTile(e){let r=this.loaded,n=e.uid;r&&r[n]&&delete r[n]}};var xy=Z(Hf(),1);var pl=Z(he(),1),Xf=Z(Tt(),1);var Ob=Xf.default.VectorTileFeature.prototype.toGeoJSON,fl=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 pl.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 pl.default(i[0],i[1]));e.push(n)}return e}}toGeoJSON(e,r,n){return Ob.call(this,e,r,n)}},Sa=class{constructor(e){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=8192,this.length=e.length,this._features=e}feature(e){return new fl(this._features[e])}};var by=Z(ry(),1);var ny=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],hl=1,gi=8,bi=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!==hl)throw new Error(`Got v${i} data when expected v${hl}.`);let o=ny[n&15];if(!o)throw new Error("Unrecognized array type.");let[a]=new Uint16Array(e,2,1),[s]=new Uint32Array(e,4,1);return new t(s,a,o,e)}constructor(e,r=64,n=Float64Array,i){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=n,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;let o=ny.indexOf(this.ArrayType),a=e*2*this.ArrayType.BYTES_PER_ELEMENT,s=e*this.IndexArrayType.BYTES_PER_ELEMENT,l=(8-s%8)%8;if(o<0)throw new Error(`Unexpected typed array class: ${n}.`);i&&i instanceof ArrayBuffer?(this.data=i,this.ids=new this.IndexArrayType(this.data,gi,e),this.coords=new this.ArrayType(this.data,gi+s+l,e*2),this._pos=e*2,this._finished=!0):(this.data=new ArrayBuffer(gi+a+s+l),this.ids=new this.IndexArrayType(this.data,gi,e),this.coords=new this.ArrayType(this.data,gi+s+l,e*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,(hl<<4)+o]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=e)}add(e,r){let n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=e,this.coords[this._pos++]=r,n}finish(){let e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return gl(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 d=f;d<=p;d++){let g=a[2*d],b=a[2*d+1];g>=e&&g<=n&&b>=r&&b<=i&&u.push(o[d])}continue}let y=f+p>>1,m=a[2*y],h=a[2*y+1];m>=e&&m<=n&&h>=r&&h<=i&&u.push(o[y]),(c===0?e<=m:r<=h)&&(l.push(f),l.push(y-1),l.push(1-c)),(c===0?n>=m:i>=h)&&(l.push(y+1),l.push(p),l.push(1-c))}return u}within(e,r,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:i,coords:o,nodeSize:a}=this,s=[0,i.length-1,0],l=[],u=n*n;for(;s.length;){let c=s.pop()||0,p=s.pop()||0,f=s.pop()||0;if(p-f<=a){for(let d=f;d<=p;d++)iy(o[2*d],o[2*d+1],e,r)<=u&&l.push(i[d]);continue}let y=f+p>>1,m=o[2*y],h=o[2*y+1];iy(m,h,e,r)<=u&&l.push(i[y]),(c===0?e-n<=m:r-n<=h)&&(s.push(f),s.push(y-1),s.push(1-c)),(c===0?e+n>=m:r+n>=h)&&(s.push(y+1),s.push(p),s.push(1-c))}return l}};function gl(t,e,r,n,i,o){if(i-n<=r)return;let a=n+i>>1;oy(t,e,a,n,i,o),gl(t,e,r,n,a-1,1-o),gl(t,e,r,a+1,i,1-o)}function oy(t,e,r,n,i,o){for(;i>n;){if(i-n>600){let u=i-n+1,c=r-n+1,p=Math.log(u),f=.5*Math.exp(2*p/3),y=.5*Math.sqrt(p*f*(u-f)/u)*(c-u/2<0?-1:1),m=Math.max(n,Math.floor(r-c*f/u+y)),h=Math.min(i,Math.floor(r+(u-c)*f/u+y));oy(t,e,r,m,h,o)}let a=e[2*r+o],s=n,l=i;for(xi(t,e,n,r),e[2*i+o]>a&&xi(t,e,n,i);s<l;){for(xi(t,e,s,l),s++,l--;e[2*s+o]<a;)s++;for(;e[2*l+o]>a;)l--}e[2*n+o]===a?xi(t,e,n,l):(l++,xi(t,e,l,i)),l<=r&&(n=l+1),r<=l&&(i=l-1)}}function xi(t,e,r,n){dl(t,r,n),dl(e,2*r,2*n),dl(e,2*r+1,2*n+1)}function dl(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}function iy(t,e,r,n){let i=t-r,o=e-n;return i*i+o*o}var Xb={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},ay=Math.fround||(t=>e=>(t[0]=+e,t[0]))(new Float32Array(1)),or=2,Et=3,xl=4,Mt=5,ly=6,vi=class{constructor(e){this.options=Object.assign(Object.create(Xb),e),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(e){let{log:r,minZoom:n,maxZoom:i}=this.options;r&&console.time("total time");let o=`prepare ${e.length} points`;r&&console.time(o),this.points=e;let a=[];for(let l=0;l<e.length;l++){let u=e[l];if(!u.geometry)continue;let[c,p]=u.geometry.coordinates,f=ay(Aa(c)),y=ay(_a(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),_a(a),Aa(o),_a(i)),u=s.data,c=[];for(let p of l){let f=this.stride*p;c.push(u[f+Mt]>1?sy(u,f,this.clusterProps):this.points[u[f+Et]])}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+xl]===e&&p.push(a[y+Mt]>1?sy(a,y,this.clusterProps):this.points[a[y+Et]])}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 bi(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+Mt]>1,c,p,f;if(u)c=uy(r,l,this.clusterProps),p=r[l],f=r[l+1];else{let h=this.points[r[l+Et]];c=h.properties;let[d,g]=h.geometry.coordinates;p=Aa(d),f=_a(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+Et]:m=this.points[r[l+Et]].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+or]<=r)continue;l[p+or]=r;let f=l[p],y=l[p+1],m=e.within(l[p],l[p+1],s),h=l[p+Mt],d=h;for(let g of m){let b=g*c;l[b+or]>r&&(d+=l[b+Mt])}if(d>h&&d>=a){let g=f*h,b=y*h,x,v=-1,P=((p/c|0)<<5)+(r+1)+this.points.length;for(let w of m){let T=w*c;if(l[T+or]<=r)continue;l[T+or]=r;let F=l[T+Mt];g+=l[T]*F,b+=l[T+1]*F,l[T+xl]=P,o&&(x||(x=this._map(l,p,!0),v=this.clusterProps.length,this.clusterProps.push(x)),o(x,this._map(l,T)))}l[p+xl]=P,u.push(g/d,b/d,1/0,P,-1,d),o&&u.push(v)}else{for(let g=0;g<c;g++)u.push(l[p+g]);if(d>1)for(let g of m){let b=g*c;if(!(l[b+or]<=r)){l[b+or]=r;for(let x=0;x<c;x++)u.push(l[b+x])}}}}return u}_getOriginId(e){return e-this.points.length>>5}_getOriginZoom(e){return(e-this.points.length)%32}_map(e,r,n){if(e[r+Mt]>1){let a=this.clusterProps[e[r+ly]];return n?Object.assign({},a):a}let i=this.points[e[r+Et]].properties,o=this.options.map(i);return n&&o===i?Object.assign({},o):o}};function sy(t,e,r){return{type:"Feature",id:t[e+Et],properties:uy(t,e,r),geometry:{type:"Point",coordinates:[Kb(t[e]),Yb(t[e+1])]}}}function uy(t,e,r){let n=t[e+Mt],i=n>=1e4?`${Math.round(n/1e3)}k`:n>=1e3?`${Math.round(n/100)/10}k`:n,o=t[e+ly],a=o===-1?{}:Object.assign({},r[o]);return Object.assign(a,{cluster:!0,cluster_id:t[e+Et],point_count:n,point_count_abbreviated:i})}function Aa(t){return t/360+.5}function _a(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 Kb(t){return(t-.5)*360}function Yb(t){let e=(180-t*360)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function Pi(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=Qb(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&&Pi(t,e,s,n),t[s+2]=i,r-s>3&&Pi(t,s,r,n))}function Qb(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 ft(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 e0(i),i}function e0(t){var e=t.geometry,r=t.type;if(r==="Point"||r==="MultiPoint"||r==="LineString")bl(t,e);else if(r==="Polygon"||r==="MultiLineString")for(var n=0;n<e.length;n++)bl(t,e[n]);else if(r==="MultiPolygon")for(n=0;n<e.length;n++)for(var i=0;i<e[n].length;i++)bl(t,e[n][i])}function bl(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 Sl(t,e){var r=[];if(t.type==="FeatureCollection")for(var n=0;n<t.features.length;n++)Ia(r,t.features[n],e,n);else t.type==="Feature"?Ia(r,t,e):Ia(r,{geometry:t},e);return r}function Ia(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")cy(i,s);else if(o==="MultiPoint")for(var u=0;u<i.length;u++)cy(i[u],s);else if(o==="LineString")Pl(i,s,a,!1);else if(o==="MultiLineString")if(r.lineMetrics){for(u=0;u<i.length;u++)s=[],Pl(i[u],s,a,!1),t.push(ft(l,"LineString",s,e.properties));return}else vl(i,s,a,!1);else if(o==="Polygon")vl(i,s,a,!0);else if(o==="MultiPolygon")for(u=0;u<i.length;u++){var c=[];vl(i[u],c,a,!0),s.push(c)}else if(o==="GeometryCollection"){for(u=0;u<e.geometry.geometries.length;u++)Ia(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(ft(l,o,s,e.properties))}}function cy(t,e){e.push(py(t[0])),e.push(fy(t[1])),e.push(0)}function Pl(t,e,r,n){for(var i,o,a=0,s=0;s<t.length;s++){var l=py(t[s][0]),u=fy(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,Pi(e,0,c,r),e[c+2]=1,e.size=Math.abs(a),e.start=0,e.end=e.size}function vl(t,e,r,n){for(var i=0;i<t.length;i++){var o=[];Pl(t[i],o,r,n),e.push(o)}}function py(t){return t/360+.5}function fy(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 qe(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 h=[];if(f==="Point"||f==="MultiPoint")t0(p,h,r,n,i);else if(f==="LineString")my(p,h,r,n,i,!1,s.lineMetrics);else if(f==="MultiLineString")wl(p,h,r,n,i,!1);else if(f==="Polygon")wl(p,h,r,n,i,!0);else if(f==="MultiPolygon")for(var d=0;d<p.length;d++){var g=[];wl(p[d],g,r,n,i,!0),g.length&&h.push(g)}if(h.length){if(s.lineMetrics&&f==="LineString"){for(d=0;d<h.length;d++)l.push(ft(c.id,f,h[d],c.tags));continue}(f==="LineString"||f==="MultiLineString")&&(h.length===1?(f="LineString",h=h[0]):f="MultiLineString"),(f==="Point"||f==="MultiPoint")&&(f=h.length===3?"Point":"MultiPoint"),l.push(ft(c.id,f,h,c.tags))}}return l.length?l:null}function t0(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 my(t,e,r,n,i,o,a){for(var s=yy(t),l=i===0?r0:n0,u=t.start,c,p,f=0;f<t.length-3;f+=3){var y=t[f],m=t[f+1],h=t[f+2],d=t[f+3],g=t[f+4],b=i===0?y:m,x=i===0?d:g,v=!1;a&&(c=Math.sqrt(Math.pow(y-d,2)+Math.pow(m-g,2))),b<r?x>r&&(p=l(s,y,m,d,g,r),a&&(s.start=u+c*p)):b>n?x<n&&(p=l(s,y,m,d,g,n),a&&(s.start=u+c*p)):Al(s,y,m,h),x<r&&b>=r&&(p=l(s,y,m,d,g,r),v=!0),x>n&&b<=n&&(p=l(s,y,m,d,g,n),v=!0),!o&&v&&(a&&(s.end=u+c*p),e.push(s),s=yy(t)),a&&(u+=c)}var P=t.length-3;y=t[P],m=t[P+1],h=t[P+2],b=i===0?y:m,b>=r&&b<=n&&Al(s,y,m,h),P=s.length-3,o&&P>=3&&(s[P]!==s[0]||s[P+1]!==s[1])&&Al(s,s[0],s[1],s[2]),s.length&&e.push(s)}function yy(t){var e=[];return e.size=t.size,e.start=t.start,e.end=t.end,e}function wl(t,e,r,n,i,o){for(var a=0;a<t.length;a++)my(t[a],e,r,n,i,o,!1)}function Al(t,e,r,n){t.push(e),t.push(r),t.push(n)}function r0(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 n0(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 Il(t,e){var r=e.buffer/e.extent,n=t,i=qe(t,1,-1-r,r,0,-1,2,e),o=qe(t,1,1-r,2+r,0,-1,2,e);return(i||o)&&(n=qe(t,1,-r,1+r,0,-1,2,e)||[],i&&(n=hy(i,1).concat(n)),o&&(n=n.concat(hy(o,-1)))),n}function hy(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=_l(i.geometry,e);else if(o==="MultiLineString"||o==="Polygon"){a=[];for(var s=0;s<i.geometry.length;s++)a.push(_l(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(_l(i.geometry[s][u],e));a.push(l)}r.push(ft(i.id,o,a,i.tags))}return r}function _l(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 Ta(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(dy(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(dy(u[a][s],u[a][s+1],e,r,n,i));l.geometry.push(p)}}return t.transformed=!0,t}function dy(t,e,r,n,i,o){return[Math.round(r*(t*n-i)),Math.round(r*(e*n-o))]}function Cl(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++,i0(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 i0(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")Tl(a,i,t,r,!1,!1);else if(o==="MultiLineString"||o==="Polygon")for(s=0;s<i.length;s++)Tl(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++)Tl(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 Tl(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&&o0(s,o),t.push(s)}function o0(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 Ml(t,e){return new Ca(t,e)}function Ca(t,e){e=this.options=a0(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=Sl(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=Il(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=kl(e,r,n),f=this.tiles[p];if(!f&&(u>1&&console.time("creation"),f=this.tiles[p]=Cl(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 h=.5*l.buffer/l.extent,d=.5-h,g=.5+h,b=1+h,x,v,P,w,T,F;x=v=P=w=null,T=qe(t,c,r-h,r+g,0,f.minX,f.maxX,l),F=qe(t,c,r+d,r+b,0,f.minX,f.maxX,l),t=null,T&&(x=qe(T,c,n-h,n+g,1,f.minY,f.maxY,l),v=qe(T,c,n+d,n+b,1,f.minY,f.maxY,l),T=null),F&&(P=qe(F,c,n-h,n+g,1,f.minY,f.maxY,l),w=qe(F,c,n+d,n+b,1,f.minY,f.maxY,l),F=null),u>1&&console.timeEnd("clipping"),s.push(x||[],e+1,r*2,n*2),s.push(v||[],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=kl(t,e,r);if(this.tiles[s])return Ta(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[kl(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]?Ta(this.tiles[s],i):null)};function kl(t,e,r){return((1<<t)*r+e)*32+t}function a0(t,e){for(var r in e)t[r]=e[r];return t}function Si(t,e){return e?t.properties[e]:t.id}function El(t,e){if(t==null)return!0;if(t.type==="Feature")return Si(t,e)!=null;if(t.type==="FeatureCollection"){let r=new Set;for(let n of t.features){let i=Si(n,e);if(i==null||r.has(i))return!1;r.add(i)}return!0}return!1}function Fl(t,e){let r=new Map;if(t!=null)if(t.type==="Feature")r.set(Si(t,e),t);else for(let n of t.features)r.set(Si(n,e),n);return r}function gy(t,e,r){if(e.removeAll&&t.clear(),e.remove)for(let n of e.remove)t.delete(n);if(e.add)for(let n of e.add){let i=Si(n,r);i!=null&&t.set(i,n)}if(e.update)for(let n of e.update){let i=t.get(n.id);if(i==null)continue;let o=n.newGeometry||n.removeAllProperties,a=!n.removeAllProperties&&(n.removeProperties?.length>0||n.addOrUpdateProperties?.length>0);if((o||a)&&(i={...i},t.set(n.id,i),a&&(i.properties={...i.properties})),n.newGeometry&&(i.geometry=n.newGeometry),n.removeAllProperties)i.properties={};else if(n.removeProperties?.length>0)for(let s of n.removeProperties)Object.prototype.hasOwnProperty.call(i.properties,s)&&delete i.properties[s];if(n.addOrUpdateProperties?.length>0)for(let{key:s,value:l}of n.addOrUpdateProperties)i.properties[s]=l}}var ka=class extends Or{constructor(){super(...arguments);this._dataUpdateable=new Map}async loadVectorTile(r,n){let i=r.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");let o=this._geoJSONIndex.getTile(i.z,i.x,i.y);if(!o)return null;let a=new Sa(o.features),s=(0,by.default)(a);return(s.byteOffset!==0||s.byteLength!==s.buffer.byteLength)&&(s=new Uint8Array(s)),{vectorTile:a,rawData:s.buffer}}async loadData(r){this._pendingRequest?.abort();let n=r&&r.request&&r.request.collectResourceTiming?new Rr(r.request):!1;this._pendingRequest=new AbortController;try{let i=await this.loadGeoJSON(r,this._pendingRequest);if(delete this._pendingRequest,typeof i!="object")throw new Error(`Input data given to \'${r.source}\' is not a valid GeoJSON object.`);if((0,xy.default)(i,!0),r.filter){let a=qt(r.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(a.result==="error")throw new Error(a.value.map(l=>`${l.key}: ${l.message}`).join(", "));i={type:"FeatureCollection",features:i.features.filter(l=>a.value.evaluate({zoom:0},l))}}this._geoJSONIndex=r.cluster?new vi(s0(r)).load(i.features):Ml(i,r.geojsonVtOptions),this.loaded={};let o={};if(n){let a=n.finish();a&&(o.resourceTiming={},o.resourceTiming[r.source]=JSON.parse(JSON.stringify(a)))}return o}catch(i){if(delete this._pendingRequest,tc(i))return{abandoned:!0};throw i}}reloadTile(r){let n=this.loaded,i=r.uid;return n&&n[i]?super.reloadTile(r):this.loadTile(r)}async loadGeoJSON(r,n){let{promoteId:i}=r;if(r.request){let o=await uc(r.request,n);return this._dataUpdateable=El(o.data,i)?Fl(o.data,i):void 0,o.data}if(typeof r.data=="string")try{let o=JSON.parse(r.data);return this._dataUpdateable=El(o,i)?Fl(o,i):void 0,o}catch{throw new Error(`Input data given to \'${r.source}\' is not a valid GeoJSON object.`)}if(!r.dataDiff)throw new Error(`Input data given to \'${r.source}\' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${r.source}`);return gy(this._dataUpdateable,r.dataDiff,i),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}}async removeSource(r){this._pendingRequest&&this._pendingRequest.abort()}getClusterExpansionZoom(r){return this._geoJSONIndex.getClusterExpansionZoom(r.clusterId)}getClusterChildren(r){return this._geoJSONIndex.getChildren(r.clusterId)}getClusterLeaves(r){return this._geoJSONIndex.getLeaves(r.clusterId,r.limit,r.offset)}};function s0({superclusterOptions:t,clusterProperties:e}){if(!e||!t)return t;let r={},n={},i={accumulated:null,zoom:0},o={properties:null},a=Object.keys(e);for(let s of a){let[l,u]=e[s],c=qt(u),p=qt(typeof l=="string"?[l,["accumulated"],["get",s]]:l);r[s]=c.value,n[s]=p.value}return t.map=s=>{o.properties=s;let l={};for(let u of a)l[u]=r[u].evaluate(i,o);return l},t.reduce=(s,l)=>{o.properties=l;for(let u of a)i.accumulated=s[u],s[u]=n[u].evaluate(i,o)},t}var Ma=class{constructor(e){this.self=e,this.actor=new to(e),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(r,n)=>{if(this.externalWorkerSourceTypes[r])throw new Error(`Worker source with name "${r}" already registered.`);this.externalWorkerSourceTypes[r]=n},this.self.addProtocol=nc,this.self.removeProtocol=ic,this.self.registerRTLTextPlugin=r=>{if(ye.isParsed())throw new Error("RTL text plugin already registered.");ye.setMethods(r)},this.actor.registerMessageHandler("LDT",(r,n)=>this._getDEMWorkerSource(r,n.source).loadTile(n)),this.actor.registerMessageHandler("RDT",async(r,n)=>{this._getDEMWorkerSource(r,n.source).removeTile(n)}),this.actor.registerMessageHandler("GCEZ",async(r,n)=>this._getWorkerSource(r,n.type,n.source).getClusterExpansionZoom(n)),this.actor.registerMessageHandler("GCC",async(r,n)=>this._getWorkerSource(r,n.type,n.source).getClusterChildren(n)),this.actor.registerMessageHandler("GCL",async(r,n)=>this._getWorkerSource(r,n.type,n.source).getClusterLeaves(n)),this.actor.registerMessageHandler("LD",(r,n)=>this._getWorkerSource(r,n.type,n.source).loadData(n)),this.actor.registerMessageHandler("LT",(r,n)=>this._getWorkerSource(r,n.type,n.source).loadTile(n)),this.actor.registerMessageHandler("RT",(r,n)=>this._getWorkerSource(r,n.type,n.source).reloadTile(n)),this.actor.registerMessageHandler("AT",(r,n)=>this._getWorkerSource(r,n.type,n.source).abortTile(n)),this.actor.registerMessageHandler("RMT",(r,n)=>this._getWorkerSource(r,n.type,n.source).removeTile(n)),this.actor.registerMessageHandler("RS",async(r,n)=>{if(!this.workerSources[r]||!this.workerSources[r][n.type]||!this.workerSources[r][n.type][n.source])return;let i=this.workerSources[r][n.type][n.source];delete this.workerSources[r][n.type][n.source],i.removeSource!==void 0&&i.removeSource(n)}),this.actor.registerMessageHandler("RM",async r=>{delete this.layerIndexes[r],delete this.availableImages[r],delete this.workerSources[r],delete this.demWorkerSources[r]}),this.actor.registerMessageHandler("SR",async(r,n)=>{this.referrer=n}),this.actor.registerMessageHandler("SRPS",(r,n)=>this._syncRTLPluginState(r,n)),this.actor.registerMessageHandler("IS",async(r,n)=>{this.self.importScripts(n)}),this.actor.registerMessageHandler("SI",(r,n)=>this._setImages(r,n)),this.actor.registerMessageHandler("UL",async(r,n)=>{this._getLayerIndex(r).update(n.layers,n.removedIds)}),this.actor.registerMessageHandler("SL",async(r,n)=>{this._getLayerIndex(r).replace(n)})}async _setImages(e,r){this.availableImages[e]=r;for(let n in this.workerSources[e]){let i=this.workerSources[e][n];for(let o in i)i[o].availableImages=r}}async _syncRTLPluginState(e,r){if(ye.isParsed())return ye.getState();if(r.pluginStatus!=="loading")return ye.setState(r),r;let n=r.pluginURL;if(this.self.importScripts(n),ye.isParsed()){let o={pluginStatus:"loaded",pluginURL:n};return ye.setState(o),o}throw ye.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${n}`)}_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 ca),r}_getWorkerSource(e,r,n){if(this.workerSources[e]||(this.workerSources[e]={}),this.workerSources[e][r]||(this.workerSources[e][r]={}),!this.workerSources[e][r][n]){let i={sendAsync:(o,a)=>(o.targetMapId=e,this.actor.sendAsync(o,a))};switch(r){case"vector":this.workerSources[e][r][n]=new Or(i,this._getLayerIndex(e),this._getAvailableImages(e));break;case"geojson":this.workerSources[e][r][n]=new ka(i,this._getLayerIndex(e),this._getAvailableImages(e));break;default:this.workerSources[e][r][n]=new this.externalWorkerSourceTypes[r](i,this._getLayerIndex(e),this._getAvailableImages(e));break}}return this.workerSources[e][r][n]}_getDEMWorkerSource(e,r){return this.demWorkerSources[e]||(this.demWorkerSources[e]={}),this.demWorkerSources[e][r]||(this.demWorkerSources[e][r]=new va),this.demWorkerSources[e][r]}};at(self)&&(self.worker=new Ma(self));})();\n/*! Bundled license information:\n\nieee754/index.js:\n (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)\n*/\n';var QT=()=>Je.WORKER_URL?Je.WORKER_URL:URL.createObjectURL(new Blob([ng],{type:"text/javascript"}));function og(){return new Worker(QT())}var wl="maplibre_preloaded_worker_pool",Er=class r{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<r.workerCount;)this.workers.push(og());return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],this.numActive()===0&&(this.workers.forEach(t=>{t.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[wl]}numActive(){return Object.keys(this.active).length}},eA=Math.floor(K.hardwareConcurrency/2);Er.workerCount=ff(globalThis)?Math.max(Math.min(eA,3),1):1;var Uo;function No(){return Uo||(Uo=new Er),Uo}function tA(){No().acquire(wl)}function rA(){let r=Uo;r&&(r.isPreloaded()&&r.numActive()===1?(r.release(wl),Uo=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()"))}var Go=class{constructor(e,t){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=t;let i=this.workerPool.acquire(t);for(let n=0;n<i.length;n++){let o=i[n],a=new vl(o,t);a.name=`Worker ${n}`,this.actors.push(a)}if(!this.actors.length)throw new Error("No actors found")}broadcast(e,t){let i=[];for(let n of this.actors)i.push(n.sendAsync({type:e,data:t}));return Promise.all(i)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(e=!0){this.actors.forEach(t=>{t.remove()}),this.actors=[],e&&this.workerPool.release(this.id)}registerMessageHandler(e,t){for(let i of this.actors)i.registerMessageHandler(e,t)}},Sl;function Pl(){return Sl||(Sl=new Go(No(),Ua),Sl.registerMessageHandler("GR",(r,e,t)=>_i(e,t))),Sl}m();function iA(r,e){let t=N.create();return N.translate(t,t,[1,1,0]),N.scale(t,t,[r.width*.5,r.height*.5,1]),N.multiply(t,t,r.calculatePosMatrix(e.toUnwrapped()))}function nA(r,e,t){if(r)for(let i of r){let n=e[i];if(n&&n.source===t&&n.type==="fill-extrusion")return!0}else for(let i in e){let n=e[i];if(n.source===t&&n.type==="fill-extrusion")return!0}return!1}function ag(r,e,t,i,n,o){let a=nA(n&&n.layers,e,r.id),s=o.maxPitchScaleFactor(),l=r.tilesIn(i,s,a);l.sort(ug);let u=[];for(let p of l)u.push({wrappedTileID:p.tileID.wrapped().key,queryResults:p.tile.queryRenderedFeatures(e,t,r._state,p.queryGeometry,p.cameraQueryGeometry,p.scale,n,o,s,iA(r.transform,p.tileID))});let c=oA(u);for(let p in c)c[p].forEach(h=>{let f=h.feature,d=r.getFeatureState(f.layer["source-layer"],f.id);f.source=f.layer.source,f.layer["source-layer"]&&(f.sourceLayer=f.layer["source-layer"]),f.state=d});return c}function sg(r,e,t,i,n,o,a){let s={},l=o.queryRenderedSymbols(i),u=[];for(let c of Object.keys(l).map(Number))u.push(a[c]);u.sort(ug);for(let c of u){let p=c.featureIndex.lookupSymbolFeatures(l[c.bucketInstanceId],e,c.bucketIndex,c.sourceLayerIndex,n.filter,n.layers,n.availableImages,r);for(let h in p){let f=s[h]=s[h]||[],d=p[h];d.sort((y,g)=>{let x=c.featureSortOrder;if(x){let v=x.indexOf(y.featureIndex);return x.indexOf(g.featureIndex)-v}else return g.featureIndex-y.featureIndex});for(let y of d)f.push(y)}}for(let c in s)s[c].forEach(p=>{let h=p.feature,f=r[c],y=t[f.source].getFeatureState(h.layer["source-layer"],h.id);h.source=h.layer.source,h.layer["source-layer"]&&(h.sourceLayer=h.layer["source-layer"]),h.state=y});return s}function lg(r,e){let t=r.getRenderableIds().map(o=>r.getTileByID(o)),i=[],n={};for(let o=0;o<t.length;o++){let a=t[o],s=a.tileID.canonical.key;n[s]||(n[s]=!0,a.querySourceFeatures(i,e))}return i}function ug(r,e){let t=r.tileID,i=e.tileID;return t.overscaledZ-i.overscaledZ||t.canonical.y-i.canonical.y||t.wrap-i.wrap||t.canonical.x-i.canonical.x}function oA(r){let e={},t={};for(let i of r){let n=i.queryResults,o=i.wrappedTileID,a=t[o]=t[o]||{};for(let s in n){let l=n[s],u=a[s]=a[s]||{},c=e[s]=e[s]||[];for(let p of l)u[p.featureIndex]||(u[p.featureIndex]=!0,c.push(p))}}return e}m();m();m();m();async function Tl(r,e,t){let i=r;if(r.url?i=(await fr(e.transformRequest(r.url,"Source"),t)).data:await K.frameAsync(t),!i)return null;let n=hr(O(i,r),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in i&&i.vector_layers&&(n.vectorLayerIds=i.vector_layers.map(o=>o.id)),n}m();m();m();var $o=63710088e-1,re=class r{constructor(e,t){if(isNaN(e)||isNaN(t))throw new Error(`Invalid LngLat object: (${e}, ${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 r(Kt(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){let t=Math.PI/180,i=this.lat*t,n=e.lat*t,o=Math.sin(i)*Math.sin(n)+Math.cos(i)*Math.cos(n)*Math.cos((e.lng-this.lng)*t);return $o*Math.acos(Math.min(o,1))}static convert(e){if(e instanceof r)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new r(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new r(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 ut=class r{constructor(e,t){e&&(t?this.setSouthWest(e).setNorthEast(t):Array.isArray(e)&&(e.length===4?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1])))}setNorthEast(e){return this._ne=e instanceof 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(e){let t=this._sw,i=this._ne,n,o;if(e instanceof re)n=e,o=e;else if(e instanceof r){if(n=e._sw,o=e._ne,!n||!o)return this}else{if(Array.isArray(e))if(e.length===4||e.every(Array.isArray)){let a=e;return this.extend(r.convert(a))}else{let a=e;return this.extend(re.convert(a))}else if(e&&("lng"in e||"lon"in e)&&"lat"in e)return this.extend(re.convert(e));return this}return!t&&!i?(this._sw=new re(n.lng,n.lat),this._ne=new re(o.lng,o.lat)):(t.lng=Math.min(n.lng,t.lng),t.lat=Math.min(n.lat,t.lat),i.lng=Math.max(o.lng,i.lng),i.lat=Math.max(o.lat,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(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){let{lng:t,lat:i}=re.convert(e),n=this._sw.lat<=i&&i<=this._ne.lat,o=this._sw.lng<=t&&t<=this._ne.lng;return this._sw.lng>this._ne.lng&&(o=this._sw.lng>=t&&t>=this._ne.lng),n&&o}static convert(e){return e instanceof r||!e?e:new r(e)}static fromLngLat(e,t=0){let n=360*t/40075017,o=n/Math.cos(Math.PI/180*e.lat);return new r(new re(e.lng-o,e.lat-n),new re(e.lng+o,e.lat+n))}};m();var cg=2*Math.PI*$o;function pg(r){return cg*Math.cos(r*Math.PI/180)}function kr(r){return(180+r)/360}function Lr(r){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360}function Al(r,e){return r/pg(e)}function aA(r){return r*360-180}function $p(r){let e=180-r*360;return 360/Math.PI*Math.atan(Math.exp(e*Math.PI/180))-90}function sA(r,e){return r*pg($p(e))}function lA(r){return 1/Math.cos(r*Math.PI/180)}var ze=class r{constructor(e,t,i=0){this.x=+e,this.y=+t,this.z=+i}static fromLngLat(e,t=0){let i=re.convert(e);return new r(kr(i.lng),Lr(i.lat),Al(t,i.lat))}toLngLat(){return new re(aA(this.x),$p(this.y))}toAltitude(){return sA(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/cg*lA($p(this.y))}};var nn=class{constructor(e,t,i){this.bounds=ut.convert(this.validateBounds(e)),this.minzoom=t||0,this.maxzoom=i||24}validateBounds(e){return!Array.isArray(e)||e.length!==4?[-180,-90,180,90]:[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]}contains(e){let t=Math.pow(2,e.z),i={minX:Math.floor(kr(this.bounds.getWest())*t),minY:Math.floor(Lr(this.bounds.getNorth())*t),maxX:Math.ceil(kr(this.bounds.getEast())*t),maxY:Math.ceil(Lr(this.bounds.getSouth())*t)};return e.x>=i.minX&&e.x<i.maxX&&e.y>=i.minY&&e.y<i.maxY}};var qo=class extends me{constructor(e,t,i,n){if(super(),this.id=e,this.dispatcher=i,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,O(this,hr(t,["url","scheme","tileSize","promoteId"])),this._options=O({type:"vector"},t),this._collectResourceTiming=t.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(n)}async load(){this._loaded=!1,this.fire(new z("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let e=await Tl(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),e&&(O(this,e),e.bounds&&(this.tileBounds=new nn(e.bounds,this.minzoom,this.maxzoom)),this.fire(new z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new z("data",{dataType:"source",sourceDataType:"content"})))}catch(e){this._tileJSONRequest=null,this.fire(new Z(e))}}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}setSourceProperty(e){this._tileJSONRequest&&this._tileJSONRequest.abort(),e(),this.load()}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return O({},this._options)}async loadTile(e){let t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),i={request:this.map._requestManager.transformRequest(t,"Tile"),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};i.request.collectResourceTiming=this._collectResourceTiming;let n="RT";if(!e.actor||e.state==="expired")e.actor=this.dispatcher.getActor(),n="LT";else if(e.state==="loading")return new Promise((o,a)=>{e.reloadPromise={resolve:o,reject:a}});e.abortController=new AbortController;try{let o=await e.actor.sendAsync({type:n,data:i},e.abortController);if(delete e.abortController,e.aborted)return;this._afterTileLoadWorkerResponse(e,o)}catch(o){if(delete e.abortController,e.aborted)return;if(o&&o.status!==404)throw o;this._afterTileLoadWorkerResponse(e,null)}}_afterTileLoadWorkerResponse(e,t){if(t&&t.resourceTiming&&(e.resourceTiming=t.resourceTiming),t&&this.map._refreshExpiredTiles&&e.setExpiryData(t),e.loadVectorData(t,this.map.painter),e.reloadPromise){let i=e.reloadPromise;e.reloadPromise=null,this.loadTile(e).then(i.resolve).catch(i.reject)}}async abortTile(e){e.abortController&&(e.abortController.abort(),delete e.abortController),e.actor&&await e.actor.sendAsync({type:"AT",data:{uid:e.uid,type:this.type,source:this.id}})}async unloadTile(e){e.unloadVectorData(),e.actor&&await e.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}})}hasTransition(){return!1}};m();var ui=class extends me{constructor(e,t,i,n){super(),this.id=e,this.dispatcher=i,this.setEventedParent(n),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=O({type:"raster"},t),O(this,hr(t,["url","scheme","tileSize"]))}async load(){this._loaded=!1,this.fire(new z("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{let e=await Tl(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,e&&(O(this,e),e.bounds&&(this.tileBounds=new nn(e.bounds,this.minzoom,this.maxzoom)),this.fire(new z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new z("data",{dataType:"source",sourceDataType:"content"})))}catch(e){this._tileJSONRequest=null,this.fire(new Z(e))}}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(e){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),e(),this.load()}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}serialize(){return O({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}async loadTile(e){let t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.abortController=new AbortController;try{let i=await st.getImage(this.map._requestManager.transformRequest(t,"Tile"),e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted){e.state="unloaded";return}if(i&&i.data){this.map._refreshExpiredTiles&&i.cacheControl&&i.expires&&e.setExpiryData({cacheControl:i.cacheControl,expires:i.expires});let n=this.map.painter.context,o=n.gl,a=i.data;e.texture=this.map.painter.getTileTexture(a.width),e.texture?e.texture.update(a,{useMipmap:!0}):(e.texture=new _e(n,a,o.RGBA,{useMipmap:!0}),e.texture.bind(o.LINEAR,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST),n.extTextureFilterAnisotropic&&o.texParameterf(o.TEXTURE_2D,n.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,n.extTextureFilterAnisotropicMax)),e.state="loaded"}}catch(i){if(delete e.abortController,e.aborted)e.state="unloaded";else if(i)throw e.state="errored",i}}async abortTile(e){e.abortController&&(e.abortController.abort(),delete e.abortController)}async unloadTile(e){e.texture&&this.map.painter.saveTileTexture(e.texture)}hasTransition(){return!1}};m();m();m();function fg(r,e,t){e=Math.pow(2,t)-e-1;var i=hg(r*256,e*256,t),n=hg((r+1)*256,(e+1)*256,t);return i[0]+","+i[1]+","+n[0]+","+n[1]}function hg(r,e,t){var i=2*Math.PI*6378137/256/Math.pow(2,t),n=r*i-2*Math.PI*6378137/2,o=e*i-2*Math.PI*6378137/2;return[n,o]}var mg=ne(ye(),1);var on=class{constructor(e,t,i){if(e<0||e>25||i<0||i>=Math.pow(2,e)||t<0||t>=Math.pow(2,e))throw new Error(`x=${t}, y=${i}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} 0<=z<=25 `);this.z=e,this.x=t,this.y=i,this.key=jo(0,e,e,t,i)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,t,i){let n=fg(this.x,this.y,this.z),o=uA(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(i==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,t>1?"@2x":"").replace(/{quadkey}/g,o).replace(/{bbox-epsg-3857}/g,n)}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 mg.default((e.x*t-this.x)*8192,(e.y*t-this.y)*8192)}toString(){return`${this.z}/${this.x}/${this.y}`}},an=class{constructor(e,t){this.wrap=e,this.canonical=t,this.key=jo(e,t.z,t.z,t.x,t.y)}},Ye=class r{constructor(e,t,i,n,o){if(e<i)throw new Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${i}`);this.overscaledZ=e,this.wrap=t,this.canonical=new on(i,+n,+o),this.key=jo(t,e,i,n,o)}clone(){return new r(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);let t=this.canonical.z-e;return e>this.canonical.z?new r(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new r(e,this.wrap,e,this.canonical.x>>t,this.canonical.y>>t)}calculateScaledKey(e,t){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);let i=this.canonical.z-e;return e>this.canonical.z?jo(this.wrap*+t,e,this.canonical.z,this.canonical.x,this.canonical.y):jo(this.wrap*+t,e,e,this.canonical.x>>i,this.canonical.y>>i)}isChildOf(e){if(e.wrap!==this.wrap)return!1;let t=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ<this.overscaledZ&&e.canonical.x===this.canonical.x>>t&&e.canonical.y===this.canonical.y>>t}children(e){if(this.overscaledZ>=e)return[new r(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let t=this.canonical.z+1,i=this.canonical.x*2,n=this.canonical.y*2;return[new r(t,this.wrap,t,i,n),new r(t,this.wrap,t,i+1,n),new r(t,this.wrap,t,i,n+1),new r(t,this.wrap,t,i+1,n+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 r(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new r(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 an(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new ze(e.x-this.wrap,e.y))}};function jo(r,e,t,i,n){r*=2,r<0&&(r=r*-1-1);let o=1<<t;return(o*o*r+o*n+i).toString(36)+t.toString(36)+e.toString(36)}function uA(r,e,t){let i="",n;for(let o=r;o>0;o--)n=1<<o-1,i+=(e&n?1:0)+(t&n?2:0);return i}U("CanonicalTileID",on);U("OverscaledTileID",Ye,{omit:["posMatrix"]});m();var qp=class{constructor(e,t,i,n=1,o=1,a=1,s=0){if(this.uid=e,t.height!==t.width)throw new RangeError("DEM tiles must be square");if(i&&!["mapbox","terrarium","custom"].includes(i)){ke(`"${i}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);return}this.stride=t.height;let l=this.dim=t.height-2;switch(this.data=new Uint32Array(t.data.buffer),i){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=n,this.greenFactor=o,this.blueFactor=a,this.baseShift=s;break;case"mapbox":default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4;break}for(let u=0;u<l;u++)this.data[this._idx(-1,u)]=this.data[this._idx(0,u)],this.data[this._idx(l,u)]=this.data[this._idx(l-1,u)],this.data[this._idx(u,-1)]=this.data[this._idx(u,0)],this.data[this._idx(u,l)]=this.data[this._idx(u,l-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(l,-1)]=this.data[this._idx(l-1,0)],this.data[this._idx(-1,l)]=this.data[this._idx(0,l-1)],this.data[this._idx(l,l)]=this.data[this._idx(l-1,l-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let u=0;u<l;u++)for(let c=0;c<l;c++){let p=this.get(u,c);p>this.max&&(this.max=p),p<this.min&&(this.min=p)}}get(e,t){let i=new Uint8Array(this.data.buffer),n=this._idx(e,t)*4;return this.unpack(i[n],i[n+1],i[n+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(e,t){if(e<-1||e>=this.dim+1||t<-1||t>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(t+1)*this.stride+(e+1)}unpack(e,t,i){return e*this.redFactor+t*this.greenFactor+i*this.blueFactor-this.baseShift}getPixels(){return new we({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,t,i){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let n=t*this.dim,o=t*this.dim+this.dim,a=i*this.dim,s=i*this.dim+this.dim;switch(t){case-1:n=o-1;break;case 1:o=n+1;break}switch(i){case-1:a=s-1;break;case 1:s=a+1;break}let l=-t*this.dim,u=-i*this.dim;for(let c=a;c<s;c++)for(let p=n;p<o;p++)this.data[this._idx(p,c)]=e.data[this._idx(p+l,c+u)]}};U("DEMData",qp);var Zo=class extends ui{constructor(e,t,i,n){super(e,t,i,n),this.type="raster-dem",this.maxzoom=22,this._options=O({type:"raster-dem"},t),this.encoding=t.encoding||"mapbox",this.redFactor=t.redFactor,this.greenFactor=t.greenFactor,this.blueFactor=t.blueFactor,this.baseShift=t.baseShift}async loadTile(e){let t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),i=this.map._requestManager.transformRequest(t,"Tile");e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{let n=await st.getImage(i,e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted){e.state="unloaded";return}if(n&&n.data){let o=n.data;this.map._refreshExpiredTiles&&n.cacheControl&&n.expires&&e.setExpiryData({cacheControl:n.cacheControl,expires:n.expires});let s=pt(o)&&za()?o:await this.readImageNow(o),l={type:this.type,uid:e.uid,source:this.id,rawImageData:s,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!e.actor||e.state==="expired"){e.actor=this.dispatcher.getActor();let u=await e.actor.sendAsync({type:"LDT",data:l});e.dem=u,e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded"}}}catch(n){if(delete e.abortController,e.aborted)e.state="unloaded";else if(n)throw e.state="errored",n}}async readImageNow(e){if(typeof VideoFrame<"u"&&vc()){let t=e.width+2,i=e.height+2;try{return new we({width:t,height:i},await yf(e,-1,-1,t,i))}catch{}}return K.getImageData(e,1)}_getNeighboringTiles(e){let t=e.canonical,i=Math.pow(2,t.z),n=(t.x-1+i)%i,o=t.x===0?e.wrap-1:e.wrap,a=(t.x+1+i)%i,s=t.x+1===i?e.wrap+1:e.wrap,l={};return l[new Ye(e.overscaledZ,o,t.z,n,t.y).key]={backfilled:!1},l[new Ye(e.overscaledZ,s,t.z,a,t.y).key]={backfilled:!1},t.y>0&&(l[new Ye(e.overscaledZ,o,t.z,n,t.y-1).key]={backfilled:!1},l[new Ye(e.overscaledZ,e.wrap,t.z,t.x,t.y-1).key]={backfilled:!1},l[new Ye(e.overscaledZ,s,t.z,a,t.y-1).key]={backfilled:!1}),t.y+1<i&&(l[new Ye(e.overscaledZ,o,t.z,n,t.y+1).key]={backfilled:!1},l[new Ye(e.overscaledZ,e.wrap,t.z,t.x,t.y+1).key]={backfilled:!1},l[new Ye(e.overscaledZ,s,t.z,a,t.y+1).key]={backfilled:!1}),l}async unloadTile(e){e.demTexture&&this.map.painter.saveTileTexture(e.demTexture),e.fbo&&(e.fbo.destroy(),delete e.fbo),e.dem&&delete e.dem,delete e.neighboringTiles,e.state="unloaded",e.actor&&await e.actor.sendAsync({type:"RDT",data:{type:this.type,uid:e.uid,source:this.id}})}};m();var Ho=class extends me{constructor(e,t,i,n){super(),this.id=e,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=i.getActor(),this.setEventedParent(n),this._data=t.data,this._options=O({},t),this._collectResourceTiming=t.collectResourceTiming,t.maxzoom!==void 0&&(this.maxzoom=t.maxzoom),t.type&&(this.type=t.type),t.attribution&&(this.attribution=t.attribution),this.promoteId=t.promoteId;let o=8192/this.tileSize;this.workerOptions=O({source:this.id,cluster:t.cluster||!1,geojsonVtOptions:{buffer:(t.buffer!==void 0?t.buffer:128)*o,tolerance:(t.tolerance!==void 0?t.tolerance:.375)*o,extent:8192,maxZoom:this.maxzoom,lineMetrics:t.lineMetrics||!1,generateId:t.generateId||!1},superclusterOptions:{maxZoom:t.clusterMaxZoom!==void 0?t.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,t.clusterMinPoints||2),extent:8192,radius:(t.clusterRadius||50)*o,log:!1,generateId:t.generateId||!1},clusterProperties:t.clusterProperties,filter:t.filter},t.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}async load(){await this._updateWorkerData()}onAdd(e){this.map=e,this.load()}setData(e){return this._data=e,this._updateWorkerData(),this}updateData(e){return this._updateWorkerData(e),this}setClusterOptions(e){return this.workerOptions.cluster=e.cluster,e&&(e.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=e.clusterRadius),e.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=e.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(e){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:e,source:this.id}})}getClusterChildren(e){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:e,source:this.id}})}getClusterLeaves(e,t,i){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:e,limit:t,offset:i}})}async _updateWorkerData(e){let t=O({type:this.type},this.workerOptions);e?t.dataDiff=e:typeof this._data=="string"?(t.request=this.map._requestManager.transformRequest(K.resolveURL(this._data),"Source"),t.request.collectResourceTiming=this._collectResourceTiming):t.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new z("dataloading",{dataType:"source"}));try{let i=await this.actor.sendAsync({type:"LD",data:t});if(this._pendingLoads--,this._removed||i.abandoned){this.fire(new z("dataabort",{dataType:"source"}));return}let n=null;i.resourceTiming&&i.resourceTiming[this.id]&&(n=i.resourceTiming[this.id].slice(0));let o={dataType:"source"};this._collectResourceTiming&&n&&n.length>0&&O(o,{resourceTiming:n}),this.fire(new z("data",{...o,sourceDataType:"metadata"})),this.fire(new z("data",{...o,sourceDataType:"content"}))}catch(i){if(this._pendingLoads--,this._removed){this.fire(new z("dataabort",{dataType:"source"}));return}this.fire(new Z(i))}}loaded(){return this._pendingLoads===0}async loadTile(e){let t=e.actor?"RT":"LT";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.abortController=new AbortController;let n=await this.actor.sendAsync({type:t,data:i},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(n,this.map.painter,t==="RT")}async abortTile(e){e.abortController&&(e.abortController.abort(),delete e.abortController),e.aborted=!0}async unloadTile(e){e.unloadVectorData(),await this.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return O({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}};m();m();m();var Dr=be([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);var kt=class extends me{constructor(e,t,i,n){super(),this.id=e,this.dispatcher=i,this.coordinates=t.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(n),this.options=t}async load(e){this._loaded=!1,this.fire(new z("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{let t=await st.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,t&&t.data&&(this.image=t.data,e&&(this.coordinates=e),this._finishLoading())}catch(t){this._request=null,this._loaded=!0,this.fire(new Z(t))}}loaded(){return this._loaded}updateImage(e){return e.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=e.url,this.load(e.coordinates).finally(()=>{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.abort(),this._request=null)}setCoordinates(e){this.coordinates=e;let t=e.map(ze.fromLngLat);this.tileID=cA(t),this.minzoom=this.maxzoom=this.tileID.z;let i=t.map(n=>this.tileID.getTilePoint(n)._round());return this._boundsArray=new Gi,this._boundsArray.emplaceBack(i[0].x,i[0].y,0,0),this._boundsArray.emplaceBack(i[1].x,i[1].y,8192,0),this._boundsArray.emplaceBack(i[3].x,i[3].y,0,8192),this._boundsArray.emplaceBack(i[2].x,i[2].y,8192,8192),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new z("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;let e=this.map.painter.context,t=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,Dr.members)),this.boundsSegments||(this.boundsSegments=he.simpleSegment(0,0,4,2)),this.texture||(this.texture=new _e(e,this.image,t.RGBA),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE));let i=!1;for(let n in this.tiles){let o=this.tiles[n];o.state!=="loaded"&&(o.state="loaded",o.texture=this.texture,i=!0)}i&&this.fire(new z("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}async loadTile(e){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={}):e.state="errored"}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}};function cA(r){let e=1/0,t=1/0,i=-1/0,n=-1/0;for(let c of r)e=Math.min(e,c.x),t=Math.min(t,c.y),i=Math.max(i,c.x),n=Math.max(n,c.y);let o=i-e,a=n-t,s=Math.max(o,a),l=Math.max(0,Math.floor(-Math.log(s)/Math.LN2)),u=Math.pow(2,l);return new on(l,Math.floor((e+i)/2*u),Math.floor((t+n)/2*u))}var Wo=class extends kt{constructor(e,t,i,n){super(e,t,i,n),this.roundZoom=!0,this.type="video",this.options=t}async load(){this._loaded=!1;let e=this.options;this.urls=[];for(let t of e.urls)this.urls.push(this.map._requestManager.transformRequest(t,"Source").url);try{let t=await _f(this.urls);if(this._loaded=!0,!t)return;this.video=t,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(t){this.fire(new Z(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 Z(new R(`sources.${this.id}`,null,`Playback for this video can be set only between the ${t.start(0)} and ${t.end(0)}-second mark.`))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;let e=this.map.painter.context,t=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,Dr.members)),this.boundsSegments||(this.boundsSegments=he.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 _e(e,this.video,t.RGBA),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE));let i=!1;for(let n in this.tiles){let o=this.tiles[n];o.state!=="loaded"&&(o.state="loaded",o.texture=this.texture,i=!0)}i&&this.fire(new z("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}};m();var Xo=class extends kt{constructor(e,t,i,n){super(e,t,i,n),t.coordinates?(!Array.isArray(t.coordinates)||t.coordinates.length!==4||t.coordinates.some(o=>!Array.isArray(o)||o.length!==2||o.some(a=>typeof a!="number")))&&this.fire(new Z(new R(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new Z(new R(`sources.${e}`,null,'missing required property "coordinates"'))),t.animate&&typeof t.animate!="boolean"&&this.fire(new Z(new R(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),t.canvas?typeof t.canvas!="string"&&!(t.canvas instanceof HTMLCanvasElement)&&this.fire(new Z(new R(`sources.${e}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new Z(new R(`sources.${e}`,null,'missing required property "canvas"'))),this.options=t,this.animate=t.animate!==void 0?t.animate:!0}async load(){if(this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()){this.fire(new Z(new Error("Canvas dimensions cannot be less than or equal to zero.")));return}this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading()}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;let t=this.map.painter.context,i=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,Dr.members)),this.boundsSegments||(this.boundsSegments=he.simpleSegment(0,0,4,2)),this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new _e(t,this.canvas,i.RGBA,{premultiply:!0});let n=!1;for(let o in this.tiles){let a=this.tiles[o];a.state!=="loaded"&&(a.state="loaded",a.texture=this.texture,n=!0)}n&&this.fire(new z("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}};var dg={},yg=(r,e,t,i)=>{let n=gg(e.type),o=new n(r,e,t,i);if(o.id!==r)throw new Error(`Expected Source id to be ${r} instead of ${o.id}`);return o},gg=r=>{switch(r){case"geojson":return Ho;case"image":return kt;case"raster":return ui;case"raster-dem":return Zo;case"vector":return qo;case"video":return Wo;case"canvas":return Xo}return dg[r]},pA=(r,e)=>{dg[r]=e},hA=async(r,e)=>{if(gg(r))throw new Error(`A source type called "${r}" already exists.`);pA(r,e)};m();m();function xg(r,e){let t={};if(!e)return t;for(let i of r){let n=i.layerIds.map(o=>e.getLayer(o)).filter(Boolean);if(n.length!==0){i.layers=n,i.stateDependentLayerIds&&(i.stateDependentLayers=i.stateDependentLayerIds.map(o=>n.filter(a=>a.id===o)[0]));for(let o of n)t[o.id]=i}}return t}m();m();var Ml=class{constructor(e){this._stringToNumber={},this._numberToString=[];for(let t=0;t<e.length;t++){let i=e[t];this._stringToNumber[i]=t,this._numberToString[t]=i}}encode(e){return this._stringToNumber[e]}decode(e){if(e>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}};var vg=ne(Io(),1),wg=ne(Op(),1);m();var sn=class{constructor(e,t,i,n,o){this.type="Feature",this._vectorTileFeature=e,e._z=t,e._x=i,e._y=n,this.properties=e.properties,this.id=o}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){let e={geometry:this.geometry};for(let t in this)t==="_geometry"||t==="_vectorTileFeature"||(e[t]=this[t]);return e}};var jp=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 Kr(8192,16,0),this.grid3D=new Kr(8192,16,0),this.featureIndexArray=new ho,this.promoteId=t}insert(e,t,i,n,o,a){let s=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(i,n,o);let l=a?this.grid3D:this.grid;for(let u=0;u<t.length;u++){let c=t[u],p=[1/0,1/0,-1/0,-1/0];for(let h=0;h<c.length;h++){let f=c[h];p[0]=Math.min(p[0],f.x),p[1]=Math.min(p[1],f.y),p[2]=Math.max(p[2],f.x),p[3]=Math.max(p[3],f.y)}p[0]<8192&&p[1]<8192&&p[2]>=0&&p[3]>=0&&l.insert(s,p[0],p[1],p[2],p[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new vg.default.VectorTile(new wg.default(this.rawTileData)).layers,this.sourceLayerCoder=new Ml(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,t,i,n){this.loadVTLayers();let o=e.params||{},a=8192/e.tileSize/e.scale,s=Nn(o.filter),l=e.queryGeometry,u=e.queryPadding*a,c=_g(l),p=this.grid.query(c.minX-u,c.minY-u,c.maxX+u,c.maxY+u),h=_g(e.cameraQueryGeometry),f=this.grid3D.query(h.minX-u,h.minY-u,h.maxX+u,h.maxY+u,(g,x,v,b)=>ed(e.cameraQueryGeometry,g-u,x-u,v+u,b+u));for(let g of f)p.push(g);p.sort(fA);let d={},y;for(let g=0;g<p.length;g++){let x=p[g];if(x===y)continue;y=x;let v=this.featureIndexArray.get(x),b=null;this.loadMatchingFeature(d,v.bucketIndex,v.sourceLayerIndex,v.featureIndex,s,o.layers,o.availableImages,t,i,n,(w,S,P)=>(b||(b=mt(w)),S.queryIntersectsFeature(l,w,P,b,this.z,e.transform,a,e.pixelPosMatrix)))}return d}loadMatchingFeature(e,t,i,n,o,a,s,l,u,c,p){let h=this.bucketLayerIDs[t];if(a&&!lf(a,h))return;let f=this.sourceLayerCoder.decode(i),y=this.vtLayers[f].feature(n);if(o.needGeometry){let x=dt(y,!0);if(!o.filter(new de(this.tileID.overscaledZ),x,this.tileID.canonical))return}else if(!o.filter(new de(this.tileID.overscaledZ),y))return;let g=this.getId(y,f);for(let x=0;x<h.length;x++){let v=h[x];if(a&&a.indexOf(v)<0)continue;let b=l[v];if(!b)continue;let w={};g&&c&&(w=c.getState(b.sourceLayer||"_geojsonTileLayer",g));let S=O({},u[v]);S.paint=bg(S.paint,b.paint,y,w,s),S.layout=bg(S.layout,b.layout,y,w,s);let P=!p||p(y,b,w);if(!P)continue;let I=new sn(y,this.z,this.x,this.y,g);I.layer=S;let k=e[v];k===void 0&&(k=e[v]=[]),k.push({featureIndex:n,feature:I,intersectionZ:P})}}lookupSymbolFeatures(e,t,i,n,o,a,s,l){let u={};this.loadVTLayers();let c=Nn(o);for(let p of e)this.loadMatchingFeature(u,i,n,p,c,a,s,l,t);return u}hasLayer(e){for(let t of this.bucketLayerIDs)for(let i of t)if(e===i)return!0;return!1}getId(e,t){let i=e.id;if(this.promoteId){let n=typeof this.promoteId=="string"?this.promoteId:this.promoteId[t];i=e.properties[n],typeof i=="boolean"&&(i=Number(i))}return i}};U("FeatureIndex",jp,{omit:["rawTileData","sourceLayerCoder"]});function bg(r,e,t,i,n){return bn(r,(o,a)=>{let s=e instanceof _r?e.get(a):null;return s&&s.evaluate?s.evaluate(t,i,n):s})}function _g(r){let e=1/0,t=1/0,i=-1/0,n=-1/0;for(let o of r)e=Math.min(e,o.x),t=Math.min(t,o.y),i=Math.max(i,o.x),n=Math.max(n,o.y);return{minX:e,minY:t,maxX:i,maxY:n}}function fA(r,e){return e-r}m();m();var Ko="RTLPluginLoaded";var Hp=class extends me{constructor(){super(...arguments);this.status="unavailable";this.url=null;this.dispatcher=Pl()}_syncState(t){return this.status=t,this.dispatcher.broadcast("SRPS",{pluginStatus:t,pluginURL:this.url}).catch(i=>{throw this.status="error",i})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}async setRTLTextPlugin(t,i=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=K.resolveURL(t),!this.url)throw new Error(`requested url ${t} is invalid`);if(this.status==="unavailable")if(i)this.status="deferred",this._syncState(this.status);else return this._requestImport();else if(this.status==="requested")return this._requestImport()}async _requestImport(){await this._syncState("loading"),this.status="loaded",this.fire(new z(Ko))}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}},Zp=null;function zr(){return Zp||(Zp=new Hp),Zp}var mA=3e4,ln=class{constructor(e,t){this.timeAdded=0;this.fadeEndTime=0;this.tileID=e,this.uid=Ra(),this.uses=0,this.tileSize=t,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(e){let t=e+this.timeAdded;t<this.fadeEndTime||(this.fadeEndTime=t)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(e){this.demTexture&&e.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(e,t,i){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",!e){this.collisionBoxArray=new ao;return}e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestFeatureIndex.rawTileData=e.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=xg(e.buckets,t.style),this.hasSymbolBuckets=!1;for(let n in this.buckets){let o=this.buckets[n];if(o instanceof Bt)if(this.hasSymbolBuckets=!0,i)o.justReloaded=!0;else break}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let n in this.buckets){let o=this.buckets[n];if(o instanceof Bt&&o.hasRTLText){this.hasRTLText=!0,zr().lazyLoad();break}}this.queryPadding=0;for(let n in this.buckets){let o=this.buckets[n];this.queryPadding=Math.max(this.queryPadding,t.style.getLayer(n).queryRadius(o))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage)}unloadVectorData(){for(let e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(e){return this.buckets[e.id]}upload(e){for(let i in this.buckets){let n=this.buckets[i];n.uploadPending()&&n.upload(e)}let t=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new _e(e,this.imageAtlas.image,t.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new _e(e,this.glyphAtlasImage,t.ALPHA),this.glyphAtlasImage=null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,t,i,n,o,a,s,l,u,c){return!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData?{}:this.latestFeatureIndex.query({queryGeometry:n,cameraQueryGeometry:o,scale:a,tileSize:this.tileSize,pixelPosMatrix:c,transform:l,params:s,queryPadding:this.queryPadding*u},e,t,i)}querySourceFeatures(e,t){let i=this.latestFeatureIndex;if(!i||!i.rawTileData)return;let n=i.loadVTLayers(),o=t&&t.sourceLayer?t.sourceLayer:"",a=n._geojsonTileLayer||n[o];if(!a)return;let s=Nn(t&&t.filter),{z:l,x:u,y:c}=this.tileID.canonical,p={z:l,x:u,y:c};for(let h=0;h<a.length;h++){let f=a.feature(h);if(s.needGeometry){let g=dt(f,!0);if(!s.filter(new de(this.tileID.overscaledZ),g,this.tileID.canonical))continue}else if(!s.filter(new de(this.tileID.overscaledZ),f))continue;let d=i.getId(f,o),y=new sn(f,l,u,c,d);y.tile=p,e.push(y)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){let t=this.expirationTime;if(e.cacheControl){let i=hf(e.cacheControl);i["max-age"]&&(this.expirationTime=Date.now()+i["max-age"]*1e3)}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){let i=Date.now(),n=!1;if(this.expirationTime>i)n=!1;else if(!t)n=!0;else if(this.expirationTime<t)n=!0;else{let o=this.expirationTime-t;o?this.expirationTime=i+Math.max(o,mA):n=!0}n?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}setFeatureState(e,t){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(e).length===0)return;let i=this.latestFeatureIndex.loadVTLayers();for(let n in this.buckets){if(!t.style.hasLayer(n))continue;let o=this.buckets[n],a=o.layers[0].sourceLayer||"_geojsonTileLayer",s=i[a],l=e[a];if(!s||!l||Object.keys(l).length===0)continue;o.update(l,s,this.imageAtlas&&this.imageAtlas.patternPositions||{});let u=t&&t.style&&t.style.getLayer(n);u&&(this.queryPadding=Math.max(this.queryPadding,u.queryRadius(o)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<K.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(e){this.symbolFadeHoldUntil=K.now()+e}setDependencies(e,t){let i={};for(let n of t)i[n]=!0;this.dependencies[e]=i}hasDependency(e,t){for(let i of e){let n=this.dependencies[i];if(n){for(let o of t)if(n[o])return!0}}return!1}};m();var Il=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,i){let n=e.wrapped().key;this.data[n]===void 0&&(this.data[n]=[]);let o={value:t,timeout:void 0};if(i!==void 0&&(o.timeout=setTimeout(()=>{this.remove(e,o)},i)),this.data[n].push(o),this.order.push(n),this.order.length>this.max){let a=this._getAndRemoveByKey(this.order[0]);a&&this.onRemove(a)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){let t=this.data[e].shift();return t.timeout&&clearTimeout(t.timeout),this.data[e].length===0&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),t.value}getByKey(e){let t=this.data[e];return t?t[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,t){if(!this.has(e))return this;let i=e.wrapped().key,n=t===void 0?0:this.data[i].indexOf(t),o=this.data[i][n];return this.data[i].splice(n,1),o.timeout&&clearTimeout(o.timeout),this.data[i].length===0&&delete this.data[i],this.onRemove(o.value),this.order.splice(this.order.indexOf(i),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){let t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}filter(e){let t=[];for(let i in this.data)for(let n of this.data[i])e(n.value)||t.push(n);for(let i of t)this.remove(i.value.tileID,i)}};var Wp=ne(ye(),1);m();var Cl=class{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,t,i){let n=String(t);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][n]=this.stateChanges[e][n]||{},O(this.stateChanges[e][n],i),this.deletedStates[e]===null){this.deletedStates[e]={};for(let o in this.state[e])o!==n&&(this.deletedStates[e][o]=null)}else if(this.deletedStates[e]&&this.deletedStates[e][n]===null){this.deletedStates[e][n]={};for(let a in this.state[e][n])i[a]||(this.deletedStates[e][n][a]=null)}else for(let a in i)this.deletedStates[e]&&this.deletedStates[e][n]&&this.deletedStates[e][n][a]===null&&delete this.deletedStates[e][n][a]}removeFeatureState(e,t,i){if(this.deletedStates[e]===null)return;let o=String(t);if(this.deletedStates[e]=this.deletedStates[e]||{},i&&t!==void 0)this.deletedStates[e][o]!==null&&(this.deletedStates[e][o]=this.deletedStates[e][o]||{},this.deletedStates[e][o][i]=null);else if(t!==void 0)if(this.stateChanges[e]&&this.stateChanges[e][o]){this.deletedStates[e][o]={};for(i in this.stateChanges[e][o])this.deletedStates[e][o][i]=null}else this.deletedStates[e][o]=null;else this.deletedStates[e]=null}getState(e,t){let i=String(t),n=this.state[e]||{},o=this.stateChanges[e]||{},a=O({},n[i],o[i]);if(this.deletedStates[e]===null)return{};if(this.deletedStates[e]){let s=this.deletedStates[e][t];if(s===null)return{};for(let l in s)delete a[l]}return a}initializeTileState(e,t){e.setFeatureState(this.state,t)}coalesceChanges(e,t){let i={};for(let n in this.stateChanges){this.state[n]=this.state[n]||{};let o={};for(let a in this.stateChanges[n])this.state[n][a]||(this.state[n][a]={}),O(this.state[n][a],this.stateChanges[n][a]),o[a]=this.state[n][a];i[n]=o}for(let n in this.deletedStates){this.state[n]=this.state[n]||{};let o={};if(this.deletedStates[n]===null)for(let a in this.state[n])o[a]={},this.state[n][a]={};else for(let a in this.deletedStates[n]){if(this.deletedStates[n][a]===null)this.state[n][a]={};else for(let l of Object.keys(this.deletedStates[n][a]))delete this.state[n][a][l];o[a]=this.state[n][a]}i[n]=i[n]||{},O(i[n],o)}if(this.stateChanges={},this.deletedStates={},Object.keys(i).length!==0)for(let n in e)e[n].setFeatureState(i,t)}};var ar=class r extends me{constructor(e,t,i){super(),this.id=e,this.dispatcher=i,this.on("data",n=>this._dataHandler(n)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=yg(e,t,i,this),this._tiles={},this._cache=new Il(0,n=>this._unloadTile(n)),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((this.used!==void 0||this.usedForTerrain!==void 0)&&!this.used&&!this.usedForTerrain)return!0;if(!this._updated)return!1;for(let e in this._tiles){let t=this._tiles[e];if(t.state!=="loaded"&&t.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;let e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}async _loadTile(e,t,i){try{await this._source.loadTile(e),this._tileLoaded(e,t,i)}catch(n){e.state="errored",n.status!==404?this._source.fire(new Z(n,{tile:e})):this.update(this.transform,this.terrain)}}_unloadTile(e){this._source.unloadTile&&this._source.unloadTile(e)}_abortTile(e){this._source.abortTile&&this._source.abortTile(e),this._source.fire(new 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 i=this._tiles[t];i.upload(e),i.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(e=>e.tileID).sort(Sg).map(e=>e.key)}getRenderableIds(e){let t=[];for(let i in this._tiles)this._isIdRenderable(i,e)&&t.push(this._tiles[i]);return e?t.sort((i,n)=>{let o=i.tileID,a=n.tileID,s=new Wp.default(o.canonical.x,o.canonical.y)._rotate(this.transform.angle),l=new Wp.default(a.canonical.x,a.canonical.y)._rotate(this.transform.angle);return o.overscaledZ-a.overscaledZ||l.y-s.y||l.x-s.x}).map(i=>i.tileID.key):t.map(i=>i.tileID).sort(Sg).map(i=>i.key)}hasRenderableParent(e){let t=this.findLoadedParent(e,0);return t?this._isIdRenderable(t.tileID.key):!1}_isIdRenderable(e,t){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(t||!this._tiles[e].holdingForFade())}reload(){if(this._paused){this._shouldReloadOnResume=!0;return}this._cache.reset();for(let e in this._tiles)this._tiles[e].state!=="errored"&&this._reloadTile(e,"reloading")}async _reloadTile(e,t){let i=this._tiles[e];i&&(i.state!=="loading"&&(i.state=t),await this._loadTile(i,e,t))}_tileLoaded(e,t,i){e.timeAdded=K.now(),i==="expired"&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(t,e),this.getSource().type==="raster-dem"&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new z("data",{dataType:"source",tile:e,coord:e.tileID}))}_backfillDEM(e){let t=this.getRenderableIds();for(let n=0;n<t.length;n++){let o=t[n];if(e.neighboringTiles&&e.neighboringTiles[o]){let a=this.getTileByID(o);i(e,a),i(a,e)}}function i(n,o){n.needsHillshadePrepare=!0,n.needsTerrainPrepare=!0;let a=o.tileID.canonical.x-n.tileID.canonical.x,s=o.tileID.canonical.y-n.tileID.canonical.y,l=Math.pow(2,n.tileID.canonical.z),u=o.tileID.key;a===0&&s===0||Math.abs(s)>1||(Math.abs(a)>1&&(Math.abs(a+l)===1?a+=l:Math.abs(a-l)===1&&(a-=l)),!(!o.dem||!n.dem)&&(n.dem.backfillBorder(o.dem,a,s),n.neighboringTiles&&n.neighboringTiles[u]&&(n.neighboringTiles[u].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,t,i,n){for(let o in this._tiles){let a=this._tiles[o];if(n[o]||!a.hasData()||a.tileID.overscaledZ<=t||a.tileID.overscaledZ>i)continue;let s=a.tileID;for(;a&&a.tileID.overscaledZ>t+1;){let u=a.tileID.scaledTo(a.tileID.overscaledZ-1);a=this._tiles[u.key],a&&a.hasData()&&(s=u)}let l=s;for(;l.overscaledZ>t;)if(l=l.scaledTo(l.overscaledZ-1),e[l.key]){n[s.key]=s;break}}}findLoadedParent(e,t){if(e.key in this._loadedParentTiles){let i=this._loadedParentTiles[e.key];return i&&i.tileID.overscaledZ>=t?i:null}for(let i=e.overscaledZ-1;i>=t;i--){let n=e.scaledTo(i),o=this._getLoadedTile(n);if(o)return o}}_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,i=Math.ceil(e.height/this._source.tileSize)+1,n=t*i,o=this._maxTileCacheZoomLevels===null?Je.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels,a=Math.floor(n*o),s=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,a):a;this._cache.setMaxSize(s)}handleWrapJump(e){let t=this._prevLng===void 0?e:this._prevLng,n=(e-t)/360,o=Math.round(n);if(this._prevLng=e,o){let a={};for(let s in this._tiles){let l=this._tiles[s];l.tileID=l.tileID.unwrapTo(l.tileID.wrap+o),a[l.tileID.key]=l}this._tiles=a;for(let s in this._timers)clearTimeout(this._timers[s]),delete this._timers[s];for(let s in this._tiles){let l=this._tiles[s];this._setTileReloadTimer(s,l)}}}update(e,t){if(!this._sourceLoaded||this._paused)return;this.transform=e,this.terrain=t,this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={};let i;!this.used&&!this.usedForTerrain?i=[]:this._source.tileID?i=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(c=>new Ye(c.canonical.z,c.wrap,c.canonical.z,c.canonical.x,c.canonical.y)):(i=e.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this.usedForTerrain?!1:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:t}),this._source.hasTile&&(i=i.filter(c=>this._source.hasTile(c))));let n=e.coveringZoomLevel(this._source),o=Math.max(n-r.maxOverzooming,this._source.minzoom),a=Math.max(n+r.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){let c={};for(let p of i)if(p.canonical.z>this._source.minzoom){let h=p.scaledTo(p.canonical.z-1);c[h.key]=h;let f=p.scaledTo(Math.max(this._source.minzoom,Math.min(p.canonical.z,5)));c[f.key]=f}i=i.concat(Object.values(c))}let s=i.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,s&&this.fire(new z("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));let l=this._updateRetainedTiles(i,n);if(Pg(this._source.type)){let c={},p={},h=Object.keys(l),f=K.now();for(let d of h){let y=l[d],g=this._tiles[d];if(!g||g.fadeEndTime!==0&&g.fadeEndTime<=f)continue;let x=this.findLoadedParent(y,o);x&&(this._addTile(x.tileID),c[x.tileID.key]=x.tileID),p[d]=y}this._retainLoadedChildren(p,n,a,l);for(let d in c)l[d]||(this._coveredTiles[d]=!0,l[d]=c[d]);if(t){let d={},y={};for(let g of i)this._tiles[g.key].hasData()?d[g.key]=g:y[g.key]=g;for(let g in y){let x=y[g].children(this._source.maxzoom);this._tiles[x[0].key]&&this._tiles[x[1].key]&&this._tiles[x[2].key]&&this._tiles[x[3].key]&&(d[x[0].key]=l[x[0].key]=x[0],d[x[1].key]=l[x[1].key]=x[1],d[x[2].key]=l[x[2].key]=x[2],d[x[3].key]=l[x[3].key]=x[3],delete y[g])}for(let g in y){let x=this.findLoadedParent(y[g],this._source.minzoom);if(x){d[x.tileID.key]=l[x.tileID.key]=x.tileID;for(let v in d)d[v].isChildOf(x.tileID)&&delete d[v]}}for(let g in this._tiles)d[g]||(this._coveredTiles[g]=!0)}}for(let c in l)this._tiles[c].clearFadeHold();let u=of(this._tiles,l);for(let c of u){let p=this._tiles[c];p.hasSymbolBuckets&&!p.holdingForFade()?p.setHoldDuration(this.map._fadeDuration):(!p.hasSymbolBuckets||p.symbolFadeFinished())&&this._removeTile(c)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(let e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(e)}_updateRetainedTiles(e,t){let i={},n={},o=Math.max(t-r.maxOverzooming,this._source.minzoom),a=Math.max(t+r.maxUnderzooming,this._source.minzoom),s={};for(let l of e){let u=this._addTile(l);i[l.key]=l,!u.hasData()&&t<this._source.maxzoom&&(s[l.key]=l)}this._retainLoadedChildren(s,t,a,i);for(let l of e){let u=this._tiles[l.key];if(u.hasData())continue;if(t+1>this._source.maxzoom){let p=l.children(this._source.maxzoom)[0],h=this.getTile(p);if(h&&h.hasData()){i[p.key]=p;continue}}else{let p=l.children(this._source.maxzoom);if(i[p[0].key]&&i[p[1].key]&&i[p[2].key]&&i[p[3].key])continue}let c=u.wasRequested();for(let p=l.overscaledZ-1;p>=o;--p){let h=l.scaledTo(p);if(n[h.key])break;if(n[h.key]=!0,u=this.getTile(h),!u&&c&&(u=this._addTile(h)),u){let f=u.hasData();if((c||f)&&(i[h.key]=h),c=u.wasRequested(),f)break}}}return i}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(let e in this._tiles){let t=[],i,n=this._tiles[e].tileID;for(;n.overscaledZ>0;){if(n.key in this._loadedParentTiles){i=this._loadedParentTiles[n.key];break}t.push(n.key);let o=n.scaledTo(n.overscaledZ-1);if(i=this._getLoadedTile(o),i)break;n=o}for(let o of t)this._loadedParentTiles[o]=i}}_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 i=t;return t||(t=new ln(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(t,e.key,t.state)),t.uses++,this._tiles[e.key]=t,i||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 i=t.getExpiryTimeout();i&&(this._timers[e]=setTimeout(()=>{this._reloadTile(e,"expired"),delete this._timers[e]},i))}_removeTile(e){let t=this._tiles[e];t&&(t.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),!(t.uses>0)&&(t.hasData()&&t.state!=="reloading"?this._cache.add(t.tileID,t,t.getExpiryTimeout()):(t.aborted=!0,this._abortTile(t),this._unloadTile(t))))}_dataHandler(e){let t=e.sourceDataType;e.dataType==="source"&&t==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&e.dataType==="source"&&t==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(let e in this._tiles)this._removeTile(e);this._cache.reset()}tilesIn(e,t,i){let n=[],o=this.transform;if(!o)return n;let a=i?o.getCameraQueryGeometry(e):e,s=e.map(d=>o.pointCoordinate(d,this.terrain)),l=a.map(d=>o.pointCoordinate(d,this.terrain)),u=this.getIds(),c=1/0,p=1/0,h=-1/0,f=-1/0;for(let d of l)c=Math.min(c,d.x),p=Math.min(p,d.y),h=Math.max(h,d.x),f=Math.max(f,d.y);for(let d=0;d<u.length;d++){let y=this._tiles[u[d]];if(y.holdingForFade())continue;let g=y.tileID,x=Math.pow(2,o.zoom-y.tileID.overscaledZ),v=t*y.queryPadding*8192/y.tileSize/x,b=[g.getTilePoint(new ze(c,p)),g.getTilePoint(new ze(h,f))];if(b[0].x-v<8192&&b[0].y-v<8192&&b[1].x+v>=0&&b[1].y+v>=0){let w=s.map(P=>g.getTilePoint(P)),S=l.map(P=>g.getTilePoint(P));n.push({tile:y,tileID:g,queryGeometry:w,cameraQueryGeometry:S,scale:x})}}return n}getVisibleCoordinates(e){let t=this.getRenderableIds(e).map(i=>this._tiles[i].tileID);for(let i of t)i.posMatrix=this.transform.calculatePosMatrix(i.toUnwrapped());return t}hasTransition(){if(this._source.hasTransition())return!0;if(Pg(this._source.type)){let e=K.now();for(let t in this._tiles)if(this._tiles[t].fadeEndTime>=e)return!0}return!1}setFeatureState(e,t,i){e=e||"_geojsonTileLayer",this._state.updateState(e,t,i)}removeFeatureState(e,t,i){e=e||"_geojsonTileLayer",this._state.removeFeatureState(e,t,i)}getFeatureState(e,t){return e=e||"_geojsonTileLayer",this._state.getState(e,t)}setDependencies(e,t,i){let n=this._tiles[e];n&&n.setDependencies(t,i)}reloadTilesForDependencies(e,t){for(let i in this._tiles)this._tiles[i].hasDependency(e,t)&&this._reloadTile(i,"reloading");this._cache.filter(i=>!i.hasDependency(e,t))}};ar.maxOverzooming=10;ar.maxUnderzooming=3;function Sg(r,e){let t=Math.abs(r.wrap*2)-+(r.wrap<0),i=Math.abs(e.wrap*2)-+(e.wrap<0);return r.overscaledZ-e.overscaledZ||i-t||e.canonical.y-r.canonical.y||e.canonical.x-r.canonical.x}function Pg(r){return r==="raster"||r==="image"||r==="video"}m();m();m();var Zt=ne(ye(),1);m();var sr=ne(ye(),1);function Xp(r,e,t,i,n){let o=[];for(let a=0;a<r.length;a++){let s=r[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 sr.default(e,c.y+(p.y-c.y)*((e-c.x)/(p.x-c.x)))._round():p.x<e&&(p=new sr.default(e,c.y+(p.y-c.y)*((e-c.x)/(p.x-c.x)))._round()),!(c.y<t&&p.y<t)&&(c.y<t?c=new sr.default(c.x+(p.x-c.x)*((t-c.y)/(p.y-c.y)),t)._round():p.y<t&&(p=new sr.default(c.x+(p.x-c.x)*((t-c.y)/(p.y-c.y)),t)._round()),!(c.x>=i&&p.x>=i)&&(c.x>=i?c=new sr.default(i,c.y+(p.y-c.y)*((i-c.x)/(p.x-c.x)))._round():p.x>=i&&(p=new sr.default(i,c.y+(p.y-c.y)*((i-c.x)/(p.x-c.x)))._round()),!(c.y>=n&&p.y>=n)&&(c.y>=n?c=new sr.default(c.x+(p.x-c.x)*((n-c.y)/(p.y-c.y)),n)._round():p.y>=n&&(p=new sr.default(c.x+(p.x-c.x)*((n-c.y)/(p.y-c.y)),n)._round()),(!l||!c.equals(l[l.length-1]))&&(l=[c],o.push(l)),l.push(p)))))}}return o}m();var El=class{constructor(e,t){this.reset(e,t)}reset(e,t){this.points=e||[],this._distances=[0];for(let i=1;i<this.points.length;i++)this._distances[i]=this._distances[i-1]+this.points[i].dist(this.points[i-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(t||0,this.length*.5),this.paddedLength=this.length-this.padding*2}lerp(e){if(this.points.length===1)return this.points[0];e=Ae(e,0,1);let t=1,i=this._distances[t],n=e*this.paddedLength+this.padding;for(;i<n&&t<this._distances.length;)i=this._distances[++t];let o=t-1,a=this._distances[o],s=i-a,l=s>0?(n-a)/s:0;return this.points[o].mult(1-l).add(this.points[t].mult(l))}};m();function kl(r,e){let t=!0;return r==="always"||(r==="never"||e==="never")&&(t=!1),t}var Jo=class{constructor(e,t,i){let n=this.boxCells=[],o=this.circleCells=[];this.xCellCount=Math.ceil(e/i),this.yCellCount=Math.ceil(t/i);for(let a=0;a<this.xCellCount*this.yCellCount;a++)n.push([]),o.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=t,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/t,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,t,i,n,o){this._forEachCell(t,i,n,o,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(t),this.bboxes.push(i),this.bboxes.push(n),this.bboxes.push(o)}insertCircle(e,t,i,n){this._forEachCell(t-n,i-n,t+n,i+n,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(t),this.circles.push(i),this.circles.push(n)}_insertBoxCell(e,t,i,n,o,a){this.boxCells[o].push(a)}_insertCircleCell(e,t,i,n,o,a){this.circleCells[o].push(a)}_query(e,t,i,n,o,a,s){if(i<0||e>this.width||n<0||t>this.height)return[];let l=[];if(e<=0&&t<=0&&this.width<=i&&this.height<=n){if(o)return[{key:null,x1:e,y1:t,x2:i,y2:n}];for(let u=0;u<this.boxKeys.length;u++)l.push({key:this.boxKeys[u],x1:this.bboxes[u*4],y1:this.bboxes[u*4+1],x2:this.bboxes[u*4+2],y2:this.bboxes[u*4+3]});for(let u=0;u<this.circleKeys.length;u++){let c=this.circles[u*3],p=this.circles[u*3+1],h=this.circles[u*3+2];l.push({key:this.circleKeys[u],x1:c-h,y1:p-h,x2:c+h,y2:p+h})}}else{let u={hitTest:o,overlapMode:a,seenUids:{box:{},circle:{}}};this._forEachCell(e,t,i,n,this._queryCell,l,u,s)}return l}query(e,t,i,n){return this._query(e,t,i,n,!1,null)}hitTest(e,t,i,n,o,a){return this._query(e,t,i,n,!0,o,a).length>0}hitTestCircle(e,t,i,n,o){let a=e-i,s=e+i,l=t-i,u=t+i;if(s<0||a>this.width||u<0||l>this.height)return!1;let c=[],p={hitTest:!0,overlapMode:n,circle:{x:e,y:t,radius:i},seenUids:{box:{},circle:{}}};return this._forEachCell(a,l,s,u,this._queryCellCircle,c,p,o),c.length>0}_queryCell(e,t,i,n,o,a,s,l){let{seenUids:u,hitTest:c,overlapMode:p}=s,h=this.boxCells[o];if(h!==null){let d=this.bboxes;for(let y of h)if(!u.box[y]){u.box[y]=!0;let g=y*4,x=this.boxKeys[y];if(e<=d[g+2]&&t<=d[g+3]&&i>=d[g+0]&&n>=d[g+1]&&(!l||l(x))&&(!c||!kl(p,x.overlapMode))&&(a.push({key:x,x1:d[g],y1:d[g+1],x2:d[g+2],y2:d[g+3]}),c))return!0}}let f=this.circleCells[o];if(f!==null){let d=this.circles;for(let y of f)if(!u.circle[y]){u.circle[y]=!0;let g=y*3,x=this.circleKeys[y];if(this._circleAndRectCollide(d[g],d[g+1],d[g+2],e,t,i,n)&&(!l||l(x))&&(!c||!kl(p,x.overlapMode))){let v=d[g],b=d[g+1],w=d[g+2];if(a.push({key:x,x1:v-w,y1:b-w,x2:v+w,y2:b+w}),c)return!0}}}return!1}_queryCellCircle(e,t,i,n,o,a,s,l){let{circle:u,seenUids:c,overlapMode:p}=s,h=this.boxCells[o];if(h!==null){let d=this.bboxes;for(let y of h)if(!c.box[y]){c.box[y]=!0;let g=y*4,x=this.boxKeys[y];if(this._circleAndRectCollide(u.x,u.y,u.radius,d[g+0],d[g+1],d[g+2],d[g+3])&&(!l||l(x))&&!kl(p,x.overlapMode))return a.push(!0),!0}}let f=this.circleCells[o];if(f!==null){let d=this.circles;for(let y of f)if(!c.circle[y]){c.circle[y]=!0;let g=y*3,x=this.circleKeys[y];if(this._circlesCollide(d[g],d[g+1],d[g+2],u.x,u.y,u.radius)&&(!l||l(x))&&!kl(p,x.overlapMode))return a.push(!0),!0}}}_forEachCell(e,t,i,n,o,a,s,l){let u=this._convertToXCellCoord(e),c=this._convertToYCellCoord(t),p=this._convertToXCellCoord(i),h=this._convertToYCellCoord(n);for(let f=u;f<=p;f++)for(let d=c;d<=h;d++){let y=this.xCellCount*d+f;if(o.call(this,e,t,i,n,y,a,s,l))return}}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,t,i,n,o,a){let s=n-e,l=o-t,u=i+a;return u*u>s*s+l*l}_circleAndRectCollide(e,t,i,n,o,a,s){let l=(a-n)/2,u=Math.abs(e-(n+l));if(u>l+i)return!1;let c=(s-o)/2,p=Math.abs(t-(o+c));if(p>c+i)return!1;if(u<=l||p<=c)return!0;let h=u-l,f=p-c;return h*h+f*f<=i*i}};m();var un=ne(ye(),1);function Yo(r,e,t,i,n){let o=N.create();return e?(N.scale(o,o,[1/n,1/n,1]),t||N.rotateZ(o,o,i.angle)):N.multiply(o,i.labelPlaneMatrix,r),o}function Dl(r,e,t,i,n){if(e){let o=N.clone(r);return N.scale(o,o,[n,n,1]),t||N.rotateZ(o,o,-i.angle),o}else return i.glCoordMatrix}function xt(r,e,t){let i;t?(i=[r.x,r.y,t(r.x,r.y),1],Ne.transformMat4(i,i,e)):(i=[r.x,r.y,0,1],zl(i,i,e));let n=i[3];return{point:new un.default(i[0]/n,i[1]/n),signedDistanceFromCamera:n}}function Qo(r,e){return .5+.5*(r/e)}function dA(r,e){let t=r[0]/r[3],i=r[1]/r[3];return t>=-e[0]&&t<=e[0]&&i>=-e[1]&&i<=e[1]}function Mg(r,e,t,i,n,o,a,s,l,u){let c=i?r.textSizeData:r.iconSizeData,p=si(c,t.transform.zoom),h=[256/t.width*2+1,256/t.height*2+1],f=i?r.text.dynamicLayoutVertexArray:r.icon.dynamicLayoutVertexArray;f.clear();let d=r.lineVertexArray,y=i?r.text.placedSymbolArray:r.icon.placedSymbolArray,g=t.transform.width/t.transform.height,x=!1;for(let v=0;v<y.length;v++){let b=y.get(v);if(b.hidden||b.writingMode===2&&!x){ci(b.numGlyphs,f);continue}x=!1;let w;if(u?(w=[b.anchorX,b.anchorY,u(b.anchorX,b.anchorY),1],Ne.transformMat4(w,w,e)):(w=[b.anchorX,b.anchorY,0,1],zl(w,w,e)),!dA(w,h)){ci(b.numGlyphs,f);continue}let S=w[3],P=Qo(t.transform.cameraToCenterDistance,S),I=Qi(c,p,b),k=a?I/P:I*P,C=new un.default(b.anchorX,b.anchorY),T=xt(C,n,u).point,D={projections:{},offsets:{}},F=Ag(b,k,!1,s,e,n,o,r.glyphOffsetArray,d,f,T,C,D,g,l,u);x=F.useVertical,(F.notEnoughRoom||x||F.needsFlipping&&Ag(b,k,!0,s,e,n,o,r.glyphOffsetArray,d,f,T,C,D,g,l,u).notEnoughRoom)&&ci(b.numGlyphs,f)}i?r.text.dynamicLayoutVertexBuffer.updateData(f):r.icon.dynamicLayoutVertexBuffer.updateData(f)}function Yp(r,e,t,i,n,o,a,s,l,u,c,p,h){let f=s.glyphStartIndex+s.numGlyphs,d=s.lineStartIndex,y=s.lineStartIndex+s.lineLength,g=e.getoffsetX(s.glyphStartIndex),x=e.getoffsetX(f-1),v=Ll(r*g,t,i,n,o,a,s.segment,d,y,l,u,c,p,h);if(!v)return null;let b=Ll(r*x,t,i,n,o,a,s.segment,d,y,l,u,c,p,h);return b?{first:v,last:b}:null}function Tg(r,e,t,i){if(r===1){let n=Math.abs(t.y-e.y),o=Math.abs(t.x-e.x)*i;if(n>o)return{useVertical:!0}}return(r===2?e.y<t.y:e.x>t.x)?{needsFlipping:!0}:null}function Ag(r,e,t,i,n,o,a,s,l,u,c,p,h,f,d,y){let g=e/24,x=r.lineOffsetX*g,v=r.lineOffsetY*g,b;if(r.numGlyphs>1){let w=r.glyphStartIndex+r.numGlyphs,S=r.lineStartIndex,P=r.lineStartIndex+r.lineLength,I=Yp(g,s,x,v,t,c,p,r,l,o,h,d,y);if(!I)return{notEnoughRoom:!0};let k=xt(I.first.point,a,y).point,C=xt(I.last.point,a,y).point;if(i&&!t){let T=Tg(r.writingMode,k,C,f);if(T)return T}b=[I.first];for(let T=r.glyphStartIndex+1;T<w-1;T++){let D=Ll(g*s.getoffsetX(T),x,v,t,c,p,r.segment,S,P,l,o,h,d,y);if(D==null)return{notEnoughRoom:!0};b.push(D)}b.push(I.last)}else{if(i&&!t){let S=xt(p,n,y).point,P=r.lineStartIndex+r.segment+1,I=new un.default(l.getx(P),l.gety(P)),k=xt(I,n,y),C=k.signedDistanceFromCamera>0?k.point:Ig(p,I,S,1,n,y),T=Tg(r.writingMode,S,C,f);if(T)return T}let w=Ll(g*s.getoffsetX(r.glyphStartIndex),x,v,t,c,p,r.segment,r.lineStartIndex,r.lineStartIndex+r.lineLength,l,o,h,d,y);if(!w)return{notEnoughRoom:!0};b=[w]}for(let w of b)li(u,w.point,w.angle);return{}}function Ig(r,e,t,i,n,o){let a=xt(r.add(r.sub(e)._unit()),n,o).point,s=t.sub(a);return t.add(s._mult(i/s.mag()))}function Kp(r,e){let{projectionCache:t,lineVertexArray:i,labelPlaneMatrix:n,tileAnchorPoint:o,distanceFromAnchor:a,getElevation:s,previousVertex:l,direction:u,absOffsetX:c}=e;if(t.projections[r])return t.projections[r];let p=new un.default(i.getx(r),i.gety(r)),h=xt(p,n,s);if(h.signedDistanceFromCamera>0)return t.projections[r]=h.point,h.point;let f=r-u,d=a===0?o:new un.default(i.getx(f),i.gety(f));return Ig(d,p,l,c-a+1,n,s)}function Jp(r,e,t){return r._unit()._perp()._mult(e*t)}function yA(r,e,t,i,n,o,a,s){let{projectionCache:l,direction:u}=s;if(l.offsets[r])return l.offsets[r];let c=t.add(e);if(r+u<i||r+u>=n)return l.offsets[r]=c,c;let p=Kp(r+u,s),h=Jp(p.sub(t),a,u),f=t.add(h),d=p.add(h);return l.offsets[r]=uf(o,c,f,d)||c,l.offsets[r]}function Ll(r,e,t,i,n,o,a,s,l,u,c,p,h,f){let d=i?r-e:r+e,y=d>0?1:-1,g=0;i&&(y*=-1,g=Math.PI),y<0&&(g+=Math.PI);let x=y>0?s+a:s+a+1,v=n,b=n,w,S,P=0,I=0,k=Math.abs(d),C=[],T;for(;P+I<=k;){if(x+=y,x<s||x>=l)return null;P+=I,b=v,S=w;let A={projectionCache:p,lineVertexArray:u,labelPlaneMatrix:c,tileAnchorPoint:o,distanceFromAnchor:P,getElevation:f,previousVertex:b,direction:y,absOffsetX:k};if(v=Kp(x,A),t===0)C.push(b),T=v.sub(b);else{let $,X=v.sub(b);if(X.mag()===0){let j=Kp(x+y,A);$=Jp(j.sub(v),t,y)}else $=Jp(X,t,y);S||(S=b.add($)),w=yA(x,$,v,s,l,S,t,A),C.push(S),T=w.sub(S)}I=T.mag()}let D=(k-P)/I,F=T._mult(D)._add(S||b),E=g+Math.atan2(v.y-b.y,v.x-b.x);return C.push(F),{point:F,angle:h?E:0,path:C}}var gA=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function ci(r,e){for(let t=0;t<r;t++){let i=e.length;e.resize(i+4),e.float32.set(gA,i*3)}}function zl(r,e,t){let i=e[0],n=e[1];return r[0]=t[0]*i+t[4]*n+t[12],r[1]=t[1]*i+t[5]*n+t[13],r[3]=t[3]*i+t[7]*n+t[15],r}var He=100,Fl=class{constructor(e,t=new Jo(e.width+2*He,e.height+2*He,25),i=new Jo(e.width+2*He,e.height+2*He,25)){this.transform=e,this.grid=t,this.ignoredGrid=i,this.pitchfactor=Math.cos(e._pitch)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+He,this.screenBottomBoundary=e.height+He,this.gridRightBoundary=e.width+2*He,this.gridBottomBoundary=e.height+2*He,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,t,i,n,o,a){let s=this.projectAndGetPerspectiveRatio(n,e.anchorPointX,e.anchorPointY,a),l=i*s.perspectiveRatio,u=e.x1*l+s.point.x,c=e.y1*l+s.point.y,p=e.x2*l+s.point.x,h=e.y2*l+s.point.y;return!this.isInsideGrid(u,c,p,h)||t!=="always"&&this.grid.hitTest(u,c,p,h,t,o)||s.perspectiveRatio<this.perspectiveRatioCutoff?{box:[],offscreen:!1}:{box:[u,c,p,h],offscreen:this.isOffscreen(u,c,p,h)}}placeCollisionCircles(e,t,i,n,o,a,s,l,u,c,p,h,f,d){let y=[],g=new Zt.default(t.anchorX,t.anchorY),x=xt(g,a,d),v=Qo(this.transform.cameraToCenterDistance,x.signedDistanceFromCamera),w=(c?o/v:o*v)/Cr,S=xt(g,s,d).point,P={projections:{},offsets:{}},I=t.lineOffsetX*w,k=t.lineOffsetY*w,C=Yp(w,n,I,k,!1,S,g,t,i,s,P,!1,d),T=!1,D=!1,F=!0;if(C){let E=h*.5*v+f,A=new Zt.default(-He,-He),$=new Zt.default(this.screenRightBoundary,this.screenBottomBoundary),X=new El,j=C.first,fe=C.last,Q=[];for(let le=j.path.length-1;le>=1;le--)Q.push(j.path[le]);for(let le=1;le<fe.path.length;le++)Q.push(fe.path[le]);let nt=E*2.5;if(l){let le=Q.map(Te=>xt(Te,l,d));le.some(Te=>Te.signedDistanceFromCamera<=0)?Q=[]:Q=le.map(Te=>Te.point)}let We=[];if(Q.length>0){let le=Q[0].clone(),Te=Q[0].clone();for(let Qe=1;Qe<Q.length;Qe++)le.x=Math.min(le.x,Q[Qe].x),le.y=Math.min(le.y,Q[Qe].y),Te.x=Math.max(Te.x,Q[Qe].x),Te.y=Math.max(Te.y,Q[Qe].y);le.x>=A.x&&Te.x<=$.x&&le.y>=A.y&&Te.y<=$.y?We=[Q]:Te.x<A.x||le.x>$.x||Te.y<A.y||le.y>$.y?We=[]:We=Xp([Q],A.x,A.y,$.x,$.y)}for(let le of We){X.reset(le,E*.25);let Te=0;X.length<=.5*E?Te=1:Te=Math.ceil(X.paddedLength/nt)+1;for(let Qe=0;Qe<Te;Qe++){let cr=Qe/Math.max(Te-1,1),pr=X.lerp(cr),Dt=pr.x+He,Wt=pr.y+He;y.push(Dt,Wt,E,0);let Br=Dt-E,et=Wt-E,$e=Dt+E,Xe=Wt+E;if(F=F&&this.isOffscreen(Br,et,$e,Xe),D=D||this.isInsideGrid(Br,et,$e,Xe),e!=="always"&&this.grid.hitTestCircle(Dt,Wt,E,e,p)&&(T=!0,!u))return{circles:[],offscreen:!1,collisionDetected:T}}}}return{circles:!u&&T||!D||v<this.perspectiveRatioCutoff?[]:y,offscreen:F,collisionDetected:T}}queryRenderedSymbols(e){if(e.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};let t=[],i=1/0,n=1/0,o=-1/0,a=-1/0;for(let c of e){let p=new Zt.default(c.x+He,c.y+He);i=Math.min(i,p.x),n=Math.min(n,p.y),o=Math.max(o,p.x),a=Math.max(a,p.y),t.push(p)}let s=this.grid.query(i,n,o,a).concat(this.ignoredGrid.query(i,n,o,a)),l={},u={};for(let c of s){let p=c.key;if(l[p.bucketInstanceId]===void 0&&(l[p.bucketInstanceId]={}),l[p.bucketInstanceId][p.featureIndex])continue;let h=[new Zt.default(c.x1,c.y1),new Zt.default(c.x2,c.y1),new Zt.default(c.x2,c.y2),new Zt.default(c.x1,c.y2)];Ns(t,h)&&(l[p.bucketInstanceId][p.featureIndex]=!0,u[p.bucketInstanceId]===void 0&&(u[p.bucketInstanceId]=[]),u[p.bucketInstanceId].push(p.featureIndex))}return u}insertCollisionBox(e,t,i,n,o,a){let s=i?this.ignoredGrid:this.grid,l={bucketInstanceId:n,featureIndex:o,collisionGroupID:a,overlapMode:t};s.insert(l,e[0],e[1],e[2],e[3])}insertCollisionCircles(e,t,i,n,o,a){let s=i?this.ignoredGrid:this.grid,l={bucketInstanceId:n,featureIndex:o,collisionGroupID:a,overlapMode:t};for(let u=0;u<e.length;u+=4)s.insertCircle(l,e[u],e[u+1],e[u+2])}projectAndGetPerspectiveRatio(e,t,i,n){let o;return n?(o=[t,i,n(t,i),1],Ne.transformMat4(o,o,e)):(o=[t,i,0,1],zl(o,o,e)),{point:new Zt.default((o[0]/o[3]+1)/2*this.transform.width+He,(-o[1]/o[3]+1)/2*this.transform.height+He),perspectiveRatio:.5+.5*(this.transform.cameraToCenterDistance/o[3])}}isOffscreen(e,t,i,n){return i<He||e>=this.screenRightBoundary||n<He||t>this.screenBottomBoundary}isInsideGrid(e,t,i,n){return i>=0&&e<this.gridRightBoundary&&n>=0&&t<this.gridBottomBoundary}getViewportMatrix(){let e=N.identity([]);return N.translate(e,e,[-He,-He,0]),e}};m();m();var Cg=ne(ye(),1);var ea=class r extends Cg.default{constructor(e,t,i,n){super(e,t),this.angle=i,n!==void 0&&(this.segment=n)}clone(){return new r(this.x,this.y,this.angle,this.segment)}};U("Anchor",ea);m();m();m();var xA=ne(ye(),1);m();var bA=ne(ye(),1);m();var _A=ne(Eg(),1),vA=ne(ye(),1);var SA=ne(yp(),1);m();var ta=(o=>(o[o.center=1]="center",o[o.left=2]="left",o[o.right=3]="right",o[o.top=4]="top",o[o.bottom=5]="bottom",o[o["top-left"]=6]="top-left",o[o["top-right"]=7]="top-right",o[o["bottom-left"]=8]="bottom-left",o[o["bottom-right"]=9]="bottom-right",o))(ta||{});var wA=Number.POSITIVE_INFINITY;function kg(r){switch(r){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}m();function je(r,e,t){return e*(8192/(r.tileSize*Math.pow(2,t-r.tileID.overscaledZ)))}var Ul=ne(ye(),1);var Bl=class{constructor(e,t,i,n){e?this.opacity=Math.max(0,Math.min(1,e.opacity+(e.placed?t:-t))):this.opacity=n&&i?1:0,this.placed=i}isHidden(){return this.opacity===0&&!this.placed}},pi=class{constructor(e,t,i,n,o){this.text=new Bl(e?e.text:null,t,i,o),this.icon=new Bl(e?e.icon:null,t,n,o)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}},Ol=class{constructor(e,t,i){this.text=e,this.icon=t,this.skipFade=i}},ih=class{constructor(){this.invProjMatrix=N.create(),this.viewportMatrix=N.create(),this.circles=[]}},nh=class{constructor(e,t,i,n,o){this.bucketInstanceId=e,this.featureIndex=t,this.sourceLayerIndex=i,this.bucketIndex=n,this.tileID=o}},oh=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:i=>i.collisionGroupID===t}}return this.collisionGroups[e]}};function Lg(r,e,t,i,n){let{horizontalAlign:o,verticalAlign:a}=al(r),s=-(o-.5)*e,l=-(a-.5)*t;return new Ul.default(s+i[0]*n,l+i[1]*n)}function rh(r,e,t,i,n,o){let{x1:a,x2:s,y1:l,y2:u,anchorPointX:c,anchorPointY:p}=r,h=new Ul.default(e,t);return i&&h._rotate(n?o:-o),{x1:a+h.x,y1:l+h.y,x2:s+h.x,y2:u+h.y,anchorPointX:c,anchorPointY:p}}var Vl=class{constructor(e,t,i,n,o){this.transform=e.clone(),this.terrain=t,this.collisionIndex=new Fl(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=i,this.retainedQueryData={},this.collisionGroups=new oh(n),this.collisionCircleArrays={},this.prevPlacement=o,o&&(o.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(e,t,i,n){let o=i.getBucket(t),a=i.latestFeatureIndex;if(!o||!a||t.id!==o.layerIds[0])return;let s=i.collisionBoxArray,l=o.layers[0].layout,u=Math.pow(2,this.transform.zoom-i.tileID.overscaledZ),c=i.tileSize/8192,p=this.transform.calculatePosMatrix(i.tileID.toUnwrapped()),h=l.get("text-pitch-alignment")==="map",f=l.get("text-rotation-alignment")==="map",d=je(i,1,this.transform.zoom),y=Yo(p,h,f,this.transform,d),g=null;if(h){let v=Dl(p,h,f,this.transform,d);g=N.multiply([],this.transform.labelPlaneMatrix,v)}this.retainedQueryData[o.bucketInstanceId]=new nh(o.bucketInstanceId,a,o.sourceLayerIndex,o.index,i.tileID);let x={bucket:o,layout:l,posMatrix:p,textLabelPlaneMatrix:y,labelToScreenMatrix:g,scale:u,textPixelRatio:c,holdingForFade:i.holdingForFade(),collisionBoxArray:s,partiallyEvaluatedTextSize:si(o.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(o.sourceID)};if(n)for(let v of o.sortKeyRanges){let{sortKey:b,symbolInstanceStart:w,symbolInstanceEnd:S}=v;e.push({sortKey:b,symbolInstanceStart:w,symbolInstanceEnd:S,parameters:x})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:o.symbolInstances.length,parameters:x})}attemptAnchorPlacement(e,t,i,n,o,a,s,l,u,c,p,h,f,d,y,g){let x=ta[e.textAnchor],v=[e.textOffset0,e.textOffset1],b=Lg(x,i,n,v,o),w=this.collisionIndex.placeCollisionBox(rh(t,b.x,b.y,a,s,this.transform.angle),p,l,u,c.predicate,g);if(!(y&&this.collisionIndex.placeCollisionBox(rh(y,b.x,b.y,a,s,this.transform.angle),p,l,u,c.predicate,g).box.length===0)&&w.box.length>0){let S;if(this.prevPlacement&&this.prevPlacement.variableOffsets[h.crossTileID]&&this.prevPlacement.placements[h.crossTileID]&&this.prevPlacement.placements[h.crossTileID].text&&(S=this.prevPlacement.variableOffsets[h.crossTileID].anchor),h.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[h.crossTileID]={textOffset:v,width:i,height:n,anchor:x,textBoxScale:o,prevAnchor:S},this.markUsedJustification(f,x,h,d),f.allowVerticalPlacement&&(this.markUsedOrientation(f,d,h),this.placedOrientations[h.crossTileID]=d),{shift:b,placedGlyphBoxes:w}}}placeLayerBucketPart(e,t,i){let{bucket:n,layout:o,posMatrix:a,textLabelPlaneMatrix:s,labelToScreenMatrix:l,textPixelRatio:u,holdingForFade:c,collisionBoxArray:p,partiallyEvaluatedTextSize:h,collisionGroup:f}=e.parameters,d=o.get("text-optional"),y=o.get("icon-optional"),g=en(o,"text-overlap","text-allow-overlap"),x=g==="always",v=en(o,"icon-overlap","icon-allow-overlap"),b=v==="always",w=o.get("text-rotation-alignment")==="map",S=o.get("text-pitch-alignment")==="map",P=o.get("icon-text-fit")!=="none",I=o.get("symbol-z-order")==="viewport-y",k=x&&(b||!n.hasIconData()||y),C=b&&(x||!n.hasTextData()||d);!n.collisionArrays&&p&&n.deserializeCollisionBoxes(p);let T=this.retainedQueryData[n.bucketInstanceId].tileID,D=this.terrain?(E,A)=>this.terrain.getElevation(T,E,A):null,F=(E,A)=>{if(t[E.crossTileID])return;if(c){this.placements[E.crossTileID]=new Ol(!1,!1,!1);return}let $=!1,X=!1,j=!0,fe=null,Q={box:null,offscreen:null},nt={box:null,offscreen:null},We=null,le=null,Te=null,Qe=0,cr=0,pr=0;A.textFeatureIndex?Qe=A.textFeatureIndex:E.useRuntimeCollisionCircles&&(Qe=E.featureIndex),A.verticalTextFeatureIndex&&(cr=A.verticalTextFeatureIndex);let Dt=A.textBox;if(Dt){let et=tt=>{let Pt=1;if(n.allowVerticalPlacement&&!tt&&this.prevPlacement){let at=this.prevPlacement.placedOrientations[E.crossTileID];at&&(this.placedOrientations[E.crossTileID]=at,Pt=at,this.markUsedOrientation(n,Pt,E))}return Pt},$e=(tt,Pt)=>{if(n.allowVerticalPlacement&&E.numVerticalGlyphVertices>0&&A.verticalTextBox){for(let at of n.writingModes)if(at===2?(Q=Pt(),nt=Q):Q=tt(),Q&&Q.box&&Q.box.length)break}else Q=tt()},Xe=E.textAnchorOffsetStartIndex,di=E.textAnchorOffsetEndIndex;if(di===Xe){let tt=(Ot,yi)=>{let Ke=this.collisionIndex.placeCollisionBox(Ot,g,u,a,f.predicate,D);return Ke&&Ke.box&&Ke.box.length&&(this.markUsedOrientation(n,yi,E),this.placedOrientations[E.crossTileID]=yi),Ke};$e(()=>tt(Dt,1),()=>{let Ot=A.verticalTextBox;return n.allowVerticalPlacement&&E.numVerticalGlyphVertices>0&&Ot?tt(Ot,2):{box:null,offscreen:null}}),et(Q&&Q.box&&Q.box.length)}else{let tt=ta[this.prevPlacement?.variableOffsets[E.crossTileID]?.anchor],Pt=(Ke,gc,T_)=>{let A_=Ke.x2-Ke.x1,M_=Ke.y2-Ke.y1,I_=E.textBoxScale,C_=P&&v==="never"?gc:null,gi={box:[],offscreen:!1},jh=g==="never"?1:2,Zh="never";tt&&jh++;for(let Hh=0;Hh<jh;Hh++){for(let xc=Xe;xc<di;xc++){let Wh=n.textAnchorOffsets.get(xc);if(tt&&Wh.textAnchor!==tt)continue;let bc=this.attemptAnchorPlacement(Wh,Ke,A_,M_,I_,w,S,u,a,f,Zh,E,n,T_,C_,D);if(bc&&(gi=bc.placedGlyphBoxes,gi&&gi.box&&gi.box.length))return $=!0,fe=bc.shift,gi}tt?tt=null:Zh=g}return gi};$e(()=>Pt(Dt,A.iconBox,1),()=>{let Ke=A.verticalTextBox,gc=Q&&Q.box&&Q.box.length;return n.allowVerticalPlacement&&!gc&&E.numVerticalGlyphVertices>0&&Ke?Pt(Ke,A.verticalIconBox,2):{box:null,offscreen:null}}),Q&&($=Q.box,j=Q.offscreen);let yi=et(Q&&Q.box);if(!$&&this.prevPlacement){let Ke=this.prevPlacement.variableOffsets[E.crossTileID];Ke&&(this.variableOffsets[E.crossTileID]=Ke,this.markUsedJustification(n,Ke.anchor,E,yi))}}}if(We=Q,$=We&&We.box&&We.box.length>0,j=We&&We.offscreen,E.useRuntimeCollisionCircles){let et=n.text.placedSymbolArray.get(E.centerJustifiedTextSymbolIndex),$e=Qi(n.textSizeData,h,et),Xe=o.get("text-padding"),di=E.collisionCircleDiameter;le=this.collisionIndex.placeCollisionCircles(g,et,n.lineVertexArray,n.glyphOffsetArray,$e,a,s,l,i,S,f.predicate,di,Xe,D),le.circles.length&&le.collisionDetected&&!i&&ke("Collisions detected, but collision boxes are not shown"),$=x||le.circles.length>0&&!le.collisionDetected,j=j&&le.offscreen}if(A.iconFeatureIndex&&(pr=A.iconFeatureIndex),A.iconBox){let et=$e=>{let Xe=P&&fe?rh($e,fe.x,fe.y,w,S,this.transform.angle):$e;return this.collisionIndex.placeCollisionBox(Xe,v,u,a,f.predicate,D)};nt&&nt.box&&nt.box.length&&A.verticalIconBox?(Te=et(A.verticalIconBox),X=Te.box.length>0):(Te=et(A.iconBox),X=Te.box.length>0),j=j&&Te.offscreen}let Wt=d||E.numHorizontalGlyphVertices===0&&E.numVerticalGlyphVertices===0,Br=y||E.numIconVertices===0;if(!Wt&&!Br?X=$=X&&$:Br?Wt||(X=X&&$):$=X&&$,$&&We&&We.box&&(nt&&nt.box&&cr?this.collisionIndex.insertCollisionBox(We.box,g,o.get("text-ignore-placement"),n.bucketInstanceId,cr,f.ID):this.collisionIndex.insertCollisionBox(We.box,g,o.get("text-ignore-placement"),n.bucketInstanceId,Qe,f.ID)),X&&Te&&this.collisionIndex.insertCollisionBox(Te.box,v,o.get("icon-ignore-placement"),n.bucketInstanceId,pr,f.ID),le&&($&&this.collisionIndex.insertCollisionCircles(le.circles,g,o.get("text-ignore-placement"),n.bucketInstanceId,Qe,f.ID),i)){let et=n.bucketInstanceId,$e=this.collisionCircleArrays[et];$e===void 0&&($e=this.collisionCircleArrays[et]=new ih);for(let Xe=0;Xe<le.circles.length;Xe+=4)$e.circles.push(le.circles[Xe+0]),$e.circles.push(le.circles[Xe+1]),$e.circles.push(le.circles[Xe+2]),$e.circles.push(le.collisionDetected?1:0)}if(E.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(n.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[E.crossTileID]=new Ol($||k,X||C,j||n.justReloaded),t[E.crossTileID]=!0};if(I){if(e.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");let E=n.getSortedSymbolIndexes(this.transform.angle);for(let A=E.length-1;A>=0;--A){let $=E[A];F(n.symbolInstances.get($),n.collisionArrays[$])}}else for(let E=e.symbolInstanceStart;E<e.symbolInstanceEnd;E++)F(n.symbolInstances.get(E),n.collisionArrays[E]);if(i&&n.bucketInstanceId in this.collisionCircleArrays){let E=this.collisionCircleArrays[n.bucketInstanceId];N.invert(E.invProjMatrix,a),E.viewportMatrix=this.collisionIndex.getViewportMatrix()}n.justReloaded=!1}markUsedJustification(e,t,i,n){let o={left:i.leftJustifiedTextSymbolIndex,center:i.centerJustifiedTextSymbolIndex,right:i.rightJustifiedTextSymbolIndex},a;n===2?a=i.verticalPlacedTextSymbolIndex:a=o[kg(t)];let s=[i.leftJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.rightJustifiedTextSymbolIndex,i.verticalPlacedTextSymbolIndex];for(let l of s)l>=0&&(a>=0&&l!==a?e.text.placedSymbolArray.get(l).crossTileID=0:e.text.placedSymbolArray.get(l).crossTileID=i.crossTileID)}markUsedOrientation(e,t,i){let n=t===1||t===3?t:0,o=t===2?t:0,a=[i.leftJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.rightJustifiedTextSymbolIndex];for(let s of a)e.text.placedSymbolArray.get(s).placedOrientation=n;i.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(i.verticalPlacedTextSymbolIndex).placedOrientation=o)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;let t=this.prevPlacement,i=!1;this.prevZoomAdjustment=t?t.zoomAdjustment(this.transform.zoom):0;let n=t?t.symbolFadeChange(e):1,o=t?t.opacities:{},a=t?t.variableOffsets:{},s=t?t.placedOrientations:{};for(let l in this.placements){let u=this.placements[l],c=o[l];c?(this.opacities[l]=new pi(c,n,u.text,u.icon),i=i||u.text!==c.text.placed||u.icon!==c.icon.placed):(this.opacities[l]=new pi(null,n,u.text,u.icon,u.skipFade),i=i||u.text||u.icon)}for(let l in o){let u=o[l];if(!this.opacities[l]){let c=new pi(u,n,!1,!1);c.isHidden()||(this.opacities[l]=c,i=i||u.text.placed||u.icon.placed)}}for(let l in a)!this.variableOffsets[l]&&this.opacities[l]&&!this.opacities[l].isHidden()&&(this.variableOffsets[l]=a[l]);for(let l in s)!this.placedOrientations[l]&&this.opacities[l]&&!this.opacities[l].isHidden()&&(this.placedOrientations[l]=s[l]);if(t&&t.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");i?this.lastPlacementChangeTime=e:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e)}updateLayerOpacities(e,t){let i={};for(let n of t){let o=n.getBucket(e);o&&n.latestFeatureIndex&&e.id===o.layerIds[0]&&this.updateBucketOpacities(o,i,n.collisionBoxArray)}}updateBucketOpacities(e,t,i){e.hasTextData()&&(e.text.opacityVertexArray.clear(),e.text.hasVisibleVertices=!1),e.hasIconData()&&(e.icon.opacityVertexArray.clear(),e.icon.hasVisibleVertices=!1),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();let n=e.layers[0],o=n.layout,a=new pi(null,0,!1,!1,!0),s=o.get("text-allow-overlap"),l=o.get("icon-allow-overlap"),u=n._unevaluatedLayout.hasValue("text-variable-anchor")||n._unevaluatedLayout.hasValue("text-variable-anchor-offset"),c=o.get("text-rotation-alignment")==="map",p=o.get("text-pitch-alignment")==="map",h=o.get("icon-text-fit")!=="none",f=new pi(null,0,s&&(l||!e.hasIconData()||o.get("icon-optional")),l&&(s||!e.hasTextData()||o.get("text-optional")),!0);!e.collisionArrays&&i&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(i);let d=(y,g,x)=>{for(let v=0;v<g/4;v++)y.opacityVertexArray.emplaceBack(x);y.hasVisibleVertices=y.hasVisibleVertices||x!==ra};for(let y=0;y<e.symbolInstances.length;y++){let g=e.symbolInstances.get(y),{numHorizontalGlyphVertices:x,numVerticalGlyphVertices:v,crossTileID:b}=g,w=t[b],S=this.opacities[b];w?S=a:S||(S=f,this.opacities[b]=S),t[b]=!0;let P=x>0||v>0,I=g.numIconVertices>0,k=this.placedOrientations[g.crossTileID],C=k===2,T=k===1||k===3;if(P){let D=Dg(S.text),F=C?ra:D;d(e.text,x,F);let E=T?ra:D;d(e.text,v,E);let A=S.text.isHidden();[g.rightJustifiedTextSymbolIndex,g.centerJustifiedTextSymbolIndex,g.leftJustifiedTextSymbolIndex].forEach(j=>{j>=0&&(e.text.placedSymbolArray.get(j).hidden=A||C?1:0)}),g.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(g.verticalPlacedTextSymbolIndex).hidden=A||T?1:0);let $=this.variableOffsets[g.crossTileID];$&&this.markUsedJustification(e,$.anchor,g,k);let X=this.placedOrientations[g.crossTileID];X&&(this.markUsedJustification(e,"left",g,X),this.markUsedOrientation(e,X,g))}if(I){let D=Dg(S.icon),F=!(h&&g.verticalPlacedIconSymbolIndex&&C);if(g.placedIconSymbolIndex>=0){let E=F?D:ra;d(e.icon,g.numIconVertices,E),e.icon.placedSymbolArray.get(g.placedIconSymbolIndex).hidden=S.icon.isHidden()}if(g.verticalPlacedIconSymbolIndex>=0){let E=F?ra:D;d(e.icon,g.numVerticalIconVertices,E),e.icon.placedSymbolArray.get(g.verticalPlacedIconSymbolIndex).hidden=S.icon.isHidden()}}if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){let D=e.collisionArrays[y];if(D){let F=new Ul.default(0,0);if(D.textBox||D.verticalTextBox){let A=!0;if(u){let $=this.variableOffsets[b];$?(F=Lg($.anchor,$.width,$.height,$.textOffset,$.textBoxScale),c&&F._rotate(p?this.transform.angle:-this.transform.angle)):A=!1}D.textBox&&Rl(e.textCollisionBox.collisionVertexArray,S.text.placed,!A||C,F.x,F.y),D.verticalTextBox&&Rl(e.textCollisionBox.collisionVertexArray,S.text.placed,!A||T,F.x,F.y)}let E=!!(!T&&D.verticalIconBox);D.iconBox&&Rl(e.iconCollisionBox.collisionVertexArray,S.icon.placed,E,h?F.x:0,h?F.y:0),D.verticalIconBox&&Rl(e.iconCollisionBox.collisionVertexArray,S.icon.placed,!E,h?F.x:0,h?F.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 (= ${e.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${e.text.layoutVertexArray.length}) / 4`);if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${e.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${e.icon.layoutVertexArray.length}) / 4`);if(e.bucketInstanceId in this.collisionCircleArrays){let y=this.collisionCircleArrays[e.bucketInstanceId];e.placementInvProjMatrix=y.invProjMatrix,e.placementViewportMatrix=y.viewportMatrix,e.collisionCircleArray=y.circles,delete this.collisionCircleArrays[e.bucketInstanceId]}}symbolFadeChange(e){return this.fadeDuration===0?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,t){let i=this.zoomAtLastRecencyCheck===t?1-this.zoomAdjustment(t):1;return this.zoomAtLastRecencyCheck=t,this.commitTime+this.fadeDuration*i>e}setStale(){this.stale=!0}};function Rl(r,e,t,i,n){r.emplaceBack(e?1:0,t?1:0,i||0,n||0),r.emplaceBack(e?1:0,t?1:0,i||0,n||0),r.emplaceBack(e?1:0,t?1:0,i||0,n||0),r.emplaceBack(e?1:0,t?1:0,i||0,n||0)}var PA=Math.pow(2,25),TA=Math.pow(2,24),AA=Math.pow(2,17),MA=Math.pow(2,16),IA=Math.pow(2,9),CA=Math.pow(2,8),EA=Math.pow(2,1);function Dg(r){if(r.opacity===0&&!r.placed)return 0;if(r.opacity===1&&r.placed)return 4294967295;let e=r.placed?1:0,t=Math.floor(r.opacity*127);return t*PA+e*TA+t*AA+e*MA+t*IA+e*CA+t*EA+e}var ra=0;var ah=class{constructor(e){this._sortAcrossTiles=e.layout.get("symbol-z-order")!=="viewport-y"&&!e.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,t,i,n,o){let a=this._bucketParts;for(;this._currentTileIndex<e.length;){let s=e[this._currentTileIndex];if(t.getBucketParts(a,n,s,this._sortAcrossTiles),this._currentTileIndex++,o())return!0}for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,a.sort((s,l)=>s.sortKey-l.sortKey));this._currentPartIndex<a.length;){let s=a[this._currentPartIndex];if(t.placeLayerBucketPart(s,this._seenCrossTileIDs,i),this._currentPartIndex++,o())return!0}return!1}},Nl=class{constructor(e,t,i,n,o,a,s,l){this.placement=new Vl(e,t,a,s,l),this._currentPlacementIndex=i.length-1,this._forceFullPlacement=n,this._showCollisionBoxes=o,this._done=!1}isDone(){return this._done}continuePlacement(e,t,i){let n=K.now(),o=()=>this._forceFullPlacement?!1:K.now()-n>2;for(;this._currentPlacementIndex>=0;){let a=e[this._currentPlacementIndex],s=t[a],l=this.placement.collisionIndex.transform.zoom;if(s.type==="symbol"&&(!s.minzoom||s.minzoom<=l)&&(!s.maxzoom||s.maxzoom>l)){if(this._inProgressLayer||(this._inProgressLayer=new ah(s)),this._inProgressLayer.continuePlacement(i[s.source],this.placement,this._showCollisionBoxes,s,o))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}};m();m();var zg=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],sh=1,ia=8,oa=class r{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");let[t,i]=new Uint8Array(e,0,2);if(t!==219)throw new Error("Data does not appear to be in a KDBush format.");let n=i>>4;if(n!==sh)throw new Error(`Got v${n} data when expected v${sh}.`);let o=zg[i&15];if(!o)throw new Error("Unrecognized array type.");let[a]=new Uint16Array(e,2,1),[s]=new Uint32Array(e,4,1);return new r(s,a,o,e)}constructor(e,t=64,i=Float64Array,n){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=i,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;let o=zg.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: ${i}.`);n&&n instanceof ArrayBuffer?(this.data=n,this.ids=new this.IndexArrayType(this.data,ia,e),this.coords=new this.ArrayType(this.data,ia+s+l,e*2),this._pos=e*2,this._finished=!0):(this.data=new ArrayBuffer(ia+a+s+l),this.ids=new this.IndexArrayType(this.data,ia,e),this.coords=new this.ArrayType(this.data,ia+s+l,e*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,(sh<<4)+o]),new Uint16Array(this.data,2,1)[0]=t,new Uint32Array(this.data,4,1)[0]=e)}add(e,t){let i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=e,this.coords[this._pos++]=t,i}finish(){let e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return uh(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,i,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:o,coords:a,nodeSize:s}=this,l=[0,o.length-1,0],u=[];for(;l.length;){let c=l.pop()||0,p=l.pop()||0,h=l.pop()||0;if(p-h<=s){for(let g=h;g<=p;g++){let x=a[2*g],v=a[2*g+1];x>=e&&x<=i&&v>=t&&v<=n&&u.push(o[g])}continue}let f=h+p>>1,d=a[2*f],y=a[2*f+1];d>=e&&d<=i&&y>=t&&y<=n&&u.push(o[f]),(c===0?e<=d:t<=y)&&(l.push(h),l.push(f-1),l.push(1-c)),(c===0?i>=d:n>=y)&&(l.push(f+1),l.push(p),l.push(1-c))}return u}within(e,t,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:n,coords:o,nodeSize:a}=this,s=[0,n.length-1,0],l=[],u=i*i;for(;s.length;){let c=s.pop()||0,p=s.pop()||0,h=s.pop()||0;if(p-h<=a){for(let g=h;g<=p;g++)Fg(o[2*g],o[2*g+1],e,t)<=u&&l.push(n[g]);continue}let f=h+p>>1,d=o[2*f],y=o[2*f+1];Fg(d,y,e,t)<=u&&l.push(n[f]),(c===0?e-i<=d:t-i<=y)&&(s.push(h),s.push(f-1),s.push(1-c)),(c===0?e+i>=d:t+i>=y)&&(s.push(f+1),s.push(p),s.push(1-c))}return l}};function uh(r,e,t,i,n,o){if(n-i<=t)return;let a=i+n>>1;Rg(r,e,a,i,n,o),uh(r,e,t,i,a-1,1-o),uh(r,e,t,a+1,n,1-o)}function Rg(r,e,t,i,n,o){for(;n>i;){if(n-i>600){let u=n-i+1,c=t-i+1,p=Math.log(u),h=.5*Math.exp(2*p/3),f=.5*Math.sqrt(p*h*(u-h)/u)*(c-u/2<0?-1:1),d=Math.max(i,Math.floor(t-c*h/u+f)),y=Math.min(n,Math.floor(t+(u-c)*h/u+f));Rg(r,e,t,d,y,o)}let a=e[2*t+o],s=i,l=n;for(na(r,e,i,t),e[2*n+o]>a&&na(r,e,i,n);s<l;){for(na(r,e,s,l),s++,l--;e[2*s+o]<a;)s++;for(;e[2*l+o]>a;)l--}e[2*i+o]===a?na(r,e,i,l):(l++,na(r,e,l,n)),l<=t&&(i=l+1),t<=l&&(n=l-1)}}function na(r,e,t,i){lh(r,t,i),lh(e,2*t,2*i),lh(e,2*t+1,2*i+1)}function lh(r,e,t){let i=r[e];r[e]=r[t],r[t]=i}function Fg(r,e,t,i){let n=r-t,o=e-i;return n*n+o*o}var aa=512/8192/2,kA=128,ch=class{constructor(e,t,i){this.tileID=e;this.bucketInstanceId=i;this._symbolsByKey={};let n=new Map;for(let o=0;o<t.length;o++){let a=t.get(o),s=a.key,l=n.get(s);l?l.push(a):n.set(s,[a])}for(let[o,a]of n){let s=a.map(c=>({x:Math.floor(c.anchorX*aa),y:Math.floor(c.anchorY*aa)})),l=a.map(c=>c.crossTileID),u={positions:s,crossTileIDs:l};if(u.positions.length>kA){let c=new oa(u.positions.length,16,Uint16Array);for(let{x:p,y:h}of u.positions)c.add(p,h);c.finish(),delete u.positions,u.index=c}this._symbolsByKey[o]=u}}getScaledCoordinates(e,t){let{x:i,y:n,z:o}=this.tileID.canonical,{x:a,y:s,z:l}=t.canonical,u=l-o,c=aa/Math.pow(2,u),p=(a*8192+e.anchorX)*c,h=(s*8192+e.anchorY)*c,f=i*8192*aa,d=n*8192*aa;return{x:Math.floor(p-f),y:Math.floor(h-d)}}findMatches(e,t,i){let n=this.tileID.canonical.z<t.canonical.z?1:Math.pow(2,this.tileID.canonical.z-t.canonical.z);for(let o=0;o<e.length;o++){let a=e.get(o);if(a.crossTileID)continue;let s=this._symbolsByKey[a.key];if(!s)continue;let l=this.getScaledCoordinates(a,t);if(s.index){let u=s.index.range(l.x-n,l.y-n,l.x+n,l.y+n).sort();for(let c of u){let p=s.crossTileIDs[c];if(!i[p]){i[p]=!0,a.crossTileID=p;break}}}else if(s.positions)for(let u=0;u<s.positions.length;u++){let c=s.positions[u],p=s.crossTileIDs[u];if(Math.abs(c.x-l.x)<=n&&Math.abs(c.y-l.y)<=n&&!i[p]){i[p]=!0,a.crossTileID=p;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:e})=>e)}},ph=class{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}},hh=class{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){let t=Math.round((e-this.lng)/360);if(t!==0)for(let i in this.indexes){let n=this.indexes[i],o={};for(let a in n){let s=n[a];s.tileID=s.tileID.unwrapTo(s.tileID.wrap+t),o[s.tileID.key]=s}this.indexes[i]=o}this.lng=e}addBucket(e,t,i){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===t.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let o=0;o<t.symbolInstances.length;o++){let a=t.symbolInstances.get(o);a.crossTileID=0}this.usedCrossTileIDs[e.overscaledZ]||(this.usedCrossTileIDs[e.overscaledZ]={});let n=this.usedCrossTileIDs[e.overscaledZ];for(let o in this.indexes){let a=this.indexes[o];if(Number(o)>e.overscaledZ)for(let s in a){let l=a[s];l.tileID.isChildOf(e)&&l.findMatches(t.symbolInstances,e,n)}else{let s=e.scaledTo(Number(o)),l=a[s.key];l&&l.findMatches(t.symbolInstances,e,n)}}for(let o=0;o<t.symbolInstances.length;o++){let a=t.symbolInstances.get(o);a.crossTileID||(a.crossTileID=i.generate(),n[a.crossTileID]=!0)}return this.indexes[e.overscaledZ]===void 0&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new ch(e,t.symbolInstances,t.bucketInstanceId),!0}removeBucketCrossTileIDs(e,t){for(let i of t.getCrossTileIDsLists())for(let n of i)delete this.usedCrossTileIDs[e][n]}removeStaleBuckets(e){let t=!1;for(let i in this.indexes){let n=this.indexes[i];for(let o in n)e[n[o].bucketInstanceId]||(this.removeBucketCrossTileIDs(i,n[o]),delete n[o],t=!0)}return t}},cn=class{constructor(){this.layerIndexes={},this.crossTileIDs=new ph,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,t,i){let n=this.layerIndexes[e.id];n===void 0&&(n=this.layerIndexes[e.id]=new hh);let o=!1,a={};n.handleWrapJump(i);for(let s of t){let l=s.getBucket(e);!l||e.id!==l.layerIds[0]||(l.bucketInstanceId||(l.bucketInstanceId=++this.maxBucketInstanceId),n.addBucket(s.tileID,l,this.crossTileIDs)&&(o=!0),a[l.bucketInstanceId]=!0)}return n.removeStaleBuckets(a)&&(o=!0),o}pruneUnusedLayers(e){let t={};e.forEach(i=>{t[i]=!0});for(let i in this.layerIndexes)t[i]||delete this.layerIndexes[i]}};var Gl=(r,e)=>Di(r,e&&e.filter(t=>t.identifier!=="source.canvas")),LA=gm(),pn=class extends me{constructor(t,i={}){super();this._rtlPluginLoaded=()=>{for(let t in this.sourceCaches){let i=this.sourceCaches[t].getSource().type;(i==="vector"||i==="geojson")&&this.sourceCaches[t].reload()}};this.map=t,this.dispatcher=new Go(No(),t._getMapId()),this.dispatcher.registerMessageHandler("GG",(n,o)=>this.getGlyphs(n,o)),this.dispatcher.registerMessageHandler("GI",(n,o)=>this.getImages(n,o)),this.imageManager=new yl,this.imageManager.setEventedParent(this),this.glyphManager=new gl(t._requestManager,i.localIdeographFontFamily),this.lineAtlas=new bl(256,512),this.crossTileSymbolIndex=new cn,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new Ri,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",Na()),zr().on(Ko,this._rtlPluginLoaded),this.on("data",n=>{if(n.dataType!=="source"||n.sourceDataType!=="metadata")return;let o=this.sourceCaches[n.sourceId];if(!o)return;let a=o.getSource();if(!(!a||!a.vectorLayerIds))for(let s in this._layers){let l=this._layers[s];l.source===a.id&&this._validateLayer(l)}})}loadURL(t,i={},n){this.fire(new z("dataloading",{dataType:"style"})),i.validate=typeof i.validate=="boolean"?i.validate:!0;let o=this.map._requestManager.transformRequest(t,"Style");this._loadStyleRequest=new AbortController,fr(o,this._loadStyleRequest).then(a=>{this._loadStyleRequest=null,this._load(a.data,i,n)}).catch(a=>{this._loadStyleRequest=null,a&&this.fire(new Z(a))})}loadJSON(t,i={},n){this.fire(new z("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,K.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,i.validate=i.validate!==!1,this._load(t,i,n)}).catch(()=>{})}loadEmpty(){this.fire(new z("dataloading",{dataType:"style"})),this._load(LA,{validate:!1})}_load(t,i,n){let o=i.transformStyle?i.transformStyle(n,t):t;if(!(i.validate&&Gl(this,Ve(o)))){this._loaded=!0,this.stylesheet=o;for(let a in o.sources)this.addSource(a,o.sources[a],{validate:!1});o.sprite?this._loadSprite(o.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(o.glyphs),this._createLayers(),this.light=new xl(this.stylesheet.light),this.map.setTerrain(this.stylesheet.terrain??null),this.fire(new z("data",{dataType:"style"})),this.fire(new z("style.load"))}}_createLayers(){let t=Qc(this.stylesheet.layers);this.dispatcher.broadcast("SL",t),this._order=t.map(i=>i.id),this._layers={},this._serializedLayers=null;for(let i of t){let n=ml(i);n.setEventedParent(this,{layer:{id:i.id}}),this._layers[i.id]=n}}_loadSprite(t,i=!1,n=void 0){this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController;let o;Yy(t,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(a=>{if(this._spriteRequest=null,a)for(let s in a){this._spritesImagesIds[s]=[];let l=this._spritesImagesIds[s]?this._spritesImagesIds[s].filter(u=>!(u in a)):[];for(let u of l)this.imageManager.removeImage(u),this._changedImages[u]=!0;for(let u in a[s]){let c=s==="default"?u:`${s}:${u}`;this._spritesImagesIds[s].push(c),c in this.imageManager.images?this.imageManager.updateImage(c,a[s][u],!1):this.imageManager.addImage(c,a[s][u]),i&&(this._changedImages[c]=!0)}}}).catch(a=>{this._spriteRequest=null,o=a,this.fire(new Z(o))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),i&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new z("data",{dataType:"style"})),n&&n(o)})}_unloadSprite(){for(let t of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(t),this._changedImages[t]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new z("data",{dataType:"style"}))}_validateLayer(t){let i=this.sourceCaches[t.source];if(!i)return;let n=t.sourceLayer;if(!n)return;let o=i.getSource();(o.type==="geojson"||o.vectorLayerIds&&o.vectorLayerIds.indexOf(n)===-1)&&this.fire(new Z(new Error(`Source layer "${n}" does not exist on source "${o.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(t){let i=this._serializedAllLayers();if(!t||t.length===0)return Object.values(i);let n=[];for(let o of t)i[o]&&n.push(i[o]);return n}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};let i=Object.keys(this._layers);for(let n of i){let o=this._layers[n];o.type!=="custom"&&(t[n]=o.serialize())}return t}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(let t in this.sourceCaches)if(this.sourceCaches[t].hasTransition())return!0;for(let t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(t){if(!this._loaded)return;let i=this._changed;if(i){let o=Object.keys(this._updatedLayers),a=Object.keys(this._removedLayers);(o.length||a.length)&&this._updateWorkerLayers(o,a);for(let s in this._updatedSources){let l=this._updatedSources[s];if(l==="reload")this._reloadSource(s);else if(l==="clear")this._clearSource(s);else throw new Error(`Invalid action ${l}`)}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(let s in this._updatedPaintProps)this._layers[s].updateTransitions(t);this.light.updateTransitions(t),this._resetUpdates()}let n={};for(let o in this.sourceCaches){let a=this.sourceCaches[o];n[o]=a.used,a.used=!1}for(let o of this._order){let a=this._layers[o];a.recalculate(t,this._availableImages),!a.isHidden(t.zoom)&&a.source&&(this.sourceCaches[a.source].used=!0)}for(let o in n){let a=this.sourceCaches[o];!!n[o]!=!!a.used&&a.fire(new z("data",{sourceDataType:"visibility",dataType:"source",sourceId:o}))}this.light.recalculate(t),this.z=t.zoom,i&&this.fire(new z("data",{dataType:"style"}))}_updateTilesForChangedImages(){let t=Object.keys(this._changedImages);if(t.length){for(let i in this.sourceCaches)this.sourceCaches[i].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(let t in this.sourceCaches)this.sourceCaches[t].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(t,i){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(t),removedIds:i})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(t,i={}){this._checkLoaded();let n=this.serialize();if(t=i.transformStyle?i.transformStyle(n,t):t,(i.validate??!0)&&Gl(this,Ve(t)))return!1;t=ct(t),t.layers=Qc(t.layers);let a=Xf(n,t),s=this._getOperationsToPerform(a);if(s.unimplemented.length>0)throw new Error(`Unimplemented: ${s.unimplemented.join(", ")}.`);if(s.operations.length===0)return!1;for(let l of s.operations)l();return this.stylesheet=t,this._serializedLayers=null,!0}_getOperationsToPerform(t){let i=[],n=[];for(let o of t)switch(o.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":i.push(()=>this.addLayer.apply(this,o.args));break;case"removeLayer":i.push(()=>this.removeLayer.apply(this,o.args));break;case"setPaintProperty":i.push(()=>this.setPaintProperty.apply(this,o.args));break;case"setLayoutProperty":i.push(()=>this.setLayoutProperty.apply(this,o.args));break;case"setFilter":i.push(()=>this.setFilter.apply(this,o.args));break;case"addSource":i.push(()=>this.addSource.apply(this,o.args));break;case"removeSource":i.push(()=>this.removeSource.apply(this,o.args));break;case"setLayerZoomRange":i.push(()=>this.setLayerZoomRange.apply(this,o.args));break;case"setLight":i.push(()=>this.setLight.apply(this,o.args));break;case"setGeoJSONSourceData":i.push(()=>this.setGeoJSONSourceData.apply(this,o.args));break;case"setGlyphs":i.push(()=>this.setGlyphs.apply(this,o.args));break;case"setSprite":i.push(()=>this.setSprite.apply(this,o.args));break;case"setTerrain":i.push(()=>this.map.setTerrain.apply(this,o.args));break;case"setTransition":i.push(()=>{});break;default:n.push(o.command);break}return{operations:i,unimplemented:n}}addImage(t,i){if(this.getImage(t))return this.fire(new Z(new Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,i),this._afterImageUpdated(t)}updateImage(t,i){this.imageManager.updateImage(t,i)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new Z(new Error(`An image named "${t}" does not exist.`)));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new z("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,i,n={}){if(this._checkLoaded(),this.sourceCaches[t]!==void 0)throw new Error(`Source "${t}" already exists.`);if(!i.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(i).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(i.type)>=0&&this._validate(Ve.source,`sources.${t}`,i,null,n))return;this.map&&this.map._collectResourceTiming&&(i.collectResourceTiming=!0);let s=this.sourceCaches[t]=new ar(t,i,this.dispatcher);s.style=this,s.setEventedParent(this,()=>({isSourceLoaded:s.loaded(),source:s.serialize(),sourceId:t})),s.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error("There is no source with this ID");for(let n in this._layers)if(this._layers[n].source===t)return this.fire(new Z(new Error(`Source "${t}" cannot be removed while layer "${n}" is using it.`)));let i=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],i.fire(new z("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),i.setEventedParent(null),i.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,i){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error(`There is no source with this ID=${t}`);let n=this.sourceCaches[t].getSource();if(n.type!=="geojson")throw new Error(`geojsonSource.type is ${n.type}, which is !== 'geojson`);n.setData(i),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(t,i,n={}){this._checkLoaded();let o=t.id;if(this.getLayer(o)){this.fire(new Z(new Error(`Layer "${o}" already exists on this map.`)));return}let a;if(t.type==="custom"){if(Gl(this,Jy(t)))return;a=ml(t)}else{if("source"in t&&typeof t.source=="object"&&(this.addSource(o,t.source),t=ct(t),t=O(t,{source:o})),this._validate(Ve.layer,`layers.${o}`,t,{arrayIndex:-1},n))return;a=ml(t),this._validateLayer(a),a.setEventedParent(this,{layer:{id:o}})}let s=i?this._order.indexOf(i):this._order.length;if(i&&s===-1){this.fire(new Z(new Error(`Cannot add layer "${o}" before non-existing layer "${i}".`)));return}if(this._order.splice(s,0,o),this._layerOrderChanged=!0,this._layers[o]=a,this._removedLayers[o]&&a.source&&a.type!=="custom"){let l=this._removedLayers[o];delete this._removedLayers[o],l.type!==a.type?this._updatedSources[a.source]="clear":(this._updatedSources[a.source]="reload",this.sourceCaches[a.source].pause())}this._updateLayer(a),a.onAdd&&a.onAdd(this.map)}moveLayer(t,i){if(this._checkLoaded(),this._changed=!0,!this._layers[t]){this.fire(new Z(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));return}if(t===i)return;let o=this._order.indexOf(t);this._order.splice(o,1);let a=i?this._order.indexOf(i):this._order.length;if(i&&a===-1){this.fire(new Z(new Error(`Cannot move layer "${t}" before non-existing layer "${i}".`)));return}this._order.splice(a,0,t),this._layerOrderChanged=!0}removeLayer(t){this._checkLoaded();let i=this._layers[t];if(!i){this.fire(new Z(new Error(`Cannot remove non-existing layer "${t}".`)));return}i.setEventedParent(null);let n=this._order.indexOf(t);this._order.splice(n,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=i,delete this._layers[t],this._serializedLayers&&delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],i.onRemove&&i.onRemove(this.map)}getLayer(t){return this._layers[t]}getLayersOrder(){return[...this._order]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,i,n){this._checkLoaded();let o=this.getLayer(t);if(!o){this.fire(new Z(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)));return}o.minzoom===i&&o.maxzoom===n||(i!=null&&(o.minzoom=i),n!=null&&(o.maxzoom=n),this._updateLayer(o))}setFilter(t,i,n={}){this._checkLoaded();let o=this.getLayer(t);if(!o){this.fire(new Z(new Error(`Cannot filter non-existing layer "${t}".`)));return}if(!Xt(o.filter,i)){if(i==null){o.filter=void 0,this._updateLayer(o);return}this._validate(Ve.filter,`layers.${o.id}.filter`,i,null,n)||(o.filter=ct(i),this._updateLayer(o))}}getFilter(t){return ct(this.getLayer(t).filter)}setLayoutProperty(t,i,n,o={}){this._checkLoaded();let a=this.getLayer(t);if(!a){this.fire(new Z(new Error(`Cannot style non-existing layer "${t}".`)));return}Xt(a.getLayoutProperty(i),n)||(a.setLayoutProperty(i,n,o),this._updateLayer(a))}getLayoutProperty(t,i){let n=this.getLayer(t);if(!n){this.fire(new Z(new Error(`Cannot get style of non-existing layer "${t}".`)));return}return n.getLayoutProperty(i)}setPaintProperty(t,i,n,o={}){this._checkLoaded();let a=this.getLayer(t);if(!a){this.fire(new Z(new Error(`Cannot style non-existing layer "${t}".`)));return}if(Xt(a.getPaintProperty(i),n))return;a.setPaintProperty(i,n,o)&&this._updateLayer(a),this._changed=!0,this._updatedPaintProps[t]=!0,this._serializedLayers=null}getPaintProperty(t,i){return this.getLayer(t).getPaintProperty(i)}setFeatureState(t,i){this._checkLoaded();let n=t.source,o=t.sourceLayer,a=this.sourceCaches[n];if(a===void 0){this.fire(new Z(new Error(`The source '${n}' does not exist in the map's style.`)));return}let s=a.getSource().type;if(s==="geojson"&&o){this.fire(new Z(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));return}if(s==="vector"&&!o){this.fire(new Z(new Error("The sourceLayer parameter must be provided for vector source types.")));return}t.id===void 0&&this.fire(new Z(new Error("The feature id parameter must be provided."))),a.setFeatureState(o,t.id,i)}removeFeatureState(t,i){this._checkLoaded();let n=t.source,o=this.sourceCaches[n];if(o===void 0){this.fire(new Z(new Error(`The source '${n}' does not exist in the map's style.`)));return}let a=o.getSource().type,s=a==="vector"?t.sourceLayer:void 0;if(a==="vector"&&!s){this.fire(new Z(new Error("The sourceLayer parameter must be provided for vector source types.")));return}if(i&&typeof t.id!="string"&&typeof t.id!="number"){this.fire(new Z(new Error("A feature id is required to remove its specific state property.")));return}o.removeFeatureState(s,t.id,i)}getFeatureState(t){this._checkLoaded();let i=t.source,n=t.sourceLayer,o=this.sourceCaches[i];if(o===void 0){this.fire(new Z(new Error(`The source '${i}' does not exist in the map's style.`)));return}if(o.getSource().type==="vector"&&!n){this.fire(new Z(new Error("The sourceLayer parameter must be provided for vector source types.")));return}return t.id===void 0&&this.fire(new Z(new Error("The feature id parameter must be provided."))),o.getFeatureState(n,t.id)}getTransition(){return O({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;let t=bn(this.sourceCaches,a=>a.serialize()),i=this._serializeByIds(this._order),n=this.map.getTerrain()||void 0,o=this.stylesheet;return Ba({version:o.version,name:o.name,metadata:o.metadata,light:o.light,center:o.center,zoom:o.zoom,bearing:o.bearing,pitch:o.pitch,sprite:o.sprite,glyphs:o.glyphs,transition:o.transition,sources:t,layers:i,terrain:n},a=>a!==void 0)}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&this.sourceCaches[t.source].getSource().type!=="raster"&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(t){let i=s=>this._layers[s].type==="fill-extrusion",n={},o=[];for(let s=this._order.length-1;s>=0;s--){let l=this._order[s];if(i(l)){n[l]=s;for(let u of t){let c=u[l];if(c)for(let p of c)o.push(p)}}}o.sort((s,l)=>l.intersectionZ-s.intersectionZ);let a=[];for(let s=this._order.length-1;s>=0;s--){let l=this._order[s];if(i(l))for(let u=o.length-1;u>=0;u--){let c=o[u].feature;if(n[c.layer.id]<s)break;a.push(c),o.pop()}else for(let u of t){let c=u[l];if(c)for(let p of c)a.push(p.feature)}}return a}queryRenderedFeatures(t,i,n){i&&i.filter&&this._validate(Ve.filter,"queryRenderedFeatures.filter",i.filter,null,i);let o={};if(i&&i.layers){if(!Array.isArray(i.layers))return this.fire(new Z(new Error("parameters.layers must be an Array."))),[];for(let l of i.layers){let u=this._layers[l];if(!u)return this.fire(new Z(new Error(`The layer '${l}' does not exist in the map's style and cannot be queried for features.`))),[];o[u.source]=!0}}let a=[];i.availableImages=this._availableImages;let s=this._serializedAllLayers();for(let l in this.sourceCaches)i.layers&&!o[l]||a.push(ag(this.sourceCaches[l],this._layers,s,t,i,n));return this.placement&&a.push(sg(this._layers,s,this.sourceCaches,t,i,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(a)}querySourceFeatures(t,i){i&&i.filter&&this._validate(Ve.filter,"querySourceFeatures.filter",i.filter,null,i);let n=this.sourceCaches[t];return n?lg(n,i):[]}getLight(){return this.light.getLight()}setLight(t,i={}){this._checkLoaded();let n=this.light.getLight(),o=!1;for(let s in t)if(!Xt(t[s],n[s])){o=!0;break}if(!o)return;let a={now:K.now(),transition:O({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,i),this.light.updateTransitions(a)}_validate(t,i,n,o,a={}){return a&&a.validate===!1?!1:Gl(this,t.call(Ve,O({key:i,style:this.serialize(),value:n,styleSpec:M},o)))}_remove(t=!0){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),zr().off(Ko,this._rtlPluginLoaded);for(let i in this._layers)this._layers[i].setEventedParent(null);for(let i in this.sourceCaches){let n=this.sourceCaches[i];n.setEventedParent(null),n.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),t&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(t)}_clearSource(t){this.sourceCaches[t].clearTiles()}_reloadSource(t){this.sourceCaches[t].resume(),this.sourceCaches[t].reload()}_updateSources(t){for(let i in this.sourceCaches)this.sourceCaches[i].update(t,this.map.terrain)}_generateCollisionBoxes(){for(let t in this.sourceCaches)this._reloadSource(t)}_updatePlacement(t,i,n,o,a=!1){let s=!1,l=!1,u={};for(let p of this._order){let h=this._layers[p];if(h.type!=="symbol")continue;if(!u[h.source]){let d=this.sourceCaches[h.source];u[h.source]=d.getRenderableIds(!0).map(y=>d.getTileByID(y)).sort((y,g)=>g.tileID.overscaledZ-y.tileID.overscaledZ||(y.tileID.isLessThan(g.tileID)?-1:1))}let f=this.crossTileSymbolIndex.addLayer(h,u[h.source],t.center.lng);s=s||f}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),a=a||this._layerOrderChanged||n===0,(a||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(K.now(),t.zoom))&&(this.pauseablePlacement=new Nl(t,this.map.terrain,this._order,a,i,n,o,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,u),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(K.now()),l=!0),s&&this.pauseablePlacement.placement.setStale()),l||s)for(let p of this._order){let h=this._layers[p];h.type==="symbol"&&this.placement.updateLayerOpacities(h,u[h.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(K.now())}_releaseSymbolFadeTiles(){for(let t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}async getImages(t,i){let n=await this.imageManager.getImages(i.icons);this._updateTilesForChangedImages();let o=this.sourceCaches[i.source];return o&&o.setDependencies(i.tileID.key,i.type,i.icons),n}async getGlyphs(t,i){let n=await this.glyphManager.getGlyphs(i.stacks),o=this.sourceCaches[i.source];return o&&o.setDependencies(i.tileID.key,i.type,[""]),n}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,i={}){this._checkLoaded(),!(t&&this._validate(Ve.glyphs,"glyphs",t,null,i))&&(this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}addSprite(t,i,n={},o){this._checkLoaded();let a=[{id:t,url:i}],s=[...tn(this.stylesheet.sprite),...a];this._validate(Ve.sprite,"sprite",s,null,n)||(this.stylesheet.sprite=s,this._loadSprite(a,!0,o))}removeSprite(t){this._checkLoaded();let i=tn(this.stylesheet.sprite);if(!i.find(n=>n.id===t)){this.fire(new Z(new Error(`Sprite "${t}" doesn't exists on this map.`)));return}if(this._spritesImagesIds[t])for(let n of this._spritesImagesIds[t])this.imageManager.removeImage(n),this._changedImages[n]=!0;i.splice(i.findIndex(n=>n.id===t),1),this.stylesheet.sprite=i.length>0?i:void 0,delete this._spritesImagesIds[t],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new z("data",{dataType:"style"}))}getSprite(){return tn(this.stylesheet.sprite)}setSprite(t,i={},n){this._checkLoaded(),!(t&&this._validate(Ve.sprite,"sprite",t,null,i))&&(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,n):(this._unloadSprite(),n&&n(null)))}};m();m();var $l=be([{name:"a_pos",type:"Int16",components:2}]);m();m();var Bg=`#ifdef GL_ES
3
+ precision mediump float;
4
+ #else
5
+ #if !defined(lowp)
6
+ #define lowp
7
+ #endif
8
+ #if !defined(mediump)
9
+ #define mediump
10
+ #endif
11
+ #if !defined(highp)
12
+ #define highp
13
+ #endif
14
+ #endif
15
+ `;m();var Og=`#ifdef GL_ES
16
+ precision highp float;
17
+ #else
18
+ #if !defined(lowp)
19
+ #define lowp
20
+ #endif
21
+ #if !defined(mediump)
22
+ #define mediump
23
+ #endif
24
+ #if !defined(highp)
25
+ #define highp
26
+ #endif
27
+ #endif
28
+ vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0
29
+ );}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;}
30
+ #ifdef TERRAIN3D
31
+ uniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;
32
+ #endif
33
+ const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {
34
+ #ifdef TERRAIN3D
35
+ highp 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));
36
+ #else
37
+ return 1.0;
38
+ #endif
39
+ }float calculate_visibility(vec4 pos) {
40
+ #ifdef TERRAIN3D
41
+ vec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;
42
+ #else
43
+ return 1.0;
44
+ #endif
45
+ }float ele(vec2 pos) {
46
+ #ifdef TERRAIN3D
47
+ vec4 rgb=(texture2D(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;
48
+ #else
49
+ return 0.0;
50
+ #endif
51
+ }float get_elevation(vec2 pos) {
52
+ #ifdef TERRAIN3D
53
+ vec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;
54
+ #else
55
+ return 0.0;
56
+ #endif
57
+ }`;m();var Vg=`uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;
58
+ #ifdef OVERDRAW_INSPECTOR
59
+ gl_FragColor=vec4(1.0);
60
+ #endif
61
+ }`;m();var Ug="attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}";m();var Ng=`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;
62
+ #ifdef OVERDRAW_INSPECTOR
63
+ gl_FragColor=vec4(1.0);
64
+ #endif
65
+ }`;m();var Gg="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);}";m();var $g=`varying vec3 v_data;varying float v_visibility;
66
+ #pragma mapbox: define highp vec4 color
67
+ #pragma mapbox: define mediump float radius
68
+ #pragma mapbox: define lowp float blur
69
+ #pragma mapbox: define lowp float opacity
70
+ #pragma mapbox: define highp vec4 stroke_color
71
+ #pragma mapbox: define mediump float stroke_width
72
+ #pragma mapbox: define lowp float stroke_opacity
73
+ void main() {
74
+ #pragma mapbox: initialize highp vec4 color
75
+ #pragma mapbox: initialize mediump float radius
76
+ #pragma mapbox: initialize lowp float blur
77
+ #pragma mapbox: initialize lowp float opacity
78
+ #pragma mapbox: initialize highp vec4 stroke_color
79
+ #pragma mapbox: initialize mediump float stroke_width
80
+ #pragma mapbox: initialize lowp float stroke_opacity
81
+ vec2 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);
82
+ #ifdef OVERDRAW_INSPECTOR
83
+ gl_FragColor=vec4(1.0);
84
+ #endif
85
+ }`;m();var qg=`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;
86
+ #pragma mapbox: define highp vec4 color
87
+ #pragma mapbox: define mediump float radius
88
+ #pragma mapbox: define lowp float blur
89
+ #pragma mapbox: define lowp float opacity
90
+ #pragma mapbox: define highp vec4 stroke_color
91
+ #pragma mapbox: define mediump float stroke_width
92
+ #pragma mapbox: define lowp float stroke_opacity
93
+ void main(void) {
94
+ #pragma mapbox: initialize highp vec4 color
95
+ #pragma mapbox: initialize mediump float radius
96
+ #pragma mapbox: initialize lowp float blur
97
+ #pragma mapbox: initialize lowp float opacity
98
+ #pragma mapbox: initialize highp vec4 stroke_color
99
+ #pragma mapbox: initialize mediump float stroke_width
100
+ #pragma mapbox: initialize lowp float stroke_opacity
101
+ vec2 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);}`;m();var jg="void main() {gl_FragColor=vec4(1.0);}";m();var Zg="attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}";m();var Hg=`uniform highp float u_intensity;varying vec2 v_extrude;
102
+ #pragma mapbox: define highp float weight
103
+ #define GAUSS_COEF 0.3989422804014327
104
+ void main() {
105
+ #pragma mapbox: initialize highp float weight
106
+ float 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);
107
+ #ifdef OVERDRAW_INSPECTOR
108
+ gl_FragColor=vec4(1.0);
109
+ #endif
110
+ }`;m();var Wg=`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;
111
+ #pragma mapbox: define highp float weight
112
+ #pragma mapbox: define mediump float radius
113
+ const highp float ZERO=1.0/255.0/16.0;
114
+ #define GAUSS_COEF 0.3989422804014327
115
+ void main(void) {
116
+ #pragma mapbox: initialize highp float weight
117
+ #pragma mapbox: initialize mediump float radius
118
+ vec2 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;}`;m();var Xg=`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;
119
+ #ifdef OVERDRAW_INSPECTOR
120
+ gl_FragColor=vec4(0.0);
121
+ #endif
122
+ }`;m();var Kg="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;}";m();var Jg="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;}}";m();var Yg="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;}";m();var Qg="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;}";m();var ex="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);}";m();var tx="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);}";m();var rx="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);}";m();var ix=`#pragma mapbox: define highp vec4 color
123
+ #pragma mapbox: define lowp float opacity
124
+ void main() {
125
+ #pragma mapbox: initialize highp vec4 color
126
+ #pragma mapbox: initialize lowp float opacity
127
+ gl_FragColor=color*opacity;
128
+ #ifdef OVERDRAW_INSPECTOR
129
+ gl_FragColor=vec4(1.0);
130
+ #endif
131
+ }`;m();var nx=`attribute vec2 a_pos;uniform mat4 u_matrix;
132
+ #pragma mapbox: define highp vec4 color
133
+ #pragma mapbox: define lowp float opacity
134
+ void main() {
135
+ #pragma mapbox: initialize highp vec4 color
136
+ #pragma mapbox: initialize lowp float opacity
137
+ gl_Position=u_matrix*vec4(a_pos,0,1);}`;m();var ox=`varying vec2 v_pos;
138
+ #pragma mapbox: define highp vec4 outline_color
139
+ #pragma mapbox: define lowp float opacity
140
+ void main() {
141
+ #pragma mapbox: initialize highp vec4 outline_color
142
+ #pragma mapbox: initialize lowp float opacity
143
+ float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);
144
+ #ifdef OVERDRAW_INSPECTOR
145
+ gl_FragColor=vec4(1.0);
146
+ #endif
147
+ }`;m();var ax=`attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;
148
+ #pragma mapbox: define highp vec4 outline_color
149
+ #pragma mapbox: define lowp float opacity
150
+ void main() {
151
+ #pragma mapbox: initialize highp vec4 outline_color
152
+ #pragma mapbox: initialize lowp float opacity
153
+ gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}`;m();var sx=`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;
154
+ #pragma mapbox: define lowp float opacity
155
+ #pragma mapbox: define lowp vec4 pattern_from
156
+ #pragma mapbox: define lowp vec4 pattern_to
157
+ void main() {
158
+ #pragma mapbox: initialize lowp float opacity
159
+ #pragma mapbox: initialize mediump vec4 pattern_from
160
+ #pragma mapbox: initialize mediump vec4 pattern_to
161
+ vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=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;
162
+ #ifdef OVERDRAW_INSPECTOR
163
+ gl_FragColor=vec4(1.0);
164
+ #endif
165
+ }`;m();var lx=`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;
166
+ #pragma mapbox: define lowp float opacity
167
+ #pragma mapbox: define lowp vec4 pattern_from
168
+ #pragma mapbox: define lowp vec4 pattern_to
169
+ #pragma mapbox: define lowp float pixel_ratio_from
170
+ #pragma mapbox: define lowp float pixel_ratio_to
171
+ void main() {
172
+ #pragma mapbox: initialize lowp float opacity
173
+ #pragma mapbox: initialize mediump vec4 pattern_from
174
+ #pragma mapbox: initialize mediump vec4 pattern_to
175
+ #pragma mapbox: initialize lowp float pixel_ratio_from
176
+ #pragma mapbox: initialize lowp float pixel_ratio_to
177
+ vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=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;}`;m();var ux=`#ifdef GL_ES
178
+ precision highp float;
179
+ #endif
180
+ uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;
181
+ #pragma mapbox: define lowp float opacity
182
+ #pragma mapbox: define lowp vec4 pattern_from
183
+ #pragma mapbox: define lowp vec4 pattern_to
184
+ void main() {
185
+ #pragma mapbox: initialize lowp float opacity
186
+ #pragma mapbox: initialize mediump vec4 pattern_from
187
+ #pragma mapbox: initialize mediump vec4 pattern_to
188
+ vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=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;
189
+ #ifdef OVERDRAW_INSPECTOR
190
+ gl_FragColor=vec4(1.0);
191
+ #endif
192
+ }`;m();var cx=`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;
193
+ #pragma mapbox: define lowp float opacity
194
+ #pragma mapbox: define lowp vec4 pattern_from
195
+ #pragma mapbox: define lowp vec4 pattern_to
196
+ #pragma mapbox: define lowp float pixel_ratio_from
197
+ #pragma mapbox: define lowp float pixel_ratio_to
198
+ void main() {
199
+ #pragma mapbox: initialize lowp float opacity
200
+ #pragma mapbox: initialize mediump vec4 pattern_from
201
+ #pragma mapbox: initialize mediump vec4 pattern_to
202
+ #pragma mapbox: initialize lowp float pixel_ratio_from
203
+ #pragma mapbox: initialize lowp float pixel_ratio_to
204
+ vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=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);}`;m();var px=`varying vec4 v_color;void main() {gl_FragColor=v_color;
205
+ #ifdef OVERDRAW_INSPECTOR
206
+ gl_FragColor=vec4(1.0);
207
+ #endif
208
+ }`;m();var hx=`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;
209
+ #ifdef TERRAIN3D
210
+ attribute vec2 a_centroid;
211
+ #endif
212
+ varying vec4 v_color;
213
+ #pragma mapbox: define highp float base
214
+ #pragma mapbox: define highp float height
215
+ #pragma mapbox: define highp vec4 color
216
+ void main() {
217
+ #pragma mapbox: initialize highp float base
218
+ #pragma mapbox: initialize highp float height
219
+ #pragma mapbox: initialize highp vec4 color
220
+ vec3 normal=a_normal_ed.xyz;
221
+ #ifdef TERRAIN3D
222
+ float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
223
+ #else
224
+ float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
225
+ #endif
226
+ base=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;}`;m();var fx=`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;
227
+ #pragma mapbox: define lowp float base
228
+ #pragma mapbox: define lowp float height
229
+ #pragma mapbox: define lowp vec4 pattern_from
230
+ #pragma mapbox: define lowp vec4 pattern_to
231
+ #pragma mapbox: define lowp float pixel_ratio_from
232
+ #pragma mapbox: define lowp float pixel_ratio_to
233
+ void main() {
234
+ #pragma mapbox: initialize lowp float base
235
+ #pragma mapbox: initialize lowp float height
236
+ #pragma mapbox: initialize mediump vec4 pattern_from
237
+ #pragma mapbox: initialize mediump vec4 pattern_to
238
+ #pragma mapbox: initialize lowp float pixel_ratio_from
239
+ #pragma mapbox: initialize lowp float pixel_ratio_to
240
+ vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;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;
241
+ #ifdef OVERDRAW_INSPECTOR
242
+ gl_FragColor=vec4(1.0);
243
+ #endif
244
+ }`;m();var mx=`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;
245
+ #ifdef TERRAIN3D
246
+ attribute vec2 a_centroid;
247
+ #endif
248
+ varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;
249
+ #pragma mapbox: define lowp float base
250
+ #pragma mapbox: define lowp float height
251
+ #pragma mapbox: define lowp vec4 pattern_from
252
+ #pragma mapbox: define lowp vec4 pattern_to
253
+ #pragma mapbox: define lowp float pixel_ratio_from
254
+ #pragma mapbox: define lowp float pixel_ratio_to
255
+ void main() {
256
+ #pragma mapbox: initialize lowp float base
257
+ #pragma mapbox: initialize lowp float height
258
+ #pragma mapbox: initialize mediump vec4 pattern_from
259
+ #pragma mapbox: initialize mediump vec4 pattern_to
260
+ #pragma mapbox: initialize lowp float pixel_ratio_from
261
+ #pragma mapbox: initialize lowp float pixel_ratio_to
262
+ vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;
263
+ #ifdef TERRAIN3D
264
+ float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
265
+ #else
266
+ float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
267
+ #endif
268
+ base=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
269
+ ? a_pos
270
+ : 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;}`;m();var dx=`#ifdef GL_ES
271
+ precision highp float;
272
+ #endif
273
+ uniform 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);
274
+ #ifdef OVERDRAW_INSPECTOR
275
+ gl_FragColor=vec4(1.0);
276
+ #endif
277
+ }`;m();var yx="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;}";m();var gx=`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;
278
+ #define PI 3.141592653589793
279
+ void 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;
280
+ #ifdef OVERDRAW_INSPECTOR
281
+ gl_FragColor=vec4(1.0);
282
+ #endif
283
+ }`;m();var xx="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;}";m();var bx=`uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;
284
+ #pragma mapbox: define highp vec4 color
285
+ #pragma mapbox: define lowp float blur
286
+ #pragma mapbox: define lowp float opacity
287
+ void main() {
288
+ #pragma mapbox: initialize highp vec4 color
289
+ #pragma mapbox: initialize lowp float blur
290
+ #pragma mapbox: initialize lowp float opacity
291
+ 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);gl_FragColor=color*(alpha*opacity);
292
+ #ifdef OVERDRAW_INSPECTOR
293
+ gl_FragColor=vec4(1.0);
294
+ #endif
295
+ }`;m();var _x=`
296
+ #define scale 0.015873016
297
+ attribute 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;
298
+ #pragma mapbox: define highp vec4 color
299
+ #pragma mapbox: define lowp float blur
300
+ #pragma mapbox: define lowp float opacity
301
+ #pragma mapbox: define mediump float gapwidth
302
+ #pragma mapbox: define lowp float offset
303
+ #pragma mapbox: define mediump float width
304
+ void main() {
305
+ #pragma mapbox: initialize highp vec4 color
306
+ #pragma mapbox: initialize lowp float blur
307
+ #pragma mapbox: initialize lowp float opacity
308
+ #pragma mapbox: initialize mediump float gapwidth
309
+ #pragma mapbox: initialize lowp float offset
310
+ #pragma mapbox: initialize mediump float width
311
+ float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);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;
312
+ #ifdef TERRAIN3D
313
+ v_gamma_scale=1.0;
314
+ #else
315
+ float 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;
316
+ #endif
317
+ v_width2=vec2(outset,inset);}`;m();var vx=`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;
318
+ #pragma mapbox: define lowp float blur
319
+ #pragma mapbox: define lowp float opacity
320
+ void main() {
321
+ #pragma mapbox: initialize lowp float blur
322
+ #pragma mapbox: initialize lowp float opacity
323
+ float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);
324
+ #ifdef OVERDRAW_INSPECTOR
325
+ gl_FragColor=vec4(1.0);
326
+ #endif
327
+ }`;m();var wx=`
328
+ #define scale 0.015873016
329
+ attribute 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;
330
+ #pragma mapbox: define lowp float blur
331
+ #pragma mapbox: define lowp float opacity
332
+ #pragma mapbox: define mediump float gapwidth
333
+ #pragma mapbox: define lowp float offset
334
+ #pragma mapbox: define mediump float width
335
+ void main() {
336
+ #pragma mapbox: initialize lowp float blur
337
+ #pragma mapbox: initialize lowp float opacity
338
+ #pragma mapbox: initialize mediump float gapwidth
339
+ #pragma mapbox: initialize lowp float offset
340
+ #pragma mapbox: initialize mediump float width
341
+ float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);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;
342
+ #ifdef TERRAIN3D
343
+ v_gamma_scale=1.0;
344
+ #else
345
+ float 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;
346
+ #endif
347
+ v_width2=vec2(outset,inset);}`;m();var Sx=`#ifdef GL_ES
348
+ precision highp float;
349
+ #endif
350
+ uniform 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;
351
+ #pragma mapbox: define lowp vec4 pattern_from
352
+ #pragma mapbox: define lowp vec4 pattern_to
353
+ #pragma mapbox: define lowp float pixel_ratio_from
354
+ #pragma mapbox: define lowp float pixel_ratio_to
355
+ #pragma mapbox: define lowp float blur
356
+ #pragma mapbox: define lowp float opacity
357
+ void main() {
358
+ #pragma mapbox: initialize mediump vec4 pattern_from
359
+ #pragma mapbox: initialize mediump vec4 pattern_to
360
+ #pragma mapbox: initialize lowp float pixel_ratio_from
361
+ #pragma mapbox: initialize lowp float pixel_ratio_to
362
+ #pragma mapbox: initialize lowp float blur
363
+ #pragma mapbox: initialize lowp float opacity
364
+ vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;
365
+ #ifdef OVERDRAW_INSPECTOR
366
+ gl_FragColor=vec4(1.0);
367
+ #endif
368
+ }`;m();var Px=`
369
+ #define scale 0.015873016
370
+ #define LINE_DISTANCE_SCALE 2.0
371
+ attribute 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;
372
+ #pragma mapbox: define lowp float blur
373
+ #pragma mapbox: define lowp float opacity
374
+ #pragma mapbox: define lowp float offset
375
+ #pragma mapbox: define mediump float gapwidth
376
+ #pragma mapbox: define mediump float width
377
+ #pragma mapbox: define lowp float floorwidth
378
+ #pragma mapbox: define lowp vec4 pattern_from
379
+ #pragma mapbox: define lowp vec4 pattern_to
380
+ #pragma mapbox: define lowp float pixel_ratio_from
381
+ #pragma mapbox: define lowp float pixel_ratio_to
382
+ void main() {
383
+ #pragma mapbox: initialize lowp float blur
384
+ #pragma mapbox: initialize lowp float opacity
385
+ #pragma mapbox: initialize lowp float offset
386
+ #pragma mapbox: initialize mediump float gapwidth
387
+ #pragma mapbox: initialize mediump float width
388
+ #pragma mapbox: initialize lowp float floorwidth
389
+ #pragma mapbox: initialize mediump vec4 pattern_from
390
+ #pragma mapbox: initialize mediump vec4 pattern_to
391
+ #pragma mapbox: initialize lowp float pixel_ratio_from
392
+ #pragma mapbox: initialize lowp float pixel_ratio_to
393
+ float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);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;
394
+ #ifdef TERRAIN3D
395
+ v_gamma_scale=1.0;
396
+ #else
397
+ float 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;
398
+ #endif
399
+ v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`;m();var Tx=`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;
400
+ #pragma mapbox: define highp vec4 color
401
+ #pragma mapbox: define lowp float blur
402
+ #pragma mapbox: define lowp float opacity
403
+ #pragma mapbox: define mediump float width
404
+ #pragma mapbox: define lowp float floorwidth
405
+ void main() {
406
+ #pragma mapbox: initialize highp vec4 color
407
+ #pragma mapbox: initialize lowp float blur
408
+ #pragma mapbox: initialize lowp float opacity
409
+ #pragma mapbox: initialize mediump float width
410
+ #pragma mapbox: initialize lowp float floorwidth
411
+ float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=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);
412
+ #ifdef OVERDRAW_INSPECTOR
413
+ gl_FragColor=vec4(1.0);
414
+ #endif
415
+ }`;m();var Ax=`
416
+ #define scale 0.015873016
417
+ #define LINE_DISTANCE_SCALE 2.0
418
+ attribute 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;
419
+ #pragma mapbox: define highp vec4 color
420
+ #pragma mapbox: define lowp float blur
421
+ #pragma mapbox: define lowp float opacity
422
+ #pragma mapbox: define mediump float gapwidth
423
+ #pragma mapbox: define lowp float offset
424
+ #pragma mapbox: define mediump float width
425
+ #pragma mapbox: define lowp float floorwidth
426
+ void main() {
427
+ #pragma mapbox: initialize highp vec4 color
428
+ #pragma mapbox: initialize lowp float blur
429
+ #pragma mapbox: initialize lowp float opacity
430
+ #pragma mapbox: initialize mediump float gapwidth
431
+ #pragma mapbox: initialize lowp float offset
432
+ #pragma mapbox: initialize mediump float width
433
+ #pragma mapbox: initialize lowp float floorwidth
434
+ float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);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;
435
+ #ifdef TERRAIN3D
436
+ v_gamma_scale=1.0;
437
+ #else
438
+ float 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;
439
+ #endif
440
+ v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}`;m();var Mx=`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);
441
+ #ifdef OVERDRAW_INSPECTOR
442
+ gl_FragColor=vec4(1.0);
443
+ #endif
444
+ }`;m();var Ix="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;}";m();var Cx=`uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;
445
+ #pragma mapbox: define lowp float opacity
446
+ void main() {
447
+ #pragma mapbox: initialize lowp float opacity
448
+ lowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;
449
+ #ifdef OVERDRAW_INSPECTOR
450
+ gl_FragColor=vec4(1.0);
451
+ #endif
452
+ }`;m();var Ex=`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;
453
+ #pragma mapbox: define lowp float opacity
454
+ void main() {
455
+ #pragma mapbox: initialize lowp float opacity
456
+ vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}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 ?
457
+ camera_to_anchor_distance/u_camera_to_center_distance :
458
+ u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=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));}`;m();var kx=`#define SDF_PX 8.0
459
+ uniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;
460
+ #pragma mapbox: define highp vec4 fill_color
461
+ #pragma mapbox: define highp vec4 halo_color
462
+ #pragma mapbox: define lowp float opacity
463
+ #pragma mapbox: define lowp float halo_width
464
+ #pragma mapbox: define lowp float halo_blur
465
+ void main() {
466
+ #pragma mapbox: initialize highp vec4 fill_color
467
+ #pragma mapbox: initialize highp vec4 halo_color
468
+ #pragma mapbox: initialize lowp float opacity
469
+ #pragma mapbox: initialize lowp float halo_width
470
+ #pragma mapbox: initialize lowp float halo_blur
471
+ float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}gl_FragColor=color*(alpha*opacity*fade_opacity);
472
+ #ifdef OVERDRAW_INSPECTOR
473
+ gl_FragColor=vec4(1.0);
474
+ #endif
475
+ }`;m();var Lx=`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;
476
+ #pragma mapbox: define highp vec4 fill_color
477
+ #pragma mapbox: define highp vec4 halo_color
478
+ #pragma mapbox: define lowp float opacity
479
+ #pragma mapbox: define lowp float halo_width
480
+ #pragma mapbox: define lowp float halo_blur
481
+ void main() {
482
+ #pragma mapbox: initialize highp vec4 fill_color
483
+ #pragma mapbox: initialize highp vec4 halo_color
484
+ #pragma mapbox: initialize lowp float opacity
485
+ #pragma mapbox: initialize lowp float halo_width
486
+ #pragma mapbox: initialize lowp float halo_blur
487
+ vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}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 ?
488
+ camera_to_anchor_distance/u_camera_to_center_distance :
489
+ u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=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);}`;m();var Dx=`#define SDF_PX 8.0
490
+ #define SDF 1.0
491
+ #define ICON 0.0
492
+ uniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;
493
+ #pragma mapbox: define highp vec4 fill_color
494
+ #pragma mapbox: define highp vec4 halo_color
495
+ #pragma mapbox: define lowp float opacity
496
+ #pragma mapbox: define lowp float halo_width
497
+ #pragma mapbox: define lowp float halo_blur
498
+ void main() {
499
+ #pragma mapbox: initialize highp vec4 fill_color
500
+ #pragma mapbox: initialize highp vec4 halo_color
501
+ #pragma mapbox: initialize lowp float opacity
502
+ #pragma mapbox: initialize lowp float halo_width
503
+ #pragma mapbox: initialize lowp float halo_blur
504
+ float 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;
505
+ #ifdef OVERDRAW_INSPECTOR
506
+ gl_FragColor=vec4(1.0);
507
+ #endif
508
+ return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=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);
509
+ #ifdef OVERDRAW_INSPECTOR
510
+ gl_FragColor=vec4(1.0);
511
+ #endif
512
+ }`;m();var zx=`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;
513
+ #pragma mapbox: define highp vec4 fill_color
514
+ #pragma mapbox: define highp vec4 halo_color
515
+ #pragma mapbox: define lowp float opacity
516
+ #pragma mapbox: define lowp float halo_width
517
+ #pragma mapbox: define lowp float halo_blur
518
+ void main() {
519
+ #pragma mapbox: initialize highp vec4 fill_color
520
+ #pragma mapbox: initialize highp vec4 halo_color
521
+ #pragma mapbox: initialize lowp float opacity
522
+ #pragma mapbox: initialize lowp float halo_width
523
+ #pragma mapbox: initialize lowp float halo_blur
524
+ vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}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 ?
525
+ camera_to_anchor_distance/u_camera_to_center_distance :
526
+ u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=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);}`;m();var Fx="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);}";m();var Rx="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);}";m();var Bx="uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}";m();var ql="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;}";var hi={prelude:Ce(Bg,Og),background:Ce(Vg,Ug),backgroundPattern:Ce(Ng,Gg),circle:Ce($g,qg),clippingMask:Ce(jg,Zg),heatmap:Ce(Hg,Wg),heatmapTexture:Ce(Xg,Kg),collisionBox:Ce(Jg,Yg),collisionCircle:Ce(Qg,ex),debug:Ce(tx,rx),fill:Ce(ix,nx),fillOutline:Ce(ox,ax),fillOutlinePattern:Ce(sx,lx),fillPattern:Ce(ux,cx),fillExtrusion:Ce(px,hx),fillExtrusionPattern:Ce(fx,mx),hillshadePrepare:Ce(dx,yx),hillshade:Ce(gx,xx),line:Ce(bx,_x),lineGradient:Ce(vx,wx),linePattern:Ce(Sx,Px),lineSDF:Ce(Tx,Ax),raster:Ce(Mx,Ix),symbolIcon:Ce(Cx,Ex),symbolSDF:Ce(kx,Lx),symbolTextAndIcon:Ce(Dx,zx),terrain:Ce(Bx,ql),terrainDepth:Ce(Fx,ql),terrainCoords:Ce(Rx,ql)};function Ce(r,e){let t=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,i=e.match(/attribute ([\w]+) ([\w]+)/g),n=r.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),o=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),a=o?o.concat(n):n,s={};return r=r.replace(t,(l,u,c,p,h)=>(s[h]=!0,u==="define"?`
527
+ #ifndef HAS_UNIFORM_u_${h}
528
+ varying ${c} ${p} ${h};
529
+ #else
530
+ uniform ${c} ${p} u_${h};
531
+ #endif
532
+ `:`
533
+ #ifdef HAS_UNIFORM_u_${h}
534
+ ${c} ${p} ${h} = u_${h};
535
+ #endif
536
+ `)),e=e.replace(t,(l,u,c,p,h)=>{let f=p==="float"?"vec2":"vec4",d=h.match(/color/)?"color":f;return s[h]?u==="define"?`
537
+ #ifndef HAS_UNIFORM_u_${h}
538
+ uniform lowp float u_${h}_t;
539
+ attribute ${c} ${f} a_${h};
540
+ varying ${c} ${p} ${h};
541
+ #else
542
+ uniform ${c} ${p} u_${h};
543
+ #endif
544
+ `:d==="vec4"?`
545
+ #ifndef HAS_UNIFORM_u_${h}
546
+ ${h} = a_${h};
547
+ #else
548
+ ${c} ${p} ${h} = u_${h};
549
+ #endif
550
+ `:`
551
+ #ifndef HAS_UNIFORM_u_${h}
552
+ ${h} = unpack_mix_${d}(a_${h}, u_${h}_t);
553
+ #else
554
+ ${c} ${p} ${h} = u_${h};
555
+ #endif
556
+ `:u==="define"?`
557
+ #ifndef HAS_UNIFORM_u_${h}
558
+ uniform lowp float u_${h}_t;
559
+ attribute ${c} ${f} a_${h};
560
+ #else
561
+ uniform ${c} ${p} u_${h};
562
+ #endif
563
+ `:d==="vec4"?`
564
+ #ifndef HAS_UNIFORM_u_${h}
565
+ ${c} ${p} ${h} = a_${h};
566
+ #else
567
+ ${c} ${p} ${h} = u_${h};
568
+ #endif
569
+ `:`
570
+ #ifndef HAS_UNIFORM_u_${h}
571
+ ${c} ${p} ${h} = unpack_mix_${d}(a_${h}, u_${h}_t);
572
+ #else
573
+ ${c} ${p} ${h} = u_${h};
574
+ #endif
575
+ `}),{fragmentSource:r,vertexSource:e,staticAttributes:i,staticUniforms:a}}m();m();var jl=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,i,n,o,a,s,l,u){this.context=e;let c=this.boundPaintVertexBuffers.length!==n.length;for(let h=0;!c&&h<n.length;h++)this.boundPaintVertexBuffers[h]!==n[h]&&(c=!0);!this.vao||this.boundProgram!==t||this.boundLayoutVertexBuffer!==i||c||this.boundIndexBuffer!==o||this.boundVertexOffset!==a||this.boundDynamicVertexBuffer!==s||this.boundDynamicVertexBuffer2!==l||this.boundDynamicVertexBuffer3!==u?this.freshBind(t,i,n,o,a,s,l,u):(e.bindVertexArray.set(this.vao),s&&s.bind(),o&&o.dynamicDraw&&o.bind(),l&&l.bind(),u&&u.bind())}freshBind(e,t,i,n,o,a,s,l){let u=e.numAttributes,c=this.context,p=c.gl;this.vao&&this.destroy(),this.vao=c.createVertexArray(),c.bindVertexArray.set(this.vao),this.boundProgram=e,this.boundLayoutVertexBuffer=t,this.boundPaintVertexBuffers=i,this.boundIndexBuffer=n,this.boundVertexOffset=o,this.boundDynamicVertexBuffer=a,this.boundDynamicVertexBuffer2=s,this.boundDynamicVertexBuffer3=l,t.enableAttributes(p,e);for(let h of i)h.enableAttributes(p,e);a&&a.enableAttributes(p,e),s&&s.enableAttributes(p,e),l&&l.enableAttributes(p,e),t.bind(),t.setVertexAttribPointers(p,e,o);for(let h of i)h.bind(),h.setVertexAttribPointers(p,e,o);a&&(a.bind(),a.setVertexAttribPointers(p,e,o)),n&&n.bind(),s&&(s.bind(),s.setVertexAttribPointers(p,e,o)),l&&(l.bind(),l.setVertexAttribPointers(p,e,o)),c.currentNumAttributes=u}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}};m();var Ox=(r,e)=>({u_depth:new J(r,e.u_depth),u_terrain:new J(r,e.u_terrain),u_terrain_dim:new V(r,e.u_terrain_dim),u_terrain_matrix:new te(r,e.u_terrain_matrix),u_terrain_unpack:new Tr(r,e.u_terrain_unpack),u_terrain_exaggeration:new V(r,e.u_terrain_exaggeration)}),Vx=(r,e)=>({u_matrix:new te(r,e.u_matrix),u_texture:new J(r,e.u_texture),u_ele_delta:new V(r,e.u_ele_delta)}),Ux=(r,e)=>({u_matrix:new te(r,e.u_matrix),u_ele_delta:new V(r,e.u_ele_delta)}),Nx=(r,e)=>({u_matrix:new te(r,e.u_matrix),u_texture:new J(r,e.u_texture),u_terrain_coords_id:new V(r,e.u_terrain_coords_id),u_ele_delta:new V(r,e.u_ele_delta)}),Gx=(r,e)=>({u_matrix:r,u_texture:0,u_ele_delta:e}),$x=(r,e)=>({u_matrix:r,u_ele_delta:e}),qx=(r,e,t)=>({u_matrix:r,u_terrain_coords_id:e/255,u_texture:0,u_ele_delta:t});function fh(r){let e=[];for(let t=0;t<r.length;t++){if(r[t]===null)continue;let i=r[t].split(" ");e.push(i.pop())}return e}var Zl=class{constructor(e,t,i,n,o,a){let s=e.gl;this.program=s.createProgram();let l=fh(t.staticAttributes),u=i?i.getBinderAttributes():[],c=l.concat(u),p=hi.prelude.staticUniforms?fh(hi.prelude.staticUniforms):[],h=t.staticUniforms?fh(t.staticUniforms):[],f=i?i.getBinderUniforms():[],d=p.concat(h).concat(f),y=[];for(let P of d)y.indexOf(P)<0&&y.push(P);let g=i?i.defines():[];o&&g.push("#define OVERDRAW_INSPECTOR;"),a&&g.push("#define TERRAIN3D;");let x=g.concat(hi.prelude.fragmentSource,t.fragmentSource).join(`
576
+ `),v=g.concat(hi.prelude.vertexSource,t.vertexSource).join(`
577
+ `),b=s.createShader(s.FRAGMENT_SHADER);if(s.isContextLost()){this.failedToCreate=!0;return}if(s.shaderSource(b,x),s.compileShader(b),!s.getShaderParameter(b,s.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${s.getShaderInfoLog(b)}`);s.attachShader(this.program,b);let w=s.createShader(s.VERTEX_SHADER);if(s.isContextLost()){this.failedToCreate=!0;return}if(s.shaderSource(w,v),s.compileShader(w),!s.getShaderParameter(w,s.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${s.getShaderInfoLog(w)}`);s.attachShader(this.program,w),this.attributes={};let S={};this.numAttributes=c.length;for(let P=0;P<this.numAttributes;P++)c[P]&&(s.bindAttribLocation(this.program,P,c[P]),this.attributes[c[P]]=P);if(s.linkProgram(this.program),!s.getProgramParameter(this.program,s.LINK_STATUS))throw new Error(`Program failed to link: ${s.getProgramInfoLog(this.program)}`);s.deleteShader(w),s.deleteShader(b);for(let P=0;P<y.length;P++){let I=y[P];if(I&&!S[I]){let k=s.getUniformLocation(this.program,I);k&&(S[I]=k)}}this.fixedUniforms=n(e,S),this.terrainUniforms=Ox(e,S),this.binderUniforms=i?i.getUniforms(e,S):[]}draw(e,t,i,n,o,a,s,l,u,c,p,h,f,d,y,g,x,v){let b=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(i),e.setStencilMode(n),e.setColorMode(o),e.setCullFace(a),l){e.activeTexture.set(b.TEXTURE2),b.bindTexture(b.TEXTURE_2D,l.depthTexture),e.activeTexture.set(b.TEXTURE3),b.bindTexture(b.TEXTURE_2D,l.texture);for(let S in this.terrainUniforms)this.terrainUniforms[S].set(l[S])}for(let S in this.fixedUniforms)this.fixedUniforms[S].set(s[S]);y&&y.setUniforms(e,this.binderUniforms,f,{zoom:d});let w=0;switch(t){case b.LINES:w=2;break;case b.TRIANGLES:w=3;break;case b.LINE_STRIP:w=1;break}for(let S of h.get()){let P=S.vaos||(S.vaos={});(P[u]||(P[u]=new jl)).bind(e,this,c,y?y.getPaintVertexBuffers():[],p,S.vertexOffset,g,x,v),b.drawElements(t,S.primitiveLength*w,b.UNSIGNED_SHORT,S.primitiveOffset*w*2)}}};m();m();m();function Hl(r,e,t){let i=1/je(t,1,e.transform.tileZoom),n=Math.pow(2,t.tileID.overscaledZ),o=t.tileSize*Math.pow(2,e.transform.tileZoom)/n,a=o*(t.tileID.canonical.x+t.tileID.wrap*n),s=o*t.tileID.canonical.y;return{u_image:0,u_texsize:t.imageAtlasTexture.size,u_scale:[i,r.fromScale,r.toScale],u_fade:r.t,u_pixel_coord_upper:[a>>16,s>>16],u_pixel_coord_lower:[a&65535,s&65535]}}function jx(r,e,t,i){let n=t.imageManager.getPattern(r.from.toString()),o=t.imageManager.getPattern(r.to.toString()),{width:a,height:s}=t.imageManager.getPixelSize(),l=Math.pow(2,i.tileID.overscaledZ),u=i.tileSize*Math.pow(2,t.transform.tileZoom)/l,c=u*(i.tileID.canonical.x+i.tileID.wrap*l),p=u*i.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:n.tl,u_pattern_br_a:n.br,u_pattern_tl_b:o.tl,u_pattern_br_b:o.br,u_texsize:[a,s],u_mix:e.t,u_pattern_size_a:n.displaySize,u_pattern_size_b:o.displaySize,u_scale_a:e.fromScale,u_scale_b:e.toScale,u_tile_units_to_pixels:1/je(i,1,t.transform.tileZoom),u_pixel_coord_upper:[c>>16,p>>16],u_pixel_coord_lower:[c&65535,p&65535]}}var Zx=(r,e)=>({u_matrix:new te(r,e.u_matrix),u_lightpos:new lt(r,e.u_lightpos),u_lightintensity:new V(r,e.u_lightintensity),u_lightcolor:new lt(r,e.u_lightcolor),u_vertical_gradient:new V(r,e.u_vertical_gradient),u_opacity:new V(r,e.u_opacity)}),Hx=(r,e)=>({u_matrix:new te(r,e.u_matrix),u_lightpos:new lt(r,e.u_lightpos),u_lightintensity:new V(r,e.u_lightintensity),u_lightcolor:new lt(r,e.u_lightcolor),u_vertical_gradient:new V(r,e.u_vertical_gradient),u_height_factor:new V(r,e.u_height_factor),u_image:new J(r,e.u_image),u_texsize:new ee(r,e.u_texsize),u_pixel_coord_upper:new ee(r,e.u_pixel_coord_upper),u_pixel_coord_lower:new ee(r,e.u_pixel_coord_lower),u_scale:new lt(r,e.u_scale),u_fade:new V(r,e.u_fade),u_opacity:new V(r,e.u_opacity)}),mh=(r,e,t,i)=>{let n=e.style.light,o=n.properties.get("position"),a=[o.x,o.y,o.z],s=_o.create();n.properties.get("anchor")==="viewport"&&_o.fromRotation(s,-e.transform.angle),yt.transformMat3(a,a,s);let l=n.properties.get("color");return{u_matrix:r,u_lightpos:a,u_lightintensity:n.properties.get("intensity"),u_lightcolor:[l.r,l.g,l.b],u_vertical_gradient:+t,u_opacity:i}},Wx=(r,e,t,i,n,o,a)=>O(mh(r,e,t,i),Hl(o,e,a),{u_height_factor:-Math.pow(2,n.overscaledZ)/a.tileSize/8});m();var Xx=(r,e)=>({u_matrix:new te(r,e.u_matrix)}),Kx=(r,e)=>({u_matrix:new te(r,e.u_matrix),u_image:new J(r,e.u_image),u_texsize:new ee(r,e.u_texsize),u_pixel_coord_upper:new ee(r,e.u_pixel_coord_upper),u_pixel_coord_lower:new ee(r,e.u_pixel_coord_lower),u_scale:new lt(r,e.u_scale),u_fade:new V(r,e.u_fade)}),Jx=(r,e)=>({u_matrix:new te(r,e.u_matrix),u_world:new ee(r,e.u_world)}),Yx=(r,e)=>({u_matrix:new te(r,e.u_matrix),u_world:new ee(r,e.u_world),u_image:new J(r,e.u_image),u_texsize:new ee(r,e.u_texsize),u_pixel_coord_upper:new ee(r,e.u_pixel_coord_upper),u_pixel_coord_lower:new ee(r,e.u_pixel_coord_lower),u_scale:new lt(r,e.u_scale),u_fade:new V(r,e.u_fade)}),dh=r=>({u_matrix:r}),yh=(r,e,t,i)=>O(dh(r),Hl(t,e,i)),Qx=(r,e)=>({u_matrix:r,u_world:e}),eb=(r,e,t,i,n)=>O(yh(r,e,t,i),{u_world:n});m();var tb=(r,e)=>({u_camera_to_center_distance:new V(r,e.u_camera_to_center_distance),u_scale_with_map:new J(r,e.u_scale_with_map),u_pitch_with_map:new J(r,e.u_pitch_with_map),u_extrude_scale:new ee(r,e.u_extrude_scale),u_device_pixel_ratio:new V(r,e.u_device_pixel_ratio),u_matrix:new te(r,e.u_matrix)}),rb=(r,e,t,i)=>{let n=r.transform,o,a;if(i.paint.get("circle-pitch-alignment")==="map"){let s=je(t,1,n.zoom);o=!0,a=[s,s]}else o=!1,a=n.pixelsToGLUnits;return{u_camera_to_center_distance:n.cameraToCenterDistance,u_scale_with_map:+(i.paint.get("circle-pitch-scale")==="map"),u_matrix:r.translatePosMatrix(e.posMatrix,t,i.paint.get("circle-translate"),i.paint.get("circle-translate-anchor")),u_pitch_with_map:+o,u_device_pixel_ratio:r.pixelRatio,u_extrude_scale:a}};m();var ib=(r,e)=>({u_matrix:new te(r,e.u_matrix),u_camera_to_center_distance:new V(r,e.u_camera_to_center_distance),u_pixels_to_tile_units:new V(r,e.u_pixels_to_tile_units),u_extrude_scale:new ee(r,e.u_extrude_scale),u_overscale_factor:new V(r,e.u_overscale_factor)}),nb=(r,e)=>({u_matrix:new te(r,e.u_matrix),u_inv_matrix:new te(r,e.u_inv_matrix),u_camera_to_center_distance:new V(r,e.u_camera_to_center_distance),u_viewport_size:new ee(r,e.u_viewport_size)}),ob=(r,e,t)=>{let i=je(t,1,e.zoom),n=Math.pow(2,e.zoom-t.tileID.overscaledZ),o=t.tileID.overscaleFactor();return{u_matrix:r,u_camera_to_center_distance:e.cameraToCenterDistance,u_pixels_to_tile_units:i,u_extrude_scale:[e.pixelsToGLUnits[0]/(i*n),e.pixelsToGLUnits[1]/(i*n)],u_overscale_factor:o}},ab=(r,e,t)=>({u_matrix:r,u_inv_matrix:e,u_camera_to_center_distance:t.cameraToCenterDistance,u_viewport_size:[t.width,t.height]});m();var sb=(r,e)=>({u_color:new Et(r,e.u_color),u_matrix:new te(r,e.u_matrix),u_overlay:new J(r,e.u_overlay),u_overlay_scale:new V(r,e.u_overlay_scale)}),gh=(r,e,t=1)=>({u_matrix:r,u_color:e,u_overlay:0,u_overlay_scale:t});m();var lb=(r,e)=>({u_matrix:new te(r,e.u_matrix)}),xh=r=>({u_matrix:r});m();var ub=(r,e)=>({u_extrude_scale:new V(r,e.u_extrude_scale),u_intensity:new V(r,e.u_intensity),u_matrix:new te(r,e.u_matrix)}),cb=(r,e)=>({u_matrix:new te(r,e.u_matrix),u_world:new ee(r,e.u_world),u_image:new J(r,e.u_image),u_color_ramp:new J(r,e.u_color_ramp),u_opacity:new V(r,e.u_opacity)}),pb=(r,e,t,i)=>({u_matrix:r,u_extrude_scale:je(e,1,t),u_intensity:i}),hb=(r,e,t,i)=>{let n=N.create();N.ortho(n,0,r.width,r.height,0,0,1);let o=r.context.gl;return{u_matrix:n,u_world:[o.drawingBufferWidth,o.drawingBufferHeight],u_image:t,u_color_ramp:i,u_opacity:e.paint.get("heatmap-opacity")}};m();var fb=(r,e)=>({u_matrix:new te(r,e.u_matrix),u_image:new J(r,e.u_image),u_latrange:new ee(r,e.u_latrange),u_light:new ee(r,e.u_light),u_shadow:new Et(r,e.u_shadow),u_highlight:new Et(r,e.u_highlight),u_accent:new Et(r,e.u_accent)}),mb=(r,e)=>({u_matrix:new te(r,e.u_matrix),u_image:new J(r,e.u_image),u_dimension:new ee(r,e.u_dimension),u_zoom:new V(r,e.u_zoom),u_unpack:new Tr(r,e.u_unpack)}),db=(r,e,t,i)=>{let n=t.paint.get("hillshade-shadow-color"),o=t.paint.get("hillshade-highlight-color"),a=t.paint.get("hillshade-accent-color"),s=t.paint.get("hillshade-illumination-direction")*(Math.PI/180);t.paint.get("hillshade-illumination-anchor")==="viewport"&&(s-=r.transform.angle);let l=!r.options.moving;return{u_matrix:i?i.posMatrix:r.transform.calculatePosMatrix(e.tileID.toUnwrapped(),l),u_image:0,u_latrange:DA(r,e.tileID),u_light:[t.paint.get("hillshade-exaggeration"),s],u_shadow:n,u_highlight:o,u_accent:a}},yb=(r,e)=>{let t=e.stride,i=N.create();return N.ortho(i,0,8192,-8192,0,0,1),N.translate(i,i,[0,-8192,0]),{u_matrix:i,u_image:1,u_dimension:[t,t],u_zoom:r.overscaledZ,u_unpack:e.getUnpackVector()}};function DA(r,e){let t=Math.pow(2,e.canonical.z),i=e.canonical.y;return[new ze(0,i/t).toLngLat().lat,new ze(0,(i+1)/t).toLngLat().lat]}m();var gb=(r,e)=>({u_matrix:new te(r,e.u_matrix),u_ratio:new V(r,e.u_ratio),u_device_pixel_ratio:new V(r,e.u_device_pixel_ratio),u_units_to_pixels:new ee(r,e.u_units_to_pixels)}),xb=(r,e)=>({u_matrix:new te(r,e.u_matrix),u_ratio:new V(r,e.u_ratio),u_device_pixel_ratio:new V(r,e.u_device_pixel_ratio),u_units_to_pixels:new ee(r,e.u_units_to_pixels),u_image:new J(r,e.u_image),u_image_height:new V(r,e.u_image_height)}),bb=(r,e)=>({u_matrix:new te(r,e.u_matrix),u_texsize:new ee(r,e.u_texsize),u_ratio:new V(r,e.u_ratio),u_device_pixel_ratio:new V(r,e.u_device_pixel_ratio),u_image:new J(r,e.u_image),u_units_to_pixels:new ee(r,e.u_units_to_pixels),u_scale:new lt(r,e.u_scale),u_fade:new V(r,e.u_fade)}),_b=(r,e)=>({u_matrix:new te(r,e.u_matrix),u_ratio:new V(r,e.u_ratio),u_device_pixel_ratio:new V(r,e.u_device_pixel_ratio),u_units_to_pixels:new ee(r,e.u_units_to_pixels),u_patternscale_a:new ee(r,e.u_patternscale_a),u_patternscale_b:new ee(r,e.u_patternscale_b),u_sdfgamma:new V(r,e.u_sdfgamma),u_image:new J(r,e.u_image),u_tex_y_a:new V(r,e.u_tex_y_a),u_tex_y_b:new V(r,e.u_tex_y_b),u_mix:new V(r,e.u_mix)}),Wl=(r,e,t,i)=>{let n=r.transform;return{u_matrix:Tb(r,e,t,i),u_ratio:1/je(e,1,n.zoom),u_device_pixel_ratio:r.pixelRatio,u_units_to_pixels:[1/n.pixelsToGLUnits[0],1/n.pixelsToGLUnits[1]]}},vb=(r,e,t,i,n)=>O(Wl(r,e,t,n),{u_image:0,u_image_height:i}),wb=(r,e,t,i,n)=>{let o=r.transform,a=Pb(e,o);return{u_matrix:Tb(r,e,t,n),u_texsize:e.imageAtlasTexture.size,u_ratio:1/je(e,1,o.zoom),u_device_pixel_ratio:r.pixelRatio,u_image:0,u_scale:[a,i.fromScale,i.toScale],u_fade:i.t,u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]]}},Sb=(r,e,t,i,n,o)=>{let a=r.transform,s=r.lineAtlas,l=Pb(e,a),u=t.layout.get("line-cap")==="round",c=s.getDash(i.from,u),p=s.getDash(i.to,u),h=c.width*n.fromScale,f=p.width*n.toScale;return O(Wl(r,e,t,o),{u_patternscale_a:[l/h,-c.height/2],u_patternscale_b:[l/f,-p.height/2],u_sdfgamma:s.width/(Math.min(h,f)*256*r.pixelRatio)/2,u_image:0,u_tex_y_a:c.y,u_tex_y_b:p.y,u_mix:n.t})};function Pb(r,e){return 1/je(r,1,e.tileZoom)}function Tb(r,e,t,i){return r.translatePosMatrix(i?i.posMatrix:e.tileID.posMatrix,e,t.paint.get("line-translate"),t.paint.get("line-translate-anchor"))}m();var Ab=(r,e)=>({u_matrix:new te(r,e.u_matrix),u_tl_parent:new ee(r,e.u_tl_parent),u_scale_parent:new V(r,e.u_scale_parent),u_buffer_scale:new V(r,e.u_buffer_scale),u_fade_t:new V(r,e.u_fade_t),u_opacity:new V(r,e.u_opacity),u_image0:new J(r,e.u_image0),u_image1:new J(r,e.u_image1),u_brightness_low:new V(r,e.u_brightness_low),u_brightness_high:new V(r,e.u_brightness_high),u_saturation_factor:new V(r,e.u_saturation_factor),u_contrast_factor:new V(r,e.u_contrast_factor),u_spin_weights:new lt(r,e.u_spin_weights)}),Mb=(r,e,t,i,n)=>({u_matrix:r,u_tl_parent:e,u_scale_parent:t,u_buffer_scale:1,u_fade_t:i.mix,u_opacity:i.opacity*n.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:n.paint.get("raster-brightness-min"),u_brightness_high:n.paint.get("raster-brightness-max"),u_saturation_factor:RA(n.paint.get("raster-saturation")),u_contrast_factor:FA(n.paint.get("raster-contrast")),u_spin_weights:zA(n.paint.get("raster-hue-rotate"))});function zA(r){r*=Math.PI/180;let e=Math.sin(r),t=Math.cos(r);return[(2*t+1)/3,(-Math.sqrt(3)*e-t+1)/3,(Math.sqrt(3)*e-t+1)/3]}function FA(r){return r>0?1/(1-r):1+r}function RA(r){return r>0?1-1/(1.001-r):-r}m();var Ib=(r,e)=>({u_is_size_zoom_constant:new J(r,e.u_is_size_zoom_constant),u_is_size_feature_constant:new J(r,e.u_is_size_feature_constant),u_size_t:new V(r,e.u_size_t),u_size:new V(r,e.u_size),u_camera_to_center_distance:new V(r,e.u_camera_to_center_distance),u_pitch:new V(r,e.u_pitch),u_rotate_symbol:new J(r,e.u_rotate_symbol),u_aspect_ratio:new V(r,e.u_aspect_ratio),u_fade_change:new V(r,e.u_fade_change),u_matrix:new te(r,e.u_matrix),u_label_plane_matrix:new te(r,e.u_label_plane_matrix),u_coord_matrix:new te(r,e.u_coord_matrix),u_is_text:new J(r,e.u_is_text),u_pitch_with_map:new J(r,e.u_pitch_with_map),u_texsize:new ee(r,e.u_texsize),u_texture:new J(r,e.u_texture)}),Cb=(r,e)=>({u_is_size_zoom_constant:new J(r,e.u_is_size_zoom_constant),u_is_size_feature_constant:new J(r,e.u_is_size_feature_constant),u_size_t:new V(r,e.u_size_t),u_size:new V(r,e.u_size),u_camera_to_center_distance:new V(r,e.u_camera_to_center_distance),u_pitch:new V(r,e.u_pitch),u_rotate_symbol:new J(r,e.u_rotate_symbol),u_aspect_ratio:new V(r,e.u_aspect_ratio),u_fade_change:new V(r,e.u_fade_change),u_matrix:new te(r,e.u_matrix),u_label_plane_matrix:new te(r,e.u_label_plane_matrix),u_coord_matrix:new te(r,e.u_coord_matrix),u_is_text:new J(r,e.u_is_text),u_pitch_with_map:new J(r,e.u_pitch_with_map),u_texsize:new ee(r,e.u_texsize),u_texture:new J(r,e.u_texture),u_gamma_scale:new V(r,e.u_gamma_scale),u_device_pixel_ratio:new V(r,e.u_device_pixel_ratio),u_is_halo:new J(r,e.u_is_halo)}),Eb=(r,e)=>({u_is_size_zoom_constant:new J(r,e.u_is_size_zoom_constant),u_is_size_feature_constant:new J(r,e.u_is_size_feature_constant),u_size_t:new V(r,e.u_size_t),u_size:new V(r,e.u_size),u_camera_to_center_distance:new V(r,e.u_camera_to_center_distance),u_pitch:new V(r,e.u_pitch),u_rotate_symbol:new J(r,e.u_rotate_symbol),u_aspect_ratio:new V(r,e.u_aspect_ratio),u_fade_change:new V(r,e.u_fade_change),u_matrix:new te(r,e.u_matrix),u_label_plane_matrix:new te(r,e.u_label_plane_matrix),u_coord_matrix:new te(r,e.u_coord_matrix),u_is_text:new J(r,e.u_is_text),u_pitch_with_map:new J(r,e.u_pitch_with_map),u_texsize:new ee(r,e.u_texsize),u_texsize_icon:new ee(r,e.u_texsize_icon),u_texture:new J(r,e.u_texture),u_texture_icon:new J(r,e.u_texture_icon),u_gamma_scale:new V(r,e.u_gamma_scale),u_device_pixel_ratio:new V(r,e.u_device_pixel_ratio),u_is_halo:new J(r,e.u_is_halo)}),bh=(r,e,t,i,n,o,a,s,l,u)=>{let c=n.transform;return{u_is_size_zoom_constant:+(r==="constant"||r==="source"),u_is_size_feature_constant:+(r==="constant"||r==="camera"),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:c.cameraToCenterDistance,u_pitch:c.pitch/360*2*Math.PI,u_rotate_symbol:+t,u_aspect_ratio:c.width/c.height,u_fade_change:n.options.fadeDuration?n.symbolFadeChange:1,u_matrix:o,u_label_plane_matrix:a,u_coord_matrix:s,u_is_text:+l,u_pitch_with_map:+i,u_texsize:u,u_texture:0}},_h=(r,e,t,i,n,o,a,s,l,u,c)=>{let p=n.transform;return O(bh(r,e,t,i,n,o,a,s,l,u),{u_gamma_scale:i?Math.cos(p._pitch)*p.cameraToCenterDistance:1,u_device_pixel_ratio:n.pixelRatio,u_is_halo:+c})},kb=(r,e,t,i,n,o,a,s,l,u)=>O(_h(r,e,t,i,n,o,a,s,!0,l,!0),{u_texsize_icon:u,u_texture_icon:1});m();var Lb=(r,e)=>({u_matrix:new te(r,e.u_matrix),u_opacity:new V(r,e.u_opacity),u_color:new Et(r,e.u_color)}),Db=(r,e)=>({u_matrix:new te(r,e.u_matrix),u_opacity:new V(r,e.u_opacity),u_image:new J(r,e.u_image),u_pattern_tl_a:new ee(r,e.u_pattern_tl_a),u_pattern_br_a:new ee(r,e.u_pattern_br_a),u_pattern_tl_b:new ee(r,e.u_pattern_tl_b),u_pattern_br_b:new ee(r,e.u_pattern_br_b),u_texsize:new ee(r,e.u_texsize),u_mix:new V(r,e.u_mix),u_pattern_size_a:new ee(r,e.u_pattern_size_a),u_pattern_size_b:new ee(r,e.u_pattern_size_b),u_scale_a:new V(r,e.u_scale_a),u_scale_b:new V(r,e.u_scale_b),u_pixel_coord_upper:new ee(r,e.u_pixel_coord_upper),u_pixel_coord_lower:new ee(r,e.u_pixel_coord_lower),u_tile_units_to_pixels:new V(r,e.u_tile_units_to_pixels)}),zb=(r,e,t)=>({u_matrix:r,u_opacity:e,u_color:t}),Fb=(r,e,t,i,n,o)=>O(jx(i,o,t,n),{u_matrix:r,u_opacity:e});var Rb={fillExtrusion:Zx,fillExtrusionPattern:Hx,fill:Xx,fillPattern:Kx,fillOutline:Jx,fillOutlinePattern:Yx,circle:tb,collisionBox:ib,collisionCircle:nb,debug:sb,clippingMask:lb,heatmap:ub,heatmapTexture:cb,hillshade:fb,hillshadePrepare:mb,line:gb,lineGradient:xb,linePattern:bb,lineSDF:_b,raster:Ab,symbolIcon:Ib,symbolSDF:Cb,symbolTextAndIcon:Eb,background:Lb,backgroundPattern:Db,terrain:Vx,terrainDepth:Ux,terrainCoords:Nx};m();m();var Xl=class{constructor(e,t,i){this.context=e;let n=e.gl;this.buffer=n.createBuffer(),this.dynamicDraw=!!i,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.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)}};m();var BA={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"},Kl=class{constructor(e,t,i,n){this.length=t.length,this.attributes=i,this.itemSize=t.bytesPerElement,this.dynamicDraw=n,this.context=e;let o=e.gl;this.buffer=o.createBuffer(),e.bindVertexBuffer.set(this.buffer),o.bufferData(o.ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?o.DYNAMIC_DRAW:o.STATIC_DRAW),this.dynamicDraw||delete t.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){if(e.length!==this.length)throw new Error(`Length of new data is ${e.length}, which doesn't match current length of ${this.length}`);let t=this.context.gl;this.bind(),t.bufferSubData(t.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,t){for(let i=0;i<this.attributes.length;i++){let n=this.attributes[i],o=t.attributes[n.name];o!==void 0&&e.enableVertexAttribArray(o)}}setVertexAttribPointers(e,t,i){for(let n=0;n<this.attributes.length;n++){let o=this.attributes[n],a=t.attributes[o.name];a!==void 0&&e.vertexAttribPointer(a,o.components,e[BA[o.type]],!1,this.itemSize,o.offset+this.itemSize*(i||0))}}destroy(){let e=this.context.gl;this.buffer&&(e.deleteBuffer(this.buffer),delete this.buffer)}};m();m();m();var vh=new WeakMap;function hn(r){if(vh.has(r))return vh.get(r);{let e=r.getParameter(r.VERSION)?.startsWith("WebGL 2.0");return vh.set(r,e),e}}var xe=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)}},Jl=class extends xe{getDefault(){return W.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)}},Yl=class extends xe{getDefault(){return 1}set(e){e===this.current&&!this.dirty||(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}},Ql=class extends xe{getDefault(){return 0}set(e){e===this.current&&!this.dirty||(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}},eu=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)}},tu=class extends xe{getDefault(){return!0}set(e){e===this.current&&!this.dirty||(this.gl.depthMask(e),this.current=e,this.dirty=!1)}},ru=class extends xe{getDefault(){return 255}set(e){e===this.current&&!this.dirty||(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}},iu=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)}},nu=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)}},ou=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}},au=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)}},su=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}},lu=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)}},uu=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}},cu=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)}},pu=class extends xe{getDefault(){return W.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)}},hu=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)}},fu=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}},mu=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)}},du=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)}},yu=class extends xe{getDefault(){return null}set(e){e===this.current&&!this.dirty||(this.gl.useProgram(e),this.current=e,this.dirty=!1)}},gu=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)}},xu=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)}},bu=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}},_u=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}},vu=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}},wu=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}},Su=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}},Pu=class extends xe{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;hn(t)?t.bindVertexArray(e):t.getExtension("OES_vertex_array_object")?.bindVertexArrayOES(e),this.current=e,this.dirty=!1}},Tu=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}},Au=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}},Mu=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}},sa=class extends xe{constructor(e,t){super(e),this.context=e,this.parent=t}getDefault(){return null}},Iu=class extends sa{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}},Cu=class extends sa{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}},Eu=class extends sa{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}};var ku=class{constructor(e,t,i,n,o){this.context=e,this.width=t,this.height=i;let a=e.gl,s=this.framebuffer=a.createFramebuffer();if(this.colorAttachment=new Iu(e,s),n)this.depthAttachment=o?new Eu(e,s):new Cu(e,s);else if(o)throw new Error("Stencil cannot be set without depth");if(a.checkFramebufferStatus(a.FRAMEBUFFER)!==a.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 i=this.depthAttachment.get();i&&e.deleteRenderbuffer(i)}e.deleteFramebuffer(this.framebuffer)}};m();var OA=0,Bb=1,VA=771,Ee=class{constructor(e,t,i){this.blendFunction=e,this.blendColor=t,this.mask=i}};Ee.Replace=[Bb,OA];Ee.disabled=new Ee(Ee.Replace,W.transparent,[!1,!1,!1,!1]);Ee.unblended=new Ee(Ee.Replace,W.transparent,[!0,!0,!0,!0]);Ee.alphaBlended=new Ee([Bb,VA],W.transparent,[!0,!0,!0,!0]);var Lu=class{constructor(e){if(this.gl=e,this.clearColor=new Jl(this),this.clearDepth=new Yl(this),this.clearStencil=new Ql(this),this.colorMask=new eu(this),this.depthMask=new tu(this),this.stencilMask=new ru(this),this.stencilFunc=new iu(this),this.stencilOp=new nu(this),this.stencilTest=new ou(this),this.depthRange=new au(this),this.depthTest=new su(this),this.depthFunc=new lu(this),this.blend=new uu(this),this.blendFunc=new cu(this),this.blendColor=new pu(this),this.blendEquation=new hu(this),this.cullFace=new fu(this),this.cullFaceSide=new mu(this),this.frontFace=new du(this),this.program=new yu(this),this.activeTexture=new gu(this),this.viewport=new xu(this),this.bindFramebuffer=new bu(this),this.bindRenderbuffer=new _u(this),this.bindTexture=new vu(this),this.bindVertexBuffer=new wu(this),this.bindElementBuffer=new Su(this),this.bindVertexArray=new Pu(this),this.pixelStoreUnpack=new Tu(this),this.pixelStoreUnpackPremultiplyAlpha=new Au(this),this.pixelStoreUnpackFlipY=new Mu(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),hn(e)){this.HALF_FLOAT=e.HALF_FLOAT;let t=e.getExtension("EXT_color_buffer_half_float");this.RGBA16F=e.RGBA16F??t?.RGBA16F_EXT,this.RGB16F=e.RGB16F??t?.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=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 Xl(this,e,t)}createVertexBuffer(e,t,i){return new Kl(this,e,t,i)}createRenderbuffer(e,t,i){let n=this.gl,o=n.createRenderbuffer();return this.bindRenderbuffer.set(o),n.renderbufferStorage(n.RENDERBUFFER,e,t,i),this.bindRenderbuffer.set(null),o}createFramebuffer(e,t,i,n){return new ku(this,e,t,i,n)}clear({color:e,depth:t,stencil:i}){let n=this.gl,o=0;e&&(o|=n.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),typeof t<"u"&&(o|=n.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(t),this.depthMask.set(!0)),typeof i<"u"&&(o|=n.STENCIL_BUFFER_BIT,this.clearStencil.set(i),this.stencilMask.set(255)),n.clear(o)}setCullFace(e){e.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}setDepthMode(e){e.func===this.gl.ALWAYS&&!e.mask?this.depthTest.set(!1):(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range))}setStencilMode(e){e.test.func===this.gl.ALWAYS&&!e.mask?this.stencilTest.set(!1):(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask}))}setColorMode(e){Xt(e.blendFunction,Ee.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)}createVertexArray(){return hn(this.gl)?this.gl.createVertexArray():this.gl.getExtension("OES_vertex_array_object")?.createVertexArrayOES()}deleteVertexArray(e){return hn(this.gl)?this.gl.deleteVertexArray(e):this.gl.getExtension("OES_vertex_array_object")?.deleteVertexArrayOES(e)}unbindVAO(){this.bindVertexArray.set(null)}};m();var Y=class{constructor(e,t,i){this.func=e,this.mask=t,this.range=i}};Y.ReadOnly=!1;Y.ReadWrite=!0;Y.disabled=new Y(519,Y.ReadOnly,[0,1]);m();var pe=class{constructor(e,t,i,n,o,a){this.test=e,this.ref=t,this.mask=i,this.fail=n,this.depthFail=o,this.pass=a}};pe.disabled=new pe({func:519,mask:0},0,0,7680,7680,7680);m();var se=class{constructor(e,t,i){this.enable=e,this.mode=t,this.frontFace=i}};se.disabled=new se(!1,1029,2305);se.backCCW=new se(!0,1029,2305);m();var Sh=ne(ye(),1);m();var Du;function wh(r,e,t,i,n,o,a){let s=r.context,l=s.gl,u=r.useProgram("collisionBox"),c=[],p=0,h=0;for(let v=0;v<i.length;v++){let b=i[v],w=e.getTile(b),S=w.getBucket(t);if(!S)continue;let P=b.posMatrix;(n[0]!==0||n[1]!==0)&&(P=r.translatePosMatrix(b.posMatrix,w,n,o));let I=a?S.textCollisionBox:S.iconCollisionBox,k=S.collisionCircleArray;if(k.length>0){let C=N.create(),T=P;N.mul(C,S.placementInvProjMatrix,r.transform.glCoordMatrix),N.mul(C,C,S.placementViewportMatrix),c.push({circleArray:k,circleOffset:h,transform:T,invTransform:C,coord:b}),p+=k.length/4,h=p}I&&u.draw(s,l.LINES,Y.disabled,pe.disabled,r.colorModeForRenderPass(),se.disabled,ob(P,r.transform,w),r.style.map.terrain&&r.style.map.terrain.getTerrainData(b),t.id,I.layoutVertexBuffer,I.indexBuffer,I.segments,null,r.transform.zoom,null,null,I.collisionVertexBuffer)}if(!a||!c.length)return;let f=r.useProgram("collisionCircle"),d=new zs;d.resize(p*4),d._trim();let y=0;for(let v of c)for(let b=0;b<v.circleArray.length/4;b++){let w=b*4,S=v.circleArray[w+0],P=v.circleArray[w+1],I=v.circleArray[w+2],k=v.circleArray[w+3];d.emplace(y++,S,P,I,k,0),d.emplace(y++,S,P,I,k,1),d.emplace(y++,S,P,I,k,2),d.emplace(y++,S,P,I,k,3)}(!Du||Du.length<p*2)&&(Du=UA(p));let g=s.createIndexBuffer(Du,!0),x=s.createVertexBuffer(d,Iy.members,!0);for(let v of c){let b=ab(v.transform,v.invTransform,r.transform);f.draw(s,l.TRIANGLES,Y.disabled,pe.disabled,r.colorModeForRenderPass(),se.disabled,b,r.style.map.terrain&&r.style.map.terrain.getTerrainData(v.coord),t.id,x,g,he.simpleSegment(0,v.circleOffset*2,v.circleArray.length,v.circleArray.length/2),null,r.transform.zoom,null,null,null)}x.destroy(),g.destroy()}function UA(r){let e=r*2,t=new Rs;t.resize(e),t._trim();for(let i=0;i<e;i++){let n=i*6;t.uint16[n+0]=i*4+0,t.uint16[n+1]=i*4+1,t.uint16[n+2]=i*4+2,t.uint16[n+3]=i*4+2,t.uint16[n+4]=i*4+3,t.uint16[n+5]=i*4+0}return t}var NA=N.identity(new Float32Array(16));function Ub(r,e,t,i,n){if(r.renderPass!=="translucent")return;let o=pe.disabled,a=r.colorModeForRenderPass();(t._unevaluatedLayout.hasValue("text-variable-anchor")||t._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&$A(i,r,t,e,t.layout.get("text-rotation-alignment"),t.layout.get("text-pitch-alignment"),n),t.paint.get("icon-opacity").constantOr(1)!==0&&Ob(r,e,t,i,!1,t.paint.get("icon-translate"),t.paint.get("icon-translate-anchor"),t.layout.get("icon-rotation-alignment"),t.layout.get("icon-pitch-alignment"),t.layout.get("icon-keep-upright"),o,a),t.paint.get("text-opacity").constantOr(1)!==0&&Ob(r,e,t,i,!0,t.paint.get("text-translate"),t.paint.get("text-translate-anchor"),t.layout.get("text-rotation-alignment"),t.layout.get("text-pitch-alignment"),t.layout.get("text-keep-upright"),o,a),e.map.showCollisionBoxes&&(wh(r,e,t,i,t.paint.get("text-translate"),t.paint.get("text-translate-anchor"),!0),wh(r,e,t,i,t.paint.get("icon-translate"),t.paint.get("icon-translate-anchor"),!1))}function GA(r,e,t,i,n,o){let{horizontalAlign:a,verticalAlign:s}=al(r),l=-(a-.5)*e,u=-(s-.5)*t;return new Sh.default((l/n+i[0])*o,(u/n+i[1])*o)}function $A(r,e,t,i,n,o,a){let s=e.transform,l=n==="map",u=o==="map";for(let c of r){let p=i.getTile(c),h=p.getBucket(t);if(!h||!h.text||!h.text.segments.get().length)continue;let f=h.textSizeData,d=si(f,s.zoom),y=je(p,1,e.transform.zoom),g=Yo(c.posMatrix,u,l,e.transform,y),x=t.layout.get("icon-text-fit")!=="none"&&h.hasIconData();if(d){let v=Math.pow(2,s.zoom-p.tileID.overscaledZ),b=e.style.map.terrain?(w,S)=>e.style.map.terrain.getElevation(c,w,S):null;qA(h,l,u,a,s,g,c.posMatrix,v,d,x,b)}}}function qA(r,e,t,i,n,o,a,s,l,u,c){let p=r.text.placedSymbolArray,h=r.text.dynamicLayoutVertexArray,f=r.icon.dynamicLayoutVertexArray,d={};h.clear();for(let y=0;y<p.length;y++){let g=p.get(y),x=r.allowVerticalPlacement&&!g.placedOrientation,v=!g.hidden&&g.crossTileID&&!x?i[g.crossTileID]:null;if(!v)ci(g.numGlyphs,h);else{let b=new Sh.default(g.anchorX,g.anchorY),w=xt(b,t?a:o,c),S=Qo(n.cameraToCenterDistance,w.signedDistanceFromCamera),P=Qi(r.textSizeData,l,g)*S/Cr;t&&(P*=r.tilePixelRatio/s);let{width:I,height:k,anchor:C,textOffset:T,textBoxScale:D}=v,F=GA(C,I,k,T,D,P),E=t?xt(b.add(F),o,c).point:w.point.add(e?F.rotate(-n.angle):F),A=r.allowVerticalPlacement&&g.placedOrientation===2?Math.PI/2:0;for(let $=0;$<g.numGlyphs;$++)li(h,E,A);u&&g.associatedIconIndex>=0&&(d[g.associatedIconIndex]={shiftedAnchor:E,angle:A})}}if(u){f.clear();let y=r.icon.placedSymbolArray;for(let g=0;g<y.length;g++){let x=y.get(g);if(x.hidden)ci(x.numGlyphs,f);else{let v=d[g];if(!v)ci(x.numGlyphs,f);else for(let b=0;b<x.numGlyphs;b++)li(f,v.shiftedAnchor,v.angle)}}r.icon.dynamicLayoutVertexBuffer.updateData(f)}r.text.dynamicLayoutVertexBuffer.updateData(h)}function jA(r,e,t){return t.iconsInText&&e?"symbolTextAndIcon":r?"symbolSDF":"symbolIcon"}function Ob(r,e,t,i,n,o,a,s,l,u,c,p){let h=r.context,f=h.gl,d=r.transform,y=s==="map",g=l==="map",x=s!=="viewport"&&t.layout.get("symbol-placement")!=="point",v=y&&!g&&!x,b=!t.layout.get("symbol-sort-key").isConstant(),w=!1,S=r.depthModeForSublayer(0,Y.ReadOnly),P=t._unevaluatedLayout.hasValue("text-variable-anchor")||t._unevaluatedLayout.hasValue("text-variable-anchor-offset"),I=[];for(let k of i){let C=e.getTile(k),T=C.getBucket(t);if(!T)continue;let D=n?T.text:T.icon;if(!D||!D.segments.get().length||!D.hasVisibleVertices)continue;let F=D.programConfigurations.get(t.id),E=n||T.sdfIcons,A=n?T.textSizeData:T.iconSizeData,$=g||d.pitch!==0,X=r.useProgram(jA(E,n,T),F),j=si(A,d.zoom),fe=r.style.map.terrain&&r.style.map.terrain.getTerrainData(k),Q,nt=[0,0],We,le,Te=null,Qe;if(n){if(We=C.glyphAtlasTexture,le=f.LINEAR,Q=C.glyphAtlasTexture.size,T.iconsInText){nt=C.imageAtlasTexture.size,Te=C.imageAtlasTexture;let at=A.kind==="composite"||A.kind==="camera";Qe=$||r.options.rotating||r.options.zooming||at?f.LINEAR:f.NEAREST}}else{let at=t.layout.get("icon-size").constantOr(0)!==1||T.iconsNeedLinear;We=C.imageAtlasTexture,le=E||r.options.rotating||r.options.zooming||at||$?f.LINEAR:f.NEAREST,Q=C.imageAtlasTexture.size}let cr=je(C,1,r.transform.zoom),pr=Yo(k.posMatrix,g,y,r.transform,cr),Dt=Dl(k.posMatrix,g,y,r.transform,cr),Wt=P&&T.hasTextData(),Br=t.layout.get("icon-text-fit")!=="none"&&Wt&&T.hasIconData();if(x){let at=r.style.map.terrain?(yi,Ke)=>r.style.map.terrain.getElevation(k,yi,Ke):null,Ot=t.layout.get("text-rotation-alignment")==="map";Mg(T,k.posMatrix,r,n,pr,Dt,g,u,Ot,at)}let et=r.translatePosMatrix(k.posMatrix,C,o,a),$e=x||n&&P||Br?NA:pr,Xe=r.translatePosMatrix(Dt,C,o,a,!0),di=E&&t.paint.get(n?"text-halo-width":"icon-halo-width").constantOr(1)!==0,tt;E?T.iconsInText?tt=kb(A.kind,j,v,g,r,et,$e,Xe,Q,nt):tt=_h(A.kind,j,v,g,r,et,$e,Xe,n,Q,!0):tt=bh(A.kind,j,v,g,r,et,$e,Xe,n,Q);let Pt={program:X,buffers:D,uniformValues:tt,atlasTexture:We,atlasTextureIcon:Te,atlasInterpolation:le,atlasInterpolationIcon:Qe,isSDF:E,hasHalo:di};if(b&&T.canOverlap){w=!0;let at=D.segments.get();for(let Ot of at)I.push({segments:new he([Ot]),sortKey:Ot.sortKey,state:Pt,terrainData:fe})}else I.push({segments:D.segments,sortKey:0,state:Pt,terrainData:fe})}w&&I.sort((k,C)=>k.sortKey-C.sortKey);for(let k of I){let C=k.state;if(h.activeTexture.set(f.TEXTURE0),C.atlasTexture.bind(C.atlasInterpolation,f.CLAMP_TO_EDGE),C.atlasTextureIcon&&(h.activeTexture.set(f.TEXTURE1),C.atlasTextureIcon&&C.atlasTextureIcon.bind(C.atlasInterpolationIcon,f.CLAMP_TO_EDGE)),C.isSDF){let T=C.uniformValues;C.hasHalo&&(T.u_is_halo=1,Vb(C.buffers,k.segments,t,r,C.program,S,c,p,T,k.terrainData)),T.u_is_halo=0}Vb(C.buffers,k.segments,t,r,C.program,S,c,p,C.uniformValues,k.terrainData)}}function Vb(r,e,t,i,n,o,a,s,l,u){let c=i.context,p=c.gl;n.draw(c,p.TRIANGLES,o,a,s,se.disabled,l,u,t.id,r.layoutVertexBuffer,r.indexBuffer,e,t.paint,i.transform.zoom,r.programConfigurations.get(t.id),r.dynamicLayoutVertexBuffer,r.opacityVertexBuffer)}m();function Nb(r,e,t,i){if(r.renderPass!=="translucent")return;let n=t.paint.get("circle-opacity"),o=t.paint.get("circle-stroke-width"),a=t.paint.get("circle-stroke-opacity"),s=!t.layout.get("circle-sort-key").isConstant();if(n.constantOr(1)===0&&(o.constantOr(1)===0||a.constantOr(1)===0))return;let l=r.context,u=l.gl,c=r.depthModeForSublayer(0,Y.ReadOnly),p=pe.disabled,h=r.colorModeForRenderPass(),f=[];for(let d=0;d<i.length;d++){let y=i[d],g=e.getTile(y),x=g.getBucket(t);if(!x)continue;let v=x.programConfigurations.get(t.id),b=r.useProgram("circle",v),w=x.layoutVertexBuffer,S=x.indexBuffer,P=r.style.map.terrain&&r.style.map.terrain.getTerrainData(y),I=rb(r,y,g,t),k={programConfiguration:v,program:b,layoutVertexBuffer:w,indexBuffer:S,uniformValues:I,terrainData:P};if(s){let C=x.segments.get();for(let T of C)f.push({segments:new he([T]),sortKey:T.sortKey,state:k})}else f.push({segments:x.segments,sortKey:0,state:k})}s&&f.sort((d,y)=>d.sortKey-y.sortKey);for(let d of f){let{programConfiguration:y,program:g,layoutVertexBuffer:x,indexBuffer:v,uniformValues:b,terrainData:w}=d.state,S=d.segments;g.draw(l,u.TRIANGLES,c,p,h,se.disabled,b,w,t.id,x,v,S,t.paint,r.transform.zoom,y)}}m();function Gb(r,e,t,i){if(t.paint.get("heatmap-opacity")!==0)if(r.renderPass==="offscreen"){let n=r.context,o=n.gl,a=pe.disabled,s=new Ee([o.ONE,o.ONE],W.transparent,[!0,!0,!0,!0]);ZA(n,r,t),n.clear({color:W.transparent});for(let l=0;l<i.length;l++){let u=i[l];if(e.hasRenderableParent(u))continue;let c=e.getTile(u),p=c.getBucket(t);if(!p)continue;let h=p.programConfigurations.get(t.id),f=r.useProgram("heatmap",h),{zoom:d}=r.transform;f.draw(n,o.TRIANGLES,Y.disabled,a,s,se.disabled,pb(u.posMatrix,c,d,t.paint.get("heatmap-intensity")),null,t.id,p.layoutVertexBuffer,p.indexBuffer,p.segments,t.paint,r.transform.zoom,h)}n.viewport.set([0,0,r.width,r.height])}else r.renderPass==="translucent"&&(r.context.setColorMode(r.colorModeForRenderPass()),WA(r,t))}function ZA(r,e,t){let i=r.gl;r.activeTexture.set(i.TEXTURE1),r.viewport.set([0,0,e.width/4,e.height/4]);let n=t.heatmapFbo;if(n)i.bindTexture(i.TEXTURE_2D,n.colorAttachment.get()),r.bindFramebuffer.set(n.framebuffer);else{let o=i.createTexture();i.bindTexture(i.TEXTURE_2D,o),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),n=t.heatmapFbo=r.createFramebuffer(e.width/4,e.height/4,!1,!1),HA(r,e,o,n)}}function HA(r,e,t,i){let n=r.gl,o=r.HALF_FLOAT??n.UNSIGNED_BYTE,a=r.RGBA16F??n.RGBA;n.texImage2D(n.TEXTURE_2D,0,a,e.width/4,e.height/4,0,n.RGBA,o,null),i.colorAttachment.set(t)}function WA(r,e){let t=r.context,i=t.gl,n=e.heatmapFbo;if(!n)return;t.activeTexture.set(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,n.colorAttachment.get()),t.activeTexture.set(i.TEXTURE1);let o=e.colorRampTexture;o||(o=e.colorRampTexture=new _e(t,e.colorRamp,i.RGBA)),o.bind(i.LINEAR,i.CLAMP_TO_EDGE),r.useProgram("heatmapTexture").draw(t,i.TRIANGLES,Y.disabled,pe.disabled,r.colorModeForRenderPass(),se.disabled,hb(r,e,0,1),null,e.id,r.viewportBuffer,r.quadTriangleIndexBuffer,r.viewportSegments,e.paint,r.transform.zoom)}m();function $b(r,e,t,i){if(r.renderPass!=="translucent")return;let n=t.paint.get("line-opacity"),o=t.paint.get("line-width");if(n.constantOr(1)===0||o.constantOr(1)===0)return;let a=r.depthModeForSublayer(0,Y.ReadOnly),s=r.colorModeForRenderPass(),l=t.paint.get("line-dasharray"),u=t.paint.get("line-pattern"),c=u.constantOr(1),p=t.paint.get("line-gradient"),h=t.getCrossfadeParameters(),f=c?"linePattern":l?"lineSDF":p?"lineGradient":"line",d=r.context,y=d.gl,g=!0;for(let x of i){let v=e.getTile(x);if(c&&!v.patternsLoaded())continue;let b=v.getBucket(t);if(!b)continue;let w=b.programConfigurations.get(t.id),S=r.context.program.get(),P=r.useProgram(f,w),I=g||P.program!==S,k=r.style.map.terrain&&r.style.map.terrain.getTerrainData(x),C=u.constantOr(null);if(C&&v.imageAtlas){let F=v.imageAtlas,E=F.patternPositions[C.to.toString()],A=F.patternPositions[C.from.toString()];E&&A&&w.setConstantPatternPositions(E,A)}let T=k?x:null,D=c?wb(r,v,t,h,T):l?Sb(r,v,t,l,h,T):p?vb(r,v,t,b.lineClipsArray.length,T):Wl(r,v,t,T);if(c)d.activeTexture.set(y.TEXTURE0),v.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),w.updatePaintBuffers(h);else if(l&&(I||r.lineAtlas.dirty))d.activeTexture.set(y.TEXTURE0),r.lineAtlas.bind(d);else if(p){let F=b.gradients[t.id],E=F.texture;if(t.gradientVersion!==F.version){let A=256;if(t.stepInterpolant){let $=e.getSource().maxzoom,X=x.canonical.z===$?Math.ceil(1<<r.transform.maxZoom-x.canonical.z):1,Q=b.maxLineLength/8192*1024*X;A=Ae(sf(Q),256,d.maxTextureSize)}F.gradient=js({expression:t.gradientExpression(),evaluationKey:"lineProgress",resolution:A,image:F.gradient||void 0,clips:b.lineClipsArray}),F.texture?F.texture.update(F.gradient):F.texture=new _e(d,F.gradient,y.RGBA),F.version=t.gradientVersion,E=F.texture}d.activeTexture.set(y.TEXTURE0),E.bind(t.stepInterpolant?y.NEAREST:y.LINEAR,y.CLAMP_TO_EDGE)}P.draw(d,y.TRIANGLES,a,r.stencilModeForClipping(x),s,se.disabled,D,k,t.id,b.layoutVertexBuffer,b.indexBuffer,b.segments,t.paint,r.transform.zoom,w,b.layoutVertexBuffer2),g=!1}}m();m();function zu(r,e,t,i,n){if(!t||!i||!i.imageAtlas)return;let o=i.imageAtlas.patternPositions,a=o[t.to.toString()],s=o[t.from.toString()];if(!a&&s&&(a=s),!s&&a&&(s=a),!a||!s){let l=n.getPaintProperty(e);a=o[l],s=o[l]}a&&s&&r.setConstantPatternPositions(a,s)}function jb(r,e,t,i){let n=t.paint.get("fill-color"),o=t.paint.get("fill-opacity");if(o.constantOr(1)===0)return;let a=r.colorModeForRenderPass(),s=t.paint.get("fill-pattern"),l=r.opaquePassEnabledForLayer()&&!s.constantOr(1)&&n.constantOr(W.transparent).a===1&&o.constantOr(0)===1?"opaque":"translucent";if(r.renderPass===l){let u=r.depthModeForSublayer(1,r.renderPass==="opaque"?Y.ReadWrite:Y.ReadOnly);qb(r,e,t,i,u,a,!1)}if(r.renderPass==="translucent"&&t.paint.get("fill-antialias")){let u=r.depthModeForSublayer(t.getPaintProperty("fill-outline-color")?2:0,Y.ReadOnly);qb(r,e,t,i,u,a,!0)}}function qb(r,e,t,i,n,o,a){let s=r.context.gl,l="fill-pattern",u=t.paint.get(l),c=u&&u.constantOr(1),p=t.getCrossfadeParameters(),h,f,d,y,g;a?(f=c&&!t.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",h=s.LINES):(f=c?"fillPattern":"fill",h=s.TRIANGLES);let x=u.constantOr(null);for(let v of i){let b=e.getTile(v);if(c&&!b.patternsLoaded())continue;let w=b.getBucket(t);if(!w)continue;let S=w.programConfigurations.get(t.id),P=r.useProgram(f,S),I=r.style.map.terrain&&r.style.map.terrain.getTerrainData(v);c&&(r.context.activeTexture.set(s.TEXTURE0),b.imageAtlasTexture.bind(s.LINEAR,s.CLAMP_TO_EDGE),S.updatePaintBuffers(p)),zu(S,l,x,b,t);let k=I?v:null,C=k?k.posMatrix:v.posMatrix,T=r.translatePosMatrix(C,b,t.paint.get("fill-translate"),t.paint.get("fill-translate-anchor"));if(!a)y=w.indexBuffer,g=w.segments,d=c?yh(T,r,p,b):dh(T);else{y=w.indexBuffer2,g=w.segments2;let D=[s.drawingBufferWidth,s.drawingBufferHeight];d=f==="fillOutlinePattern"&&c?eb(T,r,p,b,D):Qx(T,D)}P.draw(r.context,h,n,r.stencilModeForClipping(v),o,se.disabled,d,I,t.id,w.layoutVertexBuffer,y,g,t.paint,r.transform.zoom,S)}}m();function Zb(r,e,t,i){let n=t.paint.get("fill-extrusion-opacity");if(n!==0&&r.renderPass==="translucent"){let o=new Y(r.context.gl.LEQUAL,Y.ReadWrite,r.depthRangeFor3D);if(n===1&&!t.paint.get("fill-extrusion-pattern").constantOr(1)){let a=r.colorModeForRenderPass();Ph(r,e,t,i,o,pe.disabled,a)}else Ph(r,e,t,i,o,pe.disabled,Ee.disabled),Ph(r,e,t,i,o,r.stencilModeFor3D(),r.colorModeForRenderPass())}}function Ph(r,e,t,i,n,o,a){let s=r.context,l=s.gl,u="fill-extrusion-pattern",c=t.paint.get(u),p=c.constantOr(1),h=t.getCrossfadeParameters(),f=t.paint.get("fill-extrusion-opacity"),d=c.constantOr(null);for(let y of i){let g=e.getTile(y),x=g.getBucket(t);if(!x)continue;let v=r.style.map.terrain&&r.style.map.terrain.getTerrainData(y),b=x.programConfigurations.get(t.id),w=r.useProgram(p?"fillExtrusionPattern":"fillExtrusion",b);p&&(r.context.activeTexture.set(l.TEXTURE0),g.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),b.updatePaintBuffers(h)),zu(b,u,d,g,t);let S=r.translatePosMatrix(y.posMatrix,g,t.paint.get("fill-extrusion-translate"),t.paint.get("fill-extrusion-translate-anchor")),P=t.paint.get("fill-extrusion-vertical-gradient"),I=p?Wx(S,r,P,f,y,h,g):mh(S,r,P,f);w.draw(s,s.gl.TRIANGLES,n,o,a,se.backCCW,I,v,t.id,x.layoutVertexBuffer,x.indexBuffer,x.segments,t.paint,r.transform.zoom,b,r.style.map.terrain&&x.centroidVertexBuffer)}}m();function Hb(r,e,t,i){if(r.renderPass!=="offscreen"&&r.renderPass!=="translucent")return;let n=r.context,o=r.depthModeForSublayer(0,Y.ReadOnly),a=r.colorModeForRenderPass(),[s,l]=r.renderPass==="translucent"?r.stencilConfigForOverlap(i):[{},i];for(let u of l){let c=e.getTile(u);typeof c.needsHillshadePrepare<"u"&&c.needsHillshadePrepare&&r.renderPass==="offscreen"?KA(r,c,t,o,pe.disabled,a):r.renderPass==="translucent"&&XA(r,u,c,t,o,s[u.overscaledZ],a)}n.viewport.set([0,0,r.width,r.height])}function XA(r,e,t,i,n,o,a){let s=r.context,l=s.gl,u=t.fbo;if(!u)return;let c=r.useProgram("hillshade"),p=r.style.map.terrain&&r.style.map.terrain.getTerrainData(e);s.activeTexture.set(l.TEXTURE0),l.bindTexture(l.TEXTURE_2D,u.colorAttachment.get());let h=p?e:null;c.draw(s,l.TRIANGLES,n,o,a,se.disabled,db(r,t,i,h),p,i.id,r.rasterBoundsBuffer,r.quadTriangleIndexBuffer,r.rasterBoundsSegments)}function KA(r,e,t,i,n,o){let a=r.context,s=a.gl,l=e.dem;if(l&&l.data){let u=l.dim,c=l.stride,p=l.getPixels();if(a.activeTexture.set(s.TEXTURE1),a.pixelStoreUnpackPremultiplyAlpha.set(!1),e.demTexture=e.demTexture||r.getTileTexture(c),e.demTexture){let f=e.demTexture;f.update(p,{premultiply:!1}),f.bind(s.NEAREST,s.CLAMP_TO_EDGE)}else e.demTexture=new _e(a,p,s.RGBA,{premultiply:!1}),e.demTexture.bind(s.NEAREST,s.CLAMP_TO_EDGE);a.activeTexture.set(s.TEXTURE0);let h=e.fbo;if(!h){let f=new _e(a,{width:u,height:u,data:null},s.RGBA);f.bind(s.LINEAR,s.CLAMP_TO_EDGE),h=e.fbo=a.createFramebuffer(u,u,!0,!1),h.colorAttachment.set(f.texture)}a.bindFramebuffer.set(h.framebuffer),a.viewport.set([0,0,u,u]),r.useProgram("hillshadePrepare").draw(a,s.TRIANGLES,i,n,o,se.disabled,yb(e.tileID,l),null,t.id,r.rasterBoundsBuffer,r.quadTriangleIndexBuffer,r.rasterBoundsSegments),e.needsHillshadePrepare=!1}}m();function Wb(r,e,t,i){if(r.renderPass!=="translucent"||t.paint.get("raster-opacity")===0||!i.length)return;let n=r.context,o=n.gl,a=e.getSource(),s=r.useProgram("raster"),l=r.colorModeForRenderPass(),[u,c]=a instanceof kt?[{},i]:r.stencilConfigForOverlap(i),p=c[c.length-1].overscaledZ,h=!r.options.moving;for(let f of c){let d=r.depthModeForSublayer(f.overscaledZ-p,t.paint.get("raster-opacity")===1?Y.ReadWrite:Y.ReadOnly,o.LESS),y=e.getTile(f);y.registerFadeDuration(t.paint.get("raster-fade-duration"));let g=e.findLoadedParent(f,0),x=JA(y,g,e,t,r.transform,r.style.map.terrain),v,b,w=t.paint.get("raster-resampling")==="nearest"?o.NEAREST:o.LINEAR;n.activeTexture.set(o.TEXTURE0),y.texture.bind(w,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST),n.activeTexture.set(o.TEXTURE1),g?(g.texture.bind(w,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST),v=Math.pow(2,g.tileID.overscaledZ-y.tileID.overscaledZ),b=[y.tileID.canonical.x*v%1,y.tileID.canonical.y*v%1]):y.texture.bind(w,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST);let S=r.style.map.terrain&&r.style.map.terrain.getTerrainData(f),P=S?f:null,I=P?P.posMatrix:r.transform.calculatePosMatrix(f.toUnwrapped(),h),k=Mb(I,b||[0,0],v||1,x,t);a instanceof kt?s.draw(n,o.TRIANGLES,d,pe.disabled,l,se.disabled,k,S,t.id,a.boundsBuffer,r.quadTriangleIndexBuffer,a.boundsSegments):s.draw(n,o.TRIANGLES,d,u[f.overscaledZ],l,se.disabled,k,S,t.id,r.rasterBoundsBuffer,r.quadTriangleIndexBuffer,r.rasterBoundsSegments)}}function JA(r,e,t,i,n,o){let a=i.paint.get("raster-fade-duration");if(!o&&a>0){let s=K.now(),l=(s-r.timeAdded)/a,u=e?(s-e.timeAdded)/a:-1,c=t.getSource(),p=n.coveringZoomLevel({tileSize:c.tileSize,roundZoom:c.roundZoom}),h=!e||Math.abs(e.tileID.overscaledZ-p)>Math.abs(r.tileID.overscaledZ-p),f=h&&r.refreshedUponExpiration?1:Ae(h?l:1-u,0,1);return r.refreshedUponExpiration&&l>=1&&(r.refreshedUponExpiration=!1),e?{opacity:1,mix:1-f}:{opacity:f,mix:0}}else return{opacity:1,mix:0}}m();function Xb(r,e,t,i){let n=t.paint.get("background-color"),o=t.paint.get("background-opacity");if(o===0)return;let a=r.context,s=a.gl,l=r.transform,u=l.tileSize,c=t.paint.get("background-pattern");if(r.isPatternMissing(c))return;let p=!c&&n.a===1&&o===1&&r.opaquePassEnabledForLayer()?"opaque":"translucent";if(r.renderPass!==p)return;let h=pe.disabled,f=r.depthModeForSublayer(0,p==="opaque"?Y.ReadWrite:Y.ReadOnly),d=r.colorModeForRenderPass(),y=r.useProgram(c?"backgroundPattern":"background"),g=i||l.coveringTiles({tileSize:u,terrain:r.style.map.terrain});c&&(a.activeTexture.set(s.TEXTURE0),r.imageManager.bind(r.context));let x=t.getCrossfadeParameters();for(let v of g){let b=i?v.posMatrix:r.transform.calculatePosMatrix(v.toUnwrapped()),w=c?Fb(b,o,r,c,{tileID:v,tileSize:u},x):zb(b,o,n),S=r.style.map.terrain&&r.style.map.terrain.getTerrainData(v);y.draw(a,s.TRIANGLES,f,h,d,se.disabled,w,S,t.id,r.tileExtentBuffer,r.quadTriangleIndexBuffer,r.tileExtentSegments)}}m();var YA=new W(1,0,0,1),QA=new W(0,1,0,1),eM=new W(0,0,1,1),tM=new W(1,0,1,1),rM=new W(0,1,1,1);function Yb(r){let e=r.transform.padding,t=3;Kb(r,r.transform.height-(e.top||0),t,YA),Kb(r,e.bottom||0,t,QA),Jb(r,e.left||0,t,eM),Jb(r,r.transform.width-(e.right||0),t,tM);let i=r.transform.centerPoint;iM(r,i.x,r.transform.height-i.y,rM)}function iM(r,e,t,i){Fu(r,e-2/2,t-20/2,2,20,i),Fu(r,e-20/2,t-2/2,20,2,i)}function Kb(r,e,t,i){Fu(r,0,e+t/2,r.transform.width,t,i)}function Jb(r,e,t,i){Fu(r,e-t/2,0,t,r.transform.height,i)}function Fu(r,e,t,i,n,o){let a=r.context,s=a.gl;s.enable(s.SCISSOR_TEST),s.scissor(e*r.pixelRatio,t*r.pixelRatio,i*r.pixelRatio,n*r.pixelRatio),a.clear({color:o}),s.disable(s.SCISSOR_TEST)}function Qb(r,e,t){for(let i=0;i<t.length;i++)nM(r,e,t[i])}function nM(r,e,t){let i=r.context,n=i.gl,o=t.posMatrix,a=r.useProgram("debug"),s=Y.disabled,l=pe.disabled,u=r.colorModeForRenderPass(),c="$debug",p=r.style.map.terrain&&r.style.map.terrain.getTerrainData(t);i.activeTexture.set(n.TEXTURE0);let h=e.getTileByID(t.key).latestRawTileData,f=h&&h.byteLength||0,d=Math.floor(f/1024),y=e.getTile(t).tileSize,g=512/Math.min(y,512)*(t.overscaledZ/r.transform.zoom)*.5,x=t.canonical.toString();t.overscaledZ!==t.canonical.z&&(x+=` => ${t.overscaledZ}`);let v=`${x} ${d}kB`;oM(r,v),a.draw(i,n.TRIANGLES,s,l,Ee.alphaBlended,se.disabled,gh(o,W.transparent,g),null,c,r.debugBuffer,r.quadTriangleIndexBuffer,r.debugSegments),a.draw(i,n.LINE_STRIP,s,l,u,se.disabled,gh(o,W.red),p,c,r.debugBuffer,r.tileBorderIndexBuffer,r.debugSegments)}function oM(r,e){r.initDebugOverlayCanvas();let t=r.debugOverlayCanvas,i=r.context.gl,n=r.debugOverlayCanvas.getContext("2d");n.clearRect(0,0,t.width,t.height),n.shadowColor="white",n.shadowBlur=2,n.lineWidth=1.5,n.strokeStyle="white",n.textBaseline="top",n.font="bold 36px Open Sans, sans-serif",n.fillText(e,5,5),n.strokeText(e,5,5),r.debugOverlayTexture.update(t),r.debugOverlayTexture.bind(i.LINEAR,i.CLAMP_TO_EDGE)}function e_(r,e){let t=null,n=Object.values(r._layers).flatMap(l=>l.source&&!l.isHidden(e)?[r.sourceCaches[l.source]]:[]),o=n.filter(l=>l.getSource().type==="vector"),a=n.filter(l=>l.getSource().type!=="vector"),s=l=>{(!t||t.getSource().maxzoom<l.getSource().maxzoom)&&(t=l)};return o.forEach(l=>s(l)),t||a.forEach(l=>s(l)),t}m();function t_(r,e,t){let i=r.context,n=t.implementation;if(r.renderPass==="offscreen"){let o=n.prerender;o&&(r.setCustomLayerDefaults(),i.setColorMode(r.colorModeForRenderPass()),o.call(n,i.gl,r.transform.customLayerMatrix()),i.setDirty(),r.setBaseState())}else if(r.renderPass==="translucent"){r.setCustomLayerDefaults(),i.setColorMode(r.colorModeForRenderPass()),i.setStencilMode(pe.disabled);let o=n.renderingMode==="3d"?new Y(r.context.gl.LEQUAL,Y.ReadWrite,r.depthRangeFor3D):r.depthModeForSublayer(0,Y.ReadOnly);i.setDepthMode(o),n.render(i.gl,r.transform.customLayerMatrix()),i.setDirty(),r.setBaseState(),i.bindFramebuffer.set(null)}}m();function r_(r,e){let t=r.context,i=t.gl,n=Ee.unblended,o=new Y(i.LEQUAL,Y.ReadWrite,[0,1]),a=e.getTerrainMesh(),s=e.sourceCache.getRenderableTiles(),l=r.useProgram("terrainDepth");t.bindFramebuffer.set(e.getFramebuffer("depth").framebuffer),t.viewport.set([0,0,r.width/devicePixelRatio,r.height/devicePixelRatio]),t.clear({color:W.transparent,depth:1});for(let u of s){let c=e.getTerrainData(u.tileID),p=r.transform.calculatePosMatrix(u.tileID.toUnwrapped()),h=$x(p,e.getMeshFrameDelta(r.transform.zoom));l.draw(t,i.TRIANGLES,o,pe.disabled,n,se.backCCW,h,c,"terrain",a.vertexBuffer,a.indexBuffer,a.segments)}t.bindFramebuffer.set(null),t.viewport.set([0,0,r.width,r.height])}function i_(r,e){let t=r.context,i=t.gl,n=Ee.unblended,o=new Y(i.LEQUAL,Y.ReadWrite,[0,1]),a=e.getTerrainMesh(),s=e.getCoordsTexture(),l=e.sourceCache.getRenderableTiles(),u=r.useProgram("terrainCoords");t.bindFramebuffer.set(e.getFramebuffer("coords").framebuffer),t.viewport.set([0,0,r.width/devicePixelRatio,r.height/devicePixelRatio]),t.clear({color:W.transparent,depth:1}),e.coordsIndex=[];for(let c of l){let p=e.getTerrainData(c.tileID);t.activeTexture.set(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,s.texture);let h=r.transform.calculatePosMatrix(c.tileID.toUnwrapped()),f=qx(h,255-e.coordsIndex.length,e.getMeshFrameDelta(r.transform.zoom));u.draw(t,i.TRIANGLES,o,pe.disabled,n,se.backCCW,f,p,"terrain",a.vertexBuffer,a.indexBuffer,a.segments),e.coordsIndex.push(c.tileID.key)}t.bindFramebuffer.set(null),t.viewport.set([0,0,r.width,r.height])}function Th(r,e,t){let i=r.context,n=i.gl,o=r.colorModeForRenderPass(),a=new Y(n.LEQUAL,Y.ReadWrite,r.depthRangeFor3D),s=r.useProgram("terrain"),l=e.getTerrainMesh();i.bindFramebuffer.set(null),i.viewport.set([0,0,r.width,r.height]);for(let u of t){let c=r.renderToTexture.getTexture(u),p=e.getTerrainData(u.tileID);i.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,c.texture);let h=r.transform.calculatePosMatrix(u.tileID.toUnwrapped()),f=Gx(h,e.getMeshFrameDelta(r.transform.zoom));s.draw(i,n.TRIANGLES,a,pe.disabled,o,se.backCCW,f,p,"terrain",l.vertexBuffer,l.indexBuffer,l.segments)}}var Ru=class{constructor(e,t){this.context=new Lu(e),this.transform=t,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:N.identity(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=ar.maxUnderzooming+ar.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new cn}resize(e,t,i){if(this.width=Math.floor(e*i),this.height=Math.floor(t*i),this.pixelRatio=i,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let n of this.style._order)this.style._layers[n].resize()}setup(){let e=this.context,t=new Sr;t.emplaceBack(0,0),t.emplaceBack(8192,0),t.emplaceBack(0,8192),t.emplaceBack(8192,8192),this.tileExtentBuffer=e.createVertexBuffer(t,$l.members),this.tileExtentSegments=he.simpleSegment(0,0,4,2);let i=new Sr;i.emplaceBack(0,0),i.emplaceBack(8192,0),i.emplaceBack(0,8192),i.emplaceBack(8192,8192),this.debugBuffer=e.createVertexBuffer(i,$l.members),this.debugSegments=he.simpleSegment(0,0,4,5);let n=new Gi;n.emplaceBack(0,0,0,0),n.emplaceBack(8192,0,8192,0),n.emplaceBack(0,8192,0,8192),n.emplaceBack(8192,8192,8192,8192),this.rasterBoundsBuffer=e.createVertexBuffer(n,Dr.members),this.rasterBoundsSegments=he.simpleSegment(0,0,4,2);let o=new Sr;o.emplaceBack(0,0),o.emplaceBack(1,0),o.emplaceBack(0,1),o.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(o,$l.members),this.viewportSegments=he.simpleSegment(0,0,4,2);let a=new mo;a.emplaceBack(0),a.emplaceBack(1),a.emplaceBack(3),a.emplaceBack(2),a.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(a);let s=new rt;s.emplaceBack(0,1,2),s.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(s);let l=this.context.gl;this.stencilClearMode=new pe({func:l.ALWAYS,mask:0},0,255,l.ZERO,l.ZERO,l.ZERO)}clearStencil(){let e=this.context,t=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let i=N.create();N.ortho(i,0,this.width,this.height,0,0,1),N.scale(i,i,[t.drawingBufferWidth,t.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(e,t.TRIANGLES,Y.disabled,this.stencilClearMode,Ee.disabled,se.disabled,xh(i),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 i=this.context,n=i.gl;this.nextStencilID+t.length>256&&this.clearStencil(),i.setColorMode(Ee.disabled),i.setDepthMode(Y.disabled);let o=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(let a of t){let s=this._tileClippingMaskIDs[a.key]=this.nextStencilID++,l=this.style.map.terrain&&this.style.map.terrain.getTerrainData(a);o.draw(i,n.TRIANGLES,Y.disabled,new pe({func:n.ALWAYS,mask:0},s,255,n.KEEP,n.KEEP,n.REPLACE),Ee.disabled,se.disabled,xh(a.posMatrix),l,"$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 pe({func:t.NOTEQUAL,mask:255},e,255,t.KEEP,t.KEEP,t.REPLACE)}stencilModeForClipping(e){let t=this.context.gl;return new pe({func:t.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,t.KEEP,t.KEEP,t.REPLACE)}stencilConfigForOverlap(e){let t=this.context.gl,i=e.sort((a,s)=>s.overscaledZ-a.overscaledZ),n=i[i.length-1].overscaledZ,o=i[0].overscaledZ-n+1;if(o>1){this.currentStencilSource=void 0,this.nextStencilID+o>256&&this.clearStencil();let a={};for(let s=0;s<o;s++)a[s+n]=new pe({func:t.GEQUAL,mask:255},s+this.nextStencilID,255,t.KEEP,t.KEEP,t.REPLACE);return this.nextStencilID+=o,[a,i]}return[{[n]:pe.disabled},i]}colorModeForRenderPass(){let e=this.context.gl;return this._showOverdrawInspector?new Ee([e.CONSTANT_COLOR,e.ONE],new W(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Ee.unblended:Ee.alphaBlended}depthModeForSublayer(e,t,i){if(!this.opaquePassEnabledForLayer())return Y.disabled;let n=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new Y(i||this.context.gl.LEQUAL,t,[n,n])}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(K.now()),this.imageManager.beginFrame();let i=this.style._order,n=this.style.sourceCaches,o={},a={},s={};for(let l in n){let u=n[l];u.used&&u.prepare(this.context),o[l]=u.getVisibleCoordinates(),a[l]=o[l].slice().reverse(),s[l]=u.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let l=0;l<i.length;l++){let u=i[l];if(this.style._layers[u].is3D()){this.opaquePassCutoff=l;break}}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(let l of i){let u=this.style._layers[l];if(!u.hasOffscreenPass()||u.isHidden(this.transform.zoom))continue;let c=a[u.source];u.type!=="custom"&&!c.length||this.renderLayer(this,n[u.source],u,c)}if(this.context.bindFramebuffer.set(null),this.context.clear({color:t.showOverdrawInspector?W.black:W.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=i.length-1;this.currentLayer>=0;this.currentLayer--){let l=this.style._layers[i[this.currentLayer]],u=n[l.source],c=o[l.source];this._renderTileClippingMasks(l,c),this.renderLayer(this,u,l,c)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<i.length;this.currentLayer++){let l=this.style._layers[i[this.currentLayer]],u=n[l.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(l))continue;let c=(l.type==="symbol"?s:a)[l.source];this._renderTileClippingMasks(l,o[l.source]),this.renderLayer(this,u,l,c)}if(this.options.showTileBoundaries){let l=e_(this.style,this.transform.zoom);l&&Qb(this,l,l.getVisibleCoordinates())}this.options.showPadding&&Yb(this),this.context.setDefault()}maybeDrawDepthAndCoords(e){if(!this.style||!this.style.map||!this.style.map.terrain)return;let t=this.terrainFacilitator.matrix,i=this.transform.projMatrix,n=this.terrainFacilitator.dirty;n||(n=e?!N.exactEquals(t,i):!N.equals(t,i)),n||(n=this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime).length>0),n&&(N.copy(t,i),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,r_(this,this.style.map.terrain),i_(this,this.style.map.terrain))}renderLayer(e,t,i,n){if(!i.isHidden(this.transform.zoom)&&!(i.type!=="background"&&i.type!=="custom"&&!(n||[]).length))switch(this.id=i.id,i.type){case"symbol":Ub(e,t,i,n,this.style.placement.variableOffsets);break;case"circle":Nb(e,t,i,n);break;case"heatmap":Gb(e,t,i,n);break;case"line":$b(e,t,i,n);break;case"fill":jb(e,t,i,n);break;case"fill-extrusion":Zb(e,t,i,n);break;case"hillshade":Hb(e,t,i,n);break;case"raster":Wb(e,t,i,n);break;case"background":Xb(e,t,i,n);break;case"custom":t_(e,t,i);break}}translatePosMatrix(e,t,i,n,o){if(!i[0]&&!i[1])return e;let a=o?n==="map"?this.transform.angle:0:n==="viewport"?-this.transform.angle:0;if(a){let u=Math.sin(a),c=Math.cos(a);i=[i[0]*c-i[1]*u,i[0]*u+i[1]*c]}let s=[o?i[0]:je(t,i[0],this.transform.zoom),o?i[1]:je(t,i[1],this.transform.zoom),0],l=new Float32Array(16);return N.translate(l,e,s),l}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()),i=this.imageManager.getPattern(e.to.toString());return!t||!i}useProgram(e,t){this.cache=this.cache||{};let i=e+(t?t.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[i]||(this.cache[i]=new Zl(this.context,hi[e],t,Rb[e],this._showOverdrawInspector,this.style.map.terrain)),this.cache[i]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){let e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){if(this.debugOverlayCanvas==null){this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512;let e=this.context.gl;this.debugOverlayTexture=new _e(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}};m();var Ze=ne(ye(),1);m();var Bu=class r{constructor(e,t){this.points=e;this.planes=t}static fromInvProjectionMatrix(e,t,i){let 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]],o=Math.pow(2,i),a=n.map(u=>{u=Ne.transformMat4([],u,e);let c=1/u[3]/t*o;return Ne.mul(u,u,[c,c,1/u[3],c])}),l=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(u=>{let c=yt.sub([],a[u[0]],a[u[1]]),p=yt.sub([],a[u[2]],a[u[1]]),h=yt.normalize([],yt.cross([],c,p)),f=-yt.dot(h,a[u[1]]);return h.concat(f)});return new r(a,l)}},la=class r{constructor(e,t){this.min=e,this.max=t,this.center=yt.scale([],yt.add([],this.min,this.max),.5)}quadrant(e){let t=[e%2===0,e<2],i=yt.clone(this.min),n=yt.clone(this.max);for(let o=0;o<t.length;o++)i[o]=t[o]?this.min[o]:this.center[o],n[o]=t[o]?this.center[o]:this.max[o];return n[2]=this.max[2],new r(i,n)}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]],i=!0;for(let n=0;n<e.planes.length;n++){let o=e.planes[n],a=0;for(let s=0;s<t.length;s++)Ne.dot(o,t[s])>=0&&a++;if(a===0)return 0;a!==t.length&&(i=!1)}if(i)return 2;for(let n=0;n<3;n++){let o=Number.MAX_VALUE,a=-Number.MAX_VALUE;for(let s=0;s<e.points.length;s++){let l=e.points[s][n]-this.min[n];o=Math.min(o,l),a=Math.max(a,l)}if(a<0||o>this.max[n]-this.min[n])return 0}return 1}};m();var n_=ne(ye(),1);var ua=class r{constructor(e=0,t=0,i=0,n=0){if(isNaN(e)||e<0||isNaN(t)||t<0||isNaN(i)||i<0||isNaN(n)||n<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=i,this.right=n}interpolate(e,t,i){return t.top!=null&&e.top!=null&&(this.top=Se.number(e.top,t.top,i)),t.bottom!=null&&e.bottom!=null&&(this.bottom=Se.number(e.bottom,t.bottom,i)),t.left!=null&&e.left!=null&&(this.left=Se.number(e.left,t.left,i)),t.right!=null&&e.right!=null&&(this.right=Se.number(e.right,t.right,i)),this}getCenter(e,t){let i=Ae((this.left+e-this.right)/2,0,e),n=Ae((this.top+t-this.bottom)/2,0,t);return new n_.default(i,n)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new r(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}};var Ou=85.051129,Vu=class r{constructor(e,t,i,n,o){this.tileSize=512,this._renderWorldCopies=o===void 0?!0:!!o,this._minZoom=e||0,this._maxZoom=t||22,this._minPitch=i??0,this._maxPitch=n??60,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=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new ua,this._posMatrixCache={},this._alignedPosMatrixCache={},this.minElevationForCurrentTile=0}clone(){let e=new r(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return e.apply(this),e}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.minElevationForCurrentTile=e.minElevationForCurrentTile,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){e===void 0?e=!0:e===null&&(e=!1),this._renderWorldCopies=e}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new Ze.default(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(e){let t=-Kt(e,-180,180)*Math.PI/180;this.angle!==t&&(this._unmodified=!1,this.angle=t,this._calcMatrices(),this.rotationMatrix=bo.create(),bo.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(e){let t=Ae(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,i){this._unmodified=!1,this._edgeInsets.interpolate(e,t,i),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 an(0,e)];if(this._renderWorldCopies){let i=this.pointCoordinate(new Ze.default(0,0)),n=this.pointCoordinate(new Ze.default(this.width,0)),o=this.pointCoordinate(new Ze.default(this.width,this.height)),a=this.pointCoordinate(new Ze.default(0,this.height)),s=Math.floor(Math.min(i.x,n.x,o.x,a.x)),l=Math.floor(Math.max(i.x,n.x,o.x,a.x)),u=1;for(let c=s-u;c<=l+u;c++)c!==0&&t.push(new an(c,e))}return t}coveringTiles(e){let t=this.coveringZoomLevel(e),i=t;if(e.minzoom!==void 0&&t<e.minzoom)return[];e.maxzoom!==void 0&&t>e.maxzoom&&(t=e.maxzoom);let n=this.pointCoordinate(this.getCameraPoint()),o=ze.fromLngLat(this.center),a=Math.pow(2,t),s=[a*n.x,a*n.y,0],l=[a*o.x,a*o.y,0],u=Bu.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,t),c=e.minzoom||0;!e.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(c=t);let p=e.terrain?2/Math.min(this.tileSize,e.tileSize)*this.tileSize:3,h=x=>({aabb:new la([x*a,0,0],[(x+1)*a,a,0]),zoom:0,x:0,y:0,wrap:x,fullyVisible:!1}),f=[],d=[],y=t,g=e.reparseOverscaled?i:t;if(this._renderWorldCopies)for(let x=1;x<=3;x++)f.push(h(-x)),f.push(h(x));for(f.push(h(0));f.length>0;){let x=f.pop(),v=x.x,b=x.y,w=x.fullyVisible;if(!w){let T=x.aabb.intersects(u);if(T===0)continue;w=T===2}let S=e.terrain?s:l,P=x.aabb.distanceX(S),I=x.aabb.distanceY(S),k=Math.max(Math.abs(P),Math.abs(I)),C=p+(1<<y-x.zoom)-2;if(x.zoom===y||k>C&&x.zoom>=c){let T=y-x.zoom,D=s[0]-.5-(v<<T),F=s[1]-.5-(b<<T);d.push({tileID:new Ye(x.zoom===y?g:x.zoom,x.wrap,x.zoom,v,b),distanceSq:ji.sqrLen([l[0]-.5-v,l[1]-.5-b]),tileDistanceToCamera:Math.sqrt(D*D+F*F)});continue}for(let T=0;T<4;T++){let D=(v<<1)+T%2,F=(b<<1)+(T>>1),E=x.zoom+1,A=x.aabb.quadrant(T);if(e.terrain){let $=new Ye(E,x.wrap,E,D,F),X=e.terrain.getMinMaxElevation($),j=X.minElevation??this.elevation,fe=X.maxElevation??this.elevation;A=new la([A.min[0],A.min[1],j],[A.max[0],A.max[1],fe])}f.push({aabb:A,zoom:E,x:D,y:F,wrap:x.wrap,fullyVisible:w})}}return d.sort((x,v)=>x.distanceSq-v.distanceSq).map(x=>x.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=Ae(e.lat,-Ou,Ou);return new Ze.default(kr(e.lng)*this.worldSize,Lr(t)*this.worldSize)}unproject(e){return new ze(e.x/this.worldSize,e.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){let e=this.pointLocation(this.getCameraPoint()),t=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter;return{lngLat:e,altitude:t+this.elevation}}recalculateZoom(e){let t=this.elevation,i=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter,n=this.pointLocation(this.centerPoint,e),o=e.getElevationForLngLatZoom(n,this.tileZoom);if(!(this.elevation-o))return;let s=i+t-o,c=Math.cos(this._pitch)*this.cameraToCenterDistance/s/Al(1,n.lat)/this.tileSize,p=this.scaleZoom(c);this._elevation=o,this._center=n,this.zoom=p}setLocationAtPoint(e,t){let i=this.pointCoordinate(t),n=this.pointCoordinate(this.centerPoint),o=this.locationCoordinate(e),a=new ze(o.x-(i.x-n.x),o.y-(i.y-n.y));this.center=this.coordinateLocation(a),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(e,t){return t?this.coordinatePoint(this.locationCoordinate(e),t.getElevationForLngLatZoom(e,this.tileZoom),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 y=t.pointCoordinate(e);if(y!=null)return y}let i=0,n=[e.x,e.y,0,1],o=[e.x,e.y,1,1];Ne.transformMat4(n,n,this.pixelMatrixInverse),Ne.transformMat4(o,o,this.pixelMatrixInverse);let a=n[3],s=o[3],l=n[0]/a,u=o[0]/s,c=n[1]/a,p=o[1]/s,h=n[2]/a,f=o[2]/s,d=h===f?0:(i-h)/(f-h);return new ze(Se.number(l,u,d)/this.worldSize,Se.number(c,p,d)/this.worldSize)}coordinatePoint(e,t=0,i=this.pixelMatrix){let n=[e.x*this.worldSize,e.y*this.worldSize,t,1];return Ne.transformMat4(n,n,i),new Ze.default(n[0]/n[3],n[1]/n[3])}getBounds(){let e=Math.max(0,this.height/2-this.getHorizon());return new ut().extend(this.pointLocation(new Ze.default(0,e))).extend(this.pointLocation(new Ze.default(this.width,e))).extend(this.pointLocation(new Ze.default(this.width,this.height))).extend(this.pointLocation(new Ze.default(0,this.height)))}getMaxBounds(){return!this.latRange||this.latRange.length!==2||!this.lngRange||this.lngRange.length!==2?null:new ut([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]])}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=[-Ou,Ou])}calculatePosMatrix(e,t=!1){let i=e.key,n=t?this._alignedPosMatrixCache:this._posMatrixCache;if(n[i])return n[i];let o=e.canonical,a=this.worldSize/this.zoomScale(o.z),s=o.x+Math.pow(2,o.z)*e.wrap,l=N.identity(new Float64Array(16));return N.translate(l,l,[s*a,o.y*a,0]),N.scale(l,l,[a/8192,a/8192,1]),N.multiply(l,t?this.alignedProjMatrix:this.projMatrix,l),n[i]=new Float32Array(l),n[i]}customLayerMatrix(){return this.mercatorMatrix.slice()}getConstrained(e,t){t=Ae(+t,this.minZoom,this.maxZoom);let i={center:new re(e.lng,e.lat),zoom:t},n=this.lngRange;if(!this._renderWorldCopies&&n===null){let b=179.9999999999;n=[-b,b]}let o=this.tileSize*this.zoomScale(i.zoom),a=0,s=o,l=0,u=o,c=0,p=0,{x:h,y:f}=this.size;if(this.latRange){let b=this.latRange;a=Lr(b[1])*o,s=Lr(b[0])*o,s-a<f&&(c=f/(s-a))}n&&(l=Kt(kr(n[0])*o,0,o),u=Kt(kr(n[1])*o,0,o),u<l&&(u+=o),u-l<h&&(p=h/(u-l)));let{x:d,y}=this.project.call({worldSize:o},e),g,x,v=Math.max(p||0,c||0);if(v){let b=new Ze.default(p?(u+l)/2:d,c?(s+a)/2:y);return i.center=this.unproject.call({worldSize:o},b).wrap(),i.zoom+=this.scaleZoom(v),i}if(this.latRange){let b=f/2;y-b<a&&(x=a+b),y+b>s&&(x=s-b)}if(n){let b=(l+u)/2,w=d;this._renderWorldCopies&&(w=Kt(d,b-o/2,b+o/2));let S=h/2;w-S<l&&(g=l+S),w+S>u&&(g=u-S)}if(g!==void 0||x!==void 0){let b=new Ze.default(g??d,x??y);i.center=this.unproject.call({worldSize:o},b).wrap()}return i}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let e=this._unmodified,{center:t,zoom:i}=this.getConstrained(this.center,this.zoom);this.center=t,this.zoom=i,this._unmodified=e,this._constraining=!1}_calcMatrices(){if(!this.height)return;let e=this._fov/2,t=this.centerOffset,i=this.point.x,n=this.point.y;this.cameraToCenterDistance=.5/Math.tan(e)*this.height,this._pixelPerMeter=Al(1,this.center.lat)*this.worldSize;let o=N.identity(new Float64Array(16));N.scale(o,o,[this.width/2,-this.height/2,1]),N.translate(o,o,[1,-1,0]),this.labelPlaneMatrix=o,o=N.identity(new Float64Array(16)),N.scale(o,o,[1,-1,1]),N.translate(o,o,[-1,-1,0]),N.scale(o,o,[2/this.width,2/this.height,1]),this.glCoordMatrix=o;let a=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),s=Math.min(this.elevation,this.minElevationForCurrentTile),l=a-s*this._pixelPerMeter/Math.cos(this._pitch),u=s<0?l:a,c=Math.PI/2+this._pitch,p=this._fov*(.5+t.y/this.height),h=Math.sin(p)*u/Math.sin(Ae(Math.PI-c-p,.01,Math.PI-.01)),f=this.getHorizon(),y=2*Math.atan(f/this.cameraToCenterDistance)*(.5+t.y/(f*2)),g=Math.sin(y)*u/Math.sin(Ae(Math.PI-c-y,.01,Math.PI-.01)),x=Math.min(h,g),v=(Math.cos(Math.PI/2-this._pitch)*x+u)*1.01,b=this.height/50;o=new Float64Array(16),N.perspective(o,this._fov,this.width/this.height,b,v),o[8]=-t.x*2/this.width,o[9]=t.y*2/this.height,N.scale(o,o,[1,-1,1]),N.translate(o,o,[0,0,-this.cameraToCenterDistance]),N.rotateX(o,o,this._pitch),N.rotateZ(o,o,this.angle),N.translate(o,o,[-i,-n,0]),this.mercatorMatrix=N.scale([],o,[this.worldSize,this.worldSize,this.worldSize]),N.scale(o,o,[1,1,this._pixelPerMeter]),this.pixelMatrix=N.multiply(new Float64Array(16),this.labelPlaneMatrix,o),N.translate(o,o,[0,0,-this.elevation]),this.projMatrix=o,this.invProjMatrix=N.invert([],o),this.pixelMatrix3D=N.multiply(new Float64Array(16),this.labelPlaneMatrix,o);let w=this.width%2/2,S=this.height%2/2,P=Math.cos(this.angle),I=Math.sin(this.angle),k=i-Math.round(i)+P*w+I*S,C=n-Math.round(n)+P*S+I*w,T=new Float64Array(o);if(N.translate(T,T,[k>.5?k-1:k,C>.5?C-1:C,0]),this.alignedProjMatrix=T,o=N.invert(new Float64Array(16),this.pixelMatrix),!o)throw new Error("failed to invert matrix");this.pixelMatrixInverse=o,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;let e=this.pointCoordinate(new Ze.default(0,0)),t=[e.x*this.worldSize,e.y*this.worldSize,0,1];return Ne.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 Ze.default(0,t))}getCameraQueryGeometry(e){let t=this.getCameraPoint();if(e.length===1)return[e[0],t];{let i=t.x,n=t.y,o=t.x,a=t.y;for(let s of e)i=Math.min(i,s.x),n=Math.min(n,s.y),o=Math.max(o,s.x),a=Math.max(a,s.y);return[new Ze.default(i,n),new Ze.default(o,n),new Ze.default(o,a),new Ze.default(i,a),new Ze.default(i,n)]}}lngLatToCameraDepth(e,t){let i=this.locationCoordinate(e),n=[i.x*this.worldSize,i.y*this.worldSize,t,1];return Ne.transformMat4(n,n,this.projMatrix),n[2]/n[3]}};m();m();function Uu(r,e){let t=!1,i=null,n=null,o,a=()=>{i=null,t&&(r.apply(n,o),i=setTimeout(a,e),t=!1)};return(...s)=>(t=!0,n=this,o=s,i||a(),i)}var ca=class{constructor(e){this._getCurrentHash=()=>{let e=window.location.hash.replace("#","");if(this._hashName){let t;return e.split("&").map(i=>i.split("=")).forEach(i=>{i[0]===this._hashName&&(t=i)}),(t&&t[1]||"").split("/")}return e.split("/")};this._onHashChange=()=>{let e=this._getCurrentHash();if(e.length>=3&&!e.some(t=>isNaN(t))){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};this._updateHashUnthrottled=()=>{let e=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,e)}catch{}};this._updateHash=Uu(this._updateHashUnthrottled,30*1e3/100);this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(e){let t=this._map.getCenter(),i=Math.round(this._map.getZoom()*100)/100,n=Math.ceil((i*Math.LN2+Math.log(512/360/.5))/Math.LN10),o=Math.pow(10,n),a=Math.round(t.lng*o)/o,s=Math.round(t.lat*o)/o,l=this._map.getBearing(),u=this._map.getPitch(),c="";if(e?c+=`/${a}/${s}/${i}`:c+=`${i}/${s}/${a}`,(l||u)&&(c+=`/${Math.round(l*10)/10}`),u&&(c+=`/${Math.round(u)}`),this._hashName){let p=this._hashName,h=!1,f=window.location.hash.slice(1).split("&").map(d=>{let y=d.split("=")[0];return y===p?(h=!0,`${y}=${c}`):d}).filter(d=>d);return h||f.push(`${p}=${c}`),`#${f.join("&")}`}return`#${c}`}};m();m();var o_=ne(ye(),1),qu={linearity:.3,easing:gn(0,0,.3,1)},aM=O({deceleration:2500,maxSpeed:1400},qu),sM=O({deceleration:20,maxSpeed:1400},qu),lM=O({deceleration:1e3,maxSpeed:360},qu),uM=O({deceleration:1e3,maxSpeed:90},qu),$u=class{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:K.now(),settings:e})}_drainInertiaBuffer(){let e=this._inertiaBuffer,t=K.now(),i=160;for(;e.length>0&&t-e[0].time>i;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;let t={zoom:0,bearing:0,pitch:0,pan:new o_.default(0,0),pinchAround:void 0,around:void 0};for(let{settings:a}of this._inertiaBuffer)t.zoom+=a.zoomDelta||0,t.bearing+=a.bearingDelta||0,t.pitch+=a.pitchDelta||0,a.panDelta&&t.pan._add(a.panDelta),a.around&&(t.around=a.around),a.pinchAround&&(t.pinchAround=a.pinchAround);let n=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,o={};if(t.pan.mag()){let a=Gu(t.pan.mag(),n,O({},aM,e||{}));o.offset=t.pan.mult(a.amount/t.pan.mag()),o.center=this._map.transform.center,Nu(o,a)}if(t.zoom){let a=Gu(t.zoom,n,sM);o.zoom=this._map.transform.zoom+a.amount,Nu(o,a)}if(t.bearing){let a=Gu(t.bearing,n,lM);o.bearing=this._map.transform.bearing+Ae(a.amount,-179,179),Nu(o,a)}if(t.pitch){let a=Gu(t.pitch,n,uM);o.pitch=this._map.transform.pitch+a.amount,Nu(o,a)}if(o.zoom||o.bearing){let a=t.pinchAround===void 0?t.around:t.pinchAround;o.around=a?this._map.unproject(a):this._map.getCenter()}return this.clear(),O(o,{noMoveStart:!0})}};function Nu(r,e){(!r.duration||r.duration<e.duration)&&(r.duration=e.duration,r.easing=e.easing)}function Gu(r,e,t){let{maxSpeed:i,linearity:n,deceleration:o}=t,a=Ae(r*n/(e/1e3),-i,i),s=Math.abs(a)/(o*n);return{easing:t.easing,duration:s*1e3,amount:a*(s/2)}}m();m();var a_=ne(ye(),1);var it=class extends z{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,i,n={}){let o=L.mousePos(t.getCanvas(),i),a=t.unproject(o);super(e,O({point:o,lngLat:a,originalEvent:i},n)),this._defaultPrevented=!1,this.target=t}},Fr=class extends z{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,i){let n=e==="touchend"?i.changedTouches:i.touches,o=L.touchPos(t.getCanvasContainer(),n),a=o.map(u=>t.unproject(u)),s=o.reduce((u,c,p,h)=>u.add(c.div(h.length)),new a_.default(0,0)),l=t.unproject(s);super(e,{points:o,point:s,lngLats:a,lngLat:l,originalEvent:i}),this._defaultPrevented=!1}},pa=class extends z{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,i){super(e,{originalEvent:i}),this._defaultPrevented=!1}};var ju=class{constructor(e,t){this._map=e,this._clickTolerance=t.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new pa(e.type,this._map,e))}mousedown(e,t){return this._mousedownPos=t,this._firePreventable(new it(e.type,this._map,e))}mouseup(e){this._map.fire(new it(e.type,this._map,e))}click(e,t){this._mousedownPos&&this._mousedownPos.dist(t)>=this._clickTolerance||this._map.fire(new it(e.type,this._map,e))}dblclick(e){return this._firePreventable(new it(e.type,this._map,e))}mouseover(e){this._map.fire(new it(e.type,this._map,e))}mouseout(e){this._map.fire(new it(e.type,this._map,e))}touchstart(e){return this._firePreventable(new Fr(e.type,this._map,e))}touchmove(e){this._map.fire(new Fr(e.type,this._map,e))}touchend(e){this._map.fire(new Fr(e.type,this._map,e))}touchcancel(e){this._map.fire(new Fr(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}},Zu=class{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new it(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new it("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new it(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}};m();m();var s_=ne(ye(),1),Lt=class{constructor(e){this._map=e}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(e){return this.transform.pointLocation(s_.default.convert(e),this._map.terrain)}};var ha=class{constructor(e,t){this._map=e,this._tr=new Lt(e),this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=t.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){console.warn("boxZoom will not work. Use SDK interaction events instead.")}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,t){this.isEnabled()&&e.shiftKey&&e.button===0&&(L.disableDrag(),this._startPos=this._lastPos=t,this._active=!0)}mousemoveWindow(e,t){if(!this._active)return;let i=t;if(this._lastPos.equals(i)||!this._box&&i.dist(this._startPos)<this._clickTolerance)return;let n=this._startPos;this._lastPos=i,this._box||(this._box=L.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",e));let o=Math.min(n.x,i.x),a=Math.max(n.x,i.x),s=Math.min(n.y,i.y),l=Math.max(n.y,i.y);L.setTransform(this._box,`translate(${o}px,${s}px)`),this._box.style.width=`${a-o}px`,this._box.style.height=`${l-s}px`}mouseupWindow(e,t){if(!this._active||e.button!==0)return;let i=this._startPos,n=t;if(this.reset(),L.suppressClick(),i.x===n.x&&i.y===n.y)this._fireEvent("boxzoomcancel",e);else return this._map.fire(new z("boxzoomend",{originalEvent:e})),{cameraAnimation:o=>o.fitScreenCoordinates(i,n,this._tr.bearing,{linear:!0})}}keydown(e){this._active&&e.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(L.remove(this._box),this._box=null),L.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,t){return this._map.fire(new z(e,{originalEvent:t}))}};m();m();var l_=ne(ye(),1);m();function fa(r,e){if(r.length!==e.length)throw new Error(`The number of touches and points are not equal - touches ${r.length}, points ${e.length}`);let t={};for(let i=0;i<r.length;i++)t[r[i].identifier]=e[i];return t}function cM(r){let e=new l_.default(0,0);for(let t of r)e._add(t);return e.div(r.length)}var Mh=500,pM=500,Hu=30,Ah=class{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,t,i){(this.centroid||i.length>this.numTouches)&&(this.aborted=!0),!this.aborted&&(this.startTime===void 0&&(this.startTime=e.timeStamp),i.length===this.numTouches&&(this.centroid=cM(t),this.touches=fa(i,t)))}touchmove(e,t,i){if(this.aborted||!this.centroid)return;let n=fa(i,t);for(let o in this.touches){let a=this.touches[o],s=n[o];(!s||s.dist(a)>Hu)&&(this.aborted=!0)}}touchend(e,t,i){if((!this.centroid||e.timeStamp-this.startTime>pM)&&(this.aborted=!0),i.length===0){let n=!this.aborted&&this.centroid;if(this.reset(),n)return n}}},fi=class{constructor(e){this.singleTap=new Ah(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,t,i){this.singleTap.touchstart(e,t,i)}touchmove(e,t,i){this.singleTap.touchmove(e,t,i)}touchend(e,t,i){let n=this.singleTap.touchend(e,t,i);if(n){let o=e.timeStamp-this.lastTime<Mh,a=!this.lastTap||this.lastTap.dist(n)<Hu;if((!o||!a)&&this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=n,this.count===this.numTaps)return this.reset(),n}}};var Wu=class{constructor(e){this._tr=new Lt(e),this._zoomIn=new fi({numTouches:1,numTaps:2}),this._zoomOut=new fi({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,t,i){this._zoomIn.touchstart(e,t,i),this._zoomOut.touchstart(e,t,i)}touchmove(e,t,i){this._zoomIn.touchmove(e,t,i),this._zoomOut.touchmove(e,t,i)}touchend(e,t,i){let n=this._zoomIn.touchend(e,t,i),o=this._zoomOut.touchend(e,t,i),a=this._tr;if(n)return this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:s=>s.easeTo({duration:300,zoom:a.zoom+1,around:a.unproject(n)},{originalEvent:e})};if(o)return this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:s=>s.easeTo({duration:300,zoom:a.zoom-1,around:a.unproject(o)},{originalEvent:e})}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}};m();m();var lr=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 i=this._lastPoint;if(!i)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e)){this.reset(e);return}let n=t.length?t[0]:t;if(!(!this._moved&&n.dist(i)<this._clickTolerance))return this._moved=!0,this._lastPoint=n,this._move(i,n)}dragEnd(e){!this.isEnabled()||!this._lastPoint||this._moveStateManager.isValidEndEvent(e)&&(this._moved&&L.suppressClick(),this.reset(e))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}};m();var hM=0,fM=2,mM={[hM]:1,[fM]:2};function dM(r,e){let t=mM[e];return r.buttons===void 0||(r.buttons&t)!==t}var fn=class{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){let t=L.mouseButton(e);this._eventButton=t}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!dM(e,this._eventButton)}isValidEndEvent(e){return L.mouseButton(e)===this._eventButton}},ma=class{constructor(){this._firstTouch=void 0}_isOneFingerTouch(e){return e.targetTouches.length===1}_isSameTouchEvent(e){return e.targetTouches[0].identifier===this._firstTouch}startMove(e){let t=e.targetTouches[0].identifier;this._firstTouch=t}endMove(e){delete this._firstTouch}isValidStartEvent(e){return this._isOneFingerTouch(e)}isValidMoveEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}isValidEndEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}};var Ih=0,u_=2,Ch=r=>{r.mousedown=r.dragStart,r.mousemoveWindow=r.dragMove,r.mouseup=r.dragEnd,r.contextmenu=function(e){e.preventDefault()}},c_=({enable:r,clickTolerance:e})=>{let t=new fn({checkCorrectEvent:i=>L.mouseButton(i)===Ih&&!i.ctrlKey});return new lr({clickTolerance:e,move:(i,n)=>({around:n,panDelta:n.sub(i)}),activateOnStart:!0,moveStateManager:t,enable:r,assignEvents:Ch})},Xu=({enable:r,clickTolerance:e,bearingDegreesPerPixelMoved:t=.8})=>{let i=new fn({checkCorrectEvent:n=>L.mouseButton(n)===Ih&&n.ctrlKey||L.mouseButton(n)===u_});return new lr({clickTolerance:e,move:(n,o)=>({bearingDelta:(o.x-n.x)*t}),moveStateManager:i,enable:r,assignEvents:Ch})},Ku=({enable:r,clickTolerance:e,pitchDegreesPerPixelMoved:t=-.5})=>{let i=new fn({checkCorrectEvent:n=>L.mouseButton(n)===Ih&&n.ctrlKey||L.mouseButton(n)===u_});return new lr({clickTolerance:e,move:(n,o)=>({pitchDelta:(o.y-n.y)*t}),moveStateManager:i,enable:r,assignEvents:Ch})};m();var Ju=ne(ye(),1);var Yu=class{constructor(e,t){this._clickTolerance=e.clickTolerance||1,this._map=t,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new Ju.default(0,0)}minTouchs(){return this._map.cooperativeGestures.isEnabled()?2:1}touchstart(e,t,i){return this._calculateTransform(e,t,i)}touchmove(e,t,i){if(!(!this._active||i.length<this.minTouchs()))return e.preventDefault(),this._calculateTransform(e,t,i)}touchend(e,t,i){this._calculateTransform(e,t,i),this._active&&i.length<this.minTouchs()&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,t,i){i.length>0&&(this._active=!0);let n=fa(i,t),o=new Ju.default(0,0),a=new Ju.default(0,0),s=0;for(let c in n){let p=n[c],h=this._touches[c];h&&(o._add(p),a._add(p.sub(h)),s++,n[c]=p)}if(this._touches=n,s<this.minTouchs()||!a.mag())return;let l=a.div(s);return this._sum._add(l),this._sum.mag()<this._clickTolerance?void 0:{around:o.div(s),panDelta:l}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}};m();var da=class{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(e,t,i){this._firstTwoTouches||i.length<2||(this._firstTwoTouches=[i[0].identifier,i[1].identifier],this._start([t[0],t[1]]))}touchmove(e,t,i){if(!this._firstTwoTouches)return;e.preventDefault();let[n,o]=this._firstTwoTouches,a=Qu(i,t,n),s=Qu(i,t,o);if(!a||!s)return;let l=this._aroundCenter?null:a.add(s).div(2);return this._move([a,s],l,e)}touchend(e,t,i){if(!this._firstTwoTouches)return;let[n,o]=this._firstTwoTouches,a=Qu(i,t,n),s=Qu(i,t,o);a&&s||(this._active&&L.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&e.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}};function Qu(r,e,t){for(let i=0;i<r.length;i++)if(r[i].identifier===t)return e[i]}var yM=.1;function p_(r,e){return Math.log(r/e)/Math.LN2}var ya=class extends da{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,t){let i=this._distance;if(this._distance=e[0].dist(e[1]),!(!this._active&&Math.abs(p_(this._distance,this._startDistance))<yM))return this._active=!0,{zoomDelta:p_(this._distance,i),pinchAround:t}}},gM=25;function h_(r,e){return r.angleWith(e)*180/Math.PI}var ga=class extends da{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,t,i){let n=this._vector;if(this._vector=e[0].sub(e[1]),!(!this._active&&this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:h_(this._vector,n),pinchAround:t}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());let t=Math.PI*this._minDiameter,i=gM/t*360,n=h_(e,this._startVector);return Math.abs(n)<i}};function Eh(r){return Math.abs(r.y)>Math.abs(r.x)}var xM=100,xa=class extends da{constructor(t){super();this._currentTouchCount=0;this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,i,n){super.touchstart(t,i,n),this._currentTouchCount=n.length}_start(t){this._lastPoints=t,Eh(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,i,n){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;let o=t[0].sub(this._lastPoints[0]),a=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(o,a,n.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(o.y+a.y)/2*-.5}):void 0}gestureBeginsVertically(t,i,n){if(this._valid!==void 0)return this._valid;let o=2,a=t.mag()>=o,s=i.mag()>=o;if(!a&&!s)return;if(!a||!s)return this._firstMove===void 0&&(this._firstMove=n),n-this._firstMove<xM?void 0:!1;let l=t.y>0==i.y>0;return Eh(t)&&Eh(i)&&l}};m();var bM={panStep:100,bearingStep:15,pitchStep:10},ba=class{constructor(e){this._tr=new Lt(e);let t=bM;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let t=0,i=0,n=0,o=0,a=0;switch(e.keyCode){case 61:case 107:case 171:case 187:t=1;break;case 189:case 109:case 173:t=-1;break;case 37:e.shiftKey?i=-1:(e.preventDefault(),o=-1);break;case 39:e.shiftKey?i=1:(e.preventDefault(),o=1);break;case 38:e.shiftKey?n=1:(e.preventDefault(),a=-1);break;case 40:e.shiftKey?n=-1:(e.preventDefault(),a=1);break;default:return}return this._rotationDisabled&&(i=0,n=0),{cameraAnimation:s=>{let l=this._tr;s.easeTo({duration:300,easeId:"keyboardHandler",easing:_M,zoom:t?Math.round(l.zoom)+t*(e.shiftKey?2:1):l.zoom,bearing:l.bearing+i*this._bearingStep,pitch:l.pitch+n*this._pitchStep,offset:[-o*this._panStep,-a*this._panStep],center:l.center},{originalEvent:e})}}}enable(){console.warn("maplibre keyboard events are not supported, use SDK keyboard events instead.")}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}};function _M(r){return r*(2-r)}m();var f_=4.000244140625,vM=1/100,wM=1/450,SM=2,_a=class{constructor(e,t){this._onTimeout=e=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(e)};this._map=e,this._tr=new Lt(e),this._triggerRenderFrame=t,this._delta=0,this._defaultZoomRate=vM,this._wheelZoomRate=wM}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(e){console.log("Enable maplibre scrollZoom events will not work. Use Mappedin SDK interactions events instead.")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(e){if(!this.isEnabled()||this._map.cooperativeGestures.isEnabled()&&!e[this._map.cooperativeGestures._bypassKey])return;let t=e.deltaMode===WheelEvent.DOM_DELTA_LINE?e.deltaY*40:e.deltaY,i=K.now(),n=i-(this._lastWheelEventTime||0);this._lastWheelEventTime=i,t!==0&&t%f_===0?this._type="wheel":t!==0&&Math.abs(t)<4?this._type="trackpad":n>400?(this._type=null,this._lastValue=t,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(n*t)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,t+=this._lastValue)),e.shiftKey&&t&&(t=t/4),this._type&&(this._lastWheelEvent=e,this._delta-=t,this._active||this._start(e)),e.preventDefault()}_start(e){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);let t=L.mousePos(this._map.getCanvas(),e),i=this._tr;t.y>i.transform.height/2-i.transform.getHorizon()?this._around=re.convert(this._aroundCenter?i.center:i.unproject(t)):this._around=re.convert(i.center),this._aroundPoint=i.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;let e=this._tr.transform;if(this._delta!==0){let s=this._type==="wheel"&&Math.abs(this._delta)>f_?this._wheelZoomRate:this._defaultZoomRate,l=SM/(1+Math.exp(-Math.abs(this._delta*s)));this._delta<0&&l!==0&&(l=1/l);let u=typeof this._targetZoom=="number"?e.zoomScale(this._targetZoom):e.scale;this._targetZoom=Math.min(e.maxZoom,Math.max(e.minZoom,e.scaleZoom(u*l))),this._type==="wheel"&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let t=typeof this._targetZoom=="number"?this._targetZoom:e.zoom,i=this._startZoom,n=this._easing,o=!1,a;if(this._type==="wheel"&&i&&n){let s=Math.min((K.now()-this._lastWheelEventTime)/200,1),l=n(s);a=Se.number(i,t,l),s<1?this._frameId||(this._frameId=!0):o=!0}else a=t,o=!0;return this._active=!0,o&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!o,zoomDelta:a-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let t=xn;if(this._prevEase){let i=this._prevEase,n=(K.now()-i.start)/i.duration,o=i.easing(n+.01)-i.easing(n),a=.27/Math.sqrt(o*o+1e-4)*.01,s=Math.sqrt(.27*.27-a*a);t=gn(a,s,.25,1)}return this._prevEase={start:K.now(),duration:e,easing:t},t}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}};m();var va=class{constructor(e,t){this._clickZoom=e,this._tapZoom=t}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}};m();var ec=class{constructor(e){this._tr=new Lt(e),this.reset()}reset(){this._active=!1}dblclick(e,t){return e.preventDefault(),{cameraAnimation:i=>{i.easeTo({duration:300,zoom:this._tr.zoom+(e.shiftKey?-1:1),around:this._tr.unproject(t)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}};m();var tc=class{constructor(){this._tap=new fi({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(e,t,i){if(!this._swipePoint)if(!this._tapTime)this._tap.touchstart(e,t,i);else{let n=t[0],o=e.timeStamp-this._tapTime<Mh,a=this._tapPoint.dist(n)<Hu;!o||!a?this.reset():i.length>0&&(this._swipePoint=n,this._swipeTouch=i[0].identifier)}}touchmove(e,t,i){if(!this._tapTime)this._tap.touchmove(e,t,i);else if(this._swipePoint){if(i[0].identifier!==this._swipeTouch)return;let n=t[0],o=n.y-this._swipePoint.y;return this._swipePoint=n,e.preventDefault(),this._active=!0,{zoomDelta:o/128}}}touchend(e,t,i){if(this._tapTime)this._swipePoint&&i.length===0&&this.reset();else{let n=this._tap.touchend(e,t,i);n&&(this._tapTime=e.timeStamp,this._tapPoint=n)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}};m();var wa=class{constructor(e,t,i){this._el=e,this._mousePan=t,this._touchPan=i}enable(e){console.log("Maplibre interaction is not supported. Use Mappedin SDK interaction instead")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}};m();var Sa=class{constructor(e,t,i){this._pitchWithRotate=e.pitchWithRotate,this._mouseRotate=t,this._mousePitch=i}enable(){console.warn("dragRotate does not work. Use SDK interaction events instead.")}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}};m();var Pa=class{constructor(e,t,i,n){this._el=e,this._touchZoom=t,this._touchRotate=i,this._tapDragZoom=n,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}};m();var Ta=class{constructor(e,t){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey";this._map=e,this._options=t,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;let e=this._map.getCanvasContainer();e.classList.add("maplibregl-cooperative-gestures"),this._container=L.create("div","maplibregl-cooperative-gesture-screen",e);let t=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(t=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));let i=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),n=document.createElement("div");n.className="maplibregl-desktop-message",n.textContent=t,this._container.appendChild(n);let o=document.createElement("div");o.className="maplibregl-mobile-message",o.textContent=i,this._container.appendChild(o),this._container.setAttribute("aria-hidden","true")}_destoryUI(){this._container&&(L.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destoryUI()}isEnabled(){return this._enabled}touchmove(e){this._onCooperativeGesture(e.touches.length===1)}wheel(e){this._map.scrollZoom.isEnabled()&&this._onCooperativeGesture(!e[this._bypassKey])}_onCooperativeGesture(e){!this._enabled||!e||(this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}};var m_=ne(ye(),1),rc=r=>r.zoom||r.drag||r.pitch||r.rotate,Lh=class extends z{};function kh(r){return r.panDelta&&r.panDelta.mag()||r.zoomDelta||r.bearingDelta||r.pitchDelta}var ic=class{constructor(e,t){this.handleWindowEvent=e=>{this.handleEvent(e,`${e.type}Window`)};this.handleEvent=(e,t)=>{if(e.type==="blur"){this.stop(!0);return}this._updatingCamera=!0;let i=e.type==="renderFrame"?void 0:e,n={needsRenderFrame:!1},o={},a={},s=e.touches,l=s?this._getMapTouches(s):void 0,u=l?L.touchPos(this._map.getCanvas(),l):L.mousePos(this._map.getCanvas(),e);for(let{handlerName:h,handler:f,allowed:d}of this._handlers){if(!f.isEnabled())continue;let y;this._blockedByActive(a,d,h)?f.reset():f[t||e.type]&&(y=f[t||e.type](e,u,l),this.mergeHandlerResult(n,o,y,h,i),y&&y.needsRenderFrame&&this._triggerRenderFrame()),(y||f.isActive())&&(a[h]=f)}let c={};for(let h in this._previousActiveHandlers)a[h]||(c[h]=i);this._previousActiveHandlers=a,(Object.keys(c).length||kh(n))&&(this._changes.push([n,o,c]),this._triggerRenderFrame()),(Object.keys(a).length||kh(n))&&this._map._stop(!0),this._updatingCamera=!1;let{cameraAnimation:p}=n;p&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],p(this._map))};this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new $u(e),this._bearingSnap=t.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(t);let i=this._el;this._listeners=[[i,"touchstart",{passive:!0}],[i,"touchmove",{passive:!1}],[i,"touchend",void 0],[i,"touchcancel",void 0],[i,"mousedown",void 0],[i,"mousemove",void 0],[i,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[i,"mouseover",void 0],[i,"mouseout",void 0],[i,"dblclick",void 0],[i,"click",void 0],[i,"keydown",{capture:!1}],[i,"keyup",void 0],[i,"wheel",{passive:!1}],[i,"contextmenu",void 0],[window,"blur",void 0]];for(let[n,o,a]of this._listeners);}destroy(){for(let[e,t,i]of this._listeners)L.removeEventListener(e,t,e===document?this.handleWindowEvent:this.handleEvent,i)}_addDefaultHandlers(e){let t=this._map,i=t.getCanvasContainer();this._add("mapEvent",new ju(t,e));let n=t.boxZoom=new ha(t,e);this._add("boxZoom",n),e.interactive&&e.boxZoom&&n.enable();let o=t.cooperativeGestures=new Ta(t,e.cooperativeGestures);this._add("cooperativeGestures",o),e.cooperativeGestures&&o.enable();let a=new Wu(t),s=new ec(t);t.doubleClickZoom=new va(s,a),this._add("tapZoom",a),this._add("clickZoom",s),e.interactive&&e.doubleClickZoom&&t.doubleClickZoom.enable();let l=new tc;this._add("tapDragZoom",l);let u=t.touchPitch=new xa(t);this._add("touchPitch",u),e.interactive&&e.touchPitch&&t.touchPitch.enable(e.touchPitch);let c=Xu(e),p=Ku(e);t.dragRotate=new Sa(e,c,p),this._add("mouseRotate",c,["mousePitch"]),this._add("mousePitch",p,["mouseRotate"]),e.interactive&&e.dragRotate&&t.dragRotate.enable();let h=c_(e),f=new Yu(e,t);t.dragPan=new wa(i,h,f),this._add("mousePan",h),this._add("touchPan",f,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&t.dragPan.enable(e.dragPan);let d=new ga,y=new ya;t.touchZoomRotate=new Pa(i,y,d,l),this._add("touchRotate",d,["touchPan","touchZoom"]),this._add("touchZoom",y,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&t.touchZoomRotate.enable(e.touchZoomRotate);let g=t.scrollZoom=new _a(t,()=>this._triggerRenderFrame());this._add("scrollZoom",g,["mousePan"]),e.interactive&&e.scrollZoom&&t.scrollZoom.enable(e.scrollZoom);let x=t.keyboard=new ba(t);this._add("keyboard",x),e.interactive&&e.keyboard&&t.keyboard.enable(),this._add("blockableMapEvent",new Zu(t))}_add(e,t,i){this._handlers.push({handlerName:e,handler:t,allowed:i}),this._handlersById[e]=t}stop(e){if(!this._updatingCamera){for(let{handler:t}of this._handlers)t.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(let{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!rc(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,t,i){for(let n in e)if(n!==i&&(!t||t.indexOf(n)<0))return!0;return!1}_getMapTouches(e){let t=[];for(let i of e){let n=i.target;this._el.contains(n)&&t.push(i)}return t}mergeHandlerResult(e,t,i,n,o){if(!i)return;O(e,i);let a={handlerName:n,originalEvent:i.originalEvent||o};i.zoomDelta!==void 0&&(t.zoom=a),i.panDelta!==void 0&&(t.drag=a),i.pitchDelta!==void 0&&(t.pitch=a),i.bearingDelta!==void 0&&(t.rotate=a)}_applyChanges(){let e={},t={},i={};for(let[n,o,a]of this._changes)n.panDelta&&(e.panDelta=(e.panDelta||new m_.default(0,0))._add(n.panDelta)),n.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+n.zoomDelta),n.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+n.bearingDelta),n.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+n.pitchDelta),n.around!==void 0&&(e.around=n.around),n.pinchAround!==void 0&&(e.pinchAround=n.pinchAround),n.noInertia&&(e.noInertia=n.noInertia),O(t,o),O(i,a);this._updateMapTransform(e,t,i),this._changes=[]}_updateMapTransform(e,t,i){let n=this._map,o=n._getTransformForUpdate(),a=n.terrain;if(!kh(e)&&!(a&&this._terrainMovement))return this._fireEvents(t,i,!0);let{panDelta:s,zoomDelta:l,bearingDelta:u,pitchDelta:c,around:p,pinchAround:h}=e;h!==void 0&&(p=h),n._stop(!0),p=p||n.transform.centerPoint;let f=o.pointLocation(s?p.sub(s):p);u&&(o.bearing+=u),c&&(o.pitch+=c),l&&(o.zoom+=l),a?!this._terrainMovement&&(t.drag||t.zoom)?(this._terrainMovement=!0,this._map._elevationFreeze=!0,o.setLocationAtPoint(f,p),this._map.once("moveend",()=>{this._map._elevationFreeze=!1,this._terrainMovement=!1,o.recalculateZoom(n.terrain)})):t.drag&&this._terrainMovement?o.center=o.pointLocation(o.centerPoint.sub(s)):o.setLocationAtPoint(f,p):o.setLocationAtPoint(f,p),n._applyUpdatedTransform(o),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(t,i,!0)}_fireEvents(e,t,i){let n=rc(this._eventsInProgress),o=rc(e),a={};for(let c in e){let{originalEvent:p}=e[c];this._eventsInProgress[c]||(a[`${c}start`]=p),this._eventsInProgress[c]=e[c]}!n&&o&&this._fireEvent("movestart",o.originalEvent);for(let c in a)this._fireEvent(c,a[c]);o&&this._fireEvent("move",o.originalEvent);for(let c in e){let{originalEvent:p}=e[c];this._fireEvent(c,p)}let s={},l;for(let c in this._eventsInProgress){let{handlerName:p,originalEvent:h}=this._eventsInProgress[c];this._handlersById[p].isActive()||(delete this._eventsInProgress[c],l=t[p]||h,s[`${c}end`]=l)}for(let c in s)this._fireEvent(c,s[c]);let u=rc(this._eventsInProgress);if(i&&(n||o)&&!u){this._updatingCamera=!0;let c=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),p=h=>h!==0&&-this._bearingSnap<h&&h<this._bearingSnap;c&&(c.essential||!K.prefersReducedMotion)?(p(c.bearing||this._map.getBearing())&&(c.bearing=0),c.freezeElevation=!0,this._map.easeTo(c,{originalEvent:l})):(this._map.fire(new z("moveend",{originalEvent:l})),p(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 Lh("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}};m();var Ht=ne(ye(),1);var nc=class extends me{constructor(t,i){super();this._renderFrameCallback=()=>{let t=Math.min((K.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(t)),t<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()};this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=i.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new re(this.transform.center.lng,this.transform.center.lat)}setCenter(t,i){return this.jumpTo({center:t},i)}panBy(t,i,n){return t=Ht.default.convert(t).mult(-1),this.panTo(this.transform.center,O({offset:t},i),n)}panTo(t,i,n){return this.easeTo(O({center:t},i),n)}getZoom(){return this.transform.zoom}setZoom(t,i){return this.jumpTo({zoom:t},i),this}zoomTo(t,i,n){return this.easeTo(O({zoom:t},i),n)}zoomIn(t,i){return this.zoomTo(this.getZoom()+1,t,i),this}zoomOut(t,i){return this.zoomTo(this.getZoom()-1,t,i),this}getBearing(){return this.transform.bearing}setBearing(t,i){return this.jumpTo({bearing:t},i),this}getPadding(){return this.transform.padding}setPadding(t,i){return this.jumpTo({padding:t},i),this}rotateTo(t,i,n){return this.easeTo(O({bearing:t},i),n)}resetNorth(t,i){return this.rotateTo(0,O({duration:1e3},t),i),this}resetNorthPitch(t,i){return this.easeTo(O({bearing:0,pitch:0,duration:1e3},t),i),this}snapToNorth(t,i){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,i):this}getPitch(){return this.transform.pitch}setPitch(t,i){return this.jumpTo({pitch:t},i),this}cameraForBounds(t,i){t=ut.convert(t);let n=i&&i.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),n,i)}_cameraForBoxAndBearing(t,i,n,o){let a={top:0,bottom:0,right:0,left:0};if(o=O({padding:a,offset:[0,0],maxZoom:this.transform.maxZoom},o),typeof o.padding=="number"){let j=o.padding;o.padding={top:j,bottom:j,right:j,left:j}}o.padding=O(a,o.padding);let s=this.transform,l=s.padding,u=new ut(t,i),c=s.project(u.getNorthWest()),p=s.project(u.getNorthEast()),h=s.project(u.getSouthEast()),f=s.project(u.getSouthWest()),d=Sc(-n),y=c.rotate(d),g=p.rotate(d),x=h.rotate(d),v=f.rotate(d),b=new Ht.default(Math.max(y.x,g.x,v.x,x.x),Math.max(y.y,g.y,v.y,x.y)),w=new Ht.default(Math.min(y.x,g.x,v.x,x.x),Math.min(y.y,g.y,v.y,x.y)),S=b.sub(w),P=(s.width-(l.left+l.right+o.padding.left+o.padding.right))/S.x,I=(s.height-(l.top+l.bottom+o.padding.top+o.padding.bottom))/S.y;if(I<0||P<0){ke("Map cannot fit within canvas with the given bounds, padding, and/or offset.");return}let k=Math.min(s.scaleZoom(s.scale*Math.min(P,I)),o.maxZoom),C=Ht.default.convert(o.offset),T=(o.padding.left-o.padding.right)/2,D=(o.padding.top-o.padding.bottom)/2,E=new Ht.default(T,D).rotate(Sc(n)),$=C.add(E).mult(s.scale/s.zoomScale(k));return{center:s.unproject(c.add(h).div(2).sub($)),zoom:k,bearing:n}}fitBounds(t,i,n){return this._fitInternal(this.cameraForBounds(t,i),i,n)}fitScreenCoordinates(t,i,n,o,a){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(Ht.default.convert(t)),this.transform.pointLocation(Ht.default.convert(i)),n,o),o,a)}_fitInternal(t,i,n){return t?(i=O(t,i),delete i.padding,i.linear?this.easeTo(i,n):this.flyTo(i,n)):this}jumpTo(t,i){this.stop();let n=this._getTransformForUpdate(),o=!1,a=!1,s=!1;return"zoom"in t&&n.zoom!==+t.zoom&&(o=!0,n.zoom=+t.zoom),t.center!==void 0&&(n.center=re.convert(t.center)),"bearing"in t&&n.bearing!==+t.bearing&&(a=!0,n.bearing=+t.bearing),"pitch"in t&&n.pitch!==+t.pitch&&(s=!0,n.pitch=+t.pitch),t.padding!=null&&!n.isPaddingEqual(t.padding)&&(n.padding=t.padding),this._applyUpdatedTransform(n),this.fire(new z("movestart",i)).fire(new z("move",i)),o&&this.fire(new z("zoomstart",i)).fire(new z("zoom",i)).fire(new z("zoomend",i)),a&&this.fire(new z("rotatestart",i)).fire(new z("rotate",i)).fire(new z("rotateend",i)),s&&this.fire(new z("pitchstart",i)).fire(new z("pitch",i)).fire(new z("pitchend",i)),this.fire(new z("moveend",i))}calculateCameraOptionsFromTo(t,i,n,o=0){let a=ze.fromLngLat(t,i),s=ze.fromLngLat(n,o),l=s.x-a.x,u=s.y-a.y,c=s.z-a.z,p=Math.hypot(l,u,c);if(p===0)throw new Error("Can't calculate camera options with same From and To");let h=Math.hypot(l,u),f=this.transform.scaleZoom(this.transform.cameraToCenterDistance/p/this.transform.tileSize),d=Math.atan2(l,-u)*180/Math.PI,y=Math.acos(h/p)*180/Math.PI;return y=c<0?90-y:90+y,{center:s.toLngLat(),zoom:f,pitch:y,bearing:d}}easeTo(t,i){this._stop(!1,t.easeId),t=O({offset:[0,0],duration:500,easing:xn},t),(t.animate===!1||!t.essential&&K.prefersReducedMotion)&&(t.duration=0);let n=this._getTransformForUpdate(),o=this.getZoom(),a=this.getBearing(),s=this.getPitch(),l=this.getPadding(),u="bearing"in t?this._normalizeBearing(t.bearing,a):a,c="pitch"in t?+t.pitch:s,p="padding"in t?t.padding:n.padding,h=Ht.default.convert(t.offset),f=n.centerPoint.add(h),d=n.pointLocation(f),{center:y,zoom:g}=n.getConstrained(re.convert(t.center||d),t.zoom??o);this._normalizeCenter(y);let x=n.project(d),v=n.project(y).sub(x),b=n.zoomScale(g-o),w,S;t.around&&(w=re.convert(t.around),S=n.locationPoint(w));let P={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||g!==o,this._rotating=this._rotating||a!==u,this._pitching=this._pitching||c!==s,this._padding=!n.isPaddingEqual(p),this._easeId=t.easeId,this._prepareEase(i,t.noMoveStart,P),this.terrain&&this._prepareElevation(y),this._ease(I=>{if(this._zooming&&(n.zoom=Se.number(o,g,I)),this._rotating&&(n.bearing=Se.number(a,u,I)),this._pitching&&(n.pitch=Se.number(s,c,I)),this._padding&&(n.interpolatePadding(l,p,I),f=n.centerPoint.add(h)),this.terrain&&!t.freezeElevation&&this._updateElevation(I),w)n.setLocationAtPoint(w,S);else{let k=n.zoomScale(n.zoom-o),C=g>o?Math.min(2,b):Math.max(.5,b),T=Math.pow(C,1-I),D=n.unproject(x.add(v.mult(I*T)).mult(k));n.setLocationAtPoint(n.renderWorldCopies?D.wrap():D,f)}this._applyUpdatedTransform(n),this._fireMoveEvents(i)},I=>{this.terrain&&this._finalizeElevation(),this._afterEase(i,I)},t),this}_prepareEase(t,i,n={}){this._moving=!0,!i&&!n.moving&&this.fire(new z("movestart",t)),this._zooming&&!n.zooming&&this.fire(new z("zoomstart",t)),this._rotating&&!n.rotating&&this.fire(new z("rotatestart",t)),this._pitching&&!n.pitching&&this.fire(new z("pitchstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(t,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(t){this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);let i=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(t<1&&i!==this._elevationTarget){let n=this._elevationTarget-this._elevationStart,o=(i-(n*t+this._elevationStart))/(1-t);this._elevationStart+=t*(n-o),this._elevationTarget=i}this.transform.elevation=Se.number(this._elevationStart,this._elevationTarget,t)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_applyUpdatedTransform(t){if(!this.transformCameraUpdate)return;let i=t.clone(),{center:n,zoom:o,pitch:a,bearing:s,elevation:l}=this.transformCameraUpdate(i);n&&(i.center=n),o!==void 0&&(i.zoom=o),a!==void 0&&(i.pitch=a),s!==void 0&&(i.bearing=s),l!==void 0&&(i.elevation=l),this.transform.apply(i)}_fireMoveEvents(t){this.fire(new z("move",t)),this._zooming&&this.fire(new z("zoom",t)),this._rotating&&this.fire(new z("rotate",t)),this._pitching&&this.fire(new z("pitch",t))}_afterEase(t,i){if(this._easeId&&i&&this._easeId===i)return;delete this._easeId;let n=this._zooming,o=this._rotating,a=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,n&&this.fire(new z("zoomend",t)),o&&this.fire(new z("rotateend",t)),a&&this.fire(new z("pitchend",t)),this.fire(new z("moveend",t))}flyTo(t,i){if(!t.essential&&K.prefersReducedMotion){let j=hr(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(j,i)}this.stop(),t=O({offset:[0,0],speed:1.2,curve:1.42,easing:xn},t);let n=this._getTransformForUpdate(),o=this.getZoom(),a=this.getBearing(),s=this.getPitch(),l=this.getPadding(),u="bearing"in t?this._normalizeBearing(t.bearing,a):a,c="pitch"in t?+t.pitch:s,p="padding"in t?t.padding:n.padding,h=Ht.default.convert(t.offset),f=n.centerPoint.add(h),d=n.pointLocation(f),{center:y,zoom:g}=n.getConstrained(re.convert(t.center||d),t.zoom??o);this._normalizeCenter(y);let x=n.zoomScale(g-o),v=n.project(d),b=n.project(y).sub(v),w=t.curve,S=Math.max(n.width,n.height),P=S/x,I=b.mag();if("minZoom"in t){let j=Ae(Math.min(t.minZoom,o,g),n.minZoom,n.maxZoom),fe=S/n.zoomScale(j-o);w=Math.sqrt(fe/I*2)}let k=w*w;function C(j){let fe=(P*P-S*S+(j?-1:1)*k*k*I*I)/(2*(j?P:S)*k*I);return Math.log(Math.sqrt(fe*fe+1)-fe)}function T(j){return(Math.exp(j)-Math.exp(-j))/2}function D(j){return(Math.exp(j)+Math.exp(-j))/2}function F(j){return T(j)/D(j)}let E=C(!1),A=function(j){return D(E)/D(E+w*j)},$=function(j){return S*((D(E)*F(E+w*j)-T(E))/k)/I},X=(C(!0)-E)/w;if(Math.abs(I)<1e-6||!isFinite(X)){if(Math.abs(S-P)<1e-6)return this.easeTo(t,i);let j=P<S?-1:1;X=Math.abs(Math.log(P/S))/w,$=function(){return 0},A=function(fe){return Math.exp(j*w*fe)}}if("duration"in t)t.duration=+t.duration;else{let j="screenSpeed"in t?+t.screenSpeed/w:+t.speed;t.duration=1e3*X/j}return t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=a!==u,this._pitching=c!==s,this._padding=!n.isPaddingEqual(p),this._prepareEase(i,!1),this.terrain&&this._prepareElevation(y),this._ease(j=>{let fe=j*X,Q=1/A(fe);n.zoom=j===1?g:o+n.scaleZoom(Q),this._rotating&&(n.bearing=Se.number(a,u,j)),this._pitching&&(n.pitch=Se.number(s,c,j)),this._padding&&(n.interpolatePadding(l,p,j),f=n.centerPoint.add(h)),this.terrain&&!t.freezeElevation&&this._updateElevation(j);let nt=j===1?y:n.unproject(v.add(b.mult($(fe))).mult(Q));n.setLocationAtPoint(n.renderWorldCopies?nt.wrap():nt,f),this._applyUpdatedTransform(n),this._fireMoveEvents(i)},()=>{this.terrain&&this._finalizeElevation(),this._afterEase(i)},t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,i){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let n=this._onEaseEnd;delete this._onEaseEnd,n.call(this,i)}if(!t){let n=this.handlers;n&&n.stop(!1)}return this}_ease(t,i,n){n.animate===!1||n.duration===0?(t(1),i()):(this._easeStart=K.now(),this._easeOptions=n,this._onEaseFrame=t,this._onEaseEnd=i,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,i){t=Kt(t,-180,180);let n=Math.abs(t-i);return Math.abs(t-360-i)<n&&(t-=360),Math.abs(t+360-i)<n&&(t+=360),t}_normalizeCenter(t){let i=this.transform;if(!i.renderWorldCopies||i.lngRange)return;let n=t.lng-i.center.lng;t.lng+=n>180?-360:n<-180?360:0}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLatZoom(re.convert(t),this.transform.tileZoom)-this.transform.elevation:null}};var ur=ne(ye(),1);m();var Dh={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'},Aa=class{constructor(e=Dh){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))};this._updateData=e=>{e&&(e.sourceDataType==="metadata"||e.sourceDataType==="visibility"||e.dataType==="style"||e.type==="terrain")&&this._updateAttributions()};this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):!this._container.classList.contains("maplibregl-compact")&&!this._container.classList.contains("maplibregl-attrib-empty")&&(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))};this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")};this.options=e}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=L.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=L.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=L.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){L.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 i=this._map._getUIString(`AttributionControl.${t}`);e.title=i,e.setAttribute("aria-label",i)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map(n=>typeof n!="string"?"":n)):typeof this.options.customAttribution=="string"&&e.push(this.options.customAttribution)),this._map.style.stylesheet){let n=this._map.style.stylesheet;this.styleOwner=n.owner,this.styleId=n.id}let t=this._map.style.sourceCaches;for(let n in t){let o=t[n];if(o.used||o.usedForTerrain){let a=o.getSource();a.attribution&&e.indexOf(a.attribution)<0&&e.push(a.attribution)}}e=e.filter(n=>String(n).trim()),e.sort((n,o)=>n.length-o.length),e=e.filter((n,o)=>{for(let a=o+1;a<e.length;a++)if(e[a].indexOf(n)>=0)return!1;return!0});let i=e.join(" | ");i!==this._attribHTML&&(this._attribHTML=i,e.length?(this._innerContainer.innerHTML=i,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}};m();var Ma=class{constructor(e={}){this._updateCompact=()=>{let e=this._container.children;if(e.length){let t=e[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&t.classList.add("maplibregl-compact"):t.classList.remove("maplibregl-compact")}};this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){this._map=e,this._compact=this.options&&this.options.compact,this._container=L.create("div","maplibregl-ctrl");let t=L.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(){L.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}};m();var oc=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,i=t?this._queue.concat(t):this._queue;for(let n of i)if(n.id===e){n.cancelled=!0;return}}run(e=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");let t=this._currentlyRunning=this._queue;this._queue=[];for(let i of t)if(!i.cancelled&&(i.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}};m();var sc=(i=>(i.create="create",i.load="load",i.fullLoad="fullLoad",i))(sc||{}),ac=null,Ia=[],PM=60,zh=1e3/PM,Fh="loadTime",Rh="fullLoadTime",mn={mark(r){performance.mark(r)},frame(r){let e=r;if(ac!=null){let t=e-ac;Ia.push(t)}ac=e},clearMetrics(){ac=null,Ia=[],performance.clearMeasures(Fh),performance.clearMeasures(Rh);for(let r in sc)performance.clearMarks(sc[r])},getPerformanceMetrics(){performance.measure(Fh,"create","load"),performance.measure(Rh,"create","fullLoad");let r=performance.getEntriesByName(Fh)[0].duration,e=performance.getEntriesByName(Rh)[0].duration,t=Ia.length,n=1/(Ia.reduce((s,l)=>s+l,0)/t/1e3),o=Ia.filter(s=>s>zh).reduce((s,l)=>s+(l-zh)/zh,0),a=o/(t+o)*100;return{loadTime:r,fullLoadTime:e,fps:n,percentDroppedFrames:a,totalFrames:t}}};m();m();var d_=be([{name:"a_pos3d",type:"Int16",components:3}]);m();var lc=class extends me{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 i={};for(let n of e.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:t}))i[n.key]=!0,this._renderableTilesKeys.push(n.key),this._tiles[n.key]||(n.posMatrix=new Float64Array(16),N.ortho(n.posMatrix,0,8192,0,8192,0,1),this._tiles[n.key]=new ln(n,this.tileSize));for(let n in this._tiles)i[n]||delete this._tiles[n]}freeRtt(e){for(let t in this._tiles){let i=this._tiles[t];(!e||i.tileID.equals(e)||i.tileID.isChildOf(e)||e.isChildOf(i.tileID))&&(i.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(e=>this.getTileByID(e))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e){let t={};for(let i of this._renderableTilesKeys){let n=this._tiles[i].tileID;if(n.canonical.equals(e.canonical)){let o=e.clone();o.posMatrix=new Float64Array(16),N.ortho(o.posMatrix,0,8192,0,8192,0,1),t[i]=o}else if(n.canonical.isChildOf(e.canonical)){let o=e.clone();o.posMatrix=new Float64Array(16);let a=n.canonical.z-e.canonical.z,s=n.canonical.x-(n.canonical.x>>a<<a),l=n.canonical.y-(n.canonical.y>>a<<a),u=8192>>a;N.ortho(o.posMatrix,0,u,0,u,0,1),N.translate(o.posMatrix,o.posMatrix,[-s*u,-l*u,0]),t[i]=o}else if(e.canonical.isChildOf(n.canonical)){let o=e.clone();o.posMatrix=new Float64Array(16);let a=e.canonical.z-n.canonical.z,s=e.canonical.x-(e.canonical.x>>a<<a),l=e.canonical.y-(e.canonical.y>>a<<a),u=8192>>a;N.ortho(o.posMatrix,0,8192,0,8192,0,1),N.translate(o.posMatrix,o.posMatrix,[s*u,l*u,0]),N.scale(o.posMatrix,o.posMatrix,[1/2**a,1/2**a,0]),t[i]=o}}return t}getSourceTile(e,t){let i=this.sourceCache._source,n=e.overscaledZ-this.deltaZoom;if(n>i.maxzoom&&(n=i.maxzoom),n<i.minzoom)return null;this._sourceTileCache[e.key]||(this._sourceTileCache[e.key]=e.scaledTo(n).key);let o=this.sourceCache.getTileByID(this._sourceTileCache[e.key]);if(!(o&&o.dem)&&t)for(;n>=i.minzoom&&!(o&&o.dem);)o=this.sourceCache.getTileByID(e.scaledTo(n--).key);return o}tilesAfterTime(e=Date.now()){return Object.values(this._tiles).filter(t=>t.timeAdded>=e)}};var uc=class{constructor(e,t,i){this.painter=e,this.sourceCache=new lc(t),this.options=i,this.exaggeration=typeof i.exaggeration=="number"?i.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(e,t,i,n=8192){if(!(t>=0&&t<n&&i>=0&&i<n))return 0;let o=this.getTerrainData(e),a=o.tile?.dem;if(!a)return 0;let s=ji.transformMat4([],[t/n*8192,i/n*8192],o.u_terrain_matrix),l=[s[0]*a.dim,s[1]*a.dim],u=Math.floor(l[0]),c=Math.floor(l[1]),p=l[0]-u,h=l[1]-c;return a.get(u,c)*(1-p)*(1-h)+a.get(u+1,c)*p*(1-h)+a.get(u,c+1)*(1-p)*h+a.get(u+1,c+1)*p*h}getElevationForLngLatZoom(e,t){let{tileID:i,mercatorX:n,mercatorY:o}=this._getOverscaledTileIDFromLngLatZoom(e,t);return this.getElevation(i,n%8192,o%8192,8192)}getElevation(e,t,i,n=8192){return this.getDEMElevation(e,t,i,n)*this.exaggeration}getTerrainData(e){if(!this._emptyDemTexture){let n=this.painter.context,o=new we({width:1,height:1},new Uint8Array(1*4));this._emptyDepthTexture=new _e(n,o,n.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new _e(n,new we({width:1,height:1}),n.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(n.gl.NEAREST,n.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=N.identity([])}let t=this.sourceCache.getSourceTile(e,!0);if(t&&t.dem&&(!t.demTexture||t.needsTerrainPrepare)){let n=this.painter.context;t.demTexture=this.painter.getTileTexture(t.dem.stride),t.demTexture?t.demTexture.update(t.dem.getPixels(),{premultiply:!1}):t.demTexture=new _e(n,t.dem.getPixels(),n.gl.RGBA,{premultiply:!1}),t.demTexture.bind(n.gl.NEAREST,n.gl.CLAMP_TO_EDGE),t.needsTerrainPrepare=!1}let i=t&&t+t.tileID.key+e.key;if(i&&!this._demMatrixCache[i]){let n=this.sourceCache.sourceCache._source.maxzoom,o=e.canonical.z-t.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=n?o=e.canonical.z-n:ke("cannot calculate elevation if elevation maxzoom > source.maxzoom"));let a=e.canonical.x-(e.canonical.x>>o<<o),s=e.canonical.y-(e.canonical.y>>o<<o),l=N.fromScaling(new Float64Array(16),[1/(8192<<o),1/(8192<<o),0]);N.translate(l,l,[a*8192,s*8192,0]),this._demMatrixCache[e.key]={matrix:l,coord:e}}return{u_depth:2,u_terrain:3,u_terrain_dim:t&&t.dem&&t.dem.dim||1,u_terrain_matrix:i?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,i=t.width/devicePixelRatio,n=t.height/devicePixelRatio;return this._fbo&&(this._fbo.width!==i||this._fbo.height!==n)&&(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new _e(t.context,{width:i,height:n,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 _e(t.context,{width:i,height:n,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(i,n,!0,!1),this._fbo.depthAttachment.set(t.context.createRenderbuffer(t.context.gl.DEPTH_COMPONENT16,i,n))),this._fbo.colorAttachment.set(e==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){let e=this.painter.context;if(this._coordsTexture)return this._coordsTexture;let t=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let o=0,a=0;o<this._coordsTextureSize;o++)for(let s=0;s<this._coordsTextureSize;s++,a+=4)t[a+0]=s&255,t[a+1]=o&255,t[a+2]=s>>8<<4|o>>8,t[a+3]=0;let i=new we({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(t.buffer)),n=new _e(e,i,e.gl.RGBA,{premultiply:!1});return n.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=n,n}pointCoordinate(e){this.painter.maybeDrawDepthAndCoords(!0);let t=new Uint8Array(4),i=this.painter.context,n=i.gl,o=Math.round(e.x*this.painter.pixelRatio/devicePixelRatio),a=Math.round(e.y*this.painter.pixelRatio/devicePixelRatio),s=Math.round(this.painter.height/devicePixelRatio);i.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),n.readPixels(o,s-a-1,1,1,n.RGBA,n.UNSIGNED_BYTE,t),i.bindFramebuffer.set(null);let l=t[0]+(t[2]>>4<<8),u=t[1]+((t[2]&15)<<8),c=this.coordsIndex[255-t[3]],p=c&&this.sourceCache.getTileByID(c);if(!p)return null;let h=this._coordsTextureSize,f=(1<<p.tileID.canonical.z)*h;return new ze((p.tileID.canonical.x*h+l)/f+p.tileID.wrap,(p.tileID.canonical.y*h+u)/f,this.getElevation(p.tileID,l,u,h))}depthAtPoint(e){let t=new Uint8Array(4),i=this.painter.context,n=i.gl;return i.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),n.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,n.RGBA,n.UNSIGNED_BYTE,t),i.bindFramebuffer.set(null),(t[0]/(256*256*256)+t[1]/(256*256)+t[2]/256+t[3])/256}getTerrainMesh(){if(this._mesh)return this._mesh;let e=this.painter.context,t=new Ts,i=new rt,n=this.meshSize,o=8192/n,a=n*n;for(let p=0;p<=n;p++)for(let h=0;h<=n;h++)t.emplaceBack(h*o,p*o,0);for(let p=0;p<a;p+=n+1)for(let h=0;h<n;h++)i.emplaceBack(h+p,n+h+p+1,n+h+p+2),i.emplaceBack(h+p,n+h+p+2,h+p+1);let s=t.length,l=s+(n+1)*2;for(let p of[0,1])for(let h=0;h<=n;h++)for(let f of[0,1])t.emplaceBack(h*o,p*8192,f);for(let p=0;p<n*2;p+=2)i.emplaceBack(l+p,l+p+1,l+p+3),i.emplaceBack(l+p,l+p+3,l+p+2),i.emplaceBack(s+p,s+p+3,s+p+1),i.emplaceBack(s+p,s+p+2,s+p+3);let u=t.length,c=u+(n+1)*2;for(let p of[0,1])for(let h=0;h<=n;h++)for(let f of[0,1])t.emplaceBack(p*8192,h*o,f);for(let p=0;p<n*2;p+=2)i.emplaceBack(u+p,u+p+1,u+p+3),i.emplaceBack(u+p,u+p+3,u+p+2),i.emplaceBack(c+p,c+p+3,c+p+1),i.emplaceBack(c+p,c+p+2,c+p+3);return this._mesh={indexBuffer:e.createIndexBuffer(i),vertexBuffer:e.createVertexBuffer(t,d_.members),segments:he.simpleSegment(0,0,t.length,i.length)},this._mesh}getMeshFrameDelta(e){return 2*Math.PI*$o/Math.pow(2,e)/5}getMinTileElevationForLngLatZoom(e,t){let{tileID:i}=this._getOverscaledTileIDFromLngLatZoom(e,t);return this.getMinMaxElevation(i).minElevation??0}getMinMaxElevation(e){let t=this.getTerrainData(e).tile,i={minElevation:null,maxElevation:null};return t&&t.dem&&(i.minElevation=t.dem.min*this.exaggeration,i.maxElevation=t.dem.max*this.exaggeration),i}_getOverscaledTileIDFromLngLatZoom(e,t){let i=ze.fromLngLat(e.wrap()),n=(1<<t)*8192,o=i.x*n,a=i.y*n,s=Math.floor(o/8192),l=Math.floor(a/8192);return{tileID:new Ye(t,0,t,s,l),mercatorX:o,mercatorY:a}}};m();m();var cc=class{constructor(e,t,i){this._context=e;this._size=t;this._tileSize=i;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),i=new _e(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return i.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(i.texture),{id:e,fbo:t,texture:i,stamp:-1,inUse:!1}}getObjectForId(e){return this._objects[e]}useObject(e){e.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(t=>e.id!==t),this._recentlyUsed.push(e.id)}stampObject(e){e.stamp=++this._stamp}getOrCreateFreeObject(){for(let t of this._recentlyUsed)if(!this._objects[t].inUse)return this._objects[t];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");let e=this._createObject(this._objects.length);return this._objects.push(e),e}freeObject(e){e.inUse=!1}freeAllObjects(){for(let e of this._objects)this.freeObject(e)}isFull(){return this._objects.length<this._size?!1:this._objects.some(e=>!e.inUse)===!1}};var dn={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0},pc=class{constructor(e,t){this.painter=e,this.terrain=t,this.pool=new cc(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(i=>!e._layers[i].isHidden(t)),this._coordsDescendingInv={};for(let i in e.sourceCaches){this._coordsDescendingInv[i]={};let n=e.sourceCaches[i].getVisibleCoordinates();for(let o of n){let a=this.terrain.sourceCache.getTerrainCoords(o);for(let s in a)this._coordsDescendingInv[i][s]||(this._coordsDescendingInv[i][s]=[]),this._coordsDescendingInv[i][s].push(a[s])}}this._coordsDescendingInvStr={};for(let i of e._order){let n=e._layers[i],o=n.source;if(dn[n.type]&&!this._coordsDescendingInvStr[o]){this._coordsDescendingInvStr[o]={};for(let a in this._coordsDescendingInv[o])this._coordsDescendingInvStr[o][a]=this._coordsDescendingInv[o][a].map(s=>s.key).sort().join()}}for(let i of this._renderableTiles)for(let n in this._coordsDescendingInvStr){let o=this._coordsDescendingInvStr[n][i.tileID.key];o&&o!==i.rttCoords[n]&&(i.rtt=[])}}renderLayer(e){if(e.isHidden(this.painter.transform.zoom))return!1;let t=e.type,i=this.painter,n=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(dn[t]&&((!this._prevType||!dn[this._prevType])&&this._stacks.push([]),this._prevType=t,this._stacks[this._stacks.length-1].push(e.id),!n))return!0;if(dn[this._prevType]||dn[t]&&n){this._prevType=t;let o=this._stacks.length-1,a=this._stacks[o]||[];for(let s of this._renderableTiles){if(this.pool.isFull()&&(Th(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(s),s.rtt[o]){let u=this.pool.getObjectForId(s.rtt[o].id);if(u.stamp===s.rtt[o].stamp){this.pool.useObject(u);continue}}let l=this.pool.getOrCreateFreeObject();this.pool.useObject(l),this.pool.stampObject(l),s.rtt[o]={id:l.id,stamp:l.stamp},i.context.bindFramebuffer.set(l.fbo.framebuffer),i.context.clear({color:W.transparent,stencil:0}),i.currentStencilSource=void 0;for(let u=0;u<a.length;u++){let c=i.style._layers[a[u]],p=c.source?this._coordsDescendingInv[c.source][s.tileID.key]:[s.tileID];i.context.viewport.set([0,0,l.fbo.width,l.fbo.height]),i._renderTileClippingMasks(c,p),i.renderLayer(i,i.style.sourceCaches[c.source],c,p),c.source&&(s.rttCoords[c.source]=this._coordsDescendingInvStr[c.source][s.tileID.key])}}return Th(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),dn[t]}return!1}};m();var y_={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","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.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use \u2318 + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"};var TM=Da.version,fc=-2,g_=22,Rr=0,x_=80,hc=85,AM={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:fc,maxZoom:g_,minPitch:Rr,maxPitch:x_,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:Dh,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]},Bh=class extends nc{constructor(t){if(mn.mark("create"),t=O({},AM,t),t.minZoom!=null&&t.maxZoom!=null&&t.minZoom>t.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(t.minPitch!=null&&t.maxPitch!=null&&t.minPitch>t.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(t.minPitch!=null&&t.minPitch<Rr)throw new Error(`minPitch must be greater than or equal to ${Rr}`);if(t.maxPitch!=null&&t.maxPitch>hc)throw new Error(`maxPitch must be less than or equal to ${hc}`);let i=new Vu(t.minZoom,t.maxZoom,t.minPitch,t.maxPitch,t.renderWorldCopies);super(i,{bearingSnap:t.bearingSnap});this._contextLost=t=>{t.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new z("webglcontextlost",{originalEvent:t}))};this._contextRestored=t=>{this._setupPainter(),this.resize(),this._update(),this.fire(new z("webglcontextrestored",{originalEvent:t}))};this._onMapScroll=t=>{if(t.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1};this._onWindowOnline=()=>{this._update()};if(this._interactive=t.interactive,this._maxTileCacheSize=t.maxTileCacheSize,this._maxTileCacheZoomLevels=t.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=t.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=t.preserveDrawingBuffer,this._antialias=t.antialias,this._trackResize=t.trackResize,this._bearingSnap=t.bearingSnap,this._refreshExpiredTiles=t.refreshExpiredTiles,this._fadeDuration=t.fadeDuration,this._crossSourceCollisions=t.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=t.collectResourceTiming,this._renderTaskQueue=new oc,this._controls=[],this._mapId=Ra(),this._locale=O({},y_,t.locale),this._clickTolerance=t.clickTolerance,this._overridePixelRatio=t.pixelRatio,this._maxCanvasSize=t.maxCanvasSize,this.transformCameraUpdate=t.transformCameraUpdate,this._imageQueueHandle=st.addThrottleControl(()=>this.isMoving()),this._requestManager=new Ga(t.transformRequest),typeof t.container=="string"){if(this._container=document.getElementById(t.container),!this._container)throw new Error(`Container '${t.container}' not found.`)}else if(t.container instanceof HTMLElement)this._container=t.container;else throw new Error("Invalid type: 'container' must be a String or HTMLElement.");if(t.maxBounds&&this.setMaxBounds(t.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 o=!1,a=Uu(s=>{this._trackResize&&!this._removed&&this.resize(s)._update()},50);this._resizeObserver=new ResizeObserver(s=>{if(!o){o=!0;return}a(s)}),this._resizeObserver.observe(this._container)}this.handlers=new ic(this,t);let n=typeof t.hash=="string"&&t.hash||void 0;this._hash=t.hash&&new ca(n).addTo(this),(!this._hash||!this._hash._onHashChange())&&(this.jumpTo({center:t.center,zoom:t.zoom,bearing:t.bearing,pitch:t.pitch}),t.bounds&&(this.resize(),this.fitBounds(t.bounds,O({},t.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=t.localIdeographFontFamily,this._validateStyle=t.validateStyle,t.style&&this.setStyle(t.style,{localIdeographFontFamily:t.localIdeographFontFamily}),t.attributionControl&&this.addControl(new Aa(typeof t.attributionControl=="boolean"?void 0:t.attributionControl)),t.maplibreLogo&&this.addControl(new Ma,t.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",o=>{this._update(o.dataType==="style"),this.fire(new z(`${o.dataType}data`,o))}),this.on("dataloading",o=>{this.fire(new z(`${o.dataType}dataloading`,o))}),this.on("dataabort",o=>{this.fire(new z("sourcedataabort",o))})}_getMapId(){return this._mapId}addControl(t,i){if(i===void 0&&(t.getDefaultPosition?i=t.getDefaultPosition():i="top-right"),!t||!t.onAdd)return this.fire(new Z(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let n=t.onAdd(this);this._controls.push(t);let o=this._controlPositions[i];return i.indexOf("bottom")!==-1?o.insertBefore(n,o.firstChild):o.appendChild(n),this}removeControl(t){if(!t||!t.onRemove)return this.fire(new Z(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let i=this._controls.indexOf(t);return i>-1&&this._controls.splice(i,1),t.onRemove(this),this}hasControl(t){return this._controls.indexOf(t)>-1}calculateCameraOptionsFromTo(t,i,n,o){return o==null&&this.terrain&&(o=this.terrain.getElevationForLngLatZoom(n,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(t,i,n,o)}resize(t){let i=this._containerDimensions(),n=i[0],o=i[1],a=this._getClampedPixelRatio(n,o);if(this._resizeCanvas(n,o,a),this.painter.resize(n,o,a),this.painter.overLimit()){let l=this.painter.context.gl;this._maxCanvasSize=[l.drawingBufferWidth,l.drawingBufferHeight];let u=this._getClampedPixelRatio(n,o);this._resizeCanvas(n,o,u),this.painter.resize(n,o,u)}this.transform.resize(n,o),this._requestedCameraState?.resize(n,o);let s=!this._moving;return s&&(this.stop(),this.fire(new z("movestart",t)).fire(new z("move",t))),this.fire(new z("resize",t)),s&&this.fire(new z("moveend",t)),this}_getClampedPixelRatio(t,i){let{0:n,1:o}=this._maxCanvasSize,a=this.getPixelRatio(),s=t*a,l=i*a,u=s>n?n/s:1,c=l>o?o/l:1;return Math.min(u,c)*a}getPixelRatio(){return this._overridePixelRatio??devicePixelRatio}setPixelRatio(t){this._overridePixelRatio=t,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(t){return this.transform.setMaxBounds(ut.convert(t)),this._update()}setMinZoom(t){if(t=t??fc,t>=fc&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()<t&&this.setZoom(t),this;throw new Error(`minZoom must be between ${fc} and the current maxZoom, inclusive`)}getMinZoom(){return this.transform.minZoom}setMaxZoom(t){if(t=t??g_,t>=this.transform.minZoom)return this.transform.maxZoom=t,this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(t){if(t=t??Rr,t<Rr)throw new Error(`minPitch must be greater than or equal to ${Rr}`);if(t>=Rr&&t<=this.transform.maxPitch)return this.transform.minPitch=t,this._update(),this.getPitch()<t&&this.setPitch(t),this;throw new Error(`minPitch must be between ${Rr} and the current maxPitch, inclusive`)}getMinPitch(){return this.transform.minPitch}setMaxPitch(t){if(t=t??x_,t>hc)throw new Error(`maxPitch must be less than or equal to ${hc}`);if(t>=this.transform.minPitch)return this.transform.maxPitch=t,this._update(),this.getPitch()>t&&this.setPitch(t),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(t){return this.transform.renderWorldCopies=t,this._update()}project(t){return this.transform.locationPoint(re.convert(t),this.style&&this.terrain)}unproject(t){return this.transform.pointLocation(ur.default.convert(t),this.terrain)}isMoving(){return this._moving||this.handlers?.isMoving()}isZooming(){return this._zooming||this.handlers?.isZooming()}isRotating(){return this._rotating||this.handlers?.isRotating()}_createDelegatedListener(t,i,n){if(t==="mouseenter"||t==="mouseover"){let o=!1;return{layer:i,listener:n,delegates:{mousemove:l=>{let u=this.getLayer(i)?this.queryRenderedFeatures(l.point,{layers:[i]}):[];u.length?o||(o=!0,n.call(this,new it(t,this,l.originalEvent,{features:u}))):o=!1},mouseout:()=>{o=!1}}}}else if(t==="mouseleave"||t==="mouseout"){let o=!1;return{layer:i,listener:n,delegates:{mousemove:l=>{(this.getLayer(i)?this.queryRenderedFeatures(l.point,{layers:[i]}):[]).length?o=!0:o&&(o=!1,n.call(this,new it(t,this,l.originalEvent)))},mouseout:l=>{o&&(o=!1,n.call(this,new it(t,this,l.originalEvent)))}}}}else{let o=a=>{let s=this.getLayer(i)?this.queryRenderedFeatures(a.point,{layers:[i]}):[];s.length&&(a.features=s,n.call(this,a),delete a.features)};return{layer:i,listener:n,delegates:{[t]:o}}}}on(t,i,n){if(n===void 0)return super.on(t,i);let o=this._createDelegatedListener(t,i,n);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[t]=this._delegatedListeners[t]||[],this._delegatedListeners[t].push(o);for(let a in o.delegates)this.on(a,o.delegates[a]);return this}once(t,i,n){if(n===void 0)return super.once(t,i);let o=this._createDelegatedListener(t,i,n);for(let a in o.delegates)this.once(a,o.delegates[a]);return this}off(t,i,n){if(n===void 0)return super.off(t,i);let o=a=>{let s=a[t];for(let l=0;l<s.length;l++){let u=s[l];if(u.layer===i&&u.listener===n){for(let c in u.delegates)this.off(c,u.delegates[c]);return s.splice(l,1),this}}};return this._delegatedListeners&&this._delegatedListeners[t]&&o(this._delegatedListeners),this}queryRenderedFeatures(t,i){if(!this.style)return[];let n,o=t instanceof ur.default||Array.isArray(t),a=o?t:[[0,0],[this.transform.width,this.transform.height]];if(i=i||(o?{}:t)||{},a instanceof ur.default||typeof a[0]=="number")n=[ur.default.convert(a)];else{let s=ur.default.convert(a[0]),l=ur.default.convert(a[1]);n=[s,new ur.default(l.x,s.y),l,new ur.default(s.x,l.y),s]}return this.style.queryRenderedFeatures(n,i,this.transform)}querySourceFeatures(t,i){return this.style.querySourceFeatures(t,i)}setStyle(t,i){return i=O({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},i),i.diff!==!1&&i.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&t?(this._diffStyle(t,i),this):(this._localIdeographFontFamily=i.localIdeographFontFamily,this._updateStyle(t,i))}setTransformRequest(t){return this._requestManager.setTransformRequest(t),this}_getUIString(t){let i=this._locale[t];if(i==null)throw new Error(`Missing UI string '${t}'`);return i}_updateStyle(t,i){if(i.transformStyle&&this.style&&!this.style._loaded){this.style.once("style.load",()=>this._updateStyle(t,i));return}let n=this.style&&i.transformStyle?this.style.serialize():void 0;if(this.style&&(this.style.setEventedParent(null),this.style._remove(!t)),t)this.style=new pn(this,i||{});else return delete this.style,this;return this.style.setEventedParent(this,{style:this.style}),typeof t=="string"?this.style.loadURL(t,i,n):this.style.loadJSON(t,i,n),this}_lazyInitEmptyStyle(){this.style||(this.style=new pn(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(t,i){if(typeof t=="string"){let n=t,o=this._requestManager.transformRequest(n,"Style");fr(o,new AbortController).then(a=>{this._updateDiff(a.data,i)}).catch(a=>{a&&this.fire(new Z(a))})}else typeof t=="object"&&this._updateDiff(t,i)}_updateDiff(t,i){try{this.style.setState(t,i)&&this._update(!0)}catch(n){ke(`Unable to perform style diff: ${n.message||n.error||n}. Rebuilding the style from scratch.`),this._updateStyle(t,i)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():ke("There is no style added to the map.")}addSource(t,i){return this._lazyInitEmptyStyle(),this.style.addSource(t,i),this._update(!0)}isSourceLoaded(t){let i=this.style&&this.style.sourceCaches[t];if(i===void 0){this.fire(new Z(new Error(`There is no source with ID '${t}'`)));return}return i.loaded()}setTerrain(t){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),!t)this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.minElevationForCurrentTile=0,this.transform.elevation=0;else{let i=this.style.sourceCaches[t.source];if(!i)throw new Error(`cannot load terrain, because there exists no source with ID: ${t.source}`);this.terrain===null&&i.reload();for(let n in this.style._layers){let o=this.style._layers[n];o.type==="hillshade"&&o.source===t.source&&ke("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 uc(this.painter,i,t),this.painter.renderToTexture=new pc(this.painter,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=n=>{n.dataType==="style"?this.terrain.sourceCache.freeRtt():n.dataType==="source"&&n.tile&&(n.sourceId===t.source&&!this._elevationFreeze&&(this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(n.tile.tileID))},this.style.on("data",this._terrainDataCallback)}return this.fire(new z("terrain",{terrain:t})),this}getTerrain(){return this.terrain?.options??null}areTilesLoaded(){let t=this.style&&this.style.sourceCaches;for(let i in t){let o=t[i]._tiles;for(let a in o){let s=o[a];if(!(s.state==="loaded"||s.state==="errored"))return!1}}return!0}removeSource(t){return this.style.removeSource(t),this._update(!0)}getSource(t){return this.style.getSource(t)}addImage(t,i,n={}){let{pixelRatio:o=1,sdf:a=!1,stretchX:s,stretchY:l,content:u}=n;this._lazyInitEmptyStyle();let c=0;if(i instanceof HTMLImageElement||pt(i)){let{width:p,height:h,data:f}=K.getImageData(i);this.style.addImage(t,{data:new we({width:p,height:h},f),pixelRatio:o,stretchX:s,stretchY:l,content:u,sdf:a,version:c})}else{if(i.width===void 0||i.height===void 0)return this.fire(new Z(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:p,height:h,data:f}=i,d=i;return this.style.addImage(t,{data:new we({width:p,height:h},new Uint8Array(f)),pixelRatio:o,stretchX:s,stretchY:l,content:u,sdf:a,version:c,userImage:d}),d.onAdd&&d.onAdd(this,t),this}}}updateImage(t,i){let n=this.style.getImage(t);if(!n)return this.fire(new Z(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let o=i instanceof HTMLImageElement||pt(i)?K.getImageData(i):i,{width:a,height:s,data:l}=o;if(a===void 0||s===void 0)return this.fire(new Z(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!==n.data.width||s!==n.data.height)return this.fire(new Z(new Error("The width and height of the updated image must be that same as the previous version of the image")));let u=!(i instanceof HTMLImageElement||pt(i));return n.data.replace(l,u),this.style.updateImage(t,n),this}getImage(t){return this.style.getImage(t)}hasImage(t){return t?!!this.style.getImage(t):(this.fire(new Z(new Error("Missing required image id"))),!1)}removeImage(t){this.style.removeImage(t)}loadImage(t){return st.getImage(this._requestManager.transformRequest(t,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(t,i){return this._lazyInitEmptyStyle(),this.style.addLayer(t,i),this._update(!0)}moveLayer(t,i){return this.style.moveLayer(t,i),this._update(!0)}removeLayer(t){return this.style.removeLayer(t),this._update(!0)}getLayer(t){return this.style.getLayer(t)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(t,i,n){return this.style.setLayerZoomRange(t,i,n),this._update(!0)}setFilter(t,i,n={}){return this.style.setFilter(t,i,n),this._update(!0)}getFilter(t){return this.style.getFilter(t)}setPaintProperty(t,i,n,o={}){return this.style.setPaintProperty(t,i,n,o),this._update(!0)}getPaintProperty(t,i){return this.style.getPaintProperty(t,i)}setLayoutProperty(t,i,n,o={}){return this.style.setLayoutProperty(t,i,n,o),this._update(!0)}getLayoutProperty(t,i){return this.style.getLayoutProperty(t,i)}setGlyphs(t,i={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(t,i),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(t,i,n={}){return this._lazyInitEmptyStyle(),this.style.addSprite(t,i,n,o=>{o||this._update(!0)}),this}removeSprite(t){return this._lazyInitEmptyStyle(),this.style.removeSprite(t),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(t,i={}){return this._lazyInitEmptyStyle(),this.style.setSprite(t,i,n=>{n||this._update(!0)}),this}setLight(t,i={}){return this._lazyInitEmptyStyle(),this.style.setLight(t,i),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(t,i){return this.style.setFeatureState(t,i),this._update()}removeFeatureState(t,i){return this.style.removeFeatureState(t,i),this._update()}getFeatureState(t){return this.style.getFeatureState(t)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let t=0,i=0;return this._container&&(t=this._container.clientWidth||400,i=this._container.clientHeight||300),[t,i]}_setupContainer(){let t=this._container;t.classList.add("maplibregl-map");let i=this._canvasContainer=L.create("div","maplibregl-canvas-container",t);this._interactive&&i.classList.add("maplibregl-interactive"),this._canvas=L.create("canvas","maplibregl-canvas",i),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");let n=this._containerDimensions(),o=this._getClampedPixelRatio(n[0],n[1]);this._resizeCanvas(n[0],n[1],o);let a=this._controlContainer=L.create("div","maplibregl-control-container",t),s=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(l=>{s[l]=L.create("div",`maplibregl-ctrl-${l} `,a)})}_resizeCanvas(t,i,n){this._canvas.width=Math.floor(n*t),this._canvas.height=Math.floor(n*i),this._canvas.style.width=`${t}px`,this._canvas.style.height=`${i}px`}_setupPainter(){let t={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1},i=null;this._canvas.addEventListener("webglcontextcreationerror",o=>{i={requestedAttributes:t},o&&(i.statusMessage=o.statusMessage,i.type=o.type)},{once:!0});let n=this._canvas.getContext("webgl2",t)||this._canvas.getContext("webgl",t);if(!n){let o="Failed to initialize WebGL";throw i?(i.message=o,new Error(JSON.stringify(i))):new Error(o)}this.painter=new Ru(n,this.transform),vn.testSupport(n)}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(t){return!this.style||!this.style._loaded?this:(this._styleDirty=this._styleDirty||t,this._sourcesDirty=!0,this.triggerRepaint(),this)}_requestRenderFrame(t){return this._update(),this._renderTaskQueue.add(t)}_cancelRenderFrame(t){this._renderTaskQueue.remove(t)}_render(t){let i=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(t),this._removed)return;let n=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let a=this.transform.zoom,s=K.now();this.style.zoomHistory.update(a,s);let l=new de(a,{now:s,fadeDuration:i,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),u=l.crossFadingFactor();(u!==1||u!==this._crossFadingFactor)&&(n=!0,this._crossFadingFactor=u),this.style.update(l)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain&&(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.minElevationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,i,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:i,showPadding:this.showPadding}),this.fire(new z("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,mn.mark("load"),this.fire(new z("load"))),this.style&&(this.style.hasTransitions()||n)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let o=this._sourcesDirty||this._styleDirty||this._placementDirty;return o||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new z("idle")),this._loaded&&!this._fullyLoaded&&!o&&(this._fullyLoaded=!0,mn.mark("fullLoad")),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){this._hash&&this._hash.remove();for(let i of this._controls)i.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),st.removeThrottleControl(this._imageQueueHandle),this._resizeObserver?.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),L.remove(this._canvasContainer),L.remove(this._controlContainer),this._container.classList.remove("maplibregl-map"),mn.clearMetrics(),this._removed=!0,this.fire(new z("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,K.frameAsync(this._frameRequest).then(t=>{mn.frame(t),this._frameRequest=null,this._render(t)}).catch(()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update())}get showPadding(){return!!this._showPadding}set showPadding(t){this._showPadding!==t&&(this._showPadding=t,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,t?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update())}get repaint(){return!!this._repaint}set repaint(t){this._repaint!==t&&(this._repaint=t,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(t){this._vertices=t,this._update()}get version(){return TM}getCameraTargetElevation(){return this.transform.elevation}};m();m();var b_=r=>{r.touchstart=r.dragStart,r.touchmoveWindow=r.dragMove,r.touchend=r.dragEnd},__=({enable:r,clickTolerance:e,bearingDegreesPerPixelMoved:t=.8})=>{let i=new ma;return new lr({clickTolerance:e,move:(n,o)=>({bearingDelta:(o.x-n.x)*t}),moveStateManager:i,enable:r,assignEvents:b_})},v_=({enable:r,clickTolerance:e,pitchDegreesPerPixelMoved:t=-.5})=>{let i=new ma;return new lr({clickTolerance:e,move:(n,o)=>({pitchDelta:(o.y-n.y)*t}),moveStateManager:i,enable:r,assignEvents:b_})};var MM={showCompass:!0,showZoom:!0,visualizePitch:!1},Oh=class{constructor(e){this._updateZoomButtons=()=>{let e=this._map.getZoom(),t=e===this._map.getMaxZoom(),i=e===this._map.getMinZoom();this._zoomInButton.disabled=t,this._zoomOutButton.disabled=i,this._zoomInButton.setAttribute("aria-disabled",t.toString()),this._zoomOutButton.setAttribute("aria-disabled",i.toString())};this._rotateCompassArrow=()=>{let e=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=e};this._setButtonTitle=(e,t)=>{let i=this._map._getUIString(`NavigationControl.${t}`);e.title=i,e.setAttribute("aria-label",i)};this.options=O({},MM,e),this._container=L.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),L.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",t=>this._map.zoomOut({},{originalEvent:t})),L.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})}),this._compassIcon=L.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 Vh(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){L.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 i=L.create("button",e,this._container);return i.type="button",i.addEventListener("click",t),i}},Vh=class{constructor(e,t,i=!1){this.mousedown=e=>{this.startMouse(O({},e,{ctrlKey:!0,preventDefault:()=>e.preventDefault()}),L.mousePos(this.element,e)),L.addEventListener(window,"mousemove",this.mousemove),L.addEventListener(window,"mouseup",this.mouseup)};this.mousemove=e=>{this.moveMouse(e,L.mousePos(this.element,e))};this.mouseup=e=>{this.mouseRotate.dragEnd(e),this.mousePitch&&this.mousePitch.dragEnd(e),this.offTemp()};this.touchstart=e=>{e.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=L.touchPos(this.element,e.targetTouches)[0],this.startTouch(e,this._startPos),L.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),L.addEventListener(window,"touchend",this.touchend))};this.touchmove=e=>{e.targetTouches.length!==1?this.reset():(this._lastPos=L.touchPos(this.element,e.targetTouches)[0],this.moveTouch(e,this._lastPos))};this.touchend=e=>{e.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()};this.reset=()=>{this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()};this._clickTolerance=10;let n=e.dragRotate._mouseRotate.getClickTolerance(),o=e.dragRotate._mousePitch.getClickTolerance();this.element=t,this.mouseRotate=Xu({clickTolerance:n,enable:!0}),this.touchRotate=__({clickTolerance:n,enable:!0}),this.map=e,i&&(this.mousePitch=Ku({clickTolerance:o,enable:!0}),this.touchPitch=v_({clickTolerance:o,enable:!0})),L.addEventListener(t,"mousedown",this.mousedown),L.addEventListener(t,"touchstart",this.touchstart,{passive:!1}),L.addEventListener(t,"touchcancel",this.reset)}startMouse(e,t){this.mouseRotate.dragStart(e,t),this.mousePitch&&this.mousePitch.dragStart(e,t),L.disableDrag()}startTouch(e,t){this.touchRotate.dragStart(e,t),this.touchPitch&&this.touchPitch.dragStart(e,t),L.disableDrag()}moveMouse(e,t){let i=this.map,{bearingDelta:n}=this.mouseRotate.dragMove(e,t)||{};if(n&&i.setBearing(i.getBearing()+n),this.mousePitch){let{pitchDelta:o}=this.mousePitch.dragMove(e,t)||{};o&&i.setPitch(i.getPitch()+o)}}moveTouch(e,t){let i=this.map,{bearingDelta:n}=this.touchRotate.dragMove(e,t)||{};if(n&&i.setBearing(i.getBearing()+n),this.touchPitch){let{pitchDelta:o}=this.touchPitch.dragMove(e,t)||{};o&&i.setPitch(i.getPitch()+o)}}off(){let e=this.element;L.removeEventListener(e,"mousedown",this.mousedown),L.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),L.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),L.removeEventListener(window,"touchend",this.touchend),L.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){L.enableDrag(),L.removeEventListener(window,"mousemove",this.mousemove),L.removeEventListener(window,"mouseup",this.mouseup),L.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),L.removeEventListener(window,"touchend",this.touchend)}};m();m();var mi;async function w_(r=!1){if(mi!==void 0&&!r)return mi;if(window.navigator.permissions===void 0)return mi=!!window.navigator.geolocation,mi;try{mi=(await window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{mi=!!window.navigator.geolocation}return mi}m();var Ea=ne(ye(),1);m();function mc(r,e,t){let i=new re(r.lng,r.lat);if(r=new re(r.lng,r.lat),e){let n=new re(r.lng-360,r.lat),o=new re(r.lng+360,r.lat),a=t.locationPoint(r).distSqr(e);t.locationPoint(n).distSqr(e)<a?r=n:t.locationPoint(o).distSqr(e)<a&&(r=o)}for(;Math.abs(r.lng-t.center.lng)>180;){let n=t.locationPoint(r);if(n.x>=0&&n.y>=0&&n.x<=t.width&&n.y<=t.height)break;r.lng>t.center.lng?r.lng-=360:r.lng+=360}return r.lng!==i.lng&&t.locationPoint(r).y>t.height/2-t.getHorizon()?r:i}m();var Ca={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 dc(r,e,t){let i=r.classList;for(let n in Ca)i.remove(`maplibregl-${t}-anchor-${n}`);i.add(`maplibregl-${t}-anchor-${e}`)}var yn=class extends me{constructor(t){super();this._onKeyPress=t=>{let i=t.code,n=t.charCode||t.keyCode;(i==="Space"||i==="Enter"||n===32||n===13)&&this.togglePopup()};this._onMapClick=t=>{let i=t.originalEvent.target,n=this._element;this._popup&&(i===n||n.contains(i))&&this.togglePopup()};this._update=t=>{if(!this._map)return;let i=this._map.loaded()&&!this._map.isMoving();(t?.type==="terrain"||t?.type==="render"&&!i)&&this._map.once("render",this._update),this._map.transform.renderWorldCopies?this._lngLat=mc(this._lngLat,this._flatPos,this._map.transform):this._lngLat=this._lngLat?.wrap(),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationPoint(this._lngLat)._add(this._offset));let n="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?n=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(n=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let o="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?o="rotateX(0deg)":this._pitchAlignment==="map"&&(o=`rotateX(${this._map.getPitch()}deg)`),(!t||t.type==="moveend")&&(this._pos=this._pos.round()),L.setTransform(this._element,`${Ca[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${o} ${n}`),K.frameAsync(new AbortController).then(()=>{this._updateOpacity(t&&t.type==="moveend")}).catch(()=>{})};this._onMove=t=>{if(!this._isDragging){let i=this._clickTolerance||this._map._clickTolerance;this._isDragging=t.point.dist(this._pointerdownPos)>=i}this._isDragging&&(this._pos=t.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new z("dragstart"))),this.fire(new z("drag")))};this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new z("dragend")),this._state="inactive"};this._addDragHandler=t=>{this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._offset),this._pointerdownPos=t.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))};if(this._anchor=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment!=="auto"?t.pitchAlignment:this._rotationAlignment,this.setOpacity(),this.setOpacity(t?.opacity,t?.opacityWhenCovered),!t||!t.element){this._defaultMarker=!0,this._element=L.create("div"),this._element.setAttribute("aria-label","Map marker");let i=L.createNS("http://www.w3.org/2000/svg","svg"),n=41,o=27;i.setAttributeNS(null,"display","block"),i.setAttributeNS(null,"height",`${n}px`),i.setAttributeNS(null,"width",`${o}px`),i.setAttributeNS(null,"viewBox",`0 0 ${o} ${n}`);let a=L.createNS("http://www.w3.org/2000/svg","g");a.setAttributeNS(null,"stroke","none"),a.setAttributeNS(null,"stroke-width","1"),a.setAttributeNS(null,"fill","none"),a.setAttributeNS(null,"fill-rule","evenodd");let s=L.createNS("http://www.w3.org/2000/svg","g");s.setAttributeNS(null,"fill-rule","nonzero");let l=L.createNS("http://www.w3.org/2000/svg","g");l.setAttributeNS(null,"transform","translate(3.0, 29.0)"),l.setAttributeNS(null,"fill","#000000");let u=[{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 v of u){let b=L.createNS("http://www.w3.org/2000/svg","ellipse");b.setAttributeNS(null,"opacity","0.04"),b.setAttributeNS(null,"cx","10.5"),b.setAttributeNS(null,"cy","5.80029008"),b.setAttributeNS(null,"rx",v.rx),b.setAttributeNS(null,"ry",v.ry),l.appendChild(b)}let c=L.createNS("http://www.w3.org/2000/svg","g");c.setAttributeNS(null,"fill",this._color);let p=L.createNS("http://www.w3.org/2000/svg","path");p.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"),c.appendChild(p);let h=L.createNS("http://www.w3.org/2000/svg","g");h.setAttributeNS(null,"opacity","0.25"),h.setAttributeNS(null,"fill","#000000");let f=L.createNS("http://www.w3.org/2000/svg","path");f.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),h.appendChild(f);let d=L.createNS("http://www.w3.org/2000/svg","g");d.setAttributeNS(null,"transform","translate(6.0, 7.0)"),d.setAttributeNS(null,"fill","#FFFFFF");let y=L.createNS("http://www.w3.org/2000/svg","g");y.setAttributeNS(null,"transform","translate(8.0, 8.0)");let g=L.createNS("http://www.w3.org/2000/svg","circle");g.setAttributeNS(null,"fill","#000000"),g.setAttributeNS(null,"opacity","0.25"),g.setAttributeNS(null,"cx","5.5"),g.setAttributeNS(null,"cy","5.5"),g.setAttributeNS(null,"r","5.4999962");let x=L.createNS("http://www.w3.org/2000/svg","circle");x.setAttributeNS(null,"fill","#FFFFFF"),x.setAttributeNS(null,"cx","5.5"),x.setAttributeNS(null,"cy","5.5"),x.setAttributeNS(null,"r","5.4999962"),y.appendChild(g),y.appendChild(x),s.appendChild(l),s.appendChild(c),s.appendChild(h),s.appendChild(d),s.appendChild(y),i.appendChild(s),i.setAttributeNS(null,"height",`${n*this._scale}px`),i.setAttributeNS(null,"width",`${o*this._scale}px`),this._element.appendChild(i),this._offset=Ea.default.convert(t&&t.offset||[0,-14])}else this._element=t.element,this._offset=Ea.default.convert(t&&t.offset||[0,0]);if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",i=>{i.preventDefault()}),this._element.addEventListener("mousedown",i=>{i.preventDefault()}),dc(this._element,this._anchor,"marker"),t&&t.className)for(let i of t.className.split(" "))this._element.classList.add(i);this._popup=null}addTo(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),t.on("terrain",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),L.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=re.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){let o=Math.abs(13.5)/Math.SQRT2;t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[o,(38.1-13.5+o)*-1],"bottom-right":[-o,(38.1-13.5+o)*-1],left:[13.5,(38.1-13.5)*-1],right:[-13.5,(38.1-13.5)*-1]}:this._offset}this._popup=t,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}getPopup(){return this._popup}togglePopup(){let t=this._popup;if(this._element.style.opacity===this._opacityWhenCovered)return this;if(t)t.isOpen()?t.remove():(t.setLngLat(this._lngLat),t.addTo(this._map));else return this;return this}_updateOpacity(t=!1){if(!this._map?.terrain){this._element.style.opacity!==this._opacity&&(this._element.style.opacity=this._opacity);return}if(t)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}let n=this._map,o=n.terrain.depthAtPoint(this._pos),a=n.terrain.getElevationForLngLatZoom(this._lngLat,n.transform.tileZoom),s=n.transform.lngLatToCameraDepth(this._lngLat,a),l=.006;if(s-o<l){this._element.style.opacity=this._opacity;return}let u=-this._offset.y/n.transform._pixelPerMeter,c=Math.sin(n.getPitch()*Math.PI/180)*u,p=n.terrain.depthAtPoint(new Ea.default(this._pos.x,this._pos.y-this._offset.y)),f=n.transform.lngLatToCameraDepth(this._lngLat,a+c)-p>l;this._popup?.isOpen()&&f&&this._popup.remove(),this._element.style.opacity=f?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(t){return this._offset=Ea.default.convert(t),this._update(),this}addClassName(t){this._element.classList.add(t)}removeClassName(t){this._element.classList.remove(t)}toggleClassName(t){return this._element.classList.toggle(t)}setDraggable(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&t!=="auto"?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(t,i){return t===void 0&&i===void 0&&(this._opacity="1",this._opacityWhenCovered="0.2"),t!==void 0&&(this._opacity=t),i!==void 0&&(this._opacityWhenCovered=i),this._map&&this._updateOpacity(!0),this}};var IM={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},yc=0,ka=!1,Uh=class extends me{constructor(t){super();this._onSuccess=t=>{if(this._map){if(this._isOutOfMapMaxBounds(t)){this._setErrorState(),this.fire(new z("outofmaxbounds",t)),this._updateMarker(),this._finish();return}if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(t),(!this.options.trackUserLocation||this._watchState==="ACTIVE_LOCK")&&this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new z("geolocate",t)),this._finish()}};this._updateCamera=t=>{let i=new re(t.coords.longitude,t.coords.latitude),n=t.coords.accuracy,o=this._map.getBearing(),a=O({bearing:o},this.options.fitBoundsOptions),s=ut.fromLngLat(i,n);this._map.fitBounds(s,a,{geolocateSource:!0})};this._updateMarker=t=>{if(t){let i=new re(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=t.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()};this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()};this._onError=t=>{if(this._map){if(this.options.trackUserLocation)if(t.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;let i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(t.code===3&&ka)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new z("error",t)),this._finish()}};this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0};this._setupUI=t=>{if(this._map){if(this._container.addEventListener("contextmenu",i=>i.preventDefault()),this._geolocateButton=L.create("button","maplibregl-ctrl-geolocate",this._container),L.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",t===!1){ke("Geolocation support is not available so the GeolocateControl will be disabled.");let i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}else{let i=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=L.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new yn({element:this._dotElement}),this._circleElement=L.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new yn({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",i=>{let n=i.originalEvent&&i.originalEvent.type==="resize";!i.geolocateSource&&this._watchState==="ACTIVE_LOCK"&&!n&&(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new z("trackuserlocationend")))})}};this.options=O({},IM,t)}onAdd(t){return this._map=t,this._container=L.create("div","maplibregl-ctrl maplibregl-ctrl-group"),w_().then(i=>this._setupUI(i)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),L.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,yc=0,ka=!1}_isOutOfMapMaxBounds(t){let i=this._map.getMaxBounds(),n=t.coords;return i&&(n.longitude<i.getWest()||n.longitude>i.getEast()||n.latitude<i.getSouth()||n.latitude>i.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 ${this._watchState}`)}}_updateCircleRadius(){let t=this._map.getBounds(),i=t.getSouthEast(),n=t.getNorthEast(),o=i.distanceTo(n),a=this._map._container.clientHeight,s=Math.ceil(2*(this._accuracy/(o/a)));this._circleElement.style.width=`${s}px`,this._circleElement.style.height=`${s}px`}trigger(){if(!this._setup)return ke("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":yc--,ka=!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 ${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 ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),yc++;let t;yc>1?(t={maximumAge:6e5,timeout:0},ka=!0):(t=this.options.positionOptions,ka=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,t)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}};m();var CM={maxWidth:100,unit:"metric"},Nh=class{constructor(e){this._onMove=()=>{S_(this._map,this._container,this.options)};this.setUnit=e=>{this.options.unit=e,S_(this._map,this._container,this.options)};this.options={...CM,...e}}getDefaultPosition(){return"bottom-left"}onAdd(e){return this._map=e,this._container=L.create("div","maplibregl-ctrl maplibregl-ctrl-scale",e.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){L.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}};function S_(r,e,t){let i=t&&t.maxWidth||100,n=r._container.clientHeight/2,o=r.unproject([0,n]),a=r.unproject([i,n]),s=o.distanceTo(a);if(t&&t.unit==="imperial"){let l=3.2808*s;if(l>5280){let u=l/5280;La(e,i,u,r._getUIString("ScaleControl.Miles"))}else La(e,i,l,r._getUIString("ScaleControl.Feet"))}else if(t&&t.unit==="nautical"){let l=s/1852;La(e,i,l,r._getUIString("ScaleControl.NauticalMiles"))}else s>=1e3?La(e,i,s/1e3,r._getUIString("ScaleControl.Kilometers")):La(e,i,s,r._getUIString("ScaleControl.Meters"))}function La(r,e,t,i){let n=kM(t),o=n/t;r.style.width=`${e*o}px`,r.innerHTML=`${n}&nbsp;${i}`}function EM(r){let e=Math.pow(10,Math.ceil(-Math.log(r)/Math.LN10));return Math.round(r*e)/e}function kM(r){let e=Math.pow(10,`${Math.floor(r)}`.length-1),t=r/e;return t=t>=10?10:t>=5?5:t>=3?3:t>=2?2:t>=1?1:EM(t),e*t}m();var Gh=class extends me{constructor(t={}){super();this._onFullscreenChange=()=>{let t=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;t?.shadowRoot?.fullscreenElement;)t=t.shadowRoot.fullscreenElement;t===this._container!==this._fullscreen&&this._handleFullscreenChange()};this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()};this._fullscreen=!1,t&&t.container&&(t.container instanceof HTMLElement?this._container=t.container:ke("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(t){return this._map=t,this._container||(this._container=this._map.getContainer()),this._controlContainer=L.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){L.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){let t=this._fullscreenButton=L.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);L.create("span","maplibregl-ctrl-icon",t).setAttribute("aria-hidden","true"),t.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){let t=this._getTitle();this._fullscreenButton.setAttribute("aria-label",t),this._fullscreenButton.title=t}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new z("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new z("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}};m();var $h=class{constructor(e){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()};this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))};this.options=e}onAdd(e){return this._map=e,this._container=L.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=L.create("button","maplibregl-ctrl-terrain",this._container),L.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(){L.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}};m();var Ge=ne(ye(),1);var LM={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1},DM=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", "),qh=class extends me{constructor(t){super();this.remove=()=>(this._content&&L.remove(this._content),this._container&&(L.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new z("close"))),this);this._onMouseUp=t=>{this._update(t.point)};this._onMouseMove=t=>{this._update(t.point)};this._onDrag=t=>{this._update(t.point)};this._update=t=>{let i=this._lngLat||this._trackPointer;if(!this._map||!i||!this._content)return;if(!this._container){if(this._container=L.create("div","maplibregl-popup",this._map.getContainer()),this._tip=L.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(let l of this.options.className.split(" "))this._container.classList.add(l);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=mc(this._lngLat,this._flatPos,this._map.transform):this._lngLat=this._lngLat?.wrap(),this._trackPointer&&!t)return;let n=this._flatPos=this._pos=this._trackPointer&&t?t:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&t?t:this._map.transform.locationPoint(this._lngLat));let o=this.options.anchor,a=P_(this.options.offset);if(!o){let l=this._container.offsetWidth,u=this._container.offsetHeight,c;n.y+a.bottom.y<u?c=["top"]:n.y>this._map.transform.height-u?c=["bottom"]:c=[],n.x<l/2?c.push("left"):n.x>this._map.transform.width-l/2&&c.push("right"),c.length===0?o="bottom":o=c.join("-")}let s=n.add(a[o]);this.options.subpixelPositioning||(s=s.round()),L.setTransform(this._container,`${Ca[o]} translate(${s.x}px,${s.y}px)`),dc(this._container,o,"popup")};this._onClose=()=>{this.remove()};this.options=O(Object.create(LM),t)}addTo(t){return this._map&&this.remove(),this._map=t,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new z("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=re.convert(t),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(t){return this.setDOMContent(document.createTextNode(t))}setHTML(t){let i=document.createDocumentFragment(),n=document.createElement("body"),o;for(n.innerHTML=t;o=n.firstChild,!!o;)i.appendChild(o);return this.setDOMContent(i)}getMaxWidth(){return this._container?.style.maxWidth}setMaxWidth(t){return this.options.maxWidth=t,this._update(),this}setDOMContent(t){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=L.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(t),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(t){this._container&&this._container.classList.add(t)}removeClassName(t){this._container&&this._container.classList.remove(t)}setOffset(t){return this.options.offset=t,this._update(),this}toggleClassName(t){if(this._container)return this._container.classList.toggle(t)}setSubpixelPositioning(t){this.options.subpixelPositioning=t}_createCloseButton(){this.options.closeButton&&(this._closeButton=L.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 t=this._container.querySelector(DM);t&&t.focus()}};function P_(r){if(r)if(typeof r=="number"){let e=Math.round(Math.abs(r)/Math.SQRT2);return{center:new Ge.default(0,0),top:new Ge.default(0,r),"top-left":new Ge.default(e,e),"top-right":new Ge.default(-e,e),bottom:new Ge.default(0,-r),"bottom-left":new Ge.default(e,-e),"bottom-right":new Ge.default(-e,-e),left:new Ge.default(r,0),right:new Ge.default(-r,0)}}else if(r instanceof Ge.default||Array.isArray(r)){let e=Ge.default.convert(r);return{center:e,top:e,"top-left":e,"top-right":e,bottom:e,"bottom-left":e,"bottom-right":e,left:e,right:e}}else return{center:Ge.default.convert(r.center||[0,0]),top:Ge.default.convert(r.top||[0,0]),"top-left":Ge.default.convert(r["top-left"]||[0,0]),"top-right":Ge.default.convert(r["top-right"]||[0,0]),bottom:Ge.default.convert(r.bottom||[0,0]),"bottom-left":Ge.default.convert(r["bottom-left"]||[0,0]),"bottom-right":Ge.default.convert(r["bottom-right"]||[0,0]),left:Ge.default.convert(r.left||[0,0]),right:Ge.default.convert(r.right||[0,0])};else return P_(new Ge.default(0,0))}var zM=ne(ye(),1);var FM=Da.version;function vY(r,e){return zr().setRTLTextPlugin(r,e)}function wY(){return zr().getRTLTextPluginStatus()}function SY(){return FM}function PY(){return Er.workerCount}function TY(r){Er.workerCount=r}function AY(){return Je.MAX_PARALLEL_IMAGE_REQUESTS}function MY(r){Je.MAX_PARALLEL_IMAGE_REQUESTS=r}function IY(){return Je.WORKER_URL}function CY(r){Je.WORKER_URL=r}function EY(r){return Pl().broadcast("IS",r)}export{Eg as a,Ip as b,Je as c,F_ as d,R_ as e,Vr as f,me as g,tA as h,rA as i,re as j,ut as k,ze as l,qo as m,ui as n,Zo as o,Ho as p,kt as q,Wo as r,Xo as s,hA as t,pn as u,ua as v,Uu as w,ca as x,it as y,Fr as z,pa as A,ha as B,ya as C,ga as D,xa as E,ba as F,_a as G,va as H,wa as I,Sa as J,Pa as K,Ta as L,Aa as M,Ma as N,Bh as O,Oh as P,yn as Q,Uh as R,Nh as S,Gh as T,$h as U,qh as V,zM as W,vY as X,wY as Y,SY as Z,PY as _,TY as $,AY as aa,MY as ba,IY as ca,CY as da,EY as ea};
578
+ //# sourceMappingURL=chunk-BBNTGIFB.js.map