@wodira/browser 1.1.0 → 1.2.1

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 (43) hide show
  1. package/CHANGELOG.md +24 -1
  2. package/README.md +106 -1
  3. package/dist/index.cjs +36 -0
  4. package/dist/index.d.ts +90 -1
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +36 -0
  7. package/dist/types.d.ts +3 -0
  8. package/dist/types.d.ts.map +1 -1
  9. package/dist/ui/boxes/cdn.js +15 -15
  10. package/dist/ui/components.d.ts +18 -1
  11. package/dist/ui/components.d.ts.map +1 -1
  12. package/dist/ui/events.d.ts +1 -1
  13. package/dist/ui/events.d.ts.map +1 -1
  14. package/dist/ui/i18n.d.ts +1 -1
  15. package/dist/ui/i18n.d.ts.map +1 -1
  16. package/dist/ui/{index-tfej862z.js → index-1zshfsk6.js} +45 -1563
  17. package/dist/ui/index-3qe91gk8.js +1625 -0
  18. package/dist/ui/index-bjb0t7yn.js +1624 -0
  19. package/dist/ui/index.d.ts +1 -0
  20. package/dist/ui/index.d.ts.map +1 -1
  21. package/dist/ui/index.js +290 -125
  22. package/dist/ui/map-view-rn3jgtqn.js +28737 -0
  23. package/dist/ui/maplibre-gl-worker.mjs +10 -0
  24. package/dist/ui/route-3d/cdn.d.ts +2 -0
  25. package/dist/ui/route-3d/cdn.d.ts.map +1 -0
  26. package/dist/ui/route-3d/cdn.js +1527 -0
  27. package/dist/ui/route-3d/gpx.d.ts +14 -0
  28. package/dist/ui/route-3d/gpx.d.ts.map +1 -0
  29. package/dist/ui/route-3d/index.d.ts +12 -0
  30. package/dist/ui/route-3d/index.d.ts.map +1 -0
  31. package/dist/ui/route-3d/index.js +16 -0
  32. package/dist/ui/route-3d/map-view.d.ts +73 -0
  33. package/dist/ui/route-3d/map-view.d.ts.map +1 -0
  34. package/dist/ui/route-3d/maplibre-gl-worker.mjs +10 -0
  35. package/dist/ui/route-3d/route-3d.d.ts +168 -0
  36. package/dist/ui/route-3d/route-3d.d.ts.map +1 -0
  37. package/dist/ui/route-3d/route-geo.d.ts +77 -0
  38. package/dist/ui/route-3d/route-geo.d.ts.map +1 -0
  39. package/dist/ui/shirt-sponsors/cdn.js +29 -27
  40. package/dist/ui/shirt-sponsors/index.js +5 -3
  41. package/dist/ui/shirt-sponsors/shirt-auction.d.ts +19 -0
  42. package/dist/ui/shirt-sponsors/shirt-auction.d.ts.map +1 -1
  43. package/package.json +15 -6
@@ -0,0 +1,1527 @@
1
+ var $c=(e,t,i)=>()=>{if(e)try{t=e(e=0)}catch(r){i=[r]}if(i)throw i[0];return t};function Cg(e,t){let i=Si(t.lat-e.lat),r=Si(t.lon-e.lon),a=Math.sin(i/2)**2+Math.cos(Si(e.lat))*Math.cos(Si(t.lat))*Math.sin(r/2)**2;return 12742017.6*Math.asin(Math.min(1,Math.sqrt(a)))}function Dg(e){let t=[],i=[],r=0,a=0,o=0,n=null,s=null,l=null;for(let u=0;u<e.length;u++){let c=e[u];if(u>0)r+=Cg(e[u-1],c);t.push(r);let h=typeof c.ele==="number"&&Number.isFinite(c.ele)?c.ele:null;if(i.push(h),h===null)continue;if(s=s===null?h:Math.min(s,h),l=l===null?h:Math.max(l,h),n===null)n=h;else if(h-n>=3)a+=h-n,n=h;else if(n-h>=3)o+=n-h,n=h}return{distances:t,elevations:i,distanceM:r,ascentM:a,descentM:o,minEleM:s,maxEleM:l,hasElevation:s!==null}}function l5(e,t){let i=0,r=e.length-1;while(i<r){let a=i+r+1>>1;if(e[a]<=t)i=a;else r=a-1}return i}function Ci(e,t,i){if(!e.length)return null;let r=Math.max(0,Math.min(t.distanceM,i)),a=Math.min(l5(t.distances,r),e.length-1),o=Math.min(a+1,e.length-1),n=e[a],s=e[o],l=t.distances[o]-t.distances[a],u=l>0?(r-t.distances[a])/l:0,c=t.elevations[a],h=t.elevations[o],d=c!==null&&c!==void 0&&h!==null&&h!==void 0?c+(h-c)*u:c??h??null;return{lat:n.lat+(s.lat-n.lat)*u,lon:n.lon+(s.lon-n.lon)*u,ele:d,bearing:$s(n,o===a?n:s),index:a}}function $s(e,t){let i=Math.sin(Si(t.lon-e.lon))*Math.cos(Si(t.lat)),r=Math.cos(Si(e.lat))*Math.sin(Si(t.lat))-Math.sin(Si(e.lat))*Math.cos(Si(t.lat))*Math.cos(Si(t.lon-e.lon));return(Math.atan2(i,r)*180/Math.PI+360)%360}function Us(e,t,i){let r=1/0,a=0,o=Math.cos(Si(i.lat));for(let n=0;n<e.length-1;n++){let s=e[n],l=e[n+1],u=(s.lon-i.lon)*o,c=s.lat-i.lat,h=(l.lon-s.lon)*o,d=l.lat-s.lat,p=h*h+d*d,f=p>0?Math.max(0,Math.min(1,-(u*h+c*d)/p)):0,m=u+h*f,g=c+d*f,_=m*m+g*g;if(_<r)r=_,a=t.distances[n]+(t.distances[n+1]-t.distances[n])*f}return a}function qs(e,t=10){let i=e/1000/t;for(let r of[1,2,5,10,20,25,50,100])if(i<=r)return r;return 200}function Ag(e,t,i=400){if(!t.hasElevation||t.distanceM<=0)return[];let r=[];for(let a=0;a<=i;a++){let o=t.distanceM*a/i,n=Ci(e,t,o);if(n?.ele!==null&&n?.ele!==void 0)r.push({distance:o,ele:n.ele})}return r}function Mg(e){let t=1/0,i=1/0,r=-1/0,a=-1/0;for(let o of e)t=Math.min(t,o.lon),r=Math.max(r,o.lon),i=Math.min(i,o.lat),a=Math.max(a,o.lat);return[t,i,r,a]}function Pg(e){return e.length>2&&Cg(e[0],e[e.length-1])<250}var Si=(e)=>e*Math.PI/180;function D(e,t){this.x=e,this.y=t}function m5(e,t,i,r){let a=3*e,o=3*(i-e)-a,n=1-a-o,s=3*t,l=3*(r-t)-s,u=1-s-l;return function(c,h=0.000001){if(c<=0)return 0;if(c>=1)return 1;let d=c;for(let m=0;m<8;m++){let g=((n*d+o)*d+a)*d-c;if(Math.abs(g)<h)return((u*d+l)*d+s)*d;let _=(3*n*d+2*o)*d+a;if(Math.abs(_)<0.000001)break;d-=g/_}let p=0,f=1;d=c;for(let m=0;m<20;m++){let g=((n*d+o)*d+a)*d;if(Math.abs(g-c)<h)break;c>g?p=d:f=d,d=(p+f)*0.5}return((u*d+l)*d+s)*d}}function kp(){return Ig??=typeof OffscreenCanvas<"u"&&!!new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function",Ig}function py(){if(Gs==null&&(Gs=!1,kp())){let e=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(e){for(let i=0;i<25;i++){let r=i*4;e.fillStyle=`rgb(${r},${r+1},${r+2})`,e.fillRect(i%5,Math.floor(i/5),1,1)}let t=e.getImageData(0,0,5,5).data;for(let i=0;i<100;i++)if(i%4!=3&&t[i]!==i){Gs=!0;break}}}return Gs||!1}function Qh(){var e=new At(4);return At!=Float32Array&&(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e}function g5(e,t){var i=t[0],r=t[1],a=t[2],o=t[3],n=i*o-a*r;return n?(n=1/n,e[0]=o*n,e[1]=-r*n,e[2]=-a*n,e[3]=i*n,e):null}function _5(e){return e[0]*e[3]-e[2]*e[1]}function y5(e,t,i){var r=t[0],a=t[1],o=t[2],n=t[3],s=Math.sin(i),l=Math.cos(i);return e[0]=r*l+o*s,e[1]=a*l+n*s,e[2]=r*-s+o*l,e[3]=a*-s+n*l,e}function fy(){var e=new At(9);return At!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function v5(e){var t=e[0],i=e[1],r=e[2],a=e[3],o=e[4],n=e[5],s=e[6],l=e[7],u=e[8];return t*(u*o-n*l)+i*(-u*a+n*s)+r*(l*a-o*s)}function x5(e,t){var i=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=i,e[2]=0,e[3]=-i,e[4]=r,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function b5(e,t){var i=t[0],r=t[1],a=t[2],o=t[3],n=i+i,s=r+r,l=a+a,u=i*n,c=r*n,h=r*s,d=a*n,p=a*s,f=a*l,m=o*n,g=o*s,_=o*l;return e[0]=1-h-f,e[3]=c-_,e[6]=d+g,e[1]=c+_,e[4]=1-u-f,e[7]=p-m,e[2]=d-g,e[5]=p+m,e[8]=1-u-h,e}function Lo(){var e=new At(16);return At!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function ed(e){var t=new At(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function w5(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function er(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Vl(e,t){var i=t[0],r=t[1],a=t[2],o=t[3],n=t[4],s=t[5],l=t[6],u=t[7],c=t[8],h=t[9],d=t[10],p=t[11],f=t[12],m=t[13],g=t[14],_=t[15],y=i*s-r*n,v=i*l-a*n,x=i*u-o*n,b=r*l-a*s,w=r*u-o*s,T=a*u-o*l,E=c*m-h*f,S=c*g-d*f,A=c*_-p*f,I=h*g-d*m,R=h*_-p*m,k=d*_-p*g,M=y*k-v*R+x*I+b*A-w*S+T*E;return M?(M=1/M,e[0]=(s*k-l*R+u*I)*M,e[1]=(a*R-r*k-o*I)*M,e[2]=(m*T-g*w+_*b)*M,e[3]=(d*w-h*T-p*b)*M,e[4]=(l*A-n*k-u*S)*M,e[5]=(i*k-a*A+o*S)*M,e[6]=(g*x-f*T-_*v)*M,e[7]=(c*T-d*x+p*v)*M,e[8]=(n*R-s*A+u*E)*M,e[9]=(r*A-i*R-o*E)*M,e[10]=(f*w-m*x+_*y)*M,e[11]=(h*x-c*w-p*y)*M,e[12]=(s*S-n*I-l*E)*M,e[13]=(i*I-r*S+a*E)*M,e[14]=(m*v-f*b-g*y)*M,e[15]=(c*b-h*v+d*y)*M,e):null}function Rn(e,t,i){var r=t[0],a=t[1],o=t[2],n=t[3],s=t[4],l=t[5],u=t[6],c=t[7],h=t[8],d=t[9],p=t[10],f=t[11],m=t[12],g=t[13],_=t[14],y=t[15],v=i[0],x=i[1],b=i[2],w=i[3];return e[0]=v*r+x*s+b*h+w*m,e[1]=v*a+x*l+b*d+w*g,e[2]=v*o+x*u+b*p+w*_,e[3]=v*n+x*c+b*f+w*y,v=i[4],x=i[5],b=i[6],w=i[7],e[4]=v*r+x*s+b*h+w*m,e[5]=v*a+x*l+b*d+w*g,e[6]=v*o+x*u+b*p+w*_,e[7]=v*n+x*c+b*f+w*y,v=i[8],x=i[9],b=i[10],w=i[11],e[8]=v*r+x*s+b*h+w*m,e[9]=v*a+x*l+b*d+w*g,e[10]=v*o+x*u+b*p+w*_,e[11]=v*n+x*c+b*f+w*y,v=i[12],x=i[13],b=i[14],w=i[15],e[12]=v*r+x*s+b*h+w*m,e[13]=v*a+x*l+b*d+w*g,e[14]=v*o+x*u+b*p+w*_,e[15]=v*n+x*c+b*f+w*y,e}function gt(e,t,i){var r=i[0],a=i[1],o=i[2],n,s,l,u,c,h,d,p,f,m,g,_;return t===e?(e[12]=t[0]*r+t[4]*a+t[8]*o+t[12],e[13]=t[1]*r+t[5]*a+t[9]*o+t[13],e[14]=t[2]*r+t[6]*a+t[10]*o+t[14],e[15]=t[3]*r+t[7]*a+t[11]*o+t[15]):(n=t[0],s=t[1],l=t[2],u=t[3],c=t[4],h=t[5],d=t[6],p=t[7],f=t[8],m=t[9],g=t[10],_=t[11],e[0]=n,e[1]=s,e[2]=l,e[3]=u,e[4]=c,e[5]=h,e[6]=d,e[7]=p,e[8]=f,e[9]=m,e[10]=g,e[11]=_,e[12]=n*r+c*a+f*o+t[12],e[13]=s*r+h*a+m*o+t[13],e[14]=l*r+d*a+g*o+t[14],e[15]=u*r+p*a+_*o+t[15]),e}function Xt(e,t,i){var r=i[0],a=i[1],o=i[2];return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*a,e[5]=t[5]*a,e[6]=t[6]*a,e[7]=t[7]*a,e[8]=t[8]*o,e[9]=t[9]*o,e[10]=t[10]*o,e[11]=t[11]*o,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function To(e,t,i){var r=Math.sin(i),a=Math.cos(i),o=t[4],n=t[5],s=t[6],l=t[7],u=t[8],c=t[9],h=t[10],d=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=o*a+u*r,e[5]=n*a+c*r,e[6]=s*a+h*r,e[7]=l*a+d*r,e[8]=u*a-o*r,e[9]=c*a-n*r,e[10]=h*a-s*r,e[11]=d*a-l*r,e}function my(e,t,i){var r=Math.sin(i),a=Math.cos(i),o=t[0],n=t[1],s=t[2],l=t[3],u=t[8],c=t[9],h=t[10],d=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*a-u*r,e[1]=n*a-c*r,e[2]=s*a-h*r,e[3]=l*a-d*r,e[8]=o*r+u*a,e[9]=n*r+c*a,e[10]=s*r+h*a,e[11]=l*r+d*a,e}function Jr(e,t,i){var r=Math.sin(i),a=Math.cos(i),o=t[0],n=t[1],s=t[2],l=t[3],u=t[4],c=t[5],h=t[6],d=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*a+u*r,e[1]=n*a+c*r,e[2]=s*a+h*r,e[3]=l*a+d*r,e[4]=u*a-o*r,e[5]=c*a-n*r,e[6]=h*a-s*r,e[7]=d*a-l*r,e}function T5(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function E5(e,t,i,r,a){var o=1/Math.tan(t/2);if(e[0]=o/i,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,a!=null&&a!==1/0){var n=1/(r-a);e[10]=(a+r)*n,e[14]=2*a*r*n}else e[10]=-1,e[14]=-2*r;return e}function S5(e,t,i,r,a,o,n){var s=1/(t-i),l=1/(r-a),u=1/(o-n);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*u,e[11]=0,e[12]=(t+i)*s,e[13]=(a+r)*l,e[14]=(n+o)*u,e[15]=1,e}function C5(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&e[4]===t[4]&&e[5]===t[5]&&e[6]===t[6]&&e[7]===t[7]&&e[8]===t[8]&&e[9]===t[9]&&e[10]===t[10]&&e[11]===t[11]&&e[12]===t[12]&&e[13]===t[13]&&e[14]===t[14]&&e[15]===t[15]}function D5(e,t){var i=e[0],r=e[1],a=e[2],o=e[3],n=e[4],s=e[5],l=e[6],u=e[7],c=e[8],h=e[9],d=e[10],p=e[11],f=e[12],m=e[13],g=e[14],_=e[15],y=t[0],v=t[1],x=t[2],b=t[3],w=t[4],T=t[5],E=t[6],S=t[7],A=t[8],I=t[9],R=t[10],k=t[11],M=t[12],C=t[13],P=t[14],B=t[15];return Math.abs(i-y)<=0.000001*Math.max(1,Math.abs(i),Math.abs(y))&&Math.abs(r-v)<=0.000001*Math.max(1,Math.abs(r),Math.abs(v))&&Math.abs(a-x)<=0.000001*Math.max(1,Math.abs(a),Math.abs(x))&&Math.abs(o-b)<=0.000001*Math.max(1,Math.abs(o),Math.abs(b))&&Math.abs(n-w)<=0.000001*Math.max(1,Math.abs(n),Math.abs(w))&&Math.abs(s-T)<=0.000001*Math.max(1,Math.abs(s),Math.abs(T))&&Math.abs(l-E)<=0.000001*Math.max(1,Math.abs(l),Math.abs(E))&&Math.abs(u-S)<=0.000001*Math.max(1,Math.abs(u),Math.abs(S))&&Math.abs(c-A)<=0.000001*Math.max(1,Math.abs(c),Math.abs(A))&&Math.abs(h-I)<=0.000001*Math.max(1,Math.abs(h),Math.abs(I))&&Math.abs(d-R)<=0.000001*Math.max(1,Math.abs(d),Math.abs(R))&&Math.abs(p-k)<=0.000001*Math.max(1,Math.abs(p),Math.abs(k))&&Math.abs(f-M)<=0.000001*Math.max(1,Math.abs(f),Math.abs(M))&&Math.abs(m-C)<=0.000001*Math.max(1,Math.abs(m),Math.abs(C))&&Math.abs(g-P)<=0.000001*Math.max(1,Math.abs(g),Math.abs(P))&&Math.abs(_-B)<=0.000001*Math.max(1,Math.abs(_),Math.abs(B))}function gy(){var e=new At(3);return At!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function id(e){var t=new At(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function Ki(e){var t=e[0],i=e[1],r=e[2];return Math.sqrt(t*t+i*i+r*r)}function kg(e,t,i){var r=new At(3);return r[0]=e,r[1]=t,r[2]=i,r}function Bi(e,t,i){return e[0]=t[0]+i[0],e[1]=t[1]+i[1],e[2]=t[2]+i[2],e}function Fp(e,t,i){return e[0]=t[0]-i[0],e[1]=t[1]-i[1],e[2]=t[2]-i[2],e}function Ue(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e}function $l(e,t,i,r){return e[0]=t[0]+i[0]*r,e[1]=t[1]+i[1]*r,e[2]=t[2]+i[2]*r,e}function Rp(e,t){var i=t[0]-e[0],r=t[1]-e[1],a=t[2]-e[2];return Math.sqrt(i*i+r*r+a*a)}function A5(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function Rt(e,t){var i=t[0],r=t[1],a=t[2],o=i*i+r*r+a*a;return o>0&&(o=1/Math.sqrt(o)),e[0]=t[0]*o,e[1]=t[1]*o,e[2]=t[2]*o,e}function ft(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function si(e,t,i){var r=t[0],a=t[1],o=t[2],n=i[0],s=i[1],l=i[2];return e[0]=a*l-o*s,e[1]=o*n-r*l,e[2]=r*s-a*n,e}function _y(e,t,i,r){var a=t[0],o=t[1],n=t[2];return e[0]=a+r*(i[0]-a),e[1]=o+r*(i[1]-o),e[2]=n+r*(i[2]-n),e}function M5(e,t,i){var r=t[0],a=t[1],o=t[2],n=i[3]*r+i[7]*a+i[11]*o+i[15];return n||=1,e[0]=(i[0]*r+i[4]*a+i[8]*o+i[12])/n,e[1]=(i[1]*r+i[5]*a+i[9]*o+i[13])/n,e[2]=(i[2]*r+i[6]*a+i[10]*o+i[14])/n,e}function P5(e,t,i){var r=t[0],a=t[1],o=t[2];return e[0]=r*i[0]+a*i[3]+o*i[6],e[1]=r*i[1]+a*i[4]+o*i[7],e[2]=r*i[2]+a*i[5]+o*i[8],e}function nh(e,t,i){var r=i[0],a=i[1],o=i[2],n=i[3],s=t[0],l=t[1],u=t[2],c=a*u-o*l,h=o*s-r*u,d=r*l-a*s;return c+=c,h+=h,d+=d,e[0]=s+n*c+a*d-o*h,e[1]=l+n*h+o*c-r*d,e[2]=u+n*d+r*h-a*c,e}function zn(e,t,i,r){var a=[],o=[];return a[0]=t[0]-i[0],a[1]=t[1]-i[1],a[2]=t[2]-i[2],o[0]=a[0],o[1]=a[1]*Math.cos(r)-a[2]*Math.sin(r),o[2]=a[1]*Math.sin(r)+a[2]*Math.cos(r),e[0]=o[0]+i[0],e[1]=o[1]+i[1],e[2]=o[2]+i[2],e}function lo(e,t,i,r){var a=[],o=[];return a[0]=t[0]-i[0],a[1]=t[1]-i[1],a[2]=t[2]-i[2],o[0]=a[2]*Math.sin(r)+a[0]*Math.cos(r),o[1]=a[1],o[2]=a[2]*Math.cos(r)-a[0]*Math.sin(r),e[0]=o[0]+i[0],e[1]=o[1]+i[1],e[2]=o[2]+i[2],e}function rd(e,t,i,r){var a=[],o=[];return a[0]=t[0]-i[0],a[1]=t[1]-i[1],a[2]=t[2]-i[2],o[0]=a[0]*Math.cos(r)-a[1]*Math.sin(r),o[1]=a[0]*Math.sin(r)+a[1]*Math.cos(r),o[2]=a[2],e[0]=o[0]+i[0],e[1]=o[1]+i[1],e[2]=o[2]+i[2],e}function I5(e){return e[0]=0,e[1]=0,e[2]=0,e}function k5(){var e=new At(4);return At!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function F5(e,t,i,r,a){return e[0]=t,e[1]=i,e[2]=r,e[3]=a,e}function R5(e,t,i){return e[0]=t[0]*i[0],e[1]=t[1]*i[1],e[2]=t[2]*i[2],e[3]=t[3]*i[3],e}function z5(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e}function L5(e,t){var i=t[0],r=t[1],a=t[2],o=t[3],n=i*i+r*r+a*a+o*o;return n>0&&(n=1/Math.sqrt(n)),e[0]=i*n,e[1]=r*n,e[2]=a*n,e[3]=o*n,e}function $t(e,t,i){var r=t[0],a=t[1],o=t[2],n=t[3];return e[0]=i[0]*r+i[4]*a+i[8]*o+i[12]*n,e[1]=i[1]*r+i[5]*a+i[9]*o+i[13]*n,e[2]=i[2]*r+i[6]*a+i[10]*o+i[14]*n,e[3]=i[3]*r+i[7]*a+i[11]*o+i[15]*n,e}function Fg(){var e=new At(4);return At!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function O5(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function j5(e,t,i){i*=0.5;var r=Math.sin(i);return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=Math.cos(i),e}function N5(e,t,i){var r=t[0],a=t[1],o=t[2],n=t[3],s=i[0],l=i[1],u=i[2],c=i[3];return e[0]=r*c+n*s+a*u-o*l,e[1]=a*c+n*l+o*s-r*u,e[2]=o*c+n*u+r*l-a*s,e[3]=n*c-r*s-a*l-o*u,e}function Al(e,t,i,r){var a=t[0],o=t[1],n=t[2],s=t[3],l=i[0],u=i[1],c=i[2],h=i[3],d,p=a*l+o*u+n*c+s*h,f,m,g;return p<0&&(p=-p,l=-l,u=-u,c=-c,h=-h),1-p>0.000001?(d=Math.acos(p),f=Math.sin(d),m=Math.sin((1-r)*d)/f,g=Math.sin(r*d)/f):(m=1-r,g=r),e[0]=m*a+g*l,e[1]=m*o+g*u,e[2]=m*n+g*c,e[3]=m*s+g*h,e}function V5(e,t){var i=t[0]+t[4]+t[8],r;if(i>0)r=Math.sqrt(i+1),e[3]=0.5*r,r=0.5/r,e[0]=(t[5]-t[7])*r,e[1]=(t[6]-t[2])*r,e[2]=(t[1]-t[3])*r;else{var a=0;t[4]>t[0]&&(a=1),t[8]>t[a*3+a]&&(a=2);var o=(a+1)%3,n=(a+2)%3;r=Math.sqrt(t[a*3+a]-t[o*3+o]-t[n*3+n]+1),e[a]=0.5*r,r=0.5/r,e[3]=(t[o*3+n]-t[n*3+o])*r,e[o]=(t[o*3+a]+t[a*3+o])*r,e[n]=(t[n*3+a]+t[a*3+n])*r}return e}function zp(e,t,i,r){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:"zyx",o=Math.PI/360;t*=o,r*=o,i*=o;var n=Math.sin(t),s=Math.cos(t),l=Math.sin(i),u=Math.cos(i),c=Math.sin(r),h=Math.cos(r);switch(a){case"xyz":e[0]=n*u*h+s*l*c,e[1]=s*l*h-n*u*c,e[2]=s*u*c+n*l*h,e[3]=s*u*h-n*l*c;break;case"xzy":e[0]=n*u*h-s*l*c,e[1]=s*l*h-n*u*c,e[2]=s*u*c+n*l*h,e[3]=s*u*h+n*l*c;break;case"yxz":e[0]=n*u*h+s*l*c,e[1]=s*l*h-n*u*c,e[2]=s*u*c-n*l*h,e[3]=s*u*h+n*l*c;break;case"yzx":e[0]=n*u*h+s*l*c,e[1]=s*l*h+n*u*c,e[2]=s*u*c-n*l*h,e[3]=s*u*h-n*l*c;break;case"zxy":e[0]=n*u*h-s*l*c,e[1]=s*l*h+n*u*c,e[2]=s*u*c+n*l*h,e[3]=s*u*h-n*l*c;break;case"zyx":e[0]=n*u*h-s*l*c,e[1]=s*l*h+n*u*c,e[2]=s*u*c-n*l*h,e[3]=s*u*h+n*l*c;break;default:throw Error("Unknown angle order "+a)}return e}function ad(){var e=new At(2);return At!=Float32Array&&(e[0]=0,e[1]=0),e}function zg(e,t){var i=new At(2);return i[0]=e,i[1]=t,i}function Lg(e,t,i){return e[0]=t[0]*i,e[1]=t[1]*i,e}function Bg(e){var t=e[0],i=e[1];return Math.sqrt(t*t+i*i)}function U5(e){var t=e[0],i=e[1];return t*t+i*i}function q5(e,t){return e[0]*t[0]+e[1]*t[1]}function Og(e){return e[0]=0,e[1]=0,e}function Ti(e,t,i){return t*(z/(e.tileSize*2**(i-e.tileID.overscaledZ)))}function Mt(e){return e instanceof Error?e:Error(typeof e=="string"?e:String(e))}function Lr(){return new Float64Array(4)}function De(){return new Float64Array(3)}function Ea(){return new Float64Array(16)}function Ws(){let e=new Float64Array(16);return er(e),e}function yy(){let e=new Float32Array(16);return er(e),e}function aa(e,t,i,r,a=!1){if(!i[0]&&!i[1])return[0,0];let o=a?r==="map"?-e.bearingInRadians:0:r==="viewport"?e.bearingInRadians:0;if(o){let n=Math.sin(o),s=Math.cos(o);i=[i[0]*s-i[1]*n,i[0]*n+i[1]*s]}return[a?i[0]:Ti(t,i[0],e.zoom),a?i[1]:Ti(t,i[1],e.zoom)]}function od(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]}function Di(e,t,i){let r=v5([e[0],e[1],e[2],t[0],t[1],t[2],i[0],i[1],i[2]]);if(r===0)return null;let a=si([],[t[0],t[1],t[2]],[i[0],i[1],i[2]]),o=si([],[i[0],i[1],i[2]],[e[0],e[1],e[2]]),n=si([],[e[0],e[1],e[2]],[t[0],t[1],t[2]]),s=Ue([],a,-e[3]);return Bi(s,s,Ue([],o,-t[3])),Bi(s,s,Ue([],n,-i[3])),Ue(s,s,1/r),s}function W5(e,t,i){let r=e[0]*i[0]+e[1]*i[1]+e[2]*i[2],a=t[0]*i[0]+t[1]*i[1]+t[2]*i[2];return a===0?null:(-r-i[3])/a}function Zs(e,t,i,r){let a=Math.sqrt(e*e+t*t),o=Math.sqrt(i*i+r*r);e/=a,t/=a,i/=o,r/=o;let n=e*i+t*r,s=Math.acos(n);return-t*i+e*r>0?s:-s}function ti(e,t){let i=Aa(e,360),r=Aa(t,360),a=r-i,o=r>i?a-360:a+360;return Math.abs(a)<Math.abs(o)?a:o}function Hs(e,t){let i=Aa(e,Math.PI*2),r=Aa(t,Math.PI*2);return Math.min(Math.abs(i-r),Math.abs(i-r+Math.PI*2),Math.abs(i-r-Math.PI*2))}function Aa(e,t){return(e%t+t)%t}function bn(e,t,i,r,a){return ea(r,a,H((e-t)/(i-t),0,1))}function ea(e,t,i){return e*(1-i)+t*i}function Z5(e){let t=1/0,i=1/0,r=-1/0,a=-1/0;for(let o of e)t=Math.min(t,o.x),i=Math.min(i,o.y),r=Math.max(r,o.x),a=Math.max(a,o.y);return[t,i,r,a]}function H5(e){if(!e.length)return new Set;let t=Math.max(...e.map((l)=>l.canonical.z)),i=1/0,r=-1/0,a=1/0,o=-1/0,n=[];for(let l of e){let{x:u,y:c,z:h}=l.canonical,d=2**(t-h),p=u*d,f=c*d;n.push({id:l,x:p,y:f}),p<i&&(i=p),p>r&&(r=p),f<a&&(a=f),f>o&&(o=f)}let s=new Set;for(let l of n)(l.x===i||l.x===r||l.y===a||l.y===o)&&s.add(l.id);return s}function X5(e){if(e<=0)return 0;if(e>=1)return 1;let t=e*e,i=t*e;return 4*(e<0.5?i:3*(e-t)+i-0.75)}function Lp(e,t,i,r){return m5(e,t,i,r)}function H(e,t,i){return Math.min(i,Math.max(t,e))}function Fi(e,t,i){let r=i-t,a=((e-t)%r+r)%r+t;return a===t?i:a}function ee(e,...t){for(let i of t)for(let r in i)e[r]=i[r];return e}function Au(e,t){let i={};for(let r of t)r in e&&(i[r]=e[r]);return i}function vy(){return Y5++}function K5(e){return Math.log(e)/Math.LN2%1==0}function J5(e){return e<=1?1:2**Math.ceil(Math.log(e)/Math.LN2)}function St(e){return 2**e}function wt(e){return Math.log(e)/Math.LN2}function xi(e,t,i){if(t<=0)return e;let r=1/t;return i===void 0||Math.abs(i)<0.0000000001?Math.round(e*r)/r:(i>0?Math.ceil(e*r-0.000000001):Math.floor(e*r+0.0000000001))/r}function Bp(e,t,i){let r={};for(let a in e)r[a]=t.call(i||this,e[a],a,e);return r}function xy(e,t,i){let r={};for(let a in e)t.call(i||this,e[a],a,e)&&(r[a]=e[a]);return r}function lr(e,t){if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!lr(e[i],t[i]))return!1;return!0}if(typeof e=="object"&&e&&t!==null){if(typeof t!="object"||Object.keys(e).length!==Object.keys(t).length)return!1;for(let i in e)if(!lr(e[i],t[i]))return!1;return!0}return e===t}function bi(e){return Array.isArray(e)?e.map(bi):typeof e=="object"&&e?Bp(e,bi):e}function he(e){jg[e]||(typeof console<"u"&&console.warn(e),jg[e]=!0)}function Qr(e,t,i){return(i.y-e.y)*(t.x-e.x)>(t.y-e.y)*(i.x-e.x)}function Q5(e,t,i,r){let a=t.y-e.y,o=t.x-e.x,n=r.y-i.y,s=r.x-i.x,l=n*o-s*a;if(l===0)return null;let u=e.y-i.y,c=e.x-i.x,h=(s*u-n*c)/l;return new D(e.x+h*o,e.y+h*a)}function by([e,t,i]){return t+=90,t*=Math.PI/180,i*=Math.PI/180,[e*Math.cos(t)*Math.sin(i),e*Math.sin(t)*Math.sin(i),e*Math.cos(i)]}function Eo(e){return typeof WorkerGlobalScope<"u"&&e!==void 0&&e instanceof WorkerGlobalScope}function e3(e){let t=/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,i={};if(e.replace(t,(r,a,o,n)=>{let s=o||n;return i[a]=!s||s.toLowerCase(),""}),i["max-age"]){let r=parseInt(i["max-age"],10);isNaN(r)?delete i["max-age"]:i["max-age"]=r}return i}function t3(e){if(sh==null){let t=e.navigator?e.navigator.userAgent:null;sh=!!e.safari||!!(t&&(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return sh}function Sa(e){return typeof ImageBitmap<"u"&&e instanceof ImageBitmap}function a3(e,t,i,r,a){let o=Math.max(-t,0)*4,n=(Math.max(0,i)-i)*r*4+o,s=r*4,l=Math.max(0,t),u=Math.max(0,i),c=Math.min(e.width,t+r),h=Math.min(e.height,i+a);return{rect:{x:l,y:u,width:c-l,height:h-u},layout:[{offset:n,stride:s}]}}async function o3(e,t,i,r,a){if(typeof VideoFrame>"u")throw Error("VideoFrame not supported");let o=new VideoFrame(e,{timestamp:0});try{let n=o?.format;if(!n||!(n.startsWith("BGR")||n.startsWith("RGB")))throw Error(`Unrecognized format ${n}`);let s=n.startsWith("BGR"),l=new Uint8ClampedArray(r*a*4);if(await o.copyTo(l,a3(e,t,i,r,a)),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 ql(e,t,i,r){return e.addEventListener(t,i,r),{unsubscribe:()=>{e.removeEventListener(t,i,r)}}}function We(e){return e*Math.PI/180}function Wi(e){return e/Math.PI*180}function wy(e,t){return e.roll==t.roll&&e.pitch==t.pitch&&e.bearing==t.bearing}function n3(e){let t=new Float64Array(9);b5(t,e);let i=Wi(-Math.asin(H(t[2],-1,1))),r,a;return Math.hypot(t[5],t[8])<0.001?(r=0,a=-Wi(Math.atan2(t[3],t[4]))):(r=Wi(t[5]===0&&t[8]===0?0:Math.atan2(t[5],t[8])),a=Wi(t[1]===0&&t[0]===0?0:Math.atan2(t[1],t[0]))),{roll:r,pitch:i+90,bearing:a}}function s3(e,t,i){let r=zg(t.x-i.x,t.y-i.y),a=zg(e.x-i.x,e.y-i.y),o=r[0]*a[1]-r[1]*a[0];return Wi(Math.atan2(o,q5(r,a)))}function Ng(e,t,i){let r=new Float64Array(4);return zp(r,e,t-90,i),r}function l3(e,t){return Ty[t]&&"touches"in e}function u3(e,t){if(!Ey[t])return!1;let i=e,r=i?.target?.ownerDocument?.defaultView||window;return i instanceof r.MouseEvent||i instanceof r.WheelEvent}function c3(e){return Ty[e]||Ey[e]}function pr(e){return e instanceof Error&&e.name==="AbortError"}function Ln(e){if(e.aborted)throw new os(e.reason)}function Fe(){return h3.getCurrentTime()}function d3(e){return Gl?Gl.createHTML(e):e}function p3(e){return Gl?Gl.createScriptURL(e):e}function ch(){return Ug??={getAttribute:Element.prototype.getAttribute,getAttributeNames:Element.prototype.getAttributeNames,querySelectorAll:Element.prototype.querySelectorAll,remove:Element.prototype.remove,removeAttribute:Element.prototype.removeAttribute,localName:Object.getOwnPropertyDescriptor(Element.prototype,"localName").get,namespaceURI:Object.getOwnPropertyDescriptor(Element.prototype,"namespaceURI").get},Ug}function Sy(e){return Ma.REGISTERED_PROTOCOLS[e.substring(0,e.indexOf("://"))]}function Op(){if(Eo(self))return self.worker?.referrer;if(window.location.protocol==="blob:")try{return window.parent.location.href}catch{}return window.location.href}async function v3(e,t){let i=new Request(e.url,{method:e.method||"GET",body:e.body,credentials:e.credentials,headers:e.headers,cache:e.cache,referrer:Op(),referrerPolicy:e.referrerPolicy,signal:t.signal});e.type==="json"&&!i.headers.has("Accept")&&i.headers.set("Accept","application/json");let r;try{r=await fetch(i)}catch(n){throw pr(n)?n:new Wl(0,Mt(n).message,e.url,new Blob)}if(!r.ok){let n=await r.blob();throw new Wl(r.status,r.statusText,e.url,n)}let a;a=e.type==="arrayBuffer"||e.type==="image"?r.arrayBuffer():e.type==="json"?r.json():r.text();let o=await a;return Ln(t.signal),{data:o,cacheControl:r.headers.get("Cache-Control"),expires:r.headers.get("Expires"),etag:r.headers.get("ETag")}}function x3(e,t){return new Promise((i,r)=>{let a=new XMLHttpRequest;a.open(e.method||"GET",e.url,!0),(e.type==="arrayBuffer"||e.type==="image")&&(a.responseType="arraybuffer");for(let o in e.headers)a.setRequestHeader(o,e.headers[o]);e.type==="json"&&(a.responseType="text",e.headers?.Accept||a.setRequestHeader("Accept","application/json")),a.withCredentials=e.credentials==="include",a.onerror=()=>{r(Error(a.statusText))},a.onload=()=>{if(!t.signal.aborted)if((a.status>=200&&a.status<300||a.status===0)&&a.response!==null){let o=a.response;if(e.type==="json")try{o=JSON.parse(a.response)}catch(n){r(n);return}i({data:o,cacheControl:a.getResponseHeader("Cache-Control"),expires:a.getResponseHeader("Expires"),etag:a.getResponseHeader("ETag")})}else{let o=new Blob([a.response],{type:a.getResponseHeader("Content-Type")});r(new Wl(a.status,a.statusText,e.url,o))}},t.signal.addEventListener("abort",()=>{a.abort(),r(new os(t.signal.reason))}),a.send(e.body)})}function Dy(e){if(!e||e.startsWith("data:image/"))return!0;if(e.startsWith("blob:")&&(e=e.slice(5),e.startsWith("null")))return!1;if(e.indexOf("://")<=0)return!0;let t=new URL(e),i=window.location;return t.protocol===i.protocol&&t.host===i.host}function qg(e,t,i){i[e]?.includes(t)||(i[e]||=[],i[e].push(t))}function hh(e,t,i){if(i?.[e]){let r=i[e].indexOf(t);r!==-1&&i[e].splice(r,1)}}function T3(e,t){let i={};for(let r in e)r!=="ref"&&(i[r]=e[r]);return w3.forEach((r)=>{r in t&&(i[r]=t[r])}),i}function Gg(e){e=e.slice();let t=Object.create(null);for(let i=0;i<e.length;i++)t[e[i].id]=e[i];for(let i=0;i<e.length;i++)"ref"in e[i]&&(e[i]=T3(e[i],t[e[i].ref]));return e}function ke(e,t){if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!ke(e[i],t[i]))return!1;return!0}if(typeof e=="object"&&e&&t!==null){if(typeof t!="object"||Object.keys(e).length!==Object.keys(t).length)return!1;for(let i in e)if(!ke(e[i],t[i]))return!1;return!0}return e===t}function vi(e,t){e.push(t)}function My(e,t,i){vi(i,{command:"addSource",args:[e,t[e]]})}function Py(e,t,i){vi(t,{command:"removeSource",args:[e]}),i[e]=!0}function E3(e,t,i,r){Py(e,i,r),My(e,t,i)}function S3(e,t,i){let r;for(r in e[i])if(Object.prototype.hasOwnProperty.call(e[i],r)&&r!=="data"&&!ke(e[i][r],t[i][r]))return!1;for(r in t[i])if(Object.prototype.hasOwnProperty.call(t[i],r)&&r!=="data"&&!ke(e[i][r],t[i][r]))return!1;return!0}function C3(e,t,i,r){e||={},t||={};let a;for(a in e)Object.prototype.hasOwnProperty.call(e,a)&&(Object.prototype.hasOwnProperty.call(t,a)||Py(a,i,r));for(a in t)Object.prototype.hasOwnProperty.call(t,a)&&(Object.prototype.hasOwnProperty.call(e,a)?ke(e[a],t[a])||(e[a].type==="geojson"&&t[a].type==="geojson"&&S3(e,t,a)?vi(i,{command:"setGeoJSONSourceData",args:[a,t[a].data]}):E3(a,t,i,r)):My(a,t,i))}function Wg(e,t,i,r,a){vi(t,{command:a,args:[i,r,e[r]]})}function Xs(e,t,i,r,a){e||={},t||={};for(let o in e)Object.prototype.hasOwnProperty.call(e,o)&&(ke(e[o],t[o])||Wg(t,i,r,o,a));for(let o in t)Object.prototype.hasOwnProperty.call(t,o)&&!Object.prototype.hasOwnProperty.call(e,o)&&(ke(e[o],t[o])||Wg(t,i,r,o,a))}function Zg(e){return e.id}function Hg(e,t){return e[t.id]=t,e}function D3(e,t,i){e||=[],t||=[];let r=e.map(Zg),a=t.map(Zg),o=e.reduce(Hg,{}),n=t.reduce(Hg,{}),s=r.slice(),l=Object.create(null),u,c,h,d,p;for(let f=0,m=0;f<r.length;f++)u=r[f],Object.prototype.hasOwnProperty.call(n,u)?m++:(vi(i,{command:"removeLayer",args:[u]}),s.splice(s.indexOf(u,m),1));for(let f=0,m=0;f<a.length;f++)u=a[a.length-1-f],s[s.length-1-f]!==u&&(Object.prototype.hasOwnProperty.call(o,u)?(vi(i,{command:"removeLayer",args:[u]}),s.splice(s.lastIndexOf(u,s.length-m),1)):m++,d=s[s.length-f],vi(i,{command:"addLayer",args:[n[u],d]}),s.splice(s.length-f,0,u),l[u]=!0);for(let f=0;f<a.length;f++)if(u=a[f],c=o[u],h=n[u],!(l[u]||ke(c,h)))if(!ke(c.source,h.source)||!ke(c["source-layer"],h["source-layer"])||!ke(c.type,h.type))vi(i,{command:"removeLayer",args:[u]}),d=s[s.lastIndexOf(u)+1],vi(i,{command:"addLayer",args:[h,d]});else{for(p in Xs(c.layout,h.layout,i,u,"setLayoutProperty"),Xs(c.paint,h.paint,i,u,"setPaintProperty"),ke(c.filter,h.filter)||vi(i,{command:"setFilter",args:[u,h.filter]}),ke(c.minzoom,h.minzoom)&&ke(c.maxzoom,h.maxzoom)||vi(i,{command:"setLayerZoomRange",args:[u,h.minzoom,h.maxzoom]}),c)Object.prototype.hasOwnProperty.call(c,p)&&p!=="layout"&&p!=="paint"&&p!=="filter"&&p!=="metadata"&&p!=="minzoom"&&p!=="maxzoom"&&(p.indexOf("paint.")===0?Xs(c[p],h[p],i,u,"setPaintProperty"):ke(c[p],h[p])||vi(i,{command:"setLayerProperty",args:[u,p,h[p]]}));for(p in h)Object.prototype.hasOwnProperty.call(h,p)&&!Object.prototype.hasOwnProperty.call(c,p)&&p!=="layout"&&p!=="paint"&&p!=="filter"&&p!=="metadata"&&p!=="minzoom"&&p!=="maxzoom"&&(p.indexOf("paint.")===0?Xs(c[p],h[p],i,u,"setPaintProperty"):ke(c[p],h[p])||vi(i,{command:"setLayerProperty",args:[u,p,h[p]]}))}}function A3(e,t){if(!e)return[{command:"setStyle",args:[t]}];let i=[];try{if(!ke(e.version,t.version))return[{command:"setStyle",args:[t]}];ke(e.center,t.center)||i.push({command:"setCenter",args:[t.center]}),ke(e.state,t.state)||i.push({command:"setGlobalState",args:[t.state]}),ke(e.centerAltitude,t.centerAltitude)||i.push({command:"setCenterAltitude",args:[t.centerAltitude]}),ke(e.zoom,t.zoom)||i.push({command:"setZoom",args:[t.zoom]}),ke(e.bearing,t.bearing)||i.push({command:"setBearing",args:[t.bearing]}),ke(e.pitch,t.pitch)||i.push({command:"setPitch",args:[t.pitch]}),ke(e.roll,t.roll)||i.push({command:"setRoll",args:[t.roll]}),ke(e.sprite,t.sprite)||i.push({command:"setSprite",args:[t.sprite]}),ke(e.glyphs,t.glyphs)||i.push({command:"setGlyphs",args:[t.glyphs]}),ke(e["font-faces"],t["font-faces"])||i.push({command:"setFontFaces",args:[t["font-faces"]]}),ke(e.transition,t.transition)||i.push({command:"setTransition",args:[t.transition]}),ke(e.light,t.light)||i.push({command:"setLight",args:[t.light]});let r=!ke(e.terrain,t.terrain);r&&!t.terrain&&i.push({command:"setTerrain",args:[void 0]}),ke(e.sky,t.sky)||i.push({command:"setSky",args:[t.sky]}),ke(e.projection,t.projection)||i.push({command:"setProjection",args:[t.projection]});let a={},o=[];C3(e.sources,t.sources,o,a);let n=[];e.layers&&e.layers.forEach((s)=>{"source"in s&&a[s.source]?i.push({command:"removeLayer",args:[s.id]}):n.push(s)}),i=i.concat(o),D3(n,t.layers,i),r&&t.terrain&&i.push({command:"setTerrain",args:[t.terrain]})}catch(r){console.warn("Unable to compute style diff:",r),i=[{command:"setStyle",args:[t]}]}return i}function Vt(e,t){return{kind:"array",itemType:e,N:t}}function it(e){if(e.kind==="array"){let t=it(e.itemType);return typeof e.N=="number"?`array<${t}, ${e.N}>`:e.itemType.kind==="value"?"array":`array<${t}>`}return e.kind}function On(e,t){if(t.kind==="error")return null;if(e.kind==="array"){if(t.kind==="array"&&(t.N===0&&t.itemType.kind==="value"||!On(e.itemType,t.itemType))&&(typeof e.N!="number"||e.N===t.N))return null}else if(e.kind===t.kind)return null;else if(e.kind==="value"){for(let i of I3)if(!On(i,t))return null}return`Expected ${it(e)} but found ${it(t)} instead.`}function jp(e,t){return t.some((i)=>i.kind===e.kind)}function Da(e,t){return t.some((i)=>i==="null"?e===null:i==="array"?Array.isArray(e):i==="object"?e&&!Array.isArray(e)&&typeof e=="object":i===typeof e)}function Wr(e,t){return e.kind==="array"&&t.kind==="array"?e.itemType.kind===t.itemType.kind&&typeof e.N=="number":e.kind===t.kind}function Vp(e){return e%=360,e<0&&(e+=360),e}function Ly([e,t,i,r]){e=fr(e),t=fr(t),i=fr(i);let a,o,n=dh((0.2225045*e+0.7168786*t+0.0606169*i)/1);return e===t&&t===i?a=o=n:(a=dh((0.4360747*e+0.3850649*t+0.1430804*i)/Iy),o=dh((0.0139322*e+0.0971045*t+0.7141733*i)/ky)),[116*n-16,500*(a-n),200*(n-o),r]}function fr(e){let t=Math.abs(e);return t<=0.04045?e/12.92:Math.sign(e)*((t+0.055)/1.055)**2.4}function dh(e){return e>0.008856451679035631?e**0.3333333333333333:e/Ry+Fy}function By([e,t,i,r]){let a=(e+16)/116,o=isNaN(t)?a:a+t/500,n=isNaN(i)?a:a-i/200;return a=1*fh(a),o=Iy*fh(o),n=ky*fh(n),[ph(3.1338561*o-1.6168667*a-0.4906146*n),ph(-0.9787684*o+1.9161415*a+0.033454*n),ph(0.0719453*o-0.2289914*a+1.4052427*n),r]}function ph(e){let t=Math.abs(e);return t<=0.00304?12.92*e:Math.sign(e)*(1.055*t**0.4166666666666667-0.055)}function fh(e){return e>ud?e*e*e:Ry*(e-Fy)}function k3(e){let[t,i,r,a]=Ly(e),o=Math.sqrt(i*i+r*r);return[Math.round(o*1e4)?Vp(Math.atan2(r,i)*Np):NaN,o,t,a]}function F3([e,t,i,r]){return e=isNaN(e)?0:e*zy,By([i,Math.cos(e)*t,Math.sin(e)*t,r])}function R3([e,t,i,r]){e=Vp(e),t/=100,i/=100;function a(o){let n=(o+e/30)%12,s=t*Math.min(i,1-i);return i-s*Math.max(-1,Math.min(n-3,9-n,1))}return[a(0),a(8),a(4),r]}function mr(e,[t,i,r]){return[e[0][0]*t+e[0][1]*i+e[0][2]*r,e[1][0]*t+e[1][1]*i+e[1][2]*r,e[2][0]*t+e[2][1]*i+e[2][2]*r]}function wn(e){let t=Math.abs(e);return t>0.0031308?Math.sign(e)*(1.055*t**0.4166666666666667-0.055):12.92*e}function Ny([e,t,i]){let[r,a,o]=mr(z3,mr(Oy,[fr(e),fr(t),fr(i)]));return mr(L3,[Math.cbrt(r),Math.cbrt(a),Math.cbrt(o)])}function j3(e){let[t,i,r]=mr(B3,e),[a,o,n]=mr(jy,mr(O3,[t*t*t,i*i*i,r*r*r]));return[wn(a),wn(o),wn(n)]}function N3([e,t,i,r]){let[a,o,n]=Ny([e,t,i]);return[a,o,n,r]}function V3([e,t,i,r]){let[a,o,n]=Ny([e,t,i]),s=Math.sqrt(o*o+n*n);return s<=0.000004?[a,0,NaN,r]:[a,s,Vp(Math.atan2(n,o)*Np),r]}function $p([e,t,i,r]){let a=isNaN(i)?0:i*zy,o=Math.min(t,1e6),[n,s,l]=j3([e,o*Math.cos(a),o*Math.sin(a)]);return[n,s,l,r]}function Vy([e,t,i,r]){return $p([e,Math.hypot(t,i),Math.atan2(i,t)*Np,r])}function q3([e,t,i,r]){let[a,o,n]=[e,t,i].map((c)=>fr(Math.min(Math.max(c,-1e6),1e6))),[s,l,u]=mr(jy,mr($3,[a,o,n])).map(wn);return[s,l,u,r]}function G3([e,t,i,r]){let[a,o,n]=mr(U3,mr(Oy,[fr(e),fr(t),fr(i)])).map((s)=>Math.min(Math.max(wn(s),0),1));return[a,o,n,r]}function Tn(e,t){return W3(e,t)?e[t]:void 0}function Z3(e){if(e=e.toLowerCase().trim(),e==="transparent")return[0,0,0,0];let t=Tn(K3,e);if(t){let[n,s,l]=t;return[n/255,s/255,l/255,1]}if(e.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(e)){let n=e.length<6?1:2,s=1;return[Ys(e.slice(s,s+=n)),Ys(e.slice(s,s+=n)),Ys(e.slice(s,s+=n)),Ys(e.slice(s,s+n)||"ff")]}if(e.startsWith("rgb")){let n=e.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(n){let[s,l,u,c,h,d,p,f,m,g,_,y]=n,v=[c||" ",p||" ",g].join("");if(v===" "||v===" /"||v===",,"||v===",,,"){let x=[u,d,m].join(""),b=x==="%%%"?100:x===""?255:0;if(b){let w=[$i(+l/b,0,1),$i(+h/b,0,1),$i(+f/b,0,1),_?Yg(+_,y):1];if(Kg(w))return w}}return}}let i=e.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(i){let[n,s,l,u,c,h,d,p,f]=i,m=[l||" ",c||" ",d].join("");if(m===" "||m===" /"||m===",,"||m===",,,"){let g=[+s,$i(+u,0,100),$i(+h,0,100),p?Yg(+p,f):1];if(Kg(g))return R3(g)}}let r=e.match(H3);if(r){let[,n,s,l,u]=r,c=[Ai(n,1),Ai(s,0.4),Ai(l,1),u===void 0?1:Ai(u,1)];if(c.every(Number.isFinite))return $p([$i(c[0],0,1),Math.max(c[1],0),c[2]%360,$i(c[3],0,1)])}let a=e.match(X3);if(a){let[,n,s,l,u]=a,c=[Ai(n,1),Ai(s,0.4),Ai(l,0.4),u===void 0?1:Ai(u,1)];if(c.every(Number.isFinite))return Vy([$i(c[0],0,1),c[1],c[2],$i(c[3],0,1)])}let o=e.match(Y3);if(o){let[,n,s,l,u]=o,c=[Ai(n,1),Ai(s,1),Ai(l,1),u===void 0?1:Ai(u,1)];if(c.every(Number.isFinite))return q3([c[0],c[1],c[2],$i(c[3],0,1)])}}function Ai(e,t){if(e==="none")return 0;let[,i,r]=e.match(/^(.+?)(%|[a-z]+)?$/);return r==="%"?i/100*t:r?+i%(360/Xg[r])*Xg[r]:+i}function Ys(e){return parseInt(e.padEnd(2,e),16)/255}function Yg(e,t){return $i(t?e/100:e,0,1)}function $i(e,t,i){return Math.min(Math.max(t,e),i)}function Kg(e){return!e.some(Number.isNaN)}function Nt(e,t,i){return e+i*(t-e)}function So(e,t,i){return e.map((r,a)=>Nt(r,t[a],i))}function J3(e){return e==="rgb"||e==="hcl"||e==="lab"||e==="oklch"||e==="oklab"}function $y(e,t,i,r){return typeof e=="number"&&e>=0&&e<=255&&typeof t=="number"&&t>=0&&t<=255&&typeof i=="number"&&i>=0&&i<=255?r===void 0||typeof r=="number"&&r>=0&&r<=1?null:`Invalid rgba value [${[e,t,i,r].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof r=="number"?[e,t,i,r]:[e,t,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Co(e){if(e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number"||e instanceof la||e instanceof se||e instanceof Up||e instanceof Or||e instanceof br||e instanceof wr||e instanceof oi||e instanceof yr||e instanceof vr)return!0;if(Array.isArray(e)){for(let t of e)if(!Co(t))return!1;return!0}if(typeof e=="object"){for(let t in e)if(!Co(e[t]))return!1;return!0}return!1}function ut(e){if(e===null)return ns;if(typeof e=="string")return ce;if(typeof e=="boolean")return ve;if(typeof e=="number")return U;if(e instanceof se)return Xi;if(e instanceof la)return Iu;if(e instanceof Up)return ku;if(e instanceof Or)return ss;if(e instanceof br)return Fu;if(e instanceof wr)return Ru;if(e instanceof oi)return Bn;if(e instanceof yr)return zu;if(e instanceof vr)return ls;if(Array.isArray(e)){let t=e.length,i;for(let r of e){let a=ut(r);if(!i)i=a;else if(i===a)continue;else{i=de;break}}return Vt(i||de,t)}return Ca}function En(e){let t=typeof e;return e===null?"":t==="string"||t==="number"||t==="boolean"?String(e):e instanceof se||e instanceof la||e instanceof Or||e instanceof br||e instanceof wr||e instanceof oi||e instanceof yr||e instanceof vr?e.toString():JSON.stringify(e)}function Lu(e,t,i){let r=e.length-1,a=0,o=r,n=0,s,l;for(;a<=o;)if(n=Math.floor((a+o)/2),s=e[n],l=e[n+1],s<=t){if(n===r||t<l)return n;a=n+1}else if(s>t)o=n-1;else throw new Je("Input is not a number.",i);return 0}function l4(e,t,i,r){let a=3*e,o=3*(i-e)-a,n=1-a-o,s=3*t,l=3*(r-t)-s,u=1-s-l;return function(c,h=0.000001){if(c<=0)return 0;if(c>=1)return 1;let d=c;for(let m=0;m<8;m++){let g=((n*d+o)*d+a)*d-c;if(Math.abs(g)<h)return((u*d+l)*d+s)*d;let _=(3*n*d+2*o)*d+a;if(Math.abs(_)<0.000001)break;d-=g/_}let p=0,f=1;d=c;for(let m=0;m<20;m++){let g=((n*d+o)*d+a)*d;if(Math.abs(g-c)<h)break;c>g?p=d:f=d,d=(p+f)*0.5}return((u*d+l)*d+s)*d}}function mh(e,t,i,r){let a=r-i,o=e-i;return a===0?0:t===1?o/a:(t**+o-1)/(t**+a-1)}function Qg(e,t){return e==="=="||e==="!="?t.kind==="boolean"||t.kind==="string"||t.kind==="number"||t.kind==="null"||t.kind==="value":t.kind==="string"||t.kind==="number"||t.kind==="value"}function u4(e,t,i){return t===i}function c4(e,t,i){return t!==i}function h4(e,t,i){return t<i}function d4(e,t,i){return t>i}function p4(e,t,i){return t<=i}function f4(e,t,i){return t>=i}function Hy(e,t,i,r){return r.compare(t,i)===0}function m4(e,t,i,r){return!Hy(e,t,i,r)}function g4(e,t,i,r){return r.compare(t,i)<0}function _4(e,t,i,r){return r.compare(t,i)>0}function y4(e,t,i,r){return r.compare(t,i)<=0}function v4(e,t,i,r){return r.compare(t,i)>=0}function Bo(e,t,i){let r=e!=="=="&&e!=="!=";return class a{constructor(o,n,s,l){this.lhs=o,this.rhs=n,this.key=s,this.collator=l,this.type=ve,this.hasUntypedArgument=o.type.kind==="value"||n.type.kind==="value"}static parse(o,n){if(o.length!==3&&o.length!==4)return n.error("Expected two or three arguments.");let s=o[0],l=n.parse(o[1],1,de);if(!l)return null;if(!Qg(s,l.type))return n.concat(1).error(`"${s}" comparisons are not supported for type '${it(l.type)}'.`);let u=n.parse(o[2],2,de);if(!u)return null;if(!Qg(s,u.type))return n.concat(2).error(`"${s}" comparisons are not supported for type '${it(u.type)}'.`);if(l.type.kind!==u.type.kind&&l.type.kind!=="value"&&u.type.kind!=="value")return n.error(`Cannot compare types '${it(l.type)}' and '${it(u.type)}'.`);r&&(l.type.kind==="value"&&u.type.kind!=="value"?l=new Ir(u.type,[l],n.key):l.type.kind!=="value"&&u.type.kind==="value"&&(u=new Ir(l.type,[u],n.key)));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 n.error("Cannot use collator to compare non-string types.");if(c=n.parse(o[3],3,ku),!c)return null}return new a(l,u,n.key,c)}evaluate(o){let n=this.lhs.evaluate(o),s=this.rhs.evaluate(o);if(r&&this.hasUntypedArgument){let l=ut(n),u=ut(s);if(l.kind!==u.kind||l.kind!=="string"&&l.kind!=="number")throw new Je(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${l.kind}, ${u.kind}) instead.`,this.key)}if(this.collator&&!r&&this.hasUntypedArgument){let l=ut(n),u=ut(s);if(l.kind!=="string"||u.kind!=="string")return t(o,n,s)}return this.collator?i(o,n,s,this.collator.evaluate(o)):t(o,n,s)}eachChild(o){o(this.lhs),o(this.rhs),this.collator&&o(this.collator)}outputDefined(){return!0}}}function M4(e,t){let i=P4(e[0]),r=k4(e[1]),a=2**t.z;return[Math.round(i*a*gr),Math.round(r*a*gr)]}function Gp(e,t){let i=2**t.z,r=(e[0]/gr+t.x)/i,a=(e[1]/gr+t.y)/i;return[I4(r),F4(a)]}function P4(e){return(180+e)/360}function I4(e){return e*360-180}function k4(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function F4(e){return 360/Math.PI*Math.atan(Math.exp((180-e*360)*Math.PI/180))-90}function us(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[0]),e[3]=Math.max(e[3],t[1])}function jn(e,t){return!(e[0]<=t[0]||e[2]>=t[2]||e[1]<=t[1]||e[3]>=t[3])}function R4(e,t,i){return t[1]>e[1]!=i[1]>e[1]&&e[0]<(i[0]-t[0])*(e[1]-t[1])/(i[1]-t[1])+t[0]}function z4(e,t,i){let r=e[0]-t[0],a=e[1]-t[1],o=e[0]-i[0],n=e[1]-i[1];return r*n-o*a===0&&r*o<=0&&a*n<=0}function Bu(e,t,i,r){let a=[t[0]-e[0],t[1]-e[1]];return j4([r[0]-i[0],r[1]-i[1]],a)!==0&&!!(e0(e,t,i,r)&&e0(i,r,e,t))}function L4(e,t,i){for(let r of i)for(let a=0;a<r.length-1;++a)if(Bu(e,t,r[a],r[a+1]))return!0;return!1}function Oo(e,t,i=!1){let r=!1;for(let a of t)for(let o=0;o<a.length-1;o++){if(z4(e,a[o],a[o+1]))return i;R4(e,a[o],a[o+1])&&(r=!r)}return r}function B4(e,t){for(let i of t)if(Oo(e,i))return!0;return!1}function Ky(e,t){for(let i of e)if(!Oo(i,t))return!1;for(let i=0;i<e.length-1;++i)if(L4(e[i],e[i+1],t))return!1;return!0}function O4(e,t){for(let i of t)if(Ky(e,i))return!0;return!1}function j4(e,t){return e[0]*t[1]-e[1]*t[0]}function e0(e,t,i,r){let a=e[0]-i[0],o=e[1]-i[1],n=t[0]-i[0],s=t[1]-i[1],l=r[0]-i[0],u=r[1]-i[1],c=a*u-l*o,h=n*u-l*s;return c>0&&h<0||c<0&&h>0}function Wp(e,t,i){let r=[];for(let a=0;a<e.length;a++){let o=[];for(let n=0;n<e[a].length;n++){let s=M4(e[a][n],i);us(t,s),o.push(s)}r.push(o)}return r}function Jy(e,t,i){let r=[];for(let a=0;a<e.length;a++){let o=Wp(e[a],t,i);r.push(o)}return r}function Qy(e,t,i,r){if(e[0]<i[0]||e[0]>i[2]){let a=r*0.5,o=e[0]-i[0]>a?-r:i[0]-e[0]>a?r:0;o===0&&(o=e[0]-i[2]>a?-r:i[2]-e[0]>a?r:0),e[0]+=o}us(t,e)}function N4(e){e[0]=e[1]=1/0,e[2]=e[3]=-1/0}function t0(e,t,i,r){let a=2**r.z*gr,o=[r.x*gr,r.y*gr],n=[];for(let s of e)for(let l of s){let u=[l.x+o[0],l.y+o[1]];Qy(u,t,i,a),n.push(u)}return n}function i0(e,t,i,r){let a=2**r.z*gr,o=[r.x*gr,r.y*gr],n=[];for(let s of e){let l=[];for(let u of s){let c=[u.x+o[0],u.y+o[1]];us(t,c),l.push(c)}n.push(l)}if(t[2]-t[0]<=a/2){N4(t);for(let s of n)for(let l of s)Qy(l,t,i,a)}return n}function V4(e,t){let i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],a=e.canonicalID();if(t.type==="Polygon"){let o=Wp(t.coordinates,r,a),n=t0(e.geometry(),i,r,a);if(!jn(i,r))return!1;for(let s of n)if(!Oo(s,o))return!1}if(t.type==="MultiPolygon"){let o=Jy(t.coordinates,r,a),n=t0(e.geometry(),i,r,a);if(!jn(i,r))return!1;for(let s of n)if(!B4(s,o))return!1}return!0}function $4(e,t){let i=[1/0,1/0,-1/0,-1/0],r=[1/0,1/0,-1/0,-1/0],a=e.canonicalID();if(t.type==="Polygon"){let o=Wp(t.coordinates,r,a),n=i0(e.geometry(),i,r,a);if(!jn(i,r))return!1;for(let s of n)if(!Ky(s,o))return!1}if(t.type==="MultiPolygon"){let o=Jy(t.coordinates,r,a),n=i0(e.geometry(),i,r,a);if(!jn(i,r))return!1;for(let s of n)if(!O4(s,o))return!1}return!0}function tv(e,t,i=0,r=e.length-1,a=U4){for(;r>i;){if(r-i>600){let l=r-i+1,u=t-i+1,c=Math.log(l),h=0.5*Math.exp(2*c/3),d=0.5*Math.sqrt(c*h*(l-h)/l)*(u-l/2<0?-1:1);tv(e,t,Math.max(i,Math.floor(t-u*h/l+d)),Math.min(r,Math.floor(t+(l-u)*h/l+d)),a)}let o=e[t],n=i,s=r;for(un(e,i,t),a(e[r],o)>0&&un(e,i,r);n<s;){for(un(e,n,s),n++,s--;a(e[n],o)<0;)n++;for(;a(e[s],o)>0;)s--}a(e[i],o)===0?un(e,i,s):(s++,un(e,s,r)),s<=t&&(i=s+1),t<=s&&(r=s-1)}}function un(e,t,i){let r=e[t];e[t]=e[i],e[i]=r}function U4(e,t){return e<t?-1:+(e>t)}function Ou(e,t){if(e.length<=1)return[e];let i=[],r,a;for(let o of e){let n=G4(o);n!==0&&(o.area=Math.abs(n),a===void 0&&(a=n<0),a===n<0?(r&&i.push(r),r=[o]):r.push(o))}if(r&&i.push(r),t>1)for(let o=0;o<i.length;o++)i[o].length<=t||(tv(i[o],t,1,i[o].length-1,q4),i[o]=i[o].slice(0,t));return i}function q4(e,t){return t.area-e.area}function G4(e){let t=0;for(let i=0,r=e.length,a=r-1,o,n;i<r;a=i++)o=e[i],n=e[a],t+=(n.x-o.x)*(o.y+n.y);return t}function iv(e,t){return t[0]-e[0]}function Zl(e){return e[1]-e[0]+1}function jr(e,t){return e[1]>=e[0]&&e[1]<t}function hd(e,t){if(e[0]>e[1])return[null,null];let i=Zl(e);if(t){if(i===2)return[e,null];let a=Math.floor(i/2);return[[e[0],e[0]+a],[e[0]+a,e[1]]]}if(i===1)return[e,null];let r=Math.floor(i/2)-1;return[[e[0],e[0]+r],[e[0]+r+1,e[1]]]}function dd(e,t){if(!jr(t,e.length))return[1/0,1/0,-1/0,-1/0];let i=[1/0,1/0,-1/0,-1/0];for(let r=t[0];r<=t[1];++r)us(i,e[r]);return i}function pd(e){let t=[1/0,1/0,-1/0,-1/0];for(let i of e)for(let r of i)us(t,r);return t}function a0(e){return e[0]!==-1/0&&e[1]!==-1/0&&e[2]!==1/0&&e[3]!==1/0}function Xp(e,t,i){if(!a0(e)||!a0(t))return NaN;let r=0,a=0;return e[2]<t[0]&&(r=t[0]-e[2]),e[0]>t[2]&&(r=e[0]-t[2]),e[1]>t[3]&&(a=e[1]-t[3]),e[3]<t[1]&&(a=t[1]-e[3]),i.distance([0,0],[r,a])}function xa(e,t,i){let r=i.pointOnLine(t,e);return i.distance(e,r.point)}function Yp(e,t,i,r,a){let o=Math.min(xa(e,[i,r],a),xa(t,[i,r],a)),n=Math.min(xa(i,[e,t],a),xa(r,[e,t],a));return Math.min(o,n)}function W4(e,t,i,r,a){if(!(jr(t,e.length)&&jr(r,i.length)))return 1/0;let o=1/0;for(let n=t[0];n<t[1];++n){let s=e[n],l=e[n+1];for(let u=r[0];u<r[1];++u){let c=i[u],h=i[u+1];if(Bu(s,l,c,h))return 0;o=Math.min(o,Yp(s,l,c,h,a))}}return o}function Z4(e,t,i,r,a){if(!(jr(t,e.length)&&jr(r,i.length)))return NaN;let o=1/0;for(let n=t[0];n<=t[1];++n)for(let s=r[0];s<=r[1];++s)if(o=Math.min(o,a.distance(e[n],i[s])),o===0)return o;return o}function H4(e,t,i){if(Oo(e,t,!0))return 0;let r=1/0;for(let a of t){let o=a[0],n=a[a.length-1];if(o!==n&&(r=Math.min(r,xa(e,[n,o],i)),r===0))return r;let s=i.pointOnLine(a,e);if(r=Math.min(r,i.distance(e,s.point)),r===0)return r}return r}function X4(e,t,i,r){if(!jr(t,e.length))return NaN;for(let o=t[0];o<=t[1];++o)if(Oo(e[o],i,!0))return 0;let a=1/0;for(let o=t[0];o<t[1];++o){let n=e[o],s=e[o+1];for(let l of i)for(let u=0,c=l.length,h=c-1;u<c;h=u++){let d=l[h],p=l[u];if(Bu(n,s,d,p))return 0;a=Math.min(a,Yp(n,s,d,p,r))}}return a}function o0(e,t){for(let i of e)for(let r of i)if(Oo(r,t,!0))return!0;return!1}function Y4(e,t,i,r=1/0){let a=pd(e),o=pd(t);if(r!==1/0&&Xp(a,o,i)>=r)return r;if(jn(a,o)){if(o0(e,t))return 0}else if(o0(t,e))return 0;let n=1/0;for(let s of e)for(let l=0,u=s.length,c=u-1;l<u;c=l++){let h=s[c],d=s[l];for(let p of t)for(let f=0,m=p.length,g=m-1;f<m;g=f++){let _=p[g],y=p[f];if(Bu(h,d,_,y))return 0;n=Math.min(n,Yp(h,d,_,y,i))}}return n}function n0(e,t,i,r,a,o){if(!o)return;let n=Xp(dd(r,o),a,i);n<t&&e.push([n,o,[0,0]])}function Js(e,t,i,r,a,o,n){if(!o||!n)return;let s=Xp(dd(r,o),dd(a,n),i);s<t&&e.push([s,o,n])}function Hl(e,t,i,r,a=1/0){let o=Math.min(r.distance(e[0],i[0][0]),a);if(o===0)return o;let n=new ev([[0,[0,e.length-1],[0,0]]],iv),s=pd(i);for(;n.length>0;){let l=n.pop();if(l[0]>=o)continue;let u=l[1],c=t?50:100;if(Zl(u)<=c){if(!jr(u,e.length))return NaN;if(t){let h=X4(e,u,i,r);if(isNaN(h)||h===0)return h;o=Math.min(o,h)}else for(let h=u[0];h<=u[1];++h){let d=H4(e[h],i,r);if(o=Math.min(o,d),o===0)return 0}}else{let h=hd(u,t);n0(n,o,r,e,s,h[0]),n0(n,o,r,e,s,h[1])}}return o}function Xl(e,t,i,r,a,o=1/0){let n=Math.min(o,a.distance(e[0],i[0]));if(n===0)return n;let s=new ev([[0,[0,e.length-1],[0,i.length-1]]],iv);for(;s.length>0;){let l=s.pop();if(l[0]>=n)continue;let u=l[1],c=l[2],h=t?50:100,d=r?50:100;if(Zl(u)<=h&&Zl(c)<=d){if(!jr(u,e.length)&&jr(c,i.length))return NaN;let p;if(t&&r)p=W4(e,u,i,c,a),n=Math.min(n,p);else if(t&&!r){let f=e.slice(u[0],u[1]+1);for(let m=c[0];m<=c[1];++m)if(p=xa(i[m],f,a),n=Math.min(n,p),n===0)return n}else if(!t&&r){let f=i.slice(c[0],c[1]+1);for(let m=u[0];m<=u[1];++m)if(p=xa(e[m],f,a),n=Math.min(n,p),n===0)return n}else p=Z4(e,u,i,c,a),n=Math.min(n,p)}else{let p=hd(u,t),f=hd(c,r);Js(s,n,a,e,i,p[0],f[0]),Js(s,n,a,e,i,p[0],f[1]),Js(s,n,a,e,i,p[1],f[0]),Js(s,n,a,e,i,p[1],f[1])}}return n}function K4(e,t){let i=e.geometry(),r=i.flat().map((n)=>Gp([n.x,n.y],e.canonical));if(i.length===0)return NaN;let a=new Hp(r[0][1]),o=1/0;for(let n of t){switch(n.type){case"Point":o=Math.min(o,Xl(r,!1,[n.coordinates],!1,a,o));break;case"LineString":o=Math.min(o,Xl(r,!1,n.coordinates,!0,a,o));break;case"Polygon":o=Math.min(o,Hl(r,!1,n.coordinates,a,o))}if(o===0)return o}return o}function J4(e,t){let i=e.geometry(),r=i.flat().map((n)=>Gp([n.x,n.y],e.canonical));if(i.length===0)return NaN;let a=new Hp(r[0][1]),o=1/0;for(let n of t){switch(n.type){case"Point":o=Math.min(o,Xl(r,!0,[n.coordinates],!1,a,o));break;case"LineString":o=Math.min(o,Xl(r,!0,n.coordinates,!0,a,o));break;case"Polygon":o=Math.min(o,Hl(r,!0,n.coordinates,a,o))}if(o===0)return o}return o}function Q4(e,t){let i=e.geometry();if(i.length===0||i[0].length===0)return NaN;let r=Ou(i,0).map((n)=>n.map((s)=>s.map((l)=>Gp([l.x,l.y],e.canonical)))),a=new Hp(r[0][0][0][1]),o=1/0;for(let n of t)for(let s of r){switch(n.type){case"Point":o=Math.min(o,Hl([n.coordinates],!1,s,a,o));break;case"LineString":o=Math.min(o,Hl(n.coordinates,!0,s,a,o));break;case"Polygon":o=Math.min(o,Y4(s,n.coordinates,a,o))}if(o===0)return o}return o}function gh(e){return e.type==="MultiPolygon"?e.coordinates.map((t)=>({type:"Polygon",coordinates:t})):e.type==="MultiLineString"?e.coordinates.map((t)=>({type:"LineString",coordinates:t})):e.type==="MultiPoint"?e.coordinates.map((t)=>({type:"Point",coordinates:t})):[e]}function s0(e,[t,i,r,a],o){t=t.evaluate(e),i=i.evaluate(e),r=r.evaluate(e);let n=a?a.evaluate(e):1,s=$y(t,i,r,n);if(s)throw new Je(s,o);return new se(t/255,i/255,r/255,n,!1)}function l0(e,t){return e in t&&t[e]!==void 0}function _h(e,t){let i=t[e];return i===void 0?null:i}function t6(e,t,i,r){for(;i<=r;){let a=i+r>>1;if(t[a]===e)return!0;t[a]>e?r=a-1:i=a+1}return!1}function fa(e){return{type:e}}function i6(e){return Array.isArray(e)?`(${e.map(it).join(", ")})`:`(${it(e.type)}...)`}function Yl(e){if(e instanceof Wy)return Yl(e.boundExpression);if(e instanceof La&&e.name==="error"||e instanceof Xy||e instanceof Zp||e instanceof Kp||e instanceof Jp)return!1;let t=e instanceof uo||e instanceof Ir,i=!0;return e.eachChild((r)=>{i&&=t?Yl(r):r instanceof Do}),i?ju(e)&&Nu(e,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"]):!1}function ju(e){if(e instanceof La&&(e.name==="get"&&e.args.length===1||e.name==="feature-state"||e.name==="has"&&e.args.length===1||e.name==="properties"||e.name==="geometry-type"||e.name==="id"||/^filter-/.test(e.name))||e instanceof Zp||e instanceof Kp)return!1;let t=!0;return e.eachChild((i)=>{t&&!ju(i)&&(t=!1)}),t}function Nn(e){if(e instanceof La&&e.name==="feature-state")return!1;let t=!0;return e.eachChild((i)=>{t&&!Nn(i)&&(t=!1)}),t}function Nu(e,t){if(e instanceof La&&t.indexOf(e.name)>=0)return!1;let i=!0;return e.eachChild((r)=>{i&&!Nu(r,t)&&(i=!1)}),i}function fd(e){return{result:"success",value:e}}function oo(e){return{result:"error",value:e}}function Ao(e){return e["property-type"]==="data-driven"||e["property-type"]==="cross-faded-data-driven"}function rv(e){return!!e.expression&&e.expression.parameters.indexOf("zoom")>-1}function Qp(e){return!!e.expression&&e.expression.interpolated}function Vn(e,...t){for(let i of t)for(let r in i)e[r]=i[r];return e}function _e(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":e===null?"null":typeof e}function Vu(e){return typeof e=="object"&&!!e&&!Array.isArray(e)&&ut(e)===Ca}function r6(e){return e}function a6(e){switch(e.type){case"color":return se.parse;case"padding":return br.parse;case"numberArray":return wr.parse;case"colorArray":return oi.parse;default:return null}}function o6(e){switch(e){case"exponential":return ov;case"interval":return s6;case"categorical":return n6;case"identity":return l6;default:throw Error(`Unknown function type "${e}"`)}}function av(e,t){let i=e.stops&&typeof e.stops[0][0]=="object",r=i||e.property!==void 0,a=i||!r,o=e.type||(Qp(t)?"exponential":"interval"),n=a6(t);if(n&&(e=Vn({},e),e.stops&&(e.stops=e.stops.map((c)=>[c[0],n(c[1])])),e.default?e.default=n(e.default):e.default=n(t.default)),e.colorSpace&&!J3(e.colorSpace))throw Error(`Unknown color space: "${e.colorSpace}"`);let s=o6(o),l,u;if(o==="categorical"){l=Object.create(null);for(let c of e.stops)l[c[0]]=c[1];u=typeof e.stops[0][0]}if(i){let c={},h=[];for(let f=0;f<e.stops.length;f++){let m=e.stops[f],g=m[0].zoom;c[g]===void 0&&(c[g]={zoom:g,type:e.type,property:e.property,default:e.default,colorSpace:e.colorSpace,stops:[]},h.push(g)),c[g].stops.push([m[0].value,m[1]])}let d=[];for(let f of h)d.push([c[f].zoom,av(c[f],t)]);let p={name:"linear"};return{kind:"composite",interpolationType:p,interpolationFactor:ni.interpolationFactor.bind(void 0,p),zoomStops:d.map((f)=>f[0]),evaluate({zoom:f},m){return ov({stops:d,base:e.base,colorSpace:e.colorSpace},t,f).evaluate(f,m)}}}if(a){let c=o==="exponential"?{name:"exponential",base:e.base===void 0?1:e.base}:null;return{kind:"camera",interpolationType:c,interpolationFactor:ni.interpolationFactor.bind(void 0,c),zoomStops:e.stops.map((h)=>h[0]),evaluate:({zoom:h})=>s(e,t,h,l,u)}}return{kind:"source",evaluate(c,h){let d=h&&h.properties?h.properties[e.property]:void 0;return d===void 0?cs(e.default,t.default):s(e,t,d,l,u)}}}function cs(e,t,i){if(e!==void 0)return e;if(t!==void 0)return t;if(i!==void 0)return i}function n6(e,t,i,r,a){return cs(typeof i===a?r[i]:void 0,e.default,t.default)}function s6(e,t,i){if(_e(i)!=="number")return cs(e.default,t.default);let r=e.stops.length;if(r===1||i<=e.stops[0][0])return e.stops[0][1];if(i>=e.stops[r-1][0])return e.stops[r-1][1];let a=Lu(e.stops.map((o)=>o[0]),i,"");return e.stops[a][1]}function ov(e,t,i){let r=e.base===void 0?1:e.base;if(_e(i)!=="number")return cs(e.default,t.default);let a=e.stops.length;if(a===1||i<=e.stops[0][0])return e.stops[0][1];if(i>=e.stops[a-1][0])return e.stops[a-1][1];let o=Lu(e.stops.map((c)=>c[0]),i,""),n=u6(i,r,e.stops[o][0],e.stops[o+1][0]),s=e.stops[o][1],l=e.stops[o+1][1],u=Ze[t.type]||r6;return typeof s.evaluate=="function"?{evaluate(...c){let h=s.evaluate.apply(void 0,c),d=l.evaluate.apply(void 0,c);if(h!==void 0&&d!==void 0)return u(h,d,n,e.colorSpace)}}:u(s,l,n,e.colorSpace)}function l6(e,t,i){switch(t.type){case"color":i=se.parse(i);break;case"formatted":i=Or.fromString(i.toString());break;case"resolvedImage":i=vr.fromString(i.toString());break;case"padding":i=br.parse(i);break;case"colorArray":i=oi.parse(i);break;case"numberArray":i=wr.parse(i);break;default:_e(i)===t.type||t.type==="enum"&&t.values[i]||(i=void 0)}return cs(i,e.default,t.default)}function u6(e,t,i,r){let a=r-i,o=e-i;return a===0?0:t===1?o/a:(t**+o-1)/(t**+a-1)}function nv(e,t,i,r){return`${e}${t}: ${i}${r==null?"":` Falling back to ${String(r)}.`}`}function sv(e){if(!e)throw Error('rootKey must identify the location of the expression in the style JSON, e.g. "layers[3].paint.line-width".')}function $u(e){return Array.isArray(e)&&e.length>0&&typeof e[0]=="string"&&e[0]in fo}function Uu(e,t,i,r){sv(t);let a=new qy(fo,Yl,[],i?d6(i):void 0),o=a.parse(e,void 0,void 0,void 0,i&&i.type==="string"?{typeAnnotation:"coerce"}:void 0);return o?fd(new tf(o,t,i,r)):oo(a.errors)}function c6(e){return e._styleExpression!==void 0}function lv(e,t,i,r){let a=Uu(e,t,i,r);if(a.result==="error")return a;let o=a.value.expression,n=ju(o);if(!n&&!Ao(i))return oo([new ur("","data expressions not supported")]);let s=Nu(o,["zoom"]);if(!s&&!rv(i))return oo([new ur("","zoom expressions not supported")]);let l=Ml(o);if(!l&&!s)return oo([new ur("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(l instanceof ur)return oo([l]);if(l instanceof ni&&!Qp(i))return oo([new ur("",'"interpolate" expressions cannot be used with this property')]);if(!l)return fd(n?new $n("constant",a.value,r):new $n("source",a.value,r));let u=l instanceof ni?l.interpolation:void 0;return fd(n?new Kl("camera",a.value,l.labels,u,r):new Kl("composite",a.value,l.labels,u,r))}function h6(e,t,i,r){if(Vu(e))return new uv(e,t,i);if($u(e)){let a=lv(e,t,i,r);if(a.result==="error")throw Error(a.value.map((o)=>`${o.key}: ${o.message}`).join(", "));return a.value}{let a=e;return i.type==="color"&&typeof e=="string"?a=se.parse(e):i.type==="padding"&&(typeof e=="number"||Array.isArray(e))?a=br.parse(e):i.type==="numberArray"&&(typeof e=="number"||Array.isArray(e))?a=wr.parse(e):i.type==="colorArray"&&(typeof e=="string"||Array.isArray(e))?a=oi.parse(e):i.type==="variableAnchorOffsetCollection"&&Array.isArray(e)?a=yr.parse(e):i.type==="projectionDefinition"&&typeof e=="string"&&(a=la.parse(e)),{globalStateRefs:new Set,_globalState:null,kind:"constant",evaluate:()=>a}}}function Ml(e,t=new Map){if(t.has(e))return t.get(e);let i=null;if(e instanceof Gy)i=Ml(e.result,t);else if(e instanceof Zy){for(let r of e.args)if(i=Ml(r,t),i)break}else(e instanceof qp||e instanceof ni)&&e.input instanceof La&&e.input.name==="zoom"&&(i=e);return i instanceof ur?(t.set(e,i),i):(e.eachChild((r)=>{let a=Ml(r,t);a instanceof ur?i=a:!i&&a?i=new ur("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):i&&a&&i!==a&&(i=new ur("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t.set(e,i),i)}function hs(e,t=new Set){return e instanceof Jp&&t.add(e.key),e.eachChild((i)=>{hs(i,t)}),t}function d6(e){let t={color:Xi,string:ce,number:U,enum:ce,boolean:ve,formatted:ss,padding:Fu,numberArray:Ru,colorArray:Bn,projectionDefinition:Iu,resolvedImage:ls,variableAnchorOffsetCollection:zu};return e.type==="array"?Vt(t[e.value]||de,e.length):t[e.type]}function cv(e){if(e.type==="color"&&Vu(e.default))return new se(0,0,0,0);switch(e.type){case"color":return se.parse(e.default)||null;case"padding":return br.parse(e.default)||null;case"numberArray":return wr.parse(e.default)||null;case"colorArray":return oi.parse(e.default)||null;case"variableAnchorOffsetCollection":return yr.parse(e.default)||null;case"projectionDefinition":return la.parse(e.default)||null;default:return e.default===void 0?null:e.default}}function Mo(e,t){let{zoom:i,heatmapDensity:r,elevation:a,lineProgress:o,isSupportedScript:n,accumulated:s}=e??{};return{zoom:i,heatmapDensity:r,elevation:a,lineProgress:o,isSupportedScript:n,accumulated:s,globalState:t}}function p6(e){let t=!1;for(let i of e){let r=hv(i);if(r==="expression")return"expression";r==="legacy"&&(t=!0)}return t?"legacy":"neutral"}function hv(e){if(typeof e=="boolean")return"neutral";if(!Array.isArray(e)||e.length===0)return"legacy";switch(e[0]){case"has":return e.length<2||e[1]==="$id"||e[1]==="$type"?"legacy":e.length===2?"neutral":"expression";case"in":return e.length>=3&&(typeof e[1]!="string"||Array.isArray(e[2]))?"expression":"legacy";case"!in":case"!has":return"legacy";case"==":case"!=":case">":case">=":case"<":case"<=":return e.length!==3||Array.isArray(e[1])||Array.isArray(e[2])?"expression":"legacy";case"none":return"legacy";case"any":case"all":return p6(e.slice(1));default:return"expression"}}function rf(e){return hv(e)!=="legacy"}function u0(e){return e==="$type"?["geometry-type"]:e==="$id"?["id"]:["get",e]}function f6(e){switch(e[0]){case"==":case"!=":case"<":case"<=":case">":case">=":return e.length!==3||typeof e[1]!="string"?null:[e[0],u0(e[1]),e[2]];case"in":case"!in":{if(e.length<2||typeof e[1]!="string")return null;let t=["in",u0(e[1]),["literal",e.slice(2)]];return e[0]==="!in"?["!",t]:t}case"has":case"!has":{if(e.length!==2||typeof e[1]!="string"||e[1]==="$type"||e[1]==="$id")return null;let t=["has",e[1]];return e[0]==="!has"?["!",t]:t}default:return null}}function dv(e){if((e[0]==="<"||e[0]==="<="||e[0]===">"||e[0]===">=")&&e[1]==="$type")return`"$type" cannot be use with operator "${e[0]}"`;let t=f6(e);return t?`Mixing deprecated filter syntax with expression syntax is not supported. Replace ${JSON.stringify(e)} with ${JSON.stringify(t)}.`:`Mixing deprecated filter syntax with expression syntax is not supported. Convert ${JSON.stringify(e)} to expression syntax.`}function yh(e,t,i){let r=i[e];return Array.isArray(r)?rf(r)?af(r,t.concat(e)):{path:t.concat(e),legacyFilter:r}:null}function af(e,t=[]){if(!Array.isArray(e)||e.length<1)return null;switch(e[0]){case"all":case"any":case"none":for(let i=1;i<e.length;i++){let r=yh(i,t,e);if(r)return r}break;case"!":{let i=yh(1,t,e);if(i)return i;break}case"case":for(let i=1;i<e.length-1;i+=2){let r=yh(i,t,e);if(r)return r}}return null}function m6(e,t){let i=af(e);if(!i||typeof console>"u")return;let r=i.path.map((a)=>`[${a}]`).join("");console.warn(`${t}${r}: ${dv(i.legacyFilter)}`)}function Un(e,t,i){if(e==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};rf(e)?m6(e,t):e=Jl(e);let r=Uu(e,t,g6,i);if(r.result==="error")throw Error(r.value.map((a)=>`${a.key}: ${a.message}`).join(", "));return{filter:(a,o,n)=>r.value.evaluate(a,o,{},n),needGeometry:pv(e),getGlobalStateRefs:()=>hs(r.value.expression)}}function _6(e,t){return e<t?-1:+(e>t)}function pv(e){if(!Array.isArray(e))return!1;if(e[0]==="within"||e[0]==="distance")return!0;for(let t=1;t<e.length;t++)if(pv(e[t]))return!0;return!1}function Jl(e){if(!e)return!0;let t=e[0];return e.length<=1?t!=="any":t==="=="?vh(e[1],e[2],"=="):t==="!="?Qs(vh(e[1],e[2],"==")):t==="<"||t===">"||t==="<="||t===">="?vh(e[1],e[2],t):t==="any"?y6(e.slice(1)):t==="all"?["all"].concat(e.slice(1).map(Jl)):t==="none"?["all"].concat(e.slice(1).map(Jl).map(Qs)):t==="in"?c0(e[1],e.slice(2)):t==="!in"?Qs(c0(e[1],e.slice(2))):t==="has"?h0(e[1]):t!=="!has"||Qs(h0(e[1]))}function vh(e,t,i){switch(e){case"$type":return[`filter-type-${i}`,t];case"$id":return[`filter-id-${i}`,t];default:return[`filter-${i}`,e,t]}}function y6(e){return["any"].concat(e.map(Jl))}function c0(e,t){if(t.length===0)return!1;switch(e){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some((i)=>typeof i!=typeof t[0])?["filter-in-large",e,["literal",t.sort(_6)]]:["filter-in-small",e,["literal",t]]}}function h0(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function Qs(e){return["!",e]}function v6(){let e={},t=F.$version;for(let i in F.$root){let r=F.$root[i];if(r.required){let a=null;a=i==="version"?t:r.type==="array"?[]:{},a!=null&&(e[i]=a)}}return e}function fv(e){let{key:t,value:i}=e;return i?[new O(t,i,"constants have been deprecated as of v8")]:[]}function lt(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function Pa(e){if(Array.isArray(e))return e.map(Pa);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){let t={};for(let i in e)t[i]=Pa(e[i]);return t}return lt(e)}function wi(e){let{key:t,value:i}=e,r=e.valueSpec||{},a=e.objectElementValidators||{},{style:o,styleSpec:n,validateSpec:s}=e,l=[],u=_e(i);if(u!=="object")return[new O(t,i,`object expected, ${u} found`)];for(let c in i){let h=c.split(".")[0],d=Tn(r,h)||r["*"],p;if(Tn(a,h))p=a[h];else if(Tn(r,h)){if(i[c]===void 0)continue;p=s}else if(a["*"])p=a["*"];else if(r["*"])p=s;else{l.push(new O(t,i[c],`unknown property "${c}"`));continue}l=l.concat(p({key:(t&&`${t}.`)+c,value:i[c],valueSpec:d,style:o,styleSpec:n,object:i,objectKey:c,validateSpec:s},i))}for(let c in r)a[c]||r[c].required&&r[c].default===void 0&&i[c]===void 0&&l.push(new O(t,i,`missing required property "${c}"`));return l}function of(e){let{value:t,valueSpec:i,validateSpec:r,style:a,styleSpec:o,key:n}=e,s=e.arrayElementValidator||r;if(_e(t)!=="array")return[new O(n,t,`array expected, ${_e(t)} found`)];if(i.length&&t.length!==i.length)return[new O(n,t,`array length ${i.length} expected, length ${t.length} found`)];let l={type:i.value,values:i.values};o.$version<7&&(l.function=i.function),_e(i.value)==="object"&&(l=i.value);let u=[];for(let c=0;c<t.length;c++)u=u.concat(s({array:t,arrayIndex:c,value:t[c],valueSpec:l,validateSpec:e.validateSpec,style:a,styleSpec:o,key:`${n}[${c}]`}));return u}function qu(e){let{key:t,value:i,valueSpec:r}=e,a=_e(i);return a==="number"&&i!==i&&(a="NaN"),a==="number"?"minimum"in r&&i<r.minimum?[new O(t,i,`${i} is less than the minimum value ${r.minimum}`)]:("maximum"in r)&&i>r.maximum?[new O(t,i,`${i} is greater than the maximum value ${r.maximum}`)]:[]:[new O(t,i,`number expected, ${a} found`)]}function mv(e){let t=e.valueSpec,i=lt(e.value.type),r,a={},o,n,s=i!=="categorical"&&e.value.property===void 0,l=!s,u=_e(e.value.stops)==="array"&&_e(e.value.stops[0])==="array"&&_e(e.value.stops[0][0])==="object",c=wi({key:e.key,value:e.value,valueSpec:e.styleSpec.function,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{stops:h,default:f}});return i==="identity"&&s&&c.push(new O(e.key,e.value,'missing required property "property"')),i!=="identity"&&!e.value.stops&&c.push(new O(e.key,e.value,'missing required property "stops"')),i==="exponential"&&e.valueSpec.expression&&!Qp(e.valueSpec)&&c.push(new O(e.key,e.value,"exponential functions not supported")),e.styleSpec.$version>=8&&(l&&!Ao(e.valueSpec)?c.push(new O(e.key,e.value,"property functions not supported")):s&&!rv(e.valueSpec)&&c.push(new O(e.key,e.value,"zoom functions not supported"))),(i==="categorical"||u)&&e.value.property===void 0&&c.push(new O(e.key,e.value,'"property" property is required')),c;function h(m){if(i==="identity")return[new O(m.key,m.value,'identity function may not have a "stops" property')];let g=[],_=m.value;return g=g.concat(of({key:m.key,value:_,valueSpec:m.valueSpec,validateSpec:m.validateSpec,style:m.style,styleSpec:m.styleSpec,arrayElementValidator:d})),_e(_)==="array"&&_.length===0&&g.push(new O(m.key,_,"array must have at least one stop")),g}function d(m){let g=[],{value:_,key:y}=m;if(_e(_)!=="array")return[new O(y,_,`array expected, ${_e(_)} found`)];if(_.length!==2)return[new O(y,_,`array length 2 expected, length ${_.length} found`)];if(u){if(_e(_[0])!=="object")return[new O(y,_,`object expected, ${_e(_[0])} found`)];if(_[0].zoom===void 0)return[new O(y,_,"object stop key must have zoom")];if(_[0].value===void 0)return[new O(y,_,"object stop key must have value")];if(n&&n>lt(_[0].zoom))return[new O(y,_[0].zoom,"stop zoom values must appear in ascending order")];lt(_[0].zoom)!==n&&(n=lt(_[0].zoom),o=void 0,a={}),g=g.concat(wi({key:`${y}[0]`,value:_[0],valueSpec:{zoom:{}},validateSpec:m.validateSpec,style:m.style,styleSpec:m.styleSpec,objectElementValidators:{zoom:qu,value:p}}))}else g=g.concat(p({key:`${y}[0]`,value:_[0],valueSpec:{},validateSpec:m.validateSpec,style:m.style,styleSpec:m.styleSpec},_));return $u(Pa(_[1]))?g.concat([new O(`${y}[1]`,_[1],"expressions are not allowed in function stops.")]):g.concat(m.validateSpec({key:`${y}[1]`,value:_[1],valueSpec:t,validateSpec:m.validateSpec,style:m.style,styleSpec:m.styleSpec}))}function p(m,g){let _=_e(m.value),y=lt(m.value),v=m.value===null?g:m.value;if(!r)r=_;else if(_!==r)return[new O(m.key,v,`${_} stop domain type must match previous stop domain type ${r}`)];if(_!=="number"&&_!=="string"&&_!=="boolean")return[new O(m.key,v,"stop domain value must be a number, string, or boolean")];if(_!=="number"&&i!=="categorical"){let x=`number expected, ${_} found`;return Ao(t)&&i===void 0&&(x+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new O(m.key,v,x)]}return i==="categorical"&&_==="number"&&(!isFinite(y)||Math.floor(y)!==y)?[new O(m.key,v,`integer expected, found ${y}`)]:i!=="categorical"&&_==="number"&&o!==void 0&&y<o?[new O(m.key,v,"stop domain values must appear in ascending order")]:(o=y,i==="categorical"&&(y in a)?[new O(m.key,v,"stop domain values must be unique")]:(a[y]=!0,[]))}function f(m){return m.validateSpec({key:m.key,value:m.value,valueSpec:t,validateSpec:m.validateSpec,style:m.style,styleSpec:m.styleSpec})}}function Po(e){let t=(e.expressionContext==="property"?lv:Uu)(Pa(e.value),e.key,e.valueSpec);if(t.result==="error")return t.value.map((r)=>new O(`${e.key}${r.key}`,e.value,r.message));let i=t.value.expression||t.value._styleExpression.expression;if(e.expressionContext==="property"&&e.propertyKey==="text-font"&&!i.outputDefined())return[new O(e.key,e.value,`Invalid data expression for "${e.propertyKey}". Output values must be contained as literals within the expression.`)];if(e.expressionContext==="property"&&e.propertyType==="layout"&&!Nn(i))return[new O(e.key,e.value,'"feature-state" data expressions are not supported with layout properties.')];if(e.expressionContext==="filter"&&!Nn(i))return[new O(e.key,e.value,'"feature-state" data expressions are not supported with filters.')];if(e.expressionContext&&e.expressionContext.indexOf("cluster")===0){if(!Nu(i,["zoom","feature-state"]))return[new O(e.key,e.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(e.expressionContext==="cluster-initial"&&!ju(i))return[new O(e.key,e.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function x6(e){let{value:t,key:i}=e,r=_e(t);return r==="boolean"?[]:[new O(i,t,`boolean expected, ${r} found`)]}function md(e){let{key:t,value:i}=e,r=_e(i);return r==="string"?se.parse(String(i))?[]:[new O(t,i,`color expected, "${i}" found`)]:[new O(t,i,`color expected, ${r} found`)]}function qn(e){let{key:t,value:i,valueSpec:r}=e,a=[];return Array.isArray(r.values)?r.values.indexOf(lt(i))===-1&&a.push(new O(t,i,`expected one of [${r.values.join(", ")}], ${JSON.stringify(i)} found`)):Object.keys(r.values).indexOf(lt(i))===-1&&a.push(new O(t,i,`expected one of [${Object.keys(r.values).join(", ")}], ${JSON.stringify(i)} found`)),a}function b6(e,t){let i=e;for(let r of t)i=i[r];return i}function w6(e,t){let i=af(t);return i?[new O(`${e.key}${i.path.map((r)=>`[${r}]`).join("")}`,b6(e.value,i.path),dv(i.legacyFilter),null,"warning")]:[]}function nf(e){let t=Pa(e.value);return rf(t)?[...w6(e,t),...Po(Vn({},e,{expressionContext:"filter",valueSpec:{value:"boolean"}}))]:gv(e)}function gv(e){let{value:t,key:i}=e;if(_e(t)!=="array")return[new O(i,t,`array expected, ${_e(t)} found`)];let r=e.styleSpec,a,o=[];if(t.length<1)return[new O(i,t,"filter array must have at least 1 element")];switch(o=o.concat(qn({key:`${i}[0]`,value:t[0],valueSpec:r.filter_operator,style:e.style,styleSpec:e.styleSpec})),lt(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&lt(t[1])==="$type"&&o.push(new O(i,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":t.length!==3&&o.push(new O(i,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(a=_e(t[1]),a!=="string"&&o.push(new O(`${i}[1]`,t[1],`string expected, ${a} found`)));for(let n=2;n<t.length;n++)a=_e(t[n]),lt(t[1])==="$type"?o=o.concat(qn({key:`${i}[${n}]`,value:t[n],valueSpec:r.geometry_type,style:e.style,styleSpec:e.styleSpec})):a!=="string"&&a!=="number"&&a!=="boolean"&&o.push(new O(`${i}[${n}]`,t[n],`string, number, or boolean expected, ${a} found`));break;case"any":case"all":case"none":for(let n=1;n<t.length;n++)o=o.concat(gv({key:`${i}[${n}]`,value:t[n],style:e.style,styleSpec:e.styleSpec}));break;case"has":case"!has":a=_e(t[1]),t.length===2?a!=="string"&&o.push(new O(`${i}[1]`,t[1],`string expected, ${a} found`)):o.push(new O(i,t,`filter array for "${t[0]}" operator must have 2 elements`))}return o}function _v(e,t){let{key:i,validateSpec:r,style:a,styleSpec:o,value:n,objectKey:s}=e,l=o[`${t}_${e.layerType}`];if(!l)return[];let u=s.match(ef);if(t==="paint"&&u&&l[u[1]]&&l[u[1]].transition)return r({key:i,value:n,valueSpec:o.transition,style:a,styleSpec:o});let c=e.valueSpec||l[s];if(!c)return[new O(i,n,`unknown property "${s}"`)];let h;if(_e(n)==="string"&&Ao(c)&&!c.tokens&&(h=/^{([^}]+)}$/.exec(n)))return[new O(i,n,`"${s}" does not support interpolation syntax
2
+ Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(h[1])} }\`.`)];let d=[];return e.layerType==="symbol"&&s==="text-font"&&Vu(Pa(n))&&lt(n.type)==="identity"&&d.push(new O(i,n,'"text-font" does not support identity functions')),d.concat(r({key:e.key,value:n,valueSpec:c,style:a,styleSpec:o,expressionContext:"property",propertyType:t,propertyKey:s}))}function yv(e){return _v(e,"paint")}function vv(e){return _v(e,"layout")}function xv(e){let t=[],{value:i,key:r,style:a,styleSpec:o}=e;if(_e(i)!=="object")return[new O(r,i,`object expected, ${_e(i)} found`)];!i.type&&!i.ref&&t.push(new O(r,i,'either "type" or "ref" is required'));let n=lt(i.type),s=lt(i.ref);if(i.id){let l=lt(i.id);for(let u=0;u<e.arrayIndex;u++){let c=a.layers[u];lt(c.id)===l&&t.push(new O(r,i.id,`duplicate layer id "${i.id}", previously used at line ${c.id.__line__}`))}}if("ref"in i){["type","source","source-layer","filter","layout"].forEach((u)=>{u in i&&t.push(new O(r,i[u],`"${u}" is prohibited for ref layers`))});let l;a.layers.forEach((u)=>{lt(u.id)===s&&(l=u)}),l?l.ref?t.push(new O(r,i.ref,"ref cannot reference another ref layer")):n=lt(l.type):t.push(new O(r,i.ref,`ref layer "${s}" not found`))}else if(n!=="background")if(!i.source)t.push(new O(r,i,'missing required property "source"'));else{let l=a.sources&&a.sources[i.source],u=l&&lt(l.type);l?u==="vector"&&n==="raster"?t.push(new O(r,i.source,`layer "${i.id}" requires a raster source`)):u!=="raster-dem"&&n==="hillshade"||u!=="raster-dem"&&n==="color-relief"?t.push(new O(r,i.source,`layer "${i.id}" requires a raster-dem source`)):u==="raster"&&n!=="raster"?t.push(new O(r,i.source,`layer "${i.id}" requires a vector source`)):u==="vector"&&!i["source-layer"]?t.push(new O(r,i,`layer "${i.id}" must specify a "source-layer"`)):u==="raster-dem"&&n!=="hillshade"&&n!=="color-relief"?t.push(new O(r,i.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):n==="line"&&i.paint&&i.paint["line-gradient"]&&(u!=="geojson"||!l.lineMetrics)&&t.push(new O(r,i,`layer "${i.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new O(r,i.source,`source "${i.source}" not found`))}return n==="raster"&&i.paint?.resampling&&i.paint?.["raster-resampling"]&&t.push(new O(r,i.paint,`layer "${i.id}" redundantly specifies "resampling" and "raster-resampling" paint properties, but only one is allowed. It is advised to use "resampling".`)),t=t.concat(wi({key:r,value:i,valueSpec:o.layer,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*"(){return[]},type(){return e.validateSpec({key:`${r}.type`,value:i.type,valueSpec:o.layer.type,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,object:i,objectKey:"type"})},filter:nf,layout(l){return wi({layer:i,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return vv(Vn({layerType:n},u))}}})},paint(l){return wi({layer:i,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return yv(Vn({layerType:n},u))}}})}}})),t}function oa(e){let{value:t,key:i}=e,r=_e(t);return r==="string"?[]:[new O(i,t,`string expected, ${r} found`)]}function T6(e){let t=e.sourceName??"",{value:i,styleSpec:r}=e,a=r.source_raster_dem,o=e.style,n=[],s=_e(i);if(i===void 0)return n;if(s!=="object")return n.push(new O("source_raster_dem",i,`object expected, ${s} found`)),n;let l=lt(i.encoding)==="custom",u=["redFactor","greenFactor","blueFactor","baseShift"],c=e.value.encoding?`"${e.value.encoding}"`:"Default";for(let h in i)!l&&u.includes(h)?n.push(new O(h,i[h],`In "${t}": "${h}" is only valid when "encoding" is set to "custom". ${c} encoding found`)):a[h]?n=n.concat(e.validateSpec({key:h,value:i[h],valueSpec:a[h],validateSpec:e.validateSpec,style:o,styleSpec:r})):n.push(new O(h,i[h],`unknown property "${h}"`));return n}function bv(e){let{value:t,key:i,styleSpec:r,style:a,validateSpec:o}=e;if(!t.type)return[new O(i,t,'"type" is required')];let n=lt(t.type),s;switch(n){case"vector":case"raster":return s=wi({key:i,value:t,valueSpec:r[`source_${n.replace("-","_")}`],style:e.style,styleSpec:r,objectElementValidators:d0,validateSpec:o}),s;case"raster-dem":return s=T6({sourceName:i,value:t,style:e.style,styleSpec:r,validateSpec:o}),s;case"geojson":if(s=wi({key:i,value:t,valueSpec:r.source_geojson,style:a,styleSpec:r,validateSpec:o,objectElementValidators:d0}),t.cluster)for(let l in t.clusterProperties){let[u,c]=t.clusterProperties[l],h=typeof u=="string"?[u,["accumulated"],["get",l]]:u;s.push(...Po({key:`${i}.${l}.map`,value:c,validateSpec:o,expressionContext:"cluster-map"})),s.push(...Po({key:`${i}.${l}.reduce`,value:h,validateSpec:o,expressionContext:"cluster-reduce"}))}return s;case"video":return wi({key:i,value:t,valueSpec:r.source_video,style:a,validateSpec:o,styleSpec:r});case"image":return wi({key:i,value:t,valueSpec:r.source_image,style:a,validateSpec:o,styleSpec:r});case"canvas":return[new O(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return qn({key:`${i}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:a,validateSpec:o,styleSpec:r})}}function E6({key:e,value:t}){if(_e(t)==="string")return oa({key:e,value:t});{let i=[];for(let r in t)i.push(...oa({key:`${e}.${r}`,value:t[r]}));return i}}function wv(e){let{value:t,styleSpec:i}=e,r=i.light,a=e.style,o=[],n=_e(t);if(t===void 0)return o;if(n!=="object")return o=o.concat([new O("light",t,`object expected, ${n} found`)]),o;for(let s in t){let l=s.match(ef);o=l&&r[l[1]]&&r[l[1]].transition?o.concat(e.validateSpec({key:s,value:t[s],valueSpec:i.transition,validateSpec:e.validateSpec,style:a,styleSpec:i})):r[s]?o.concat(e.validateSpec({key:s,value:t[s],valueSpec:r[s],validateSpec:e.validateSpec,style:a,styleSpec:i})):o.concat([new O(s,t[s],`unknown property "${s}"`)])}return o}function Tv(e){let{value:t,styleSpec:i}=e,r=i.sky,a=e.style,o=_e(t);if(t===void 0)return[];if(o!=="object")return[new O("sky",t,`object expected, ${o} found`)];let n=[];for(let s in t){let l=s.match(ef);n=l&&r[l[1]]&&r[l[1]].transition?n.concat(e.validateSpec({key:s,value:t[s],valueSpec:i.transition,style:a,styleSpec:i})):r[s]?n.concat(e.validateSpec({key:s,value:t[s],valueSpec:r[s],style:a,styleSpec:i})):n.concat([new O(s,t[s],`unknown property "${s}"`)])}return n}function Ev(e){let{value:t,styleSpec:i}=e,r=i.terrain,a=e.style,o=[],n=_e(t);if(t===void 0)return o;if(n!=="object")return o=o.concat([new O("terrain",t,`object expected, ${n} found`)]),o;for(let s in t)o=r[s]?o.concat(e.validateSpec({key:s,value:t[s],valueSpec:r[s],validateSpec:e.validateSpec,style:a,styleSpec:i})):o.concat([new O(s,t[s],`unknown property "${s}"`)]);return o}function S6(e){return oa(e).length===0?[]:Po(e)}function C6(e){return oa(e).length===0?[]:Po(e)}function D6(e){let{key:t,value:i}=e;if(_e(i)==="array"){if(i.length<1||i.length>4)return[new O(t,i,`padding requires 1 to 4 values; ${i.length} values found`)];let r={type:"number"},a=[];for(let o=0;o<i.length;o++)a=a.concat(e.validateSpec({key:`${t}[${o}]`,value:i[o],validateSpec:e.validateSpec,valueSpec:r}));return a}return qu({key:t,value:i,valueSpec:{}})}function A6(e){let{key:t,value:i}=e;if(_e(i)==="array"){let r={type:"number"};if(i.length<1)return[new O(t,i,"array length at least 1 expected, length 0 found")];let a=[];for(let o=0;o<i.length;o++)a=a.concat(e.validateSpec({key:`${t}[${o}]`,value:i[o],validateSpec:e.validateSpec,valueSpec:r}));return a}return qu({key:t,value:i,valueSpec:{}})}function M6(e){let{key:t,value:i}=e;if(_e(i)==="array"){if(i.length<1)return[new O(t,i,"array length at least 1 expected, length 0 found")];let r=[];for(let a=0;a<i.length;a++)r=r.concat(md({key:`${t}[${a}]`,value:i[a],valueSpec:{}}));return r}return md({key:t,value:i,valueSpec:{}})}function P6(e){let{key:t,value:i}=e,r=_e(i),a=e.styleSpec;if(r!=="array"||i.length<1||i.length%2!=0)return[new O(t,i,"variableAnchorOffsetCollection requires a non-empty array of even length")];let o=[];for(let n=0;n<i.length;n+=2)o=o.concat(qn({key:`${t}[${n}]`,value:i[n],valueSpec:a.layout_symbol["text-anchor"]})),o=o.concat(of({key:`${t}[${n+1}]`,value:i[n+1],valueSpec:{length:2,value:"number"},validateSpec:e.validateSpec,style:e.style,styleSpec:a}));return o}function Sv(e){let t=[],{value:i,key:r}=e;if(Array.isArray(i)){let a=[],o=[];for(let n in i)i[n].id&&a.includes(i[n].id)&&t.push(new O(r,i,`all the sprites' ids must be unique, but ${i[n].id} is duplicated`)),a.push(i[n].id),i[n].url&&o.includes(i[n].url)&&t.push(new O(r,i,`all the sprites' URLs must be unique, but ${i[n].url} is duplicated`)),o.push(i[n].url),t=t.concat(wi({key:`${r}[${n}]`,value:i[n],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:e.validateSpec}));return t}return oa({key:r,value:i})}function I6(e){let{value:t,styleSpec:i}=e,r=i.projection,a=e.style,o=_e(t);if(t===void 0)return[];if(o!=="object")return[new O("projection",t,`object expected, ${o} found`)];let n=[];for(let s in t)n=r[s]?n.concat(e.validateSpec({key:s,value:t[s],valueSpec:r[s],style:a,styleSpec:i})):n.concat([new O(s,t[s],`unknown property "${s}"`)]);return n}function k6(e){let{key:t,value:i}=e;i=i instanceof String?i.valueOf():i;let r=_e(i);return r==="array"&&!R6(i)&&!F6(i)?[new O(t,i,`projection expected, invalid array ${JSON.stringify(i)} found`)]:["array","string"].includes(r)?[]:[new O(t,i,`projection expected, invalid type "${r}" found`)]}function F6(e){return!!["interpolate","step","literal"].includes(e[0])}function R6(e){return Array.isArray(e)&&e.length===3&&typeof e[0]=="string"&&typeof e[1]=="string"&&typeof e[2]=="number"}function gd(e){return!!e&&e.constructor===Object}function Cv(e){return gd(e.value)?[]:[new O(e.key,e.value,`object expected, ${_e(e.value)} found`)]}function L6(e,t){if(_e(t)!=="string")return[];let i=`${t}`,r=()=>[new O(e,t,'invalid unicode range, expected a value such as "U+26", "U+0-10FFFF" or "U+4??"')],a=i.match(z6);if(!a)return r();let[,o,n,s]=a;if(s!==void 0)return s.length>6?r():[];let l=parseInt(o,16),u=n===void 0?l:parseInt(n,16);return l>p0||u>p0?[new O(e,t,"unicode range is out of bounds, the maximum code point is U+10FFFF")]:l>u?[new O(e,t,`unicode range start must not be greater than its end, but ${i} is`)]:[]}function Dv(e){let t=e.key??"font-faces",{value:i,validateSpec:r}=e,a=e.styleSpec??Ay,o=e.style;if(!gd(i))return[new O(t,i,`object expected, ${_e(i)} found`)];let n=[];for(let s in i){let l=i[s],u=_e(l);if(u==="string")n.push(...oa({key:`${t}.${s}`,value:l}));else if(u==="array"){let c={url:{type:"string",required:!0},"unicode-range":{type:"array",value:"string"}};for(let[h,d]of l.entries()){let p=`${t}.${s}[${h}]`;n.push(...wi({key:p,value:d,valueSpec:c,styleSpec:a,style:o,validateSpec:r}));let f=gd(d)?d["unicode-range"]:void 0;if(_e(f)==="array")for(let[m,g]of f.entries())n.push(...L6(`${p}.unicode-range[${m}]`,g))}}else n.push(new O(`${t}.${s}`,l,`string or array expected, ${u} found`))}return n}function Sn(e){let{value:t,valueSpec:i,styleSpec:r}=e;return e.validateSpec=Sn,i.expression&&Vu(lt(t))?mv(e):i.expression&&$u(Pa(t))?Po(e):i.type&&f0[i.type]?f0[i.type](e):wi(Vn({},e,{valueSpec:i.type?r[i.type]:i}))}function Av(e){let{value:t,key:i}=e,r=oa(e);return r.length||(t.indexOf("{fontstack}")===-1&&r.push(new O(i,t,'"glyphs" url must include a "{fontstack}" token')),t.indexOf("{range}")===-1&&r.push(new O(i,t,'"glyphs" url must include a "{range}" token'))),r}function _i(e,t=F){let i=[];return i=i.concat(Sn({key:"",value:e,valueSpec:t.$root,styleSpec:t,style:e,validateSpec:Sn,objectElementValidators:{glyphs:Av,"*"(){return[]}}})),e.constants&&(i=i.concat(fv({key:"constants",value:e.constants,style:e,styleSpec:t,validateSpec:Sn}))),Mv(i)}function Mi(e){return function(t){return e(Object.assign({},t,{validateSpec:Sn}))}}function Mv(e){return[].concat(e).sort((t,i)=>t.line-i.line)}function Pi(e){return function(...t){return Mv(e.apply(this,t))}}function j6(e,t,i){return new O6(e,t,i)}function Z(e,t,i={}){if(kr[e])throw Error(`${e} is already registered.`);Object.defineProperty(t,"_classRegistryKey",{value:e,writeable:!1}),kr[e]={klass:t,omit:i.omit||[],shallow:i.shallow||[]}}function Pv(e){return e&&typeof ArrayBuffer<"u"&&(e instanceof ArrayBuffer||e.constructor?.name==="ArrayBuffer")}function sf(e){let t=e.constructor;return e.$name||t._classRegistryKey}function N6(e){if(typeof e!="object"||!e)return!1;let t=sf(e);return t&&t!=="Object"}function Iv(e){return!N6(e)&&(e==null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||e instanceof Blob||e instanceof Error||Pv(e)||Sa(e)||ArrayBuffer.isView(e)||e instanceof ImageData)}function Cn(e,t){if(Iv(e))return(Pv(e)||Sa(e))&&t&&t.push(e),ArrayBuffer.isView(e)&&t&&t.push(e.buffer),e instanceof ImageData&&t&&t.push(e.data.buffer),e;if(Array.isArray(e)){let o=[];for(let n of e)o.push(Cn(n,t));return o}if(typeof e!="object")throw Error(`can't serialize object of type ${typeof e}`);let i=sf(e);if(!i)throw Error(`can't serialize object of unregistered class ${e.constructor.name}`);if(!kr[i])throw Error(`${i} is not registered.`);let{klass:r}=kr[i],a=r.serialize?r.serialize(e,t):{};if(!r.serialize){for(let o in e){if(!e.hasOwnProperty(o)||kr[i].omit.includes(o))continue;let n=e[o];n!==void 0&&(a[o]=kr[i].shallow.includes(o)?n:Cn(n,t))}e instanceof Error&&(a.message=e.message)}else if(a===t?.[t.length-1])throw Error("statically serialized object won't survive transfer of $name property");if(a.$name)throw Error("$name property is reserved for worker serialization logic.");return i!=="Object"&&(a.$name=i),a}function Dn(e){if(Iv(e))return e;if(Array.isArray(e))return e.map(Dn);if(typeof e!="object")throw Error(`can't deserialize object of type ${typeof e}`);let t=sf(e)||"Object";if(!kr[t])throw Error(`can't deserialize unregistered class ${t}`);let{klass:i}=kr[t];if(!i)throw Error(`can't deserialize unregistered class ${t}`);if(i.deserialize)return i.deserialize(e);let r=Object.create(i.prototype);for(let a of Object.keys(e)){if(a==="$name")continue;let o=e[a];r[a]=kr[t].shallow.includes(a)?o:Dn(o)}return r}function kv(e,t,i){let r=e.map((a)=>ql(a,"error",()=>{i.fire(new ie(Error("Worker failed to load. Check that the worker URL is correct.")))},!1));return{actors:e.map((a,o)=>{let n=new U6(a,t);return n.name=`Worker ${o}`,n}),workerErrorSubscriptions:r}}function q6(e){if(!e)return!1;let t=globalThis.location;if(!t)return!1;try{return new URL(e,t.href).origin!==t.origin}catch{return!1}}function G6(){let e=import.meta.url;if(!/^https?:/.test(e))return"";let t=e.endsWith("-dev.mjs")?"maplibre-gl-worker-dev.mjs":"maplibre-gl-worker.mjs",i=new URL(`./${t}`,e);return i.searchParams.set("v",dy),i.href}function W6(e){return e.endsWith(".cjs")||e.split(/[?#]/)[0].endsWith(".cjs")}function el(e,t){let i=p3(e);if(t)try{return new Worker(i,{type:"module"})}catch(r){console.warn("Module worker not supported, falling back to classic worker",r)}return new Worker(i)}async function Fv(e){let t=await fetch(e);if(!t.ok)throw Error(`Failed to fetch worker script (${t.status}): ${e}`);return t.text()}async function Z6(e){let t=new Blob([await Fv(e)],{type:"text/javascript"});return URL.createObjectURL(t)}function H6(){return globalThis.origin==="null"}async function X6(e){return`data:text/javascript;charset=utf-8,${encodeURIComponent(await Fv(e))}`}function Y6(e){let t=new Blob([`import ${JSON.stringify(new URL(e,import.meta.url).href)}`],{type:"text/javascript"});return URL.createObjectURL(t)}async function K6(){let e=Ma.WORKER_URL||G6(),t=!W6(e);if(t&&H6())return el(await X6(e),t);if(!q6(e))return el(e,t);if(t){let r=Y6(e);try{return el(r,t)}finally{URL.revokeObjectURL(r)}}let i=await Z6(e);try{return el(i,t)}finally{URL.revokeObjectURL(i)}}function Ql(){return m0||=new Rv,m0}function zv(){return tl||(tl=new eT(Ql()),tl.registerMessageHandler("GR",(e,t,i)=>Mu(t,i))),tl}function lT(e){return Object.entries(e.sources??{}).filter(([,t])=>!Lv.has(t.type)).map(([t])=>`sources.${t}`)}function y0(e,t){let i=lT(t);return lf(e,ai(t).filter(({message:r})=>!i.some((a)=>r.startsWith(`${a}:`)||r.startsWith(`${a}.`))))}function lf(e,t){let i=!1;for(let r of t)r.severity==="warning"?he(r.message):(e.fire(new ie(Error(r.message))),i=!0);return i}function ds(e,t,i,r){return r?.validate!==!1&&lf(e,t({styleSpec:F,...i}))}function b0(e){if(Array.isArray(e))return e.length;let t=e?.values;return Array.isArray(t)?t.length:void 0}function Bv(e,t){let i=b0(e),r=b0(t);return i!==void 0&&r!==void 0&&i!==r}function rt(e,t=1){let i=0,r=0;return{members:e.map((a)=>{let o=mT(a.type),n=i=T0(i,Math.max(t,o)),s=a.components||1;return r=Math.max(r,o),i+=o*s,{name:a.name,type:a.type,components:s,offset:n}}),size:T0(i,Math.max(r,t)),alignment:t}}function mT(e){return fT[e].BYTES_PER_ELEMENT}function T0(e,t){return Math.ceil(e/t)*t}function C0(e,t){return e=H(Math.floor(e),0,255),t=H(Math.floor(t),0,255),256*e+t}function D0(e){let t=+e;return!isNaN(t)&&t<=9007199254740991?t:(0,ru.default)(String(e))}function Nd(e,t,i,r){let a=!1;for(;i<r;){let o=e[a?i+Math.floor(Math.random()*(r-i)):i+r>>1],n=i-1,s=r+1;for(;;){do n++;while(e[n]<o);do s--;while(e[s]>o);if(n>=s)break;rl(e,n,s),rl(t,3*n,3*s),rl(t,3*n+1,3*s+1),rl(t,3*n+2,3*s+2)}a=Math.min(s-i,r-s)<r-i>>3,s-i<r-s?(Nd(e,t,i,s),i=s+1):(Nd(e,t,s+1,r),r=s)}}function rl(e,t,i){let r=e[t];e[t]=e[i],e[i]=r}function Vd(e){return[C0(255*e.r,255*e.g),C0(255*e.b,255*e.a)]}function LT(e,t){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-dasharray":["dasharray_to","dasharray_from"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[e]||[e.replace(`${t}-`,"").replace(/-/g,"_")]}function BT(e){return{"line-pattern":{source:to,composite:to},"fill-pattern":{source:to,composite:to},"fill-extrusion-pattern":{source:to,composite:to},"line-dasharray":{source:E0,composite:E0}}[e]}function P0(e,t,i){let r={color:{source:Xn,composite:Bd},number:{source:iu,composite:Xn}};return BT(e)?.[i]||r[t][i]}function Ba(e){let t=z/e.extent,i=e.loadGeometry();for(let r of i)for(let a of r){let o=Math.round(a.x*t),n=Math.round(a.y*t);a.x=H(o,I0,$d),a.y=H(n,I0,$d),(o<a.x||o>a.x+1||n<a.y||n>a.y+1)&&he("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return i}function Oa(e,t){return{type:e.type,id:e.id,properties:e.properties,geometry:t?Ba(e):[]}}function au(e,t){return e.x===t.x&&(e.x<0||e.x>8192)||e.y===t.y&&(e.y<0||e.y>8192)}function k0(e){return e.every((t)=>t.x<0)||e.every((t)=>t.x>8192)||e.every((t)=>t.y<0)||e.every((t)=>t.y>8192)}function uf(e){return e.x<0||e.x>=8192||e.y<0||e.y>=8192}function jT(e,t,i,r,a){e.emplaceBack(F0+t*8+r,F0+i*8+a)}function t2(e,t){for(let i of e)if(ko(t,i))return!0;for(let i of t)if(ko(e,i))return!0;return hf(e,t)}function Hu(e,t,i){return ko(e,t)?!0:Ud(t,e,i)}function i2(e,t){if(e.length===1)return R0(t,e[0]);for(let i of t)for(let r of i)if(ko(e,r))return!0;for(let i of e)if(R0(t,i))return!0;for(let i of t)if(hf(e,i))return!0;return!1}function NT(e,t,i){for(let r of t){if(e.length>=3){for(let a of r)if(ko(e,a))return!0}if(VT(e,r,i))return!0}return!1}function VT(e,t,i){if(e.length>1){if(hf(e,t))return!0;for(let r of t)if(Ud(r,e,i))return!0}for(let r of e)if(Ud(r,t,i))return!0;return!1}function hf(e,t){if(e.length===0||t.length===0)return!1;for(let i=0;i<e.length-1;i++){let r=e[i],a=e[i+1];for(let o=0;o<t.length-1;o++){let n=t[o],s=t[o+1];if($T(r,a,n,s))return!0}}return!1}function $T(e,t,i,r){return Qr(e,i,r)!==Qr(t,i,r)&&Qr(e,t,i)!==Qr(e,t,r)}function Ud(e,t,i){let r=i*i;if(t.length===1)return e.distSqr(t[0])<r;for(let a=1;a<t.length;a++){let o=t[a-1],n=t[a];if(r2(e,o,n)<r)return!0}return!1}function r2(e,t,i){let r=t.distSqr(i);if(r===0)return e.distSqr(t);let a=((e.x-t.x)*(i.x-t.x)+(e.y-t.y)*(i.y-t.y))/r;return a<0?e.distSqr(t):a>1?e.distSqr(i):e.distSqr(i.sub(t)._mult(a)._add(t))}function R0(e,t){let i=!1,r,a,o;for(let n of e){r=n;for(let s=0,l=r.length-1;s<r.length;l=s++)a=r[s],o=r[l],a.y>t.y!=o.y>t.y&&t.x<(o.x-a.x)*(t.y-a.y)/(o.y-a.y)+a.x&&(i=!i)}return i}function ko(e,t){let i=!1;for(let r=0,a=e.length-1;r<e.length;a=r++){let o=e[r],n=e[a];o.y>t.y!=n.y>t.y&&t.x<(n.x-o.x)*(t.y-o.y)/(n.y-o.y)+o.x&&(i=!i)}return i}function UT(e,t,i,r,a){for(let n of e)if(t<=n.x&&i<=n.y&&r>=n.x&&a>=n.y)return!0;let o=[new D(t,i),new D(t,a),new D(r,a),new D(r,i)];if(e.length>2){for(let n of o)if(ko(e,n))return!0}for(let n=0;n<e.length-1;n++){let s=e[n],l=e[n+1];if(qT(s,l,o))return!0}return!1}function qT(e,t,i){let r=i[0],a=i[2];if(e.x<r.x&&t.x<r.x||e.x>a.x&&t.x>a.x||e.y<r.y&&t.y<r.y||e.y>a.y&&t.y>a.y)return!1;let o=Qr(e,t,i[0]);return o!==Qr(e,t,i[1])||o!==Qr(e,t,i[2])||o!==Qr(e,t,i[3])}function a2(e){return df*Math.cos(e*Math.PI/180)}function ou(e){return(180+e)/360}function nu(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function Gd(e,t){return e/a2(t)}function o2(e){return e*360-180}function Yn(e){let t=180-e*360;return 360/Math.PI*Math.atan(Math.exp(t*Math.PI/180))-90}function GT(e,t){return e*a2(Yn(t))}function n2(e){return 1/Math.cos(e*Math.PI/180)}function WT(e,t,i){return!(e<0||e>25||i<0||i>=2**e||t<0||t>=2**e)}function wh(e,t,i){let{x:r,y:a}=i.worldFromLngLat(t.lng,t.lat);return!(e<0||e>25||a<0||a>=1||r<0||r>=1)}function mo(e,t,i,r,a){e*=2,e<0&&(e=e*-1-1);let o=1<<i;return(o*o*e+o*a+r).toString(36)+i.toString(36)+t.toString(36)}function z0(e,t,i,r){let a=2**i,o=r.extentAtZoom0/a,[n,s]=r.origin,l=s-r.extentAtZoom0,u=a-t-1;return`${n+e*o},${l+u*o},${n+(e+1)*o},${l+(u+1)*o}`}function ZT(e,t,i){let r="";for(let a=e;a>0;a--){let o=1<<a-1;r+=(t&o?1:0)+(i&o?2:0)}return r}function L0(e,t){let i=Math.abs(e.wrap*2)-+(e.wrap<0),r=Math.abs(t.wrap*2)-+(t.wrap<0);return e.overscaledZ-t.overscaledZ||r-i||t.canonical.y-e.canonical.y||t.canonical.x-e.canonical.x}function s2(e,t,i){let r=1/(1<<i.z);return new Ot(e/z*r+i.x*r,t/z*r+i.y*r)}function l2(e){if(!e)return[0,0,1,1];let t=e.canonical.z>=0?1<<e.canonical.z:2**e.canonical.z;return[e.canonical.x/t,e.canonical.y/t,1/t/z,1/t/z]}function HT(e,t,i){return s2(e,t,i).toLngLat()}function ki(e,t,i){let r=i.wraps?H(t.lat,-85.051129,ci):t.lat,{x:a,y:o}=i.worldFromLngLat(t.lng,r);return new D(a*e,o*e)}function ta(e,t,i){return i.lngLatFromWorld(t.x/e,t.y/e)}function Yu(e){return e.cameraToCenterDistance*Math.min(Math.tan(We(90-e.pitch))*0.85,Math.tan(We(go-e.pitch)))}function Wd(e,t){let i=e.canonical,r=t/St(i.z),a=i.x+2**i.z*e.wrap,o=new Float64Array(16);return er(o),gt(o,o,[a*r,i.y*r,0]),Xt(o,o,[r/z,r/z,1]),o}function u2(e,t,i,r){let{x:a,y:o,z:n}=pf(t,i),s=r*-a,l=r*-o,u=r*n;return new Ot(e.x+s,e.y+l,e.z+u)}function XT(e,t,i=e.center){let r=t.worldZFromAltitude(1,i),a=r*e.worldSize,o=e.cameraToCenterDistance/a;return u2(t.worldFromLngLat(i.lng,i.lat,e.elevation),e.pitch,e.bearing,o*r)}function pf(e,t){let i=We(e),r=We(t),a=Math.cos(-i),o=Math.sin(i);return{x:o*Math.sin(r),y:-o*Math.cos(r),z:a}}function c2(e,t,i,r,a){let o=(h,d)=>{let{x:p,y:f}=e.worldFromLngLat(h,d);return new D(p,f)},n=(h)=>h===16?r:t+(r-t)*h/16,s=(h)=>h===16?i:a+(i-a)*h/16,l=[];for(let h=0;h<=16;h++)for(let d=0;d<=16;d++)l.push(o(n(d),s(h)));let u=(h,d)=>l[h*17+d],c=0;for(let h=0;h<16;h++){let d=(n(h)+n(h+1))/2,p=(s(h)+s(h+1))/2,f=[[u(0,h),u(0,h+1),o(d,a)],[u(16,h),u(16,h+1),o(d,i)],[u(h,0),u(h+1,0),o(t,p)],[u(h,16),u(h+1,16),o(r,p)]];for(let[m,g,_]of f){let y=g.sub(m),v=_.sub(m),x=y.mag(),b=x>0?Math.abs(y.x*v.y-y.y*v.x)/x:v.mag();b>c&&(c=b)}}return{points:l,bulge:c}}function h2(e,t,i,r,a){let{points:o,bulge:n}=c2(e,t,i,r,a),s=1/0,l=1/0,u=-1/0,c=-1/0;for(let{x:h,y:d}of o)h<s&&(s=h),d<l&&(l=d),h>u&&(u=h),d>c&&(c=d);return{minX:s-n,minY:l-n,maxX:u+n,maxY:c+n}}function YT(e,t,i,r,a){let o=[e.lngLatFromWorld(t,i),e.lngLatFromWorld(r,i),e.lngLatFromWorld(r,a),e.lngLatFromWorld(t,a)];return{west:Math.min(o[0].lng,o[1].lng,o[2].lng,o[3].lng),south:Math.min(o[0].lat,o[1].lat,o[2].lat,o[3].lat),east:Math.max(o[0].lng,o[1].lng,o[2].lng,o[3].lng),north:Math.max(o[0].lat,o[1].lat,o[2].lat,o[3].lat)}}function KT(e,t){if(e.wraps)return 360;let i=t.lat>0?-0.0001:Th,r=e.worldFromLngLat(t.lng,t.lat),a=e.worldFromLngLat(t.lng+Th,t.lat),o=e.worldFromLngLat(t.lng,t.lat+i),n=Math.max(Math.hypot(a.x-r.x,a.y-r.y),Math.hypot(o.x-r.x,o.y-r.y));return Th/n}function JT(e,t){let i=1/(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]),r=1/(t[8]*t[8]+t[9]*t[9]+t[10]*t[10]),a=t[0]*i,o=t[4]*i,n=t[8]*r,s=t[1]*i,l=t[5]*i,u=t[9]*r,c=t[2]*i,h=t[6]*i,d=t[10]*r;e[0]=a,e[1]=o,e[2]=n,e[4]=s,e[5]=l,e[6]=u,e[8]=c,e[9]=h,e[10]=d;let p=t[12],f=t[13],m=t[14];return e[12]=-a*p-s*f-c*m,e[13]=-o*p-l*f-h*m,e[14]=-n*p-u*f-d*m,e[3]=0,e[7]=0,e[11]=0,e[15]=1,e}function QT(e,t){return e[0]=1/t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1/t[5],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=0,e[11]=1/t[14],e[12]=0,e[13]=0,e[14]=-1,e[15]=t[10]/t[14],e}function eE(e,t){let i=1/(t[0]*t[5]-t[1]*t[4]);return e[0]=t[5]*i,e[1]=-t[1]*i,e[2]=0,e[3]=0,e[4]=-t[4]*i,e[5]=t[0]*i,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1/t[10],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1/t[15],e}function ff(e,t,i){let r=t[0],a=t[1];return e[0]=i[0]*r+i[4]*a+i[12],e[1]=i[1]*r+i[5]*a+i[13],e[3]=i[3]*r+i[7]*a+i[15],e}function d2(e){return{tileSize:512,width:0,height:0,center:new Y(0,0),elevation:0,zoom:0,bearingInRadians:0,pitchInRadians:0,rollInRadians:0,fovInRadians:0.6435011087932844,padding:{top:0,bottom:0,left:0,right:0},minZoom:e?.minZoom||0,maxZoom:e?.maxZoom||22,minPitch:e?.minPitch===void 0||e?.minPitch===null?0:e?.minPitch,maxPitch:e?.maxPitch===void 0||e?.maxPitch===null?60:e?.maxPitch,lngRange:null,latRange:[-85.051129,ci],renderWorldCopies:e?.renderWorldCopies===void 0||!!e?.renderWorldCopies,minElevationForCurrentTile:0,nearFarZOverride:null,unmodified:!0}}function p2(e,t,i){let{top:r=0,bottom:a=0,left:o=0,right:n=0}=e;return new mf(r,a,o,n).interpolate(e,t,i).toJSON()}function Fo(e,t){return new mf(e.top,e.bottom,e.left,e.right).equals(t)}function hr(e){let{top:t,bottom:i,left:r,right:a}=e.padding;return new mf(t,i,r,a).getCenter(e.width,e.height)}function f2(e){return hr(e)._sub(new D(e.width,e.height)._div(2))}function _o(e){return e.bearingInRadians/Math.PI*180}function Gi(e){return e.pitchInRadians/Math.PI*180}function vn(e){return e.rollInRadians/Math.PI*180}function tE(e){let{lngRange:t,latRange:i}=e;return!t&&i[0]===-85.051129&&i[1]===85.051129?null:new Nr([t?.[0]??-1/0,i[0],t?.[1]??1/0,i[1]])}function gf(e){return Wi(e.fovInRadians)}function iE(e,t){let i=St(e.zoom),r=e.tileSize*i,a=!!e.width&&!!e.height,o=a?rE(e.width,e.height):void 0;return{...e,tileZoom:Math.max(0,Math.floor(e.zoom)),scale:i,worldSize:r,pixelsPerMeter:t.worldZFromAltitude(1,e.center)*r,cameraToCenterDistance:a?0.5/Math.tan(e.fovInRadians/2)*e.height:void 0,rotationMatrix:y5(Qh(),Qh(),-e.bearingInRadians),pixelsToGLUnits:o?.pixelsToGLUnits,pixelsToClipSpaceMatrix:o?.pixelsToClipSpaceMatrix,clipSpaceToPixelsMatrix:o?.clipSpaceToPixelsMatrix,pitch:Gi(e),bearing:_o(e),roll:vn(e),fov:gf(e),centerPoint:hr(e)}}function rE(e,t){return(al?.width!==e||al.height!==t)&&(al={width:e,height:t,pixelsToGLUnits:[2/e,-2/t],pixelsToClipSpaceMatrix:oE(e,t),clipSpaceToPixelsMatrix:aE(e,t)}),al}function aE(e,t){let i=er(new Float64Array(16));return Xt(i,i,[e/2,-t/2,1]),gt(i,i,[1,-1,0]),i}function oE(e,t){let i=er(new Float64Array(16));return Xt(i,i,[1,-1,1]),gt(i,i,[-1,-1,0]),Xt(i,i,[2/e,2/t,1]),i}function ot(e){return e.projection==="globe"?e.globeness>0?e.verticalPerspective:e.mercator:e}function An(e){return ot(e).projection==="vertical-perspective"}function nE(e){let t=Math.tan(e.pitchInRadians)*(e.cameraToCenterDistance||1);return e.centerPoint.add(new D(t*Math.sin(e.rollInRadians),t*Math.cos(e.rollInRadians)))}function m2(e,t){let i=nE(e);if(t.length===1)return[t[0],i];let{minX:r,minY:a,maxX:o,maxY:n}=Yi.fromPoints(t).extend(i);return[new D(r,a),new D(o,a),new D(o,n),new D(r,n),new D(r,a)]}function g2(e,t=1,i=0,r,a){let o=[[-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]],n=a?[[6,5,4],[0,1,2],[0,3,7],[2,1,5],[3,2,6],[0,4,5]]:[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]],s=2**i,l=o.map((d)=>sE(d,e,t,s));r&&lE(l,n[0],r,a);let u=n.map((d)=>{let p=Rt([],si([],Br([],l[d[0]],l[d[1]]),Br([],l[d[2]],l[d[1]]))),f=-ft(p,l[d[1]]);return p.concat(f)}),c=[1/0,1/0,1/0],h=[-1/0,-1/0,-1/0];for(let d of l)for(let p=0;p<3;p++)c[p]=Math.min(c[p],d[p]),h[p]=Math.max(h[p],d[p]);return{points:l,planes:u,aabb:{min:c,max:h}}}function sE(e,t,i,r){let a=$t([],e,t),o=1/a[3]/i*r;return B5(a,a,[o,o,1/a[3],o])}function lE(e,t,i,r){let a=r?4:0,o=r?0:4,n=0,s=[],l=[];for(let h=0;h<4;h++){let d=Br([],e[h+o],e[h+a]),p=Ki(d);Ue(d,d,1/p),s.push(p),l.push(d)}for(let h=0;h<4;h++){let d=W5(e[h+a],l[h],i);n=d!==null&&d>=0?Math.max(n,d):Math.max(n,s[h])}let u=uE(e,t),c=cE(i,u);if(c!==null){let h=c/ft(l[0],u);n=Math.min(n,h)}for(let h=0;h<4;h++){let d=Math.min(n,s[h]);e[h+o]=[e[h+a][0]+l[h][0]*d,e[h+a][1]+l[h][1]*d,e[h+a][2]+l[h][2]*d,1]}}function uE(e,t){let i=Br([],e[t[0]],e[t[1]]),r=Br([],e[t[2]],e[t[1]]),a=[0,0,0,0];return Rt(a,si([],i,r)),a[3]=-ft(a,e[t[0]]),a}function cE(e,t){let i=z5([],e,1/Ul(e)),r=Br([],t,Ue([],i,ft(t,i))),a=Ul(r);if(a>0){let o=Math.sqrt(1-i[3]*i[3]);return od(t,Bi([],Ue([],i,-i[3]),Ue([],r,o/a)))}return null}function Ro(e,t,i,r,a){if(r<0||r>=1||!a&&(i<0||i>=1))return j0;let o=a?Math.floor(i):0,n=i-o;for(let s of e.zooms){let l=1<<s,u=n*l,c=r*l,h=Math.floor(u),d=Math.floor(c),p=`${o}/${s}/${h}/${d}`;if(!e.samplerPerTile.has(p))continue;let f=e.samplerPerTile.get(p);return f?{covered:!0,demLoaded:!0,elevation:f(Math.min((u-h)*z,B0),Math.min((c-d)*z,B0),z)*t}:{covered:!0,demLoaded:!1,elevation:0}}return j0}function _f(e,t){return e.covered&&t<=e.elevation+0.000001}function _2(e,t,i,r,a){for(let o=0;o<40&&r-i>a;o++){let n=(i+r)/2;t(e,n)?r=n:i=n}return{lo:i,hi:r}}function Zd(e){let t=N0.get(e);return t||(t={posMatrices:new Map,alignedPosMatrices:new Map,fogMatrices:new Map},N0.set(e,t)),t}function V0(e,t,i=e.nearFarZOverride){let r={...e,projection:"mercator",clippingPlane:null};if(!e.width||!e.height)return r;let a=f2(e),o=ki(e.worldSize,e.center,t),{x:n,y:s}=o,l=We(Math.min(e.pitch,go)),u=Math.max(e.cameraToCenterDistance/2,e.cameraToCenterDistance+e.elevation*e.pixelsPerMeter/Math.cos(l)),{nearZ:c,farZ:h}=i??dE(e,u,l,a),d=new Float64Array(16);td(d,e.fovInRadians,e.width/e.height,c,h);let p=new Float64Array(16);QT(p,d),d[8]=-a.x*2/e.width,d[9]=a.y*2/e.height;let f=ed(d);Xt(d,d,[1,-1,1]),gt(d,d,[0,0,-e.cameraToCenterDistance]),Jr(d,d,-e.rollInRadians),To(d,d,e.pitchInRadians),Jr(d,d,-e.bearingInRadians),gt(d,d,[-n,-s,0]);let m=Xt([],d,[e.worldSize,e.worldSize,e.worldSize]);Xt(d,d,[1,1,e.pixelsPerMeter]);let g=Rn(new Float64Array(16),e.clipSpaceToPixelsMatrix,d);gt(d,d,[0,0,-e.elevation]);let _=d,y=Vl([],d),v=[0,0,-1,1];$t(v,v,y);let x=[v[0]/v[3],v[1]/v[3],v[2]/v[3]],b=new Float64Array(16);td(b,e.fovInRadians,e.width/e.height,u,h),b[8]=-a.x*2/e.width,b[9]=a.y*2/e.height,Xt(b,b,[1,-1,1]),gt(b,b,[0,0,-e.cameraToCenterDistance]),Jr(b,b,-e.rollInRadians),To(b,b,e.pitchInRadians),Jr(b,b,-e.bearingInRadians),gt(b,b,[-n,-s,0]),Xt(b,b,[1,1,e.pixelsPerMeter]),gt(b,b,[0,0,-e.elevation]);let w=Rn(new Float64Array(16),e.clipSpaceToPixelsMatrix,d),T=e.width%2/2,E=e.height%2/2,S=Math.cos(e.bearingInRadians),A=Math.sin(-e.bearingInRadians),I=n-Math.round(n)+S*T+A*E,R=s-Math.round(s)+S*E+A*T,k=new Float64Array(d);gt(k,k,[I>0.5?I-1:I,R>0.5?R-1:R,0]);let M=Vl(new Float64Array(16),g);if(!M)throw Error("failed to invert matrix");return{...r,nearZ:c,farZ:h,projectionMatrix:f,modelViewProjectionMatrix:_,inverseProjectionMatrix:p,cameraPosition:x,mercatorMatrix:m,inverseModelViewProjectionMatrix:y,alignedModelViewProjectionMatrix:k,pixelMatrix:g,pixelMatrix3D:w,pixelMatrixInverse:M,fogMatrix:b}}function dE(e,t,i,r){let a=Math.cos(e.pitchInRadians)*e.cameraToCenterDistance/e.pixelsPerMeter+e.elevation,o=Math.min(e.elevation,e.minElevationForCurrentTile,a-100),n=t-o*e.pixelsPerMeter/Math.cos(i),s=o<0?n:t,l=Math.PI/2+e.pitchInRadians,u=We(e.fov)*(Math.abs(Math.cos(We(e.roll)))*e.height+Math.abs(Math.sin(We(e.roll)))*e.width)/e.height*(0.5+r.y/e.height),c=Math.sin(u)*s/Math.sin(H(Math.PI-l-u,0.01,Math.PI-0.01)),h=Yu(e),d=Math.atan(h/e.cameraToCenterDistance),p=We(0.75),f=d>p?2*d*(0.5+r.y/(h*2)):p,m=Math.sin(f)*s/Math.sin(H(Math.PI-l-f,0.01,Math.PI-0.01)),g=Math.min(c,m),_=(Math.cos(Math.PI/2-i)*g+s)*1.01;return{nearZ:e.height/50,farZ:_}}function $0(e){return Yu(e)}function Hd(e,t){return t?e.lngLatFromWorld(t.x,t.y):void 0}function pE(e,t,i){let r=i.getCoverageIndex();if(!r)return null;let{near:a,far:o}=lu(e,e.centerPoint,-1),n=e.cameraToCenterDistance*St(e.zoom-e.maxZoom),s=_y([],a,o,Math.max(0,(n-e.nearZ)/(e.farZ-e.nearZ)));return _f(Ro(r,i.exaggeration,s[0]/e.worldSize,s[1]/e.worldSize,t.wraps),s[2])?null:Hd(t,y2(e,t,s,o,i))??null}function y2(e,t,i,r,a){let o=a.getCoverageIndex();if(!o)return null;let n=e.worldSize,s=r[0]-i[0],l=r[1]-i[1],u=r[2]-i[2],c={index:o,exaggeration:a.exaggeration,near:i,dx:s,dy:l,dz:u,worldSize:n,wraps:t.wraps},h=0,d=1;if(u===0){if(i[2]>o.maxElevation||i[2]<o.minElevation)return null}else{let _=(o.maxElevation-i[2])/u,y=(o.minElevation-i[2])/u;if(h=Math.max(h,Math.min(_,y)),d=Math.min(d,Math.max(_,y)),h>d)return null}let p=Math.hypot(s,l),f=H(Math.ceil(p*(d-h)/4),1,512),m=0,g=!ol(c,0);for(let _=0;_<=f;_++){let y=h+(d-h)*_/f;if(!g)g=!ol(c,y);else if(ol(c,y)){let{lo:v,hi:x}=_2(c,ol,m,y,0.001/p),b=Pl(c,v),w=Pl(c,x),T=i[2]+v*u-b.elevation,E=i[2]+x*u-w.elevation,S=b.covered&&T>E?H(v+T*(x-v)/(T-E),v,x):x;return new Ot((i[0]+S*s)/n,(i[1]+S*l)/n,Pl(c,S).elevation)}m=y}return null}function lu(e,t,i=0){let r=[t.x,t.y,i,1],a=[t.x,t.y,1,1];$t(r,r,e.pixelMatrixInverse),$t(a,a,e.pixelMatrixInverse);let o=r[3],n=a[3],s=e.elevation;return{near:[r[0]/o,r[1]/o,r[2]/o+s],far:[a[0]/n,a[1]/n,a[2]/n+s]}}function sr(e,t,i){let r=i||0,{near:a,far:o}=lu(e,t),n=a[2]===o[2]?0:(r+e.elevation-a[2])/(o[2]-a[2]);return new Ot(Ze.number(a[0],o[0],n)/e.worldSize,Ze.number(a[1],o[1],n)/e.worldSize,r)}function U0(e,t,i=0,r=e.pixelMatrix){let a=v2(e,t,i,r),o=a[3];return o>0?new D(a[0]/o,a[1]/o):fE(e,a[0],a[1],o)}function v2(e,t,i,r){let a=[t.x*e.worldSize,t.y*e.worldSize,i,1];return $t(a,a,r)}function fE(e,t,i,r){let a=e.width/2,o=e.height/2,n=t-a*r,s=i-o*r;n===0&&s===0&&(s=1);let l=a+e.width,u=o+e.height,c=Math.min(n===0?1/0:l/Math.abs(n),s===0?1/0:u/Math.abs(s));return new D(a+n*c,o+s*c)}function Eh(e,t,i=!1,r=!1){let a=t.key??mo(t.wrap,t.canonical.z,t.canonical.z,t.canonical.x,t.canonical.y),o=i?Zd(e).alignedPosMatrices:Zd(e).posMatrices;if(o.has(a)){let l=o.get(a);return r?l.f32:l.f64}let n=Wd(t,e.worldSize);Rn(n,i?e.alignedModelViewProjectionMatrix:e.modelViewProjectionMatrix,n);let s={f64:n,f32:new Float32Array(n)};return o.set(a,s),r?s.f32:s.f64}function Pl(e,t){return Ro(e.index,e.exaggeration,(e.near[0]+t*e.dx)/e.worldSize,(e.near[1]+t*e.dy)/e.worldSize,e.wraps)}function ol(e,t){return _f(Pl(e,t),e.near[2]+t*e.dz)}function q0({near:e,far:t},i,r,a){let o=t[0]-e[0],n=t[1]-e[1],s=t[2]-e[2];return((i-e[0])*o+(r-e[1])*n+(a-e[2])*s)/(o*o+n*n+s*s)}function x2(e){let t=Na(e.worldSize,e.center.lat);return 2*Math.PI*t}function gE(e,t,i){let r=H(ft(dt(t),dt(i)),-1,1),a=Math.acos(r),o=x2(e);return a/(2*Math.PI)*o}function _E(e,t){return[Aa(e*Math.PI*2+Math.PI,Math.PI*2),2*Math.atan(Math.exp(Math.PI-t*Math.PI*2))-Math.PI*0.5]}function yE(e,t){let i=Math.cos(t),r=new Float64Array(3);return r[0]=Math.sin(e)*i,r[1]=Math.sin(t),r[2]=Math.cos(e)*i,r}function Hr(e,t,i,r,a){let o=1/(1<<a),n=e/z*o+i*o,s=t/z*o+r*o,l=Aa(n*Math.PI*2+Math.PI,Math.PI*2),u=2*Math.atan(Math.exp(Math.PI-s*Math.PI*2))-Math.PI*0.5,c=Math.cos(u),h=new Float64Array(3);return h[0]=Math.sin(l)*c,h[1]=Math.sin(u),h[2]=Math.cos(l)*c,h}function dt(e){return yE(e.lng*Math.PI/180,e.lat*Math.PI/180)}function Na(e,t){return e/(2*Math.PI)/ka(t)}function b2(e){let t=$t(Lr(),[0,0,0,1],e.modelViewProjectionMatrix);return $t(t,t,e.inverseProjectionMatrix),[t[0]/t[3],t[1]/t[3],t[2]/t[3]]}function Kn(e){let t=Math.asin(e[1])/Math.PI*180,i=Math.sqrt(e[0]*e[0]+e[2]*e[2]);if(i>0.000001){let r=e[0]/i,a=e[2]/i,o=Math.acos(a);return new Y(Fi((r>0?o:-o)/Math.PI*180,-180,180),t)}return new Y(0,t)}function vE(e,t){return zp(Lr(),-e.lng,-e.lat,t)}function xE(e){let t=e[0],i=e[1],r=e[2],a=e[3];return{lng:-Math.atan2(2*(a*t+i*r),1-2*(t*t+i*i))*180/Math.PI,lat:-Math.asin(H(2*(a*i-r*t),-1,1))*180/Math.PI,bearing:Math.atan2(2*(a*r+t*i),1-2*(i*i+r*r))*180/Math.PI}}function bE(e){let t=De();return t[0]=e[0]*-e[3],t[1]=e[1]*-e[3],t[2]=e[2]*-e[3],{center:t,radius:Math.sqrt(1-e[3]*e[3])}}function wE(e,t,i){let r=De();Br(r,i,e);let a=De();return $l(a,e,r,t/Ul(r)),a}function ka(e){return Math.cos(Math.min(Math.abs(e),ci)*Math.PI/180)}function Tt(e,t){let i=ka(e);return wt(ka(t)/i)}function TE(e,t){return 360/x2({worldSize:e,center:{lat:t}})}function EE(e,t){let i=e.rotate(t.bearingInRadians),r=t.zoom+Tt(t.center.lat,0),a=ea(1/ka(t.center.lat),1/ka(Math.min(Math.abs(t.center.lat),60)),bn(r,7,3,0,1)),o=TE(t.worldSize,t.center.lat);return new Y(t.center.lng-i.x*o*a,H(t.center.lat+i.y*o,-90,90))}function Sh(e){let t=0.5*e,i=Math.sin(t),r=Math.cos(t);return Math.log(i+r)-Math.log(r-i)}function G0(e,t,i,r){let a=H(e.lat+i*r,-90,90),o=H(e.lat,-85.051129,ci),n=H(e.lat+i,-85.051129,ci);if(Math.abs(n-o)>1){let s=(Math.sign(n)===Math.sign(o)?Math.abs(o):-Math.abs(o))*Math.PI/180,l=Math.abs(n)*Math.PI/180,u=Sh(s+r*(l-s)),c=Sh(s),h=Sh(l),d=(u-c)/(h-c);return new Y(e.lng+t*d,a)}return new Y(e.lng+t*r,a)}function uu(e,t,i=1){let r=ft(e,t),a=i*i,o=De(),n=De();Ue(n,t,r),Br(o,e,n);let s=a-ft(o,o);if(s<0)return null;let l=ft(e,e)-a,u=-r+(r<0?1:-1)*Math.sqrt(s),c=l/u,h=u,d=Math.max(c,h);return d<0?null:{tMin:Math.min(c,h),tMax:d}}function w2(e,t){let i=t*0.01569612305760477,r=H((e-i)/(9*i),0,1);return r*r*(3-2*r)}function W0(e,t=e.nearFarZOverride){let i={...e,projection:"vertical-perspective"};if(!e.width||!e.height)return{...i,nearZ:void 0,farZ:void 0,projectionMatrix:Ws(),modelViewProjectionMatrix:Ws(),modelViewProjectionMatrix32f:yy(),inverseModelViewProjectionMatrix:Ws(),inverseProjectionMatrix:Ws(),cameraPosition:De(),clippingPlane:Lr(),frustum:void 0};let r=Na(e.worldSize,e.center.lat),a=Ea(),{nearZ:o,farZ:n}=t??{nearZ:0.5,farZ:e.cameraToCenterDistance+r*2};td(a,e.fovInRadians,e.width/e.height,o,n);let s=f2(e);a[8]=-s.x*2/e.width,a[9]=s.y*2/e.height;let l=ed(a),u=Ea();Vl(u,a),gt(a,a,[0,0,-e.cameraToCenterDistance]),Jr(a,a,e.rollInRadians),To(a,a,-e.pitchInRadians),Jr(a,a,e.bearingInRadians),gt(a,a,[0,0,-r]);let c=De();c[0]=r,c[1]=r,c[2]=r,To(a,a,e.center.lat*Math.PI/180),my(a,a,-e.center.lng*Math.PI/180),Xt(a,a,c);let h=a,d=new Float32Array(a),p=Ea();Vl(p,a);let f=De(),m=De();m[2]=e.cameraToCenterDistance/r,rd(m,m,f,-e.rollInRadians),zn(m,m,f,e.pitchInRadians),rd(m,m,f,-e.bearingInRadians),Bi(m,m,[0,0,1]),zn(m,m,f,-e.center.lat*Math.PI/180),lo(m,m,f,e.center.lng*Math.PI/180);let g=SE(e,r),_=ed(p);Xt(_,_,[1,1,-1]);let y=g2(_,1,0,g,!0);return{...i,nearZ:o,farZ:n,projectionMatrix:l,modelViewProjectionMatrix:h,modelViewProjectionMatrix32f:d,inverseModelViewProjectionMatrix:p,inverseProjectionMatrix:u,cameraPosition:m,clippingPlane:g,frustum:y}}function SE(e,t){let i=e.pitchInRadians,r=e.cameraToCenterDistance/t,a=Math.sin(i)*r,o=Math.cos(i)*r+1,n=1/Math.sqrt(a*a+o*o)*1,s=-a,l=o,u=Math.sqrt(s*s+l*l);s/=u,l/=u;let c=[0,s,l];rd(c,c,[0,0,0],-e.bearingInRadians),zn(c,c,[0,0,0],-1*e.center.lat*Math.PI/180),lo(c,c,[0,0,0],e.center.lng*Math.PI/180);let h=1/Ki(c);return Ue(c,c,h),[...c,-n*h]}function CE(e,t,i,r){let a=e.cameraPosition,o=t-a[0],n=i-a[1],s=r-a[2],l=o*o+n*n+s*s;if(l===0)return!1;let u=H(-(a[0]*o+a[1]*n+a[2]*s)/l,0,1),c=a[0]+u*o,h=a[1]+u*n,d=a[2]+u*s;return c*c+h*h+d*d<1}function Ch(e,t){let i=Lr();return $t(i,[...t,1],e.modelViewProjectionMatrix),i[0]/=i[3],i[1]/=i[3],new D((i[0]*0.5+0.5)*e.width,(-i[1]*0.5+0.5)*e.height)}function Z0(e,t){return!!uu(e.cameraPosition,Mn(e,t))}function Mn(e,t){let i=Lr();i[0]=t.x/e.width*2-1,i[1]=(t.y/e.height*2-1)*-1,i[2]=1,i[3]=1,$t(i,i,e.inverseModelViewProjectionMatrix),i[0]/=i[3],i[1]/=i[3],i[2]/=i[3];let r=De();r[0]=i[0]-e.cameraPosition[0],r[1]=i[1]-e.cameraPosition[1],r[2]=i[2]-e.cameraPosition[2];let a=De();return Rt(a,r),a}function T2(e,t){let i=e.clippingPlane;return i[0]*t[0]+i[1]*t[1]+i[2]*t[2]+i[3]>=0}function H0(e,t){if(!T2(e,t))return!1;let i=Lr();return $t(i,[...t,1],e.modelViewProjectionMatrix),i[0]/=i[3],i[1]/=i[3],i[2]/=i[3],i[0]>-1&&i[0]<1&&i[1]>-1&&i[1]<1&&i[2]>-1&&i[2]<1}function Il(e,t){let i=e.cameraPosition,r=Mn(e,t),a=uu(i,r);if(a){let c=De();Bi(c,i,[r[0]*a.tMin,r[1]*a.tMin,r[2]*a.tMin]);let h=De();return Rt(h,c),Kn(h)}let o=e.clippingPlane,n=o[0]*r[0]+o[1]*r[1]+o[2]*r[2],s=-od(o,i)/n,l=De();if(s>0)Bi(l,i,[r[0]*s,r[1]*s,r[2]*s]);else{let c=De();Bi(c,i,[r[0]*2,r[1]*2,r[2]*2]);let h=od(o,c);Br(l,c,[o[0]*h,o[1]*h,o[2]*h])}let u=bE(o);return Kn(wE(u.center,u.radius,l))}function E2(e,t){let i=De();$l(i,e.origin,e.direction,t);let r=Ki(i),a=De();Ue(a,i,1/r);let o=Kn(a),n=Ot.fromLngLat(o),s=new Ot(n.x,H(n.y,0,0.999999999)),l=Ro(e.index,e.exaggeration,s.x,s.y,!1),u=Math.abs(o.lat)>85.051129?0:l.elevation;return{sample:{...l,elevation:u},radius:r,mercator:s}}function X0(e,t){let{sample:i,radius:r}=E2(e,t);return _f(i,(r-1)*Yt)}function Y0(e,t){let i=dt(e);return Ue(i,i,1+t/Yt)}function K0(e,t,i){return ft(Fp(De(),i,e),t)}function V(e){switch(e.projection){case"mercator":return S2;case"vertical-perspective":return C2;case"globe":return ME}}function yo(e,t,i){let r=t.paint.get(e).value;return r.kind==="constant"?r.value:i.programConfigurations.get(t.id).getMaxValue(e)}function Ku(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function Ju(e,t,i,r,a){if(!t[0]&&!t[1])return e;let o=D.convert(t)._mult(a);i==="viewport"&&o._rotate(-r);let n=[];for(let s of e)n.push(s.sub(o));return n}function PE(e){let t=[];for(let i=0;i<e.length;i++){let r=e[i],a=t.at(-1);(i===0||a&&!r.equals(a))&&t.push(r)}return t}function IE(e,t){let i=[];for(let r of e){let a=PE(r),o=[];for(let n=0;n<a.length;n++){let s=a[n],l=a[n-1],u=a[n+1],c=n===0?new D(0,0):s.sub(l)._unit()._perp(),h=n===a.length-1?new D(0,0):u.sub(s)._unit()._perp(),d=c._add(h)._unit(),p=d.x*h.x+d.y*h.y;p!==0&&d._mult(1/p),o.push(d._mult(t)._add(s))}i.push(o)}return i}function kE({queryGeometry:e,size:t},i){return Hu(e,i,t)}function FE({queryGeometry:e,size:t,projectedCamera:i,unwrappedTileID:r,getElevation:a},o){return Hu(e,o,t*(V(i).projectTileCoordinates(i,o.x,o.y,r,a?.(o.x,o.y)).signedDistanceFromCamera/i.cameraToCenterDistance))}function RE({queryGeometry:e,size:t,projectedCamera:i,unwrappedTileID:r,getElevation:a},o){let n=V(i).projectTileCoordinates(i,o.x,o.y,r,a?.(o.x,o.y)).signedDistanceFromCamera,s=t*(i.cameraToCenterDistance/n);return Hu(e,yf(o,i,r,a),s)}function zE({queryGeometry:e,size:t,projectedCamera:i,unwrappedTileID:r,getElevation:a},o){return Hu(e,yf(o,i,r,a),t)}function D2({queryGeometry:e,size:t,projectedCamera:i,unwrappedTileID:r,getElevation:a,pitchAlignment:o="map",pitchScale:n="map"},s){let l=o==="map"?n==="map"?kE:FE:n==="map"?RE:zE,u={queryGeometry:e,size:t,projectedCamera:i,unwrappedTileID:r,getElevation:a};for(let c of s)for(let h of c)if(l(u,h))return!0;return!1}function yf(e,t,i,r){let a=V(t).projectTileCoordinates(t,e.x,e.y,i,r?.(e.x,e.y)).point;return new D((a.x*0.5+0.5)*t.width,(-a.y*0.5+0.5)*t.height)}function LE(e,t,i,r){return e.map((a)=>yf(a,t,i,r))}function vf(e,{width:t,height:i},r,a){if(!a)a=new Uint8Array(t*i*r);else if(a instanceof Uint8ClampedArray)a=new Uint8Array(a.buffer);else if(a.length!==t*i*r)throw RangeError(`mismatched image size. expected: ${a.length} but got: ${t*i*r}`);return e.width=t,e.height=i,e.data=a,e}function M2(e,{width:t,height:i},r){if(t===e.width&&i===e.height)return;let a=vf({},{width:t,height:i},r);xf(e,a,{x:0,y:0},{x:0,y:0},{width:Math.min(e.width,t),height:Math.min(e.height,i)},r),e.width=t,e.height=i,e.data=a.data}function xf(e,t,i,r,a,o){if(a.width===0||a.height===0)return t;if(a.width>e.width||a.height>e.height||i.x>e.width-a.width||i.y>e.height-a.height)throw RangeError("out of range source coordinates for image copy");if(a.width>t.width||a.height>t.height||r.x>t.width-a.width||r.y>t.height-a.height)throw RangeError("out of range destination coordinates for image copy");let n=e.data,s=t.data;if(n===s)throw Error("srcData equals dstData, so image is already copied");for(let l=0;l<a.height;l++){let u=((i.y+l)*e.width+i.x)*o,c=((r.y+l)*t.width+r.x)*o;for(let h=0;h<a.width*o;h++)s[c+h]=n[u+h]}return t}function Dh(e){let t=new Uint8Array(e.length);for(let i=0;i<e.length;i+=4){let r=e[i+3];t[i+0]=Math.round(e[i+0]*r/255),t[i+1]=Math.round(e[i+1]*r/255),t[i+2]=Math.round(e[i+2]*r/255),t[i+3]=r}return t}function P2(e){let t={},i=e.resolution||256,r=e.clips?e.clips.length:1,a=e.image||new $e({width:i,height:r});if(!K5(i))throw Error(`width is not a power of 2 - ${i}`);let o=(n,s,l)=>{t[e.evaluationKey]=l;let u=e.expression.evaluate(t);a.setPixel(n/4/i,s/4,u)};if(e.clips)for(let n=0,s=0;n<r;++n,s+=i*4)for(let l=0,u=0;l<i;l++,u+=4){let c=l/(i-1),{start:h,end:d}=e.clips[n],p=h*(1-c)+d*c;o(s,u,p)}else for(let n=0,s=0;n<i;n++,s+=4){let l=n/(i-1);o(0,s,l)}return a}function nl(e){return"data"in e}function I2(e,t){let i=t[0],r=t[1],a=t[2],o=t[3],n=[i,r,a].filter((c)=>c!==0);if(n.length===0)return{r:0,g:0,b:0};let s=Math.min(...n),l=Math.round((e+o)/s),u=(c)=>c===0?0:Math.floor(l*s/c)%256;return{r:u(i),g:u(r),b:u(a)}}function hu(e,t,i){let r=i.patternDependencies,a=!1;for(let o of t){let n=o.paint.get(`${e}-pattern`);n.isConstant()||(a=!0);let s=n.constantOr(null);s&&(a=!0,r[s.to]=!0,r[s.from]=!0)}return a}function wf(e,t,i,r,a){let{zoom:o}=r,n=a.patternDependencies;for(let s of t){let l=s.paint.get(`${e}-pattern`).value;if(l.kind!=="constant"){let u=l.evaluate({zoom:o-1},i,{},a.availableImages),c=l.evaluate({zoom:o},i,{},a.availableImages),h=l.evaluate({zoom:o+1},i,{},a.availableImages);u=u?.name?u.name:u,c=c?.name?c.name:c,h=h?.name?h.name:h,n[u]=!0,n[c]=!0,n[h]=!0,i.patterns[s.id]={min:u,mid:c,max:h}}}return i}function sS(e,t,i=2){let r=t&&t.length,a=r?t[0]*i:e.length;Jn.size&&Jn.clear();let o=k2(e,0,a,i,!0),n=[];if(!o||o.next===o.prev)return n;let s=0,l=0,u=0;if(r&&(o=dS(e,t,o,i)),e.length>80*i){s=e[0],l=e[1];let c=s,h=l;for(let d=i;d<a;d+=i){let p=e[d],f=e[d+1];p<s&&(s=p),f<l&&(l=f),p>c&&(c=p),f>h&&(h=f)}u=Math.max(c-s,h-l),u=u===0?0:32767/u}return Kd(o,n,s,l,u),n}function k2(e,t,i,r,a){let o=null;if(a===SS(e,t,i,r)>0)for(let n=t;n<i;n+=r)o=e1(n/r|0,e[n],e[n+1],o);else for(let n=i-r;n>=t;n-=r)o=e1(n/r|0,e[n],e[n+1],o);return o&&Qn(o,o.next)&&(ts(o),o=o.next),o}function Fa(e,t=e){let i=t===e,r=e,a;do a=!1,r!==r.next&&(Jn.size===0||!Jn.has(r))&&(Qn(r,r.next)||_t(r.prev,r,r.next)===0)?((i||r===t)&&(t=r.prev),Yd=!0,ts(r),r=r.prev,a=!0):(i||r!==t)&&(r=r.next,a=!i);while(a||r!==t);return t}function Kd(e,t,i,r,a){a&&vS(e,i,r,a);let o=e,n=!1;for(;e.prev!==e.next;){let s=e.prev,l=e.next;if(_t(s,e,l)<0&&(a?uS(e,i,r,a):lS(e)))t.push(s.i,e.i,l.i),ts(e),e=l,o=l;else if(e=l,e===o){if(Yd=!1,e=Fa(e),Yd){o=e;continue}if(!n){e=cS(e,t),o=e,n=!0;continue}hS(e,t,i,r,a);break}}}function lS(e){let t=e.prev,i=e,r=e.next,a=t.x,o=i.x,n=r.x,s=t.y,l=i.y,u=r.y,c=Math.min(a,o,n),h=Math.min(s,l,u),d=Math.max(a,o,n),p=Math.max(s,l,u),f=r.next;for(;f!==t;){if(f.x>=c&&f.x<=d&&f.y>=h&&f.y<=p&&(a!==f.x||s!==f.y)&&pu(a,s,o,l,n,u,f.x,f.y)&&_t(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function uS(e,t,i,r){let a=e.prev,o=e,n=e.next,s=a.x,l=o.x,u=n.x,c=a.y,h=o.y,d=n.y,p=Math.min(s,l,u),f=Math.min(c,h,d),m=Math.max(s,l,u),g=Math.max(c,h,d),_=tp(p,f,t,i,r),y=tp(m,g,t,i,r),v=e.prevZ;for(;v&&v.z>=_;){if(v.x>=p&&v.x<=m&&v.y>=f&&v.y<=g&&v!==n&&(s!==v.x||c!==v.y)&&pu(s,c,l,h,u,d,v.x,v.y)&&_t(v.prev,v,v.next)>=0)return!1;v=v.prevZ}let x=e.nextZ;for(;x&&x.z<=y;){if(x.x>=p&&x.x<=m&&x.y>=f&&x.y<=g&&x!==n&&(s!==x.x||c!==x.y)&&pu(s,c,l,h,u,d,x.x,x.y)&&_t(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function cS(e,t){let i=e,r=!1;do{let a=i.prev,o=i.next.next;R2(a,i,i.next,o,!1)&&es(a,o)&&es(o,a)&&(t.push(a.i,i.i,o.i),ts(i),ts(i.next),i=e=o,r=!0),i=i.next}while(i!==e);return r?Fa(i):i}function hS(e,t,i,r,a){let o=e;do{let n=o.next.next;for(;n!==o.prev;){if(o.i!==n.i&&wS(o,n)){let s=z2(o,n);o=Fa(o,o.next),s=Fa(s,s.next),Kd(o,t,i,r,a),Kd(s,t,i,r,a);return}n=n.next}o=o.next}while(o!==e)}function dS(e,t,i,r){let a=[];for(let o=0,n=t.length;o<n;o++){let s=k2(e,t[o]*r,o<n-1?t[o+1]*r:e.length,r,!1);s===s.next&&Jn.add(s),a.push(bS(s))}a.sort(pS),mS(e.length/r,t.length),F2(i,i),Jd=!0;for(let o=0;o<a.length;o++)i=fS(a[o],i);return Jd=!1,Fa(i)}function pS(e,t){return e.x-t.x||e.y-t.y||(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x)}function fS(e,t){let i=_S(e,t);if(!i)return t;let r=z2(i,e),a=r.next;return F2(i,a.next),Fa(r,r.next),Fa(i,i.next)}function mS(e,t){let i=Math.ceil((e+2*t)/16)+t+2;st.length<i*4&&(st=new Float64Array(i*4)),du=0}function F2(e,t){let i=e;do{let r=du++;Qd[r]=i;let a=i.x,o=i.y,n=i.x,s=i.y,l=0;do{let c=i.next;i.z=r,c.x<a&&(a=c.x),c.x>n&&(n=c.x),c.y<o&&(o=c.y),c.y>s&&(s=c.y),i=c}while(++l<16&&i!==t);ep[r]=i;let u=r*4;st[u]=a,st[u+1]=o,st[u+2]=n,st[u+3]=s}while(i!==t)}function gS(e,t){let i=e.z*4;t.x<st[i]&&(st[i]=t.x),t.y<st[i+1]&&(st[i+1]=t.y),t.x>st[i+2]&&(st[i+2]=t.x),t.y>st[i+3]&&(st[i+3]=t.y)}function J0(e){let t=ep[e];for(;t.prev.next!==t;)t=t.next;return ep[e]=t,t}function Q0(e){let t=Qd[e];for(;t.prev.next!==t;)t=t.next;return Qd[e]=t,t}function _S(e,t){let i=t,{x:r,y:a}=e,o=-1/0,n;if(Qn(e,i))return i;for(let d=0,p=0;d<du;d++,p+=4){if(a<st[p+1]||a>st[p+3]||st[p]>r||st[p+2]<=o)continue;let f=J0(d);i=Q0(d);do{if(i.prev.next===i){if(Qn(e,i.next))return i.next;if(a<=i.y&&a>=i.next.y&&i.next.y!==i.y){let m=i.x+(a-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(m<=r&&m>o&&(o=m,n=i.x<i.next.x?i:i.next,m===r))return n}}i=i.next}while(i!==f)}if(!n)return null;let s=n.x,l=n.y,u=Math.min(a,l),c=Math.max(a,l),h=1/0;for(let d=0,p=0;d<du;d++,p+=4){if(st[p+2]<s||st[p]>r||st[p+3]<u||st[p+1]>c)continue;let f=J0(d);i=Q0(d);do{if(i.prev.next===i&&r>=i.x&&i.x>=s&&r!==i.x&&pu(a<l?r:o,a,s,l,a<l?o:r,a,i.x,i.y)){let m=Math.abs(a-i.y)/(r-i.x);(es(i,e)||i.y===a&&i.next.y===a&&i.next.x>r)&&(m<h||m===h&&(i.x>n.x||i.x===n.x&&yS(n,i)))&&(n=i,h=m)}i=i.next}while(i!==f)}return n}function yS(e,t){return _t(e.prev,e,t.prev)<0&&_t(t.next,e,e.next)<0}function vS(e,t,i,r){let a=e,o=0;do a.z=tp(a.x,a.y,t,i,r),yi[o++]=a,a=a.next;while(a!==e);xS(o);let n=null;for(let s=0;s<o;s++){let l=yi[s];l.prevZ=n,n&&(n.nextZ=l),n=l}n.nextZ=null,yi.fill(null,0,o),no.fill(null,0,o)}function xS(e){if(e<=32)for(let t=1;t<e;t++){let i=yi[t],r=i.z,a=t-1;for(;a>=0&&yi[a].z>r;)yi[a+1]=yi[a],a--;yi[a+1]=i}else{ma.length<e&&(ma=new Uint32Array(e),cn=new Uint32Array(e),no=Array(e));for(let t=0;t<e;t++)ma[t]=yi[t].z;sl(e,yi,ma,no,cn,0),sl(e,no,cn,yi,ma,8),sl(e,yi,ma,no,cn,16),sl(e,no,cn,yi,ma,24)}}function sl(e,t,i,r,a,o){hn.fill(0);for(let s=0;s<e;s++)hn[i[s]>>>o&255]++;let n=0;for(let s=0;s<256;s++){let l=hn[s];hn[s]=n,n+=l}for(let s=0;s<e;s++){let l=i[s],u=hn[l>>>o&255]++;r[u]=t[s],a[u]=l}}function tp(e,t,i,r,a){return e=(e-i)*a|0,t=(t-r)*a|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function bS(e){let t=e,i=e;do(t.x<i.x||t.x===i.x&&t.y<i.y)&&(i=t),t=t.next;while(t!==e);return i}function pu(e,t,i,r,a,o,n,s){return(a-n)*(t-s)>=(e-n)*(o-s)&&(e-n)*(r-s)>=(i-n)*(t-s)&&(i-n)*(o-s)>=(a-n)*(r-s)}function wS(e,t){let i=Qn(e,t)&&_t(e.prev,e,e.next)>0&&_t(t.prev,t,t.next)>0;return e.next.i!==t.i&&(i||es(e,t)&&es(t,e)&&(_t(e.prev,e,t.prev)!==0||_t(e,t.prev,t)!==0))&&!TS(e,t)&&(i||ES(e,t))}function _t(e,t,i){return(t.y-e.y)*(i.x-t.x)-(t.x-e.x)*(i.y-t.y)}function Qn(e,t){return e.x===t.x&&e.y===t.y}function R2(e,t,i,r,a=!0){let o=_t(e,t,i),n=_t(e,t,r),s=_t(i,r,e),l=_t(i,r,t);return(o>0&&n<0||o<0&&n>0)&&(s>0&&l<0||s<0&&l>0)?!0:a?!!(o===0&&ll(e,i,t)||n===0&&ll(e,r,t)||s===0&&ll(i,e,r)||l===0&&ll(i,t,r)):!1}function ll(e,t,i){return t.x<=Math.max(e.x,i.x)&&t.x>=Math.min(e.x,i.x)&&t.y<=Math.max(e.y,i.y)&&t.y>=Math.min(e.y,i.y)}function TS(e,t){let i=Math.min(e.x,t.x),r=Math.max(e.x,t.x),a=Math.min(e.y,t.y),o=Math.max(e.y,t.y),n=e;do{let s=n.next;if(n.x>r&&s.x>r||n.x<i&&s.x<i||n.y>o&&s.y>o||n.y<a&&s.y<a)n=s;else{if(n.i!==e.i&&s.i!==e.i&&n.i!==t.i&&s.i!==t.i&&R2(n,s,e,t))return!0;n=s}}while(n!==e);return!1}function es(e,t){return _t(e.prev,e,e.next)<0?_t(e,t,e.next)>=0&&_t(e,e.prev,t)>=0:_t(e,t,e.prev)<0||_t(e,e.next,t)<0}function ES(e,t){let i=e,r=!1,a=(e.x+t.x)/2,o=(e.y+t.y)/2;do{let n=i.next;i.y>o!=n.y>o&&a<(n.x-i.x)*(o-i.y)/(n.y-i.y)+i.x&&(r=!r),i=n}while(i!==e);return r}function z2(e,t){let i=ip(e.i,e.x,e.y),r=ip(t.i,t.x,t.y),a=e.next,o=t.prev;return e.next=t,t.prev=e,i.next=a,a.prev=i,r.next=i,i.prev=r,o.next=r,r.prev=o,r}function e1(e,t,i,r){let a=ip(e,t,i);return r?(a.next=r.next,a.prev=r,r.next.prev=a,r.next=a):(a.prev=a,a.next=a),a}function ts(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ),Jd&&gS(e.prev,e.next)}function ip(e,t,i){return{i:e,x:t,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null}}function SS(e,t,i,r){let a=0;for(let o=t,n=i-r;o<i;o+=r)a+=(e[n]-e[o])*(e[o+1]+e[n+1]),n=o;return a}function L2(e,t,i,r=!0){return new CS(i,t).subdividePolygonInternal(e,r)}function wa(e,t,i=!1){if(!e||e.length<1||e.length<2)return[];let r=i&&B2(e);if(t<2)return r?[...e,e[0]]:[...e];let a=Math.floor(z/t),o=[];o.push(new D(e[0].x,e[0].y));let n=e.length,s=r?n:n-1;for(let l=0;l<s;l++){let u=e[l],c=l<n-1?e[l+1]:e[0],{x:h,y:d}=u,{x:p,y:f}=c,m=h!==p,g=d!==f;if(!m&&!g)continue;let _=p-h,y=f-d,v=Math.abs(_),x=Math.abs(y),b=h,w=d;for(;;){let E=_>0?(Math.floor(b/a)+1)*a:(Math.ceil(b/a)-1)*a,S=y>0?(Math.floor(w/a)+1)*a:(Math.ceil(w/a)-1)*a,A=Math.abs(b-E),I=Math.abs(w-S),R=Math.abs(b-p),k=Math.abs(w-f),M=m?A/v:1/0,C=g?I/x:1/0;if((R<=A||!m)&&(k<=I||!g))break;if(M<C&&m||!g){b=E,w+=y*M;let P=new D(b,Math.round(w));(o[o.length-1].x!==P.x||o[o.length-1].y!==P.y)&&o.push(P)}else{b+=_*C,w=S;let P=new D(Math.round(b),w);(o[o.length-1].x!==P.x||o[o.length-1].y!==P.y)&&o.push(P)}}let T=new D(p,f);(o[o.length-1].x!==T.x||o[o.length-1].y!==T.y)&&o.push(T)}return o}function B2(e){return!e[0].equals(e[e.length-1])}function DS(e){let t=[],i=[];for(let r of e)if(r.length!==0){r!==e[0]&&t.push(i.length/2);for(let a of r)i.push(a.x),i.push(a.y)}return{flattened:i,holeIndices:t}}function AS(e,t){let i=Array(e.length);for(let r=0;r<e.length;r++)i[r]=t[e[r]];return i}function MS(e,t){let i=[];for(let r=0;r<t.length;r+=3){let a=t[r],o=t[r+1],n=t[r+2],s=e[a*2],l=e[a*2+1],u=e[o*2],c=e[o*2+1],h=e[n*2],d=e[n*2+1],p=u-s,f=c-l,m=h-s;p*(d-l)-f*m>0?(i.push(a),i.push(n),i.push(o)):(i.push(a),i.push(o),i.push(n))}return i}function PS(e,t,i){if(t.length===0)throw Error("Subdivision vertex ring is empty.");let r=0,a=e[t[0]*2];for(let l=1;l<t.length;l++){let u=e[t[l]*2];u<a&&(a=u,r=l)}let o=t.length,n=r,s=(n+1)%o;for(;;){let l=n-1>=0?n-1:o-1,u=(s+1)%o,c=e[t[l]*2],h=e[t[l]*2+1],d=e[t[u]*2],p=e[t[u]*2+1],f=e[t[n]*2],m=e[t[n]*2+1],g=e[t[s]*2],_=e[t[s]*2+1],y=!1;if(c<d)y=!0;else if(c>d)y=!1;else{let v=_-m,x=-(g-f),b=m<_?1:-1;((c-f)*v+(h-m)*x)*b>((d-f)*v+(p-m)*x)*b&&(y=!0)}if(y){let v=t[l],x=t[n],b=t[s];v!==x&&v!==b&&x!==b&&i.push(b,x,v),n--,n<0&&(n=o-1)}else{let v=t[u],x=t[n],b=t[s];v!==x&&v!==b&&x!==b&&i.push(b,x,v),s++,s>=o&&(s=0)}if(l===u)break}}function O2(e,t,i,r,a,o,n,s,l){let u=a.length/2,c=n&&s&&l;if(u<tt.MAX_VERTEX_ARRAY_LENGTH){let h=t.prepareSegment(u,i,r),d=h.vertexLength;for(let m=0;m<o.length;m+=3)r.emplaceBack(d+o[m],d+o[m+1],d+o[m+2]);h.vertexLength+=u,h.primitiveLength+=o.length/3;let p,f;c&&(f=n.prepareSegment(u,i,s),p=f.vertexLength,f.vertexLength+=u);for(let m=0;m<a.length;m+=2)e(a[m],a[m+1]);if(c)for(let m of l){for(let g=1;g<m.length;g+=2)s.emplaceBack(p+m[g-1],p+m[g]);f.primitiveLength+=m.length/2}}else IS(t,i,r,a,o,e),c&&kS(n,i,s,a,l,e),t.forceNewSegmentOnNextPrepare(),n?.forceNewSegmentOnNextPrepare()}function kn(e,t,i,r,a,o,n){if(o){let s=r.count;return i(t[a*2],t[a*2+1]),e[a]=r.count,r.count++,n.vertexLength++,s}return e[a]}function IS(e,t,i,r,a,o){let n=[];for(let h=0;h<r.length/2;h++)n.push(-1);let s={count:0},l=0,u=e.getOrCreateLatestSegment(t,i),c=u.vertexLength;for(let h=2;h<a.length;h+=3){let d=a[h-2],p=a[h-1],f=a[h],m=n[d]<l,g=n[p]<l,_=n[f]<l,y=+!!m+ +!!g+ +!!_;u.vertexLength+y>tt.MAX_VERTEX_ARRAY_LENGTH&&(u=e.createNewSegment(t,i),l=s.count,m=!0,g=!0,_=!0,c=0);let v=kn(n,r,o,s,d,m,u),x=kn(n,r,o,s,p,g,u),b=kn(n,r,o,s,f,_,u);i.emplaceBack(c+v-l,c+x-l,c+b-l),u.primitiveLength++}}function kS(e,t,i,r,a,o){let n=[];for(let h=0;h<r.length/2;h++)n.push(-1);let s={count:0},l=0,u=e.getOrCreateLatestSegment(t,i),c=u.vertexLength;for(let h of a)for(let d=1;d<h.length;d+=2){let p=h[d-1],f=h[d],m=n[p]<l,g=n[f]<l,_=+!!m+ +!!g;u.vertexLength+_>tt.MAX_VERTEX_ARRAY_LENGTH&&(u=e.createNewSegment(t,i),l=s.count,m=!0,g=!0,c=0);let y=kn(n,r,o,s,p,m,u),v=kn(n,r,o,s,f,g,u);i.emplaceBack(c+y-l,c+v-l),u.primitiveLength++}}function V2(e){let t=e.length;if(t<=1)return[e];let i=[],r,a;for(let o=0;o<t;o++){let n=VS(e[o]);n!==0&&(a===void 0&&(a=n<0),a===n<0?(r&&i.push(r),r=[e[o]]):r&&r.push(e[o]))}return r&&i.push(r),i}function VS(e){let t=0;for(let i=0,r=e.length,a=r-1,o,n;i<r;a=i++)o=e[i],n=e[a],t+=(n.x-o.x)*(o.y+n.y);return t}function US(e){let t=null,i=e.readVarint()+e.pos;for(;e.pos<i;){let r=e.readVarint();t=r===10?e.readString():r===21?e.readFloat():r===25?e.readDouble():r===32?e.readVarint(!0):r===40?e.readVarint():r===48?e.readSVarint():r===56?e.readBoolean():(e.skip(r),null)}if(t==null)throw Error("unknown feature value");return t}function GS(e,t){return t<=0||!e||e.length===0?e:e.map((i)=>XS(i,t))}function WS(e,t){let i=HT(z/2,z/2,t),r=Ot.fromLngLat(i).meterInMercatorCoordinateUnits(),a=(1<<t.z)*z;return e*r*a}function HS(e){let t=[null];for(let o=1;o<e.length;o++){let n=e[o].sub(e[o-1]),s=!au(e[o],e[o-1])&&n.mag()>0;t.push(s?n._perp():null)}let i=e.length-1,r=i>1&&e[0].equals(e[i]),a=[null];for(let o=1;o<=i;o++){let n=t[o];if(!n){a.push(null);continue}let s=r&&o===1?t[i]:t[o-1],l=r&&o===i?t[1]:t[o+1];a.push({start:t1(n,s),end:t1(n,l)})}return a}function t1(e,t){if(!t)return e.unit();let i=e.mag(),r=t.mag();return e.x*t.x+e.y*t.y<ZS*i*r||i>=2*r?e.unit():r>=2*i?t.unit():e.add(t)._unit()}function XS(e,t){if(!e||e.length<3)return e;let i=e[0].x===e[e.length-1].x&&e[0].y===e[e.length-1].y,r=i?e.length-1:e.length;if(r<3)return e;let a=[],o=au(e[r-1],e[0]);for(let s=0;s<r;s++){let l=e[(s-1+r)%r],u=e[s],c=e[(s+1)%r],h=au(u,c);o||h?a.push(u.clone()):KS(a,l,u,c,t),o=h}let n=YS(a);return n.length<3?e:(i&&n.push(n[0].clone()),n)}function YS(e){let t=[];for(let i of e){let r=i.round(),a=t[t.length-1];(a?.x!==r.x||a?.y!==r.y)&&t.push(r)}for(;t.length>1&&t[0].x===t[t.length-1].x&&t[0].y===t[t.length-1].y;)t.pop();return t}function KS(e,t,i,r,a){let o=t.sub(i),n=r.sub(i),s=o.mag(),l=n.mag();if(s<0.000001||l<0.000001){e.push(i.clone());return}o._div(s),n._div(l);let u=o.x*n.x+o.y*n.y;if(Math.abs(u)>Math.cos(5*Math.PI/180)){e.push(i.clone());return}let c=0.2,h=Math.min(a,s*c,l*c),d=i.add(o.mult(h)),p=i.add(n.mult(h)),f=Math.sqrt((1+u)/2),m=i.add(o.add(n)._unit()._mult(h/f)),g=d.sub(m).angleWith(p.sub(m)),_=Math.max(2,Math.ceil(Math.abs(g)/(Math.PI/6)-0.000001));for(let y=0;y<=_;y++)e.push(d.rotateAround(y/_*g,m))}function dn(e,t,i,r,a,o,n,s){e.emplaceBack(t,i,Math.floor(r*Ah)*2+n,a*Ah*2,o*Ah*2,Math.round(s))}function JS(e,t){for(let i=0;i<t.length;i++){let r=t[i];(i!==t.length-1||t[0].x!==r.x||t[0].y!==r.y)&&(e.x+=r.x,e.y+=r.y,e.sampleCount++)}}function Mh(e,t,i,r){let{point:a,signedDistanceFromCamera:o}=V(i).projectTileCoordinates(i,e.x,e.y,r,t),n=a;return n.z=o,n}function pn(e,t){return e.x*t.x+e.y*t.y}function i1(e,t){if(e.length===1){let i=0,r=t[i++],a;for(;!a||r.equals(a);)if(a=t[i++],!a)return 1/0;for(;i<t.length;i++){let o=t[i],n=e[0],s=a.sub(r),l=o.sub(r),u=n.sub(r),c=pn(s,s),h=pn(s,l),d=pn(l,l),p=pn(u,s),f=pn(u,l),m=c*d-h*h,g=(d*p-h*f)/m,_=(c*f-h*p)/m,y=1-g-_,v=r.z*y+a.z*g+o.z*_;if(isFinite(v))return v}return 1/0}{let i=1/0;for(let r of t)i=Math.min(i,r.z);return i}}function nC(e,t,i){let r=1/0;i2(i,t)&&(r=i1(i,t[0]));for(let a=0;a<t.length;a++){let o=t[a],n=e[a];for(let s=0;s<o.length-1;s++){let l=o[s],u=o[s+1],c=n[s],h=[l,u,n[s+1],c,l];t2(i,h)&&(r=Math.min(r,i1(i,h)))}}return r!==1/0&&r}function o1(e,t){return t>0?t+2*e:e}function TC(e){return/[\u0600-\u0604\u0606-\u060B\u060D-\u061A\u061C-\u061E\u0620-\u063F\u0641-\u064A\u0656-\u066F\u0671-\u06DC\u06DE-\u070D\u070F-\u074A\u074D-\u077F\u07C0-\u07FA\u07FD-\u07FF\u0840-\u085B\u085E\u0860-\u086A\u0870-\u0891\u0897-\u08E1\u08E3-\u08FF\u1800\u1801\u1804\u1806-\u1819\u1820-\u1878\u1880-\u18AA\uA840-\uA877\uFB50-\uFD3D\uFD40-\uFDCF\uFDF0-\uFDFF\uFE70-\uFE74\uFE76-\uFEFC]|\uD802[\uDEC0-\uDEE6\uDEEB-\uDEF6\uDF80-\uDF91\uDF99-\uDF9C\uDFA9-\uDFAF]|\uD803[\uDD00-\uDD27\uDD30-\uDD39\uDE60-\uDE7E\uDEC2-\uDEC7\uDED0-\uDED8\uDEFA-\uDEFF\uDF30-\uDF59\uDF70-\uDF89\uDFB0-\uDFCB]|\uD805[\uDE60-\uDE6C]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9C-\uDC9F]|\uD83A[\uDD00-\uDD4B\uDD50-\uDD59\uDD5E\uDD5F]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB\uDEF0\uDEF1]/gim.test(String.fromCodePoint(e))}function EC(e){return/[\u0591-\u05C7\u05D0-\u05EA\u05EF-\u05F4\u0600-\u0604\u0606-\u060B\u060D-\u061A\u061C-\u061E\u0620-\u063F\u0641-\u064A\u0656-\u066F\u0671-\u06DC\u06DE-\u070D\u070F-\u074A\u074D-\u07B1\u07C0-\u07FA\u07FD-\u082D\u0830-\u083E\u0840-\u085B\u085E\u0860-\u086A\u0870-\u0891\u0897-\u08E1\u08E3-\u08FF\uFB1D-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFD3D\uFD40-\uFDCF\uFDF0-\uFDFF\uFE70-\uFE74\uFE76-\uFEFC]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC57-\uDC9E\uDCA7-\uDCAF\uDCE0-\uDCF2\uDCF4\uDCF5\uDCFB-\uDD1B\uDD1F-\uDD39\uDD3F-\uDD59\uDD80-\uDDB7\uDDBC-\uDDCF\uDDD2-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE38-\uDE3A\uDE3F-\uDE48\uDE50-\uDE58\uDE60-\uDE9F\uDEC0-\uDEE6\uDEEB-\uDEF6\uDF00-\uDF35\uDF39-\uDF55\uDF58-\uDF72\uDF78-\uDF91\uDF99-\uDF9C\uDFA9-\uDFAF]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDCFA-\uDD27\uDD30-\uDD39\uDD40-\uDD65\uDD69-\uDD85\uDD8E\uDD8F\uDE60-\uDE7E\uDE80-\uDEA9\uDEAB-\uDEAD\uDEB0\uDEB1\uDEC2-\uDEC7\uDED0-\uDED8\uDEFA-\uDF27\uDF30-\uDF59\uDF70-\uDF89\uDFB0-\uDFCB\uDFE0-\uDFF6]|\uD83A[\uDC00-\uDCC4\uDCC7-\uDCD6\uDD00-\uDD4B\uDD50-\uDD59\uDD5E\uDD5F]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB\uDEF0\uDEF1]/gim.test(String.fromCodePoint(e))}function SC(e){return/[\u0900-\u109F\u1700-\u17FF\u1900-\u194F\u19E0-\u1AAF\u1B00-\u1C4F\u1CC0-\u1CCF\uA800-\uA82F\uA880-\uA8FF\uA930-\uA95F\uA980-\uAAFF\uABC0-\uABFF]|\uD802[\uDE00-\uDE5F]|\uD804[\uDC00-\uDCCF\uDD00-\uDD4F\uDD80-\uDE4F\uDEB0-\uDFFF]|\uD805[\uDC00-\uDCDF\uDD80-\uDE5F\uDE80-\uDF4F]|\uD806[\uDC00-\uDC4F\uDD00-\uDD5F\uDDA0-\uDEAF\uDF00-\uDF7F]|\uD807[\uDC00-\uDCBF\uDD00-\uDDAF\uDEE0-\uDF5F\uDFC0-\uDFFF]|\uD818[\uDD00-\uDD3F]/gim.test(String.fromCodePoint(e))}function CC(e){return/[\u02EA\u02EB\u1100-\u11FF\u2E80-\u2FDF\u3000-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE4F\uFF00-\uFFEF]|\uD81B[\uDFE0-\uDFFF]|[\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFB]|\uD83C[\uDE00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(e))}function DC(e){return/[\u02EA\u02EB\u2E80-\u2FDF\u2FF0-\u303F\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FD-\u30FF\u3105-\u312F\u31A0-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uF900-\uFA6D\uFA70-\uFAD9\uFE10-\uFE1F\uFE30-\uFE4F\uFF00-\uFFEF]|\uD81B[\uDFE0-\uDFFF]|[\uD81C-\uD822\uD840-\uD868\uD86A-\uD86D\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD88C][\uDC00-\uDFFF]|\uD823[\uDC00-\uDCD5\uDCFF-\uDD1E\uDD80-\uDDF2]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFB]|\uD83C[\uDE00-\uDEFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEAD\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0\uDFF0-\uDFFF]|\uD87B[\uDC00-\uDE5D]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD88D[\uDC00-\uDC79]/gim.test(String.fromCodePoint(e))}function ms(e){return/[\u02EA\u02EB\u1100-\u11FF\u1401-\u167F\u18B0-\u18FF\u2065\u20DD-\u20E0\u20E2-\u20E4\u2B97\u2BF0-\u2BFF\u2E50\u2E51\u2E80-\u3007\u3012\u3013\u3020-\u302F\u3031-\u30FB\u30FD-\uA4CF\uA960-\uA97F\uAC00-\uD7FF\uF900-\uFAFF\uFE10-\uFE1F\uFE30-\uFE48\uFE50-\uFE57\uFE5F-\uFE62\uFE67-\uFE6F\uFF00-\uFF07\uFF0A-\uFF0C\uFF0E-\uFF19\uFF1F-\uFF3A\uFF3C\uFF3E\uFF40-\uFF5A\uFFE0-\uFFE2\uFFE4-\uFFE7\uFFF0-\uFFF8]|\uD802[\uDD80-\uDD9F]|\uD805[\uDD80-\uDDFF]|\uD806[\uDE00-\uDEBF]|[\uD80C-\uD810\uD81C-\uD822\uD83C\uD83D\uD840-\uD87E\uD880-\uD8BE][\uDC00-\uDFFF]|\uD811[\uDC00-\uDE7F]|\uD81B[\uDFE0-\uDFFF]|\uD823[\uDC00-\uDDFF]|\uD82B[\uDFF0-\uDFFF]|\uD82C[\uDC00-\uDEFF]|\uD833[\uDEC0-\uDFCF]|\uD834[\uDC00-\uDDFF\uDEE0-\uDF7F]|\uD836[\uDC00-\uDEAF]|\uD83E[\uDD00-\uDEFF]|[\uD87F\uD8BF][\uDC00-\uDFFD]/gim.test(String.fromCodePoint(e))}function AC(e){return/[\xA7\xA9\xAE\xB1\xBC-\xBE\xD7\xF7\u2016\u2020\u2021\u2030\u2031\u203B\u203C\u2042\u2047-\u2049\u2051\u2100-\u218F\u221E\u2234\u2235\u2300-\u2307\u230C-\u231F\u2324-\u2328\u232B\u237D-\u239A\u23BE-\u23CD\u23CF\u23D1-\u23DB\u23E2-\u2422\u2424-\u24FF\u25A0-\u2619\u2620-\u2767\u2776-\u2793\u2B12-\u2B2F\u2B50-\u2B59\u2BB8-\u2BEB\u3000-\u303F\u30A0-\u30FF\uE000-\uF8FF\uFE30-\uFE6F\uFF00-\uFFEF\uFFFC\uFFFD]|[\uDB80-\uDBFF][\uDC00-\uDFFF]/gim.test(String.fromCodePoint(e))}function MC(e){return/[\r\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0600-\u0605\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DD\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u070F\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0890\u0891\u0897-\u089F\u08CA-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D62\u0D63\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E33-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB3-\u0EBC\u0EC8-\u0ECE\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102D-\u1037\u1039-\u103E\u1056-\u1059\u105E-\u1060\u1071-\u1074\u1082\u1084-\u1086\u108D\u109D\u1100-\u11FF\u135D-\u135F\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u180F\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60\u1A62\u1A65-\u1A7C\u1A7F\u1AB0-\u1ADD\u1AE0-\u1AEB\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u200C\u200D\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA960-\uA97C\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7C\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFF9E\uFF9F]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD24-\uDD27\uDD69-\uDD6D\uDEAB\uDEAC\uDEFA-\uDEFF\uDF46-\uDF50\uDF82-\uDF85]|\uD804[\uDC00-\uDC02\uDC38-\uDC46\uDC70\uDC73\uDC74\uDC7F-\uDC82\uDCB0-\uDCBA\uDCBD\uDCC2\uDCCD\uDD00-\uDD02\uDD27-\uDD34\uDD45\uDD46\uDD73\uDD80-\uDD82\uDDB3-\uDDC0\uDDC2\uDDC3\uDDC9-\uDDCC\uDDCE\uDDCF\uDE2C-\uDE37\uDE3E\uDE41\uDEDF-\uDEEA\uDF00-\uDF03\uDF3B\uDF3C\uDF3E-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF62\uDF63\uDF66-\uDF6C\uDF70-\uDF74\uDFB8-\uDFC0\uDFC2\uDFC5\uDFC7-\uDFCA\uDFCC-\uDFD2\uDFE1\uDFE2]|\uD805[\uDC35-\uDC46\uDC5E\uDCB0-\uDCC3\uDDAF-\uDDB5\uDDB8-\uDDC0\uDDDC\uDDDD\uDE30-\uDE40\uDEAB-\uDEB7\uDF1D-\uDF1F\uDF22-\uDF2B]|\uD806[\uDC2C-\uDC3A\uDD30-\uDD35\uDD37\uDD38\uDD3B-\uDD43\uDDD1-\uDDD7\uDDDA-\uDDE0\uDDE4\uDE01-\uDE0A\uDE33-\uDE39\uDE3B-\uDE3E\uDE47\uDE51-\uDE5B\uDE84-\uDE99\uDF60-\uDF67]|\uD807[\uDC2F-\uDC36\uDC38-\uDC3F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD31-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD8A-\uDD8E\uDD90\uDD91\uDD93-\uDD97\uDEF3-\uDEF6\uDF00-\uDF03\uDF34-\uDF3A\uDF3E-\uDF42\uDF5A]|\uD80D[\uDC40\uDC47-\uDC55]|\uD818[\uDD1E-\uDD2F]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDD63\uDD67-\uDD6A\uDF4F\uDF51-\uDF87\uDF8F-\uDF92\uDFE4\uDFF0\uDFF1]|\uD82F[\uDC9D\uDC9E]|\uD833[\uDF00-\uDF2D\uDF30-\uDF46]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDC8F\uDD30-\uDD36\uDEAE\uDEEC-\uDEEF]|\uD839[\uDCEC-\uDCEF\uDDEE\uDDEF\uDEE3\uDEE6\uDEEE\uDEEF\uDEF5]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A]|\uD83C[\uDDE6-\uDDFF\uDFFB-\uDFFF]|\uDB40[\uDC20-\uDC7F\uDD00-\uDDEF]/.test(e)}function s1(e){return/[\u0E01-\u0E3A\u0E40-\u0E4E\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECE\u0EDC-\u0EDF\u0F00-\u0F47\u0F49-\u0F6C\u0F71-\u0F97\u0F99-\u0FBC\u0FBE-\u0FCC\u0FCE-\u0FD4\u0FD9\u0FDA\u1000-\u103F\u1050-\u108F\u109A-\u109F\u1780-\u17D3\u17D7\u17DC\u17DD\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19DE\u19DF\u1A20-\u1A5E\u1A60-\u1A7C\u1AA0-\u1AAD\u1B00-\u1B4C\u1B4E-\u1B7F\uA980-\uA9CD\uA9D0-\uA9D9\uA9DE-\uA9EF\uA9FA-\uA9FE\uAA60-\uAAC2\uAADB-\uAADF]|\uD805[\uDF00-\uDF1A\uDF1D-\uDF2B\uDF3A\uDF3B\uDF3F-\uDF46]/gim.test(String.fromCodePoint(e))}function PC(e,t){return/(?:[\u1039\u17D2\u1A60\u1BAB\u200D\uAAF6]|\uD802\uDE3F|\uD804[\uDD33\uDFD0]|\uD806[\uDD3E\uDE47\uDE99]|\uD807[\uDD45\uDD97\uDF42])$/.test(e)||/^\p{gc=Mc}/u.test(t)}function zC(e,t,i){let r=0;for(let a of e.split(";")){let[o,n]=a.split(",").map((l)=>parseInt(l,36)),s=r+o;for(let l=s;l<s+n;l++)i.set(l,t);r=s+n}}function LC(e){return W2.get(e)??"U"}function BC(e){return e==="D"||e==="L"||e==="C"}function OC(e){return e==="D"||e==="R"||e==="C"}function jC(e,t,i){return e==="D"?t&&i?3:t?1:i?2:0:e==="R"?+!!t:e==="L"?i?2:0:null}function NC(e){return[...e].map((t)=>{let i=t.codePointAt(0);return{codePoint:i,type:LC(i),form:null}})}function VC(e){let t=e.filter((i)=>i.type!=="T");for(let i=0;i<t.length;i++){let r=t[i],a=i>0&&BC(t[i-1].type),o=i+1<t.length&&OC(t[i+1].type);r.form=jC(r.type,a,o)}}function $C(e){let t=!1;for(let i of e)i.type==="T"?i.form=t?3:0:t=i.form===2||i.form===3}function UC(e){let t=[];for(let i=0;i<e.length;i++){let r=e[i];if(r.codePoint!==l1){t.push(r);continue}let a=i+1;for(;a<e.length&&e[a].type==="T";)a++;let o=e[a],n=o&&FC[String.fromCodePoint(l1,o.codePoint)];if(!n){t.push(r);continue}let s=r.form===3||r.form===1;t.push({codePoint:n[+!!s],type:"R",form:0}),t.push(...e.slice(i+1,a)),i=a}return t}function qC(e){if(e.form===null)return e.codePoint;let t=kC[e.codePoint];return t&&(t[e.form]||t[0])||e.codePoint}function GC(e){if(!RC.test(e))return e;let t=NC(e);return VC(t),$C(t),UC(t).map((i)=>String.fromCodePoint(qC(i))).join("")}function WC(e,t,i){let r=t.layout.get("text-transform").evaluate(i,{});return r==="uppercase"?e=e.toLocaleUpperCase():r==="lowercase"&&(e=e.toLocaleLowerCase()),(fu.applyArabicShaping??GC)(e)}function ZC(e,t,i){for(let r of e.sections)r.text=WC(r.text,t,i);return e}function Ph(e,t,i){let r=i?t.last.points:t.first.points,a=i?r[r.length-1]:r[0];return`${e}:${a.x}:${a.y}`}function HC(e){let t=e.first.points,i=t.length;for(let o=e.first.next;o;o=o.next)i+=o.points.length-1;let r=Array(i);for(let o=0;o<t.length;o++)r[o]=t[o];let a=t.length;for(let o=e.first.next;o;o=o.next){let n=o.points;for(let s=1;s<n.length;s++)r[a++]=n[s]}return r}function u1(e,t,i,r,a){let o=t[i];delete t[i],t[r]=o;let n=e[o];return n.last.next=a.first,n.last=a.last,o}function c1(e,t,i,r,a){let o=t[r];delete t[r],t[i]=o;let n=e[o];return a.last.next=n.first,n.first=a.first,o}function XC(e){let t={},i={},r=[];for(let o of e){let n=o.text?o.text.toString():null,s={points:o.geometry[0],next:null},l={feature:o,first:s,last:s};if(!n){r.push(l);continue}let u=Ph(n,l),c=Ph(n,l,!0);if(u in i&&c in t&&i[u]!==t[c]){let h=c1(r,t,u,c,l),d=u1(r,i,u,c,r[h]);delete t[u],delete i[c],i[Ph(n,r[d],!0)]=d,r[h].feature.geometry=null}else if(u in i)u1(r,i,u,c,l);else if(c in t)c1(r,t,u,c,l);else{let h=r.push(l)-1;t[u]=h,i[c]=h}}let a=[];for(let o of r){let n=o.feature;n.geometry&&(o.first.next&&(n.geometry[0]=HC(o)),a.push(n))}return a}function np(e){if(!Z2||!MC(e))return[...e];h1??=new Intl.Segmenter(void 0,{granularity:"grapheme"});let t=[];for(let{segment:i}of h1.segment(e)){let r=t.length-1;r>=0&&PC(t[r],i)?t[r]+=i:t.push(i)}return t}function YC(e){let t=new Set;if(Z2){d1??=new Intl.Segmenter(void 0,{granularity:"word"});for(let{index:r}of d1.segment(e))t.add(r);return t}let i=0;for(let r of e.split(/\b|(?=\p{Ideo})/u))t.add(i),i+=r.length;return t}function is(e){let t=e.codePointAt(0);return e.length>(t>65535?2:1)}function rs(e){return/\s/u.test(String.fromCodePoint(e))}function Qu(e){return/[\p{P}\p{S}]/u.test(String.fromCodePoint(e))}function sp(e){for(let t of e)if(ms(t.codePointAt(0)))return!0;return!1}function H2(e){for(let t of e)if(!KC(t.codePointAt(0)))return!1;return!0}function KC(e){return!TC(e)}function zo(e){return!(ms(e)||AC(e))}function X2(e){return/\p{sc=Arab}/u.test(String.fromCodePoint(e))}function Y2(e){return EC(e)}function K2(e){for(let t of e)if(Y2(t.codePointAt(0)))return!0;return!1}function JC(e){let t="",i={premature:!0,value:void 0},r=e[Symbol.iterator](),a=r.next(),o=e[Symbol.iterator]();o.next();let n=o.next();for(;!a.done;)(n.done||!zo(n.value.codePointAt(0))||co[n.value])&&(i.premature||!zo(i.value.codePointAt(0))||co[i.value])&&co[a.value]?t+=co[a.value]:t+=a.value,i={value:a.value,premature:!1},a=r.next(),n=o.next();return t}function p1(e,t,i,r,a,o){if("fontStack"in t){let n=i[t.fontStack]?.default,s=n?.[e];if(s)return s.metrics.advance*t.scale+a;let l=0;for(let u of e){let c=n?.[u];c&&(l+=c.metrics.advance*t.scale+a)}return l}{let n=r[t.imageName];return n?n.displaySize[0]*t.scale*24/o+a:0}}function f1(e,t,i,r){let a=(e-t)**2;return r?e<t?a/2:a*2:a+Math.abs(i)*i}function m1(e){return/^\s+$/u.test(e)}function tD(e,t,i){let r=0;return(e===10||e===13)&&(r-=1e4),i&&(r+=150),(e===40||e===65288)&&(r+=50),(t===41||t===65289)&&(r+=50),r}function g1(e,t,i,r,a,o){let n=null,s=f1(t,i,a,o);for(let l of r){let u=f1(t-l.x,i,a,o)+l.badness;u<=s&&(n=l,s=u)}return{index:e,x:t,priorBreak:n,badness:s}}function J2(e){return e?J2(e.priorBreak).concat(e.index):[]}function iD(){return function(e){var t={R:"13k,1a,2,3,3,2+1j,ch+16,a+1,5+2,2+n,5,a,4,6+16,4+3,h+1b,4mo,179q,2+9,2+11,2i9+7y,2+68,4,3+4,5+13,4+3,2+4k,3+29,8+cf,1t+7z,w+17,3+3m,1t+3z,16o1+5r,8+30,8+mc,29+1r,29+4v,75+73",EN:"1c+9,3d+1,6,187+9,513,4+5,7+9,sf+j,175h+9,qw+q,161f+1d,4xt+a,25i+9",ES:"17,2,6dp+1,f+1,av,16vr,mx+1,4o,2",ET:"z+2,3h+3,b+1,ym,3e+1,2o,p4+1,8,6u,7c,g6,1wc,1n9+4,30+1b,2n,6d,qhx+1,h0m,a+1,49+2,63+1,4+1,6bb+3,12jj",AN:"16o+5,2j+9,2+1,35,ed,1ff2+9,87+u",CS:"18,2+1,b,2u,12k,55v,l,17v0,2,3,53,2+1,b",B:"a,3,f+2,2v,690",S:"9,2,k",WS:"c,k,4f4,1vk+a,u,1j,335",ON:"x+1,4+4,h+5,r+5,r+3,z,5+3,2+1,2+1,5,2+2,3+4,o,w,ci+1,8+d,3+d,6+8,2+g,39+1,9,6+1,2,33,b8,3+1,3c+1,7+1,5r,b,7h+3,sa+5,2,3i+6,jg+3,ur+9,2v,ij+1,9g+9,7+a,8m,4+1,49+x,14u,2+2,c+2,e+2,e+2,e+1,i+n,e+e,2+p,u+2,e+2,36+1,2+3,2+1,b,2+2,6+5,2,2,2,h+1,5+4,6+3,3+f,16+2,5+3l,3+81,1y+p,2+40,q+a,m+13,2r+ch,2+9e,75+hf,3+v,2+2w,6e+5,f+6,75+2a,1a+p,2+2g,d+5x,r+b,6+3,4+o,g,6+1,6+2,2k+1,4,2j,5h+z,1m+1,1e+f,t+2,1f+e,d+3,4o+3,2s+1,w,535+1r,h3l+1i,93+2,2s,b+1,3l+x,2v,4g+3,21+3,kz+1,g5v+1,5a,j+9,n+v,2,3,2+8,2+1,3+2,2,3,46+1,4+4,h+5,r+5,r+a,3h+2,4+6,b+4,78,1r+24,4+c,4,1hb,ey+6,103+j,16j+c,1ux+7,5+g,fsh,jdq+1t,4,57+2e,p1,1m,1m,1m,1m,4kt+1,7j+17,5+2r,d+e,3+e,2+e,2+10,m+4,w,1n+5,1q,4z+5,4b+rb,9+c,4+c,4+37,d+2g,8+b,l+b,5+1j,9+9,7+13,9+t,3+1,27+3c,2+29,2+3q,d+d,3+4,4+2,6+6,a+o,8+6,a+2,e+6,16+42,2+1i",BN:"0+8,6+d,2s+5,2+p,e,4m9,1kt+2,2b+5,5+5,17q9+v,7k,6p+8,6+1,119d+3,440+7,96s+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+75,6p+2rz,1ben+1,1ekf+1,1ekf+1",NSM:"lc+33,7o+6,7c+18,2,2+1,2+1,2,21+a,1d+k,h,2u+6,3+5,3+1,2+3,10,v+q,2k+a,1n+8,a,p+3,2+8,2+2,2+4,18+2,3c+e,2+v,1k,2,5+7,5,4+6,b+1,u,1n,5+3,9,l+1,r,3+1,1m,5+1,5+1,3+2,4,v+1,4,c+1,1m,5+4,2+1,5,l+1,n+5,2,1n,3,2+3,9,8+1,c+1,v,1q,d,1f,4,1m+2,6+2,2+3,8+1,c+1,u,1n,g+1,l+1,t+1,1m+1,5+3,9,l+1,u,21,8+2,2,2j,3+6,d+7,2r,3+8,c+5,23+1,s,2,2,1k+d,2+4,2+1,6+a,2+z,a,2v+3,2+5,2+1,3+1,q+1,5+2,h+3,e,3+1,7,g,jk+2,qb+2,u+2,u+1,v+1,1t+1,2+6,9,3+a,a,1a+2,3c+1,z,3b+2,5+1,a,7+2,64+1,3,1n,2+6,2,2,3+7,7+9,3,1d+g,1s+3,1d,2+4,2,6,15+8,d+1,x+3,3+1,2+2,1l,2+1,4,2+2,1n+7,3+1,49+2,2+c,2+6,5,7,4+1,5j+1l,2+4,k1+w,2db+2,3y,2p+v,ff+3,30+1,n9x+3,2+9,x+1,29+1,7l,4,5,q+1,6,48+1,r+h,e,13+7,q+a,1b+2,1d,3+3,3+1,14,1w+5,3+1,3+1,d,9,1c,1g,2+2,3+1,6+1,2,17+1,9,6n,3,5,fn5,ki+f,h+f,r2,6b,46+4,1af+2,2+1,6+3,15+2,5,4m+1,fy+3,as+1,4a+a,4x,1j+e,1l+2,1e+3,3+1,1y+2,11+4,2+7,1r,d+1,1h+8,b+3,3,2o+2,3,2+1,7,4h,4+7,m+1,1m+1,4,12+6,4+4,5g+7,3+2,2,o,2d+5,2,5+1,2+1,6n+3,7+1,2+1,s+1,2e+7,3,2+1,2z,2,3+5,2,2u+2,3+3,2+4,78+8,2+1,75+1,2,5,41+3,3+1,5,x+5,3+1,15+5,3+3,9,a+5,3+2,1b+c,2+1,bb+6,2+5,2d+l,3+6,2+1,2+1,3f+5,4,2+1,2+6,2,21+1,4,2,9o+1,f0c+4,1o+6,t5,1s+3,2a,f5l+1,43t+2,i+7,3+6,v+3,45+2,1j0+1i,5+1d,9,f,n+4,2+e,11t+6,2+g,3+6,2+1,2+4,7a+6,c6+3,15t+6,32+6,gzhy+6n",AL:"16w,3,2,e+1b,z+2,2+2s,g+1,8+1,b+m,2+t,s+2i,c+e,4h+f,1d+1e,1bwe+dp,3+3z,x+c,2+1,35+3y,2rm+z,5+7,b+5,dt+l,c+u,17nl+27,1t+27,4x+6n,3+d",LRO:"6ct",RLO:"6cu",LRE:"6cq",RLE:"6cr",PDF:"6cs",LRI:"6ee",RLI:"6ef",FSI:"6eg",PDI:"6eh"},i={},r={};i.L=1,r[1]="L",Object.keys(t).forEach(function(X,ge){i[X]=1<<ge+1,r[i[X]]=X}),Object.freeze(i);var a=i.LRI|i.RLI|i.FSI,o=i.L|i.R|i.AL,n=i.B|i.S|i.WS|i.ON|i.FSI|i.LRI|i.RLI|i.PDI,s=i.BN|i.RLE|i.LRE|i.RLO|i.LRO|i.PDF,l=i.S|i.WS|i.B|a|i.PDI|s,u=null;function c(){if(!u){u=new Map;var X=0;for(var ge in t)if(t.hasOwnProperty(ge))for(var ye=t[ge],j="",ue=void 0,K=!1,re=0,J=0;J<=ye.length+1;J+=1){var me=ye[J];if(me!==","&&J!==ye.length)me==="+"?(K=!0,re=X=re+parseInt(j,36),j=""):j+=me;else{K?ue=X+parseInt(j,36):(re=X=re+parseInt(j,36),ue=X),K=!1,j="",re=ue;for(var Ne=X;Ne<ue+1;Ne+=1)u.set(Ne,i[ge])}}}}function h(X){return c(),u.get(X.codePointAt(0))||i.L}function d(X){return r[h(X)]}var p={pairs:"14>1,1e>2,u>2,2wt>1,1>1,1ge>1,1wp>1,1j>1,f>1,hm>1,1>1,u>1,u6>1,1>1,+5,28>1,w>1,1>1,+3,b8>1,1>1,+3,1>3,-1>-1,3>1,1>1,+2,1s>1,1>1,x>1,th>1,1>1,+2,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,4q>1,1e>2,u>2,2>1,+1",canonical:"6f1>-6dx,6dy>-6dx,6ec>-6ed,6ee>-6ed,6ww>2jj,-2ji>2jj,14r4>-1e7l,1e7m>-1e7l,1e7m>-1e5c,1e5d>-1e5b,1e5c>-14qx,14qy>-14qx,14vn>-1ecg,1ech>-1ecg,1edu>-1ecg,1eci>-1ecg,1eda>-1ecg,1eci>-1ecg,1eci>-168q,168r>-168q,168s>-14ye,14yf>-14ye"};function f(X,ge){var ye=0,j=new Map,ue=ge&&new Map,K;return X.split(",").forEach(function re(J){if(J.indexOf("+")!==-1)for(var me=+J;me--;)re(K);else{K=J;var Ne=J.split(">"),Ee=Ne[0],ct=Ne[1];Ee=String.fromCodePoint(ye+=parseInt(Ee,36)),ct=String.fromCodePoint(ye+=parseInt(ct,36)),j.set(Ee,ct),ge&&ue.set(ct,Ee)}}),{map:j,reverseMap:ue}}var m,g,_;function y(){if(!m){var X=f(p.pairs,!0),{map:ge,reverseMap:ye}=X;m=ge,g=ye,_=f(p.canonical,!1).map}}function v(X){return y(),m.get(X)||null}function x(X){return y(),g.get(X)||null}function b(X){return y(),_.get(X)||null}var{L:w,R:T,EN:E,ES:S,ET:A,AN:I,CS:R,B:k,S:M,ON:C,BN:P,NSM:B,AL:N,LRO:L,RLO:W,LRE:Q,RLE:be,PDF:le,LRI:je,RLI:Le,FSI:Qe,PDI:Oe}=i;function It(X,ge){for(var ye=125,j=new Uint32Array(X.length),ue=0;ue<X.length;ue++)j[ue]=h(X[ue]);var K=new Map;function re(Jt,ji){var Qt=j[Jt];j[Jt]=ji,K.set(Qt,K.get(Qt)-1),Qt&n&&K.set(n,K.get(n)-1),K.set(ji,(K.get(ji)||0)+1),ji&n&&K.set(n,(K.get(n)||0)+1)}for(var J=new Uint8Array(X.length),me=new Map,Ne=[],Ee=null,ct=0;ct<X.length;ct++)Ee||Ne.push(Ee={start:ct,end:X.length-1,level:ge==="rtl"?1:ge==="ltr"?0:Nm(ct,!1)}),j[ct]&k&&(Ee.end=ct,Ee=null);for(var ua=be|Q|W|L|a|Oe|le|k,Sr=function(Jt){return Jt+(Jt&1?1:2)},rr=function(Jt){return Jt+(Jt&1?2:1)},Gt=0;Gt<Ne.length;Gt++){Ee=Ne[Gt];var Be=[{_level:Ee.level,_override:0,_isolate:0}],Ye=void 0,Wt=0,Ei=0,qa=0;K.clear();for(var ht=Ee.start;ht<=Ee.end;ht++){var kt=j[ht];if(Ye=Be[Be.length-1],K.set(kt,(K.get(kt)||0)+1),kt&n&&K.set(n,(K.get(n)||0)+1),kt&ua)if(kt&(be|Q)){J[ht]=Ye._level;var fm=(kt===be?rr:Sr)(Ye._level);fm<=ye&&!Wt&&!Ei?Be.push({_level:fm,_override:0,_isolate:0}):Wt||Ei++}else if(kt&(W|L)){J[ht]=Ye._level;var mm=(kt===W?rr:Sr)(Ye._level);mm<=ye&&!Wt&&!Ei?Be.push({_level:mm,_override:kt&W?T:w,_isolate:0}):Wt||Ei++}else if(kt&a){kt&Qe&&(kt=Nm(ht+1,!0)===1?Le:je),J[ht]=Ye._level,Ye._override&&re(ht,Ye._override);var gm=(kt===Le?rr:Sr)(Ye._level);gm<=ye&&Wt===0&&Ei===0?(qa++,Be.push({_level:gm,_override:0,_isolate:1,_isolInitIndex:ht})):Wt++}else if(kt&Oe){if(Wt>0)Wt--;else if(qa>0){for(Ei=0;!Be[Be.length-1]._isolate;)Be.pop();var _c=Be[Be.length-1]._isolInitIndex;_c!=null&&(me.set(_c,ht),me.set(ht,_c)),Be.pop(),qa--}Ye=Be[Be.length-1],J[ht]=Ye._level,Ye._override&&re(ht,Ye._override)}else kt&le?(Wt===0&&(Ei>0?Ei--:!Ye._isolate&&Be.length>1&&(Be.pop(),Ye=Be[Be.length-1])),J[ht]=Ye._level):kt&k&&(J[ht]=Ee.level);else J[ht]=Ye._level,Ye._override&&kt!==P&&re(ht,Ye._override)}for(var Ga=[],ar=null,ca=Ee.start;ca<=Ee.end;ca++){var yc=j[ca];if(!(yc&s)){var _m=J[ca],ym=yc&a,yw=yc===Oe;ar&&_m===ar._level?(ar._end=ca,ar._endsWithIsolInit=ym):Ga.push(ar={_start:ca,_end:ca,_level:_m,_startsWithPDI:yw,_endsWithIsolInit:ym})}}for(var vc=[],xs=0;xs<Ga.length;xs++){var bs=Ga[xs];if(!bs._startsWithPDI||bs._startsWithPDI&&!me.has(bs._start)){for(var xc=[ar=bs],vm=void 0;ar&&ar._endsWithIsolInit&&(vm=me.get(ar._end))!=null;)for(var ws=xs+1;ws<Ga.length;ws++)if(Ga[ws]._start===vm){xc.push(ar=Ga[ws]);break}for(var Wa=[],bc=0;bc<xc.length;bc++)for(var xm=xc[bc],wc=xm._start;wc<=xm._end;wc++)Wa.push(wc);for(var vw=J[Wa[0]],bm=Ee.level,Ts=Wa[0]-1;Ts>=0;Ts--)if(!(j[Ts]&s)){bm=J[Ts];break}var Tc=Wa[Wa.length-1],xw=J[Tc],wm=Ee.level;if(!(j[Tc]&a)){for(var Es=Tc+1;Es<=Ee.end;Es++)if(!(j[Es]&s)){wm=J[Es];break}}vc.push({_seqIndices:Wa,_sosType:Math.max(bm,vw)%2?T:w,_eosType:Math.max(wm,xw)%2?T:w})}}for(var Ec=0;Ec<vc.length;Ec++){var Sc=vc[Ec],{_seqIndices:ne,_sosType:Uo,_eosType:bw}=Sc,Za=J[ne[0]]&1?T:w;if(K.get(B))for(var Ss=0;Ss<ne.length;Ss++){var Tm=ne[Ss];if(j[Tm]&B){for(var Cc=Uo,Cs=Ss-1;Cs>=0;Cs--)if(!(j[ne[Cs]]&s)){Cc=j[ne[Cs]];break}re(Tm,Cc&(a|Oe)?C:Cc)}}if(K.get(E))for(var Ds=0;Ds<ne.length;Ds++){var Em=ne[Ds];if(j[Em]&E)for(var As=Ds-1;As>=-1;As--){var Sm=As===-1?Uo:j[ne[As]];if(Sm&o){Sm===N&&re(Em,I);break}}}if(K.get(N))for(var Dc=0;Dc<ne.length;Dc++){var Cm=ne[Dc];j[Cm]&N&&re(Cm,T)}if(K.get(S)||K.get(R))for(var qo=1;qo<ne.length-1;qo++){var Ac=ne[qo];if(j[Ac]&(S|R)){for(var Ha=0,Mc=0,Pc=qo-1;Pc>=0&&(Ha=j[ne[Pc]],Ha&s);Pc--);for(var Ic=qo+1;Ic<ne.length&&(Mc=j[ne[Ic]],Mc&s);Ic++);Ha===Mc&&(j[Ac]===S?Ha===E:Ha&(E|I))&&re(Ac,Ha)}}if(K.get(E)){for(var or=0;or<ne.length;or++)if(j[ne[or]]&E){for(var Ms=or-1;Ms>=0&&j[ne[Ms]]&(A|s);Ms--)re(ne[Ms],E);for(or++;or<ne.length&&j[ne[or]]&(A|s|E);or++)j[ne[or]]!==E&&re(ne[or],E)}}if(K.get(A)||K.get(S)||K.get(R))for(var Go=0;Go<ne.length;Go++){var Dm=ne[Go];if(j[Dm]&(A|S|R)){re(Dm,C);for(var Ps=Go-1;Ps>=0&&j[ne[Ps]]&s;Ps--)re(ne[Ps],C);for(var Is=Go+1;Is<ne.length&&j[ne[Is]]&s;Is++)re(ne[Is],C)}}if(K.get(E))for(var kc=0,Am=Uo;kc<ne.length;kc++){var Mm=ne[kc],Fc=j[Mm];Fc&E?Am===w&&re(Mm,w):Fc&o&&(Am=Fc)}if(K.get(n)){for(var Wo=T|E|I,Pm=Wo|w,ks=[],Xa=[],Ya=0;Ya<ne.length;Ya++)if(j[ne[Ya]]&n){var Zo=X[ne[Ya]],Im=void 0;if(v(Zo)!==null)if(Xa.length<63)Xa.push({char:Zo,seqIndex:Ya});else break;else if((Im=x(Zo))!==null)for(var Ho=Xa.length-1;Ho>=0;Ho--){var Rc=Xa[Ho].char;if(Rc===Im||Rc===x(b(Zo))||v(b(Rc))===Zo){ks.push([Xa[Ho].seqIndex,Ya]),Xa.length=Ho;break}}}ks.sort(function(Jt,ji){return Jt[0]-ji[0]});for(var zc=0;zc<ks.length;zc++){for(var km=ks[zc],Fs=km[0],Lc=km[1],Fm=!1,nr=0,Bc=Fs+1;Bc<Lc;Bc++){var Rm=ne[Bc];if(j[Rm]&Pm){Fm=!0;var zm=j[Rm]&Wo?T:w;if(zm===Za){nr=zm;break}}}if(Fm&&!nr){nr=Uo;for(var Oc=Fs-1;Oc>=0;Oc--){var Lm=ne[Oc];if(j[Lm]&Pm){var Bm=j[Lm]&Wo?T:w;nr=Bm===Za?Za:Bm;break}}}if(nr){if(j[ne[Fs]]=j[ne[Lc]]=nr,nr!==Za){for(var Xo=Fs+1;Xo<ne.length;Xo++)if(!(j[ne[Xo]]&s)){h(X[ne[Xo]])&B&&(j[ne[Xo]]=nr);break}}if(nr!==Za){for(var Yo=Lc+1;Yo<ne.length;Yo++)if(!(j[ne[Yo]]&s)){h(X[ne[Yo]])&B&&(j[ne[Yo]]=nr);break}}}}for(var $r=0;$r<ne.length;$r++)if(j[ne[$r]]&n){for(var Om=$r,jc=$r,Nc=Uo,Ko=$r-1;Ko>=0;Ko--)if(j[ne[Ko]]&s)Om=Ko;else{Nc=j[ne[Ko]]&Wo?T:w;break}for(var jm=bw,Jo=$r+1;Jo<ne.length;Jo++)if(j[ne[Jo]]&(n|s))jc=Jo;else{jm=j[ne[Jo]]&Wo?T:w;break}for(var Vc=Om;Vc<=jc;Vc++)j[ne[Vc]]=Nc===jm?Nc:Za;$r=jc}}}for(var pi=Ee.start;pi<=Ee.end;pi++){var ww=J[pi],Rs=j[pi];if(ww&1?Rs&(w|E|I)&&J[pi]++:Rs&T?J[pi]++:Rs&(I|E)&&(J[pi]+=2),Rs&s&&(J[pi]=pi===0?Ee.level:J[pi-1]),pi===Ee.end||h(X[pi])&(M|k))for(var zs=pi;zs>=0&&h(X[zs])&l;zs--)J[zs]=Ee.level}}return{levels:J,paragraphs:Ne};function Nm(Jt,ji){for(var Qt=Jt;Qt<X.length;Qt++){var Ur=j[Qt];if(Ur&(T|N))return 1;if(Ur&(k|w)||ji&&Ur===Oe)return 0;if(Ur&a){var Vm=Tw(Qt);Qt=Vm===-1?X.length:Vm}}return 0}function Tw(Jt){for(var ji=1,Qt=Jt+1;Qt<X.length;Qt++){var Ur=j[Qt];if(Ur&k)break;if(Ur&Oe){if(--ji===0)return Qt}else Ur&a&&ji++}return-1}}var jt="14>1,j>2,t>2,u>2,1a>g,2v3>1,1>1,1ge>1,1wd>1,b>1,1j>1,f>1,ai>3,-2>3,+1,8>1k0,-1jq>1y7,-1y6>1hf,-1he>1h6,-1h5>1ha,-1h8>1qi,-1pu>1,6>3u,-3s>7,6>1,1>1,f>1,1>1,+2,3>1,1>1,+13,4>1,1>1,6>1eo,-1ee>1,3>1mg,-1me>1mk,-1mj>1mi,-1mg>1mi,-1md>1,1>1,+2,1>10k,-103>1,1>1,4>1,5>1,1>1,+10,3>1,1>8,-7>8,+1,-6>7,+1,a>1,1>1,u>1,u6>1,1>1,+5,26>1,1>1,2>1,2>2,8>1,7>1,4>1,1>1,+5,b8>1,1>1,+3,1>3,-2>1,2>1,1>1,+2,c>1,3>1,1>1,+2,h>1,3>1,a>1,1>1,2>1,3>1,1>1,d>1,f>1,3>1,1a>1,1>1,6>1,7>1,13>1,k>1,1>1,+19,4>1,1>1,+2,2>1,1>1,+18,m>1,a>1,1>1,lk>1,1>1,4>1,2>1,f>1,3>1,1>1,+3,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,6>1,4j>1,j>2,t>2,u>2,2>1,+1",Ut;function vt(){if(!Ut){var X=f(jt,!0),ge=X.map;X.reverseMap.forEach(function(ye,j){ge.set(j,ye)}),Ut=ge}}function qt(X){return vt(),Ut.get(X)||null}function ir(X,ge,ye,j){var ue=X.length;ye=Math.max(0,ye==null?0:+ye),j=Math.min(ue-1,j==null?ue-1:+j);for(var K=new Map,re=ye;re<=j;re++)if(ge[re]&1){var J=qt(X[re]);J!==null&&K.set(re,J)}return K}function nt(X,ge,ye,j){var ue=X.length;ye=Math.max(0,ye==null?0:+ye),j=Math.min(ue-1,j==null?ue-1:+j);var K=[];return ge.paragraphs.forEach(function(re){var J=Math.max(ye,re.start),me=Math.min(j,re.end);if(J<me){for(var Ne=ge.levels.slice(J,me+1),Ee=me;Ee>=J&&h(X[Ee])&l;Ee--)Ne[Ee]=re.level;for(var ct=re.level,ua=1/0,Sr=0;Sr<Ne.length;Sr++){var rr=Ne[Sr];rr>ct&&(ct=rr),rr<ua&&(ua=rr|1)}for(var Gt=ct;Gt>=ua;Gt--)for(var Be=0;Be<Ne.length;Be++)if(Ne[Be]>=Gt){for(var Ye=Be;Be+1<Ne.length&&Ne[Be+1]>=Gt;)Be++;Be>Ye&&K.push([Ye+J,Be+J])}}}),K}function hi(X,ge,ye,j){var ue=di(X,ge,ye,j),K=[].concat(X);return ue.forEach(function(re,J){K[J]=(ge.levels[re]&1?qt(X[re]):null)||X[re]}),K.join("")}function di(X,ge,ye,j){for(var ue=nt(X,ge,ye,j),K=[],re=0;re<X.length;re++)K[re]=re;return ue.forEach(function(J){for(var me=J[0],Ne=J[1],Ee=K.slice(me,Ne+1),ct=Ee.length;ct--;)K[Ne-ct]=Ee[ct]}),K}return e.closingToOpeningBracket=x,e.getBidiCharType=h,e.getBidiCharTypeName=d,e.getCanonicalBracket=b,e.getEmbeddingLevels=It,e.getMirroredCharacter=qt,e.getMirroredCharactersMap=ir,e.getReorderSegments=nt,e.getReorderedIndices=di,e.getReorderedString=hi,e.openingToClosingBracket=v,Object.defineProperty(e,"__esModule",{value:!0}),e}({})}function nD(e,t,i,r){let a=[],o=i;for(let n of np(e.slice(i,r)))a.push({index:o,text:n,level:t[o]}),o+=n.length;return a}function sD(e,t){let i=!0;for(let r=e.length-1;r>=0;r--){let a=Sf.getBidiCharTypeName(e[r].text[0]);oD.has(a)?(e[r].level=t,i=!0):i&&aD.has(a)?e[r].level=t:i=!1}}function lD(e,t){let i=t,r=1/0;for(let{level:o}of e)o>i&&(i=o),(o|1)<r&&(r=o|1);let a=e.slice();for(let o=i;o>=r;o--)for(let n=0;n<a.length;n++){if(a[n].level<o)continue;let s=n;for(;s+1<a.length&&a[s+1].level>=o;)s++;for(let l=n,u=s;l<u;l++,u--)[a[l],a[u]]=[a[u],a[l]];n=s}return a}function uD(e){return e.level%2==0?e.text:Sf.getMirroredCharacter(e.text)??e.text}function cD(e,t){return e.find((i)=>t>=i.start&&t<=i.end)?.level??0}function hD(e,t,i,r,a){let o=nD(e,t,r,a);sD(o,i);let n="",s=[];for(let l of lD(o,i)){if(rD.test(l.text))continue;let u=uD(l);n+=u,s.push(...Array(u.length).fill(l.index))}return{text:n,sourceIndices:s}}function dD(e,t){let i=t.filter((o)=>o>0&&o<e.length),r=[...new Set([0,...i,e.length])].sort((o,n)=>o-n),a=[];for(let o=0;o+1<r.length;o++)a.push([r[o],r[o+1]]);return a}function Q2(e,t){let{levels:i,paragraphs:r}=Sf.getEmbeddingLevels(e);return dD(e,t.concat(r.map((a)=>a.start))).map(([a,o])=>hD(e,i,cD(r,a),a,o))}function pD(e,t){return Q2(e,t).map((i)=>i.text)}function fD(e,t,i){return Q2(e,i).map((r)=>[r.text,r.sourceIndices.map((a)=>t[a]??0)])}function mD(e,t,i){let r=i.buf,a,o;if(o=r[i.pos++],a=(o&112)>>4,o<128||(o=r[i.pos++],a|=(o&127)<<3,o<128)||(o=r[i.pos++],a|=(o&127)<<10,o<128)||(o=r[i.pos++],a|=(o&127)<<17,o<128)||(o=r[i.pos++],a|=(o&127)<<24,o<128)||(o=r[i.pos++],a|=(o&1)<<31,o<128))return gD(e,a,t);throw Error("Expected varint not more than 10 bytes")}function gD(e,t,i){return i?t*4294967296+(e>>>0):(t>>>0)*4294967296+(e>>>0)}function _D(e,t,i){let r="",a=t;for(;a<i;){let o=e[a],n=null,s=o>239?4:o>223?3:o>191?2:1;if(a+s>i)break;let l,u,c;s===1?o<128&&(n=o):s===2?(l=e[a+1],(l&192)==128&&(n=(o&31)<<6|l&63,n<=127&&(n=null))):s===3?(l=e[a+1],u=e[a+2],(l&192)==128&&(u&192)==128&&(n=(o&15)<<12|(l&63)<<6|u&63,(n<=2047||n>=55296&&n<=57343)&&(n=null))):s===4&&(l=e[a+1],u=e[a+2],c=e[a+3],(l&192)==128&&(u&192)==128&&(c&192)==128&&(n=(o&15)<<18|(l&63)<<12|(u&63)<<6|c&63,(n<=65535||n>=1114112)&&(n=null))),n===null?(n=65533,s=1):n>65535&&(n-=65536,r+=String.fromCharCode(n>>>10&1023|55296),n=56320|n&1023),r+=String.fromCharCode(n),a+=s}return r}function yD(e,t,i){e===1&&i.readMessage(vD,t)}function vD(e,t,i){if(e===3){let{id:r,bitmap:a,width:o,height:n,left:s,top:l,advance:u}=i.readMessage(xD,{});t.push({id:r,bitmap:new bf({width:o+6,height:n+6},a),metrics:{width:o,height:n,left:s,top:l,advance:u}})}}function xD(e,t,i){e===1?t.id=i.readVarint():e===2?t.bitmap=i.readBytes():e===3?t.width=i.readVarint():e===4?t.height=i.readVarint():e===5?t.left=i.readSVarint():e===6?t.top=i.readSVarint():e===7&&(t.advance=i.readVarint())}function bD(e){return new ex(e).readFields(yD,[])}function mu(e){return typeof e?.renderWithWebGL=="function"}function wD(e){let{userImage:t}=e;return!t?.render||!t.render()?!1:(mu(t.data)||e.data.replace(new Uint8Array(t.data.buffer)),!0)}function tx(e){let t=0,i=0;for(let n of e)t+=n.w*n.h,i=Math.max(i,n.w);e.sort((n,s)=>s.h-n.h);let r=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/0.95)),i),h:1/0}],a=0,o=0;for(let n of e)for(let s=r.length-1;s>=0;s--){let l=r[s];if(!(n.w>l.w||n.h>l.h)){if(n.x=l.x,n.y=l.y,o=Math.max(o,n.y+n.h),a=Math.max(a,n.x+n.w),n.w===l.w&&n.h===l.h){let u=r.pop();u&&s<r.length&&(r[s]=u)}else n.h===l.h?(l.x+=n.w,l.w-=n.w):n.w===l.w?(l.y+=n.h,l.h-=n.h):(r.push({x:l.x+n.w,y:l.y,w:l.w-n.w,h:n.h}),l.y+=n.h,l.h-=n.h);break}}return{w:a,h:o,fill:t/(a*o)||0}}function ED(e){for(let t of e)if(t.positionedGlyphs.length!==0)return!1;return!0}function SD(e,t){let i=[],r=0;for(let a of t)i.push(e.substring(r,a)),r=a;return r<e.length()&&i.push(e.substring(r,e.length())),i}function CD(e){let t=[],i=0;for(;i<e.length;){if(!v1.test(e[i])){t.push(i),i++;continue}let r=i;for(;r<e.length&&v1.test(e[r]);)r++;let a=e[r];if(a!==void 0&&Y2(a.codePointAt(0))){t.push(r);for(let o=r-1;o>=i;o--)t.push(o);i=r+1}else{for(let o=i;o<r;o++)t.push(o);i=r}}return t}function DD(e){let t=[],i=0;for(let r of e.graphemes())t.push(...Array(r.length).fill(e.sectionIndex[i])),i++;return t}function AD(e,t){let i=t.map((o)=>e.toCodeUnitIndex(o)),r=fu.isParsed()?fu:null;if(e.sections.length===1)return r?r.processBidirectionalText(e.toString(),i).map((o)=>x1(o,e.sections,[...o].map(()=>0))):pD(e.toString(),i).map((o)=>lp([...o],e.sections,[...o].map(()=>0)));let a=DD(e);return r?r.processStyledBidirectionalText(e.text,a,i).map(([o,n])=>x1(o,e.sections,n)):fD(e.text,a,i).map(([o,n])=>{let s=[...o];return lp(s,e.sections,rx(s).map((l)=>n[l]??0))})}function lp(e,t,i){let r=new Ef(e.join(""),t,[]),a=0;for(let o of r.graphemes())r.sectionIndex.push(i[a]??0),a+=[...o].length;return r}function rx(e){let t=[],i=0;for(let r of e)t.push(i),i+=r.length;return t}function x1(e,t,i){let r=[...e],a=rx(r),o=CD(r);return lp(o.map((n)=>r[n]),t,o.map((n)=>i[a[n]]??0))}function cl(e,t,i,r,a,o,n,s,l,u,c,h,d,p,f){let m=Ef.fromFeature(e,a,h===2,t),g=m.determineLineBreaks(u,o,t,r,p),_=K2(m.text)?AD(m,g):SD(m,g),y=[],v={positionedLines:y,text:m.toString(),top:c[1],bottom:c[1],left:c[0],right:c[0],writingMode:h,iconsInText:!1,verticalizable:!1};return FD(v,t,i,r,_,n,s,l,h,u,d,f),!ED(y)&&v}function ec(e){let t=0.5,i=0.5;switch(e){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0}switch(e){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:t,verticalAlign:i}}function MD(e,t,i){let r=t.getMaxScale()*24,{maxImageWidth:a,maxImageHeight:o}=t.getMaxImageSize(e),n=Math.max(r,o*i);return{verticalLineContentWidth:Math.max(r,a*i),horizontalLineContentHeight:n}}function ax(e){switch(e){case"top":return 0;case"center":return 0.5;default:return 1}}function PD(e,t){return e?.rect?e:t?{rect:null,metrics:t.metrics}:null}function ox(e,t,i){return!(e===1||!t&&!ms(i)||t&&(rs(i)||X2(i)))}function kl(e){return/\p{Nd}/u.test(String.fromCodePoint(e))}function nx(e){return/\p{Lu}/u.test(String.fromCodePoint(e))}function sx(e){let t=e.some(kl)&&e.every((r)=>kl(r)||Qu(r)),i=e.length<=3&&e.every((r)=>nx(r)||kl(r));return t||i}function lx(e){return(kl(e)||nx(e))&&!X2(e)}function ID(e,t){return t?ox(2,!0,e):!zo(e)||lx(e)||Qu(e)}function kD(e,t,i){let r=!1;for(let a=0;a<e.length;a++){if(t[a])continue;let o=co[e[a]];if(o&&(a===0||t[a-1])&&(a===e.length-1||t[a+1])){if(t[a]=!0,i[a])continue;e[a]=o,r=!0}}return r}function b1(e,t,i){for(;t>=0&&t<e.length&&rs(e[t]);)t+=i;let r=[];for(;t>=0&&t<e.length&&!ms(e[t])&&!rs(e[t]);)r.push(e[t]),t+=i;return!sx(r)&&!r.every(Qu)&&r.some(zo)}function ux(e,t){let i=e.graphemes().slice(),r=i.map((s)=>s.codePointAt(0)),a=i.map((s,l)=>{let u=e.getSection(l);return"fontStack"in u&&!!t[u.fontStack]?.vertical?.[s]}),o=r.map(ms),n=(s)=>!o[s]&&!rs(r[s])&&!("imageName"in e.getSection(s));for(let s=0;s<r.length;s++){if(!n(s))continue;let l=s;for(;l+1<r.length&&n(l+1);)l++;let u=r.slice(s,l+1),c=sx(u),h=u.every(Qu),d=h&&(b1(r,s-1,-1)||b1(r,l+1,1)),p=!c&&u.some(zo);for(let f=s;f<=l;f++)o[f]=c&&lx(r[f])||a[f]&&!d&&(h||!p&&!zo(r[f]));s=l}if(a.some((s,l)=>s&&!o[l])){let s=e.text;if(e.verticalizePunctuation(t,o),e.text!==s)return ux(e,t)}return kD(i,o,a)&&(e.text=i.join(""),e.cachedGraphemes=i),o}function FD(e,t,i,r,a,o,n,s,l,u,c,h){let d=0,p=0,f=0,m=0,g=s==="right"?1:s==="left"?0:0.5,_=24/h,y=0;for(let b of a){b.trim();let w=b.getMaxScale(),T={positionedGlyphs:[],lineOffset:0};e.positionedLines[y]=T;let E=T.positionedGlyphs,S=0;if(!b.length()){p+=o,++y;continue}let A=MD(r,b,_),I=l===2&&!c?ux(b,t):null,R=b.graphemes();for(let C=0;C<R.length;C++){let P=b.getSection(C),B=R[C],N=B.codePointAt(0),L=I?I[C]:ox(l,c,N),W="fontStack"in P&&is(B)&&!t[P.fontStack]?.default?.[B]?[...B]:[B];for(let Q of W){let be={glyph:Q.codePointAt(0),grapheme:Q,imageName:null,x:d,y:p+-17,vertical:L,scale:1,fontStack:"",sectionIndex:b.getSectionIndex(C),metrics:null,rect:null},le;if("fontStack"in P){if(le=RD(P,Q,L,A,t,i),!le)continue;be.fontStack=P.fontStack}else{if(e.iconsInText=!0,P.scale*=_,le=zD(P,L,w,A,r),!le)continue;S=Math.max(S,le.imageOffset),be.imageName=P.imageName}let{rect:je,metrics:Le,baselineOffset:Qe}=le;if(be.y+=Qe,be.scale=P.scale,be.metrics=Le,be.rect=je,E.push(be),!L)d+=Le.advance*P.scale+u;else{e.verticalizable=!0;let Oe="imageName"in P?Le.advance:24;d+=Oe*P.scale+u}}}if(E.length!==0){let C=d-u;f=Math.max(C,f),LD(E,0,E.length-1,g)}d=0;let k=(w-1)*24;T.lineOffset=Math.max(S,k);let M=o*w+S;p+=M,m=Math.max(M,m),++y}let{horizontalAlign:v,verticalAlign:x}=ec(n);BD(e.positionedLines,g,v,x,f,m,o,p,a.length),e.top+=-x*p,e.bottom=e.top+p,e.left+=-v*f,e.right=e.left+f}function RD(e,t,i,r,a,o){let n=i&&a[e.fontStack]?.vertical?.[t]?"vertical":"default",s=o[e.fontStack]?.[n]?.[t],l=a[e.fontStack]?.[n]?.[t],u=PD(s,l);if(u===null)return null;let c;if(i)c=r.verticalLineContentWidth-e.scale*24;else{let h=ax(e.verticalAlign);c=(r.horizontalLineContentHeight-e.scale*24)*h}return{rect:u.rect,metrics:u.metrics,baselineOffset:c}}function zD(e,t,i,r,a){let o=a[e.imageName];if(!o)return null;let{paddedRect:n,displaySize:s}=o,l={width:s[0],height:s[1],left:1,top:-3,advance:t?s[1]:s[0]},u;if(t)u=r.verticalLineContentWidth-s[1]*e.scale;else{let h=ax(e.verticalAlign);u=(r.horizontalLineContentHeight-s[1]*e.scale)*h}let c=(t?s[0]:s[1])*e.scale-24*i;return{rect:n,metrics:l,baselineOffset:u,imageOffset:c}}function LD(e,t,i,r){if(r===0)return;let a=e[i],o=a.metrics.advance*a.scale,n=(e[i].x+o)*r;for(let s=t;s<=i;s++)e[s].x-=n}function BD(e,t,i,r,a,o,n,s,l){let u=(t-i)*a,c=0;c=o===n?-r*l*n+0.5*n:-s*r- -17;for(let h of e)for(let d of h.positionedGlyphs)d.x+=u,d.y+=c}function OD(e,t,i){let{horizontalAlign:r,verticalAlign:a}=ec(i),o=t[0],n=t[1],s=o-e.displaySize[0]*r,l=s+e.displaySize[0],u=n-e.displaySize[1]*a;return{image:e,top:u,bottom:u+e.displaySize[1],left:s,right:l}}function cx(e){let{left:t,top:i}=e,r=e.right-t,a=e.bottom-i,o=e.image.content[2]-e.image.content[0],n=e.image.content[3]-e.image.content[1],s=e.image.textFitWidth??"stretchOrShrink",l=e.image.textFitHeight??"stretchOrShrink",u=o/n;if(l==="proportional"){if(s==="stretchOnly"&&r/a<u||s==="proportional"){let c=Math.ceil(a*u);t*=c/r,r=c}}else if(s==="proportional"&&l==="stretchOnly"&&u!==0&&r/a>u){let c=Math.ceil(r/u);i*=c/a,a=c}return{x1:t,y1:i,x2:t+r,y2:i+a}}function w1(e,t,i,r,a,o,n=1){let s=e.image,l;if(s.content){let v=s.content,x=s.pixelRatio||1;l=[v[0]/x,v[1]/x,s.displaySize[0]-v[2]/x,s.displaySize[1]-v[3]/x]}let u=n>0?o/n:o,c=n>0?1/n:1,h=t.left*u,d=t.right*u,p,f,m,g;i==="width"||i==="both"?(g=a[0]+h-r[3]*c,f=a[0]+d+r[1]*c):(g=a[0]+(h+d-s.displaySize[0])/2,f=g+s.displaySize[0]);let _=t.top*u,y=t.bottom*u;return i==="height"||i==="both"?(p=a[1]+_-r[0]*c,m=a[1]+y+r[2]*c):(p=a[1]+(_+y-s.displaySize[1])/2,m=p+s.displaySize[1]),{image:s,top:p,right:f,bottom:m,left:g,collisionPadding:l}}function E1(e,t){let{expression:i}=t;if(i.kind==="constant")return{kind:"constant",layoutSize:i.evaluate(new Me(e+1))};if(i.kind==="source")return{kind:"source"};if(i.kind==="composite"){let{minZoom:r,maxZoom:a}=jD(i.zoomStops,e);return{kind:"composite",minZoom:r,maxZoom:a,interpolationType:i.interpolationType}}{let r=ND(i),a=i.evaluate(new Me(e+1));return{kind:"camera",zoomStops:i.zoomStops,sizes:r,layoutSize:a,interpolationType:i.interpolationType}}}function jD(e,t){let i=0;for(;i<e.length&&e[i]<=t;)i++;i=Math.max(0,i-1);let r=i;for(;r<e.length&&e[r]<t+1;)r++;return r=Math.min(e.length-1,r),{minZoom:e[i],maxZoom:e[r]}}function ND(e){return e.zoomStops.map((t)=>e.evaluate(new Me(t===-1/0?e.zoomStops[1]-1:t)))}function Df(e,{uSize:t,uSizeT:i},{lowerSize:r,upperSize:a}){return e.kind==="source"?r/128:e.kind==="composite"?Ze.number(r/128,a/128,i):t}function tc(e,t){let i=0,r=0;return e.kind==="constant"?r=e.layoutSize:e.kind==="camera"?r=VD(e,t):e.kind==="composite"&&(i=$D(e,t)),{uSizeT:i,uSize:r}}function VD({zoomStops:e,sizes:t,layoutSize:i,interpolationType:r},a){let o=e.length-1;for(;o>0&&e[o]>a;)o--;let n=Math.min(o+1,e.length-1),s=r?H(ni.interpolationFactor(r,a,e[o],e[n]),0,1):0;return Math.min(Ze.number(t[o],t[n],s),i)}function $D({interpolationType:e,minZoom:t,maxZoom:i},r){return e?H(ni.interpolationFactor(e,r,t,i),0,1):0}function hx(e,t,i,r,a){if(t.segment===void 0||i===0)return!0;let o=t,n=t.segment+1,s=0;for(;s>-i/2;){if(n--,n<0)return!1;s-=e[n].dist(o),o=e[n]}s+=e[n].dist(e[n+1]),n++;let l=[],u=0;for(;s<i/2;){let c=e[n-1],h=e[n],d=e[n+1];if(!d)return!1;let p=c.angleTo(h)-h.angleTo(d);for(p=Math.abs((p+3*Math.PI)%(Math.PI*2)-Math.PI),l.push({distance:s,angleDelta:p}),u+=p;s-l[0].distance>r;)u-=l.shift().angleDelta;if(u>a)return!1;n++,s+=h.dist(d)}return!0}function dx(e){let t=0;for(let i=0;i<e.length-1;i++)t+=e[i].dist(e[i+1]);return t}function px(e,t,i){return e?0.6*t*i:0}function fx(e,t){return Math.max(e?e.right-e.left:0,t?t.right-t.left:0)}function UD(e,t,i,r,a,o){let n=px(i,a,o),s=fx(i,r)*o,l=0,u=dx(e)/2;for(let c=0;c<e.length-1;c++){let h=e[c],d=e[c+1],p=h.dist(d);if(l+p>u){let f=(u-l)/p,m=new vo(Ze.number(h.x,d.x,f),Ze.number(h.y,d.y,f),d.angleTo(h),c);return m._round(),!n||hx(e,m,s,n,t)?m:void 0}l+=p}}function qD(e,t,i,r,a,o,n,s,l){let u=px(r,o,n),c=fx(r,a),h=c*n,d=e[0].x===0||e[0].x===l||e[0].y===0||e[0].y===l;t-h<t/4&&(t=h+t/4);let p=o*2;return mx(e,d?t/2*s%t:(c/2+p)*n*s%t,t,u,i,h,d,!1,l)}function mx(e,t,i,r,a,o,n,s,l){let u=o/2,c=dx(e),h=0,d=t-i,p=[];for(let f=0;f<e.length-1;f++){let m=e[f],g=e[f+1],_=m.dist(g),y=g.angleTo(m);for(;d+i<h+_;){d+=i;let v=(d-h)/_,x=Ze.number(m.x,g.x,v),b=Ze.number(m.y,g.y,v);if(x>=0&&x<l&&b>=0&&b<l&&d-u>=0&&d+u<=c){let w=new vo(x,b,y,f);w._round(),(!r||hx(e,w,o,r,a))&&p.push(w)}}h+=_}return s||p.length||n||(p=mx(e,h/2,i,r,a,o,n,!0,l)),p}function gx(e,t,i,r,a){let o=[];for(let n of e){let s;for(let l=0;l<n.length-1;l++){let u=n[l],c=n[l+1];u.x<t&&c.x<t||(u.x<t?u=new D(t,u.y+(c.y-u.y)*((t-u.x)/(c.x-u.x)))._round():c.x<t&&(c=new D(t,u.y+(c.y-u.y)*((t-u.x)/(c.x-u.x)))._round()),u.y<i&&c.y<i||(u.y<i?u=new D(u.x+(c.x-u.x)*((i-u.y)/(c.y-u.y)),i)._round():c.y<i&&(c=new D(u.x+(c.x-u.x)*((i-u.y)/(c.y-u.y)),i)._round()),u.x>=r&&c.x>=r||(u.x>=r?u=new D(r,u.y+(c.y-u.y)*((r-u.x)/(c.x-u.x)))._round():c.x>=r&&(c=new D(r,u.y+(c.y-u.y)*((r-u.x)/(c.x-u.x)))._round()),u.y>=a&&c.y>=a||(u.y>=a?u=new D(u.x+(c.x-u.x)*((a-u.y)/(c.y-u.y)),a)._round():c.y>=a&&(c=new D(u.x+(c.x-u.x)*((a-u.y)/(c.y-u.y)),a)._round()),s&&u.equals(s[s.length-1])||(s=[u],o.push(s)),s.push(c)))))}}return o}function S1(e,t,i,r,a=1){let o=[],n=e.image,s=n.pixelRatio,l=n.paddedRect.w-2,u=n.paddedRect.h-2,c={x1:e.left,y1:e.top,x2:e.right,y2:e.bottom},h=n.stretchX||[[0,l]],d=n.stretchY||[[0,u]],p=(C,P)=>C+P[1]-P[0],f=h.reduce(p,0),m=d.reduce(p,0),g=l-f,_=u-m,y=0,v=f,x=0,b=m,w=0,T=g,E=0,S=_;if(n.content&&r){let C=n.content,P=C[2]-C[0],B=C[3]-C[1];(n.textFitWidth||n.textFitHeight)&&(c=cx(e)),y=hl(h,0,C[0]),x=hl(d,0,C[1]),v=hl(h,C[0],C[2]),b=hl(d,C[1],C[3]),w=C[0]-y,E=C[1]-x,T=P-v,S=B-b}let A=c.x1,I=c.y1,R=c.x2-A,k=c.y2-I,M=(C,P,B,N)=>{let L=dl(C.stretch-y,v,R,A),W=pl(C.fixed-w,T,C.stretch,f),Q=dl(P.stretch-x,b,k,I),be=pl(P.fixed-E,S,P.stretch,m),le=dl(B.stretch-y,v,R,A),je=pl(B.fixed-w,T,B.stretch,f),Le=dl(N.stretch-x,b,k,I),Qe=pl(N.fixed-E,S,N.stretch,m),Oe=new D(L,Q),It=new D(le,Q),jt=new D(le,Le),Ut=new D(L,Le),vt=a/s,qt=new D(W*vt,be*vt),ir=new D(je*vt,Qe*vt),nt=t*Math.PI/180;if(nt){let ye=Math.sin(nt),j=Math.cos(nt),ue=[j,-ye,ye,j];Oe._matMult(ue),It._matMult(ue),Ut._matMult(ue),jt._matMult(ue)}let hi=C.stretch+C.fixed,di=B.stretch+B.fixed,X=P.stretch+P.fixed,ge=N.stretch+N.fixed;return{tl:Oe,tr:It,bl:Ut,br:jt,tex:{x:n.paddedRect.x+1+hi,y:n.paddedRect.y+1+X,w:di-hi,h:ge-X},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:qt,pixelOffsetBR:ir,minFontScaleX:T*vt/R,minFontScaleY:S*vt/k,isSDF:i}};if(!r||!n.stretchX&&!n.stretchY)o.push(M({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:l+1},{fixed:0,stretch:u+1}));else{let C=C1(h,g,f),P=C1(d,_,m);for(let B=0;B<C.length-1;B++){let N=C[B],L=C[B+1];for(let W=0;W<P.length-1;W++){let Q=P[W],be=P[W+1];o.push(M(N,Q,L,be))}}}return o}function hl(e,t,i){let r=0;for(let a of e)r+=Math.max(t,Math.min(i,a[1]))-Math.max(t,Math.min(i,a[0]));return r}function C1(e,t,i){let r=[{fixed:-1,stretch:0}];for(let[a,o]of e){let n=r[r.length-1];r.push({fixed:a-n.stretch,stretch:n.stretch}),r.push({fixed:a-n.stretch,stretch:n.stretch+(o-a)})}return r.push({fixed:t+1,stretch:i}),r}function dl(e,t,i,r){return e/t*i+r}function pl(e,t,i,r){return e-t*i/r}function GD(e,t,i,r,a,o,n,s){let l=r.layout.get("text-rotate").evaluate(o,{})*Math.PI/180,u=[];for(let c of t.positionedLines)for(let h of c.positionedGlyphs){if(!h.rect)continue;let d=h.rect||{},p=4,f=!0,m=1,g=0,_=(a||s)&&h.vertical,y=h.metrics.advance*h.scale/2;if(s&&t.verticalizable){let B=(h.scale-1)*24,N=(24-h.metrics.width*h.scale)/2;g=c.lineOffset/2-(h.imageName?-N:B)}if(h.imageName){let B=n[h.imageName];f=B.sdf,m=B.pixelRatio,p=1/m}let v=a?[h.x+y,h.y]:[0,0],x=a?[0,0]:[h.x+y+i[0],h.y+i[1]-g],b=[0,0];_&&(b=x,x=[0,0]);let w=h.metrics.isDoubleResolution?2:1,T=(h.metrics.left-p)*h.scale-y+x[0],E=(-h.metrics.top-p)*h.scale+x[1],S=T+d.w/w*h.scale/m,A=E+d.h/w*h.scale/m,I=new D(T,E),R=new D(S,E),k=new D(T,A),M=new D(S,A);if(_){let B=new D(-y,y- -17),N=-Math.PI/2,L=12-y,W=h.imageName?L:0,Q=new D(22-L,-W),be=new D(...b);I._rotateAround(N,B)._add(Q)._add(be),R._rotateAround(N,B)._add(Q)._add(be),k._rotateAround(N,B)._add(Q)._add(be),M._rotateAround(N,B)._add(Q)._add(be)}if(l){let B=Math.sin(l),N=Math.cos(l),L=[N,-B,B,N];I._matMult(L),R._matMult(L),k._matMult(L),M._matMult(L)}let C=new D(0,0),P=new D(0,0);u.push({tl:I,tr:R,bl:k,br:M,tex:d,writingMode:t.writingMode,glyphOffset:v,sectionIndex:h.sectionIndex,isSDF:f,pixelOffsetTL:C,pixelOffsetBR:P,minFontScaleX:0,minFontScaleY:0})}return u}function ZD(e,t=1){let i=Yi.fromPoints(e[0]),r=Math.min(i.width(),i.height()),a=r/2,o=new WD([],HD),{minX:n,minY:s,maxX:l,maxY:u}=i;if(r===0)return new D(n,s);for(let d=n;d<l;d+=r)for(let p=s;p<u;p+=r)o.push(new so(d+a,p+a,a,e));let c=YD(e),h=c;for(;o.length;){let d=o.pop();(d.d>h.d||!h.d)&&(h=d),d.max-h.d<=t||(a=d.h/2,o.push(new so(d.p.x-a,d.p.y-a,a,e)),o.push(new so(d.p.x+a,d.p.y-a,a,e)),o.push(new so(d.p.x-a,d.p.y+a,a,e)),o.push(new so(d.p.x+a,d.p.y+a,a,e)))}return c.d>0&&h.d-c.d<=t?c.p:h.p}function HD(e,t){return t.max-e.max}function XD(e,t){let i=!1,r=1/0;for(let a of t)for(let o=0,n=a.length,s=n-1;o<n;s=o++){let l=a[o],u=a[s];l.y>e.y!=u.y>e.y&&e.x<(u.x-l.x)*(e.y-l.y)/(u.y-l.y)+l.x&&(i=!i),r=Math.min(r,r2(e,l,u))}return(i?1:-1)*Math.sqrt(r)}function YD(e){let t=0,i=0,r=0,a=e[0];for(let o=0,n=a.length,s=n-1;o<n;s=o++){let l=a[o],u=a[s],c=l.x*u.y-u.x*l.y;i+=(l.x+u.x)*c,r+=(l.y+u.y)*c,t+=c*3}return new so(i/t,r/t,0,e)}function _x(e,t){function i(a,o){let n=0,s=0;o<0&&(o=0);let l=o/Math.SQRT2;switch(a){case"top-right":case"top-left":s=l-7;break;case"bottom-right":case"bottom-left":s=-l+7;break;case"bottom":s=-o+7;break;case"top":s=o-7}switch(a){case"top-right":case"bottom-right":n=-l;break;case"top-left":case"bottom-left":n=l;break;case"left":n=o;break;case"right":n=-o}return[n,s]}function r(a,o,n){let s=0,l=0;switch(o=Math.abs(o),n=Math.abs(n),a){case"top-right":case"top-left":case"top":l=n-7;break;case"bottom-right":case"bottom-left":case"bottom":l=-n+7}switch(a){case"top-right":case"bottom-right":case"right":s=-o;break;case"top-left":case"bottom-left":case"left":s=o}return[s,l]}return t[1]===Af?i(e,t[0]):r(e,t[0],t[1])}function yx(e,t,i){let r=e.layout,a=r.get("text-variable-anchor-offset")?.evaluate(t,{},i);if(a){let n=a.values,s=[];for(let l=0;l<n.length;l+=2){let u=s[l]=n[l],c=n[l+1].map((h)=>h*24);u.startsWith("top")?c[1]-=7:u.startsWith("bottom")&&(c[1]+=7),s[l+1]=c}return new yr(s)}let o=r.get("text-variable-anchor");if(o){let n;n=e._unevaluatedLayout.getValue("text-radial-offset")===void 0?r.get("text-offset").evaluate(t,{},i).map((l)=>l*24):[r.get("text-radial-offset").evaluate(t,{},i)*24,Af];let s=[];for(let l of o)s.push(l,_x(l,n));return new yr(s)}return null}function KD(e){e.bucket.createArrays();let t=512*e.bucket.overscaling;e.bucket.tilePixelRatio=z/t,e.bucket.compareText={},e.bucket.iconsNeedLinear=!1;let i=e.bucket.layers[0],r=i.layout,a=i._unevaluatedLayout._values,o={layoutIconSize:a["icon-size"].possiblyEvaluate(new Me(e.bucket.zoom+1),e.canonical),layoutTextSize:a["text-size"].possiblyEvaluate(new Me(e.bucket.zoom+1),e.canonical),textMaxSize:a["text-size"].possiblyEvaluate(new Me(18))};if(e.bucket.textSizeData.kind==="composite"){let{minZoom:c,maxZoom:h}=e.bucket.textSizeData;o.compositeTextSizes=[a["text-size"].possiblyEvaluate(new Me(c),e.canonical),a["text-size"].possiblyEvaluate(new Me(h),e.canonical)]}if(e.bucket.iconSizeData.kind==="composite"){let{minZoom:c,maxZoom:h}=e.bucket.iconSizeData;o.compositeIconSizes=[a["icon-size"].possiblyEvaluate(new Me(c),e.canonical),a["icon-size"].possiblyEvaluate(new Me(h),e.canonical)]}let n=r.get("text-line-height")*24,s=r.get("text-rotation-alignment")!=="viewport"&&r.get("symbol-placement")!=="point",l=r.get("text-keep-upright"),u=r.get("text-size");for(let c of e.bucket.features){let h=r.get("text-font").evaluate(c,{},e.canonical).join(","),d=u.evaluate(c,{},e.canonical),p=o.layoutTextSize.evaluate(c,{},e.canonical),f=o.layoutIconSize.evaluate(c,{},e.canonical),m={horizontal:{},vertical:void 0},g=c.text,_=[0,0];if(g){let b=g.toString(),w=r.get("text-letter-spacing").evaluate(c,{},e.canonical)*24,T=H2(b)?w:0,E=r.get("text-anchor").evaluate(c,{},e.canonical),S=yx(i,c,e.canonical);if(!S){let k=r.get("text-radial-offset").evaluate(c,{},e.canonical);_=k?_x(E,[k*24,Af]):r.get("text-offset").evaluate(c,{},e.canonical).map((M)=>M*24)}let A=s?"center":r.get("text-justify").evaluate(c,{},e.canonical),I=r.get("symbol-placement")==="point"?r.get("text-max-width").evaluate(c,{},e.canonical)*24:1/0,R=()=>{e.bucket.allowVerticalPlacement&&sp(b)&&(m.vertical=cl(g,e.glyphMap,e.glyphPositions,e.imagePositions,h,I,n,E,"left",T,_,2,!0,p,d))};if(!s&&S){let k=new Set;if(A==="auto")for(let C=0;C<S.values.length;C+=2)k.add(cp(S.values[C]));else k.add(A);let M=!1;for(let C of k)if(!m.horizontal[C])if(M)m.horizontal[C]=m.horizontal[0];else{let P=cl(g,e.glyphMap,e.glyphPositions,e.imagePositions,h,I,n,"center",C,T,_,1,!1,p,d);P&&(m.horizontal[C]=P,M=P.positionedLines.length===1)}R()}else{A==="auto"&&(A=cp(E));let k=cl(g,e.glyphMap,e.glyphPositions,e.imagePositions,h,I,n,E,A,T,_,1,!1,p,d);k&&(m.horizontal[A]=k),R(),sp(b)&&s&&l&&(m.vertical=cl(g,e.glyphMap,e.glyphPositions,e.imagePositions,h,I,n,E,A,T,_,2,!1,p,d))}}let y,v=!1;if(c.icon?.name){let b=e.imageMap[c.icon.name];b&&(y=OD(e.imagePositions[c.icon.name],r.get("icon-offset").evaluate(c,{},e.canonical),r.get("icon-anchor").evaluate(c,{},e.canonical)),v=!!b.sdf,e.bucket.sdfIcons===void 0?e.bucket.sdfIcons=v:e.bucket.sdfIcons!==v&&he("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),b.pixelRatio===e.bucket.pixelRatio?r.get("icon-rotate").constantOr(1)!==0&&(e.bucket.iconsNeedLinear=!0):e.bucket.iconsNeedLinear=!0)}let x=vx(m.horizontal)||m.vertical;e.bucket.iconsInText||=x?x.iconsInText:!1,(x||y)&&JD(e.bucket,c,m,y,e.imageMap,o,p,f,_,v,e.canonical,e.subdivisionGranularity,e.hasPromoteId)}e.showCollisionBoxes&&e.bucket.generateCollisionDebugBuffers()}function cp(e){switch(e){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function JD(e,t,i,r,a,o,n,s,l,u,c,h,d){let p=o.textMaxSize.evaluate(t,{});p===void 0&&(p=n);let f=e.layers[0].layout,m=f.get("icon-offset").evaluate(t,{},c),g=vx(i.horizontal),_=n/24,y=e.tilePixelRatio*_,v=e.tilePixelRatio*p/24,x=e.tilePixelRatio*s,b=e.tilePixelRatio*f.get("symbol-spacing"),w=f.get("text-padding")*e.tilePixelRatio,T=pA(f,t,c,e.tilePixelRatio),E=f.get("text-max-angle")/180*Math.PI,S=f.get("text-rotation-alignment")!=="viewport"&&f.get("symbol-placement")!=="point",A=f.get("icon-rotation-alignment").constantOr("viewport")==="map"&&f.get("symbol-placement")!=="point",I=f.get("symbol-placement"),R=b/2,k=f.get("icon-text-fit"),M;r&&k!=="none"&&(e.allowVerticalPlacement&&i.vertical&&(M=w1(r,i.vertical,k,f.get("icon-text-fit-padding"),m,_,s)),g&&(r=w1(r,g,k,f.get("icon-text-fit-padding"),m,_,s)));let C=c?h.line.getGranularityForZoomLevel(c.z):1,P=(B,N)=>{uf(N)||eA(e,N,B,i,r,a,M,e.layers[0],e.collisionBoxArray,t.index,t.sourceLayerIndex,e.index,y,[w,w,w,w],S,l,x,T,A,m,t,o,u,c,n,s,d)};if(I==="line")for(let B of gx(t.geometry,0,0,z,z)){let N=wa(B,C),L=qD(N,b,E,i.vertical||g,r,24,v,e.overscaling,z);for(let W of L){let Q=g;Q&&tA(e,Q.text,R,W)||P(N,W)}}else if(I==="line-center"){for(let B of t.geometry)if(B.length>1){let N=wa(B,C),L=UD(N,E,i.vertical||g,r,24,v);L&&P(N,L)}}else if(t.type==="Polygon")for(let B of Ou(t.geometry,0)){let N=ZD(B,16);P(wa(B[0],C,!0),new vo(N.x,N.y,0))}else if(t.type==="LineString")for(let B of t.geometry){let N=wa(B,C);P(N,new vo(N[0].x,N[0].y,0))}else if(t.type==="Point")for(let B of t.geometry)for(let N of B)P([N],new vo(N.x,N.y,0))}function QD(e,t){let i=e.length,r=t?.values;if(r?.length>0)for(let a=0;a<r.length;a+=2){let o=up[r[a]],n=r[a+1];e.emplaceBack(o,n[0],n[1])}return[i,e.length]}function D1(e,t,i,r,a,o,n,s,l,u,c,h,d,p,f,m){let g=GD(t,i,s,a,o,n,r,e.allowVerticalPlacement),_=e.textSizeData,y=null;_.kind==="source"?(y=[128*a.layout.get("text-size").evaluate(n,{})],y[0]>32640&&he(`${e.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):_.kind==="composite"&&(y=[128*f.compositeTextSizes[0].evaluate(n,{},m),128*f.compositeTextSizes[1].evaluate(n,{},m)],(y[0]>32640||y[1]>32640)&&he(`${e.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),e.addSymbols(e.text,g,y,s,o,n,c,t,u.lineStartIndex,u.lineLength,p,m,l);for(let v of h)d[v]=e.text.placedSymbolArray.length-1;return g.length*4}function vx(e){for(let t in e)return e[t];return null}function eA(e,t,i,r,a,o,n,s,l,u,c,h,d,p,f,m,g,_,y,v,x,b,w,T,E,S,A){let I=e.addToLineVertexArray(t,i),R=s.layout.get("symbol-height-offset").evaluate(x,{},T);R>e.maxHeightOffset&&(e.maxHeightOffset=R);let k,M,C,P,B=0,N=0,L=0,W=0,Q=-1,be=-1,le={},je=(0,ru.default)("");if(e.allowVerticalPlacement&&r.vertical){let j=s.layout.get("text-rotate").evaluate(x,{},T)+90,ue=r.vertical;C=new fl(l,t,u,c,h,ue,d,p,f,j),n&&(P=new fl(l,t,u,c,h,n,g,_,f,j))}if(a){let j=s.layout.get("icon-rotate").evaluate(x,{}),ue=s.layout.get("icon-text-fit")!=="none",K=S1(a,j,w,ue,S),re=n?S1(n,j,w,ue,S):void 0;M=new fl(l,t,u,c,h,a,g,_,!1,j),B=K.length*4;let J=e.iconSizeData,me=null;J.kind==="source"?(me=[128*s.layout.get("icon-size").evaluate(x,{})],me[0]>32640&&he(`${e.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):J.kind==="composite"&&(me=[128*b.compositeIconSizes[0].evaluate(x,{},T),128*b.compositeIconSizes[1].evaluate(x,{},T)],(me[0]>32640||me[1]>32640)&&he(`${e.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),e.addSymbols(e.icon,K,me,v,y,x,0,t,I.lineStartIndex,I.lineLength,-1,T,R),Q=e.icon.placedSymbolArray.length-1,re&&(N=re.length*4,e.addSymbols(e.icon,re,me,v,y,x,2,t,I.lineStartIndex,I.lineLength,-1,T,R),be=e.icon.placedSymbolArray.length-1)}let Le=Object.keys(r.horizontal);for(let j of Le){let ue=r.horizontal[j];k||=(je=(0,ru.default)(ue.text),new fl(l,t,u,c,h,ue,d,p,f,s.layout.get("text-rotate").evaluate(x,{},T)));let K=ue.positionedLines.length===1;if(L+=D1(e,t,ue,o,s,f,x,m,R,I,r.vertical?1:3,K?Le:[j],le,Q,b,T),K)break}r.vertical&&(W+=D1(e,t,r.vertical,o,s,f,x,m,R,I,2,["vertical"],le,be,b,T));let Qe=k?k.boxStartIndex:e.collisionBoxArray.length,Oe=k?k.boxEndIndex:e.collisionBoxArray.length,It=C?C.boxStartIndex:e.collisionBoxArray.length,jt=C?C.boxEndIndex:e.collisionBoxArray.length,Ut=M?M.boxStartIndex:e.collisionBoxArray.length,vt=M?M.boxEndIndex:e.collisionBoxArray.length,qt=P?P.boxStartIndex:e.collisionBoxArray.length,ir=P?P.boxEndIndex:e.collisionBoxArray.length,nt=-1,hi=(j,ue)=>j?.circleDiameter?Math.max(j.circleDiameter,ue):ue;nt=hi(k,nt),nt=hi(C,nt),nt=hi(M,nt),nt=hi(P,nt);let di=+(nt>-1);di&&(nt*=E/24),e.glyphOffsetArray.length>=e.maxGlyphs&&he("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),x.sortKey!==void 0&&e.addToSortKeyRanges(e.symbolInstances.length,x.sortKey);let X=yx(s,x,T),[ge,ye]=QD(e.textAnchorOffsets,X);A&&(je=iA(je,x)),e.symbolInstances.emplaceBack(t.x,t.y,le.right>=0?le.right:-1,le.center>=0?le.center:-1,le.left>=0?le.left:-1,le.vertical||-1,Q,be,je,Qe,Oe,It,jt,Ut,vt,qt,ir,u,L,W,B,N,di,0,d,nt,ge,ye,R)}function tA(e,t,i,r){let a=e.compareText;if(!(t in a))a[t]=[];else{let o=a[t];for(let n=o.length-1;n>=0;n--)if(r.dist(o[n])<i)return!0}return a[t].push(r),!1}function iA(e,t){return t.id==null||t.properties?.cluster?e:(0,ru.default)(String(t.id),e)}function gu(e,t,i){let r="never",a=e.get(t);return a?r=a:e.get(i)&&(r="always"),r}function ml(e,t,i,r,a,o,n,s,l,u,c,h,d,p){let f=s?Math.min(T1,Math.round(s[0])):0,m=s?Math.min(T1,Math.round(s[1])):0;e.emplaceBack(t,i,Math.round(r*32),Math.round(a*32),o,n,(f<<1)+ +!!l,m,u*16,c*16,h*256,d*256,p)}function _u(e,t,i){e.emplaceBack(t.x,t.y,i),e.emplaceBack(t.x,t.y,i),e.emplaceBack(t.x,t.y,i),e.emplaceBack(t.x,t.y,i)}function aA(e){for(let t of e.sections)if(K2(t.text))return!0;return!1}function oA(e){return e.sections.some((t)=>!H2(t.text))}function nA(e){return e.every((t)=>t.every(uf))}function sA(e,t){return t.replace(/{([^{}]+)}/g,(i,r)=>e&&(r in e)?String(e[r]):"")}function pA(e,t,i,r=1){let a=e.get("icon-padding").evaluate(t,{},i)?.values;return[a[0]*r,a[1]*r,a[2]*r,a[3]*r]}function vA(e){let t=[],i=e.id;return i===void 0&&t.push(new O(`layers.${i}`,null,'missing required property "id"')),e.render===void 0&&t.push(new O(`layers.${i}`,null,'missing required method "render"')),e.renderingMode&&e.renderingMode!=="2d"&&e.renderingMode!=="3d"&&t.push(new O(`layers.${i}`,null,'property "renderingMode" must be either "2d" or "3d"')),t}function kh(e,t){if(e.type==="custom")return new xA(e,t);switch(e.type){case"background":return new yA(e,t);case"circle":return new UE(e,t);case"color-relief":return new oS(e,t);case"fill":return new OS(e,t);case"fill-extrusion":return new oC(e,t);case"heatmap":return new HE(e,t);case"hillshade":return new QE(e,t);case"line":return new _C(e,t);case"raster":return new pT(e,t);case"symbol":return new dA(e,t)}}function Fl(e){let t=[];if(typeof e=="string")t.push({id:"default",url:e});else if(e&&e.length>0){let i=[];for(let{id:r,url:a}of e){let o=`${r}${a}`;i.includes(o)||(i.push(o),t.push({id:r,url:a}))}}return t}function A1(e,t,i){try{let r=new URL(e);return r.pathname+=`${t}${i}`,r.toString()}catch{throw Error(`Invalid sprite URL "${e}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}async function bA(e,t,i,r){let a=Fl(e),o=i>1?"@2x":"",n={},s={};for(let{id:l,url:u}of a){let c=await t.transformRequest(A1(u,o,".json"),"SpriteJSON");n[l]=Pu(c,r);let h=await t.transformRequest(A1(u,o,".png"),"SpriteImage");s[l]=_r.getImage(h,r)}return await Promise.all([...Object.values(n),...Object.values(s)]),wA(n,s)}async function wA(e,t){let i={};for(let r in e){i[r]={};let a=(await t[r]).data;if(!a)throw Error(`Could not load sprite image for ${r}: the response is empty`);let o=li.getImageCanvasContext(a),n=(await e[r]).data;for(let s in n){let{width:l,height:u,x:c,y:h,sdf:d,pixelRatio:p,stretchX:f,stretchY:m,content:g,textFitWidth:_,textFitHeight:y}=n[s],v={width:l,height:u,x:c,y:h,context:o};i[r][s]={data:null,pixelRatio:p,sdf:d,stretchX:f,stretchY:m,content:g,textFitWidth:_,textFitHeight:y,spriteData:v}}}return i}function DA(e){let t=/^u\+([0-9a-f]*)(\?+)$/i.exec(e);if(t){let[,a,o]=t;return a.length+o.length>6?null:M1(parseInt(`${a}${"0".repeat(o.length)}`,16),parseInt(`${a}${"f".repeat(o.length)}`,16))}let i=/^u\+([0-9a-f]{1,6})(?:-([0-9a-f]{1,6}))?$/i.exec(e);if(!i)return null;let r=parseInt(i[1],16);return M1(r,i[2]===void 0?r:parseInt(i[2],16))}function M1(e,t){return e>t||e>pp?null:{start:e,end:Math.min(t,pp)}}function AA(e,t){return e.ranges.some(({start:i,end:r})=>t>=i&&t<=r)}function P1(e,t,i,r,a,o,n,s,l,u=0){for(let c=t+u;c<t+r-u;c++)I1(e,i*o+c,o,a,n,s,l);for(let c=i;c<i+a;c++)I1(e,c*o+t,1,r,n,s,l)}function I1(e,t,i,r,a,o,n){o[0]=0,n[0]=-100000000000000000000,n[1]=fp,a[0]=e[t];for(let s=1,l=0;s<r;s++){let u=a[s]=e[t+s*i],c=s*s,h;do{let d=o[l];h=(u-a[d]+c-d*d)/(s-d)/2}while(h<=n[l]&&--l>-1);l++,o[l]=s,n[l]=h,n[l+1]=fp}for(let s=0,l=0;s<r;s++){for(;n[l+1]<s;)l++;let u=o[l],c=s-u;e[t+s*i]=a[u]+c*c}}function FA(e,t){return e.bitmap.width===t.bitmap.width&&e.bitmap.height===t.bitmap.height&&e.metrics.width===t.metrics.width&&e.metrics.height===t.metrics.height&&e.metrics.left===t.metrics.left&&e.metrics.top===t.metrics.top&&e.metrics.advance===t.metrics.advance&&e.bitmap.data.every((i,r)=>i===t.bitmap.data[r])}function VA(e){return e<60?0:e<70?(e-60)/10:1}function qA(e,t,i){if(e)for(let r of e){let a=t[r];if(a?.source===i&&a.type==="fill-extrusion")return!0}else for(let r in t){let a=t[r];if(a.source===i&&a.type==="fill-extrusion")return!0}return!1}function GA(e,t,i,r,a,o,n,s){let l=qA(a?.layers??null,t,e.id),u=V(o).maxPitchScaleFactor(o),c=e.tilesIn(r,u,l,o,n);c.sort(wx);let h=[];for(let d of c)h.push({wrappedTileID:d.tileID.wrapped().key,queryResults:d.tile.queryRenderedFeatures(t,i,e.getState(),d.queryGeometry,d.cameraQueryGeometry,d.scale,a,o,n,u,s?(p,f)=>s(d.tileID,p,f):void 0)});return XA(HA(h),e)}function WA(e,t,i,r,a,o,n,s){let l={},u=o.queryRenderedSymbols(r),c=[];for(let h of Object.keys(u).map(Number))c.push(n[h]);c.sort(wx);for(let h of c){let d=h.featureIndex.lookupSymbolFeatures(u[h.bucketInstanceId],t,h.bucketIndex,h.sourceLayerIndex,{filterSpec:a.filter,globalState:a.globalState,worldCoordinateHelper:s},a.layers,a.availableImages,e);for(let p in d){l[p]||=[];let f=d[p];f.sort((m,g)=>{let _=h.featureSortOrder;if(_){let y=_.indexOf(m.featureIndex);return _.indexOf(g.featureIndex)-y}return g.featureIndex-m.featureIndex});for(let m of f)l[p].push(m)}}return YA(l,e,i)}function ZA(e,t){let i=e.getRenderableIds().map((o)=>e.getTileByID(o)),r=[],a={};for(let o of i){let n=o.tileID.canonical.key;a[n]||(a[n]=!0,o.querySourceFeatures(r,t))}return r}function wx(e,t){let i=e.tileID,r=t.tileID;return i.overscaledZ-r.overscaledZ||i.canonical.y-r.canonical.y||i.wrap-r.wrap||i.canonical.x-r.canonical.x}function HA(e){let t={},i={};for(let{queryResults:r,wrappedTileID:a}of e){i[a]||={};let o=i[a];for(let n in r){let s=r[n];o[n]||={};let l=o[n];t[n]||=[];for(let u of s)l[u.featureIndex]||(l[u.featureIndex]=!0,t[n].push(u))}}return t}function XA(e,t){for(let i in e)for(let r of e[i])Tx(r,t);return e}function YA(e,t,i){for(let r in e)for(let a of e[r]){let o=i[t[r].source];Tx(a,o)}return e}function Tx(e,t){let i=e.feature,r=t.getFeatureState(i.layer["source-layer"],i.id);i.source=i.layer.source,i.layer["source-layer"]&&(i.sourceLayer=i.layer["source-layer"]),i.state=r}async function Ex(e,t,i,r){let a=e;if(e.url?a=(await Pu(await t.transformRequest(e.url,"Source"),i)).data:await li.frameAsync(i,r),!a)return null;let o=Au(ee(a,e),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding","sparse"]);return"vector_layers"in a&&a.vector_layers&&(o.vectorLayerIds=a.vector_layers.map((n)=>n.id)),o}function vu(e,t){return t?e.properties[t]:e.id}function QA(e,t){let i=new Map;if(e==null||e.type==null)return i;if(e.type==="Feature"){let r=vu(e,t);return r==null?void 0:(i.set(r,e),i)}if(e.type==="FeatureCollection"){let r=new Set;for(let a of e.features){let o=vu(a,t);if(o==null||r.has(o))return;r.add(o),i.set(o,a)}return i}}function eM(e,t,i){let r=[];if(t.removeAll)e.clear();else if(t.remove)for(let a of t.remove){let o=e.get(a);o&&(r.push(o.geometry),e.delete(a))}if(t.add)for(let a of t.add){let o=vu(a,i);if(o==null)continue;let n=e.get(o);n&&r.push(n.geometry),r.push(a.geometry),e.set(o,a)}if(t.update)for(let a of t.update){let o=e.get(a.id);if(!o)continue;let n=!!a.newGeometry,s=a.removeAllProperties||a.removeProperties?.length>0||a.addOrUpdateProperties?.length>0;if(!n&&!s)continue;r.push(o.geometry);let l={...o};if(e.set(a.id,l),n&&(r.push(a.newGeometry),l.geometry=a.newGeometry),s){if(l.properties=a.removeAllProperties?{}:{...l.properties||{}},a.removeProperties)for(let u of a.removeProperties)delete l.properties[u];if(a.addOrUpdateProperties)for(let{key:u,value:c}of a.addOrUpdateProperties)l.properties[u]=c}}return r}function tM(e,t,i){if(!e)return t||{};if(!t)return e||{};let r=F1(e,i),a=F1(t,i);iM(r,a);let o={};if((r.removeAll||a.removeAll)&&(o.removeAll=!0),o.remove=new Set([...r.remove,...a.remove]),o.add=new Map([...r.add,...a.add]),o.update=new Map([...r.update,...a.update]),o.remove.size&&o.add.size)for(let n of o.add.keys())o.remove.delete(n);return aM(o)}function iM(e,t){t.removeAll&&(e.add.clear(),e.update.clear(),e.remove.clear(),t.remove.clear());for(let i of t.remove)e.add.delete(i),e.update.delete(i);for(let i of t.add.keys())e.update.delete(i);for(let[i,r]of t.update){let a=e.update.get(i);a&&(t.update.set(i,rM(a,r)),e.update.delete(i))}}function rM(e,t){let i={id:e.id};if(t.removeAllProperties&&(delete e.removeProperties,delete e.addOrUpdateProperties,delete t.removeProperties),t.removeProperties&&e.addOrUpdateProperties){let r=new Set(t.removeProperties);e.addOrUpdateProperties=e.addOrUpdateProperties.filter((a)=>!r.has(a.key))}return(e.removeAllProperties||t.removeAllProperties)&&(i.removeAllProperties=!0),(e.removeProperties||t.removeProperties)&&(i.removeProperties=[...e.removeProperties||[],...t.removeProperties||[]]),(e.addOrUpdateProperties||t.addOrUpdateProperties)&&(i.addOrUpdateProperties=[...e.addOrUpdateProperties||[],...t.addOrUpdateProperties||[]]),(e.newGeometry||t.newGeometry)&&(i.newGeometry=t.newGeometry||e.newGeometry),i}function F1(e,t){if(!e)return{};let i={};return i.removeAll=e.removeAll,i.remove=new Set(e.remove||[]),i.add=new Map(e.add?.map((r)=>[vu(r,t),r])),i.update=new Map(e.update?.map((r)=>[r.id,r])),i}function aM(e){let t={};return e.removeAll&&(t.removeAll=e.removeAll),e.remove&&(t.remove=Array.from(e.remove)),e.add&&(t.add=Array.from(e.add.values())),e.update&&(t.update=Array.from(e.update.values())),t}function Dx(e){return!e||e.length===0?[]:typeof e[0]=="number"?[e]:e.flatMap((t)=>Dx(t))}function Rl(e){return e?e.type==="GeometryCollection"?e.geometries.flatMap((t)=>Rl(t)):Dx(e.coordinates):[]}function R1(e){let t=new Nr,i;switch(e.type){case"FeatureCollection":i=e.features.flatMap((r)=>Rl(r.geometry));break;case"Feature":i=Rl(e.geometry);break;default:i=Rl(e)}if(i.length===0)return t;for(let r of i){let[a,o]=r;t.extend([a,o])}return t}function oM({x:e,y:t,z:i},r,a){let o=2**i,{west:n,south:s,east:l,north:u}=YT(a,(e-r)/o,(t-r)/o,(e+1+r)/o,(t+1+r)/o);return new Nr([n,s],[l,u])}function rc(e){return typeof e=="string"?uM.get(e):void 0}function pM(e){e*=Math.PI/180;let t=Math.sin(e),i=Math.cos(e);return[(2*i+1)/3,(-Math.sqrt(3)*t-i+1)/3,(Math.sqrt(3)*t-i+1)/3]}function fM(e){return e>0?1/(1-e):1+e}function mM(e){return e>0?1-1/(1.001-e):-e}function Ax(e,t){let i=gM(t,"16bit"),r=ba.deserialize({arrayBuffer:i.vertices,length:i.vertices.byteLength/2/2}),a=xr.deserialize({arrayBuffer:i.indices,length:i.indices.byteLength/2/3});return new as(e.createVertexBuffer(r,ho.members),e.createIndexBuffer(a),tt.simpleSegment(0,0,r.length,a.length))}function gM(e,t){let i=e.granularity===void 0?1:Math.max(e.granularity,1),r=i+(e.generateBorders?2:0),a=i+(e.extendToNorthPole||e.generateBorders?1:0)+(e.extendToSouthPole||e.generateBorders?1:0),o=r+1,n=a+1,s=e.generateBorders?-1:0,l=e.generateBorders||e.extendToNorthPole?-1:0,u=i+ +!!e.generateBorders,c=i+(e.generateBorders||e.extendToSouthPole?1:0),h=o*n,d=r*a*6,p=o*n>65536;if(p&&t==="16bit")throw Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");let f=p||t==="32bit",m=new Int16Array(h*2),g=0;for(let v=l;v<=c;v++)for(let x=s;x<=u;x++){let b=x/i*z;x===-1&&(b=-64),x===i+1&&(b=8256);let w=v/i*z;v===-1&&(w=e.extendToNorthPole?Pn:-64),v===i+1&&(w=e.extendToSouthPole?In:8256),m[g++]=b,m[g++]=w}let _=f?new Uint32Array(d):new Uint16Array(d),y=0;for(let v=0;v<a;v++)for(let x=0;x<r;x++){let b=x+v*o,w=x+1+v*o,T=x+(v+1)*o,E=x+1+(v+1)*o;_[y++]=b,_[y++]=T,_[y++]=w,_[y++]=w,_[y++]=T,_[y++]=E}return{vertices:m.buffer.slice(0),indices:_.buffer.slice(0),uses32bitIndices:f}}function _M(e){let t=Yi.fromPoints(e),i=t.width(),r=t.height(),a=Math.max(0,Math.floor(-Math.log(Math.max(i,r))/Math.LN2)),o=2**a;return new Xu(a,Math.floor((t.minX+t.maxX)/2*o),Math.floor((t.minY+t.maxY)/2*o))}function yM(e){let t=e[1].x-e[0].x,i=e[1].y-e[0].y,r=e[2].x-e[0].x;return t*(e[2].y-e[0].y)-i*r<0}function vM(e,t){if(t==="flat"||Mx(e))return xo;let[i,r,a,o]=e,n=i.x-r.x+a.x-o.x,s=i.y-r.y+a.y-o.y,l=[r.x-a.x,r.y-a.y,o.x-a.x,o.y-a.y],[u,c,h,d]=l,p=_5(l),f=(n*d-h*s)/p,m=(u*s-n*c)/p,g=[1,1+f,1+f+m,1+m],_=Math.max(...g)/Math.min(...g),y=t==="perspective"?0:xM(_);return!(_>=1&&_<=512)||y>=1?xo:[f,m,y]}function xM(e){let t=(1-4/e)/0.9921875;return Math.max(0,t)}function Mx(e){let[t,i,r,a]=e;return t.x+r.x===i.x+a.x&&t.y+r.y===i.y+a.y}function CM(e,t){let i={};if(!t)return i;for(let r of e){let a=r.layerIds.map((o)=>t.getLayer(o)).filter(Boolean);if(a.length!==0){r.layers=a,r.stateDependentLayerIds&&(r.stateDependentLayers=r.stateDependentLayerIds.map((o)=>a.filter((n)=>n.id===o)[0]));for(let o of a)i[o.id]=r}}return i}function Lf(e,t){return e-e%t}function MM(e){return Lf(e+31,32)}function Rx(e){if(!Number.isFinite(e)||e<=0)return zf;let t=Lf(Math.floor(e),256);return t===0?256:t}function PM(e){let t=e>>>0;return((t&255)<<24|(t&65280)<<8|t>>>8&65280|t>>>24&255)>>>0}function IM(e,t,i,r){let a=r,o=e[t]>>>0,n=e[t+1]>>>0;i[a++]=o>>>0&3,i[a++]=o>>>2&3,i[a++]=o>>>4&3,i[a++]=o>>>6&3,i[a++]=o>>>8&3,i[a++]=o>>>10&3,i[a++]=o>>>12&3,i[a++]=o>>>14&3,i[a++]=o>>>16&3,i[a++]=o>>>18&3,i[a++]=o>>>20&3,i[a++]=o>>>22&3,i[a++]=o>>>24&3,i[a++]=o>>>26&3,i[a++]=o>>>28&3,i[a++]=o>>>30&3,i[a++]=n>>>0&3,i[a++]=n>>>2&3,i[a++]=n>>>4&3,i[a++]=n>>>6&3,i[a++]=n>>>8&3,i[a++]=n>>>10&3,i[a++]=n>>>12&3,i[a++]=n>>>14&3,i[a++]=n>>>16&3,i[a++]=n>>>18&3,i[a++]=n>>>20&3,i[a++]=n>>>22&3,i[a++]=n>>>24&3,i[a++]=n>>>26&3,i[a++]=n>>>28&3,i[a]=n>>>30&3}function kM(e,t,i,r){let a=r,o=e[t]>>>0,n=e[t+1]>>>0,s=e[t+2]>>>0;i[a++]=o>>>0&7,i[a++]=o>>>3&7,i[a++]=o>>>6&7,i[a++]=o>>>9&7,i[a++]=o>>>12&7,i[a++]=o>>>15&7,i[a++]=o>>>18&7,i[a++]=o>>>21&7,i[a++]=o>>>24&7,i[a++]=o>>>27&7,i[a++]=(o>>>30|(n&1)<<2)&7,i[a++]=n>>>1&7,i[a++]=n>>>4&7,i[a++]=n>>>7&7,i[a++]=n>>>10&7,i[a++]=n>>>13&7,i[a++]=n>>>16&7,i[a++]=n>>>19&7,i[a++]=n>>>22&7,i[a++]=n>>>25&7,i[a++]=n>>>28&7,i[a++]=(n>>>31|(s&3)<<1)&7,i[a++]=s>>>2&7,i[a++]=s>>>5&7,i[a++]=s>>>8&7,i[a++]=s>>>11&7,i[a++]=s>>>14&7,i[a++]=s>>>17&7,i[a++]=s>>>20&7,i[a++]=s>>>23&7,i[a++]=s>>>26&7,i[a]=s>>>29&7}function FM(e,t,i,r){let a=r,o=e[t]>>>0,n=e[t+1]>>>0,s=e[t+2]>>>0,l=e[t+3]>>>0;i[a++]=o>>>0&15,i[a++]=o>>>4&15,i[a++]=o>>>8&15,i[a++]=o>>>12&15,i[a++]=o>>>16&15,i[a++]=o>>>20&15,i[a++]=o>>>24&15,i[a++]=o>>>28&15,i[a++]=n>>>0&15,i[a++]=n>>>4&15,i[a++]=n>>>8&15,i[a++]=n>>>12&15,i[a++]=n>>>16&15,i[a++]=n>>>20&15,i[a++]=n>>>24&15,i[a++]=n>>>28&15,i[a++]=s>>>0&15,i[a++]=s>>>4&15,i[a++]=s>>>8&15,i[a++]=s>>>12&15,i[a++]=s>>>16&15,i[a++]=s>>>20&15,i[a++]=s>>>24&15,i[a++]=s>>>28&15,i[a++]=l>>>0&15,i[a++]=l>>>4&15,i[a++]=l>>>8&15,i[a++]=l>>>12&15,i[a++]=l>>>16&15,i[a++]=l>>>20&15,i[a++]=l>>>24&15,i[a]=l>>>28&15}function RM(e,t,i,r){let a=r,o=e[t]>>>0,n=e[t+1]>>>0,s=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0;i[a++]=o>>>0&31,i[a++]=o>>>5&31,i[a++]=o>>>10&31,i[a++]=o>>>15&31,i[a++]=o>>>20&31,i[a++]=o>>>25&31,i[a++]=(o>>>30|(n&7)<<2)&31,i[a++]=n>>>3&31,i[a++]=n>>>8&31,i[a++]=n>>>13&31,i[a++]=n>>>18&31,i[a++]=n>>>23&31,i[a++]=(n>>>28|(s&1)<<4)&31,i[a++]=s>>>1&31,i[a++]=s>>>6&31,i[a++]=s>>>11&31,i[a++]=s>>>16&31,i[a++]=s>>>21&31,i[a++]=s>>>26&31,i[a++]=(s>>>31|(l&15)<<1)&31,i[a++]=l>>>4&31,i[a++]=l>>>9&31,i[a++]=l>>>14&31,i[a++]=l>>>19&31,i[a++]=l>>>24&31,i[a++]=(l>>>29|(u&3)<<3)&31,i[a++]=u>>>2&31,i[a++]=u>>>7&31,i[a++]=u>>>12&31,i[a++]=u>>>17&31,i[a++]=u>>>22&31,i[a]=u>>>27&31}function zM(e,t,i,r){let a=r,o=e[t]>>>0,n=e[t+1]>>>0,s=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,c=e[t+5]>>>0;i[a++]=o>>>0&63,i[a++]=o>>>6&63,i[a++]=o>>>12&63,i[a++]=o>>>18&63,i[a++]=o>>>24&63,i[a++]=(o>>>30|(n&15)<<2)&63,i[a++]=n>>>4&63,i[a++]=n>>>10&63,i[a++]=n>>>16&63,i[a++]=n>>>22&63,i[a++]=(n>>>28|(s&3)<<4)&63,i[a++]=s>>>2&63,i[a++]=s>>>8&63,i[a++]=s>>>14&63,i[a++]=s>>>20&63,i[a++]=s>>>26&63,i[a++]=l>>>0&63,i[a++]=l>>>6&63,i[a++]=l>>>12&63,i[a++]=l>>>18&63,i[a++]=l>>>24&63,i[a++]=(l>>>30|(u&15)<<2)&63,i[a++]=u>>>4&63,i[a++]=u>>>10&63,i[a++]=u>>>16&63,i[a++]=u>>>22&63,i[a++]=(u>>>28|(c&3)<<4)&63,i[a++]=c>>>2&63,i[a++]=c>>>8&63,i[a++]=c>>>14&63,i[a++]=c>>>20&63,i[a]=c>>>26&63}function LM(e,t,i,r){let a=r,o=e[t]>>>0,n=e[t+1]>>>0,s=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,c=e[t+5]>>>0,h=e[t+6]>>>0;i[a++]=o>>>0&127,i[a++]=o>>>7&127,i[a++]=o>>>14&127,i[a++]=o>>>21&127,i[a++]=(o>>>28|(n&7)<<4)&127,i[a++]=n>>>3&127,i[a++]=n>>>10&127,i[a++]=n>>>17&127,i[a++]=n>>>24&127,i[a++]=(n>>>31|(s&63)<<1)&127,i[a++]=s>>>6&127,i[a++]=s>>>13&127,i[a++]=s>>>20&127,i[a++]=(s>>>27|(l&3)<<5)&127,i[a++]=l>>>2&127,i[a++]=l>>>9&127,i[a++]=l>>>16&127,i[a++]=l>>>23&127,i[a++]=(l>>>30|(u&31)<<2)&127,i[a++]=u>>>5&127,i[a++]=u>>>12&127,i[a++]=u>>>19&127,i[a++]=(u>>>26|(c&1)<<6)&127,i[a++]=c>>>1&127,i[a++]=c>>>8&127,i[a++]=c>>>15&127,i[a++]=c>>>22&127,i[a++]=(c>>>29|(h&15)<<3)&127,i[a++]=h>>>4&127,i[a++]=h>>>11&127,i[a++]=h>>>18&127,i[a]=h>>>25&127}function BM(e,t,i,r){let a=r,o=e[t]>>>0,n=e[t+1]>>>0,s=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,c=e[t+5]>>>0,h=e[t+6]>>>0,d=e[t+7]>>>0;i[a++]=o>>>0&255,i[a++]=o>>>8&255,i[a++]=o>>>16&255,i[a++]=o>>>24&255,i[a++]=n>>>0&255,i[a++]=n>>>8&255,i[a++]=n>>>16&255,i[a++]=n>>>24&255,i[a++]=s>>>0&255,i[a++]=s>>>8&255,i[a++]=s>>>16&255,i[a++]=s>>>24&255,i[a++]=l>>>0&255,i[a++]=l>>>8&255,i[a++]=l>>>16&255,i[a++]=l>>>24&255,i[a++]=u>>>0&255,i[a++]=u>>>8&255,i[a++]=u>>>16&255,i[a++]=u>>>24&255,i[a++]=c>>>0&255,i[a++]=c>>>8&255,i[a++]=c>>>16&255,i[a++]=c>>>24&255,i[a++]=h>>>0&255,i[a++]=h>>>8&255,i[a++]=h>>>16&255,i[a++]=h>>>24&255,i[a++]=d>>>0&255,i[a++]=d>>>8&255,i[a++]=d>>>16&255,i[a]=d>>>24&255}function OM(e,t,i,r){let a=r,o=e[t]>>>0,n=e[t+1]>>>0,s=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,c=e[t+5]>>>0,h=e[t+6]>>>0,d=e[t+7]>>>0,p=e[t+8]>>>0;i[a++]=o>>>0&511,i[a++]=o>>>9&511,i[a++]=o>>>18&511,i[a++]=(o>>>27|(n&15)<<5)&511,i[a++]=n>>>4&511,i[a++]=n>>>13&511,i[a++]=n>>>22&511,i[a++]=(n>>>31|(s&255)<<1)&511,i[a++]=s>>>8&511,i[a++]=s>>>17&511,i[a++]=(s>>>26|(l&7)<<6)&511,i[a++]=l>>>3&511,i[a++]=l>>>12&511,i[a++]=l>>>21&511,i[a++]=(l>>>30|(u&127)<<2)&511,i[a++]=u>>>7&511,i[a++]=u>>>16&511,i[a++]=(u>>>25|(c&3)<<7)&511,i[a++]=c>>>2&511,i[a++]=c>>>11&511,i[a++]=c>>>20&511,i[a++]=(c>>>29|(h&63)<<3)&511,i[a++]=h>>>6&511,i[a++]=h>>>15&511,i[a++]=(h>>>24|(d&1)<<8)&511,i[a++]=d>>>1&511,i[a++]=d>>>10&511,i[a++]=d>>>19&511,i[a++]=(d>>>28|(p&31)<<4)&511,i[a++]=p>>>5&511,i[a++]=p>>>14&511,i[a]=p>>>23&511}function jM(e,t,i,r){let a=r,o=e[t]>>>0,n=e[t+1]>>>0,s=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,c=e[t+5]>>>0,h=e[t+6]>>>0,d=e[t+7]>>>0,p=e[t+8]>>>0,f=e[t+9]>>>0;i[a++]=o>>>0&1023,i[a++]=o>>>10&1023,i[a++]=o>>>20&1023,i[a++]=(o>>>30|(n&255)<<2)&1023,i[a++]=n>>>8&1023,i[a++]=n>>>18&1023,i[a++]=(n>>>28|(s&63)<<4)&1023,i[a++]=s>>>6&1023,i[a++]=s>>>16&1023,i[a++]=(s>>>26|(l&15)<<6)&1023,i[a++]=l>>>4&1023,i[a++]=l>>>14&1023,i[a++]=(l>>>24|(u&3)<<8)&1023,i[a++]=u>>>2&1023,i[a++]=u>>>12&1023,i[a++]=u>>>22&1023,i[a++]=c>>>0&1023,i[a++]=c>>>10&1023,i[a++]=c>>>20&1023,i[a++]=(c>>>30|(h&255)<<2)&1023,i[a++]=h>>>8&1023,i[a++]=h>>>18&1023,i[a++]=(h>>>28|(d&63)<<4)&1023,i[a++]=d>>>6&1023,i[a++]=d>>>16&1023,i[a++]=(d>>>26|(p&15)<<6)&1023,i[a++]=p>>>4&1023,i[a++]=p>>>14&1023,i[a++]=(p>>>24|(f&3)<<8)&1023,i[a++]=f>>>2&1023,i[a++]=f>>>12&1023,i[a]=f>>>22&1023}function NM(e,t,i,r){let a=r,o=e[t]>>>0,n=e[t+1]>>>0,s=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,c=e[t+5]>>>0,h=e[t+6]>>>0,d=e[t+7]>>>0,p=e[t+8]>>>0,f=e[t+9]>>>0,m=e[t+10]>>>0;i[a++]=o>>>0&2047,i[a++]=o>>>11&2047,i[a++]=(o>>>22|(n&1)<<10)&2047,i[a++]=n>>>1&2047,i[a++]=n>>>12&2047,i[a++]=(n>>>23|(s&3)<<9)&2047,i[a++]=s>>>2&2047,i[a++]=s>>>13&2047,i[a++]=(s>>>24|(l&7)<<8)&2047,i[a++]=l>>>3&2047,i[a++]=l>>>14&2047,i[a++]=(l>>>25|(u&15)<<7)&2047,i[a++]=u>>>4&2047,i[a++]=u>>>15&2047,i[a++]=(u>>>26|(c&31)<<6)&2047,i[a++]=c>>>5&2047,i[a++]=c>>>16&2047,i[a++]=(c>>>27|(h&63)<<5)&2047,i[a++]=h>>>6&2047,i[a++]=h>>>17&2047,i[a++]=(h>>>28|(d&127)<<4)&2047,i[a++]=d>>>7&2047,i[a++]=d>>>18&2047,i[a++]=(d>>>29|(p&255)<<3)&2047,i[a++]=p>>>8&2047,i[a++]=p>>>19&2047,i[a++]=(p>>>30|(f&511)<<2)&2047,i[a++]=f>>>9&2047,i[a++]=f>>>20&2047,i[a++]=(f>>>31|(m&1023)<<1)&2047,i[a++]=m>>>10&2047,i[a]=m>>>21&2047}function VM(e,t,i,r){let a=r,o=e[t]>>>0,n=e[t+1]>>>0,s=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,c=e[t+5]>>>0,h=e[t+6]>>>0,d=e[t+7]>>>0,p=e[t+8]>>>0,f=e[t+9]>>>0,m=e[t+10]>>>0,g=e[t+11]>>>0;i[a++]=o>>>0&4095,i[a++]=o>>>12&4095,i[a++]=(o>>>24|(n&15)<<8)&4095,i[a++]=n>>>4&4095,i[a++]=n>>>16&4095,i[a++]=(n>>>28|(s&255)<<4)&4095,i[a++]=s>>>8&4095,i[a++]=s>>>20&4095,i[a++]=l>>>0&4095,i[a++]=l>>>12&4095,i[a++]=(l>>>24|(u&15)<<8)&4095,i[a++]=u>>>4&4095,i[a++]=u>>>16&4095,i[a++]=(u>>>28|(c&255)<<4)&4095,i[a++]=c>>>8&4095,i[a++]=c>>>20&4095,i[a++]=h>>>0&4095,i[a++]=h>>>12&4095,i[a++]=(h>>>24|(d&15)<<8)&4095,i[a++]=d>>>4&4095,i[a++]=d>>>16&4095,i[a++]=(d>>>28|(p&255)<<4)&4095,i[a++]=p>>>8&4095,i[a++]=p>>>20&4095,i[a++]=f>>>0&4095,i[a++]=f>>>12&4095,i[a++]=(f>>>24|(m&15)<<8)&4095,i[a++]=m>>>4&4095,i[a++]=m>>>16&4095,i[a++]=(m>>>28|(g&255)<<4)&4095,i[a++]=g>>>8&4095,i[a]=g>>>20&4095}function $M(e,t,i,r){let a=r,o=e[t]>>>0,n=e[t+1]>>>0,s=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,c=e[t+5]>>>0,h=e[t+6]>>>0,d=e[t+7]>>>0,p=e[t+8]>>>0,f=e[t+9]>>>0,m=e[t+10]>>>0,g=e[t+11]>>>0,_=e[t+12]>>>0,y=e[t+13]>>>0,v=e[t+14]>>>0,x=e[t+15]>>>0;i[a++]=o>>>0&65535,i[a++]=o>>>16&65535,i[a++]=n>>>0&65535,i[a++]=n>>>16&65535,i[a++]=s>>>0&65535,i[a++]=s>>>16&65535,i[a++]=l>>>0&65535,i[a++]=l>>>16&65535,i[a++]=u>>>0&65535,i[a++]=u>>>16&65535,i[a++]=c>>>0&65535,i[a++]=c>>>16&65535,i[a++]=h>>>0&65535,i[a++]=h>>>16&65535,i[a++]=d>>>0&65535,i[a++]=d>>>16&65535,i[a++]=p>>>0&65535,i[a++]=p>>>16&65535,i[a++]=f>>>0&65535,i[a++]=f>>>16&65535,i[a++]=m>>>0&65535,i[a++]=m>>>16&65535,i[a++]=g>>>0&65535,i[a++]=g>>>16&65535,i[a++]=_>>>0&65535,i[a++]=_>>>16&65535,i[a++]=y>>>0&65535,i[a++]=y>>>16&65535,i[a++]=v>>>0&65535,i[a++]=v>>>16&65535,i[a++]=x>>>0&65535,i[a]=x>>>16&65535}function UM(e,t,i,r){let a=r,o=t;for(let n=0;n<8;n++){let s=e[o++]>>>0;i[a++]=s>>>0&1,i[a++]=s>>>1&1,i[a++]=s>>>2&1,i[a++]=s>>>3&1,i[a++]=s>>>4&1,i[a++]=s>>>5&1,i[a++]=s>>>6&1,i[a++]=s>>>7&1,i[a++]=s>>>8&1,i[a++]=s>>>9&1,i[a++]=s>>>10&1,i[a++]=s>>>11&1,i[a++]=s>>>12&1,i[a++]=s>>>13&1,i[a++]=s>>>14&1,i[a++]=s>>>15&1,i[a++]=s>>>16&1,i[a++]=s>>>17&1,i[a++]=s>>>18&1,i[a++]=s>>>19&1,i[a++]=s>>>20&1,i[a++]=s>>>21&1,i[a++]=s>>>22&1,i[a++]=s>>>23&1,i[a++]=s>>>24&1,i[a++]=s>>>25&1,i[a++]=s>>>26&1,i[a++]=s>>>27&1,i[a++]=s>>>28&1,i[a++]=s>>>29&1,i[a++]=s>>>30&1,i[a++]=s>>>31&1}}function qM(e,t,i,r){let a=r,o=t;for(let n=0;n<8;n++){let s=e[o++]>>>0,l=e[o++]>>>0;i[a++]=s>>>0&3,i[a++]=s>>>2&3,i[a++]=s>>>4&3,i[a++]=s>>>6&3,i[a++]=s>>>8&3,i[a++]=s>>>10&3,i[a++]=s>>>12&3,i[a++]=s>>>14&3,i[a++]=s>>>16&3,i[a++]=s>>>18&3,i[a++]=s>>>20&3,i[a++]=s>>>22&3,i[a++]=s>>>24&3,i[a++]=s>>>26&3,i[a++]=s>>>28&3,i[a++]=s>>>30&3,i[a++]=l>>>0&3,i[a++]=l>>>2&3,i[a++]=l>>>4&3,i[a++]=l>>>6&3,i[a++]=l>>>8&3,i[a++]=l>>>10&3,i[a++]=l>>>12&3,i[a++]=l>>>14&3,i[a++]=l>>>16&3,i[a++]=l>>>18&3,i[a++]=l>>>20&3,i[a++]=l>>>22&3,i[a++]=l>>>24&3,i[a++]=l>>>26&3,i[a++]=l>>>28&3,i[a++]=l>>>30&3}}function GM(e,t,i,r){let a=r,o=t;for(let n=0;n<8;n++){let s=e[o++]>>>0,l=e[o++]>>>0,u=e[o++]>>>0;i[a++]=s>>>0&7,i[a++]=s>>>3&7,i[a++]=s>>>6&7,i[a++]=s>>>9&7,i[a++]=s>>>12&7,i[a++]=s>>>15&7,i[a++]=s>>>18&7,i[a++]=s>>>21&7,i[a++]=s>>>24&7,i[a++]=s>>>27&7,i[a++]=(s>>>30|(l&1)<<2)&7,i[a++]=l>>>1&7,i[a++]=l>>>4&7,i[a++]=l>>>7&7,i[a++]=l>>>10&7,i[a++]=l>>>13&7,i[a++]=l>>>16&7,i[a++]=l>>>19&7,i[a++]=l>>>22&7,i[a++]=l>>>25&7,i[a++]=l>>>28&7,i[a++]=(l>>>31|(u&3)<<1)&7,i[a++]=u>>>2&7,i[a++]=u>>>5&7,i[a++]=u>>>8&7,i[a++]=u>>>11&7,i[a++]=u>>>14&7,i[a++]=u>>>17&7,i[a++]=u>>>20&7,i[a++]=u>>>23&7,i[a++]=u>>>26&7,i[a++]=u>>>29&7}}function WM(e,t,i,r){let a=r,o=t;for(let n=0;n<8;n++){let s=e[o++]>>>0,l=e[o++]>>>0,u=e[o++]>>>0,c=e[o++]>>>0;i[a++]=s>>>0&15,i[a++]=s>>>4&15,i[a++]=s>>>8&15,i[a++]=s>>>12&15,i[a++]=s>>>16&15,i[a++]=s>>>20&15,i[a++]=s>>>24&15,i[a++]=s>>>28&15,i[a++]=l>>>0&15,i[a++]=l>>>4&15,i[a++]=l>>>8&15,i[a++]=l>>>12&15,i[a++]=l>>>16&15,i[a++]=l>>>20&15,i[a++]=l>>>24&15,i[a++]=l>>>28&15,i[a++]=u>>>0&15,i[a++]=u>>>4&15,i[a++]=u>>>8&15,i[a++]=u>>>12&15,i[a++]=u>>>16&15,i[a++]=u>>>20&15,i[a++]=u>>>24&15,i[a++]=u>>>28&15,i[a++]=c>>>0&15,i[a++]=c>>>4&15,i[a++]=c>>>8&15,i[a++]=c>>>12&15,i[a++]=c>>>16&15,i[a++]=c>>>20&15,i[a++]=c>>>24&15,i[a++]=c>>>28&15}}function ZM(e,t,i,r){let a=r,o=t;for(let n=0;n<8;n++){let s=e[o++]>>>0,l=e[o++]>>>0,u=e[o++]>>>0,c=e[o++]>>>0,h=e[o++]>>>0;i[a++]=s>>>0&31,i[a++]=s>>>5&31,i[a++]=s>>>10&31,i[a++]=s>>>15&31,i[a++]=s>>>20&31,i[a++]=s>>>25&31,i[a++]=(s>>>30|(l&7)<<2)&31,i[a++]=l>>>3&31,i[a++]=l>>>8&31,i[a++]=l>>>13&31,i[a++]=l>>>18&31,i[a++]=l>>>23&31,i[a++]=(l>>>28|(u&1)<<4)&31,i[a++]=u>>>1&31,i[a++]=u>>>6&31,i[a++]=u>>>11&31,i[a++]=u>>>16&31,i[a++]=u>>>21&31,i[a++]=u>>>26&31,i[a++]=(u>>>31|(c&15)<<1)&31,i[a++]=c>>>4&31,i[a++]=c>>>9&31,i[a++]=c>>>14&31,i[a++]=c>>>19&31,i[a++]=c>>>24&31,i[a++]=(c>>>29|(h&3)<<3)&31,i[a++]=h>>>2&31,i[a++]=h>>>7&31,i[a++]=h>>>12&31,i[a++]=h>>>17&31,i[a++]=h>>>22&31,i[a++]=h>>>27&31}}function HM(e,t,i,r){let a=r,o=t;for(let n=0;n<8;n++){let s=e[o++]>>>0,l=e[o++]>>>0,u=e[o++]>>>0,c=e[o++]>>>0,h=e[o++]>>>0,d=e[o++]>>>0;i[a++]=s>>>0&63,i[a++]=s>>>6&63,i[a++]=s>>>12&63,i[a++]=s>>>18&63,i[a++]=s>>>24&63,i[a++]=(s>>>30|(l&15)<<2)&63,i[a++]=l>>>4&63,i[a++]=l>>>10&63,i[a++]=l>>>16&63,i[a++]=l>>>22&63,i[a++]=(l>>>28|(u&3)<<4)&63,i[a++]=u>>>2&63,i[a++]=u>>>8&63,i[a++]=u>>>14&63,i[a++]=u>>>20&63,i[a++]=u>>>26&63,i[a++]=c>>>0&63,i[a++]=c>>>6&63,i[a++]=c>>>12&63,i[a++]=c>>>18&63,i[a++]=c>>>24&63,i[a++]=(c>>>30|(h&15)<<2)&63,i[a++]=h>>>4&63,i[a++]=h>>>10&63,i[a++]=h>>>16&63,i[a++]=h>>>22&63,i[a++]=(h>>>28|(d&3)<<4)&63,i[a++]=d>>>2&63,i[a++]=d>>>8&63,i[a++]=d>>>14&63,i[a++]=d>>>20&63,i[a++]=d>>>26&63}}function XM(e,t,i,r){let a=r,o=t;for(let n=0;n<8;n++){let s=e[o++]>>>0,l=e[o++]>>>0,u=e[o++]>>>0,c=e[o++]>>>0,h=e[o++]>>>0,d=e[o++]>>>0,p=e[o++]>>>0;i[a++]=s>>>0&127,i[a++]=s>>>7&127,i[a++]=s>>>14&127,i[a++]=s>>>21&127,i[a++]=(s>>>28|(l&7)<<4)&127,i[a++]=l>>>3&127,i[a++]=l>>>10&127,i[a++]=l>>>17&127,i[a++]=l>>>24&127,i[a++]=(l>>>31|(u&63)<<1)&127,i[a++]=u>>>6&127,i[a++]=u>>>13&127,i[a++]=u>>>20&127,i[a++]=(u>>>27|(c&3)<<5)&127,i[a++]=c>>>2&127,i[a++]=c>>>9&127,i[a++]=c>>>16&127,i[a++]=c>>>23&127,i[a++]=(c>>>30|(h&31)<<2)&127,i[a++]=h>>>5&127,i[a++]=h>>>12&127,i[a++]=h>>>19&127,i[a++]=(h>>>26|(d&1)<<6)&127,i[a++]=d>>>1&127,i[a++]=d>>>8&127,i[a++]=d>>>15&127,i[a++]=d>>>22&127,i[a++]=(d>>>29|(p&15)<<3)&127,i[a++]=p>>>4&127,i[a++]=p>>>11&127,i[a++]=p>>>18&127,i[a++]=p>>>25&127}}function YM(e,t,i,r){let a=r,o=t;for(let n=0;n<8;n++){let s=e[o++]>>>0,l=e[o++]>>>0,u=e[o++]>>>0,c=e[o++]>>>0,h=e[o++]>>>0,d=e[o++]>>>0,p=e[o++]>>>0,f=e[o++]>>>0;i[a++]=s>>>0&255,i[a++]=s>>>8&255,i[a++]=s>>>16&255,i[a++]=s>>>24&255,i[a++]=l>>>0&255,i[a++]=l>>>8&255,i[a++]=l>>>16&255,i[a++]=l>>>24&255,i[a++]=u>>>0&255,i[a++]=u>>>8&255,i[a++]=u>>>16&255,i[a++]=u>>>24&255,i[a++]=c>>>0&255,i[a++]=c>>>8&255,i[a++]=c>>>16&255,i[a++]=c>>>24&255,i[a++]=h>>>0&255,i[a++]=h>>>8&255,i[a++]=h>>>16&255,i[a++]=h>>>24&255,i[a++]=d>>>0&255,i[a++]=d>>>8&255,i[a++]=d>>>16&255,i[a++]=d>>>24&255,i[a++]=p>>>0&255,i[a++]=p>>>8&255,i[a++]=p>>>16&255,i[a++]=p>>>24&255,i[a++]=f>>>0&255,i[a++]=f>>>8&255,i[a++]=f>>>16&255,i[a++]=f>>>24&255}}function KM(e,t,i,r){let a=r,o=t;for(let n=0;n<128;n++){let s=e[o++]>>>0;i[a++]=s&65535,i[a++]=s>>>16&65535}}function JM(e,t,i,r,a){let o=gp[a]>>>0,n=t,s=0,l=e[n]>>>0,u=r;for(let c=0;c<8;c++){for(let h=0;h<32;h++)if(s+a<=32){let d=l>>>s&o;i[u+h]=d|0,s+=a,s===32&&(s=0,n++,h!==31&&(l=e[n]>>>0))}else{let d=32-s,p=l>>>s;n++,l=e[n]>>>0;let f=a-d,m=-1>>>32-f>>>0,g=(p|(l&m)<<d)&o;i[u+h]=g|0,s=f}u+=32,s=0,c<7&&(l=e[n]>>>0)}}function zx(){let e=new Uint8Array(QM);return{dataToBePacked:Array(33),dataPointers:new Int32Array(33),byteContainer:e,byteContainerI32:new Int32Array(e.buffer,e.byteOffset,e.byteLength>>>2),exceptionSizes:new Int32Array(33)}}function eP(e=16){if(e<0)throw RangeError(`initialEncodedWordCapacity must be >= 0, got ${e}`);let t=Math.max(16,e|0);return{encodedWords:new Uint32Array(t),decoderWorkspace:zx()}}function tP(e,t){if(t<=e.encodedWords.length)return e.encodedWords;let i=new Uint32Array(Math.max(16,t*2));return e.encodedWords=i,i}function iP(e,t,i,r){r.byteContainer.length<i&&(r.byteContainer=new Uint8Array(i*2),r.byteContainerI32=void 0);let a=r.byteContainer,o=i>>>2;if(a.byteOffset&3)for(let s=0;s<o;s=s+1|0){let l=e[t+s|0]|0,u=s<<2;a[u]=l&255,a[u+1|0]=l>>>8&255,a[u+2|0]=l>>>16&255,a[u+3|0]=l>>>24&255}else{let s=r.byteContainerI32;(!s||s.buffer!==a.buffer||s.byteOffset!==a.byteOffset||s.length<o)&&(s=r.byteContainerI32=new Int32Array(a.buffer,a.byteOffset,a.byteLength>>>2)),s.set(e.subarray(t,t+o))}let n=i&3;if(n>0){let s=e[t+o|0]|0,l=o<<2;for(let u=0;u<n;u=u+1|0)a[l+u|0]=s>>>(u<<3)&255}return a}function rP(e,t,i){let r=e[t++]|0,a=i.dataToBePacked;for(let o=2;o<=32;o=o+1|0){if(!(r>>>o-1&1))continue;if(t>=e.length)throw Error(`FastPFOR decode: truncated exception stream header (bitWidth=${o}, streamWordIndex=${t}, needWords=1, availableWords=${e.length-t}, encodedWords=${e.length})`);let n=e[t++]>>>0,s=MM(n),l=n*o+31>>>5;if(t+l>e.length)throw Error(`FastPFOR decode: truncated exception stream (bitWidth=${o}, size=${n}, streamWordIndex=${t}, needWords=${l}, availableWords=${e.length-t}, encodedWords=${e.length})`);let u=a[o];(!u||u.length<s)&&(u=a[o]=new Uint32Array(s));let c=0;for(;c<n;c=c+32|0)pP(e,t,u,c,o),t=t+o|0;let h=c-n|0;t=t-(h*o>>>5)|0,i.exceptionSizes[o]=n}return t}function aP(e,t,i,r,a){switch(a){case 1:UM(e,t,i,r);break;case 2:qM(e,t,i,r);break;case 3:GM(e,t,i,r);break;case 4:WM(e,t,i,r);break;case 5:ZM(e,t,i,r);break;case 6:HM(e,t,i,r);break;case 7:XM(e,t,i,r);break;case 8:YM(e,t,i,r);break;case 16:KM(e,t,i,r);break;default:JM(e,t,i,r,a)}return t+(a<<3)|0}function oP(e,t,i,r){if(i+2>t)throw Error(`FastPFOR decode: byteContainer underflow at block=${r} (need 2 bytes for [bitWidth, exceptionCount], bytePos=${i}, byteSize=${t})`);let a=e[i++],o=e[i++];if(a>32)throw Error(`FastPFOR decode: invalid bitWidth=${a} at block=${r} (expected 0..32). This likely indicates corrupted or truncated input.`);return{bitWidth:a,exceptionCount:o,bytePosIn:i}}function nP(e,t,i,r,a,o){if(i+1>t)throw Error(`FastPFOR decode: exception header underflow at block=${o} (need 1 byte for maxBits, bytePos=${i}, byteSize=${t})`);let n=e[i++];if(n<r||n>32)throw Error(`FastPFOR decode: invalid maxBits=${n} at block=${o} (bitWidth=${r}, expected ${r}..32)`);let s=n-r|0;if(s<1||s>32)throw Error(`FastPFOR decode: invalid exceptionBitWidth=${s} at block=${o} (bitWidth=${r}, maxBits=${n})`);if(i+a>t)throw Error(`FastPFOR decode: exception positions underflow at block=${o} (need=${a}, have=${t-i})`);return{maxBits:n,exceptionBitWidth:s,bytePosIn:i}}function sP(e,t,i,r,a,o,n,s,l){let{maxBits:u,exceptionBitWidth:c,bytePosIn:h}=nP(a,o,n,i,r,l);if(n=h,c===1){let g=1<<i;for(let _=0;_<r;_=_+1|0){let y=a[n++];e[y+t|0]|=g}return n}let d=s.dataToBePacked[c];if(!d)throw Error(`FastPFOR decode: missing exception stream for exceptionBitWidth=${c} (bitWidth=${i}, maxBits=${u}) at block ${l}`);let p=s.dataPointers,f=p[c]|0,m=s.exceptionSizes[c]|0;if(f+r>m)throw Error(`FastPFOR decode: exception stream overflow for exceptionBitWidth=${c} (ptr=${f}, need ${r}, size=${m}) at block ${l}`);for(let g=0;g<r;g=g+1|0){let _=a[n++],y=d[f++]|0;e[_+t|0]|=y<<i}return p[c]=f,n}function lP(e,t,i,r,a,o,n,s,l,u){let c=i|0,h=0;for(let d=0;d<n;d=d+1|0){let p=oP(s,l,h,d);h=p.bytePosIn;let{bitWidth:f,exceptionCount:m}=p,g=o+d*256|0;switch(f){case 0:a.fill(0,g,g+256);break;case 32:for(let _=0;_<256;_=_+1|0)a[g+_|0]=e[c+_|0]|0;c=c+256|0;break;default:c=aP(e,c,a,g,f)}m>0&&(h=sP(a,g,f,m,s,l,h,u,d))}if(c!==r)throw Error(`FastPFOR decode: packed region mismatch (pageStart=${t}, packedStart=${i}, consumedPackedEnd=${c}, expectedPackedEnd=${r}, packedWords=${r-i}, encoded.length=${e.length})`)}function uP(e,t,i,r,a,o){let n=i|0,s=e[n]|0;if(s<=0||n+s>e.length-1)throw Error(`FastPFOR decode: invalid whereMeta=${s} at pageStart=${n} (expected > 0 and pageStart+whereMeta < encoded.length=${e.length})`);let l=n+1|0,u=n+s|0,c=e[u]>>>0,h=c+3>>>2,d=u+1,p=d+h;if(p>=e.length)throw Error(`FastPFOR decode: invalid byteSize=${c} (metaInts=${h}, pageStart=${n}, packedEnd=${u}, byteContainerStart=${d}) causes bitmapPos=${p} out of bounds (encoded.length=${e.length})`);let f=iP(e,d,c,o),m=c,g=rP(e,p,o);return o.dataPointers.fill(0),lP(e,n,l,u,t,r|0,a/256|0,f,m,o),g}function cP(e,t,i,r,a,o){let n=r+Lf(a,256),s=r,l=i;for(;s!==n;){let u=Math.min(_p,n-s);l=uP(e,t,l,s,u,o),s=s+u|0}return l}function hP(e,t,i,r,a,o){if(o===0)return t;let n=0,s=t,l=t+i,u=a,c=a,h=a+o,d=0,p=0;for(;s<l&&c<h;){let f=e[s]>>>n&255;if(n+=8,s+=n>>>5,n&=31,d|=(f&127)<<p,f&128)r[c++]=d|0,d=0,p=0;else if(p+=7,p>28)throw Error(`FastPFOR VByte: unterminated value (expected MSB=1 terminator within 5 bytes; shift=${p}, partial=${d}, decoded=${c-u}/${o}, inPos=${s}, inEnd=${l})`)}if(c!==h)throw Error(`FastPFOR VByte: truncated stream (decoded=${c-u}, expected=${o}, consumedWords=${s-t}/${i}, vbyteStart=${t}, vbyteEnd=${l})`);return s}function dP(e,t,i){let r=0,a=0,o=new Uint32Array(t),n=i??zx();if(e.length>0){let u=e[r]|0;if(r=r+1|0,u&255)throw Error(`FastPFOR decode: invalid alignedLength=${u} (expected multiple of 256)`);if(a+u>o.length)throw Error(`FastPFOR decode: output buffer too small (outPos=${a}, alignedLength=${u}, out.length=${o.length})`);r=cP(e,o,r,a,u,n),a=a+u|0}let s=e.length-r|0,l=t-a|0;return hP(e,r,s,o,a,l),o}function pP(e,t,i,r,a){switch(a){case 2:IM(e,t,i,r);return;case 3:kM(e,t,i,r);return;case 4:FM(e,t,i,r);return;case 5:RM(e,t,i,r);return;case 6:zM(e,t,i,r);return;case 7:LM(e,t,i,r);return;case 8:BM(e,t,i,r);return;case 9:OM(e,t,i,r);return;case 10:jM(e,t,i,r);return;case 11:NM(e,t,i,r);return;case 12:VM(e,t,i,r);return;case 16:$M(e,t,i,r);return;case 32:for(let u=0;u<32;u=u+1|0)i[r+u|0]=e[t+u|0]|0;return}let o=gp[a]>>>0,n=t,s=0,l=e[n]>>>0;for(let u=0;u<32;u++)if(s+a<=32){let c=l>>>s&o;i[r+u]=c|0,s+=a,s===32&&(s=0,n++,u!==31&&(l=e[n]>>>0))}else{let c=32-s,h=l>>>s;n++,l=e[n]>>>0;let d=gp[a-c]>>>0,p=(h|(l&d)<<c)&o;i[r+u]=p|0,s=a-c}}function fP(e,t,i,r){if(t<0||i<0||t+i>e.length)throw RangeError(`decodeBigEndianInt32sInto: out of bounds (offset=${t}, byteLength=${i}, bytes.length=${e.length})`);let a=Math.floor(i/4),o=i%4!=0,n=o?a+1:a;if(r.length<n)throw RangeError(`decodeBigEndianInt32sInto: out.length=${r.length} < ${n}`);if(a>0){let s=e.byteOffset+t;if(s&3)for(let l=0;l<a;l++){let u=t+l*4;r[l]=e[u]<<24|e[u+1]<<16|e[u+2]<<8|e[u+3]}else{let l=new Uint32Array(e.buffer,s,a);for(let u=0;u<a;u++)r[u]=PM(l[u])|0}}if(o){let s=t+a*4,l=i-a*4,u=0;for(let c=0;c<l;c++)u|=e[s+c]<<24-c*8;r[a]=u|0}return n}function Bt(e,t,i){let r=new Uint32Array(i),a=0,o=t.get();for(let n=0;n<r.length;n++){let s=e[o++],l=s&127;s<128||(s=e[o++],l|=(s&127)<<7,s<128||(s=e[o++],l|=(s&127)<<14,s<128||(s=e[o++],l|=(s&127)<<21,s<128||(s=e[o++],l|=(s&15)<<28)))),r[a++]=l}return t.set(o),r}function Bf(e,t,i){let r=new BigUint64Array(i);for(let a=0;a<r.length;a++)r[a]=mP(e,t);return r}function mP(e,t){let i=0n,r=0,a=t.get();for(;a<e.length;){let o=e[a++];if(i|=BigInt(o&127)<<BigInt(r),!(o&128))break;if(r+=7,r>=64)throw Error("Varint too long")}return t.set(a),i}function gP(e,t,i){let r=new Float64Array(i);for(let a=0;a<i;a++)r[a]=_P(e,t);return r}function _P(e,t){let i,r;return r=e[t.get()],t.increment(),i=r&127,r<128||(r=e[t.get()],t.increment(),i|=(r&127)<<7,r<128)||(r=e[t.get()],t.increment(),i|=(r&127)<<14,r<128)||(r=e[t.get()],t.increment(),i|=(r&127)<<21,r<128)?i:(r=e[t.get()],i|=(r&15)<<28,yP(i,e,t))}function yP(e,t,i){let r,a;if(a=t[i.get()],i.increment(),r=(a&112)>>4,a<128||(a=t[i.get()],i.increment(),r|=(a&127)<<3,a<128)||(a=t[i.get()],i.increment(),r|=(a&127)<<10,a<128)||(a=t[i.get()],i.increment(),r|=(a&127)<<17,a<128)||(a=t[i.get()],i.increment(),r|=(a&127)<<24,a<128)||(a=t[i.get()],i.increment(),r|=(a&1)<<31,a<128))return r*4294967296+(e>>>0);throw Error("Expected varint not more than 10 bytes")}function vP(e,t,i,r){return xP(e,t,i,r,eP(i>>>2))}function xP(e,t,i,r,a){let o=r.get();if(i&3)throw Error(`FastPFOR: invalid encodedByteLength=${i} at offset=${o} (encodedBytes.length=${e.length}; expected a multiple of 4 bytes for an int32 big-endian word stream)`);let n=i>>>2,s=tP(a,n);fP(e,o,i,s);let l=dP(s.subarray(0,n),t,a.decoderWorkspace);return r.add(i),l}function we(e){return e>>>1^-(e&1)}function zt(e){return e>>1n^-(e&1n)}function Yr(e){return e%2==1?(e+1)/-2:e/2}function bP(e){let t=new Int32Array(e.length);for(let i=0;i<e.length;i++)t[i]=we(e[i]);return t}function wP(e){let t=new BigInt64Array(e.length);for(let i=0;i<e.length;i++)t[i]=zt(e[i]);return t}function TP(e){for(let t=0;t<e.length;t++)e[t]=Yr(e[t])}function yp(e,t,i){if(i===void 0){i=0;for(let o=0;o<t;o++)i+=e[o]}let r=new Uint32Array(i),a=0;for(let o=0;o<t;o++){let n=e[o],s=e[o+t];r.fill(s,a,a+n),a+=n}return r}function vp(e,t,i){if(i===void 0){i=0;for(let o=0;o<t;o++)i+=Number(e[o])}let r=new BigUint64Array(i),a=0;for(let o=0;o<t;o++){let n=Number(e[o]),s=e[o+t];r.fill(s,a,a+n),a+=n}return r}function Lx(e,t,i){let r=new Float64Array(i),a=0;for(let o=0;o<t;o++){let n=e[o],s=e[o+t];r.fill(s,a,a+n),a+=n}return r}function z1(e){let t=new Int32Array(e.length);t[0]=we(e[0]);let i=e.length/4*4,r=1;if(i>=4)for(;r<i-4;r+=4){let a=e[r],o=e[r+1],n=e[r+2],s=e[r+3];t[r]=we(a)+t[r-1],t[r+1]=we(o)+t[r],t[r+2]=we(n)+t[r+1],t[r+3]=we(s)+t[r+2]}for(;r!==e.length;++r)t[r]=we(e[r])+t[r-1];return t}function L1(e){let t=new BigInt64Array(e.length);t[0]=zt(e[0]);let i=e.length/4*4,r=1;if(i>=4)for(;r<i-4;r+=4){let a=e[r],o=e[r+1],n=e[r+2],s=e[r+3];t[r]=zt(a)+t[r-1],t[r+1]=zt(o)+t[r],t[r+2]=zt(n)+t[r+1],t[r+3]=zt(s)+t[r+2]}for(;r!==t.length;++r)t[r]=zt(e[r])+t[r-1];return t}function EP(e){e[0]=Yr(e[0]);let t=e.length/4*4,i=1;if(t>=4)for(;i<t-4;i+=4){let r=e[i],a=e[i+1],o=e[i+2],n=e[i+3];e[i]=Yr(r)+e[i-1],e[i+1]=Yr(a)+e[i],e[i+2]=Yr(o)+e[i+1],e[i+3]=Yr(n)+e[i+2]}for(;i!==e.length;++i)e[i]=Yr(e[i])+e[i-1]}function SP(e,t,i){if(i===void 0){i=0;for(let o=0;o<t;o++)i+=e[o]}let r=new Int32Array(i),a=0;for(let o=0;o<t;o++){let n=e[o],s=e[o+t];s=we(s),r.fill(s,a,a+n),a+=n}return r}function CP(e,t,i){if(i===void 0){i=0;for(let o=0;o<t;o++)i+=Number(e[o])}let r=new BigInt64Array(i),a=0;for(let o=0;o<t;o++){let n=Number(e[o]),s=e[o+t];s=zt(s),r.fill(s,a,a+n),a+=n}return r}function DP(e,t,i){let r=new Float64Array(i),a=0;for(let o=0;o<t;o++){let n=e[o],s=e[o+t];s=Yr(s),r.fill(s,a,a+n),a+=n}return r}function Of(e){let t=e.length/4*4,i=1;if(t>=4)for(let r=e[0];i<t-4;i+=4)r=e[i]+=r,r=e[i+1]+=r,r=e[i+2]+=r,r=e[i+3]+=r;for(;i!==e.length;)e[i]+=e[i-1],++i}function AP(e){let t=0;for(let i=0;i<e.length;i++)e[i]+=t,t=e[i]}function MP(e){if(e.length<2)return new Int32Array(e);let t=new Int32Array(e.length);t[0]=we(e[0]),t[1]=we(e[1]);let i=e.length/4*4,r=2;if(i>=4)for(;r<i-4;r+=4){let a=e[r],o=e[r+1],n=e[r+2],s=e[r+3];t[r]=we(a)+t[r-2],t[r+1]=we(o)+t[r-1],t[r+2]=we(n)+t[r],t[r+3]=we(s)+t[r+1]}for(;r!==e.length;r+=2)t[r]=we(e[r])+t[r-2],t[r+1]=we(e[r+1])+t[r-1];return t}function Bx(e,t,i,r){if(e.length<2)return new Int32Array(e);let a=new Int32Array(e.length),o=we(e[0]),n=we(e[1]);a[0]=Zr(Math.round(o*t),i,r),a[1]=Zr(Math.round(n*t),i,r);let s=e.length/16,l=2;if(s>=4)for(;l<s-4;l+=4){let u=e[l],c=e[l+1],h=we(u)+o,d=we(c)+n;a[l]=Zr(Math.round(h*t),i,r),a[l+1]=Zr(Math.round(d*t),i,r);let p=e[l+2],f=e[l+3];o=we(p)+h,n=we(f)+d,a[l+2]=Zr(Math.round(o*t),i,r),a[l+3]=Zr(Math.round(n*t),i,r)}for(;l!==e.length;l+=2)o+=we(e[l]),n+=we(e[l+1]),a[l]=Zr(Math.round(o*t),i,r),a[l+1]=Zr(Math.round(n*t),i,r);return a}function Zr(e,t,i){return Math.min(i,Math.max(t,e))}function PP(e){let t=new Int32Array(e.length+1);t[0]=0,t[1]=we(e[0]);let i=t[1];for(let r=2;r!==t.length;++r){let a=e[r-1],o=we(a);i+=o,t[r]=t[r-1]+i}return new Uint32Array(t)}function IP(e,t,i){let r=new Int32Array(i+1);r[0]=0;let a=1,o=r[0];for(let n=0;n<t;n++){let s=e[n],l=e[n+t];l=we(l);for(let u=a;u<a+s;u++)r[u]=l+o,o=r[u];a+=s}return r}function kP(e,t,i){let r=new Uint32Array(i+1);r[0]=0;let a=1,o=r[0];for(let n=0;n<t;n++){let s=e[n],l=e[n+t];for(let u=a;u<a+s;u++)r[u]=l+o,o=r[u];a+=s}return r}function FP(e,t,i){let r=new Int32Array(i),a=0,o=0;for(let n=0;n<t;n++){let s=e[n],l=e[n+t],u=we(l);for(let c=0;c<s;c++)o+=u,r[a++]=o}return r}function RP(e,t,i){let r=new BigInt64Array(i),a=0,o=0n;for(let n=0;n<t;n++){let s=Number(e[n]),l=e[n+t],u=zt(l);for(let c=0;c<s;c++)o+=u,r[a++]=o}return r}function B1(e){let t=new Uint32Array(e.length);t[0]=we(e[0])>>>0;for(let i=1;i<e.length;i++)t[i]=t[i-1]+we(e[i])>>>0;return t}function O1(e){let t=new BigUint64Array(e.length);t[0]=BigInt.asUintN(64,zt(e[0]));for(let i=1;i<e.length;i++)t[i]=BigInt.asUintN(64,t[i-1]+zt(e[i]));return t}function zP(e){if(e.length<2)return new Uint32Array(e);let t=new Uint32Array(e.length);t[0]=we(e[0])>>>0,t[1]=we(e[1])>>>0;for(let i=2;i<e.length;i+=2)t[i]=t[i-2]+we(e[i])>>>0,t[i+1]=t[i-1]+we(e[i+1])>>>0;return t}function LP(e,t,i,r){let a=Bx(e,t,i,r);return new Uint32Array(a)}function BP(e){return e[1]}function OP(e){return we(e[1])}function jP(e){if(e.length===2){let t=we(e[1]);return[t,t]}return[we(e[2]),we(e[3])]}function NP(e){return e[1]}function VP(e){return zt(e[1])}function $P(e){if(e.length===2){let t=zt(e[1]);return[t,t]}return[zt(e[2]),zt(e[3])]}function Xe(e,t){let i=YP(e,t);return i.logicalLevelTechnique1===fe.MORTON?HP(i,e,t):(fe.RLE===i.logicalLevelTechnique1||fe.RLE===i.logicalLevelTechnique2)&&Oi.NONE!==i.physicalLevelTechnique?XP(i,e,t):i}function HP(e,t,i){let r=Bt(t,i,2);return{physicalStreamType:e.physicalStreamType,logicalStreamType:e.logicalStreamType,logicalLevelTechnique1:e.logicalLevelTechnique1,logicalLevelTechnique2:e.logicalLevelTechnique2,physicalLevelTechnique:e.physicalLevelTechnique,numValues:e.numValues,byteLength:e.byteLength,decompressedCount:e.decompressedCount,numBits:r[0],coordinateShift:r[1]}}function XP(e,t,i){let r=Bt(t,i,2);return{physicalStreamType:e.physicalStreamType,logicalStreamType:e.logicalStreamType,logicalLevelTechnique1:e.logicalLevelTechnique1,logicalLevelTechnique2:e.logicalLevelTechnique2,physicalLevelTechnique:e.physicalLevelTechnique,numValues:e.numValues,byteLength:e.byteLength,decompressedCount:r[1],runs:r[0],numRleValues:r[1]}}function YP(e,t){let i=e[t.get()],r=UP[i>>4],a={};switch(r){case mt.DATA:a={dictionaryType:GP[i&15]};break;case mt.OFFSET:a={offsetType:WP[i&15]};break;case mt.LENGTH:a={lengthType:ZP[i&15]}}t.increment();let o=e[t.get()],n=j1[o>>5],s=j1[o>>2&7],l=qP[o&3];t.increment();let u=Bt(e,t,2),c=u[0],h=u[1];return{physicalStreamType:r,logicalStreamType:a,logicalLevelTechnique1:n,logicalLevelTechnique2:s,physicalLevelTechnique:l,numValues:c,byteLength:h,decompressedCount:c}}function $a(e,t,i){if(!t)return e;let r=t.size(),a=e.constructor,o=new a(r),n=0;for(let s=0;s<r;s++)o[s]=t.get(s)?e[n++]:i;return o}function KP(e,t,i){if(!i)return e;let r=i.size(),a=new Qi(e,t),o=new Qi(new Uint8Array(Math.ceil(r/8)),r),n=0;for(let s=0;s<r;s++){let l=i.get(s)?a.get(n++):!1;o.set(s,l)}return o.getBuffer()}function Ox(e,t,i){for(let r=0;r<e;r++){let a=Xe(t,i);i.add(a.byteLength)}}function jo(e,t,i,r,a){let o=JP(e,Math.ceil(t/8),i,r);return a?KP(o,t,a):o}function JP(e,t,i,r){let a=new Uint8Array(t),o=0,n=r.get()+i;for(;o<t&&!(r.get()>=n);){let s=e[r.increment()];if(s<=127){let l=s+3,u=e[r.increment()],c=Math.min(o+l,t);a.fill(u,o,c),o=c}else{let l=256-s;for(let u=0;u<l&&o<t;u++)a[o++]=e[r.increment()]}}return r.set(n),a}function jx(e,t,i,r){let a=t.get(),o=a+i*Float32Array.BYTES_PER_ELEMENT,n=new Uint8Array(e.subarray(a,o)).buffer,s=new Float32Array(n);return t.set(o),r?$a(s,r,0):s}function Nx(e,t,i,r){let a=t.get(),o=a+i*Float64Array.BYTES_PER_ELEMENT,n=new Uint8Array(e.subarray(a,o)).buffer,s=new Float64Array(n);return t.set(o),r?$a(s,r,0):s}function QP(e,t,i){let r=t.get(),a=i*Uint32Array.BYTES_PER_ELEMENT,o=new DataView(e.buffer,e.byteOffset,e.byteLength),n=new Uint32Array(i);for(let s=0;s<i;s++)n[s]=o.getUint32(r+s*Uint32Array.BYTES_PER_ELEMENT,!0);return t.add(a),n}function e8(e,t,i){let r=t.get(),a=i*BigUint64Array.BYTES_PER_ELEMENT,o=new DataView(e.buffer,e.byteOffset,e.byteLength),n=new BigUint64Array(i);for(let s=0;s<i;s++)n[s]=o.getBigUint64(r+s*BigUint64Array.BYTES_PER_ELEMENT,!0);return t.add(a),n}function jf(e,t,i){return i-t>=12?t8.decode(e.subarray(t,i)):i8(e,t,i)}function i8(e,t,i){let r="",a=t;for(;a<i;){let o=e[a],n=null,s=o>239?4:o>223?3:o>191?2:1;if(a+s>i)break;let l,u,c;s===1?o<128&&(n=o):s===2?(l=e[a+1],(l&192)==128&&(n=(o&31)<<6|l&63,n<=127&&(n=null))):s===3?(l=e[a+1],u=e[a+2],(l&192)==128&&(u&192)==128&&(n=(o&15)<<12|(l&63)<<6|u&63,(n<=2047||n>=55296&&n<=57343)&&(n=null))):s===4&&(l=e[a+1],u=e[a+2],c=e[a+3],(l&192)==128&&(u&192)==128&&(c&192)==128&&(n=(o&15)<<18|(l&63)<<12|(u&63)<<6|c&63,(n<=65535||n>=1114112)&&(n=null))),n===null?(n=65533,s=1):n>65535&&(n-=65536,r+=String.fromCharCode(n>>>10&1023|55296),n=56320|n&1023),r+=String.fromCharCode(n),a+=s}return r}function xu(e,t,i,r,a){return s8(No(e,t,i),i,r,a)}function Ft(e,t,i,r,a){return l8(No(e,t,i),i,r,a)}function Kr(e,t,i){return c8(No(e,t,i),i)}function No(e,t,i){let r=i.physicalLevelTechnique;switch(r){case Oi.FAST_PFOR:return vP(e,i.numValues,i.byteLength,t);case Oi.VARINT:return Bt(e,t,i.numValues);case Oi.NONE:return QP(e,t,i.numValues);default:throw Error(`Specified physicalLevelTechnique ${r} is not supported (yet).`)}}function _s(e,t,i){let r=i.physicalLevelTechnique;switch(r){case Oi.VARINT:return Bf(e,t,i.numValues);case Oi.NONE:return e8(e,t,i.numValues);default:throw Error(`Specified physicalLevelTechnique ${r} is not supported (yet).`)}}function r8(e,t,i){let r=No(e,t,i);return r.length===1?we(r[0]):OP(r)}function Nf(e,t,i){let r=No(e,t,i);return r.length===1?i.logicalLevelTechnique1===fe.DELTA?we(r[0]):r[0]:BP(r)}function Vx(e,t,i){return jP(No(e,t,i))}function $x(e,t,i){return $P(Bf(e,t,i.numValues))}function Ux(e,t,i,r){return Gx(_s(e,t,i),i,r)}function Vf(e,t,i,r){return Wx(_s(e,t,i),i,r)}function a8(e,t,i,r){let a=o8(e,t,i,!1);return r?$a(a,r,0):a}function o8(e,t,i,r){if(i.physicalLevelTechnique===Oi.VARINT)return u8(gP(e,t,i.numValues),i,r);let a=_s(e,t,i),o=r?Gx(a,i):Wx(a,i);return Float64Array.from(o,Number)}function n8(e,t,i){let r=_s(e,t,i);return r.length===1?zt(r[0]):VP(r)}function qx(e,t,i){let r=_s(e,t,i);return r.length===1?i.logicalLevelTechnique1===fe.DELTA?zt(r[0]):r[0]:NP(r)}function s8(e,t,i,r){let a;switch(t.logicalLevelTechnique1){case fe.DELTA:if(t.logicalLevelTechnique2===fe.RLE){let o=t;if(!r)return FP(e,o.runs,o.numRleValues);e=yp(e,o.runs,o.numRleValues),a=z1(e)}else a=z1(e);break;case fe.RLE:a=SP(e,t.runs,t.numRleValues);break;case fe.MORTON:Of(e),a=new Int32Array(e);break;case fe.COMPONENTWISE_DELTA:if(i&&!r)return Bx(e,i.scale,i.min,i.max);a=MP(e);break;case fe.NONE:a=bP(e);break;default:throw Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}return r?$a(a,r,0):a}function l8(e,t,i,r){let a;switch(t.logicalLevelTechnique1){case fe.DELTA:if(t.logicalLevelTechnique2===fe.RLE){let o=t;a=B1(yp(e,o.runs,o.numRleValues))}else a=B1(e);break;case fe.RLE:a=yp(e,t.runs,t.numRleValues);break;case fe.MORTON:Of(e),a=e;break;case fe.COMPONENTWISE_DELTA:a=i&&!r?LP(e,i.scale,i.min,i.max):zP(e);break;case fe.NONE:a=e;break;default:throw Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}return r?$a(a,r,0):a}function Gx(e,t,i){let r;switch(t.logicalLevelTechnique1){case fe.DELTA:if(t.logicalLevelTechnique2===fe.RLE){let a=t;if(!i)return RP(e,a.runs,a.numRleValues);e=vp(e,a.runs,a.numRleValues),r=L1(e)}else r=L1(e);break;case fe.RLE:r=CP(e,t.runs,t.numRleValues);break;case fe.NONE:r=wP(e);break;default:throw Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}return i?$a(r,i,0n):r}function Wx(e,t,i){let r;switch(t.logicalLevelTechnique1){case fe.DELTA:if(t.logicalLevelTechnique2===fe.RLE){let a=t;r=O1(vp(e,a.runs,a.numRleValues))}else r=O1(e);break;case fe.RLE:r=vp(e,t.runs,t.numRleValues);break;case fe.NONE:r=e;break;default:throw Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}return i?$a(r,i,0n):r}function u8(e,t,i){switch(t.logicalLevelTechnique1){case fe.DELTA:if(t.logicalLevelTechnique2===fe.RLE){let r=t;e=Lx(e,r.runs,r.numRleValues)}return EP(e),e;case fe.RLE:return d8(e,t,i);case fe.NONE:return i&&TP(e),e;default:throw Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}}function c8(e,t){if(t.logicalLevelTechnique1===fe.DELTA&&t.logicalLevelTechnique2===fe.NONE)return PP(e);if(t.logicalLevelTechnique1===fe.RLE&&t.logicalLevelTechnique2===fe.NONE){let i=t;return kP(e,i.runs,i.numRleValues)}if(t.logicalLevelTechnique1===fe.NONE&&t.logicalLevelTechnique2===fe.NONE){AP(e);let i=new Uint32Array(t.numValues+1);return i[0]=0,i.set(e,1),i}if(t.logicalLevelTechnique1===fe.DELTA&&t.logicalLevelTechnique2===fe.RLE){let i=t,r=IP(e,i.runs,i.numRleValues);return Of(r),new Uint32Array(r)}throw Error("Only delta encoding is supported for transforming length to offset streams yet.")}function oc(e,t,i,r,a="int32"){let o=e.logicalLevelTechnique1;if(o===fe.RLE)return e.runs===1?Ge.CONST:Ge.FLAT;if(o!==fe.DELTA||e.logicalLevelTechnique2!==fe.RLE)return e.numValues===1?Ge.CONST:Ge.FLAT;let n=t instanceof Qi?t.size():t,s=e;if(s.numRleValues!==n)return Ge.FLAT;if(s.runs===1)return Ge.SEQUENCE;if(s.runs!==2)return e.numValues===1?Ge.CONST:Ge.FLAT;let l=r.get();if(e.physicalLevelTechnique===Oi.VARINT)return h8(i,r,a)?Ge.SEQUENCE:e.numValues===1?Ge.CONST:Ge.FLAT;let u=r.get(),c=new Int32Array(i.buffer,i.byteOffset+u,4);return r.set(l),c[2]===2&&c[3]===2?Ge.SEQUENCE:e.numValues===1?Ge.CONST:Ge.FLAT}function h8(e,t,i){let r=new Fx(t.get());if(i==="int64"){let o=Bf(e,r,4);return o[2]===2n&&o[3]===2n}let a=Bt(e,r,4);return a[2]===2&&a[3]===2}function d8(e,t,i){return i?DP(e,t.runs,t.numRleValues):Lx(e,t.runs,t.numRleValues)}function $f(e,t,i){return{x:N1(e,t)-i,y:N1(e>>1,t)-i}}function N1(e,t){let i=0;for(let r=0;r<t;r++)i|=(e&1<<2*r)>>r;return i}function f8(e){let t=Array(e.numGeometries),i=1,r=1,a=1,o=0,n=0,s=0,{mortonSettings:l,topologyVector:u}=e,{geometryOffsets:c,partOffsets:h,ringOffsets:d}=u,p=e.vertexOffsets,f=!p||p.length===0,m=e.containsPolygonGeometry(),g=e.vertexBuffer;for(let _=0;_<e.numGeometries;_++){let y=e.geometryType(_);switch(y){case Lt.POINT:{let v,x;if(f)v=g[n++],x=g[n++];else if(e.vertexBufferType===Ua.MORTON){let b=g[p[s++]],w=$f(b,l.numBits,l.coordinateShift);v=w.x,x=w.y}else{let b=p[s++]*2;v=g[b],x=g[b+1]}t[o++]=[[new D(v,x)]],c&&a++,h&&i++,d&&r++}break;case Lt.MULTIPOINT:{let v=c[a]-c[a-1];a++;let x;if(f){x=Array(v);for(let b=0;b<v;b++){let w=g[n++],T=g[n++];x[b]=new D(w,T)}}else x=ga(e.vertexBufferType,g,p,s,v,!1,l),s+=v;t[o++]=x.map((b)=>[b]),i+=v,r+=v}break;case Lt.LINESTRING:{let v;m?(v=d[r]-d[r-1],r++):v=h[i]-h[i-1],i++;let x;f?(x=io(g,n,v,!1),n+=v*2):(x=ga(e.vertexBufferType,g,p,s,v,!1,l),s+=v),t[o++]=[x],c&&a++}break;case Lt.POLYGON:{let v=h[i]-h[i-1];i++;let x=Array(v-1),b,w=d[r]-d[r-1];if(r++,f){b=io(g,n,w,!0),n+=w*2;for(let T=0;T<x.length;T++)w=d[r]-d[r-1],r++,x[T]=io(g,n,w,!0),n+=w*2}else{b=ga(e.vertexBufferType,g,p,s,w,!0,l),s+=w;for(let T=0;T<x.length;T++)w=d[r]-d[r-1],r++,x[T]=ga(e.vertexBufferType,g,p,s,w,!0,l),s+=w}t[o++]=[b].concat(x),c&&a++}break;case Lt.MULTILINESTRING:{let v=c[a]-c[a-1];a++;let x=Array(v);for(let b=0;b<v;b++){let w;if(m?(w=d[r]-d[r-1],r++):w=h[i]-h[i-1],i++,f)x[b]=io(g,n,w,!1),n+=w*2;else{let T=ga(e.vertexBufferType,g,p,s,w,!1,l);x[b]=T,s+=w}}t[o++]=x}break;case Lt.MULTIPOLYGON:{let v=c[a]-c[a-1];a++;let x=Array(v);for(let b=0;b<v;b++){let w=h[i]-h[i-1];i++;let T,E=Array(w-1),S=d[r]-d[r-1];r++,f?(T=io(g,n,S,!0),n+=S*2):(T=ga(e.vertexBufferType,g,p,s,S,!0,l),s+=S);for(let A=0;A<E.length;A++){let I=d[r]-d[r-1];r++,f?(E[A]=io(g,n,I,!0),n+=I*2):(E[A]=ga(e.vertexBufferType,g,p,s,I,!0,l),s+=I)}x[b]=[T].concat(E)}t[o++]=x.flat()}break;default:throw Error(`The specified geometry type (${y}) is currently not supported.`)}}return t}function ga(e,t,i,r,a,o,n){return e===Ua.MORTON?g8(t,i,r,a,o,n):m8(t,i,r,a,o)}function io(e,t,i,r){let a=Array(r?i+1:i);for(let o=0;o<i*2;o+=2){let n=e[t+o],s=e[t+o+1];a[o/2]=new D(n,s)}return r&&(a[a.length-1]=a[0]),a}function m8(e,t,i,r,a){let o=Array(a?r+1:r);for(let n=0;n<r*2;n+=2){let s=t[i+n/2]*2,l=e[s],u=e[s+1];o[n/2]=new D(l,u)}return a&&(o[o.length-1]=o[0]),o}function g8(e,t,i,r,a,o){let n=Array(a?r+1:r);for(let s=0;s<r;s++){let l=e[t[i+s]],u=$f(l,o.numBits,o.coordinateShift);n[s]=new D(u.x,u.y)}return a&&(n[n.length-1]=n[0]),n}function _8(e,t,i,r,a){return new Yx(e,t,Ua.VEC_2,i,r,a)}function y8(e,t,i,r,a,o){return new Yx(e,t,Ua.MORTON,i,r,a,o)}function Kx(e,t,i,r){return new Jx(Ua.VEC_2,e,t,i,r)}function v8(e,t,i,r,a){return new Jx(Ua.MORTON,e,t,i,r,a)}function V1(e,t,i,r,a,o){return new x8(e,t,i,r,a,o)}function $1(e,t,i,r,a){return new b8(e,t,i,r,a)}function w8(e,t,i,r,a){let o=Xe(e,i),n=oc(o,r,e,i),s,l,u,c;if(n===Ge.CONST){let v=Nf(e,i,o),x,b,w,T;for(let E=0;E<t-1;E++){let S=Xe(e,i);switch(S.physicalStreamType){case mt.LENGTH:switch(S.logicalStreamType.lengthType){case bt.GEOMETRIES:x=Kr(e,i,S);break;case bt.PARTS:b=Kr(e,i,S);break;case bt.RINGS:w=Kr(e,i,S);break;case bt.TRIANGLES:T=Kr(e,i,S)}break;case mt.OFFSET:switch(S.logicalStreamType.offsetType){case Rr.VERTEX:s=Ft(e,i,S);break;case Rr.INDEX:c=Ft(e,i,S)}break;case mt.DATA:if(Ht.VERTEX===S.logicalStreamType.dictionaryType)l=xu(e,i,S,a);else{let A=S;u={numBits:A.numBits,coordinateShift:A.coordinateShift},l=Ft(e,i,S,a)}}}return c?x!==void 0||b!==void 0?V1(r,v,T,c,l,{geometryOffsets:x,partOffsets:b,ringOffsets:w}):V1(r,v,T,c,l):u===void 0?_8(r,v,{geometryOffsets:x,partOffsets:b,ringOffsets:w},s,l):y8(r,v,{geometryOffsets:x,partOffsets:b,ringOffsets:w},s,l,u)}let h=Ft(e,i,o),d,p,f,m;for(let v=0;v<t-1;v++){let x=Xe(e,i);switch(x.physicalStreamType){case mt.LENGTH:switch(x.logicalStreamType.lengthType){case bt.GEOMETRIES:d=Ft(e,i,x);break;case bt.PARTS:p=Ft(e,i,x);break;case bt.RINGS:f=Ft(e,i,x);break;case bt.TRIANGLES:m=Kr(e,i,x)}break;case mt.OFFSET:switch(x.logicalStreamType.offsetType){case Rr.VERTEX:s=Ft(e,i,x);break;case Rr.INDEX:c=Ft(e,i,x)}break;case mt.DATA:if(Ht.VERTEX===x.logicalStreamType.dictionaryType)l=xu(e,i,x,a);else{let b=x;u={numBits:b.numBits,coordinateShift:b.coordinateShift},l=Ft(e,i,x,a)}}}let g,_,y;return d?(g=Fh(h,d,2),p&&f?(_=U1(h,g,p,!1),y=E8(h,g,_,f)):p&&(_=T8(h,g,p))):p&&f?(_=Fh(h,p,1),y=U1(h,_,f,!0)):p&&(_=Fh(h,p,0)),c&&!_?$1(h,m,c,l):c?$1(h,m,c,l,{geometryOffsets:g,partOffsets:_,ringOffsets:y}):u===void 0?Kx(h,{geometryOffsets:g,partOffsets:_,ringOffsets:y},s,l):v8(h,{geometryOffsets:g,partOffsets:_,ringOffsets:y},s,l,u)}function Fh(e,t,i){let r=new Uint32Array(e.length+1),a=0;r[0]=a;let o=0;for(let n=0;n<e.length;n++)a=r[n+1]=a+(e[n]>i?t[o++]:1);return r}function U1(e,t,i,r){let a=new Uint32Array(t[t.length-1]+1),o=0;a[0]=o;let n=1,s=0;for(let l=0;l<e.length;l++){let u=e[l],c=t[l+1]-t[l];if(u===5||u===2||r&&(u===4||u===1))for(let h=0;h<c;h++)o=a[n++]=o+i[s++];else for(let h=0;h<c;h++)a[n++]=++o}return a}function T8(e,t,i){let r=new Uint32Array(t[t.length-1]+1),a=0;r[0]=a;let o=1,n=0;for(let s=0;s<e.length;s++){let l=e[s],u=t[s+1]-t[s];if(l===4||l===1)for(let c=0;c<u;c++)a=r[o++]=a+i[n++];else for(let c=0;c<u;c++)r[o++]=++a}return r}function E8(e,t,i,r){let a=new Uint32Array(i[i.length-1]+1),o=0;a[0]=o;let n=1,s=1,l=0;for(let u=0;u<e.length;u++){let c=e[u],h=t[u+1]-t[u];if(c!==0&&c!==3)for(let d=0;d<h;d++){let p=i[n]-i[n-1];n++;for(let f=0;f<p;f++)o=a[s++]=o+r[l++]}else for(let d=0;d<h;d++)a[s++]=++o,n++}return a}function D8(e,t){let i=0;for(let r=0;r<t.length;r++){let a=t[r];a===255?(i++,r++):i+=e[a]}return i}function A8(e,t,i){let r=new Uint32Array(t.length);for(let n=1;n<t.length;n++)r[n]=r[n-1]+t[n-1];let a=new Uint8Array(D8(t,i)),o=0;for(let n=0;n<i.length;n++){let s=i[n];if(s===255)n++,a[o++]=i[n];else{let l=t[s],u=r[s];for(;l-- >0;)a[o++]=e[u++]}}return a}function ib(e,t,i,r,a){let o,n,s,l,u,c=a,h,d;for(let p=0;p<r;p++){let f=Xe(t,i);switch(f.physicalStreamType){case mt.PRESENT:{let m=new Qi(jo(t,f.numValues,f.byteLength,i),f.numValues);c=a??m;break}case mt.OFFSET:n=Ft(t,i,f,void 0,c);break;case mt.LENGTH:{let m=Kr(t,i,f);bt.DICTIONARY===f.logicalStreamType.lengthType?o=m:bt.SYMBOL===f.logicalStreamType.lengthType?l=m:h=m;break}case mt.DATA:{let m=t.subarray(i.get(),i.get()+f.byteLength);i.add(f.byteLength);let g=f.logicalStreamType.dictionaryType;Ht.FSST===g?u=m:Ht.SINGLE===g||Ht.SHARED===g?s=m:Ht.NONE===g&&(d=m);break}}}return M8(e,u,n,o,s,l,c)??P8(e,s,n,o,c)??I8(e,h,d,n,c)}function M8(e,t,i,r,a,o,n){if(t){if(!i||!r||!a||!o)throw Error(`Incomplete FSST dictionary string column "${e}"`);return new tb(e,i,r,a,o,t,n)}}function P8(e,t,i,r,a){if(t){if(!i||!r)throw Error(`Incomplete dictionary string column "${e}"`);return a?new bo(e,i,r,t,a):new bo(e,i,r,t)}}function I8(e,t,i,r,a){if(t&&i){if(r)return a?new bo(e,r,t,i,a):new bo(e,r,t,i);if(a&&a.size()!==t.length-1){let o=new Uint32Array(a.size()),n=0;for(let s=0;s<a.size();s++)a.get(s)?o[s]=n++:o[s]=0;return new bo(e,o,t,i,a)}return a?new q1(e,t,i,a):new q1(e,t,i)}}function k8(e,t,i,r){let a,o,n,s,l=!1;for(;!l;){let p=Xe(e,t);switch(p.physicalStreamType){case mt.LENGTH:bt.DICTIONARY===p.logicalStreamType.lengthType?a=Kr(e,t,p):n=Kr(e,t,p);break;case mt.DATA:Ht.SINGLE===p.logicalStreamType.dictionaryType||Ht.SHARED===p.logicalStreamType.dictionaryType?(o=e.subarray(t.get(),t.get()+p.byteLength),l=!0):s=e.subarray(t.get(),t.get()+p.byteLength),t.add(p.byteLength)}}if(i.type!=="complexType")throw Error(`Shared dictionary column ${i.name} must be a complex (struct) column.`);if(!a||!o)throw Error(`Incomplete shared dictionary for column "${i.name}"`);let u=i.complexType.children,c=[],h=s?{}:void 0,d=0;for(let p of u){let f=Bt(e,t,1)[0];if(f===0)continue;let m=p.name?`${i.name}${p.name}`:i.name;if(r&&!r.has(m)){Ox(f,e,t);continue}if(p.type!=="scalarField"||p.scalarField.physicalType!==Se.STRING)throw Error("Currently only scalar string fields are implemented for a struct.");if(f>1&&!p.nullable||f===1&&p.nullable)throw Error(`The number of streams for the child field ${p.name} does not match its nullability. nullibilty: ${p.nullable}, numStreams: ${f}`);let g;if(p.nullable){let y=Xe(e,t);g=new Qi(jo(e,y.numValues,y.byteLength,t),y.numValues)}let _=Ft(e,t,Xe(e,t),void 0,g);if(s){if(!n)throw Error(`Incomplete shared FSST dictionary for column "${m}"`);c[d++]=new tb(m,_,a,o,n,s,g,h)}else c[d++]=new bo(m,_,a,o,g)}return c}function F8(e,t,i,r){let a=R8(i);if(r===0)return a.map((c)=>new G1(c,[]));let o=z8(e,t,r),n=(o.presentStream?o.presentCount:o.lengthStream.length)/a.length,s=[],l=0,u=0;for(let c=0;c<a.length;c++){let h=N8(o,c,n,l,u);s.push(new G1(a[c],h.value,h.nullabilityBuffer)),l=h.countsEnd,u=h.valuesEnd}return s}function R8(e){let t=e.type==="complexType"?e.complexType.children:void 0;return!t||t.length===0?[e.name]:t.map((i)=>e.name+(i.name??""))}function z8(e,t,i){let r=e[t.get()];t.add(1);let a=Ft(e,t,Xe(e,t)),o=i-1,n=[];r&zr.STRING&&(o-=L8(e,t,n)),o-=B8(e,t,r,n),o-=O8(e,t,r,n);let s,l=0;if(r&zr.PRESENCE){let c=j8(e,t);s=c.value,l=c.count,o--}let u=new Uint32Array;if(o>0&&(u=Ft(e,t,Xe(e,t)),o--),o!==0)throw Error(`Unexpected number of remaining streams while decoding map column: ${o}`);return{lengthStream:a,dictionary:n,presentStream:s,presentCount:l,flattenedValues:u}}function L8(e,t,i){let r=e[t.get()];t.add(1);let a=ib("",e,t,r);if(a)for(let o=0;o<a.size;o++)i.push(a.getValue(o));return r}function B8(e,t,i,r){let a=0;return i&zr.INT32?(po(r,xu(e,t,Xe(e,t))),a++):i&zr.INT64&&(po(r,Ux(e,t,Xe(e,t))),a++),i&zr.UINT32?(po(r,Ft(e,t,Xe(e,t))),a++):i&zr.UINT64&&(po(r,Vf(e,t,Xe(e,t))),a++),a}function O8(e,t,i,r){let a=0;return i&zr.FLOAT&&(po(r,jx(e,t,Xe(e,t).numValues)),a++),i&zr.DOUBLE&&(po(r,Nx(e,t,Xe(e,t).numValues)),a++),a}function j8(e,t){let i=Xe(e,t);if(i.physicalStreamType!==mt.PRESENT)throw Error(`Expected PRESENT stream for map column but found: ${i.physicalStreamType}`);let r=i.numValues,a=t.get(),o=new Qi(jo(e,r,i.byteLength,t),r);return t.set(a+i.byteLength),{value:o,count:r}}function N8(e,t,i,r,a){let{lengthStream:o,flattenedValues:n,presentStream:s,dictionary:l}=e,u=t*i,c=i,h;if(s){h=new Qi(new Uint8Array(Math.ceil(i/8)),i),c=0;for(let y=0;y<i;y++)s.get(u+y)&&(h.set(y,!0),c++)}let d=r+c;if(d>o.length)throw Error("Merged map counts underflow while decoding child streams");let p=Array(i),f=r,m=a;for(let y=0;y<i;y++){if(s&&!s.get(u+y)){p[y]=null;continue}let v=m+o[f++];if(v>n.length)throw Error("Map value stream underflow while decoding feature payload");let x=V8(n,m,v,l);p[y]=x.value,m=x.nextIndex}let g=0;for(let y=r;y<d;y++)g+=o[y];let _=a+g;if(m!==_)throw Error("Unused flattened map values remain after decode");return{value:p,nullabilityBuffer:h,countsEnd:d,valuesEnd:_}}function V8(e,t,i,r){return i-t===1||e[t]===Ta.START_LIST?qf(e,t,i,r):rb(e,t,i,r)}function rb(e,t,i,r){let a=Object.create(null),o=t;for(;o<i;){let n=ab(e[o++],r);if(typeof n!="string")throw Error(`Map key dictionary index does not resolve to a string: ${n}`);let s=qf(e,o,i,r);a[n]=s.value,o=s.nextIndex}return{value:a,nextIndex:o}}function qf(e,t,i,r){if(t>=i)throw Error("Unexpected end of map value stream");let a=e[t];if(a===Ta.FALSE)return{value:!1,nextIndex:t+1};if(a===Ta.TRUE)return{value:!0,nextIndex:t+1};if(a===Ta.START_MAP){let o=W1(e,t,i);return{value:rb(e,t+2,o,r).value,nextIndex:o}}if(a===Ta.START_LIST){let o=W1(e,t,i),n=[],s=t+2;for(;s<o;){let l=qf(e,s,o,r);n.push(l.value),s=l.nextIndex}return{value:n,nextIndex:o}}return{value:ab(a,r),nextIndex:t+1}}function W1(e,t,i){if(t+1>=i)throw Error("Missing length for nested map/list payload");let r=e[t+1];if(r<2)throw Error(`Invalid nested payload length: ${r}`);let a=t+r;if(a>i)throw Error("Nested payload exceeds containing payload bounds");return a}function ab(e,t){let i=e-Ta.COUNT;if(i<0||i>=t.length)throw Error(`Scalar dictionary index out of range: ${e}`);return t[i]}function po(e,t){for(let i of t)e.push(i)}function $8(e,t,i,r,a,o){return i.type==="scalarType"?o&&!o.has(i.name)?(Ox(r,e,t),null):U8(r,e,t,a,i.scalarType,i):i.complexType?.physicalType===ia.MAP?F8(e,t,i,r):r===0?null:k8(e,t,i,o)}function U8(e,t,i,r,a,o){let n;if(e===0)return null;if(o.nullable){let l=Xe(t,i),u=l.numValues,c=i.get(),h=jo(t,u,l.byteLength,i);i.set(c+l.byteLength),n=new Qi(h,l.numValues)}let s=n??r;switch(a.physicalType){case Se.UINT_32:case Se.INT_32:return H8(t,i,o,a,s);case Se.STRING:{let l=o.nullable?e-1:e;return ib(o.name,t,i,l,n)??null}case Se.BOOLEAN:return q8(t,i,o,r,s);case Se.UINT_64:case Se.INT_64:return Z8(t,i,o,s,a);case Se.FLOAT:return G8(t,i,o,s);case Se.DOUBLE:return W8(t,i,o,s);default:throw Error(`The specified data type for the field is currently not supported: ${a}`)}}function q8(e,t,i,r,a){let o=Xe(e,t),n=o.numValues,s=t.get(),l=ys(a)?a:void 0,u=jo(e,n,o.byteLength,t,l);t.set(s+o.byteLength);let c=new Qi(u,n);return new S8(i.name,c,a)}function G8(e,t,i,r){let a=Xe(e,t),o=ys(r)?r:void 0,n=jx(e,t,a.numValues,o);return new C8(i.name,n,r)}function W8(e,t,i,r){let a=Xe(e,t),o=ys(r)?r:void 0,n=Nx(e,t,a.numValues,o);return new If(i.name,n,r)}function Z8(e,t,i,r,a){let o=Xe(e,t),n=oc(o,r,e,t,"int64"),s=a.physicalType===Se.INT_64;if(n===Ge.FLAT){let u=ys(r)?r:void 0,c=s?Ux(e,t,o,u):Vf(e,t,o,u);return new Zx(i.name,c,r)}if(n===Ge.SEQUENCE){let u=$x(e,t,o);return new Hx(i.name,u[0],u[1],o.numRleValues,s)}let l=s?n8(e,t,o):qx(e,t,o);return new eb(i.name,l,r,s)}function H8(e,t,i,r,a){let o=Xe(e,t),n=oc(o,a,e,t),s=r.physicalType===Se.INT_32;if(n===Ge.FLAT){let u=ys(a)?a:void 0,c=s?xu(e,t,o,void 0,u):Ft(e,t,o,void 0,u);return new Pf(i.name,c,a)}if(n===Ge.SEQUENCE){let u=Vx(e,t,o);return new kf(i.name,u[0],u[1],o.numRleValues,s)}let l=s?r8(e,t,o):Nf(e,t,o);return new Ff(i.name,l,a,s)}function ys(e){return e instanceof Qi}function ob(e){switch(e){case xt.ID:case xt.ID|xt.ID_NULLABLE:case xt.ID|xt.ID_LONG:case xt.ID|xt.ID_LONG|xt.ID_NULLABLE:return{nullable:(e&xt.ID_NULLABLE)!==0,columnScope:xn.FEATURE,type:"scalarType",scalarType:{longID:(e&xt.ID_LONG)!==0,type:"logicalType",logicalType:kx.ID}};case xt.GEOMETRY:return{nullable:!1,columnScope:xn.FEATURE,type:"complexType",complexType:{type:"physicalType",physicalType:ia.GEOMETRY,children:[]}};case xt.STRUCT:return{nullable:!1,columnScope:xn.FEATURE,type:"complexType",complexType:{type:"physicalType",physicalType:ia.STRUCT,children:[]}};case xt.MAP:return{nullable:!0,columnScope:xn.FEATURE,type:"complexType",complexType:{type:"physicalType",physicalType:ia.MAP,children:[]}};default:return Q8(e)}}function X8(e){return e>=xt.SCALAR_BASE}function nb(e){return e===xt.STRUCT||e===xt.MAP}function Y8(e){if(e.type==="scalarType"){let t=e.scalarType;if(t.type==="physicalType")switch(t.physicalType){case Se.BOOLEAN:case Se.INT_8:case Se.UINT_8:case Se.INT_32:case Se.UINT_32:case Se.INT_64:case Se.UINT_64:case Se.FLOAT:case Se.DOUBLE:return!1;case Se.STRING:return!0;default:return!1}if(t.type==="logicalType")return!1}else if(e.type==="complexType"){let t=e.complexType;if(t.type==="physicalType")switch(t.physicalType){case ia.GEOMETRY:case ia.STRUCT:case ia.MAP:return!0;default:return!1}}return console.warn("Unexpected column type in hasStreamCount",e),!1}function K8(e){return e.type==="scalarType"&&e.scalarType?.type==="logicalType"&&e.scalarType.logicalType===kx.ID}function J8(e){return e.type==="complexType"&&e.complexType?.type==="physicalType"&&e.complexType.physicalType===ia.GEOMETRY}function Q8(e){let t;switch(e){case 10:case 11:t=Se.BOOLEAN;break;case 12:case 13:t=Se.INT_8;break;case 14:case 15:t=Se.UINT_8;break;case 16:case 17:t=Se.INT_32;break;case 18:case 19:t=Se.UINT_32;break;case 20:case 21:t=Se.INT_64;break;case 22:case 23:t=Se.UINT_64;break;case 24:case 25:t=Se.FLOAT;break;case 26:case 27:t=Se.DOUBLE;break;case 28:case 29:t=Se.STRING;break;default:return null}return{nullable:!!(e&1),columnScope:xn.FEATURE,type:"scalarType",scalarType:{longID:!1,type:"physicalType",physicalType:t}}}function Gf(e,t){let i=Bt(e,t,1)[0];if(i===0)return"";let r=t.get(),a=r+i,o=e.subarray(r,a);return t.add(i),eI.decode(o)}function tI(e){let{name:t,nullable:i}=e;return e.type==="scalarType"?{type:"scalarField",scalarField:e.scalarType,name:t,nullable:i}:{type:"complexField",complexField:e.complexType,name:t,nullable:i}}function sb(e,t){let i=Bt(e,t,1)[0]>>>0,r=i>=xt.SCALAR_BASE?ob(i):null;if(!r)throw Error(`Unsupported field type code ${i}. Supported: 10-29(scalars), 30(STRUCT), 31(MAP)`);let a={...r,name:Gf(e,t)};if(a.type==="complexType"&&nb(i)){let o=a.complexType,n=Bt(e,t,1)[0]>>>0;o.children=Array(n);for(let s=0;s<n;s++)o.children[s]=sb(e,t)}return tI(a)}function iI(e,t){let i=Bt(e,t,1)[0]>>>0,r=ob(i);if(!r)throw Error(`Unsupported column type code ${i}. Supported: ${Z1}`);let a;if(X8(i))a=Gf(e,t);else if(i<xt.GEOMETRY)a="id";else if(i===xt.GEOMETRY)a="geometry";else throw Error(`Unsupported column type code ${i}. Supported: ${Z1}`);let o={...r,name:a};if(o.type==="complexType"&&nb(i)){let n=Bt(e,t,1)[0]>>>0,s=o.complexType;s.children=Array(n);for(let l=0;l<n;l++)s.children[l]=sb(e,t)}return o}function rI(e,t){let i={};i.featureTables=[];let r={};if(r.name=Gf(e,t),r.name.length===0)throw Error("Missing layer name");let a=Bt(e,t,1)[0]>>>0,o=Bt(e,t,1)[0]>>>0;r.columns=Array(o);for(let n=0;n<o;n++)r.columns[n]=iI(e,t);return i.featureTables.push(r),[i,a]}function aI(e,t,i=!0){let r=new Fx(0),a=[];for(;r.get()<e.length;){let o=Bt(e,r,1)[0]>>>0,n=r.get()+o;if(n>e.length)throw Error(`Block overruns tile: ${n} > ${e.length}`);let s=Bt(e,r,1)[0]>>>0;if(s!==1&&s!==2){r.set(n);continue}let[l,u]=rI(e,r),c=l.featureTables[0],h=null,d=null,p=[],f=0;for(let g of c.columns){let _=g.name;if(K8(g)){let y=null;if(g.nullable){let x=Xe(e,r),b=r.get(),w=jo(e,x.numValues,x.byteLength,r);r.set(b+x.byteLength),y=new Qi(w,x.numValues)}let v=Xe(e,r);f=y?y.size():v.decompressedCount,h=oI(e,g,r,_,v,y??f,i)}else if(J8(g)){let y=Bt(e,r,1)[0];if(f===0){let v=r.get();f=Xe(e,r).decompressedCount,r.set(v)}t&&(t.scale=t.extent/u),d=w8(e,y,r,f,t)}else{let y=Y8(g)?Bt(e,r,1)[0]:1;if(y===0)continue;let v=$8(e,r,g,y,f,void 0);if(v)if(Array.isArray(v))for(let x of v)p.push(x);else p.push(v)}}let m=new AM(c.name,d,h,p,u);a.push(m),r.set(n)}return a}function oI(e,t,i,r,a,o,n=!1){let s=t.scalarType?.longID?Se.UINT_64:Se.UINT_32,l=typeof o=="number"?void 0:o,u=oc(a,o,e,i,s===Se.UINT_64?"int64":"int32");if(s===Se.UINT_32)switch(u){case Ge.FLAT:return new Pf(r,Ft(e,i,a,void 0,l),o);case Ge.SEQUENCE:{let c=Vx(e,i,a);return new kf(r,c[0],c[1],a.numRleValues,!1)}case Ge.CONST:return new Ff(r,Nf(e,i,a),o,!1)}switch(u){case Ge.FLAT:return n?new If(r,a8(e,i,a,l),o):new Zx(r,Vf(e,i,a,l),o);case Ge.SEQUENCE:{let c=$x(e,i,a);return new Hx(r,c[0],c[1],a.numRleValues,!1)}case Ge.CONST:return new eb(r,qx(e,i,a),o,!1)}throw Error("Vector type not supported for id column.")}function uI(e){return typeof e=="object"&&!!e&&"evaluate"in e}function H1(e,t,i,r,a){return Bp(e,(o,n)=>{let s=t instanceof Wu?t.get(n):null;return uI(s)?s.evaluate(i,r,void 0,a):s})}function cI(e,t){return t-e}function bp(){return X1||=new hI,X1}function Y1(e){let t=[];for(let i in e)t.push({id:i,state:e[i]});return t}function gI(e,t,i,r){let a=`${e.z}_${e.x}_${e.y}_${Math.round(i)}`;if(!r?.terrain)return a;let{minElevation:o,maxElevation:n}=r.terrain.getMinMaxElevation(new Et(e.z,t,e.z,e.x,e.y));return`${a}_${o}_${n}`}function Ll(e,t,i){let r=e-t;return r<0?-r:Math.max(0,r-i)}function Lh(e,t,i,r,a){let o=e-i,n;return n=o<0?Math.min(-o,1+o-a):o>a?Math.min(Math.max(o-a,0),1-o):0,Math.max(n,Ll(t,r,a))}function K1(e,t){let i=1/0,r=-1/0;for(let a of t){let o=ft(e,a);i=Math.min(i,o),r=Math.max(r,o)}return{min:i,max:r}}function Wf(e){return ot(e).projection==="mercator"?(J1??=new mI,J1):(Q1??=new yI,Q1)}function vI(e,t,i){let r=t.intersectsFrustum(e);if(!i||r===0)return r;let a=t.intersectsPlane(i);return a===0?0:r===2&&a===2?2:1}function e_(e,t,i){let r=0,a=(i-t)/10;for(let o=0;o<10;o++){let n=t+(o+0.5)/10*(i-t);r+=a*Math.cos(n)**+e}return r}function wp(e,t){return function(i,r,a,o,n){let s=2*((e-1)/wt(Math.cos(We(go-n))/Math.cos(We(go)))-1),l=Math.acos(a/o),u=2*e_(s-1,0,We(n/2)),c=Math.min(We(go),l+We(n/2)),h=Math.min(c,l-We(n/2)),d=e_(s-1,h,c),p=Math.atan(r/a),f=Math.hypot(r,a),m=i;return m+=wt(o/f/Math.max(0.5,Math.cos(We(n/2)))),m+=s*wt(Math.cos(p))/2,m-=wt(Math.max(1,d/u/t))/2,m}}function Zf(e,t){let i=(t.roundZoom?Math.round:Math.floor)(e.zoom+wt(e.tileSize/t.tileSize));return Math.max(0,i)}function bI(e,t){let i=H((15-(go-e.pitch-e.fov/2))/15,0,1),r=Math.max(500,t??0);return e.elevation+i*r}function wI(e,t,i){let r=e.planes[1],a=e.points.map((l)=>{let u=r[0]*l[0]+r[1]*l[1]+r[2]*l[2]+r[3];if(Math.abs(u)>0.000001)return l;let c=[l[0]-i[0],l[1]-i[1],l[2]-i[2]],h=r[0]*c[0]+r[1]*c[1]+r[2]*c[2];if(h>=-0.000000001)return l;let d=t/-h;return[l[0]+c[0]*d,l[1]+c[1]*d,l[2]+c[2]*d,l[3]]}),o=e.planes.map((l,u)=>u===1?[l[0],l[1],l[2],l[3]+t]:l),n=[1/0,1/0,1/0],s=[-1/0,-1/0,-1/0];for(let l of a)for(let u=0;u<3;u++)n[u]=Math.min(n[u],l[u]),s[u]=Math.max(s[u],l[u]);return{points:a,planes:o,aabb:{min:n,max:s}}}function TI(e,t,i,r){let a=Math.hypot(t[0],t[1],t[2]);if(a===0)return{frustum:e,plane:t};let o=1+r/Yt,n=H(-t[3]/a,-1,1),s=Math.cos(Math.acos(n)+Math.acos(1/o));return{frustum:wI(e,Math.sqrt(o*o-1),i),plane:[t[0],t[1],t[2],-s*a]}}function vs(e,t,i){let r=V(e).getCameraFrustum(e),a=V(e).getClippingPlane(e);a&&i.maxContentElevation>0&&({frustum:r,plane:a}=TI(r,a,e.cameraPosition,i.maxContentElevation));let o=Wf(e),n=o.getCenter(e),s=XT(e,t,n),l=t.worldFromLngLat(n.lng,n.lat,e.elevation),u=bI(e,i.maxContentElevation),c=o.allowVariableZoom(e,i),h=Zf(e,i),d=i.minzoom||0,p=i.maxzoom===void 0?e.maxZoom:i.maxzoom,f=Math.min(Math.max(0,h),p),m=2**f,g=[m*s.x,m*s.y,0],_=[m*l.x,m*l.y,0],y=Math.hypot(l.x-s.x,l.y-s.y),v=Math.abs(l.z-s.z),x=Math.hypot(y,v),b=(E)=>({zoom:0,x:0,y:0,wrap:E,fullyVisible:!1}),w=[],T=[];if(e.renderWorldCopies&&t.wraps&&o.allowWorldCopies())for(let E=1;E<=3;E++)w.push(b(-E)),w.push(b(E));for(w.push(b(0));w.length>0;){let E=w.pop(),{x:S,y:A,fullyVisible:I}=E,R={x:S,y:A,z:E.zoom},k=o.getTileBoundingVolume(R,E.wrap,u,i);if(!I){let B=vI(r,k,a);if(B===0)continue;I=B===2}let M=o.distanceToTile2d(s.x,s.y,R,k),C=h;c&&(C=(i.calculateTileZoom||xI)(e.zoom+wt(e.tileSize/i.tileSize),M,v,x,e.fov)),C=(i.roundZoom?Math.round:Math.floor)(C),C=Math.max(0,C);let P=Math.min(C,p);if(E.wrap=o.getWrap(l,R,E.wrap),E.zoom>=P){if(E.zoom<d)continue;let B=f-E.zoom,N=g[0]-0.5-(S<<B),L=g[1]-0.5-(A<<B),W=i.reparseOverscaled?Math.max(E.zoom,C):E.zoom;T.push({tileID:new Et(E.zoom===p?W:E.zoom,E.wrap,E.zoom,S,A),distanceSq:G5([_[0]-0.5-S,_[1]-0.5-A]),tileDistanceToCamera:Math.sqrt(N*N+L*L)})}else for(let B=0;B<4;B++){let N=(S<<1)+B%2,L=(A<<1)+(B>>1),W=E.zoom+1;w.push({zoom:W,x:N,y:L,wrap:E.wrap,fullyVisible:I})}}return T.sort((E,S)=>E.distanceSq-S.distanceSq).map((E)=>E.tileID)}function t_(e){return e==="raster"||e==="image"||e==="video"}function EI(e,t,i,r,a,o,n){let s=Fe(),l=H5(t);for(let u of t){let c=e.getTileById(u.key);(c.fadingDirection===0||c.fadeOpacity===0)&&c.resetFadeLogic(),SI(e,c,i,s,r,a,n)||CI(e,c,i,s,o,n)||DI(c,l,s,n)||c.resetFadeLogic()}}function SI(e,t,i,r,a,o,n){if(!t.hasData())return!1;let{tileID:s,fadingRole:l,fadingDirection:u,fadingParentID:c}=t;if(l===0&&u===1&&c)return i[c.key]=c,!0;let h=Math.max(s.overscaledZ-a,o);for(let d=s.overscaledZ-1;d>=h;d--){let p=s.scaledTo(d),f=e.getLoadedTile(p);if(f)return t.setCrossFadeLogic({fadingRole:0,fadingDirection:1,fadingParentID:f.tileID,fadeEndTime:r+n}),f.setCrossFadeLogic({fadingRole:1,fadingDirection:0,fadeEndTime:r+n}),i[p.key]=p,!0}return!1}function CI(e,t,i,r,a,o){if(!t.hasData())return!1;let n=t.tileID.children(a),s=i_(e,t,n,i,r,a,o);if(s)return!0;for(let l of n)i_(e,t,l.children(a),i,r,a,o)&&(s=!0);return s}function i_(e,t,i,r,a,o,n){if(i[0].overscaledZ>o)return!1;let s=!1;for(let l of i){let u=e.getLoadedTile(l);if(!u)continue;let{fadingRole:c,fadingDirection:h,fadingParentID:d}=u;c===0&&h===0&&d||(u.setCrossFadeLogic({fadingRole:0,fadingDirection:0,fadingParentID:t.tileID,fadeEndTime:a+n}),t.setCrossFadeLogic({fadingRole:1,fadingDirection:1,fadeEndTime:a+n})),r[l.key]=l,s=!0}return s}function DI(e,t,i,r){let a=e.tileID;if(e.selfFading)return!0;if(e.hasData())return!1;if(t.has(a)){let o=i+r;return e.setSelfFadeLogic(o),!0}return!1}function AI(e,t){if(t<=0)return!1;let i=Fe();for(let r of e.getAllTiles())if(r.fadeEndTime>=i)return!0;return!1}function MI(e,t){let i=t.getRenderableIds();for(let r of i){if(!e.neighboringTiles?.[r])continue;let a=t.getTileById(r);e.neighboringTiles[r].backfilled||r_(e,a),a.neighboringTiles?.[e.tileID.key]?.backfilled||r_(a,e)}}function r_(e,t){e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.needsColorReliefPrepare=!0;let i=t.tileID.canonical.x-e.tileID.canonical.x,r=t.tileID.canonical.y-e.tileID.canonical.y,a=2**e.tileID.canonical.z,o=t.tileID.key;i===0&&r===0||Math.abs(r)>1||(Math.abs(i)>1&&(Math.abs(i+a)===1?i+=a:Math.abs(i-a)===1&&(i-=a)),t.dem&&e.dem&&(e.dem.backfillBorder(t.dem,i,r),e.neighboringTiles?.[o]&&(e.neighboringTiles[o].backfilled=!0)))}function Bl(e,t,i,r,a){return a?e?e(t,i)+r:r===0?void 0:r:r}function gl(e,t){let i=!0;return e==="always"||(e==="never"||t==="never")&&(i=!1),i}function Hf(e,t,i){let r=Lo();if(!e){let{vecSouth:a,vecEast:o}=Xf(t),n=Qh();n[0]=o[0],n[1]=o[1],n[2]=a[0],n[3]=a[1],g5(n,n),r[0]=n[0],r[1]=n[1],r[4]=n[2],r[5]=n[3]}return Xt(r,r,[1/i,1/i,1]),r}function kI(e,t,i,r){if(e){let a=Lo();if(!t){let{vecSouth:o,vecEast:n}=Xf(i);a[0]=n[0],a[1]=n[1],a[4]=o[0],a[5]=o[1]}return Xt(a,a,[r,r,1]),a}return i.pixelsToClipSpaceMatrix}function Xf(e){let t=Math.cos(e.rollInRadians),i=Math.sin(e.rollInRadians),r=Math.cos(e.pitchInRadians),a=Math.cos(e.bearingInRadians),o=Math.sin(e.bearingInRadians),n=ad();n[0]=-a*r*i-o*t,n[1]=-o*r*i+a*t;let s=Bg(n);s<0.000000001?Og(n):Lg(n,n,1/s);let l=ad();l[0]=a*r*t-o*i,l[1]=o*r*t+a*i;let u=Bg(l);return u<0.000000001?Og(l):Lg(l,l,1/u),{vecEast:l,vecSouth:n}}function Ra(e,t,i){return Bl(e.getElevation,t,i,e.heightOffset??0,e.heightAnchorGround??!0)}function Yf(e,t,i,r){let a;r==null?(a=[e,t,0,1],ff(a,a,i)):(a=[e,t,r,1],$t(a,a,i));let o=a[3];return{point:new D(a[0]/o,a[1]/o),signedDistanceFromCamera:o,isOccluded:!1}}function ub(e,t){return 0.5+e/t*0.5}function FI(e,t){return e.x>=-t[0]&&e.x<=t[0]&&e.y>=-t[1]&&e.y<=t[1]}function RI(e,t,i,r,a,o,n,s,l,u,c,h){let d=r?e.textSizeData:e.iconSizeData,p=tc(d,i.zoom),f=[256/t.width*2+1,256/t.height*2+1],m=r?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;m.clear();let g=e.lineVertexArray,_=r?e.text.placedSymbolArray:e.icon.placedSymbolArray,y=i.width/i.height,v=!1;for(let x=0;x<_.length;x++){let b=_.get(x);if(b.hidden||b.writingMode===2&&!v){wo(b.numGlyphs,m);continue}v=!1;let w={getElevation:h,pitchedLabelPlaneMatrix:a,lineVertexArray:g,pitchWithMap:n,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projectedCamera:i,tileAnchorPoint:new D(b.anchorX,b.anchorY),unwrappedTileID:u,width:i.width,height:i.height,translation:c},T=db(b.anchorX,b.anchorY,w);if(!FI(T.point,f)){wo(b.numGlyphs,m);continue}let E=T.signedDistanceFromCamera,S=ub(i.cameraToCenterDistance,E),A=Df(d,p,b),I=n?A*V(i).getPitchedTextCorrection(i,b.anchorX,b.anchorY,u)/S:A*S,R=l_({projectionContext:w,pitchedLabelPlaneMatrixInverse:o,symbol:b,fontSize:I,flip:!1,keepUpright:s,glyphOffsetArray:e.glyphOffsetArray,dynamicLayoutVertexArray:m,aspectRatio:y,rotateToLine:l});v=R.useVertical,(R.notEnoughRoom||v||R.needsFlipping&&l_({projectionContext:w,pitchedLabelPlaneMatrixInverse:o,symbol:b,fontSize:I,flip:!0,keepUpright:s,glyphOffsetArray:e.glyphOffsetArray,dynamicLayoutVertexArray:m,aspectRatio:y,rotateToLine:l}).notEnoughRoom)&&wo(b.numGlyphs,m)}r?e.text.dynamicLayoutVertexBuffer.updateData(m):e.icon.dynamicLayoutVertexBuffer.updateData(m)}function cb(e,t,i,r,a,o,n,s){let l=o.glyphStartIndex+o.numGlyphs,u=o.lineStartIndex,c=o.lineStartIndex+o.lineLength,h=t.getoffsetX(o.glyphStartIndex),d=t.getoffsetX(l-1),p=wu(e*h,i,r,a,o.segment,u,c,s,n);if(!p)return null;let f=wu(e*d,i,r,a,o.segment,u,c,s,n);return!f||s.projectionCache.anyProjectionOccluded?null:{first:p,last:f}}function s_(e,t,i,r){return e===1&&Math.abs(i.y-t.y)>Math.abs(i.x-t.x)*r?{useVertical:!0}:(e===2?t.y<i.y:t.x>i.x)?{needsFlipping:!0}:null}function l_(e){let{projectionContext:t,pitchedLabelPlaneMatrixInverse:i,symbol:r,fontSize:a,flip:o,keepUpright:n,glyphOffsetArray:s,dynamicLayoutVertexArray:l,aspectRatio:u,rotateToLine:c}=e,h=a/24,d=r.lineOffsetX*h,p=r.lineOffsetY*h,f;if(r.numGlyphs>1){let m=r.glyphStartIndex+r.numGlyphs,g=r.lineStartIndex,_=r.lineStartIndex+r.lineLength,y=cb(h,s,d,p,o,r,c,t);if(!y)return{notEnoughRoom:!0};let v=_l(y.first.point.x,y.first.point.y,t,i),x=_l(y.last.point.x,y.last.point.y,t,i);if(n&&!o){let b=s_(r.writingMode,v,x,u);if(b)return b}f=[y.first];for(let b=r.glyphStartIndex+1;b<m-1;b++){let w=wu(h*s.getoffsetX(b),d,p,o,r.segment,g,_,t,c);if(!w)return{notEnoughRoom:!0};f.push(w)}f.push(y.last)}else{if(n&&!o){let g=za(t.tileAnchorPoint.x,t.tileAnchorPoint.y,t).point,_=r.lineStartIndex+r.segment+1,y=new D(t.lineVertexArray.getx(_),t.lineVertexArray.gety(_)),v=za(y.x,y.y,t),x=v.signedDistanceFromCamera>0?v.point:hb(t.tileAnchorPoint,y,g,1,t),b=_l(g.x,g.y,t,i),w=_l(x.x,x.y,t,i),T=s_(r.writingMode,b,w,u);if(T)return T}let m=wu(h*s.getoffsetX(r.glyphStartIndex),d,p,o,r.segment,r.lineStartIndex,r.lineStartIndex+r.lineLength,t,c);if(!m||t.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};f=[m]}for(let m of f)_u(l,m.point,m.angle);return{}}function hb(e,t,i,r,a){let o=e.add(e.sub(t)._unit()),n=za(o.x,o.y,a).point,s=i.sub(n);return i.add(s._mult(r/s.mag()))}function Tp(e,t,i){let r=t.projectionCache;if(r.projections[e])return r.projections[e];let a=new D(t.lineVertexArray.getx(e),t.lineVertexArray.gety(e)),o=za(a.x,a.y,t);if(o.signedDistanceFromCamera>0)return r.projections[e]=o.point,r.anyProjectionOccluded||=o.isOccluded,o.point;let n=e-i.direction,s=i.distanceFromAnchor===0?t.tileAnchorPoint:new D(t.lineVertexArray.getx(n),t.lineVertexArray.gety(n)),l=i.absOffsetX-i.distanceFromAnchor+1;return hb(s,a,i.previousVertex,l,t)}function za(e,t,i){let r=e+i.translation[0],a=t+i.translation[1],o;return i.pitchWithMap?(o=Yf(r,a,i.pitchedLabelPlaneMatrix,Ra(i,r,a)),o.isOccluded=!1):(o=V(i.projectedCamera).projectTileCoordinates(i.projectedCamera,r,a,i.unwrappedTileID,Ra(i,r,a)),o.point.x=(o.point.x*0.5+0.5)*i.width,o.point.y=(-o.point.y*0.5+0.5)*i.height),o}function _l(e,t,i,r){if(i.pitchWithMap){let a=[e,t,0,1];$t(a,a,r);let o=a[0]/a[3],n=a[1]/a[3];return V(i.projectedCamera).projectTileCoordinates(i.projectedCamera,o,n,i.unwrappedTileID,Ra(i,o,n)).point}return{x:e/i.width*2-1,y:1-t/i.height*2}}function db(e,t,i){return V(i.projectedCamera).projectTileCoordinates(i.projectedCamera,e,t,i.unwrappedTileID,Ra(i,e,t))}function Ep(e,t,i){return e._unit()._perp()._mult(t*i)}function zI(e,t,i,r,a,o,n,s,l){if(s.projectionCache.offsets[e])return s.projectionCache.offsets[e];let u=i.add(t);if(e+l.direction<r||e+l.direction>=a)return s.projectionCache.offsets[e]=u,u;let c=Tp(e+l.direction,s,l),h=Ep(c.sub(i),n,l.direction),d=i.add(h),p=c.add(h),f=LI(e,l.direction,r,a,s.lineVertexArray);return s.projectionCache.offsets[e]=f?u:Q5(o,u,d,p)||u,s.projectionCache.offsets[e]}function LI(e,t,i,r,a){let o=e-t,n=e+t;if(Math.min(o,n)<i||Math.max(o,n)>=r)return!1;let s=a.getx(e)-a.getx(o),l=a.gety(e)-a.gety(o),u=a.getx(n)-a.getx(e),c=a.gety(n)-a.gety(e);return s*c-l*u===0&&s*u+l*c<0}function wu(e,t,i,r,a,o,n,s,l){let u=r?e-t:e+t,c=u>0?1:-1,h=0;r&&(c*=-1,h=Math.PI),c<0&&(h+=Math.PI);let d=c>0?o+a:o+a+1,p;s.projectionCache.cachedAnchorPoint?p=s.projectionCache.cachedAnchorPoint:(p=za(s.tileAnchorPoint.x,s.tileAnchorPoint.y,s).point,s.projectionCache.cachedAnchorPoint=p);let f=p,m=p,g,_,y=0,v=0,x=Math.abs(u),b=[],w;for(;y+v<=x;){if(d+=c,d<o||d>=n)return null;y+=v,m=f,_=g;let A={absOffsetX:x,direction:c,distanceFromAnchor:y,previousVertex:m};if(f=Tp(d,s,A),i===0)b.push(m),w=f.sub(m);else{let I,R=f.sub(m);I=R.mag()===0?Ep(Tp(d+c,s,A).sub(f),i,c):Ep(R,i,c),_||=m.add(I),g=zI(d,I,f,o,n,_,i,s,A),b.push(_),w=g.sub(_)}v=w.mag()}let T=(x-y)/v,E=w._mult(T)._add(_||m),S=h+Math.atan2(f.y-m.y,f.x-m.x);return b.push(E),{point:E,angle:l?S:0,path:b}}function wo(e,t){for(let i=0;i<e;i++){let r=t.length;t.resize(r+4),t.float32.set(BI,r*3)}}function OI(e,t){let i=II;return eE(i,t.pitchedLabelPlaneMatrix),e.map((r)=>{let a=Yf(r.x,r.y,i,Ra(t,r.x,r.y)),o=V(t.projectedCamera).projectTileCoordinates(t.projectedCamera,a.point.x,a.point.y,t.unwrappedTileID,Ra(t,a.point.x,a.point.y));return o.point.x=(o.point.x*0.5+0.5)*t.width,o.point.y=(-o.point.y*0.5+0.5)*t.height,o})}function jI(e){let t=0,i=0,r=0,a=0;for(let o=0;o<e.length;o++)e[o].isOccluded?(r=o+1,a=0):(a++,a>i&&(i=a,t=r));return e.slice(t,t+i)}function h_(e,t,i,r,a){let{horizontalAlign:o,verticalAlign:n}=ec(e),s=-(o-0.5)*t,l=-(n-0.5)*i;return new D(s+r[0]*a,l+r[1]*a)}function d_(e,t,i,r,a,o){r&&r.length!==0||(r=[0,0,0,0]);let n=r[0]-100,s=r[1]-100,l=r[2]-100,u=r[3]-100;e.emplaceBack(+!!t,+!!i,a||0,o||0,n,s),e.emplaceBack(+!!t,+!!i,a||0,o||0,l,s),e.emplaceBack(+!!t,+!!i,a||0,o||0,l,u),e.emplaceBack(+!!t,+!!i,a||0,o||0,n,u)}function p_(e){if(e.opacity===0&&!e.placed)return 0;if(e.opacity===1&&e.placed)return XI;let t=+!!e.placed,i=Math.floor(e.opacity*127);return i*GI+t*WI+i*ZI+t*HI+i*512+t*256+i*2+t}function Sp(e,t,i,r,a,o){if(a-r<=i)return;let n=r+a>>1;pb(e,t,n,r,a,o),Sp(e,t,i,r,n-1,1-o),Sp(e,t,i,n+1,a,1-o)}function pb(e,t,i,r,a,o){for(;a>r;){if(a-r>600){let u=a-r+1,c=i-r+1,h=Math.log(u),d=0.5*Math.exp(2*h/3),p=0.5*Math.sqrt(h*d*(u-d)/u)*(c-u/2<0?-1:1);pb(e,t,i,Math.max(r,Math.floor(i-c*d/u+p)),Math.min(a,Math.floor(i+(u-c)*d/u+p)),o)}let n=t[2*i+o],s=r,l=a;for(mn(e,t,r,i),t[2*a+o]>n&&mn(e,t,r,a);s<l;){for(mn(e,t,s,l),s++,l--;t[2*s+o]<n;)s++;for(;t[2*l+o]>n;)l--}t[2*r+o]===n?mn(e,t,r,l):(l++,mn(e,t,l,a)),l<=i&&(r=l+1),i<=l&&(a=l-1)}}function mn(e,t,i,r){Bh(e,i,r),Bh(t,2*i,2*r),Bh(t,2*i+1,2*r+1)}function Bh(e,t,i){let r=e[t];e[t]=e[i],e[i]=r}function m_(e,t,i,r){let a=e-i,o=t-r;return a*a+o*o}function Te(e,t){let i=/#pragma maplibre: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,r=t.match(/in ([\w]+) ([\w]+)/g),a=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),o=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),n=o?o.concat(a):a,s=r?r.length:0,l={};return e=e.replace(i,(u,c,h,d,p)=>(l[p]=!0,c==="define"?`
3
+ #ifndef HAS_UNIFORM_u_${p}
4
+ in ${h} ${d} ${p};
5
+ #else
6
+ uniform ${h} ${d} u_${p};
7
+ #endif
8
+ `:`
9
+ #ifdef HAS_UNIFORM_u_${p}
10
+ ${h} ${d} ${p} = u_${p};
11
+ #endif
12
+ `)),t=t.replace(i,(u,c,h,d,p)=>{let f=d==="float"?"vec2":"vec4",m=p.match(/color/)?"color":f;return l[p]?c==="define"?`
13
+ #ifndef HAS_UNIFORM_u_${p}
14
+ uniform lowp float u_${p}_t;
15
+ layout(location = ${s++}) in ${h} ${f} a_${p};
16
+ out ${h} ${d} ${p};
17
+ #else
18
+ uniform ${h} ${d} u_${p};
19
+ #endif
20
+ `:m==="vec4"?`
21
+ #ifndef HAS_UNIFORM_u_${p}
22
+ ${p} = a_${p};
23
+ #else
24
+ ${h} ${d} ${p} = u_${p};
25
+ #endif
26
+ `:`
27
+ #ifndef HAS_UNIFORM_u_${p}
28
+ ${p} = unpack_mix_${m}(a_${p}, u_${p}_t);
29
+ #else
30
+ ${h} ${d} ${p} = u_${p};
31
+ #endif
32
+ `:c==="define"?`
33
+ #ifndef HAS_UNIFORM_u_${p}
34
+ uniform lowp float u_${p}_t;
35
+ layout(location = ${s++}) in ${h} ${f} a_${p};
36
+ #else
37
+ uniform ${h} ${d} u_${p};
38
+ #endif
39
+ `:m==="vec4"?`
40
+ #ifndef HAS_UNIFORM_u_${p}
41
+ ${h} ${d} ${p} = a_${p};
42
+ #else
43
+ ${h} ${d} ${p} = u_${p};
44
+ #endif
45
+ `:`
46
+ #ifndef HAS_UNIFORM_u_${p}
47
+ ${h} ${d} ${p} = unpack_mix_${m}(a_${p}, u_${p}_t);
48
+ #else
49
+ ${h} ${d} ${p} = u_${p};
50
+ #endif
51
+ `}),{fragmentSource:e,vertexSource:t,staticAttributes:r,staticUniforms:n}}function y_(e,t){if(Array.isArray(e)){let r=p7(e);return r&&he(`Projection expressions cannot use the registered projection "${r}", which only works as a plain name. Falling back to the globe projection.`),{projection:new __({type:e},t),cameraProjection:"globe"}}let i=rc(e);if(i)return{projection:new Ol(new sM(i)),cameraProjection:"mercator"};switch(e){case"mercator":return{projection:new Ol,cameraProjection:"mercator"};case"globe":return{projection:new __({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]},{}),cameraProjection:"globe"};case"vertical-perspective":return{projection:new gb,cameraProjection:"vertical-perspective"};default:return he(`Unknown projection name: ${e}. Falling back to mercator projection.`),{projection:new Ol,cameraProjection:"mercator"}}}function p7(e){return e.flat(1/0).find((t)=>typeof t=="string"&&rc(t)!==void 0)}function Q7(e,t){for(let[i,r]of Object.entries(nc)){let a=e.getUniformBlockIndex(t,i);a!==e.INVALID_INDEX&&e.uniformBlockBinding(t,a,r)}}function Jf(e){let t={},i=0;for(let{name:r,type:a}of e){let[o,n]=ek[a];i=Math.ceil(i/n)*n,t[r]=i,i+=o}return{offsets:t,contentWords:i,sizeWords:Math.ceil(i/4)*4}}function yb(e){return new Qf(e,nc.ProjectionUBO,_b)}function b_(e,t){let i=e.pending;i.set(t.mainMatrix,ro.u_projection_matrix),i.set(t.fallbackMatrix,ro.u_projection_fallback_matrix),i.set(t.tileMercatorCoords,ro.u_projection_tile_mercator_coords),i.set(t.clippingPlane,ro.u_projection_clipping_plane),i[ro.u_projection_transition]=t.projectionTransition,e.pendingWords[ro.u_projection_clip_antimeridian]=+!!t.clipAntimeridian,e.upload()}function tk(e,t){if(!t){e.projectionUniformBuffer.bind();return}let i=t.uniformBufferKey;if(i===void 0){b_(e.projectionUniformBuffer,t);return}let r=e.keyedProjectionUniformBuffers.get(i);if(r){r.bind();return}let a=e.freeProjectionUniformBuffers.pop()??yb(e);e.keyedProjectionUniformBuffers.set(i,a),b_(a,t)}function ik(e){e.freeProjectionUniformBuffers.push(...e.keyedProjectionUniformBuffers.values()),e.keyedProjectionUniformBuffers.clear()}function rk(e){e.projectionUniformBuffer.destroy();for(let t of e.keyedProjectionUniformBuffers.values())t.destroy();for(let t of e.freeProjectionUniformBuffers)t.destroy()}function ak(e){return new Qf(e,nc.FrameUBO,vb)}function ok(e,t,i){let r=e.pending,a=e.context.gl;r[Zt.u_units_to_pixels]=1/t.pixelsToGLUnits[0],r[Zt.u_units_to_pixels+1]=1/t.pixelsToGLUnits[1],r[Zt.u_world_size]=a.drawingBufferWidth,r[Zt.u_world_size+1]=a.drawingBufferHeight,r[Zt.u_camera_to_center_distance]=t.cameraToCenterDistance,r[Zt.u_symbol_fade_change]=i.fadeDuration?i.symbolFadeChange:1,r[Zt.u_aspect_ratio]=t.width/t.height,r[Zt.u_device_pixel_ratio]=i.pixelRatio,r[Zt.u_viewport_size]=t.width,r[Zt.u_viewport_size+1]=t.height,r[Zt.u_pixel_extrude_scale]=1/t.width,r[Zt.u_pixel_extrude_scale+1]=1/t.height,r[Zt.u_pitch]=t.pitch/360*2*Math.PI,e.upload()}function w_(e,t,i){let r=e.pending;r[Zt.u_world_size]=t,r[Zt.u_world_size+1]=i,e.upload()}function nk(e){return new Qf(e,nc.TerrainUBO,xb)}function sk(e,t){let i=e.pending;i.set(t.u_terrain_matrix,yl.u_terrain_matrix),i.set(t.u_terrain_unpack,yl.u_terrain_unpack),i[yl.u_terrain_dim]=t.u_terrain_dim,i[yl.u_terrain_exaggeration]=t.u_terrain_exaggeration,e.upload()}function jh(e){let t=[];for(let i of e){if(i===null)continue;let r=i.split(" ");t.push(r.pop())}return t}function _k(e,t){let i=new Set([e.INT,e.INT_VEC2,e.INT_VEC3,e.INT_VEC4,e.UNSIGNED_INT,e.UNSIGNED_INT_VEC2,e.UNSIGNED_INT_VEC3,e.UNSIGNED_INT_VEC4]),r=new Set,a=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let o=0;o<a;o++){let n=e.getActiveAttrib(t,o);n&&i.has(n.type)&&r.add(n.name)}return r}function bb(e,t,i){let r=1/Ti(i,1,t.tileZoom),a=2**i.tileID.overscaledZ,o=i.tileSize*2**t.tileZoom/a,n=o*(i.tileID.canonical.x+i.tileID.wrap*a),s=o*i.tileID.canonical.y;return{u_image:0,u_texsize:i.imageAtlasTexture.size,u_scale:[r,e.fromScale,e.toScale],u_fade:e.t,u_pixel_coord_upper:[n>>16,s>>16],u_pixel_coord_lower:[n&65535,s&65535]}}function vk(e,t,i,r,a){let o=i.getPattern(e.from.toString()),n=i.getPattern(e.to.toString()),{width:s,height:l}=i.getPixelSize(),u=2**a.tileID.overscaledZ,c=a.tileSize*2**r.tileZoom/u,h=c*(a.tileID.canonical.x+a.tileID.wrap*u),d=c*a.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:o.tl,u_pattern_br_a:o.br,u_pattern_tl_b:n.tl,u_pattern_br_b:n.br,u_texsize:[s,l],u_mix:t.t,u_pattern_size_a:o.displaySize,u_pattern_size_b:n.displaySize,u_scale_a:t.fromScale,u_scale_b:t.toScale,u_tile_units_to_pixels:1/Ti(a,1,r.tileZoom),u_pixel_coord_upper:[h>>16,d>>16],u_pixel_coord_lower:[h&65535,d&65535]}}function jk(e){return e.wraps?25.2562:Math.log2(e.metersPerWorldUnit(0.5,0.5))}function Nk(e,t){if(!e.wraps)return[0,0];let i=2**t.canonical.z,r=t.canonical.y;return[e.lngLatFromWorld(0,r/i).lat,e.lngLatFromWorld(0,(r+1)/i).lat]}function em(e,t){return 1/Ti(e,1,t.tileZoom)}function Cb(e,t,i){return aa(e,t,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}function S_(e,t,i,r,a){let o=a.context,n=o.gl,s=a.useProgram("collisionBox"),l=[],u=0,c=0;for(let g of i){let _=e.getTile(g).getBucket(t);if(!_)continue;let y=r?_.textCollisionBox:_.iconCollisionBox,v=_.collisionCircleArray;v.length>0&&(l.push({circleArray:v,circleOffset:c,coord:g}),u+=v.length/4,c=u),y&&s.draw(o,n.LINES,xe.disabled,Ce.disabled,a.colorModeForRenderPass(),Ae.disabled,null,a.getTerrainDataForTile(g),a.getProjectionDataForTile(g),t.id,y.layoutVertexBuffer,y.indexBuffer,y.segments,null,a.projectedCamera.zoom,null,null,y.collisionVertexBuffer)}if(!r||!l.length)return;let h=a.useProgram("collisionCircle"),d=new CT;d.resize(u*4),d._trim();let p=0;for(let g of l)for(let _=0;_<g.circleArray.length/4;_++){let y=_*4,v=g.circleArray[y+0],x=g.circleArray[y+1],b=g.circleArray[y+2],w=g.circleArray[y+3];d.emplace(p++,v,x,b,w,0),d.emplace(p++,v,x,b,w,1),d.emplace(p++,v,x,b,w,2),d.emplace(p++,v,x,b,w,3)}(!xl||xl.length<u*2)&&(xl=f9(u));let f=o.createIndexBuffer(xl,!0),m=o.createVertexBuffer(d,bC.members,!0);for(let g of l)h.draw(o,n.TRIANGLES,xe.disabled,Ce.disabled,a.colorModeForRenderPass(),Ae.disabled,null,a.getTerrainDataForTile(g.coord),null,t.id,m,f,tt.simpleSegment(0,g.circleOffset*2,g.circleArray.length,g.circleArray.length/2),null,a.projectedCamera.zoom,null,null,null);m.destroy(),f.destroy()}function f9(e){let t=e*2,i=new AT;i.resize(t),i._trim();for(let r=0;r<t;r++){let a=r*6;i.uint16[a+0]=r*4+0,i.uint16[a+1]=r*4+1,i.uint16[a+2]=r*4+2,i.uint16[a+3]=r*4+2,i.uint16[a+4]=r*4+3,i.uint16[a+5]=r*4+0}return i}function g9(e,t,i,r,a){if(a.currentPass!=="translucent")return;let o=Ce.disabled,n=a.colorModeForRenderPass();(i._unevaluatedLayout.hasValue("text-variable-anchor")||i._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&y9(r,i,t,i.layout.get("text-rotation-alignment"),i.layout.get("text-pitch-alignment"),i.paint.get("text-translate"),i.paint.get("text-translate-anchor"),a),i.paint.get("icon-opacity").constantOr(1)!==0&&C_(e,t,i,r,!1,i.paint.get("icon-translate"),i.paint.get("icon-translate-anchor"),i.layout.get("icon-rotation-alignment").constantOr("viewport"),i.layout.get("icon-pitch-alignment"),i.layout.get("icon-keep-upright"),o,n,a),i.paint.get("text-opacity").constantOr(1)!==0&&C_(e,t,i,r,!0,i.paint.get("text-translate"),i.paint.get("text-translate-anchor"),i.layout.get("text-rotation-alignment"),i.layout.get("text-pitch-alignment"),i.layout.get("text-keep-upright"),o,n,a),t.map.showCollisionBoxes&&(S_(t,i,r,!0,a),S_(t,i,r,!1,a))}function _9(e,t,i,r,a,o){let{horizontalAlign:n,verticalAlign:s}=ec(e),l=-(n-0.5)*t,u=-(s-0.5)*i;return new D((l/a+r[0])*o,(u/a+r[1])*o)}function y9(e,t,i,r,a,o,n,s){let{projectedCamera:l,terrain:u}=s,c=s.data.variableOffsets,h=r==="map",d=a==="map";for(let p of e){let f=i.getTile(p),m=f.getBucket(t);if(!m?.text?.segments.get().length)continue;let g=m.textSizeData,_=tc(g,l.zoom),y=Hf(h,l,Ti(f,1,l.zoom)),v=t.layout.get("icon-text-fit")!=="none"&&m.hasIconData();if(_){let x=2**(l.zoom-f.tileID.overscaledZ),b=u?(w,T)=>u.getElevation(p,w,T):void 0;x9(m,h,d,c,l,y,x,_,v,aa(l,f,o,n),p.toUnwrapped(),b,t.layout.get("symbol-height-anchor")==="ground")}}}function v9(e,t,i,r,a,o){let n=t.tileAnchorPoint.add(new D(t.translation[0],t.translation[1]));if(t.pitchWithMap){let s=r.mult(o);i||(s=s.rotate(-a));let l=n.add(s);return Yf(l.x,l.y,t.pitchedLabelPlaneMatrix,Ra(t,l.x,l.y)).point}if(i){let s=za(t.tileAnchorPoint.x+1,t.tileAnchorPoint.y,t).point.sub(e),l=Math.atan(s.y/s.x)+(s.x<0?Math.PI:0);return e.add(r.rotate(l))}return e.add(r)}function x9(e,t,i,r,a,o,n,s,l,u,c,h,d){let p=e.text.placedSymbolArray,f=e.text.dynamicLayoutVertexArray,m=e.icon.dynamicLayoutVertexArray,g={};f.clear();for(let _=0;_<p.length;_++){let y=p.get(_),v=e.allowVerticalPlacement&&!y.placedOrientation,x=!y.hidden&&y.crossTileID&&!v?r[y.crossTileID]:null;if(!x)wo(y.numGlyphs,f);else{let b=new D(y.anchorX,y.anchorY),w={getElevation:h,heightOffset:y.heightOffset,heightAnchorGround:d,width:a.width,height:a.height,pitchedLabelPlaneMatrix:o,lineVertexArray:null,pitchWithMap:i,projectedCamera:a,projectionCache:null,tileAnchorPoint:b,translation:u,unwrappedTileID:c},T=i?db(b.x,b.y,w):za(b.x,b.y,w),E=ub(a.cameraToCenterDistance,T.signedDistanceFromCamera),S=Df(e.textSizeData,s,y)*E/24;i&&(S*=e.tilePixelRatio/n);let{width:A,height:I,anchor:R,textOffset:k,textBoxScale:M}=x,C=_9(R,A,I,k,M,S),P=V(a).getPitchedTextCorrection(a,b.x+u[0],b.y+u[1],c),B=v9(T.point,w,t,C,-a.bearingInRadians,P),N=e.allowVerticalPlacement&&y.placedOrientation===2?Math.PI/2:0;for(let L=0;L<y.numGlyphs;L++)_u(f,B,N);l&&y.associatedIconIndex>=0&&(g[y.associatedIconIndex]={shiftedAnchor:B,angle:N})}}if(l){m.clear();let _=e.icon.placedSymbolArray;for(let y=0;y<_.length;y++){let v=_.get(y);if(v.hidden)wo(v.numGlyphs,m);else{let x=g[y];if(!x)wo(v.numGlyphs,m);else for(let b=0;b<v.numGlyphs;b++)_u(m,x.shiftedAnchor,x.angle)}}e.icon.dynamicLayoutVertexBuffer.updateData(m)}e.text.dynamicLayoutVertexBuffer.updateData(f)}function b9(e,t,i){return i.iconsInText&&t?"symbolTextAndIcon":e?"symbolSDF":"symbolIcon"}function C_(e,t,i,r,a,o,n,s,l,u,c,h,d){let p=d.context,f=p.gl,m=d.projectedCamera,g=s==="map",_=l==="map",y=s!=="viewport"&&i.layout.get("symbol-placement")!=="point",v=g&&!_&&!y,x=!i.layout.get("symbol-sort-key").isConstant(),b=!1,w=d.getDepthModeForSublayer(0,xe.ReadOnly),T=i._unevaluatedLayout.hasValue("text-variable-anchor")||i._unevaluatedLayout.hasValue("text-variable-anchor-offset"),E=[],S=V(m).getCircleRadiusCorrection(m);for(let R of r){let k=t.getTile(R),M=k.getBucket(i);if(!M)continue;let C=a?M.text:M.icon;if(!C?.segments.get().length||!C.hasVisibleVertices)continue;let P=C.programConfigurations.get(i.id),B=a||M.sdfIcons,N=a?M.textSizeData:M.iconSizeData,L=_||m.pitch!==0,W=d.useProgram(b9(B,a,M),P),Q=tc(N,m.zoom),be=d.getTerrainDataForTile(R),le,je=[0,0],Le,Qe,Oe=null,It;if(a){if(Le=k.glyphAtlasTexture,Qe=f.LINEAR,le=k.glyphAtlasTexture.size,M.iconsInText){je=k.imageAtlasTexture.size,Oe=k.imageAtlasTexture;let J=N.kind==="composite"||N.kind==="camera";It=L||d.data.rotating||d.data.zooming||J?f.LINEAR:f.NEAREST}}else{let J=i.layout.get("icon-size").constantOr(0)!==1||M.iconsNeedLinear;Le=k.imageAtlasTexture,Qe=B||d.data.rotating||d.data.zooming||J||L?f.LINEAR:f.NEAREST,le=k.imageAtlasTexture.size}let jt=Ti(k,1,d.projectedCamera.zoom),Ut=Hf(g,d.projectedCamera,jt),vt=kI(_,g,d.projectedCamera,jt),qt=aa(m,k,o,n),ir=d.getProjectionDataForTile(R),nt=T&&M.hasTextData(),hi=i.layout.get("icon-text-fit")!=="none"&&nt&&M.hasIconData(),di=i._unevaluatedLayout.hasValue("icon-offset"),X=i.layout.get("symbol-height-anchor")==="ground";if(y){let J=Lo();JT(J,Ut);let me=d.terrain?(Ne,Ee)=>d.terrain.getElevation(R,Ne,Ee):void 0;RI(M,e,m,a,Ut,J,_,u,i.layout.get("text-rotation-alignment")==="map",R.toUnwrapped(),qt,me)}let ge=a&&T||hi,ye=_?Ut:d.projectedCamera.clipSpaceToPixelsMatrix,j=y||ge?m9:ye,ue=B&&i.paint.get(a?"text-halo-width":"icon-halo-width").constantOr(1)!==0,K;K=B?M.iconsInText?r9(N.kind,Q,v,_,y,ge,m,j,vt,qt,le,je,S,di,X):Ab(N.kind,Q,v,_,y,ge,m,j,vt,qt,a,le,ue,S,di,X):Db(N.kind,Q,v,_,y,ge,j,vt,qt,a,le,S,di,X);let re={program:W,buffers:C,uniformValues:K,projectionData:ir,atlasTexture:Le,atlasTextureIcon:Oe,atlasInterpolation:Qe,atlasInterpolationIcon:It,isSDF:B,hasHalo:ue,hasCursiveText:a&&M.hasCursiveText};if(x&&M.canOverlap){b=!0;let J=C.segments.get();for(let me of J)E.push({segments:new tt([me]),sortKey:me.sortKey,state:re,terrainData:be})}else E.push({segments:C.segments,sortKey:0,state:re,terrainData:be})}b&&E.sort((R,k)=>R.sortKey-k.sortKey);let A=i.paint.get(a?"text-halo-width":"icon-halo-width").constantOr(null)??1/0,I=i.layout.get("text-letter-spacing").constantOr(0)*24<0||A>1;for(let R of E){let k=R.state;p.activeTexture.set(f.TEXTURE0),k.atlasTexture.bind(k.atlasInterpolation,f.CLAMP_TO_EDGE),k.atlasTextureIcon&&(p.activeTexture.set(f.TEXTURE1),k.atlasTextureIcon&&k.atlasTextureIcon.bind(k.atlasInterpolationIcon,f.CLAMP_TO_EDGE));let M=k.isSDF&&k.hasHalo,C=I||k.hasCursiveText;if(M){let P=k.uniformValues;P.u_is_halo=1,C&&(P.u_is_plain=0,D_(k.buffers,R.segments,i,d,k.program,w,c,h,P,k.projectionData,R.terrainData),P.u_is_halo=0,P.u_is_plain=1)}D_(k.buffers,R.segments,i,d,k.program,w,c,h,k.uniformValues,k.projectionData,R.terrainData),M&&!C&&(k.uniformValues.u_is_halo=0)}}function D_(e,t,i,r,a,o,n,s,l,u,c){let h=r.context,d=h.gl;a.draw(h,d.TRIANGLES,o,n,s,Ae.backCCW,l,c,u,i.id,e.layoutVertexBuffer,e.indexBuffer,t,i.paint,r.projectedCamera.zoom,e.programConfigurations.get(i.id),e.dynamicLayoutVertexBuffer,e.opacityVertexBuffer)}function w9(e,t,i,r){if(r.currentPass!=="translucent")return;let a=t.paint.get("circle-opacity"),o=t.paint.get("circle-stroke-width"),n=t.paint.get("circle-stroke-opacity"),s=!t.layout.get("circle-sort-key").isConstant();if(a.constantOr(1)===0&&(o.constantOr(1)===0||n.constantOr(1)===0))return;let l=r.context,u=l.gl,c=r.projectedCamera,h=r.getDepthModeForSublayer(0,xe.ReadOnly),d=Ce.disabled,p=r.colorModeForRenderPass(),f=[],m=V(c).getCircleRadiusCorrection(c);for(let g of i){let _=e.getTile(g),y=_.getBucket(t);if(!y)continue;let v=aa(c,_,t.paint.get("circle-translate"),t.paint.get("circle-translate-anchor")),x=y.programConfigurations.get(t.id),b=r.useProgram("circle",x),{layoutVertexBuffer:w,indexBuffer:T}=y,E=r.getTerrainDataForTile(g),S={programConfiguration:x,program:b,layoutVertexBuffer:w,indexBuffer:T,uniformValues:Ik(c,_,t,v,m),terrainData:E,projectionData:r.getProjectionDataForTile(g)};if(s){let A=y.segments.get();for(let I of A)f.push({segments:new tt([I]),sortKey:I.sortKey,state:S})}else f.push({segments:y.segments,sortKey:0,state:S})}s&&f.sort((g,_)=>g.sortKey-_.sortKey);for(let g of f){let{programConfiguration:_,program:y,layoutVertexBuffer:v,indexBuffer:x,uniformValues:b,terrainData:w,projectionData:T}=g.state,E=g.segments;y.draw(l,u.TRIANGLES,h,d,p,Ae.backCCW,b,w,T,t.id,v,x,E,t.paint,r.projectedCamera.zoom,_)}}function T9(e,t,i,r,a){if(i.paint.get("heatmap-opacity")===0)return;let o=a.context;if(a.terrain){for(let n of r){let s=t.getTile(n);t.hasRenderableParent(n)||(a.currentPass==="offscreen"?C9(s,i,n,a):a.currentPass==="translucent"&&D9(e,i,n,a))}o.viewport.set([0,0,e.width,e.height])}else a.currentPass==="offscreen"?E9(e,t,i,r,a):a.currentPass==="translucent"&&S9(e,i,a)}function E9(e,t,i,r,a){let o=a.context,n=o.gl,s=a.projectedCamera,l=Ce.disabled,u=new ze([n.ONE,n.ONE],se.transparent,[!0,!0,!0,!0]);A9(o,e,i),o.clear({color:se.transparent});for(let c of r){if(t.hasRenderableParent(c))continue;let h=t.getTile(c),d=h.getBucket(i);if(!d)continue;let p=d.programConfigurations.get(i.id),f=a.useProgram("heatmap",p),m=a.getProjectionDataForTile(c,{applyTerrainMatrix:!1}),g=V(s).getCircleRadiusCorrection(s);f.draw(o,n.TRIANGLES,xe.disabled,l,u,Ae.backCCW,Eb(h,s.zoom,i.paint.get("heatmap-intensity"),g),null,m,i.id,d.layoutVertexBuffer,d.indexBuffer,d.segments,i.paint,s.zoom,p)}o.viewport.set([0,0,e.width,e.height])}function S9(e,t,i){let r=i.context,a=r.gl;r.setColorMode(i.colorModeForRenderPass());let o=t.heatmapFbos.get(cu);o&&(r.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,o.colorAttachment.get()),r.activeTexture.set(a.TEXTURE1),Pb(r,t).bind(a.LINEAR,a.CLAMP_TO_EDGE),i.useProgram("heatmapTexture").draw(r,a.TRIANGLES,xe.disabled,Ce.disabled,i.colorModeForRenderPass(),Ae.disabled,Sb(e,t,0,1),null,null,t.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,t.paint,i.projectedCamera.zoom))}function C9(e,t,i,r){let a=r.context,o=a.gl,n=Ce.disabled,s=new ze([o.ONE,o.ONE],se.transparent,[!0,!0,!0,!0]),l=e.getBucket(t);if(!l)return;let u=i.key,c=t.heatmapFbos.get(u);c||(c=Mb(a,e.tileSize,e.tileSize),t.heatmapFbos.set(u,c)),a.bindFramebuffer.set(c.framebuffer),a.viewport.set([0,0,e.tileSize,e.tileSize]),a.clear({color:se.transparent});let h=l.programConfigurations.get(t.id),d=r.useProgram("heatmap",h,!r.data.isRenderingGlobe),p=r.getProjectionDataForTile(e.tileID),f=r.getTerrainDataForTile(i);d.draw(a,o.TRIANGLES,xe.disabled,n,s,Ae.disabled,Eb(e,r.projectedCamera.zoom,t.paint.get("heatmap-intensity"),1),f,p,t.id,l.layoutVertexBuffer,l.indexBuffer,l.segments,t.paint,r.projectedCamera.zoom,h)}function D9(e,t,i,r){let a=r.context,o=a.gl,n=r.projectedCamera;a.setColorMode(r.colorModeForRenderPass());let s=Pb(a,t),l=i.key,u=t.heatmapFbos.get(l);if(!u)return;a.activeTexture.set(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,u.colorAttachment.get()),a.activeTexture.set(o.TEXTURE1),s.bind(o.LINEAR,o.CLAMP_TO_EDGE);let c=r.getProjectionDataForTile(i,{applyTerrainMatrix:r.data.isRenderingGlobe});r.useProgram("heatmapTexture").draw(a,o.TRIANGLES,xe.disabled,Ce.disabled,r.colorModeForRenderPass(),Ae.disabled,Sb(e,t,0,1),null,c,t.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments,t.paint,n.zoom),u.destroy(),t.heatmapFbos.delete(l)}function A9(e,t,i){let r=e.gl;e.activeTexture.set(r.TEXTURE1),e.viewport.set([0,0,t.width/4,t.height/4]);let a=i.heatmapFbos.get(cu);a?(r.bindTexture(r.TEXTURE_2D,a.colorAttachment.get()),e.bindFramebuffer.set(a.framebuffer)):(a=Mb(e,t.width/4,t.height/4),i.heatmapFbos.set(cu,a))}function Mb(e,t,i){let r=e.gl,a=r.createTexture();r.bindTexture(r.TEXTURE_2D,a),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),r.texStorage2D(r.TEXTURE_2D,1,r.RGBA16F,t,i);let o=e.createFramebuffer(t,i,!1,!1);return o.colorAttachment.set(a),o}function Pb(e,t){return t.colorRampTexture||=new yt(e,t.colorRamp,e.gl.RGBA),t.colorRampTexture}function jl(e){return e in Ib}function M9(e){return N2(e)?jl(e.paint.get("fill-layer-blend")):G2(e)?jl(e.paint.get("line-layer-blend")):Zn(e)?jl(e.paint.get("raster-layer-blend")):!1}function k9(e,t){let[,,i,r]=t.context.viewport.get(),a=[0,0,i,r];if(e.length===0)return[0,0,0,0];if(t.terrain||t.data.useSubdivision)return a;let o=1/0,n=-1/0,s=1/0,l=-1/0;for(let p of e){let f=p.toUnwrapped();for(let[m,g]of I9){let{point:_,signedDistanceFromCamera:y}=V(t.projectedCamera).projectTileCoordinates(t.projectedCamera,m,g,f,null);if(y<=0)return a;let v=(_.x+1)*0.5*i,x=(_.y+1)*0.5*r;v<o&&(o=v),v>n&&(n=v),x<s&&(s=x),x>l&&(l=x)}}let u=Math.max(0,Math.floor(o)),c=Math.max(0,Math.floor(s)),h=Math.min(i,Math.ceil(n)),d=Math.min(r,Math.ceil(l));return h<=u||d<=c?[0,0,0,0]:[u,c,h-u,d-c]}function tm(e,t,i,r,a){let o=a.context,n=o.bindFramebuffer.get(),s=o.viewport.get(),[,,l,u]=s;a.layerCompositeSampled&&o.gl.flush(),F9(e,l,u),o.viewport.set([0,0,l,u]),o.clear({color:se.transparent,depth:1,stencil:0}),a.invalidateTileClippingMasks(),a.renderTileClippingMasks(i,r);let c=r.filter((h)=>t.getTile(h)?.getBucket(i));return{compositeTarget:n,compositeViewport:s,bounds:Zn(i)?[0,0,l,u]:k9(c,a)}}function F9(e,t,i){let r=e.context.gl;if(!e.layerCompositeFbo){let o=e.context.createFramebuffer(t,i,!0,!0);o.colorAttachment.set(kb(e,t,i)),o.depthAttachment.set(e.context.createRenderbuffer(r.DEPTH_STENCIL,t,i)),e.layerCompositeFbo=o,e.context.bindFramebuffer.set(e.layerCompositeFbo.framebuffer);return}if(e.layerCompositeFbo.width===t&&e.layerCompositeFbo.height===i){e.context.bindFramebuffer.set(e.layerCompositeFbo.framebuffer);return}let a=e.layerCompositeFbo;r.bindTexture(r.TEXTURE_2D,a.colorAttachment.get()),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,t,i,0,r.RGBA,r.UNSIGNED_BYTE,null),e.context.bindRenderbuffer.set(a.depthAttachment.get()),r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,t,i),e.context.bindRenderbuffer.set(null),a.width=t,a.height=i,e.context.bindFramebuffer.set(a.framebuffer)}function kb(e,t,i){let r=e.context.gl,a=r.createTexture();return r.bindTexture(r.TEXTURE_2D,a),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,t,i,0,r.RGBA,r.UNSIGNED_BYTE,null),a}function R9(e,t,i,r,a){let o=e.context.gl,n=e.layerCompositeBackdrop;n?n.width<r||n.height<a?(n.width=Math.max(n.width,r),n.height=Math.max(n.height,a),o.bindTexture(o.TEXTURE_2D,n.texture),o.texImage2D(o.TEXTURE_2D,0,o.RGBA,n.width,n.height,0,o.RGBA,o.UNSIGNED_BYTE,null)):o.bindTexture(o.TEXTURE_2D,n.texture):e.layerCompositeBackdrop={texture:kb(e,r,a),width:r,height:a},o.copyTexSubImage2D(o.TEXTURE_2D,0,0,0,t,i,r,a)}function im(e,t,i,r,a,o){let n=o.context,s=n.gl,[l,u,c,h]=r.bounds;if(n.bindFramebuffer.set(r.compositeTarget),n.viewport.set(r.compositeViewport),o.invalidateTileClippingMasks(),c===0||h===0)return;s.enable(s.SCISSOR_TEST),s.scissor(l,u,c,h);let d=o.data.showOverdrawInspector,p=!d&&jl(i)?i:null;p&&(n.activeTexture.set(s.TEXTURE1),R9(e,l,u,c,h)),n.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,e.layerCompositeFbo.colorAttachment.get());let f;f=d?ze.plusLighter:p?ze.unblended:i==="normal"?o.colorModeForRenderPass():P9[i];let m=p?Ib[p]:[];o.useProgram("layerComposite",null,!1,m).draw(n,s.TRIANGLES,o.getDepthModeForSublayer(0,xe.ReadOnly),Ce.disabled,f,Ae.disabled,Qk(t,0,1,[l,u]),null,null,a.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,a.paint,o.projectedCamera.zoom),s.disable(s.SCISSOR_TEST),o.layerCompositeSampled=!0}function Fb(e,t,i,r,a,o,n,s){let l=256;if(r.stepInterpolant){let u=e.getSource().maxzoom,c=o.canonical.z===u?Math.ceil(1<<s.projectedCamera.maxZoom-o.canonical.z):1;l=H(J5(a.maxLineLength/z*1024*c),256,t.maxTextureSize)}return n.gradient=P2({expression:r.gradientExpression(),evaluationKey:"lineProgress",resolution:l,image:n.gradient||void 0,clips:a.lineClipsArray}),n.texture?n.texture.update(n.gradient):n.texture=new yt(t,n.gradient,i.RGBA),n.version=r.gradientVersion,n.texture}function z9(e,t,i,r,a){e.activeTexture.set(t.TEXTURE0),i.imageAtlasTexture.bind(t.LINEAR,t.CLAMP_TO_EDGE),r.updatePaintBuffers(a)}function L9(e,t,i,r,a,o){(a||e.lineAtlas.dirty)&&(t.activeTexture.set(i.TEXTURE0),e.lineAtlas.bind(t)),r.updatePaintBuffers(o)}function B9(e,t,i,r,a,o,n){let s=a.gradients[r.id],l=s.texture;r.gradientVersion!==s.version&&(l=Fb(e,t,i,r,a,o,s,n)),t.activeTexture.set(i.TEXTURE0),l.bind(r.stepInterpolant?i.NEAREST:i.LINEAR,i.CLAMP_TO_EDGE)}function O9(e,t,i,r,a,o,n,s,l,u){let c=o.gradients[a.id],h=c.texture;a.gradientVersion!==c.version&&(h=Fb(t,i,r,a,o,n,c,u)),i.activeTexture.set(r.TEXTURE0),h.bind(a.stepInterpolant?r.NEAREST:r.LINEAR,r.CLAMP_TO_EDGE),i.activeTexture.set(r.TEXTURE1),e.lineAtlas.bind(i),s.updatePaintBuffers(l)}function j9(e,t,i,r,a){if(a.currentPass!=="translucent")return;let o=i.paint.get("line-opacity"),n=i.paint.get("line-width"),s=i.paint.get("line-layer-opacity");if(o.constantOr(1)===0||n.constantOr(1)===0||s===0)return;let l=i.paint.get("line-layer-blend");if(s<1||l!=="normal"){let u=tm(e,t,i,r,a);A_(e,t,i,r,a),im(e,s,l,u,i,a)}else A_(e,t,i,r,a)}function A_(e,t,i,r,a){let o=a.getDepthModeForSublayer(0,xe.ReadOnly),n=a.colorModeForRenderPass(),s=i.paint.get("line-dasharray"),l=s.constantOr(1),u=i.paint.get("line-pattern"),c=u.constantOr(1),h=i.paint.get("line-gradient"),d=i.getCrossfadeParameters(),p;p=c?"linePattern":l&&h?"lineGradientSDF":l?"lineSDF":h?"lineGradient":"line";let f=a.context,m=f.gl,g=a.projectedCamera,_=!0;for(let y of r){let v=t.getTile(y);if(c&&!v.patternsLoaded())continue;let x=v.getBucket(i);if(!x)continue;let b=x.programConfigurations.get(i.id),w=f.program.get(),T=a.useProgram(p,b),E=_||T.program!==w,S=a.getTerrainDataForTile(y),A=u.constantOr(null),I=s?.constantOr(null);if(A&&v.imageAtlas){let P=v.imageAtlas,B=P.patternPositions[A.to.toString()],N=P.patternPositions[A.from.toString()];B&&N&&b.setConstantPatternPositions(B,N)}else if(I){let P=i.layout.get("line-cap").constantOr(null)==="round",B=e.lineAtlas.getDash(I.to,P),N=e.lineAtlas.getDash(I.from,P);b.setConstantDashPositions(B,N)}let R=a.getProjectionDataForTile(y),k=V(g).getPixelScale(g),M;c?(M=Xk(g,v,i,k,d),z9(f,m,v,b,d)):l&&h?(M=Kk(g,e.lineAtlas,v,i,k,d,x.lineClipsArray.length),O9(e,t,f,m,i,x,y,b,d,a)):l?(M=Yk(g,e.lineAtlas,v,i,k,d),L9(e,f,m,b,E,d)):h?(M=Hk(g,v,i,k,x.lineClipsArray.length),B9(t,f,m,i,x,y,a)):M=sc(g,v,i,k);let C=a.stencilModeForClipping(y);T.draw(f,m.TRIANGLES,o,C,n,Ae.disabled,M,S,R,i.id,x.layoutVertexBuffer,x.indexBuffer,x.segments,i.paint,a.projectedCamera.zoom,b,x.layoutVertexBuffer2),_=!1}}function Rb(e,t,i,r,a){if(!i||!r?.imageAtlas)return;let o=r.imageAtlas.patternPositions,n=o[i.to.toString()],s=o[i.from.toString()];if(!n&&s&&(n=s),!s&&n&&(s=n),!n||!s){let l=a.getPaintProperty(t);n=o[l],s=o[l]}n&&s&&e.setConstantPatternPositions(n,s)}function N9(e,t,i,r,a){let o=i.paint.get("fill-color"),n=i.paint.get("fill-opacity"),s=i.paint.get("fill-layer-opacity");if(n.constantOr(1)===0||s===0)return;let l=i.paint.get("fill-layer-blend");if(s<1||l!=="normal"){if(a.currentPass!=="translucent")return;let h=tm(e,t,i,r,a);M_(t,i,r,a),im(e,s,l,h,i,a);return}let u=i.paint.get("fill-pattern"),c=a.opaquePassEnabledForLayer()&&!u.constantOr(1)&&o.constantOr(se.transparent).a===1&&n.constantOr(0)===1;if(c&&a.currentPass==="opaque"){let h=a.colorModeForRenderPass();rm(t,i,r,a.getDepthModeForSublayer(1,xe.ReadWrite),h,!1,a)}else c&&a.currentPass==="translucent"?zb(t,i,r,a):a.currentPass==="translucent"&&M_(t,i,r,a)}function M_(e,t,i,r){let a=r.colorModeForRenderPass();rm(e,t,i,r.getDepthModeForSublayer(1,xe.ReadOnly),a,!1,r),zb(e,t,i,r)}function zb(e,t,i,r){if(!t.paint.get("fill-antialias"))return;let a=r.colorModeForRenderPass();rm(e,t,i,r.getDepthModeForSublayer(t.getPaintProperty("fill-outline-color")?2:0,xe.ReadOnly),a,!0,r)}function rm(e,t,i,r,a,o,n){let s=n.context,l=s.gl,u="fill-pattern",c=t.paint.get(u),h=c?.constantOr(1),d=t.getCrossfadeParameters(),p,f,m,g,_,y=n.projectedCamera,v=t.paint.get("fill-translate"),x=t.paint.get("fill-translate-anchor");o?(f=h&&!t.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",p=l.LINES):(f=h?"fillPattern":"fill",p=l.TRIANGLES);let b=c.constantOr(null);for(let w of i){let T=e.getTile(w);if(h&&!T.patternsLoaded())continue;let E=T.getBucket(t);if(!E)continue;let S=E.sdfPatterns[t.id]??!1,A=E.programConfigurations.get(t.id),I=n.useProgram(f,A),R=n.getTerrainDataForTile(w);h&&(s.activeTexture.set(l.TEXTURE0),T.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),A.updatePaintBuffers(d)),Rb(A,u,b,T,t);let k=n.getProjectionDataForTile(w),M=aa(y,T,v,x);o?(g=E.indexBuffer2,_=E.segments2,m=f==="fillOutlinePattern"&&h?Mk(y,d,T,M,S):Ak(M)):(g=E.indexBuffer,_=E.segments,m=h?Tb(y,d,T,M,S):Dk(M));let C=n.stencilModeForClipping(w);I.draw(s,p,r,C,a,Ae.backCCW,m,R,k,t.id,E.layoutVertexBuffer,g,_,t.paint,n.projectedCamera.zoom,A)}}function V9(e,t,i,r){let a=t.paint.get("fill-extrusion-opacity");if(a!==0&&r.currentPass==="translucent"){let o=new xe(r.context.gl.LEQUAL,xe.ReadWrite,r.depthRangeFor3D);if(a===1&&!t.paint.get("fill-extrusion-pattern").constantOr(1)){let n=r.colorModeForRenderPass();$h(e,t,i,o,Ce.disabled,n,r)}else $h(e,t,i,o,Ce.disabled,ze.disabled,r),$h(e,t,i,o,r.stencilModeFor3D(),r.colorModeForRenderPass(),r)}}function $h(e,t,i,r,a,o,n){let s=n.context,l=s.gl,u="fill-extrusion-pattern",c=t.paint.get(u),h=c.constantOr(1),d=t.getCrossfadeParameters(),p=t.paint.get("fill-extrusion-opacity"),f=c.constantOr(null),m=n.projectedCamera;for(let g of i){let _=e.getTile(g),y=_.getBucket(t);if(!y)continue;let v=n.getTerrainDataForTile(g),x=y.programConfigurations.get(t.id),b=n.useProgram(h?"fillExtrusionPattern":"fillExtrusion",x);h&&(s.activeTexture.set(l.TEXTURE0),_.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),x.updatePaintBuffers(d));let w=n.getProjectionDataForTile(g);Rb(x,u,f,_,t);let T=aa(m,_,t.paint.get("fill-extrusion-translate"),t.paint.get("fill-extrusion-translate-anchor")),E=t.paint.get("fill-extrusion-vertical-gradient"),S=h?wk(m,n.data.light,E,p,T,g,d,_):wb(m,n.data.light,E,p,T);b.draw(s,s.gl.TRIANGLES,r,a,o,Ae.backCCW,S,v,w,t.id,y.layoutVertexBuffer,y.indexBuffer,y.segments,t.paint,n.projectedCamera.zoom,x,n.terrain&&y.centroidVertexBuffer)}}function $9(e,t,i,r,a){if(a.currentPass!=="offscreen"&&a.currentPass!=="translucent")return;let o=a.context,{useSubdivision:n}=a.data,s=a.getDepthModeForSublayer(0,xe.ReadOnly),l=a.colorModeForRenderPass();if(a.currentPass==="offscreen")U9(e,t,r,i,s,Ce.disabled,l,a),o.viewport.set([0,0,e.width,e.height]);else if(a.currentPass==="translucent")if(n){let[u,c,h]=a.stencilConfigForOverlapTwoPass(r);Uh(t,i,h,u,s,l,!1,a),Uh(t,i,h,c,s,l,!0,a)}else{let[u,c]=a.getStencilConfigForOverlapAndUpdateStencilID(r);Uh(t,i,c,u,s,l,!1,a)}}function Uh(e,t,i,r,a,o,n,s){let l=s.context,u=l.gl,c=[`#define NUM_ILLUMINATION_SOURCES ${t.paint.get("hillshade-highlight-color").values.length}`],h=s.useProgram("hillshade",null,!1,c),d=!s.data.moving;for(let p of i){let f=e.getTile(p),m=f.fbo;if(!m)continue;let g=s.getMeshFromTileID(p.canonical,n,!0,"raster"),_=s.getTerrainDataForTile(p);l.activeTexture.set(u.TEXTURE0),u.bindTexture(u.TEXTURE_2D,m.colorAttachment.get());let y=s.getProjectionDataForTile(p,{aligned:d});h.draw(l,u.TRIANGLES,a,r[p.overscaledZ],o,Ae.backCCW,Bk(s.projectedCamera,s.worldCoordinateHelper,f,t),_,y,t.id,g.vertexBuffer,g.indexBuffer,g.segments)}}function U9(e,t,i,r,a,o,n,s){let l=s.context,u=l.gl,c=r.paint.get("resampling")==="nearest"?u.NEAREST:u.LINEAR;for(let h of i){let d=t.getTile(h),p=d.dem;if(!p?.data||!d.needsHillshadePrepare)continue;let f=p.dim+2,m=p.stride,g=p.getPixels();if(l.activeTexture.set(u.TEXTURE1),l.pixelStoreUnpackPremultiplyAlpha.set(!1),d.demTexture||=e.getTileTexture(m),d.demTexture){let y=d.demTexture;y.update(g,{premultiply:!1}),y.bind(u.NEAREST,u.CLAMP_TO_EDGE)}else d.demTexture=new yt(l,g,u.RGBA,{premultiply:!1}),d.demTexture.bind(u.NEAREST,u.CLAMP_TO_EDGE);l.activeTexture.set(u.TEXTURE0);let _=d.fbo;if(!_){let y=new yt(l,{width:f,height:f,data:null},u.RGBA);y.bind(c,u.CLAMP_TO_EDGE),_=d.fbo=l.createFramebuffer(f,f,!0,!1),_.colorAttachment.set(y.texture)}l.bindFramebuffer.set(_.framebuffer),l.viewport.set([0,0,f,f]),s.useProgram("hillshadePrepare").draw(l,u.TRIANGLES,a,o,n,Ae.disabled,Ok(s.worldCoordinateHelper,d.tileID,p),null,null,r.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments),d.needsHillshadePrepare=!1}}function q9(e,t,i,r,a){if(a.currentPass!=="translucent"||!r.length)return;let{useSubdivision:o}=a.data,n=a.getDepthModeForSublayer(0,xe.ReadOnly),s=a.colorModeForRenderPass();if(o){let[l,u,c]=a.stencilConfigForOverlapTwoPass(r);qh(e,t,i,c,l,n,s,!1,a),qh(e,t,i,c,u,n,s,!0,a)}else{let[l,u]=a.getStencilConfigForOverlapAndUpdateStencilID(r);qh(e,t,i,u,l,n,s,!1,a)}}function qh(e,t,i,r,a,o,n,s,l){let u=l.context,c=u.gl,h=l.useProgram("colorRelief"),d=!l.data.moving,p=i.paint.get("resampling")==="nearest"?c.NEAREST:c.LINEAR,f=!0,m=0;for(let g of r){let _=t.getTile(g),y=_.dem;if(!y?.data)continue;if(f){P_||=c.getParameter(c.MAX_TEXTURE_SIZE);let T=P_,{elevationTexture:E,colorTexture:S}=i.getColorRampTextures(u,T,y.getUnpackVector());u.activeTexture.set(c.TEXTURE1),E.bind(c.NEAREST,c.CLAMP_TO_EDGE),u.activeTexture.set(c.TEXTURE4),S.bind(c.LINEAR,c.CLAMP_TO_EDGE),f=!1,m=E.size[0]}let v=y.stride;u.activeTexture.set(c.TEXTURE0),(!_.demTexture||_.needsColorReliefPrepare)&&(u.pixelStoreUnpackPremultiplyAlpha.set(!1),_.demTexture||=e.getTileTexture(v)??new yt(u,{width:v,height:v,data:null},c.RGBA),_.demTexture.update(y.getPixels(),{premultiply:!1}),_.needsColorReliefPrepare=!1),_.demTexture.bind(p,c.CLAMP_TO_EDGE);let x=l.getMeshFromTileID(g.canonical,s,!0,"raster"),b=l.getTerrainDataForTile(g),w=l.getProjectionDataForTile(g,{aligned:d});h.draw(u,c.TRIANGLES,o,a[g.overscaledZ],n,Ae.backCCW,$k(i,_.dem,m),b,w,i.id,x.vertexBuffer,x.indexBuffer,x.segments)}}function G9(e,t,i,r,a){if(a.currentPass!=="translucent"||i.paint.get("raster-opacity")===0||!r.length)return;let o=i.paint.get("raster-layer-blend");if(o==="normal"){I_(t,i,r,a);return}let n=tm(e,t,i,r,a);I_(t,i,r,a),im(e,1,o,n,i,a)}function I_(e,t,i,r){let a=e.getSource(),{useSubdivision:o}=r.data;if(a instanceof gs)bl(e,t,i,null,!1,!1,a.tileCoords,a.imageWarp,a.flippedWindingOrder,r,a.getMesh(r.context,o));else if(o){let[n,s,l]=r.stencilConfigForOverlapTwoPass(i);bl(e,t,l,n,!1,!0,Gh,xo,!1,r),bl(e,t,l,s,!0,!0,Gh,xo,!1,r)}else{let[n,s]=r.getStencilConfigForOverlapAndUpdateStencilID(i);bl(e,t,s,n,!1,!0,Gh,xo,!1,r)}}function bl(e,t,i,r,a,o,n,s,l=!1,u,c=null){let h=i[i.length-1].overscaledZ,d=u.context,p=d.gl,f=u.useProgram("raster"),m=u.colorModeForRenderPass(),g=!u.data.moving,_=t.paint.get("raster-opacity"),y=t.paint.get("resampling")==="nearest"||t.paint.get("raster-resampling")==="nearest"?p.NEAREST:p.LINEAR,v=t.paint.get("raster-fade-duration"),x=!!u.terrain;for(let b of i){let w=u.getDepthModeForSublayer(b.overscaledZ-h,_===1?xe.ReadWrite:xe.ReadOnly,p.LESS),T=e.getTile(b);d.activeTexture.set(p.TEXTURE0),T.texture.bind(y,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST),d.activeTexture.set(p.TEXTURE1);let{parentTile:E,parentScaleBy:S,parentTopLeft:A,fadeValues:I}=W9(T,e,v,x);T.fadeOpacity=I.tileOpacity,E?(E.fadeOpacity=I.parentTileOpacity,E.texture.bind(y,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST)):T.texture.bind(y,p.CLAMP_TO_EDGE,p.LINEAR_MIPMAP_NEAREST),T.texture.useMipmap&&d.extTextureFilterAnisotropic&&u.projectedCamera.pitch>u.data.anisotropicFilterPitch&&p.texParameterf(p.TEXTURE_2D,d.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,d.extTextureFilterAnisotropicMax);let R=u.getTerrainDataForTile(b),k=u.getProjectionDataForTile(b,{aligned:g}),M=dM(A,S,I.fadeMix,t,n,s),C=c??u.getMeshFromTileID(b.canonical,a,o,"raster"),P=r?r[b.overscaledZ]:Ce.disabled;f.draw(d,p.TRIANGLES,w,P,m,l?Ae.frontCCW:Ae.backCCW,M,R,k,t.id,C.vertexBuffer,C.indexBuffer,C.segments)}}function W9(e,t,i,r){let a={parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:{tileOpacity:1,parentTileOpacity:1,fadeMix:{opacity:1,mix:0}}};if(i===0||r)return a;if(e.fadingParentID){let o=t.getLoadedTile(e.fadingParentID);if(!o)return a;let n=2**(o.tileID.overscaledZ-e.tileID.overscaledZ);return{parentTile:o,parentScaleBy:n,parentTopLeft:[e.tileID.canonical.x*n%1,e.tileID.canonical.y*n%1],fadeValues:Z9(e,o,i)}}return e.selfFading?{parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:H9(e,i)}:a}function Z9(e,t,i){let r=Fe(),a=(r-e.timeAdded)/i,o=(r-t.timeAdded)/i,n=e.fadingDirection===1,s=H(a,0,1),l=H(1-o,0,1),u=n?s:l;return{tileOpacity:u,parentTileOpacity:n?l:s,fadeMix:{opacity:1,mix:1-u}}}function H9(e,t){let i=H((Fe()-e.timeAdded)/t,0,1);return{tileOpacity:i,fadeMix:{opacity:i,mix:0}}}function X9(e,t,i,r,a){let o=i.paint.get("background-color"),n=i.paint.get("background-opacity");if(n===0)return;let s=a.context,l=s.gl,u=a.projectedCamera,c=u.tileSize,h=i.paint.get("background-pattern");if(e.patternAtlas.isPatternMissing(h))return;let d=!h&&o.a===1&&n===1&&a.opaquePassEnabledForLayer()?"opaque":"translucent";if(a.currentPass!==d)return;let p=Ce.disabled,f=a.getDepthModeForSublayer(0,d==="opaque"?xe.ReadWrite:xe.ReadOnly),m=a.colorModeForRenderPass(),g=a.useProgram(h?"backgroundPattern":"background"),_=r||vs(u,a.worldCoordinateHelper,{tileSize:c,terrain:a.terrain});h&&(s.activeTexture.set(l.TEXTURE0),e.patternAtlas.bind(s));let y=i.getCrossfadeParameters();for(let v of _){let x=a.getProjectionDataForTile(v),b=h?s9(n,e.patternAtlas,u,h,{tileID:v,tileSize:c},y):n9(n,o),w=a.getTerrainDataForTile(v),T=a.getMeshFromTileID(v.canonical,!1,!0,"raster");g.draw(s,l.TRIANGLES,f,p,m,Ae.backCCW,b,w,x,i.id,T.vertexBuffer,T.indexBuffer,T.segments)}}function tF(e){let t=e.projectedCamera.padding;k_(e,e.projectedCamera.height-(t.top||0),3,Y9),k_(e,t.bottom||0,3,K9),F_(e,t.left||0,3,J9),F_(e,e.projectedCamera.width-(t.right||0),3,Q9);let i=e.projectedCamera.centerPoint;iF(e,i.x,e.projectedCamera.height-i.y,eF)}function iF(e,t,i,r){Tu(e,t-1,i-10,2,20,r),Tu(e,t-10,i-1,20,2,r)}function k_(e,t,i,r){Tu(e,0,t+i/2,e.projectedCamera.width,i,r)}function F_(e,t,i,r){Tu(e,t-i/2,0,i,e.projectedCamera.height,r)}function Tu(e,t,i,r,a,o){let n=e.context,s=n.gl,l=e.data.pixelRatio;s.enable(s.SCISSOR_TEST),s.scissor(t*l,i*l,r*l,a*l),n.clear({color:o}),s.disable(s.SCISSOR_TEST)}function rF(e,t,i,r){for(let a of i)aF(e,t,a,r)}function aF(e,t,i,r){let a=r.context,o=a.gl,n=r.useProgram("debug"),s=xe.disabled,l=Ce.disabled,u=r.colorModeForRenderPass(),c="$debug",h=r.getTerrainDataForTile(i);a.activeTexture.set(o.TEXTURE0);let d=t.getTileByID(i.key).latestRawTileData?.byteLength||0,p=Math.floor(d/1024),f=t.getTile(i).tileSize,m=512/Math.min(f,512)*(i.overscaledZ/r.projectedCamera.zoom)*0.5,g=i.canonical.toString();i.overscaledZ!==i.canonical.z&&(g+=` => ${i.overscaledZ}`),oF(e,`${g} ${p}kB`);let _=r.getProjectionDataForTile(i);n.draw(a,o.TRIANGLES,s,l,ze.alphaBlended,Ae.disabled,T_(se.transparent,m),null,_,c,e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments),n.draw(a,o.LINE_STRIP,s,l,u,Ae.disabled,T_(se.red),h,_,c,e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments)}function oF(e,t){e.initDebugOverlayCanvas();let i=e.debugOverlayCanvas,r=e.context.gl,a=e.debugOverlayCanvas.getContext("2d");a.clearRect(0,0,i.width,i.height),a.shadowColor="white",a.shadowBlur=2,a.lineWidth=1.5,a.strokeStyle="white",a.textBaseline="top",a.font="bold 36px Open Sans, sans-serif",a.fillText(t,5,5),a.strokeText(t,5,5),e.debugOverlayTexture.update(i),e.debugOverlayTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)}function nF(e,t){let i=null,r=Object.values(e._layers).flatMap((s)=>s.source&&!s.isHidden(t)?[e.tileManagers[s.source]]:[]),a=r.filter((s)=>s.getSource().type==="vector"),o=r.filter((s)=>s.getSource().type!=="vector"),n=(s)=>{(!i||i.getSource().maxzoom<s.getSource().maxzoom)&&(i=s)};for(let s of a)n(s);if(!i)for(let s of o)n(s);return i}function sF(e,t,i){let r=i.context,a=r.gl,o=i.projectedCamera,n=ze.unblended,s=new xe(a.LEQUAL,xe.ReadWrite,[0,1]),l=t.tileManager.getRenderableTiles(),u=i.useProgram("terrainDepth");r.bindFramebuffer.set(t.getFramebuffer().framebuffer),r.viewport.set([0,0,e.width/devicePixelRatio,e.height/devicePixelRatio]),r.clear({color:se.white,depth:1});for(let c of l){let h=t.getTerrainMesh(c.tileID,i.data.isRenderingGlobe),d=t.getTerrainData(c.tileID),p=V(o).getProjectionData(o,{overscaledTileID:c.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),f=mk(t.getSkirtLength(o.zoom));u.draw(r,a.TRIANGLES,s,Ce.disabled,n,Ae.backCCW,f,d,p,"terrain",h.vertexBuffer,h.indexBuffer,h.segments)}r.bindFramebuffer.set(null),r.viewport.set([0,0,e.width,e.height])}function lF(e,t,i,r){let{isRenderingGlobe:a}=r.data,o=r.context,n=o.gl,s=r.projectedCamera,l=r.colorModeForRenderPass(),u=r.getDepthModeFor3D(),c=r.useProgram("terrain");o.bindFramebuffer.set(null),o.viewport.set([0,0,e.width,e.height]);for(let h of i){let d=t.getTerrainMesh(h.tileID,a),p=e.renderToTexture.getTexture(h),f=t.getTerrainData(h.tileID);o.activeTexture.set(n.TEXTURE0),p.bind(n.LINEAR,n.CLAMP_TO_EDGE,n.LINEAR_MIPMAP_LINEAR);let m=t.getSkirtLength(s.zoom),g=V(s).calculateFogMatrix(s,h.tileID.toUnwrapped()),_=fk(m,g,r.data.sky,s.pitch,a),y=r.getProjectionDataForTile(h.tileID,{applyTerrainMatrix:!1});c.draw(o,n.TRIANGLES,u,Ce.disabled,l,Ae.backCCW,_,f,y,"terrain",d.vertexBuffer,d.indexBuffer,d.segments)}}function uF(e,t,i){let r=e.context,a=r.gl,[o,n,s,l]=i.bounds;r.setDirty();let u=t.getHeightMapFramebuffer(i.texture);r.viewport.set([0,0,i.width,i.height]),r.clear({color:se.transparent});let c=e.useProgram("terrainHeight",null,!0);for(let h of t.tileManager.getRenderableTiles()){let d=t.getTerrainData(h.tileID);if(!d.tile?.dem)continue;let{canonical:p,wrap:f}=h.tileID,m=1/(1<<p.z),g=gk([(p.x*m+f-o)/(s-o),(p.y*m-n)/(l-n),m/(s-o),m/(l-n)]),_=t.getTerrainMesh(h.tileID,e.data.isRenderingGlobe);c.draw(r,a.TRIANGLES,xe.disabled,Ce.disabled,ze.unblended,Ae.disabled,g,d,null,"terrain",_.vertexBuffer,_.indexBuffer,_.segments)}u.colorAttachment.set(null)}function cF(e,t,i,r,a){if(a.isRenderingToTexture){hF(e,i,r[0],a);return}let{isRenderingGlobe:o,projectionShaderVariant:n}=a.data,{terrain:s}=a,l=a.context,u=i.implementation,c=a.projectedCamera,h=V(c).getProjectionDataForCustomLayer(c,o),d={farZ:c.farZ,nearZ:c.nearZ,fov:c.fov*Math.PI/180,modelViewProjectionMatrix:c.modelViewProjectionMatrix,projectionMatrix:c.projectionMatrix,shaderData:{variantName:n.name,vertexShaderPrelude:`const float PI = 3.141592653589793;
52
+ uniform mat4 u_projection_matrix;
53
+ ${n.prelude.vertexSource}`,define:n.define},defaultProjectionData:h,getProjectionData:(f)=>V(c).getProjectionData(c,{overscaledTileID:new Et(f.tileID.canonical.z,f.tileID.wrap??0,f.tileID.canonical.z,f.tileID.canonical.x,f.tileID.canonical.y),aligned:f.aligned,applyGlobeMatrix:f.applyGlobeMatrix,applyTerrainMatrix:f.applyTerrainMatrix}),renderTerrainHeightMap:s&&a.currentPass==="offscreen"?(f)=>uF(a,s,f):void 0},p=u.renderingMode?u.renderingMode:"2d";if(a.currentPass==="offscreen"){let f=u.prerender;f&&(l.setCustomLayerDefaults(),l.setColorMode(a.colorModeForRenderPass()),f.call(u,l.gl,d),l.setDirty(),e.setBaseState())}else if(a.currentPass==="translucent"){l.setCustomLayerDefaults(),l.setColorMode(a.colorModeForRenderPass()),l.setStencilMode(Ce.disabled);let f=p==="3d"?a.getDepthModeFor3D():a.getDepthModeForSublayer(0,xe.ReadOnly);l.setDepthMode(f),u.render(l.gl,d),l.setDirty(),e.setBaseState(),l.bindFramebuffer.set(null)}}function hF(e,t,i,r){let a=r.context,o=a.bindFramebuffer.get(),n=a.viewport.get();a.setCustomLayerDefaults(),a.setColorMode(r.colorModeForRenderPass()),a.setDepthMode(xe.disabled),a.setStencilMode(Ce.disabled),t.implementation.renderToTerrainTile(a.gl,{tileID:{canonical:i.canonical,wrap:i.wrap},width:n[2],height:n[3]}),a.setDirty(),e.setBaseState(),a.bindFramebuffer.set(o),a.viewport.set(n)}function dF(e,t){let i=t.context,r=i.gl,{sky:a,pixelRatio:o}=t.data,n=h9(a,t.projectedCamera,o),s=new xe(r.LEQUAL,xe.ReadWrite,[0,1]),l=Ce.disabled,u=t.colorModeForRenderPass();t.useProgram("sky").draw(i,r.TRIANGLES,s,l,u,Ae.disabled,n,null,void 0,"sky",e.vertexBuffer,e.indexBuffer,e.segments)}function pF(e,t){let i=by(e.position);A5(i,i);let r=er(new Float64Array(16));return e.anchor==="map"&&(Jr(r,r,t.rollInRadians),To(r,r,-t.pitchInRadians),Jr(r,r,t.bearingInRadians),To(r,r,t.center.lat*Math.PI/180),my(r,r,-t.center.lng*Math.PI/180)),M5(i,i,r),i}function fF(e,t){let i=t.context,r=i.gl,{sky:a,light:o}=t.data,n=t.useProgram("atmosphere"),s=new xe(r.LEQUAL,xe.ReadOnly,[0,1]),l=t.projectedCamera,u=pF(o,l),c=V(l).getProjectionData(l,{overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),h=Na(l.worldSize,l.center.lat),d=b2(l),p=w2(Ki(d)-h,h),f=a["atmosphere-blend"]*c.projectionTransition*p;if(f===0)return;let m=u9(u,f,d,h,l.inverseProjectionMatrix);n.draw(i,r.TRIANGLES,s,Ce.disabled,ze.alphaBlended,Ae.disabled,m,null,null,"atmosphere",e.vertexBuffer,e.indexBuffer,e.segments)}function am(e,t){let i=!1,r=null,a,o=()=>{r=null,i&&=(e(...a),r=setTimeout(o,t),!1)};return(...n)=>(i=!0,a=n,r||o(),r)}function L_(e={}){return{projection:e.projection??"mercator",projectionTransition:e.projectionTransition??1,worldCoordinateHelper:e.worldCoordinateHelper??ja,constrainOverride:e.constrainOverride??null}}function om(e){return e.projection==="globe"?e.projectionTransition>0?"vertical-perspective":"mercator":e.projection}function Fn(e){return om(e)==="vertical-perspective"}function Dt(e,t,i,r){return t.constrainOverride===null?bF(e,t,i,r):t.constrainOverride(i,r)}function bF(e,t,i,r){return om(t)==="mercator"?wF(e,t.worldCoordinateHelper,i,r):SF(e,i,r)}function wF(e,t,i,r){if(r=H(+r,e.minZoom,e.maxZoom),!t.wraps)return TF(e,t,i,r);let a={center:new Y(i.lng,i.lat),zoom:r},o=e.lngRange;o&&(o[1]-o[0])%360==0&&(o=null),!e.renderWorldCopies&&o===null&&(o=[-179.9999999999,179.9999999999]);let n=e.tileSize*St(a.zoom),s=0,l=n,u=0,c=n,h=0,d=0,{top:p,bottom:f,left:m,right:g}=e.padding,_=e.width-m-g,y=e.height-p-f;if(e.latRange){let E=e.latRange;s=nu(E[1])*n,l=nu(E[0])*n,l-s<y&&(h=y/(l-s))}o&&(u=Fi(ou(o[0])*n,0,n),c=Fi(ou(o[1])*n,0,n),c<u&&(c+=n),c-u<_&&(d=_/(c-u)));let{x:v,y:x}=ki(n,i,t),b,w,T=Math.max(d||0,h||0);if(T)return a.center=ta(n,new D(d?(c+u)/2:v,h?(l+s)/2:x),t).wrap(),a.zoom+=wt(T),a;if(e.latRange){let E=y/2;x-E<s&&(w=s+E),x+E>l&&(w=l-E)}if(o){let E=(u+c)/2,S=v;e.renderWorldCopies&&(S=Fi(v,E-n/2,E+n/2));let A=_/2;S-A<u&&(b=u+A),S+A>c&&(b=c-A)}return(b!==void 0||w!==void 0)&&(a.center=ta(n,new D(b??v,w??x),t).wrap()),a}function TF(e,t,i,r){let a=e.lngRange,o=e.tileSize*St(r);if(!a){let{x,y:b}=ki(o,i,t),w=H(x,0,o),T=H(b,0,o);return w!==x||T!==b?{center:ta(o,new D(w,T),t),zoom:r}:{center:new Y(i.lng,i.lat),zoom:r}}let n=EF(t,a,e.latRange),s=Math.max(n.minX,0)*o,l=Math.min(n.maxX,1)*o,u=Math.max(n.minY,0)*o,c=Math.min(n.maxY,1)*o,{width:h,height:d}=e,p=l-s<h?h/(l-s):0,f=c-u<d?d/(c-u):0,{x:m,y:g}=ki(o,i,t),_=Math.max(p,f);if(_)return{center:ta(o,new D(p?(l+s)/2:m,f?(c+u)/2:g),t),zoom:r+wt(_)};let y=H(m,s+h/2,l-h/2),v=H(g,u+d/2,c-d/2);return y!==m||v!==g?{center:ta(o,new D(y,v),t),zoom:r}:{center:new Y(i.lng,i.lat),zoom:r}}function EF(e,t,i){let r=B_.get(t);if(r?.latRange===i&&r.worldCoordinateHelper===e)return r.box;let a=h2(e,t[0],i[0],t[1],i[1]);return B_.set(t,{latRange:i,worldCoordinateHelper:e,box:a}),a}function SF(e,t,i){let r=H(+i,e.minZoom+Tt(0,t.lat),e.maxZoom),a=CF(e,r);return{center:new Y(t.lng,H(t.lat,-a,a)),zoom:r}}function CF(e,t){let i=We(4.948870999999997),r=Na(e.tileSize*St(t),ci)*i,a=Math.min(e.width,e.height)/2,o=Math.min(r,a)*bn(r,a,a*4,1,0);return ci+Wi(i*o/r)}function DF({projection:e,projectionTransition:t}){return e==="globe"?`globe:${t}`:e}function cr(e,t){let i=O_.get(e);i||O_.set(e,i=new WeakMap);let r=i.get(t);return r||i.set(t,r=iE(e,t)),r}function Li(e,t){let i=j_.get(e);i||j_.set(e,i=new WeakMap);let r=i.get(t.worldCoordinateHelper);r||i.set(t.worldCoordinateHelper,r=new Map);let a=DF(t),o=r.get(a);return o||r.set(a,o=AF(e,t)),o}function AF(e,t){let{worldCoordinateHelper:i}=t,r=cr(e,i);if(t.projection==="mercator")return V0(r,i);if(t.projection==="vertical-perspective")return W0(r);let a=t.projectionTransition,o=W0(r),n=a>0,s=V0(r,i,n&&e.width&&e.height?{nearZ:o.nearZ,farZ:o.farZ}:e.nearFarZOverride),l=n?o:s;return{...r,projection:"globe",globeness:a,mercator:s,verticalPerspective:o,nearZ:l.nearZ,farZ:l.farZ,projectionMatrix:l.projectionMatrix,modelViewProjectionMatrix:l.modelViewProjectionMatrix,inverseProjectionMatrix:l.inverseProjectionMatrix,cameraPosition:l.cameraPosition,clippingPlane:l.clippingPlane}}function Tr(e,t){if(!e.width||!e.height)return e;let{center:i,zoom:r}=Dt(e,t,e.center,e.zoom),a=e;(i.lat!==a.center.lat||i.lng!==a.center.lng)&&(a={...a,center:i});let o=Dt(a,t,a.center,r).zoom;return a.zoom!==o&&(a={...a,zoom:o}),a}function Eu(e,t,i,r){if(!e.width||!e.height)return{center:i,zoom:r};let a=Dt(e,t,i,r);return{center:a.center,zoom:Dt(e,t,a.center,a.zoom).zoom}}function Lb(e,t,i){return e.minZoom===i?e:lc(e,(r)=>{let a={...r,minZoom:i};return pt(a,t,Dt(a,t,a.center,a.zoom).zoom)})}function Bb(e,t,i){return e.maxZoom===i?e:lc(e,(r)=>{let a={...r,maxZoom:i};return pt(a,t,Dt(a,t,a.center,a.zoom).zoom)})}function Ob(e,t){return e.minPitch===t?e:lc(e,(i)=>{let r={...i,minPitch:t};return Hi(r,Math.max(Gi(r),t))})}function jb(e,t){return e.maxPitch===t?e:lc(e,(i)=>{let r={...i,maxPitch:t};return Hi(r,Math.min(Gi(r),t))})}function Nb(e,t,i){return i===void 0?i=!0:i===null&&(i=!1),i&&!t.wraps&&he("renderWorldCopies has no effect in a projection whose world does not wrap."),e.renderWorldCopies===i?e:{...e,renderWorldCopies:i}}function Zi(e,t){let i=Fi(t,-180,180)*Math.PI/180;return e.bearingInRadians===i?e:{...e,unmodified:!1,bearingInRadians:i}}function Hi(e,t){let i=H(t,e.minPitch,e.maxPitch)/180*Math.PI;return e.pitchInRadians===i?e:{...e,unmodified:!1,pitchInRadians:i}}function ra(e,t){let i=t/180*Math.PI;return e.rollInRadians===i?e:{...e,unmodified:!1,rollInRadians:i}}function MF(e,t){return t=H(t,0.1,150),gf(e)===t?e:{...e,unmodified:!1,fovInRadians:We(t)}}function pt(e,t,i){let r=Dt(e,t,e.center,i).zoom;return e.zoom===r?e:Tr({...e,unmodified:!1,zoom:r},t)}function ii(e,t,i){return i.lat===e.center.lat&&i.lng===e.center.lng?e:Tr({...e,unmodified:!1,center:i},t)}function Vb(e,t,i){return{...e,unmodified:!1,center:t,zoom:i}}function _a(e,t,i){return i===e.elevation?e:Tr({...e,elevation:i},t)}function nm(e,t,i){return Fo(e.padding,i)?e:Tr({...e,unmodified:!1,padding:p2(e.padding,i,1)},t)}function Su(e,t,i,r,a){return Tr({...e,unmodified:!1,padding:p2(i,r,a)},t)}function PF(e,t,i,r,a=!0){let o=e.width===i&&e.height===r?e:{...e,width:i,height:r};return a?Tr(o,t):o}function N_(e,t){return t===e.minElevationForCurrentTile?e:{...e,minElevationForCurrentTile:t}}function IF(e,t,i){if(!i)return{...e,lngRange:null,latRange:[-85.051129,ci]};let r=i.getWest(),a=i.getEast(),o=i.getSouth(),n=i.getNorth(),s=r===-1/0&&a===1/0;if((!Number.isFinite(r)||!Number.isFinite(a))&&!s)throw Error("Longitude maxBounds values must either be finite or span from -Infinity to Infinity");return Tr({...e,lngRange:s?null:[r,a],latRange:[H(o,-85.051129,ci),H(n,-85.051129,ci)]},t)}function $b(e,t,i){if(e.elevation-i===0)return e;let r=t.worldCoordinateHelper,a=cr(e,r),{x:o,y:n,z:s}=pf(a.pitch,a.bearing),l=r.worldFromLngLat(a.center.lng,a.center.lat,a.elevation),u=1/r.worldZFromAltitude(1,a.center),c=a.cameraToCenterDistance/a.worldSize,h=new Ot(l.x-o*c,l.y-n*c,l.z+s*c),{distanceToCenter:d,clampedElevation:p}=qb(h.z*u,i,a.pitch),{centerMercator:f,dMercator:m}=Ub(r,h,o,n,d,u),g=r.lngLatFromWorld(f.x,f.y),_=wt(a.cameraToCenterDistance/m/a.tileSize),y={...e,elevation:p,center:g},v=pt(y,t,_);return v.zoom===y.zoom?Tr({...v,unmodified:!1},t):v}function kF(e,t,i,r,a,o){let n=a===void 0?_o(e):a,s=o===void 0?Gi(e):o,{distanceToCenter:l,clampedElevation:u}=qb(r,e.elevation,s),{x:c,y:h}=pf(s,n),d=Y.convert(i),p=t.worldFromLngLat(d.lng,d.lat,r),{centerMercator:f,dMercator:m}=Ub(t,p,c,h,l,t.metersPerWorldUnit(p.x,p.y));return{center:t.lngLatFromWorld(f.x,f.y),elevation:u,zoom:wt(e.height/2/Math.tan(e.fovInRadians/2)/m/e.tileSize)}}function Ub(e,t,i,r,a,o){let n=a/o,s=new Ot(t.x+i*n,t.y+r*n),l=1/0;for(let u=1;u<10;u++){let c=e.metersPerWorldUnit(s.x,s.y),h=Math.abs(c-o);if(h<=0.000000000001*o||h>=l)break;l=h,o=c,n=a/o,s=new Ot(t.x+i*n,t.y+r*n)}return{centerMercator:s,dMercator:n}}function qb(e,t,i){let r=-Math.cos(We(i)),a=e-t,o,n=t;return r*a>=0||Math.abs(r)<Math.cos(We(89.25))?(o=1e4,n=e+o*r):o=-a/r,{distanceToCenter:o,clampedElevation:n}}function lc(e,t){let i=t(e);return i.unmodified===e.unmodified?i:{...i,unmodified:e.unmodified}}function Cu(e,t,i){if(!e.renderWorldCopies||!t.wraps||e.lngRange)return;let r=i.lng-e.center.lng;i.lng+=r>180?-360:r<-180?360:0}function Gb(){he("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function Wb(e,t,i,r,a){let o;if(!a)o={roll:Ze.number(t.roll,i.roll,r),pitch:Ze.number(t.pitch,i.pitch,r),bearing:Ze.number(t.bearing,i.bearing,r)};else if(r<1){let n=new Float64Array(4);Al(n,Ng(t.roll,t.pitch,t.bearing),Ng(i.roll,i.pitch,i.bearing),r),o=n3(n)}else o=i;return Zi(Hi(ra(e,o.roll),o.pitch),o.bearing)}function Cp(e,t){return ot(Li(e,t))}function FF(e,t,i){let r=Cp(e,t),a=t.worldCoordinateHelper,o=i&&pE(r,a,i)||V(r).screenPointToLocation(r,a,r.centerPoint,i),n=i?i.getElevationForLngLat(o,r.tileZoom):0;return r.pitch<90&&n>=V(r).getCameraAltitude(r)?null:n}function $_(e,t){return ot(Li(e,t))}function U_(e,t,i){let r=e.cameraPosition,a=Ki(r);if(a<=1)return V(e).screenPointToLocation(e,t,i);let o=De();Rt(o,r);let n=V(e).getRayDirectionFromPixel(e,i),s=-ft(n,o),l=De();$l(l,n,o,s);let u=Ki(l);if(u<0.000000001)return V(e).screenPointToLocation(e,t,i);let c=Math.atan2(u,s),h=Math.asin(1/a)*0.9;if(c<h)return V(e).screenPointToLocation(e,t,i);let d=a*Math.sin(h),p=Math.asin(H(d,-1,1))-h,f=a*Math.cos(h)/Math.sqrt(Math.max(1-d*d,0.000000000001))-1,m=Wh-p,g=c-h,_=p+f*g*m/(m+f*g),y=De();Ue(y,l,1/u);let v=De();return Ue(v,o,Math.cos(H(_,0,Wh))),$l(v,v,y,Math.sin(H(_,0,Wh))),Rt(v,v),Kn(v)}function LF(e,t,i,r,a,o=!0){let n=Li(e,t),s=U_(n,t.worldCoordinateHelper,r),l=i;if(a)l=U_(n,t.worldCoordinateHelper,r.sub(a));else if(!V(n).isPointOnMapSurface(n,t.worldCoordinateHelper,r))return e;let u=dt(s),c=dt(l),h=vE(n.center,n.bearing),d=si(De(),c,u),p=Math.sqrt(ft(d,d)),f=Math.acos(H(ft(c,u),-1,1))/2,m=Math.sin(f),g=p?$5(Lr(),d[1]/p*m,-d[0]/p*m,d[2]/p*m,Math.cos(f)):O5(Lr()),{lng:_,lat:y,bearing:v}=xE(N5(Lr(),h,g)),x=o?BF(n.bearing,y,v):y,b=ii(e,t,new Y(Fi(o?OF(n,t.worldCoordinateHelper,r,a,_):_,-180,180),x));return o||(b=Zi(b,v)),pt(b,t,e.zoom+Tt(e.center.lat,b.center.lat))}function BF(e,t,i){return Math.abs(ti(e,i))<=90?t:t>0?90:-90}function OF(e,t,i,r,a){let o=e.center.lng,n=e.center.lat,s=n>=0?90:-90,l=V(e).locationToScreenPoint(e,t,new Y(0,s)),u=i.x-l.x,c=i.y-l.y,h=u*u+c*c,d=H(1-(ci-Math.abs(n))/12,0,1),p=d*d*(3-2*d),f=Aa(a-o+180,360)-180,m=0;if(p>0&&r){let g=(u*r.y-c*r.x)/Math.max(h,400);m=(s>0?1:-1)*g*180/Math.PI}return o+(1-p)*f+p*m}function ui(e){switch(om(e)){case"mercator":return jF;case"vertical-perspective":return NF}}function q_(e,t,i,r,a){return e=pt(e,t,i),e=ra(e,r.roll),e=Hi(e,r.pitch),e=Zi(e,r.bearing),nm(e,t,a)}function Zh(e,t,i,r){let a=ui(t).setLocationAtPoint(e,t,i,r);return a.zoom===e.zoom?a:pt(a,t,e.zoom)}function wl(e,t,i,r,a){let o=a,n=r==="x"?[i[0],i[4],i[8],i[12]]:[i[1],i[5],i[9],i[13]],s=[i[3],i[7],i[11],i[15]],l=e[0]*n[0]+e[1]*n[1]+e[2]*n[2],u=e[0]*s[0]+e[1]*s[1]+e[2]*s[2],c=t[0]*n[0]+t[1]*n[1]+t[2]*n[2],h=t[0]*s[0]+t[1]*s[1]+t[2]*s[2],d=(c+n[3]-o*h-o*s[3])/(c-l-o*h+o*u);return c+o*u===l+o*h||s[3]*(l-c)+n[3]*(h-u)+l*h===c*u?null:d}function Tl(e,t){return t!==null&&t>=0&&t<e?t:e}function ri(e){return Fn(e)?UF:Zb}function _n(e,t){(!e.duration||e.duration<t.duration)&&(e.duration=t.duration,e.easing=t.easing)}function El(e,t,i){let{maxSpeed:r,linearity:a,deceleration:o}=i,n=H(e*a/(t/1000),-r,r),s=Math.abs(n)/(o*a);return{easing:i.easing,duration:s*1000,amount:s/2*n}}function YF(e,t,{halfLife:i,minSpeed:r,maxSpeed:a,stopSpeed:o}){let n=H(e/(t/1000),-a,a);if(Math.abs(n)<r)return;let s=i*Math.log2(Math.abs(n)/o),l=(c)=>1-2**(-c*s/i),u=l(1);return{easing:(c)=>l(H(c,0,1))/u,duration:s,amount:i/1000*n/Math.LN2*u}}function Hh(e){return e.panDelta?.mag()||e.zoomDelta||e.bearingDelta||e.pitchDelta||e.rollDelta}function Dp(e,t){if(e.length!==t.length)throw Error(`The number of touches and points are not equal - touches ${e.length}, points ${t.length}`);let i={};for(let r=0;r<e.length;r++)i[e[r].identifier]=t[r];return i}function Ap(e,t){let i=e.proposedProjectedCamera,r=V(i),{worldCoordinateHelper:a}=e.context;if(r.isPointOnMapSurface(i,a,t))return r.screenPointToLocation(i,a,t,e.terrain)}function rR(e){let t=new D(0,0);for(let i of e)t._add(i);return t.div(e.length)}function sR(e,t){let i=nR[t];return e.buttons===void 0||(e.buttons&i)!==i}function sm(e,t,i){return t==="center"||!(e.bearingDelta||e.pitchDelta||e.rollDelta)?e:{...e,around:i}}function lR({enable:e,clickTolerance:t}){return new cc({clickTolerance:t,move:(i,r)=>({around:r,panDelta:r.sub(i)}),activateOnStart:(i)=>!i.ctrlKey,moveStateManager:new hc({checkCorrectEvent:(i)=>i.button===0}),enable:e,assignEvents:dc})}function uR({enable:e,clickTolerance:t,minPixelCenterThreshold:i=100,rotateSpeed:r=0.8},a,o,n){return new cc({clickTolerance:t,move:(s,l,u)=>{if(o?.()==="pointer")return sm({bearingDelta:(l.x-s.x)*r},"pointer",u);let c=a(),h=(n?.()??"circular")==="circular";if(h&&Math.abs(c.y-s.y)>i)return{bearingDelta:s3(new D(s.x,l.y),l,c)};let d=(l.x-s.x)*r;return h&&l.y<c.y&&(d=-d),{bearingDelta:d}},moveStateManager:new hc({checkCorrectEvent:(s)=>s.button===0&&s.ctrlKey||s.button===2&&!s.ctrlKey}),enable:e,assignEvents:dc})}function cR({enable:e,clickTolerance:t,pitchSpeed:i=-0.5},r){return new cc({clickTolerance:t,move:(a,o,n)=>sm({pitchDelta:(o.y-a.y)*i},r?.()??"center",n),moveStateManager:new hc({checkCorrectEvent:(a)=>a.button===0&&a.ctrlKey||a.button===2}),enable:e,assignEvents:dc})}function hR({enable:e,clickTolerance:t,rollDegreesPerPixelMoved:i=0.3},r,a){return new cc({clickTolerance:t,move:(o,n,s)=>{let l=r(),u=(n.x-o.x)*i;return n.y<l.y&&(u=-u),sm({rollDelta:u},a?.()??"center",s)},moveStateManager:new hc({checkCorrectEvent:(o)=>o.button===2&&o.ctrlKey}),enable:e,assignEvents:dc})}function Cl(e,t,i){for(let r=0;r<e.length;r++)if(e[r].identifier===i)return t[r]}function W_(e,t){return Math.log(e/t)/Math.LN2}function Z_(e,t){return e.angleWith(t)*180/Math.PI}function Xh(e){return Math.abs(e.y)>Math.abs(e.x)}function yR(e){return e*(2-e)}function DR(e,t){let{camera:i,canvas:r,canvasContainer:a}=e,o=[];function n(R,k,M){o.push({handlerName:R,handler:k,allowed:M})}n("mapEvent",new eR(e.eventFactory,t));let s=new iR(a,e.container,t,i,e.boxZoomEnd);n("boxZoom",s),t.interactive&&t.boxZoom&&s.enable();let l=new CR(a,e.locale,t.cooperativeGestures);n("cooperativeGestures",l),t.cooperativeGestures&&l.enable();let u=new oR(i),c=new bR(i),h=new xR(c,u);n("tapZoom",u),n("clickZoom",c),t.interactive&&t.doubleClickZoom&&h.enable();let d=new wR;n("tapDragZoom",d);let p=new mR(l);n("touchPitch",p),t.interactive&&t.touchPitch&&p.enable(t.touchPitch);let f=()=>i.projectedCamera.centerPoint,m=()=>v.around,g=uR(t,f,m,()=>v.movement),_=cR(t,m),y=hR(t,f,m),v=new ER(t,g,_,y);n("mouseRotate",g,["mousePitch"]),n("mousePitch",_,["mouseRotate","mouseRoll"]),n("mouseRoll",y,["mousePitch"]),t.interactive&&t.dragRotate&&v.enable(t.dragRotate);let x=lR(t),b=new dR(t,l),w=new TR(a,x,b);n("mousePan",x),n("touchPan",b,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&w.enable(t.dragPan);let T=new fR,E=new pR,S=new SR(a,E,T,d);n("touchRotate",T,["touchPan","touchZoom"]),n("touchZoom",E,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&S.enable(t.touchZoomRotate),n("blockableMapEvent",new tR(e.eventFactory,t),["touchPan"]);let A=new vR(r,l,i);n("scrollZoom",A,["mousePan"]),t.interactive&&t.scrollZoom&&A.enable(t.scrollZoom);let I=new _R(i);return n("keyboard",I),t.interactive&&t.keyboard&&I.enable(),{registrations:o,mapHandlers:{boxZoom:s,cooperativeGestures:l,doubleClickZoom:h,touchPitch:p,dragRotate:v,dragPan:w,touchZoomRotate:S,scrollZoom:A,keyboard:I}}}function AR(e,t,i){if(e.dem!=="awaiting")return null;let r=i.getDrawnElevationForLngLat(t,!0);if(r!==void 0)return{hold:{...e,dem:"taken"},elevation:r};let a=i.getDrawnElevationForLngLat(t);return a===void 0?null:{hold:e,elevation:a}}function Xb(e){return{view:e,motion:Hb,centerElevation:{rule:"ground"},terrainRevision:0,projection:"mercator",projectionTransition:1}}function Yb(e,t){let i=t(e);return i===e?e:{...e,...i}}function X_(...e){return(t)=>e.reduce(Yb,t)}function Kb(e){return(t)=>e===t.view?t:{view:e}}function Dl(e){return(t)=>e===t.view.elevation?t:{view:{...t.view,elevation:e}}}function MR(e,t,i,r){return(a)=>({view:PF(a.view,e,t,i,r)})}function PR(e){return(t)=>Kb(Tr(t.view,e))(t)}function IR(){return(e)=>e.motion.moving?e:{motion:{moving:!0,adjustment:null}}}function Y_(e){return(t)=>!t.motion.moving||e===t.motion.adjustment?t:{motion:{moving:!0,adjustment:e}}}function K_(e){return(t)=>({motion:Hb,view:t.centerElevation.rule==="held"?{...e,elevation:t.view.elevation}:e})}function ya(e){return(t)=>e===t.centerElevation?t:{centerElevation:e}}function J_(){return(e)=>({terrainRevision:e.terrainRevision+1})}function kR(e){return(t)=>e===t.projection?t:{projection:e,projectionTransition:1}}function FR(e){return(t)=>e===t.projectionTransition?t:{projectionTransition:e}}function Q_(){return{zoom:!1,rotate:!1,pitch:!1,roll:!1}}function LR(){return zR()(()=>({camera:Xb(d2())}))}function BR(e,t,i){return e.subscribe((r,a)=>{let o=t(r),n=t(a);o!==n&&i(o,n)})}function jR(e,t,i){let r=1,a=iy(e,t,i),o=i.distance/a.distance;for(let n=0;n<5&&!ry(a.distance,i);n++){if(!Number.isFinite(o)||o<=0)return null;let s=a.state.zoom,l=pt(a.state,t,s+wt(r/o)),u=r*St(s-l.zoom);if(u===r)return l;let c=iy(l,t,i);o=u+(i.distance-c.distance)*(u-r)/(c.distance-a.distance),r=u,a=c}return ry(a.distance,i)?a.state:null}function iy(e,t,i){let r=ui(t).setLocationAtPoint(e,t,i.location,i.point,i.elevation);return{state:r,distance:Nl(Li(r,t),t.worldCoordinateHelper,i.location,i.elevation)}}function ry(e,t){return Math.abs(e/t.distance-1)<0.0000001}function NR(e,t,i){return i.elevation!==void 0||Rp(Du(V(e).screenPointToLocation(e,t,i.point),0),Du(i.location,0))<i.distance*0.0001}function ay(e,t,i){return V(e).isPointOnMapSurface(e,t,new D(i.x,i.y-16))}function Nl(e,t,i,r=e.elevation){return Rp(Du(V(e).getCameraLngLat(e,t),V(e).getCameraAltitude(e)),Du(i,r))}function Du(e,t){let i=dt(e);return Ue(i,i,Yt+t)}function Kh(e){return ic(e)?`custom-layer:${e.id}`:e.source}function Pp(e){return ic(e)?e.implementation.renderToTerrainTile!==void 0:Qb[e.type]===!0}function ZR(e,t){let i=[],r=!1;for(let a of t){let o=Pp(e._layers[a]);o&&!r&&i.push([]),o&&i[i.length-1].push(a),r=o}return i}function tw(e,t,i,r,a=!1){if(a||!Wf(i).allowWorldCopies())return e?.wrap();let o=new Y(e.lng,e.lat);if(e=new Y(e.lng,e.lat),t){let n=new Y(e.lng-360,e.lat),s=new Y(e.lng+360,e.lat),l=V(i).locationToScreenPoint(i,r,e).distSqr(t);V(i).locationToScreenPoint(i,r,n).distSqr(t)<l?e=n:V(i).locationToScreenPoint(i,r,s).distSqr(t)<l&&(e=s)}for(;Math.abs(e.lng-i.center.lng)>180;){let n=V(i).locationToScreenPoint(i,r,e);if(n.x>=0&&n.y>=0&&n.x<=i.width&&n.y<=i.height)break;e.lng>i.center.lng?e.lng-=360:e.lng+=360}return e.lng!==o.lng&&V(i).isPointOnMapSurface(i,r,V(i).locationToScreenPoint(i,r,e))?e:o}function iw(e,t,i){let r=e.classList;for(let a in um)r.remove(`maplibregl-${i}-anchor-${a}`);r.add(`maplibregl-${i}-anchor-${t}`)}function Ii(e,t,i=[]){let r=Ve.createNS("http://www.w3.org/2000/svg",e);for(let a in t)r.setAttributeNS(null,a,t[a]);for(let a of i)r.appendChild(a);return r}function KR(){return Jh||(Jh=Ii("svg",{display:"block",height:"41px",width:"27px",viewBox:"0 0 27 41"},[Ii("g",{"fill-rule":"nonzero"},[Ii("g",{transform:"translate(3.0, 29.0)",fill:"#000000"},[["10.5","5.25002273"],["10.5","5.25002273"],["9.5","4.77275007"],["8.5","4.29549936"],["7.5","3.81822308"],["6.5","3.34094679"],["5.5","2.86367051"],["4.5","2.38636864"]].map(([e,t])=>Ii("ellipse",{opacity:"0.04",cx:"10.5",cy:"5.80029008",rx:e,ry:t}))),Ii("g",{fill:rw},[Ii("path",{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"})]),Ii("g",{opacity:"0.25",fill:"#000000"},[Ii("path",{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"})]),Ii("g",{transform:"translate(6.0, 7.0)",fill:"#FFFFFF"}),Ii("g",{transform:"translate(8.0, 8.0)"},[Ii("circle",{fill:"#000000",opacity:"0.25",cx:"5.5",cy:"5.5",r:"5.4999962"}),Ii("circle",{fill:"#FFFFFF",cx:"5.5",cy:"5.5",r:"5.4999962"})])])]),Jh)}function JR(e){return e.firstElementChild.children[1]}function ow(e){if(!e)return ow(new D(0,0));if(typeof e=="number"){let t=Math.round(Math.abs(e)/Math.SQRT2);return{center:new D(0,0),top:new D(0,e),"top-left":new D(t,t),"top-right":new D(-t,t),bottom:new D(0,-e),"bottom-left":new D(t,-t),"bottom-right":new D(-t,-t),left:new D(e,0),right:new D(-e,0)}}if(e instanceof D||Array.isArray(e)){let t=D.convert(e);return{center:t,top:t,"top-left":t,"top-right":t,bottom:t,"bottom-left":t,"bottom-right":t,left:t,right:t}}return{center:D.convert(e.center||[0,0]),top:D.convert(e.top||[0,0]),"top-left":D.convert(e["top-left"]||[0,0]),"top-right":D.convert(e["top-right"]||[0,0]),bottom:D.convert(e.bottom||[0,0]),"bottom-left":D.convert(e["bottom-left"]||[0,0]),"bottom-right":D.convert(e["bottom-right"]||[0,0]),left:D.convert(e.left||[0,0]),right:D.convert(e.right||[0,0])}}function tz(e){return e?{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}:{top:0,right:0,bottom:0,left:0}}function nw(e){Ma.WORKER_URL=e}var u5,cy,c5,h5,d5,hy,Ip=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports),p5=(e,t,i,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(var a=h5(t),o=0,n=a.length,s;o<n;o++)s=a[o],!hy.call(e,s)&&s!==i&&cy(e,s,{get:((l)=>t[l]).bind(null,s),enumerable:!(r=c5(t,s))||r.enumerable});return e},f5=(e,t,i)=>(i=e==null?{}:u5(d5(e)),p5(t||!e||!e.__esModule||!hy.call(e,"default")?cy(i,"default",{value:e,enumerable:!0}):i,e)),dy="6.19.0",Ig,Gs,At,td,Pr,Br,Ul,B5,$5,Rg,G5,z=8192,nd,Y5=1,jg,sh=null,i3=async(e,t)=>{let i=new Blob([new Uint8Array(e)],{type:"image/png"});try{return createImageBitmap(i,t)}catch(r){throw Error(`Could not load image because of ${Mt(r).message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}},r3=(e)=>new Promise((t,i)=>{let r=new Image;r.onload=()=>{t(r),URL.revokeObjectURL(r.src),r.onload=null,window.requestAnimationFrame(()=>r.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=")},r.onerror=()=>i(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 a=new Blob([new Uint8Array(e)],{type:"image/png"});r.src=URL.createObjectURL(a)}),ci=85.051129,Ty,Ey,Vg="AbortError",os,lh,$g,uh,li,h3,Gl,f3,m3,g3,_3,Ug,Ve,Ma,sd="global-dispatcher",Wl,y3=(e)=>e.startsWith("file:")||Op()?.startsWith("file:")&&!/^\w+:/.test(e),Mu=async function(e,t){if(e.url.includes("://")&&!/^https?:|^file:/.test(e.url)){let i=Sy(e.url);if(i){let r=await i(e,t);return!r.data&&e.type==="arrayBuffer"?ee(r,{data:new ArrayBuffer(0)}):r}if(Eo(self)&&self.worker?.actor)return self.worker.actor.sendAsync({type:"GR",data:e,targetMapId:sd},t)}if(!y3(e.url)){if(fetch&&Request&&AbortController&&Object.hasOwn(Request.prototype,"signal"))return v3(e,t);if(Eo(self)&&self.worker?.actor)return self.worker.actor.sendAsync({type:"GR",data:e,mustQueue:!0,targetMapId:sd},t)}return x3(e,t)},Pu=(e,t)=>Mu(ee(e,{type:"json"}),t),Cy=(e,t)=>Mu(ee(e,{type:"arrayBuffer"}),t),b3=(e)=>{let t=window.document.createElement("video");return t.muted=!0,new Promise((i)=>{t.onloadstart=()=>{i(t)};for(let r of e){let a=window.document.createElement("source");Dy(r)||(t.crossOrigin="Anonymous"),a.src=r,t.appendChild(a)}})},sa=class{constructor(e,t={}){ee(this,t),this.type=e}},ie,qe=class{on(e,t){return this._listeners||={},qg(e,t,this._listeners),{unsubscribe:()=>{this.off(e,t)}}}off(e,t){return hh(e,t,this._listeners),hh(e,t,this._oneTimeListeners),this}once(e,t){return t?(this._oneTimeListeners||={},qg(e,t,this._oneTimeListeners),this):new Promise((i)=>this.once(e,i))}fire(e,t){let i=typeof e=="string"?new sa(e,t||{}):e,r=i.type;if(this.listens(r)){i.target=this;let a=this._listeners?.[r]?.slice()??[];for(let s of a)s.call(this,i);let o=this._oneTimeListeners?.[r]?.slice()??[];for(let s of o)hh(r,s,this._oneTimeListeners),s.call(this,i);let n=this._eventedParent;n&&(ee(i,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),n.fire(i))}else i instanceof ie&&console.error(i.error);return this}listens(e){return!!(this._listeners?.[e]?.length||this._oneTimeListeners?.[e]?.length||this._eventedParent?.listens(e))}setEventedParent(e,t){return this._eventedParent=e,this._eventedParentData=t,this}},ld=class e{constructor(t,i,r){let a=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;let n=new Int32Array(this.arrayBuffer);t=n[0],i=n[1],r=n[2],this.d=i+2*r;for(let u=0;u<this.d*this.d;u++){let c=n[3+u],h=n[3+u+1];a.push(c===h?null:n.subarray(c,h))}let s=n[3+a.length],l=n[3+a.length+1];this.keys=n.subarray(s,l),this.bboxes=n.subarray(l),this.insert=this._insertReadonly}else{this.d=i+2*r;for(let n=0;n<this.d*this.d;n++)a.push([]);this.keys=[],this.bboxes=[]}this.n=i,this.extent=t,this.padding=r,this.scale=i/t,this.uid=0;let o=r/i*t;this.min=-o,this.max=t+o}insert(t,i,r,a,o){this._forEachCell(i,r,a,o,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(a),this.bboxes.push(o)}_insertReadonly(){throw Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,i,r,a,o,n){this.cells[o].push(n)}query(t,i,r,a,o){let n=this.min,s=this.max;if(t<=n&&i<=n&&s<=r&&s<=a&&!o)return[...this.keys];{let l=[];return this._forEachCell(t,i,r,a,this._queryCell,l,{},o),l}}_queryCell(t,i,r,a,o,n,s,l){let u=this.cells[o];if(u!==null){let c=this.keys,h=this.bboxes;for(let d of u)if(s[d]===void 0){let p=d*4;(l?l(h[p+0],h[p+1],h[p+2],h[p+3]):t<=h[p+2]&&i<=h[p+3]&&r>=h[p+0]&&a>=h[p+1])?(s[d]=!0,n.push(c[d])):s[d]=!1}}}_forEachCell(t,i,r,a,o,n,s,l){let u=this._convertToCellCoord(t),c=this._convertToCellCoord(i),h=this._convertToCellCoord(r),d=this._convertToCellCoord(a);for(let p=u;p<=h;p++)for(let f=c;f<=d;f++){let m=this.d*f+p;if((!l||l(this._convertFromCellCoord(p),this._convertFromCellCoord(f),this._convertFromCellCoord(p+1),this._convertFromCellCoord(f+1)))&&o.call(this,t,i,r,a,m,n,s,l))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let t=this.cells,i=3+this.cells.length+1+1,r=0;for(let n of this.cells)r+=n.length;let a=new Int32Array(i+r+this.keys.length+this.bboxes.length);a[0]=this.extent,a[1]=this.n,a[2]=this.padding;let o=i;for(let n=0;n<t.length;n++){let s=t[n];a[3+n]=o,a.set(s,o),o+=s.length}return a[3+t.length]=o,a.set(this.keys,o),o+=this.keys.length,a[3+t.length+1]=o,a.set(this.bboxes,o),o+=this.bboxes.length,a.buffer}static serialize(t,i){let r=t.toArrayBuffer();return i&&i.push(r),{buffer:r}}static deserialize(t){return new e(t.buffer)}},Ay,F,w3,O=class{constructor(e,t,i,r,a="error"){this.message=(e?`${e}: `:"")+i,r&&(this.identifier=r),this.severity=a,t!=null&&t.__line__&&(this.line=t.__line__)}},ur,M3=class e{constructor(t,i=[]){this.parent=t,this.bindings={};for(let[r,a]of i)this.bindings[r]=a}concat(t){return new e(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw Error(`${t} not found in scope.`)}has(t){return this.bindings[t]?!0:this.parent?this.parent.has(t):!1}},ns,U,ce,ve,Xi,Iu,Ca,de,P3,ku,ss,Fu,Bn,Ru,ls,zu,I3,Iy=0.96422,ky=0.82521,Fy=0.13793103448275862,ud=0.20689655172413793,Ry,zy,Np,Oy,jy,z3,L3,B3,O3,$3,U3,W3,Ri="[+-]?(?:\\d+(?:\\.\\d+)?|\\.\\d+)(?:e[+-]?\\d+)?",H3,X3,Y3,Xg,K3,se,Up=class{constructor(e,t,i){this.sensitivity=e?t?"variant":"case":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}},Q3,cd=class{constructor(e,t,i,r,a,o){this.text=e,this.image=t,this.scale=i,this.fontStack=r,this.textColor=a,this.verticalAlign=o}},Or=class e{constructor(t){this.sections=t}static fromString(t){return new e([new cd(t,null,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some((t)=>t.text.length!==0||t.image&&t.image.name.length!==0)}static factory(t){return t instanceof e?t:e.fromString(t)}toString(){return this.sections.length===0?"":this.sections.map((t)=>t.text).join("")}},br=class e{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof e)return t;if(typeof t=="number")return new e([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(let i of t)if(typeof i!="number")return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]]}return new e(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,i,r){return new e(So(t.values,i.values,r))}},wr=class e{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof e)return t;if(typeof t=="number")return new e([t]);if(Array.isArray(t)){for(let i of t)if(typeof i!="number")return;return new e(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,i,r){return new e(So(t.values,i.values,r))}},oi=class e{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof e)return t;if(typeof t=="string"){let r=se.parse(t);return r?new e([r]):void 0}if(!Array.isArray(t))return;let i=[];for(let r of t){if(typeof r!="string")return;let a=se.parse(r);if(!a)return;i.push(a)}return new e(i)}toString(){return JSON.stringify(this.values)}static interpolate(t,i,r,a="rgb"){let o=[];if(t.values.length!=i.values.length)throw Error(`colorArray: Arrays have mismatched length (${t.values.length} vs. ${i.values.length}), cannot interpolate.`);for(let n=0;n<t.values.length;n++)o.push(se.interpolate(t.values[n],i.values[n],r,a));return new e(o)}},Je,e4,yr=class e{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof e)return t;if(!(!Array.isArray(t)||t.length<1||t.length%2!=0)){for(let i=0;i<t.length;i+=2){let r=t[i],a=t[i+1];if(typeof r!="string"||!e4.has(r)||!Array.isArray(a)||a.length!==2||typeof a[0]!="number"||typeof a[1]!="number")return}return new e(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,i,r,a){let o=t.values,n=i.values;if(o.length!==n.length)throw new Je(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${i.toString()}`,a);let s=[];for(let l=0;l<o.length;l+=2){if(o[l]!==n[l])throw new Je(`Cannot interpolate values containing mismatched anchors. from[${l}]: ${o[l]}, to[${l}]: ${n[l]}`,a);s.push(o[l]);let[u,c]=o[l+1],[h,d]=n[l+1];s.push([Nt(u,h,r),Nt(c,d,r)])}return new e(s)}},vr=class e{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new e({name:t,available:!1}):null}},la=class e{constructor(t,i,r){this.from=t,this.to=i,this.transition=r}toString(){return this.from===this.to&&this.transition===1?this.from:JSON.stringify([this.from,this.to,this.transition])}static interpolate(t,i,r){return new e(t,i,r)}static parse(t){if(t instanceof e)return t;if(Array.isArray(t)&&t.length===3&&typeof t[0]=="string"&&typeof t[1]=="string"&&typeof t[2]=="number")return new e(t[0],t[1],t[2]);if(typeof t=="object"&&typeof t.from=="string"&&typeof t.to=="string"&&typeof t.transition=="number")return new e(t.from,t.to,t.transition);if(typeof t=="string")return new e(t,t,1)}},Do=class e{constructor(t,i){this.type=t,this.value=i}static parse(t,i){if(t.length!==2)return i.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!Co(t[1]))return i.error(`invalid value of type "${typeof t[1]}"`);let r=t[1],a=ut(r),o=i.expectedType;return a.kind==="array"&&a.N===0&&o&&o.kind==="array"&&(typeof o.N!="number"||o.N===0)&&(a=o),new e(a,r)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}},Ks,Ir=class e{constructor(t,i,r){this.type=t,this.args=i,this.key=r}static parse(t,i){if(t.length<2)return i.error("Expected at least one argument.");let r=1,a,o=t[0];if(o==="array"){let s;if(t.length>2){let u=t[1];if(typeof u!="string"||!(u in Ks)||u==="object")return i.error('The item type argument of "array" must be one of string, number, boolean',1);s=Ks[u],r++}else s=de;let l;if(t.length>3){if(t[2]!==null&&(typeof t[2]!="number"||t[2]<0||t[2]!==Math.floor(t[2])))return i.error('The length argument to "array" must be a positive integer literal',2);l=t[2],r++}a=Vt(s,l)}else{if(!Ks[o])throw Error(`Types doesn't contain name = ${o}`);a=Ks[o]}let n=[];for(;r<t.length;r++){let s=i.parse(t[r],r,de);if(!s)return null;n.push(s)}return new e(a,n,i.key)}evaluate(t){for(let i=0;i<this.args.length;i++){let r=this.args[i].evaluate(t);if(!On(this.type,ut(r)))return r;if(i===this.args.length-1)throw new Je(`Expected value to be of type ${it(this.type)}, but found ${it(ut(r))} instead.`,this.key)}throw Error()}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t)=>t.outputDefined())}},Jg,uo=class e{constructor(t,i,r){this.type=t,this.args=i,this.key=r}static parse(t,i){if(t.length<2)return i.error("Expected at least one argument.");let r=t[0];if(!Jg[r])throw Error(`Can't parse ${r} as it is not part of the known types`);if((r==="to-boolean"||r==="to-string")&&t.length!==2)return i.error("Expected one argument.");let a=Jg[r],o=[];for(let n=1;n<t.length;n++){let s=i.parse(t[n],n,de);if(!s)return null;o.push(s)}return new e(a,o,i.key)}evaluate(t){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(t);case"color":{let i,r;for(let a of this.args){if(i=a.evaluate(t),r=null,i instanceof se)return i;if(typeof i=="string"){let o=t.parseColor(i);if(o)return o}else if(Array.isArray(i)&&(r=i.length<3||i.length>4?`Invalid rgba value ${JSON.stringify(i)}: expected an array containing either three or four numeric values.`:$y(i[0],i[1],i[2],i[3]),!r))return new se(i[0]/255,i[1]/255,i[2]/255,i[3])}throw new Je(r||`Could not parse color from value '${typeof i=="string"?i:JSON.stringify(i)}'`,this.key)}case"padding":{let i;for(let r of this.args){i=r.evaluate(t);let a=br.parse(i);if(a)return a}throw new Je(`Could not parse padding from value '${typeof i=="string"?i:JSON.stringify(i)}'`,this.key)}case"numberArray":{let i;for(let r of this.args){i=r.evaluate(t);let a=wr.parse(i);if(a)return a}throw new Je(`Could not parse numberArray from value '${typeof i=="string"?i:JSON.stringify(i)}'`,this.key)}case"colorArray":{let i;for(let r of this.args){i=r.evaluate(t);let a=oi.parse(i);if(a)return a}throw new Je(`Could not parse colorArray from value '${typeof i=="string"?i:JSON.stringify(i)}'`,this.key)}case"variableAnchorOffsetCollection":{let i;for(let r of this.args){i=r.evaluate(t);let a=yr.parse(i);if(a)return a}throw new Je(`Could not parse variableAnchorOffsetCollection from value '${typeof i=="string"?i:JSON.stringify(i)}'`,this.key)}case"number":{let i=null;for(let r of this.args){if(i=r.evaluate(t),i===null)return 0;let a=Number(i);if(!isNaN(a))return a}throw new Je(`Could not convert ${JSON.stringify(i)} to number.`,this.key)}case"formatted":return Or.fromString(En(this.args[0].evaluate(t)));case"resolvedImage":return vr.fromString(En(this.args[0].evaluate(t)));case"projectionDefinition":{let i=this.args[0].evaluate(t);if(la.parse(i))return i;throw new Je(`Could not parse projectionDefinition from value '${typeof i=="string"?i:JSON.stringify(i)}'`,this.key)}default:return En(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t)=>t.outputDefined())}},t4,Uy=class{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?t4[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(e){let t=this._parseColorCache.get(e);return t||(t=se.parse(e),this._parseColorCache.set(e,t)),t}},qy=class e{constructor(t,i,r=[],a,o=new M3,n=[]){this.registry=t,this.path=r,this.key=r.map((s)=>`[${s}]`).join(""),this.scope=o,this.errors=n,this.expectedType=a,this._isConstant=i}parse(t,i,r,a,o={}){return i==null?this._parse(t,o):this.concat(i,r,a)._parse(t,o)}_parse(t,i){(t===null||typeof t=="string"||typeof t=="boolean"||typeof t=="number")&&(t=["literal",t]);let r=this.key;function a(o,n,s){return s==="assert"?new Ir(n,[o],r):s==="coerce"?new uo(n,[o],r):o}if(Array.isArray(t)){if(t.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');let o=t[0];if(typeof o!="string")return this.error(`Expression name must be a string, but found ${typeof o} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let n=this.registry[o];if(n){let s=n.parse(t,this);if(!s)return null;if(this.expectedType){let l=this.expectedType,u=s.type;if((l.kind==="string"||l.kind==="number"||l.kind==="boolean"||l.kind==="object"||l.kind==="array")&&u.kind==="value")s=a(s,l,i.typeAnnotation||"assert");else if(l.kind==="projectionDefinition"&&["string","array","value"].includes(u.kind)||["color","formatted","resolvedImage"].includes(l.kind)&&["value","string"].includes(u.kind)||["padding","numberArray"].includes(l.kind)&&["value","number","array"].includes(u.kind)||l.kind==="colorArray"&&["value","string","array"].includes(u.kind)||l.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(u.kind))s=a(s,l,i.typeAnnotation||"coerce");else if(this.checkSubtype(l,u))return null}if(!(s instanceof Do)&&s.type.kind!=="resolvedImage"&&this._isConstant(s)){let l=new Uy;try{s=new Do(s.type,s.evaluate(l))}catch(u){return this.error(u.message),null}}return s}return this.error(`Unknown expression "${o}". If you wanted a literal array, use ["literal", [...]].`,0)}return t===void 0?this.error("'undefined' value invalid. Use null instead."):typeof t=="object"?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error(`Expected an array, but found ${typeof t} instead.`)}concat(t,i,r){let a=typeof t=="number"?this.path.concat(t):this.path,o=r?this.scope.concat(r):this.scope;return new e(this.registry,this._isConstant,a,i||null,o,this.errors)}error(t,...i){let r=`${this.key}${i.map((a)=>`[${a}]`).join("")}`;this.errors.push(new ur(r,t))}checkSubtype(t,i){let r=On(t,i);return r&&this.error(r),r}},Gy=class e{constructor(t,i){this.type=i.type,this.bindings=[].concat(t),this.result=i}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(let i of this.bindings)t(i[1]);t(this.result)}static parse(t,i){if(t.length<4)return i.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);let r=[];for(let o=1;o<t.length-1;o+=2){let n=t[o];if(typeof n!="string")return i.error(`Expected string, but found ${typeof n} instead.`,o);if(/[^a-zA-Z0-9_]/.test(n))return i.error("Variable names must contain only alphanumeric characters or '_'.",o);let s=i.parse(t[o+1],o+1);if(!s)return null;r.push([n,s])}let a=i.parse(t[t.length-1],t.length-1,i.expectedType,r);return a?new e(r,a):null}outputDefined(){return this.result.outputDefined()}},Wy=class e{constructor(t,i){this.type=i.type,this.name=t,this.boundExpression=i}static parse(t,i){if(t.length!==2||typeof t[1]!="string")return i.error("'var' expression requires exactly one string literal argument.");let r=t[1];return i.scope.has(r)?new e(r,i.scope.get(r)):i.error(`Unknown variable "${r}". Make sure "${r}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}},i4=class e{constructor(t,i,r,a){this.type=t,this.index=i,this.input=r,this.key=a}static parse(t,i){if(t.length!==3)return i.error(`Expected 2 arguments, but found ${t.length-1} instead.`);let r=i.parse(t[1],1,U),a=i.parse(t[2],2,Vt(i.expectedType||de));if(!r||!a)return null;let o=a.type;return new e(o.itemType,r,a,i.key)}evaluate(t){let i=this.index.evaluate(t),r=this.input.evaluate(t);if(i<0)throw new Je(`Array index out of bounds: ${i} < 0.`,this.key);if(i>=r.length)throw new Je(`Array index out of bounds: ${i} > ${r.length-1}.`,this.key);if(i!==Math.floor(i))throw new Je(`Array index must be an integer, but found ${i} instead.`,this.key);return r[i]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}},r4=class e{constructor(t,i,r){this.needle=t,this.haystack=i,this.key=r,this.type=ve}static parse(t,i){if(t.length!==3)return i.error(`Expected 2 arguments, but found ${t.length-1} instead.`);let r=i.parse(t[1],1,de),a=i.parse(t[2],2,de);return!r||!a?null:jp(r.type,[ve,ce,U,ns,de])?new e(r,a,i.key):i.error(`Expected first argument to be of type boolean, string, number or null, but found ${it(r.type)} instead`)}evaluate(t){let i=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!r)return!1;if(!Da(i,["boolean","string","number","null"]))throw new Je(`Expected first argument to be of type boolean, string, number or null, but found ${it(ut(i))} instead.`,this.key);if(!Da(r,["string","array"]))throw new Je(`Expected second argument to be of type array or string, but found ${it(ut(r))} instead.`,this.key);return r.indexOf(i)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}},a4=class e{constructor(t,i,r,a){this.needle=t,this.haystack=i,this.key=r,this.fromIndex=a,this.type=U}static parse(t,i){if(t.length<=2||t.length>=5)return i.error(`Expected 2 or 3 arguments, but found ${t.length-1} instead.`);let r=i.parse(t[1],1,de),a=i.parse(t[2],2,de);if(!r||!a)return null;if(!jp(r.type,[ve,ce,U,ns,de]))return i.error(`Expected first argument to be of type boolean, string, number or null, but found ${it(r.type)} instead`);if(t.length===4){let o=i.parse(t[3],3,U);return o?new e(r,a,i.key,o):null}return new e(r,a,i.key)}evaluate(t){let i=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!Da(i,["boolean","string","number","null"]))throw new Je(`Expected first argument to be of type boolean, string, number or null, but found ${it(ut(i))} instead.`,this.key);let a;if(this.fromIndex&&(a=this.fromIndex.evaluate(t)),Da(r,["string"])){let o=r.indexOf(i,a);return o===-1?-1:[...r.slice(0,o)].length}if(Da(r,["array"]))return r.indexOf(i,a);throw new Je(`Expected second argument to be of type array or string, but found ${it(ut(r))} instead.`,this.key)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}},o4=class e{constructor(t,i,r,a,o,n){this.inputType=t,this.type=i,this.input=r,this.cases=a,this.outputs=o,this.otherwise=n}static parse(t,i){if(t.length<5)return i.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return i.error("Expected an even number of arguments.");let r,a;i.expectedType&&i.expectedType.kind!=="value"&&(a=i.expectedType);let o={},n=[];for(let u=2;u<t.length-1;u+=2){let c=t[u],h=t[u+1];Array.isArray(c)||(c=[c]);let d=i.concat(u);if(c.length===0)return d.error("Expected at least one branch label.");for(let f of c){if(typeof f!="number"&&typeof f!="string")return d.error("Branch labels must be numbers or strings.");if(typeof f=="number"&&Math.abs(f)>9007199254740991)return d.error("Branch labels must be integers no larger than 9007199254740991.");if(typeof f=="number"&&Math.floor(f)!==f)return d.error("Numeric branch labels must be integer values.");if(!r)r=ut(f);else if(d.checkSubtype(r,ut(f)))return null;if(o[String(f)]!==void 0)return d.error("Branch labels must be unique.");o[String(f)]=n.length}let p=i.parse(h,u,a);if(!p)return null;a||=p.type,n.push(p)}let s=i.parse(t[1],1,de);if(!s)return null;let l=i.parse(t[t.length-1],t.length-1,a);return!l||s.type.kind!=="value"&&i.concat(1).checkSubtype(r,s.type)?null:new e(r,a,s,o,n,l)}evaluate(t){let i=this.input.evaluate(t);return(ut(i)===this.inputType&&this.outputs[this.cases[i]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every((t)=>t.outputDefined())&&this.otherwise.outputDefined()}},n4=class e{constructor(t,i,r){this.type=t,this.branches=i,this.otherwise=r}static parse(t,i){if(t.length<4)return i.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return i.error("Expected an odd number of arguments.");let r;i.expectedType&&i.expectedType.kind!=="value"&&(r=i.expectedType);let a=[];for(let n=1;n<t.length-1;n+=2){let s=i.parse(t[n],n,ve);if(!s)return null;let l=i.parse(t[n+1],n+1,r);if(!l)return null;a.push([s,l]),r||=l.type}let o=i.parse(t[t.length-1],t.length-1,r);if(!o)return null;if(!r)throw Error("Can't infer output type");return new e(r,a,o)}evaluate(t){for(let[i,r]of this.branches)if(i.evaluate(t))return r.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(let[i,r]of this.branches)t(i),t(r);t(this.otherwise)}outputDefined(){return this.branches.every(([t,i])=>i.outputDefined())&&this.otherwise.outputDefined()}},s4=class e{constructor(t,i,r,a,o){this.type=t,this.input=i,this.beginIndex=r,this.key=a,this.endIndex=o}static parse(t,i){if(t.length<=2||t.length>=5)return i.error(`Expected 2 or 3 arguments, but found ${t.length-1} instead.`);let r=i.parse(t[1],1,de),a=i.parse(t[2],2,U);if(!r||!a)return null;if(!jp(r.type,[Vt(de),ce,de]))return i.error(`Expected first argument to be of type array or string, but found ${it(r.type)} instead`);if(t.length===4){let o=i.parse(t[3],3,U);return o?new e(r.type,r,a,i.key,o):null}return new e(r.type,r,a,i.key)}evaluate(t){let i=this.input.evaluate(t),r=this.beginIndex.evaluate(t),a;if(this.endIndex&&(a=this.endIndex.evaluate(t)),Da(i,["string"]))return[...i].slice(r,a).join("");if(Da(i,["array"]))return i.slice(r,a);throw new Je(`Expected first argument to be of type array or string, but found ${it(ut(i))} instead.`,this.key)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}},qp=class e{constructor(t,i,r,a){this.type=t,this.input=i,this.key=a,this.labels=[],this.outputs=[];for(let[o,n]of r)this.labels.push(o),this.outputs.push(n)}static parse(t,i){if(t.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return i.error("Expected an even number of arguments.");let r=i.parse(t[1],1,U);if(!r)return null;let a=[],o=null;i.expectedType&&i.expectedType.kind!=="value"&&(o=i.expectedType);for(let n=1;n<t.length;n+=2){let s=n===1?-1/0:t[n],l=t[n+1],u=n,c=n+1;if(typeof s!="number")return i.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',u);if(a.length&&a[a.length-1][0]>=s)return i.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',u);let h=i.parse(l,c,o);if(!h)return null;o||=h.type,a.push([s,h])}return new e(o,r,a,i.key)}evaluate(t){let i=this.labels,r=this.outputs;if(i.length===1)return r[0].evaluate(t);let a=this.input.evaluate(t);if(a<=i[0])return r[0].evaluate(t);let o=i.length;return a>=i[o-1]?r[o-1].evaluate(t):r[Lu(i,a,this.key)].evaluate(t)}eachChild(t){t(this.input);for(let i of this.outputs)t(i)}outputDefined(){return this.outputs.every((t)=>t.outputDefined())}},ni=class e{constructor(t,i,r,a,o,n){this.type=t,this.operator=i,this.interpolation=r,this.input=a,this.key=n,this.labels=[],this.outputs=[];for(let[s,l]of o)this.labels.push(s),this.outputs.push(l)}static interpolationFactor(t,i,r,a){let o=0;if(t.name==="exponential")o=mh(i,t.base,r,a);else if(t.name==="linear")o=mh(i,1,r,a);else if(t.name==="cubic-bezier"){let n=t.controlPoints;o=l4(n[0],n[1],n[2],n[3])(mh(i,1,r,a))}return o}static parse(t,i){let[r,a,o,...n]=t;if(!Array.isArray(a)||a.length===0)return i.error("Expected an interpolation type expression.",1);if(a[0]==="linear")a={name:"linear"};else if(a[0]==="exponential"){let u=a[1];if(typeof u!="number")return i.error("Exponential interpolation requires a numeric base.",1,1);a={name:"exponential",base:u}}else if(a[0]==="cubic-bezier"){let u=a.slice(1);if(u.length!==4||u.some((c)=>typeof c!="number"||c<0||c>1))return i.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);a={name:"cubic-bezier",controlPoints:u}}else return i.error(`Unknown interpolation type ${String(a[0])}`,1,0);if(t.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return i.error("Expected an even number of arguments.");if(o=i.parse(o,2,U),!o)return null;let s=[],l=null;(r==="interpolate-hcl"||r==="interpolate-lab"||r==="interpolate-oklch"||r==="interpolate-oklab")&&i.expectedType!=Bn?l=Xi:i.expectedType&&i.expectedType.kind!=="value"&&(l=i.expectedType);for(let u=0;u<n.length;u+=2){let c=n[u],h=n[u+1],d=u+3,p=u+4;if(typeof c!="number")return i.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',d);if(s.length&&s[s.length-1][0]>=c)return i.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',d);let f=i.parse(h,p,l);if(!f)return null;l||=f.type,s.push([c,f])}return!Wr(l,U)&&!Wr(l,Iu)&&!Wr(l,Xi)&&!Wr(l,Fu)&&!Wr(l,Ru)&&!Wr(l,Bn)&&!Wr(l,zu)&&!Wr(l,Vt(U))?i.error(`Type ${it(l)} is not interpolatable.`):new e(l,r,a,o,s,i.key)}evaluate(t){let i=this.labels,r=this.outputs;if(i.length===1)return r[0].evaluate(t);let a=this.input.evaluate(t);if(a<=i[0])return r[0].evaluate(t);let o=i.length;if(a>=i[o-1])return r[o-1].evaluate(t);let n=Lu(i,a,this.key),s=i[n],l=i[n+1],u=e.interpolationFactor(this.interpolation,a,s,l),c=r[n].evaluate(t),h=r[n+1].evaluate(t);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return Nt(c,h,u);case"color":return se.interpolate(c,h,u);case"padding":return br.interpolate(c,h,u);case"colorArray":return oi.interpolate(c,h,u);case"numberArray":return wr.interpolate(c,h,u);case"variableAnchorOffsetCollection":return yr.interpolate(c,h,u,this.key);case"array":return So(c,h,u);case"projectionDefinition":return la.interpolate(c,h,u)}case"interpolate-hcl":switch(this.type.kind){case"color":return se.interpolate(c,h,u,"hcl");case"colorArray":return oi.interpolate(c,h,u,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return se.interpolate(c,h,u,"lab");case"colorArray":return oi.interpolate(c,h,u,"lab")}case"interpolate-oklch":switch(this.type.kind){case"color":return se.interpolate(c,h,u,"oklch");case"colorArray":return oi.interpolate(c,h,u,"oklch")}case"interpolate-oklab":switch(this.type.kind){case"color":return se.interpolate(c,h,u,"oklab");case"colorArray":return oi.interpolate(c,h,u,"oklab")}}}eachChild(t){t(this.input);for(let i of this.outputs)t(i)}outputDefined(){return this.outputs.every((t)=>t.outputDefined())}},Ze,Zy=class e{constructor(t,i){this.type=t,this.args=i}static parse(t,i){if(t.length<2)return i.error("Expected at least one argument.");let r=null,a=i.expectedType;a&&a.kind!=="value"&&(r=a);let o=[];for(let n of t.slice(1)){let s=i.parse(n,1+o.length,r,void 0,{typeAnnotation:"omit"});if(!s)return null;r||=s.type,o.push(s)}if(!r)throw Error("No output type");return a&&o.some((n)=>On(a,n.type))?new e(de,o):new e(r,o)}evaluate(t){let i=null,r=0,a;for(let o of this.args)if(r++,i=o.evaluate(t),i&&i instanceof vr&&!i.available&&(a||=i.name,i=null,r===this.args.length&&(i=a)),i!==null)break;return i}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t)=>t.outputDefined())}},x4,b4,w4,T4,E4,S4,Xy=class e{constructor(t,i,r){this.type=ku,this.locale=r,this.caseSensitive=t,this.diacriticSensitive=i}static parse(t,i){if(t.length!==2)return i.error("Expected one argument.");let r=t[1];if(typeof r!="object"||Array.isArray(r))return i.error("Collator options argument must be an object.");let a=i.parse(r["case-sensitive"]!==void 0&&r["case-sensitive"],1,ve);if(!a)return null;let o=i.parse(r["diacritic-sensitive"]!==void 0&&r["diacritic-sensitive"],1,ve);if(!o)return null;let n=null;return r.locale&&(n=i.parse(r.locale,1,ce),!n)?null:new e(a,o,n)}evaluate(t){return new Up(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}},C4=class e{constructor(t,i,r,a,o,n){this.type=ce,this.number=t,this.locale=i,this.currency=r,this.unit=a,this.minFractionDigits=o,this.maxFractionDigits=n}static parse(t,i){if(t.length!==3)return i.error("Expected two arguments.");let r=i.parse(t[1],1,U);if(!r)return null;let a=t[2];if(typeof a!="object"||Array.isArray(a))return i.error("NumberFormat options argument must be an object.");let o=null;if(a.locale&&(o=i.parse(a.locale,1,ce),!o))return null;let n=null;if(a.currency&&(n=i.parse(a.currency,1,ce),!n))return null;let s=null;if(a.unit&&(s=i.parse(a.unit,1,ce),!s))return null;if(n&&s)return i.error("NumberFormat options `currency` and `unit` are mutually exclusive");let l=null;if(a["min-fraction-digits"]&&(l=i.parse(a["min-fraction-digits"],1,U),!l))return null;let u=null;return a["max-fraction-digits"]&&(u=i.parse(a["max-fraction-digits"],1,U),!u)?null:new e(r,o,n,s,l,u)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":this.unit?"unit":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,unit:this.unit?this.unit.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.unit&&t(this.unit),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}},Yy=class e{constructor(t){this.type=ss,this.sections=t}static parse(t,i){if(t.length<2)return i.error("Expected at least one argument.");let r=t[1];if(!Array.isArray(r)&&typeof r=="object")return i.error("First argument must be an image or text section.");let a=[],o=!1;for(let n=1;n<=t.length-1;++n){let s=t[n];if(o&&typeof s=="object"&&!Array.isArray(s)){o=!1;let l=null;if(s["font-scale"]&&(l=i.parse(s["font-scale"],1,U),!l))return null;let u=null;if(s["text-font"]&&(u=i.parse(s["text-font"],1,Vt(ce)),!u))return null;let c=null;if(s["text-color"]&&(c=i.parse(s["text-color"],1,Xi),!c))return null;let h=null;if(s["vertical-align"]){if(typeof s["vertical-align"]=="string"&&!Q3.includes(s["vertical-align"]))return i.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${s["vertical-align"]}' instead.`);if(h=i.parse(s["vertical-align"],1,ce),!h)return null}let d=a[a.length-1];d.scale=l,d.font=u,d.textColor=c,d.verticalAlign=h}else{let l=i.parse(t[n],1,de);if(!l)return null;let u=l.type.kind;if(u!=="string"&&u!=="value"&&u!=="null"&&u!=="resolvedImage")return i.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");o=!0,a.push({content:l,scale:null,font:null,textColor:null,verticalAlign:null})}}return new e(a)}evaluate(t){return new Or(this.sections.map((i)=>{let r=i.content.evaluate(t);return ut(r)===ls?new cd("",r,null,null,null,i.verticalAlign?i.verticalAlign.evaluate(t):null):new cd(En(r),null,i.scale?i.scale.evaluate(t):null,i.font?i.font.evaluate(t).join(","):null,i.textColor?i.textColor.evaluate(t):null,i.verticalAlign?i.verticalAlign.evaluate(t):null)}))}eachChild(t){for(let i of this.sections)t(i.content),i.scale&&t(i.scale),i.font&&t(i.font),i.textColor&&t(i.textColor),i.verticalAlign&&t(i.verticalAlign)}outputDefined(){return!1}},D4=class e{constructor(t){this.type=ls,this.input=t}static parse(t,i){if(t.length!==2)return i.error("Expected two arguments.");let r=i.parse(t[1],1,ce);return r?new e(r):i.error("No image name provided.")}evaluate(t){let i=this.input.evaluate(t),r=vr.fromString(i);return r&&t.availableImages&&(r.available=t.availableImages.indexOf(i)>-1),r}eachChild(t){t(this.input)}outputDefined(){return!1}},A4=class e{constructor(t,i){this.input=t,this.key=i,this.type=U}static parse(t,i){if(t.length!==2)return i.error(`Expected 1 argument, but found ${t.length-1} instead.`);let r=i.parse(t[1],1);return r?r.type.kind!=="array"&&r.type.kind!=="string"&&r.type.kind!=="value"?i.error(`Expected argument of type string or array, but found ${it(r.type)} instead.`):new e(r,i.key):null}evaluate(t){let i=this.input.evaluate(t);if(typeof i=="string")return[...i].length;if(Array.isArray(i))return i.length;throw new Je(`Expected value to be of type string or array, but found ${it(ut(i))} instead.`,this.key)}eachChild(t){t(this.input)}outputDefined(){return!1}},gr=8192,Zp=class e{constructor(t,i){this.type=ve,this.geojson=t,this.geometries=i}static parse(t,i){if(t.length!==2)return i.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Co(t[1])){let r=t[1];if(r.type==="FeatureCollection"){let a=[];for(let o of r.features){let{type:n,coordinates:s}=o.geometry;n==="Polygon"&&a.push(s),n==="MultiPolygon"&&a.push(...s)}if(a.length)return new e(r,{type:"MultiPolygon",coordinates:a})}else if(r.type==="Feature"){let a=r.geometry.type;if(a==="Polygon"||a==="MultiPolygon")return new e(r,r.geometry)}else if(r.type==="Polygon"||r.type==="MultiPolygon")return new e(r,r)}return i.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return V4(t,this.geometries);if(t.geometryType()==="LineString")return $4(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}},ev=class{constructor(e=[],t=(i,r)=>i<r?-1:+(i>r)){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,r=t[e];for(;e>0;){let a=e-1>>1,o=t[a];if(i(r,o)>=0)break;t[e]=o,e=a}t[e]=r}_down(e){let{data:t,compare:i}=this,r=this.length>>1,a=t[e];for(;e<r;){let o=(e<<1)+1,n=o+1;if(n<this.length&&i(t[n],t[o])<0&&(o=n),i(t[o],a)>=0)break;t[e]=t[o],e=o}t[e]=a}},r0,Hp=class{constructor(e){let t=r0*6378.137*1000,i=Math.cos(e*r0),r=1/(1-0.0066943799901413165*(1-i*i)),a=Math.sqrt(r);this.kx=t*a*i,this.ky=t*a*r*0.9933056200098587}distance(e,t){let i=this.wrap(e[0]-t[0])*this.kx,r=(e[1]-t[1])*this.ky;return Math.sqrt(i*i+r*r)}pointOnLine(e,t){let i=1/0,r,a,o,n;for(let s=0;s<e.length-1;s++){let l=e[s][0],u=e[s][1],c=this.wrap(e[s+1][0]-l)*this.kx,h=(e[s+1][1]-u)*this.ky,d=0;(c!==0||h!==0)&&(d=(this.wrap(t[0]-l)*this.kx*c+(t[1]-u)*this.ky*h)/(c*c+h*h),d>1?(l=e[s+1][0],u=e[s+1][1]):d>0&&(l+=c/this.kx*d,u+=h/this.ky*d)),c=this.wrap(t[0]-l)*this.kx,h=(t[1]-u)*this.ky;let p=c*c+h*h;p<i&&(i=p,r=l,a=u,o=s,n=d)}return{point:[r,a],index:o,t:Math.max(0,Math.min(1,n))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}},Kp=class e{constructor(t,i){this.type=U,this.geojson=t,this.geometries=i}static parse(t,i){if(t.length!==2)return i.error(`'distance' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Co(t[1])){let r=t[1];if(r.type==="FeatureCollection")return new e(r,r.features.map((a)=>gh(a.geometry)).flat());if(r.type==="Feature")return new e(r,gh(r.geometry));if("type"in r&&"coordinates"in r)return new e(r,gh(r))}return i.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return K4(t,this.geometries);if(t.geometryType()==="LineString")return J4(t,this.geometries);if(t.geometryType()==="Polygon")return Q4(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}},e6=class e{constructor(t){let i=null;for(let r of t)if(!i)i=r.type;else if(i===r.type)continue;else{i=de;break}this.type=Vt(i??de,t.length),this.arr=t}static parse(t,i){if(t.length!==2)return i.error(`'semiliteral' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!Co(t[1]))return i.error(`invalid value of type "${typeof t[1]}"`);let r=t[1],a=ut(r);if(a.kind==="array"){let o=r,n=i.concat(1),s=[];for(let l=0;l<o.length;l++){let u=n.parse(o[l],l,de);if(!u)return null;s.push(u)}return new e(s)}return new Do(a,r)}evaluate(t){return this.arr.map((i)=>i.evaluate(t))}eachChild(t){this.arr.forEach(t)}outputDefined(){return this.arr.every((t)=>t.outputDefined())}},Jp=class e{constructor(t){this.key=t,this.type=de}static parse(t,i){if(t.length!==2)return i.error(`Expected 1 argument, but found ${t.length-1} instead.`);let r=t[1];return r==null?i.error("Global state property must be defined."):typeof r=="string"?new e(r):i.error(`Global state property must be string, but found ${typeof t[1]} instead.`)}evaluate(t){let i=t.globals?.globalState;return!i||Object.keys(i).length===0?null:Tn(i,this.key)??null}eachChild(){}outputDefined(){return!1}},fo,La=class e{constructor(t,i,r,a,o){this.name=t,this.type=i,this._evaluate=r,this.args=a,this.key=o}evaluate(t){return this._evaluate(t,this.args,this.key)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,i){let r=t[0],a=e.definitions[r];if(!a)return i.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0);let o=Array.isArray(a)?a[0]:a.type,n=Array.isArray(a)?[[a[1],a[2]]]:a.overloads,s=n.filter(([u])=>!Array.isArray(u)||u.length===t.length-1),l=null;for(let[u,c]of s){l=new qy(i.registry,Yl,i.path,null,i.scope);let h=[],d=!1;for(let p=1;p<t.length;p++){let f=t[p],m=Array.isArray(u)?u[p-1]:u.type,g=l.parse(f,1+h.length,m);if(!g){d=!0;break}h.push(g)}if(!d)if(Array.isArray(u)&&u.length!==h.length)l.error(`Expected ${u.length} arguments, but found ${h.length} instead.`);else{for(let p=0;p<h.length;p++){let f=Array.isArray(u)?u[p]:u.type,m=h[p];l.concat(p+1).checkSubtype(f,m.type)}if(l.errors.length===0)return new e(r,o,c,h,i.key)}}if(s.length===1)i.errors.push(...l.errors);else{let u=(s.length?s:n).map(([h])=>i6(h)).join(" | "),c=[];for(let h=1;h<t.length;h++){let d=i.parse(t[h],1+c.length);if(!d)return null;c.push(it(d.type))}i.error(`Expected arguments of type ${u}, but found (${c.join(", ")}) instead.`)}return null}static register(t,i){e.definitions=i;for(let r in i)t[r]=e}},ef,tf=class{constructor(e,t,i,r){this.expression=e,this._warningHistory={},this._evaluator=new Uy,this._defaultValue=i?cv(i):null,this._enumValues=i&&i.type==="enum"?i.values:null,this._globalState=r,this._rootKey=t}evaluateWithoutErrorHandling(e,t,i,r,a,o){return this._globalState&&(e=Mo(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=i,this._evaluator.canonical=r,this._evaluator.availableImages=a||null,this._evaluator.formattedSection=o,this.expression.evaluate(this._evaluator)}evaluate(e,t,i,r,a,o){this._globalState&&(e=Mo(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=i||null,this._evaluator.canonical=r,this._evaluator.availableImages=a||null,this._evaluator.formattedSection=o||null;try{let n=this.expression.evaluate(this._evaluator);if(n==null||typeof n=="number"&&n!==n)return this._defaultValue;if(this._enumValues&&!(n in this._enumValues))throw new Je(`Expected value to be one of ${Object.keys(this._enumValues).map((s)=>JSON.stringify(s)).join(", ")}, but found ${JSON.stringify(n)} instead.`,"");return n}catch(n){let s=n instanceof Je?n.path:"",l=`${s}|${n.message}`;return this._warningHistory[l]||(this._warningHistory[l]=!0,typeof console<"u"&&console.warn(nv(this._rootKey,s,n.message,this._defaultValue))),this._defaultValue}}},$n=class{constructor(e,t,i){this.kind=e,this._styleExpression=t,this.isStateDependent=e!=="constant"&&!Nn(t.expression),this.globalStateRefs=hs(t.expression),this._globalState=i}evaluateWithoutErrorHandling(e,t,i,r,a,o){return this._globalState&&(e=Mo(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,t,i,r,a,o)}evaluate(e,t,i,r,a,o){return this._globalState&&(e=Mo(e,this._globalState)),this._styleExpression.evaluate(e,t,i,r,a,o)}},Kl=class{constructor(e,t,i,r,a){this.kind=e,this.zoomStops=i,this._styleExpression=t,this.isStateDependent=e!=="camera"&&!Nn(t.expression),this.globalStateRefs=hs(t.expression),this.interpolationType=r,this._globalState=a}evaluateWithoutErrorHandling(e,t,i,r,a,o){return this._globalState&&(e=Mo(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,t,i,r,a,o)}evaluate(e,t,i,r,a,o){return this._globalState&&(e=Mo(e,this._globalState)),this._styleExpression.evaluate(e,t,i,r,a,o)}interpolationFactor(e,t,i){return this.interpolationType?ni.interpolationFactor(this.interpolationType,e,t,i):0}},uv=class e{constructor(t,i,r){this.isStateDependent=!1,this.globalStateRefs=new Set,this._globalState=null,sv(i),this._parameters=t,this._specification=r,this._rootKey=i,this._defaultValue=cv(r),this._warningHistory={};let a=av(this._parameters,this._specification);this.kind=a.kind,this.interpolationFactor=a.interpolationFactor,this.zoomStops=a.zoomStops,this.interpolationType=a.interpolationType,this._innerEvaluate=a.evaluate}evaluate(t,i){try{return this._innerEvaluate(t,i)}catch(r){let a=r instanceof Error?r.message:String(r),o=`|${a}`;return this._warningHistory[o]||(this._warningHistory[o]=!0,typeof console<"u"&&console.warn(nv(this._rootKey,"",a,this._defaultValue))),this._defaultValue}}static deserialize(t){return new e(t._parameters,t._rootKey,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification,_rootKey:t._rootKey}}},g6,d0,p0=1114111,z6,f0,B6,O6=class{constructor(e,t,i){this._rootKey=t,this._globalState=i,this.setValue(e)}evaluate(){return this._literalValue??this._compiledValue.evaluate({})}setValue(e){if(e==null||e==="visible"||e==="none"){this._literalValue=e==="none"?"none":"visible",this._compiledValue=void 0,this._globalStateRefs=new Set;return}let t=Uu(e,this._rootKey,B6,this._globalState);if(t.result==="error")throw this._literalValue="visible",this._compiledValue=void 0,Error(t.value.map((i)=>`${i.key}: ${i.message}`).join(", "));this._literalValue=void 0,this._compiledValue=t.value,this._globalStateRefs=hs(t.value.expression)}getGlobalStateRefs(){return this._globalStateRefs}},kr,V6=class{constructor(e){this._methodToThrottle=e,this._triggered=!1,this._channel=new MessageChannel,this._channel.port2.onmessage=()=>this._invoke()}trigger(){this._triggered||(this._triggered=!0,this._channel?.port1.postMessage(!0),setTimeout(()=>this._invoke(),0))}_invoke(){this._triggered&&(this._triggered=!1,this._methodToThrottle())}remove(){delete this._channel,this._methodToThrottle=()=>{}}},$6,U6=class{constructor(e,t){this.target=e,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new V6(()=>this.process()),this.subscription=ql(this.target,"message",(i)=>this.receive(i),!1),this.globalScope=Eo(self)?e:window}registerMessageHandler(e,t){this.messageHandlers[e]=t}unregisterMessageHandler(e){delete this.messageHandlers[e]}sendAsync(e,t){return new Promise((i,r)=>{let a=Math.round(Math.random()*1000000000000000000).toString(36).substring(0,10),o=t?ql(t.signal,"abort",()=>{o?.unsubscribe(),delete this.resolveRejects[a];let l={id:a,type:"<cancel>",origin:location.origin,targetMapId:e.targetMapId,sourceMapId:this.mapId};this.target.postMessage(l),r(new os(t.signal.reason))},$6):null;this.resolveRejects[a]={resolve:(l)=>{o?.unsubscribe(),i(l)},reject:(l)=>{o?.unsubscribe(),r(l)}};let n=[],s={...e,id:a,sourceMapId:this.mapId,origin:location.origin,data:Cn(e.data,n)};this.target.postMessage(s,{transfer:n})})}receive(e){let t=e.data,i=t.id,r=["file://","resource://android","null"],a=[t.origin,location.origin],o=t.origin===location.origin,n=a.some((s)=>r.includes(s));if((o||n)&&!(t.targetMapId&&this.mapId!==t.targetMapId))if(t.type==="<cancel>"){delete this.tasks[i];let s=this.abortControllers[i];delete this.abortControllers[i],s&&s.abort()}else Eo(self)||t.mustQueue?(this.tasks[i]=t,this.taskQueue.push(i),this.invoker.trigger()):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 a=this.resolveRejects[e];if(delete this.resolveRejects[e],!a)return;t.error?a.reject(Mt(Dn(t.error))):a.resolve(Dn(t.data));return}if(!this.messageHandlers[t.type]){this.completeTask(e,null,null);return}let i=Dn(t.data),r=new AbortController;this.abortControllers[e]=r;try{let a=await this.messageHandlers[t.type](t.sourceMapId,i,r);this.completeTask(e,null,a)}catch(a){this.completeTask(e,Mt(a))}}completeTask(e,t,i){let r=[];delete this.abortControllers[e];let a={id:e,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:t?Cn(t):null,data:Cn(i,r)};this.target.postMessage(a,{transfer:r})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},J6="maplibre_preloaded_worker_pool",Rv,Q6,m0,eT,tl,_r,tT=class{constructor(e){this._transformRequestFn=e??null}transformRequest(e,t){return this._transformRequestFn&&this._transformRequestFn(e,t)||{url:e}}setTransformRequest(e){this._transformRequestFn=e}getTransformRequest(){return this._transformRequestFn}},Ct,oe,g0,qi,He,iT,rT,aT,_0,oT,nT,il,sT,ai,Lv,_d=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))}},Me=class{constructor(e,t){this.zoom=e,t?(this.now=t.now||0,this.fadeDuration=t.fadeDuration||0,this.zoomHistory=t.zoomHistory||new _d,this.transition=t.transition||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new _d,this.transition={})}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:0.5,toScale:1,t:1-(1-i)*t}}},Gn=class{constructor(e,t,i,r){this.property=e,this.value=t,this.expression=h6(t===void 0?e.specification.default:t,i,e.specification,r)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}readsGlobalState(e){let t=this.getGlobalStateRefs();return e.some((i)=>t.has(i))}possiblyEvaluate(e,t,i){return this.property.possiblyEvaluate(this,e,t,i)}},yd=class{constructor(e,t,i){this.property=e,this.value=new Gn(e,void 0,t,i)}transitioned(e,t){return t.value===this.value?t:new v0(this.property,this.value,t,ee({},e.transition,this.transition),e.now)}untransitioned(){return new v0(this.property,this.value,null,{},0)}},Gu=class{constructor(e,t,i){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._globalState=i,this._rootKey=t}_propertyRootKey(e){return`${this._rootKey}.${String(e)}`}hasProperty(e){return e in this._properties.defaultTransitionablePropertyValues}getValue(e){return bi(this._values[e].value.value)}setValue(e,t){Object.hasOwn(this._values,e)||(this._values[e]=new yd(this._values[e].property,this._propertyRootKey(e),this._globalState)),this._values[e].value=new Gn(this._values[e].property,t===null?void 0:bi(t),this._propertyRootKey(e),this._globalState)}setValues(e){for(let t in e){let i=e[t];t.endsWith("-transition")?this.setTransition(t.slice(0,-11),i):lr(this._values[t].value.value,i)||this.setValue(t,i)}}getTransition(e){return bi(this._values[e].transition)}setTransition(e,t){Object.hasOwn(this._values,e)||(this._values[e]=new yd(this._values[e].property,this._propertyRootKey(e),this._globalState)),this._values[e].transition=bi(t)||void 0}retainPriorGlobalState(e,t,i){for(let r of Object.keys(i._values))for(let a=i._values[r];a;a=a.prior){let{value:o}=a;o.property.specification.transition&&!o.isDataDriven()&&o.expression._globalState===this._globalState&&o.readsGlobalState(e)&&(a.value=new Gn(o.property,o.value,this._propertyRootKey(r),t))}}applyGlobalStateChange(e,t,i,r){this.retainPriorGlobalState(e,t,i);let a=!1;for(let o of Object.keys(this._values)){let{value:n}=this._values[o];n.readsGlobalState(e)&&(this.setValue(o,n.value),a=!0)}return a?this.transitioned(r,i):i}serialize(){let e={};for(let t of Object.keys(this._values)){let i=this.getValue(t);i!==void 0&&(e[t]=i);let r=this.getTransition(t);r!==void 0&&(e[`${t}-transition`]=r)}return e}transitioned(e,t){let i=new x0(this._properties);for(let r of Object.keys(this._values))i._values[r]=this._values[r].transitioned(e,t._values[r]);return i}untransitioned(){let e=new x0(this._properties);for(let t of Object.keys(this._values))e._values[t]=this._values[t].untransitioned();return e}},v0=class{constructor(e,t,i,r,a){this.property=e,this.value=t,this.begin=a+r.delay||0,this.end=this.begin+r.duration||0,e.specification.transition&&(r.delay||r.duration)&&(this.prior=i)}possiblyEvaluate(e,t,i){let r=e.now||0,a=this.value.possiblyEvaluate(e,t,i),o=this.prior;if(!o)return a;if(r>this.end||this.value.isDataDriven())return this.prior=null,a;if(r<this.begin)return o.possiblyEvaluate(e,t,i);{let n=(r-this.begin)/(this.end-this.begin);return this.property.interpolate(o.possiblyEvaluate(e,t,i),a,X5(n))}}},x0=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,t,i){let r=new Wu(this._properties);for(let a of Object.keys(this._values))r._values[a]=this._values[a].possiblyEvaluate(e,t,i);return r}hasTransition(){for(let e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}},uT=class{constructor(e,t,i){this._properties=e,this._values=Object.create(e.defaultPropertyValues),this._globalState=i,this._rootKey=t}_propertyRootKey(e){return`${this._rootKey}.${String(e)}`}hasValue(e){return this._values[e].value!==void 0}hasProperty(e){return e in this._properties.defaultPropertyValues}getValue(e){return bi(this._values[e].value)}setValue(e,t){this._values[e]=new Gn(this._values[e].property,t===null?void 0:bi(t),this._propertyRootKey(e),this._globalState)}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 r=new Wu(this._properties);for(let a of Object.keys(this._values))r._values[a]=this._values[a].possiblyEvaluate(e,t,i);return r}},zi=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,r){return this.property.evaluate(this.value,this.parameters,e,t,i,r)}},Wu=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}},q=class{constructor(e,t){this.specification=e,this.name=t}possiblyEvaluate(e,t){if(e.isDataDriven())throw Error("Value should not be data driven");return e.expression.evaluate(t)}interpolate(e,t,i){if(Bv(e,t))return he(`Property "${this.name}" is trying to interpolate arrays of different lengths. Rendering may 'jump'.`),t;let r=this.specification.type,a=Ze[r];return a?a(e,t,i):e}},ae=class{constructor(e,t,i){this.specification=e,this.name=t,this.overrides=i}possiblyEvaluate(e,t,i,r){return e.expression.kind==="constant"||e.expression.kind==="camera"?new zi(this,{kind:"constant",value:e.expression.evaluate(t,null,{},i,r)},t):new zi(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 zi(this,{kind:"constant",value:void 0},e.parameters);if(Bv(e.value.value,t.value.value))return he(`Property "${this.name}" is trying to interpolate arrays of different lengths. Rendering may 'jump'.`),t;let r=this.specification.type,a=Ze[r];if(a){let o=a(e.value.value,t.value.value,i);return new zi(this,{kind:"constant",value:o},e.parameters)}return e}evaluate(e,t,i,r,a,o){return e.kind==="constant"?e.value:e.evaluate(t,i,r,a,o)}},Wn,Ov=class{constructor(e,t){this.specification=e,this.name=t}possiblyEvaluate(e,t,i,r){if(e.value!==void 0){if(e.expression.kind==="constant"){let a=e.expression.evaluate(t,null,{},i,r);return this._calculate(a,a,a,t)}return this._calculate(e.expression.evaluate(new Me(Math.floor(t.zoom-1),t)),e.expression.evaluate(new Me(Math.floor(t.zoom),t)),e.expression.evaluate(new Me(Math.floor(t.zoom+1),t)),t)}}_calculate(e,t,i,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:i,to:t}}interpolate(e){return e}},Zu=class{constructor(e,t){this.specification=e,this.name=t}possiblyEvaluate(e,t,i,r){return!!e.expression.evaluate(t,null,{},i,r)}interpolate(){return!1}},Pt=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 r=this.defaultPropertyValues[t]=new Gn(i,void 0,i.name,void 0),a=this.defaultTransitionablePropertyValues[t]=new yd(i,i.name,void 0);this.defaultTransitioningPropertyValues[t]=a.untransitioned(),this.defaultPossiblyEvaluatedValues[t]=r.possiblyEvaluate({})}}},w0=" is a PAINT property not a LAYOUT property. Use get/setPaintProperty instead?",xh=" is a LAYOUT property not a PAINT property. Use get/setLayoutProperty instead?",tr,cT,hT=()=>cT||=new Pt({"raster-opacity":new q(F.paint_raster["raster-opacity"],"raster-opacity"),"raster-layer-blend":new q(F.paint_raster["raster-layer-blend"],"raster-layer-blend"),"raster-hue-rotate":new q(F.paint_raster["raster-hue-rotate"],"raster-hue-rotate"),"raster-brightness-min":new q(F.paint_raster["raster-brightness-min"],"raster-brightness-min"),"raster-brightness-max":new q(F.paint_raster["raster-brightness-max"],"raster-brightness-max"),"raster-saturation":new q(F.paint_raster["raster-saturation"],"raster-saturation"),"raster-contrast":new q(F.paint_raster["raster-contrast"],"raster-contrast"),resampling:new q(F.paint_raster.resampling,"resampling"),"raster-resampling":new q(F.paint_raster["raster-resampling"],"raster-resampling"),"raster-fade-duration":new q(F.paint_raster["raster-fade-duration"],"raster-fade-duration")}),dT,Zn=(e)=>e.type==="raster",pT,fT,ps=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}},at=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*5),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let t=this.uint8;this._refreshViews(),t&&this.uint8.set(t)}}_refreshViews(){throw Error("_refreshViews() must be implemented by each concrete StructArray layout")}freeBufferAfterUpload(){this.arrayBuffer=new ArrayBuffer(0),this._refreshViews()}},Hn,eu,vd,xd,bd,Xn,wd,Td,Ed,Sd,Cd,Dd,Ad,Md,Pd,tu,Id,kd,iu,Fd,Rd,zd,Ld,Bd,jv,Nv,Vv,$v,Uv,qv,Gv,Wv,Zv,Hv,Xv,Yv,ba,gT,_T,yT,vT,xT,bT,wT,to,E0,TT,ET,ST,S0,CT,DT,AT,xr,Od,MT,jd,PT,tt=class e{constructor(t=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=t}prepareSegment(t,i,r,a){let o=this.segments[this.segments.length-1];return t>e.MAX_VERTEX_ARRAY_LENGTH&&he(`Max vertices per segment is ${e.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${e.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!o||o.vertexLength+t>e.MAX_VERTEX_ARRAY_LENGTH||o.sortKey!==a?this.createNewSegment(i,r,a):o}createNewSegment(t,i,r){let a={vertexOffset:t.length,primitiveOffset:i.length,vertexLength:0,primitiveLength:0,vaos:{}};return r!==void 0&&(a.sortKey=r),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(a),a}getOrCreateLatestSegment(t,i,r){return this.prepareSegment(0,t,i,r)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(let t of this.segments)for(let i in t.vaos)t.vaos[i].destroy()}static simpleSegment(t,i,r,a){return new e([{vertexOffset:t,primitiveOffset:i,vertexLength:r,primitiveLength:a,vaos:{},sortKey:0}])}},IT,kT,FT,RT,ru,Kv=class e{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,i,r,a){this.ids.push(D0(t)),this.positions.push(i,r,a)}getPositions(t){if(!this.indexed)throw Error("Trying to get index, but feature positions are not indexed");let i=D0(t),r=0,a=this.ids.length-1;for(;r<a;){let n=r+a>>1;this.ids[n]>=i?a=n:r=n+1}let o=[];for(;this.ids[r]===i;){let n=this.positions[3*r],s=this.positions[3*r+1],l=this.positions[3*r+2];o.push({index:n,start:s,end:l}),r++}return o}static serialize(t,i){let r=new Float64Array(t.ids),a=new Uint32Array(t.positions);return Nd(r,a,0,r.length-1),i&&i.push(r.buffer,a.buffer),{ids:r,positions:a}}static deserialize(t){let i=new e;return i.ids=t.ids,i.positions=t.positions,i.indexed=!0,i}},Vr=class{constructor(e,t){this.gl=e.gl,this.location=t}},te,G,pe,Kt,Io,na,A0,M0,zT,Ji,yn=class{constructor(e,t,i){this.value=e,this.uniformNames=t.map((r)=>`u_${r}`),this.type=i}setUniform(e,t,i){e.set(i.constantOr(this.value))}getBinding(e,t,i){return this.type==="color"?new na(e,t):new G(e,t)}},va=class{constructor(e,t){this.uniformNames=t.map((i)=>`u_${i}`),this.patternFrom=null,this.patternTo=null,this.dashFrom=null,this.dashTo=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}setConstantDashPositions(e,t){this.dashTo=[0,e.y,e.height,e.width],this.dashFrom=[0,t.y,t.height,t.width]}setUniform(e,t,i,r){let a=null;r==="u_pattern_to"?a=this.patternTo:r==="u_pattern_from"?a=this.patternFrom:r==="u_dasharray_to"?a=this.dashTo:r==="u_dasharray_from"?a=this.dashFrom:r==="u_pixel_ratio_to"?a=this.pixelRatioTo:r==="u_pixel_ratio_from"&&(a=this.pixelRatioFrom),a!==null&&e.set(a)}getBinding(e,t,i){return i.startsWith("u_pattern")||i.startsWith("u_dasharray_")?new Io(e,t):new G(e,t)}},Mr=class{constructor(e,t,i,r){this.expression=e,this.type=i,this.maxValue=0,this.paintVertexAttributes=t.map((a)=>({name:`a_${a}`,type:"Float32",components:i==="color"?2:1,offset:0})),this.paintVertexArray=new r}populatePaintArray(e,t,i){let r=this.paintVertexArray.length,a=this.expression.evaluate(new Me(0,i),t,{},i.canonical,[],i.formattedSection);this.paintVertexArray.resize(e),this._setPaintValue(r,e,a)}updatePaintArray(e,t,i,r,a){let o=this.expression.evaluate(new Me(0,a),i,r);this._setPaintValue(e,t,o)}_setPaintValue(e,t,i){if(this.type==="color"){let r=Vd(i);for(let a=e;a<t;a++)this.paintVertexArray.emplace(a,r[0],r[1])}else{for(let r=e;r<t;r++)this.paintVertexArray.emplace(r,i);this.maxValue=Math.max(this.maxValue,Math.abs(i))}}upload(e){this.paintVertexArray?.arrayBuffer.byteLength&&(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()}},Ui=class{constructor(e,t,i,r,a,o){this.expression=e,this.uniformNames=t.map((n)=>`u_${n}_t`),this.type=i,this.useIntegerZoom=r,this.zoom=a,this.maxValue=0,this.paintVertexAttributes=t.map((n)=>({name:`a_${n}`,type:"Float32",components:i==="color"?4:2,offset:0})),this.paintVertexArray=new o}populatePaintArray(e,t,i){let r=this.expression.evaluate(new Me(this.zoom,i),t,{},i.canonical,[],i.formattedSection),a=this.expression.evaluate(new Me(this.zoom+1,i),t,{},i.canonical,[],i.formattedSection),o=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(o,e,r,a)}updatePaintArray(e,t,i,r,a){let o=this.expression.evaluate(new Me(this.zoom,a),i,r),n=this.expression.evaluate(new Me(this.zoom+1,a),i,r);this._setPaintValue(e,t,o,n)}_setPaintValue(e,t,i,r){if(this.type==="color"){let a=Vd(i),o=Vd(r);for(let n=e;n<t;n++)this.paintVertexArray.emplace(n,a[0],a[1],o[0],o[1])}else{for(let a=e;a<t;a++)this.paintVertexArray.emplace(a,i,r);this.maxValue=Math.max(this.maxValue,Math.abs(i),Math.abs(r))}}upload(e){this.paintVertexArray?.arrayBuffer.byteLength&&(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,r=H(this.expression.interpolationFactor(i,this.zoom,this.zoom+1),0,1);e.set(r)}getBinding(e,t,i){return new G(e,t)}},Xr=class{constructor(e,t,i,r,a,o){this.expression=e,this.type=t,this.useIntegerZoom=i,this.zoom=r,this.layerId=o,this.zoomInPaintVertexArray=new a,this.zoomOutPaintVertexArray=new a}populatePaintArray(e,t,i){let r=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(r,e,this.getPositionIds(t),i)}updatePaintArray(e,t,i,r,a){this._setPaintValues(e,t,this.getPositionIds(i),a)}_setPaintValues(e,t,i,r){let a=this.getPositions(r);if(!a||!i)return;let o=a[i.min],n=a[i.mid],s=a[i.max];if(o&&n&&s)for(let l=e;l<t;l++)this.emplace(this.zoomInPaintVertexArray,l,o,n),this.emplace(this.zoomOutPaintVertexArray,l,s,n)}upload(e){if(this.zoomInPaintVertexArray?.arrayBuffer.byteLength&&this.zoomOutPaintVertexArray?.arrayBuffer.byteLength){let t=this.getVertexAttributes();this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,t,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,t,this.expression.isStateDependent)}}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}},Jv,Qv,e2=class{constructor(e,t,i){this.binders={},this._buffers=[];let r=[];for(let a in e.paint._values){if(!i(a))continue;let o=e.paint.get(a);if(!(o instanceof zi)||!Ao(o.property.specification))continue;let n=LT(a,e.type),s=o.value,l=o.property.specification.type,u=o.property.useIntegerZoom,c=o.property.specification["property-type"],h=c==="cross-faded"||c==="cross-faded-data-driven";if(s.kind==="constant")this.binders[a]=h?new va(s.value,n):new yn(s.value,n,l),r.push(`/u_${a}`);else if(s.kind==="source"||h){let d=P0(a,l,"source");this.binders[a]=h?a==="line-dasharray"?new Qv(s,l,u,t,d,e.id):new Jv(s,l,u,t,d,e.id):new Mr(s,n,l,d),r.push(`/a_${a}`)}else{let d=P0(a,l,"composite");this.binders[a]=new Ui(s,n,l,u,t,d),r.push(`/z_${a}`)}}this.cacheKey=r.sort().join("")}getMaxValue(e){let t=this.binders[e];return t instanceof Mr||t instanceof Ui?t.maxValue:0}populatePaintArrays(e,t,i){for(let r in this.binders){let a=this.binders[r];(a instanceof Mr||a instanceof Ui||a instanceof Xr)&&a.populatePaintArray(e,t,i)}}setConstantPatternPositions(e,t){for(let i in this.binders){let r=this.binders[i];r instanceof va&&r.setConstantPatternPositions(e,t)}}setConstantDashPositions(e,t){for(let i in this.binders){let r=this.binders[i];r instanceof va&&r.setConstantDashPositions(e,t)}}updatePaintArrays(e,t,i,r,a){let o=!1;for(let n of e){let s=t.getPositions(n.id);for(let l of s){let u=i.feature(l.index);for(let c in this.binders){let h=this.binders[c];(h instanceof Mr||h instanceof Ui||h instanceof Xr)&&h.expression.isStateDependent===!0&&(h.expression=r.paint.get(c).value,h.updatePaintArray(l.start,l.end,u,n.state,a),o=!0)}}}return o}defines(){let e=[];for(let t in this.binders){let i=this.binders[t];(i instanceof yn||i instanceof va)&&e.push(...i.uniformNames.map((r)=>`#define HAS_UNIFORM_${r}`))}return e}getBinderAttributes(){let e=[];for(let t in this.binders){let i=this.binders[t];if(i instanceof Mr||i instanceof Ui)for(let r of i.paintVertexAttributes)e.push(r.name);else if(i instanceof Xr){let r=i.getVertexAttributes();for(let a of r)e.push(a.name)}}return e}getBinderUniforms(){let e=[];for(let t in this.binders){let i=this.binders[t];if(i instanceof yn||i instanceof va||i instanceof Ui)for(let r of i.uniformNames)e.push(r)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,t){let i=[];for(let r in this.binders){let a=this.binders[r];if(a instanceof yn||a instanceof va||a instanceof Ui){for(let o of a.uniformNames)if(t[o]){let n=a.getBinding(e,t[o],o);i.push({name:o,property:r,binding:n})}}}return i}setUniforms(e,t,i,r){for(let{name:a,property:o,binding:n}of t)this.binders[o].setUniform(n,r,i.get(o),a)}updatePaintBuffers(e){this._buffers=[];for(let t in this.binders){let i=this.binders[t];if(e&&i instanceof Xr){let r=e.fromScale===2?i.zoomInPaintVertexBuffer:i.zoomOutPaintVertexBuffer;r&&this._buffers.push(r)}else(i instanceof Mr||i instanceof Ui)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer)}}upload(e){for(let t in this.binders){let i=this.binders[t];(i instanceof Mr||i instanceof Ui||i instanceof Xr)&&i.upload(e)}this.updatePaintBuffers()}destroy(){for(let e in this.binders){let t=this.binders[e];(t instanceof Mr||t instanceof Ui||t instanceof Xr)&&t.destroy()}}},Ia=class{constructor(e,t,i=()=>!0){this.programConfigurations={};for(let r of e)this.programConfigurations[r.id]=new e2(r,t,i);this.needsUpload=!1,this._featureMap=new Kv,this._bufferOffset=0}populatePaintArrays(e,t,i,r){for(let a in this.programConfigurations)this.programConfigurations[a].populatePaintArrays(e,t,r);t.id!==void 0&&this._featureMap.add(t.id,i,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,t,i,r){for(let a of i)this.needsUpload=this.programConfigurations[a.id].updatePaintArrays(e,this._featureMap,t,a,r)||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()}},$d=16383,I0,Yi=class e{constructor(){this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0}extend(t){return this.minX=Math.min(this.minX,t.x),this.minY=Math.min(this.minY,t.y),this.maxX=Math.max(this.maxX,t.x),this.maxY=Math.max(this.maxY,t.y),this}expandBy(t){return this.minX-=t,this.minY-=t,this.maxX+=t,this.maxY+=t,(this.minX>this.maxX||this.minY>this.maxY)&&(this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0),this}shrinkBy(t){return this.expandBy(-t)}map(t){let i=new e;return i.extend(t(new D(this.minX,this.minY))),i.extend(t(new D(this.maxX,this.minY))),i.extend(t(new D(this.minX,this.maxY))),i.extend(t(new D(this.maxX,this.maxY))),i}static fromPoints(t){let i=new e;for(let r of t)i.extend(r);return i}contains(t){return t.x>=this.minX&&t.x<=this.maxX&&t.y>=this.minY&&t.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(t){return!this.empty()&&!t.empty()&&t.minX>=this.minX&&t.maxX<=this.maxX&&t.minY>=this.minY&&t.maxY<=this.maxY}intersects(t){return!this.empty()&&!t.empty()&&t.minX<=this.maxX&&t.maxX>=this.minX&&t.minY<=this.maxY&&t.maxY>=this.minY}},OT,F0=-32768,cf=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.hasDependencies=!1,this.layoutVertexArray=new yT,this.indexArray=new xr,this.segments=new tt,this.programConfigurations=new Ia(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter((t)=>t.isStateDependent()).map((t)=>t.id)}populate(e,t,i){let r=this.layers[0],a=[],o=null,n=!1,s=r.type==="heatmap";if(r.type==="circle"){let h=r;o=h.layout.get("circle-sort-key"),n=!o.isConstant(),s||=h.paint.get("circle-pitch-alignment")==="map"}let l=s?t.subdivisionGranularity.circle:1,u=new Me(this.zoom),c=this.layers[0]._featureFilter.needGeometry;for(let{feature:h,id:d,index:p,sourceLayerIndex:f}of e){let m=Oa(h,c);if(!this.layers[0]._featureFilter.filter(u,m,i))continue;let g=n?o.evaluate(m,{},i):void 0,_={id:d,properties:h.properties,type:h.type,sourceLayerIndex:f,index:p,geometry:c?m.geometry:Ba(h),patterns:{},sortKey:g};a.push(_)}n&&a.sort((h,d)=>h.sortKey-d.sortKey);for(let h of a){let{geometry:d,index:p,sourceLayerIndex:f}=h,m=e[p].feature;this.addFeature(h,d,p,i,l),t.featureIndex.insert(m,d,p,f,this.index)}}update(e,t,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,{imagePositions:i})}addFeatures(e){}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,PT),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,r,a=1){let o;switch(a){case 1:o=[0,7];break;case 3:o=[0,2,5,7];break;case 5:o=[0,1,3,4,6,7];break;case 7:o=[0,1,2,3,4,5,6,7];break;default:throw Error(`Invalid circle bucket granularity: ${a}; valid values are 1, 3, 5, 7.`)}let n=o.length;for(let s of t)for(let l of s){let{x:u,y:c}=l;if(uf(l))continue;let h=this.segments.prepareSegment(n*n,this.layoutVertexArray,this.indexArray,e.sortKey),d=h.vertexLength;for(let p=0;p<n;p++)for(let f=0;f<n;f++)jT(this.layoutVertexArray,u,c,o[f],o[p]);for(let p=0;p<n-1;p++)for(let f=0;f<n-1;f++){let m=d+p*n+f,g=d+(p+1)*n+f;this.indexArray.emplaceBack(m,g+1,m+1),this.indexArray.emplaceBack(m,g,g+1)}h.vertexLength+=n*n,h.primitiveLength+=(n-1)*(n-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,{imagePositions:{},canonical:r})}},Yt=6371008.8,Y=class e{constructor(t,i){if(isNaN(t)||isNaN(i))throw Error(`Invalid LngLat object: (${t}, ${i})`);if(this.lng=+t,this.lat=+i,this.lat>90||this.lat<-90)throw Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new e(Fi(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){let i=Math.PI/180,r=this.lat*i,a=t.lat*i,o=Math.sin(r)*Math.sin(a)+Math.cos(r)*Math.cos(a)*Math.cos((t.lng-this.lng)*i);return Yt*Math.acos(Math.min(o,1))}static convert(t){if(t instanceof e)return t;if(Array.isArray(t)&&(t.length===2||t.length===3))return new e(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&typeof t=="object"&&t)return new e(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw 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>]")}},bh=6378137,qd,df,Ot=class e{constructor(t,i,r=0){this.x=+t,this.y=+i,this.z=+r}static fromLngLat(t,i=0){let r=Y.convert(t);return new e(ou(r.lng),nu(r.lat),Gd(i,r.lat))}toLngLat(){return new Y(o2(this.x),Yn(this.y))}toAltitude(){return GT(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/df*n2(Yn(this.y))}},ja,Xu=class{constructor(e,t,i){if(!WT(e,t,i))throw Error(`x=${t}, y=${i}, z=${e} outside of bounds. 0<=x<${2**e}, 0<=y<${2**e} 0<=z<=25 `);this.z=e,this.x=t,this.y=i,this.key=mo(0,e,e,t,i)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,t,i,r=qd){let a=ZT(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"?2**this.z-this.y-1:this.y)).replace(/{ratio}/g,t>1?"@2x":"").replace(/{quadkey}/g,a).replace(/{bbox-epsg-3857}/g,()=>z0(this.x,this.y,this.z,qd)).replace(/{bbox}/g,()=>z0(this.x,this.y,this.z,r))}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=2**this.z;return new D((e.x*t-this.x)*z,(e.y*t-this.y)*z)}toString(){return`${this.z}/${this.x}/${this.y}`}},su=class{constructor(e,t){this.wrap=e,this.canonical=t,this.key=mo(e,t.z,t.z,t.x,t.y)}},Et=class e{constructor(t,i,r,a,o){if(this.terrainRttPosMatrix32f=null,t<r)throw Error(`overscaledZ should be >= z; overscaledZ = ${t}; z = ${r}`);this.overscaledZ=t,this.wrap=i,this.canonical=new Xu(r,+a,+o),this.key=mo(i,t,r,a,o)}clone(){return new e(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){if(t>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);let i=this.canonical.z-t;return t>this.canonical.z?new e(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new e(t,this.wrap,t,this.canonical.x>>i,this.canonical.y>>i)}isOverscaled(){return this.overscaledZ>this.canonical.z}calculateScaledKey(t,i){if(t>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);let r=this.canonical.z-t;return t>this.canonical.z?mo(this.wrap*+i,t,this.canonical.z,this.canonical.x,this.canonical.y):mo(this.wrap*+i,t,t,this.canonical.x>>r,this.canonical.y>>r)}isChildOf(t){if(t.wrap!==this.wrap||this.overscaledZ-t.overscaledZ<=0)return!1;if(t.overscaledZ===0)return this.overscaledZ>0;let i=this.canonical.z-t.canonical.z;return i<0?!1:t.canonical.x===this.canonical.x>>i&&t.canonical.y===this.canonical.y>>i}children(t){if(this.overscaledZ>=t)return[new e(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let i=this.canonical.z+1,r=this.canonical.x*2,a=this.canonical.y*2;return[new e(i,this.wrap,i,r,a),new e(i,this.wrap,i,r+1,a),new e(i,this.wrap,i,r,a+1),new e(i,this.wrap,i,r+1,a+1)]}isLessThan(t){return this.wrap<t.wrap?!0:this.wrap>t.wrap?!1:this.overscaledZ<t.overscaledZ?!0:this.overscaledZ>t.overscaledZ?!1:this.canonical.x<t.canonical.x?!0:this.canonical.x>t.canonical.x?!1:this.canonical.y<t.canonical.y}wrapped(){return new e(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new e(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return 2**(this.overscaledZ-this.canonical.z)}toUnwrapped(){return new su(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new Ot(t.x-this.wrap,t.y))}normalizeCoordinates(t,i,r=z){if(t>=0&&t<r&&i>=0&&i<r)return{tileID:this,x:t,y:i};let a=Math.floor(t/r),o=Math.floor(i/r),n=t-a*r,s=i-o*r,l=this.canonical.z,u=1<<l,c=this.canonical.y+o;if(c<0||c>=u)return null;let h=this.canonical.x+a,d=this.wrap;return h<0?(d-=Math.ceil(-h/u),h=(h%u+u)%u):h>=u&&(d+=Math.floor(h/u),h%=u),{tileID:new e(this.overscaledZ,d,l,h,c),x:n,y:s}}},Nr=class e{constructor(t,i){t&&(i?this.setSouthWest(t).setNorthEast(i):Array.isArray(t)&&(t.length===4?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1])))}setNorthEast(t){return this._ne=t instanceof Y?new Y(t.lng,t.lat):Y.convert(t),this}setSouthWest(t){return this._sw=t instanceof Y?new Y(t.lng,t.lat):Y.convert(t),this}extend(t){let i=this._sw,r=this._ne,a,o;if(t instanceof Y)a=t,o=t;else if(t instanceof e){if(a=t._sw,o=t._ne,!a||!o)return this}else{if(Array.isArray(t)){if(t.length===4||t.every(Array.isArray)){let n=t;return this.extend(e.convert(n))}{let n=t;return this.extend(Y.convert(n))}}return t&&(("lng"in t)||("lon"in t))&&"lat"in t?this.extend(Y.convert(t)):this}return!i&&!r?(this._sw=new Y(a.lng,a.lat),this._ne=new Y(o.lng,o.lat)):(i.lng=Math.min(a.lng,i.lng),i.lat=Math.min(a.lat,i.lat),r.lng=Math.max(o.lng,r.lng),r.lat=Math.max(o.lat,r.lat)),this}getCenter(){return new Y((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 Y(this.getWest(),this.getNorth())}getSouthEast(){return new Y(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(t){let{lng:i,lat:r}=Y.convert(t),a=this._sw.lat<=r&&r<=this._ne.lat,o=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(o=this._sw.lng>=i&&i>=this._ne.lng),a&&o}intersects(t){if(t=e.convert(t),!(t.getNorth()>=this.getSouth()&&t.getSouth()<=this.getNorth()))return!1;let i=Math.abs(this.getEast()-this.getWest()),r=Math.abs(t.getEast()-t.getWest());if(i>=360||r>=360)return!0;let a=Fi(this.getWest(),-180,180),o=Fi(this.getEast(),-180,180),n=Fi(t.getWest(),-180,180),s=Fi(t.getEast(),-180,180),l=a>o,u=n>s;return l&&u?!0:l?s>=a||n<=o:u?o>=n||a<=s:n<=o&&s>=a}static convert(t){return t instanceof e||!t?t:new e(t)}static fromLngLat(t,i=0){let r=360*i/40075017,a=r/Math.cos(Math.PI/180*t.lat);return new e(new Y(t.lng-a,t.lat-r),new Y(t.lng+a,t.lat+r))}adjustAntiMeridian(){let t=new Y(this._sw.lng,this._sw.lat),i=new Y(this._ne.lng,this._ne.lat);return t.lng>i.lng?new e(t,new Y(i.lng+360,i.lat)):new e(t,i)}},go=89.25,Th=0.0001,mf=class e{constructor(t=0,i=0,r=0,a=0){if(isNaN(t)||t<0||isNaN(i)||i<0||isNaN(r)||r<0||isNaN(a)||a<0)throw Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=i,this.left=r,this.right=a}interpolate(t,i,r){return i.top!=null&&t.top!=null&&(this.top=Ze.number(t.top,i.top,r)),i.bottom!=null&&t.bottom!=null&&(this.bottom=Ze.number(t.bottom,i.bottom,r)),i.left!=null&&t.left!=null&&(this.left=Ze.number(t.left,i.left,r)),i.right!=null&&t.right!=null&&(this.right=Ze.number(t.right,i.right,r)),this}getCenter(t,i){return new D(H((this.left+t-this.right)/2,0,t),H((this.top+i-this.bottom)/2,0,i))}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new e(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}},al,B0,O0=-0.5,j0,hE=class{constructor(e,t,i=()=>ja){this.tileManager=e,this.exaggeration=t,this.getWorldCoordinateHelper=i,this._samplerCache=new Map}reset(){this._samplerCache.clear(),this._index=void 0,this._ownDemIndex=void 0}getIndex(e=!1){return e?(this._ownDemIndex===void 0&&(this._ownDemIndex=this._build(!0)),this._ownDemIndex):(this._index===void 0&&(this._index=this._build(!1)),this._index)}sample(e,t=!1){let i=this.getIndex(t);if(!i)return;let r=this.getWorldCoordinateHelper(),{x:a,y:o}=r.worldFromLngLat(e.lng,e.lat),n=Ro(i,this.exaggeration,a,o,r.wraps);return n.demLoaded?n.elevation:void 0}getSampler(e){let t=e.key,i=this._samplerCache.get(t);if(i)return i;let r=this._createElevationSampler(e);return r&&this._samplerCache.set(t,r),r}_createElevationSampler(e){let t=this.tileManager.getSourceTile(e,!0),i=t?.dem;if(!t||!i)return null;let r=e.canonical.z-t.tileID.canonical.z,a=1<<r,o=i.dim/(z*a),n=(e.canonical.x-(e.canonical.x>>r<<r))/a*i.dim+O0,s=(e.canonical.y-(e.canonical.y>>r<<r))/a*i.dim+O0;return(l,u,c)=>{let h=c===8192?1:z/c;return i.sampleBilinear(l*h*o+n,u*h*o+s)}}_build(e){let{tileManager:t}=this,i=[],r=new Map,a=0,o=0;for(let n of t.getRenderableTiles()){if(!n)continue;let{canonical:s,wrap:l}=n.tileID;i.includes(s.z)||i.push(s.z);let u=e&&!t.getSourceTile(n.tileID)?.dem?null:this.getSampler(n.tileID);r.set(`${l}/${s.z}/${s.x}/${s.y}`,u);let c=t.getSourceTile(n.tileID,!0)?.dem;a=Math.min(a,(c?.min??0)*this.exaggeration),o=Math.max(o,(c?.max??0)*this.exaggeration)}return r.size===0?null:(i.sort((n,s)=>s-n),{zooms:i,samplerPerTile:r,minElevation:a-10,maxElevation:o+10})}},N0,mE=class{getVisibleUnwrappedCoordinates(e,t,i){let r=[new su(0,i)];if(e.renderWorldCopies&&t.wraps){let a=sr(e,new D(0,0)),o=sr(e,new D(e.width,0)),n=sr(e,new D(e.width,e.height)),s=sr(e,new D(0,e.height)),l=Math.floor(Math.min(a.x,o.x,n.x,s.x)),u=Math.floor(Math.max(a.x,o.x,n.x,s.x));for(let c=l-1;c<=u+1;c++)c!==0&&r.push(new su(c,i))}return r}getCameraFrustum(e){return g2(e.inverseModelViewProjectionMatrix,e.worldSize)}locationToScreenPoint(e,t,i,r){let a=t.worldFromLngLat(i.lng,i.lat);return r?U0(e,a,r.getElevationForLngLat(i,e.tileZoom),e.pixelMatrix3D):U0(e,a)}screenPointToLocation(e,t,i,r){return Hd(t,this.screenPointToMercatorCoordinate(e,t,i,r))}screenPointToLocationAtElevation(e,t,i,r){return Hd(t,sr(e,i,r-e.elevation))}screenPointToMercatorCoordinate(e,t,i,r){if(r){let a=this.screenTerrainPointToMercatorCoordinate(e,t,i,r);if(a!=null)return a}return sr(e,i)}screenTerrainPointToMercatorCoordinate(e,t,i,r){let{near:a,far:o}=lu(e,i,-1);return y2(e,t,a,o,r)}getBounds(e,t){let i=Math.max(0,e.height/2-$0(e));return new Nr().extend(this.screenPointToLocation(e,t,new D(0,i))).extend(this.screenPointToLocation(e,t,new D(e.width,i))).extend(this.screenPointToLocation(e,t,new D(e.width,e.height))).extend(this.screenPointToLocation(e,t,new D(0,e.height)))}isPointOnMapSurface(e,t,i,r){if(r)return this.screenTerrainPointToMercatorCoordinate(e,t,i,r)!=null;let a=i.y>e.centerPoint.y-$0(e);if(!a||t.wraps)return a;let o=sr(e,i);return t.hasLngLat(o.x,o.y)}calculateFogMatrix(e,t){let i=t.key,r=Zd(e).fogMatrices;if(r.has(i))return r.get(i);let a=Wd(t,e.worldSize);return Rn(a,e.fogMatrix,a),r.set(i,new Float32Array(a)),r.get(i)}maxPitchScaleFactor(e){if(!e.pixelMatrixInverse)return 1;let t=sr(e,new D(0,0)),i=[t.x*e.worldSize,t.y*e.worldSize,0,1];return $t(i,i,e.pixelMatrix)[3]/e.cameraToCenterDistance}getCameraAltitude(e){return Math.cos(e.pitchInRadians)*e.cameraToCenterDistance/e.pixelsPerMeter+e.elevation}getCameraLngLat(e,t){let i=e.center,r=t.worldZFromAltitude(1,i),a=r*e.worldSize,o=e.cameraToCenterDistance/a,n=u2(t.worldFromLngLat(i.lng,i.lat,e.elevation),e.pitch,e.bearing,o*r);return t.lngLatFromWorld(n.x,n.y)}getProjectionData(e,t){let{overscaledTileID:i,aligned:r,applyTerrainMatrix:a}=t,o=l2(i),n=i?Eh(e,i,r,!0):null,s;return s=i?.terrainRttPosMatrix32f&&a?i.terrainRttPosMatrix32f:n||yy(),{mainMatrix:s,tileMercatorCoords:o,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:s,clipAntimeridian:!1}}isLocationOccluded(e,t,i,r,a){if(!r?.getCoverageIndex())return!1;let o=t.worldFromLngLat(i.lng,i.lat);a??=r.getElevationForLngLat(i,e.tileZoom);let n=v2(e,o,a,e.pixelMatrix3D),s=n[3];if(s<=0||n[2]>s)return!0;let l=new D(n[0]/s,n[1]/s),u=this.screenTerrainPointToMercatorCoordinate(e,t,l,r);if(u==null)return!1;let c=lu(e,l,-1),h=q0(c,o.x*e.worldSize,o.y*e.worldSize,a);return q0(c,u.x*e.worldSize,u.y*e.worldSize,u.z)<h*0.99}getPixelScale(e){return 1}getCircleRadiusCorrection(e){return 1}getPitchedTextCorrection(e,t,i,r){return 1}transformLightDirection(e,t){return id(t)}projectTileCoordinates(e,t,i,r,a){let o=Eh(e,r),n;a==null?(n=[t,i,0,1],ff(n,n,o)):(n=[t,i,a,1],$t(n,n,o));let s=n[3];return{point:new D(n[0]/s,n[1]/s),signedDistanceFromCamera:s,isOccluded:!1}}getProjectionDataForCustomLayer(e,t=!0){let i=new Et(0,0,0,0,0),r=this.getProjectionData(e,{overscaledTileID:i,applyGlobeMatrix:t}),a=Wd(i,e.worldSize);Rn(a,e.modelViewProjectionMatrix,a);let o=[z,z,e.worldSize/e.pixelsPerMeter],n=Ea();return Xt(n,a,o),{...r,tileMercatorCoords:[0,0,1,1],fallbackMatrix:n,mainMatrix:n}}getFastPathSimpleProjectionMatrix(e,t){return Eh(e,t)}getClippingPlane(e){return null}getRayDirectionFromPixel(e,t){throw Error("Not implemented.")}getCameraQueryGeometry(e,t){return m2(e,t)}},DE=class{getProjectionData(e,t){let{overscaledTileID:i,applyGlobeMatrix:r}=t,a=l2(i);return{mainMatrix:e.modelViewProjectionMatrix32f,tileMercatorCoords:a,clippingPlane:e.clippingPlane,projectionTransition:+!!r,fallbackMatrix:e.modelViewProjectionMatrix32f,clipAntimeridian:i?.canonical.z===0}}isLocationOccluded(e,t,i,r,a){let o=r?.getCoverageIndex();a??=o?r.getElevationForLngLat(i,e.tileZoom):0;let n=Y0(i,a);if(!T2(e,n))return!0;if(!o)return!1;let s=Ch(e,n),l=e.cameraPosition,u=Mn(e,s),c=K0(l,u,n);if(c<=0)return!0;let h=this.screenTerrainPointToMercatorCoordinate(e,t,s,r);return h!=null&&K0(l,u,Y0(h.toLngLat(),h.z))<c*0.99}transformLightDirection(e,t){let i=e.center.lng*Math.PI/180,r=e.center.lat*Math.PI/180,a=Math.cos(r),o=[Math.sin(i)*a,Math.sin(r),Math.cos(i)*a],n=[o[2],0,-o[0]],s=[0,0,0];si(s,n,o),Rt(n,n),Rt(s,s);let l=[n[0]*t[0]+s[0]*t[1]+o[0]*t[2],n[1]*t[0]+s[1]*t[1]+o[1]*t[2],n[2]*t[0]+s[2]*t[1]+o[2]*t[2]],u=[0,0,0];return Rt(u,l),u}getPixelScale(e){return 1/ka(e.center.lat)}getCircleRadiusCorrection(e){return ka(e.center.lat)}getPitchedTextCorrection(e,t,i,r){let a=s2(t,i,r.canonical),o=_E(a.x,a.y);return this.getCircleRadiusCorrection(e)/Math.cos(o[1])}projectTileCoordinates(e,t,i,r,a){let o=r.canonical,n=Hr(t,i,o.x,o.y,o.z),s=1+(a??0)/Yt,l=n[0]*s,u=n[1]*s,c=n[2]*s,h=[l,u,c,1];$t(h,h,e.modelViewProjectionMatrix);let d;if(s<=1){let p=e.clippingPlane;d=p[0]*n[0]+p[1]*n[1]+p[2]*n[2]+p[3]<0}else d=CE(e,l,u,c);return{point:new D(h[0]/h[3],h[1]/h[3]),signedDistanceFromCamera:h[3],isOccluded:d}}calculateFogMatrix(e,t){he("calculateFogMatrix is not supported on globe projection.");let i=Ea();return er(i),i}getVisibleUnwrappedCoordinates(e,t,i){return[new su(0,i)]}getCameraFrustum(e){return e.frustum}maxPitchScaleFactor(e){return 1}getCameraAltitude(e){return(Ki(e.cameraPosition)-1)*Yt}getCameraLngLat(e,t){let i=De();return Rt(i,e.cameraPosition),Kn(i)}getBounds(e,t){let i=e.width*0.5,r=e.height*0.5,a=[new D(0,0),new D(i,0),new D(e.width,0),new D(e.width,r),new D(e.width,e.height),new D(i,e.height),new D(0,e.height),new D(0,r)],o=[];for(let d of a)o.push(Il(e,d));let n=0,s=0,l=0,u=0,c=e.center;for(let d of o){let p=ti(c.lng,d.lng),f=ti(c.lat,d.lat);p<s&&(s=p),p>n&&(n=p),f<u&&(u=f),f>l&&(l=f)}let h=[c.lng+s,c.lat+u,c.lng+n,c.lat+l];return H0(e,[0,1,0])&&(h[3]=90,h[0]=-180,h[2]=180),H0(e,[0,-1,0])&&(h[1]=-90,h[0]=-180,h[2]=180),new Nr(h)}locationToScreenPoint(e,t,i,r){let a=dt(i);return r&&Ue(a,a,1+r.getElevationForLngLat(i,e.tileZoom)/Yt),Ch(e,a)}getCameraQueryGeometry(e,t){if(t.length!==1||!Z0(e,t[0]))return m2(e,t);let i=dt(Il(e,t[0])),r=Rt(De(),e.cameraPosition),a=[t[0]];for(let o=1;o<=8;o++){let n=_y(De(),i,r,o/8);a.push(Ch(e,Rt(n,n)))}return a}screenPointToMercatorCoordinate(e,t,i,r){if(r){let a=this.screenTerrainPointToMercatorCoordinate(e,t,i,r);if(a)return a}return Ot.fromLngLat(Il(e,i))}screenTerrainPointToMercatorCoordinate(e,t,i,r){let a=r.getCoverageIndex();if(!a)return null;let o=e.cameraPosition,n=Mn(e,i),s=uu(o,n,1+a.maxElevation/Yt);if(!s)return null;let l=uu(o,n,1+a.minElevation/Yt),u=Math.max(s.tMin,0),c=l?l.tMin:s.tMax;if(c<=u)return null;let h={index:a,exaggeration:r.exaggeration,origin:o,direction:n},d=0;for(let p=0;p<=256;p++){let f=u+(c-u)*p/256;if(X0(h,f)){let{hi:m}=_2(h,X0,d,f,0.000000000001),{sample:g,mercator:_}=E2(h,m);return new Ot(_.x,_.y,g.elevation)}d=f}return null}screenPointToLocation(e,t,i,r){return this.screenPointToMercatorCoordinate(e,t,i,r)?.toLngLat()}screenPointToLocationAtElevation(e,t,i,r){return this.screenPointToLocation(e,t,i)}isPointOnMapSurface(e,t,i,r){return Z0(e,i)}getProjectionDataForCustomLayer(e,t=!0){let i=this.getProjectionData(e,{overscaledTileID:new Et(0,0,0,0,0),applyGlobeMatrix:t});return i.tileMercatorCoords=[0,0,1,1],i}getFastPathSimpleProjectionMatrix(e,t){}getClippingPlane(e){return e.clippingPlane}getRayDirectionFromPixel(e,t){return Mn(e,t)}},AE=class{constructor(e,t){this._mercator=e,this._verticalPerspective=t}_renderedMath(e){return An(e)?this._verticalPerspective:this._mercator}getProjectionData(e,t){let i=this._mercator.getProjectionData(e.mercator,t),r=this._verticalPerspective.getProjectionData(e.verticalPerspective,t);return{mainMatrix:An(e)?r.mainMatrix:i.mainMatrix,clippingPlane:r.clippingPlane,tileMercatorCoords:r.tileMercatorCoords,projectionTransition:t.applyGlobeMatrix?e.globeness:0,fallbackMatrix:i.fallbackMatrix,clipAntimeridian:r.clipAntimeridian}}getProjectionDataForCustomLayer(e,t=!0){let i=this._mercator.getProjectionDataForCustomLayer(e.mercator,t);if(!An(e))return i;let r=this._verticalPerspective.getProjectionDataForCustomLayer(e.verticalPerspective,t);return r.fallbackMatrix=i.mainMatrix,r.projectionTransition=e.globeness,r}getFastPathSimpleProjectionMatrix(e,t){return this._renderedMath(e).getFastPathSimpleProjectionMatrix(ot(e),t)}projectTileCoordinates(e,t,i,r,a){return this._renderedMath(e).projectTileCoordinates(ot(e),t,i,r,a)}getPitchedTextCorrection(e,t,i,r){return ea(this._mercator.getPitchedTextCorrection(e.mercator,t,i,r),this._verticalPerspective.getPitchedTextCorrection(e.verticalPerspective,t,i,r),e.globeness)}getCircleRadiusCorrection(e){return this._renderedMath(e).getCircleRadiusCorrection(ot(e))}getPixelScale(e){return ea(this._mercator.getPixelScale(e.mercator),this._verticalPerspective.getPixelScale(e.verticalPerspective),e.globeness)}transformLightDirection(e,t){return this._renderedMath(e).transformLightDirection(ot(e),t)}calculateFogMatrix(e,t){return this._renderedMath(e).calculateFogMatrix(ot(e),t)}getVisibleUnwrappedCoordinates(e,t,i){return this._renderedMath(e).getVisibleUnwrappedCoordinates(ot(e),t,i)}getCameraFrustum(e){return this._renderedMath(e).getCameraFrustum(ot(e))}getClippingPlane(e){return this._renderedMath(e).getClippingPlane(ot(e))}maxPitchScaleFactor(e){return this._mercator.maxPitchScaleFactor(e.mercator)}getCameraAltitude(e){return this._renderedMath(e).getCameraAltitude(ot(e))}getCameraLngLat(e,t){return this._renderedMath(e).getCameraLngLat(ot(e),t)}getBounds(e,t){return this._renderedMath(e).getBounds(ot(e),t)}isLocationOccluded(e,t,i,r,a){return this._renderedMath(e).isLocationOccluded(ot(e),t,i,r,a)}locationToScreenPoint(e,t,i,r){return this._renderedMath(e).locationToScreenPoint(ot(e),t,i,r)}screenPointToLocation(e,t,i,r){return this._renderedMath(e).screenPointToLocation(ot(e),t,i,r)}screenPointToLocationAtElevation(e,t,i,r){return this._renderedMath(e).screenPointToLocationAtElevation(ot(e),t,i,r)}screenPointToMercatorCoordinate(e,t,i,r){return this._renderedMath(e).screenPointToMercatorCoordinate(ot(e),t,i,r)}screenTerrainPointToMercatorCoordinate(e,t,i,r){return this._renderedMath(e).screenTerrainPointToMercatorCoordinate(ot(e),t,i,r)}isPointOnMapSurface(e,t,i,r){return this._renderedMath(e).isPointOnMapSurface(ot(e),t,i,r)}getRayDirectionFromPixel(e,t){return this._verticalPerspective.getRayDirectionFromPixel(e.verticalPerspective,t)}getCameraQueryGeometry(e,t){return this._renderedMath(e).getCameraQueryGeometry(ot(e),t)}},S2,C2,ME,BE,OE=()=>BE||=new Pt({"circle-sort-key":new ae(F.layout_circle["circle-sort-key"],"circle-sort-key")}),jE,NE=()=>jE||=new Pt({"circle-radius":new ae(F.paint_circle["circle-radius"],"circle-radius"),"circle-color":new ae(F.paint_circle["circle-color"],"circle-color"),"circle-blur":new ae(F.paint_circle["circle-blur"],"circle-blur"),"circle-opacity":new ae(F.paint_circle["circle-opacity"],"circle-opacity"),"circle-translate":new q(F.paint_circle["circle-translate"],"circle-translate"),"circle-translate-anchor":new q(F.paint_circle["circle-translate-anchor"],"circle-translate-anchor"),"circle-pitch-scale":new q(F.paint_circle["circle-pitch-scale"],"circle-pitch-scale"),"circle-pitch-alignment":new q(F.paint_circle["circle-pitch-alignment"],"circle-pitch-alignment"),"circle-stroke-width":new ae(F.paint_circle["circle-stroke-width"],"circle-stroke-width"),"circle-stroke-color":new ae(F.paint_circle["circle-stroke-color"],"circle-stroke-color"),"circle-stroke-opacity":new ae(F.paint_circle["circle-stroke-opacity"],"circle-stroke-opacity")}),VE,$E=(e)=>e.type==="circle",UE,A2,qE,GE=()=>qE||=new Pt({"heatmap-radius":new ae(F.paint_heatmap["heatmap-radius"],"heatmap-radius"),"heatmap-weight":new ae(F.paint_heatmap["heatmap-weight"],"heatmap-weight"),"heatmap-intensity":new q(F.paint_heatmap["heatmap-intensity"],"heatmap-intensity"),"heatmap-color":new Zu(F.paint_heatmap["heatmap-color"],"heatmap-color"),"heatmap-opacity":new q(F.paint_heatmap["heatmap-opacity"],"heatmap-opacity")}),WE,bf=class e{constructor(t,i){vf(this,t,1,i)}resize(t){M2(this,t,1)}clone(){return new e({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,i,r,a,o){xf(t,i,r,a,o,1)}},$e=class e{constructor(t,i){vf(this,t,4,i)}resize(t){M2(this,t,4)}replace(t,i){i?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new e({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,i,r,a,o){xf(t,i,r,a,o,4)}setPixel(t,i,r){let a=(t*this.width+i)*4;this.data[a+0]=Math.round(r.r*255/r.a),this.data[a+1]=Math.round(r.g*255/r.a),this.data[a+2]=Math.round(r.b*255/r.a),this.data[a+3]=Math.round(r.a*255)}},cu="big-fb",ZE=(e)=>e.type==="heatmap",HE,XE,YE=()=>XE||=new Pt({"hillshade-illumination-direction":new q(F.paint_hillshade["hillshade-illumination-direction"],"hillshade-illumination-direction"),"hillshade-illumination-altitude":new q(F.paint_hillshade["hillshade-illumination-altitude"],"hillshade-illumination-altitude"),"hillshade-illumination-anchor":new q(F.paint_hillshade["hillshade-illumination-anchor"],"hillshade-illumination-anchor"),"hillshade-exaggeration":new q(F.paint_hillshade["hillshade-exaggeration"],"hillshade-exaggeration"),"hillshade-shadow-color":new q(F.paint_hillshade["hillshade-shadow-color"],"hillshade-shadow-color"),"hillshade-highlight-color":new q(F.paint_hillshade["hillshade-highlight-color"],"hillshade-highlight-color"),"hillshade-accent-color":new q(F.paint_hillshade["hillshade-accent-color"],"hillshade-accent-color"),"hillshade-method":new q(F.paint_hillshade["hillshade-method"],"hillshade-method"),resampling:new q(F.paint_hillshade.resampling,"resampling")}),KE,JE=(e)=>e.type==="hillshade",QE,eS,tS=()=>eS||=new Pt({"color-relief-opacity":new q(F["paint_color-relief"]["color-relief-opacity"],"color-relief-opacity"),"color-relief-color":new Zu(F["paint_color-relief"]["color-relief-color"],"color-relief-color"),resampling:new q(F["paint_color-relief"].resampling,"resampling")}),iS,yt=class{constructor(e,t,i,r){this.context=e,this.format=i,this.texture=e.gl.createTexture(),this._ownedHandle=this.texture,this.update(t,r)}update(e,t,i){let{width:r,height:a}=e,o=(this.size?.[0]!==r||this.size[1]!==a)&&!i,{context:n}=this,{gl:s}=n;this.useMipmap=!!t?.useMipmap,o&&this.size&&this.format===s.RGBA&&(s.deleteTexture(this.texture),this.texture=s.createTexture(),this._ownedHandle=this.texture,this.magFilter=void 0,this.minFilter=void 0,this.wrap=void 0),s.bindTexture(s.TEXTURE_2D,this.texture),n.pixelStoreUnpackFlipY.set(!1),n.pixelStoreUnpack.set(1);let l=this.format===s.RGBA&&t?.premultiply!==!1;if(o)if(this.size=[r,a],this.format===s.RGBA&&r>0&&a>0){let u=this.useMipmap?Math.floor(Math.log2(Math.max(r,a)))+1:1;if(s.texStorage2D(s.TEXTURE_2D,u,s.RGBA8,r,a),nl(e)){n.pixelStoreUnpackPremultiplyAlpha.set(!1);let{data:c}=e;l&&c&&(c=Dh(c)),c&&s.texSubImage2D(s.TEXTURE_2D,0,0,0,r,a,s.RGBA,s.UNSIGNED_BYTE,c)}else n.pixelStoreUnpackPremultiplyAlpha.set(l),s.texSubImage2D(s.TEXTURE_2D,0,0,0,s.RGBA,s.UNSIGNED_BYTE,e)}else nl(e)?(n.pixelStoreUnpackPremultiplyAlpha.set(!1),this._uploadRawData(e,l,r,a,s)):(n.pixelStoreUnpackPremultiplyAlpha.set(l),this._uploadDomImage(e,s));else{let{x:u,y:c}=i||{x:0,y:0};nl(e)?(n.pixelStoreUnpackPremultiplyAlpha.set(!1),this._updateRawData(e,l,u,c,r,a,s)):(n.pixelStoreUnpackPremultiplyAlpha.set(l),this._updateDomImage(e,u,c,s))}this.useMipmap&&!(nl(e)&&e.data===null)&&s.generateMipmap(s.TEXTURE_2D),n.pixelStoreUnpackFlipY.setDefault(),n.pixelStoreUnpack.setDefault(),n.pixelStoreUnpackPremultiplyAlpha.setDefault()}_uploadDomImage(e,t){t.texImage2D(t.TEXTURE_2D,0,this.format,this.format,t.UNSIGNED_BYTE,e)}_uploadRawData(e,t,i,r,a){let{data:o}=e;t&&o&&(o=Dh(o)),a.texImage2D(a.TEXTURE_2D,0,this.format,i,r,0,this.format,a.UNSIGNED_BYTE,o)}_updateDomImage(e,t,i,r){r.texSubImage2D(r.TEXTURE_2D,0,t,i,r.RGBA,r.UNSIGNED_BYTE,e)}_updateRawData(e,t,i,r,a,o,n){let{data:s}=e;t&&s&&(s=Dh(s)),n.texSubImage2D(n.TEXTURE_2D,0,i,r,a,o,n.RGBA,n.UNSIGNED_BYTE,s)}bind(e,t,i){let{context:r}=this,{gl:a}=r;this.texture!==this._ownedHandle&&(this.texture=this._ownedHandle),a.bindTexture(a.TEXTURE_2D,this.texture),i!==a.LINEAR_MIPMAP_NEAREST&&i!==a.LINEAR_MIPMAP_LINEAR||this.useMipmap||(i=a.LINEAR);let o=i||e;e!==this.magFilter&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,e),this.magFilter=e),o!==this.minFilter&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,o),this.minFilter=o),t!==this.wrap&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,t),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,t),this.wrap=t)}generateMipmap(){if(!this.useMipmap)return;let{gl:e}=this.context;e.bindTexture(e.TEXTURE_2D,this.texture),e.generateMipmap(e.TEXTURE_2D)}destroy(){let{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null,this._ownedHandle=null}},rS,aS=(e)=>e.type==="color-relief",oS,Xd,nS,Jn,Yd=!1,Jd=!1,st,du=0,Qd,ep,yi,no,ma,cn,hn,Fr=class{constructor(e,t){if(t>e)throw Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=e,this._minGranularity=t}getGranularityForZoomLevel(e){let t=1<<e;return Math.max(Math.floor(this._baseZoomGranularity/t),this._minGranularity,1)}},Tf,Pn=-32768,In=32767,CS=class{constructor(e,t){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=e,this._granularityCellSize=z/e,this._canonical=t}_getKey(e,t){return e+=32768,t+=32768,e<<16|t}_vertexToIndex(e,t){if(e<-32768||t<-32768||e>32767||t>32767)throw Error("Vertex coordinates are out of signed 16 bit integer range.");let i=Math.round(e)|0,r=Math.round(t)|0,a=this._getKey(i,r),o=this._vertexDictionary.get(a);if(o!==void 0)return o;let n=this._vertexBuffer.length/2;return this._vertexDictionary.set(a,n),this._vertexBuffer.push(i,r),n}_subdivideTrianglesScanline(e,t){if(this._granularity<2)return MS(this._vertexBuffer,AS(e,t));let i=[],r=e.length;for(let a=0;a<r;a+=3){let o=[t[e[a+0]],t[e[a+1]],t[e[a+2]]],n=[this._vertexBuffer[o[0]*2+0],this._vertexBuffer[o[0]*2+1],this._vertexBuffer[o[1]*2+0],this._vertexBuffer[o[1]*2+1],this._vertexBuffer[o[2]*2+0],this._vertexBuffer[o[2]*2+1]],s=1/0,l=1/0,u=-1/0,c=-1/0;for(let m=0;m<3;m++){let g=n[m*2],_=n[m*2+1];s=Math.min(s,g),u=Math.max(u,g),l=Math.min(l,_),c=Math.max(c,_)}if(s===u||l===c)continue;let h=Math.floor(s/this._granularityCellSize),d=Math.ceil(u/this._granularityCellSize),p=Math.floor(l/this._granularityCellSize),f=Math.ceil(c/this._granularityCellSize);if(h===d&&p===f)i.push(...o);else for(let m=p;m<f;m++){let g=this._scanlineGenerateVertexRingForCellRow(m,n,o);PS(this._vertexBuffer,g,i)}}return i}_scanlineGenerateVertexRingForCellRow(e,t,i){let r=e*this._granularityCellSize,a=r+this._granularityCellSize,o=[];for(let n=0;n<3;n++){let s=t[n*2],l=t[n*2+1],u=t[(n+1)*2%6],c=t[((n+1)*2+1)%6],h=t[(n+2)*2%6],d=t[((n+2)*2+1)%6],p=u-s,f=c-l,m=p===0,g=f===0,_=(r-l)/f,y=(a-l)/f,v=Math.min(_,y),x=Math.max(_,y);if(!g&&(v>=1||x<=0)||g&&(l<r||l>a)){c>=r&&c<=a&&o.push(i[(n+1)%3]);continue}if(!g&&v>0){let T=s+p*v,E=l+f*v;o.push(this._vertexToIndex(T,E))}let b=s+p*Math.max(v,0),w=s+p*Math.min(x,1);if(m||this._generateIntraEdgeVertices(o,s,l,u,c,b,w),!g&&x<1){let T=s+p*x,E=l+f*x;o.push(this._vertexToIndex(T,E))}(g||c>=r&&c<=a)&&o.push(i[(n+1)%3]),!g&&(c<=r||c>=a)&&this._generateInterEdgeVertices(o,s,l,u,c,h,d,w,r,a)}return o}_generateIntraEdgeVertices(e,t,i,r,a,o,n){let s=r-t,l=a-i,u=l===0,c=u?Math.min(t,r):Math.min(o,n),h=u?Math.max(t,r):Math.max(o,n),d=Math.floor(c/this._granularityCellSize)+1,p=Math.ceil(h/this._granularityCellSize)-1;if(u?t<r:o<n)for(let f=d;f<=p;f++){let m=f*this._granularityCellSize,g=i+l*(m-t)/s;e.push(this._vertexToIndex(m,g))}else for(let f=p;f>=d;f--){let m=f*this._granularityCellSize,g=i+l*(m-t)/s;e.push(this._vertexToIndex(m,g))}}_generateInterEdgeVertices(e,t,i,r,a,o,n,s,l,u){let c=a-i,h=o-r,d=n-a,p=(l-a)/d,f=(u-a)/d,m=Math.min(p,f),g=Math.max(p,f),_=r+h*m,y=Math.floor(Math.min(_,s)/this._granularityCellSize)+1,v=Math.ceil(Math.max(_,s)/this._granularityCellSize)-1,x=s<_,b=d===0;if(b&&(n===l||n===u))return;if(b||m>=1||g<=0){let T=t-o,E=i-n,S=(l-n)/E,A=(u-n)/E,I=o+T*Math.min(S,A);y=Math.floor(Math.min(I,s)/this._granularityCellSize)+1,v=Math.ceil(Math.max(I,s)/this._granularityCellSize)-1,x=s<I}let w=c>0?u:l;if(x)for(let T=y;T<=v;T++){let E=T*this._granularityCellSize;e.push(this._vertexToIndex(E,w))}else for(let T=v;T>=y;T--){let E=T*this._granularityCellSize;e.push(this._vertexToIndex(E,w))}}_generateOutline(e,t){let i=[],r=0;for(let a of e){let o=this._granularity<2?this._ringPathIndices(a,r,t):this._pointArrayToIndices(wa(a,this._granularity,!0));r+=a.length;let n=[];for(let s=1;s<o.length;s++)n.push(o[s-1]),n.push(o[s]);i.push(n)}return i}_ringPathIndices(e,t,i){let r=i.slice(t,t+e.length);return r.length>=2&&B2(e)&&r.push(r[0]),r}_handlePoles(e){let t=!1,i=!1;this._canonical&&(this._canonical.y===0&&(t=!0),this._canonical.y===(1<<this._canonical.z)-1&&(i=!0)),(t||i)&&this._fillPoles(e,t,i)}_ensureNoPoleVertices(){let e=this._vertexBuffer;for(let t=0;t<e.length;t+=2){let i=e[t+1];i===-32768&&(e[t+1]=-32767),i===32767&&(e[t+1]=32766)}}_generatePoleQuad(e,t,i,r,a,o){r>a==(o===-32768)?(e.push(i),e.push(t),e.push(this._vertexToIndex(r,o)),e.push(this._vertexToIndex(a,o)),e.push(i),e.push(this._vertexToIndex(r,o))):(e.push(t),e.push(i),e.push(this._vertexToIndex(r,o)),e.push(i),e.push(this._vertexToIndex(a,o)),e.push(this._vertexToIndex(r,o)))}_fillPoles(e,t,i){let r=this._vertexBuffer,a=z,o=e.length;for(let n=2;n<o;n+=3){let s=e[n-2],l=e[n-1],u=e[n],c=r[s*2],h=r[s*2+1],d=r[l*2],p=r[l*2+1],f=r[u*2],m=r[u*2+1];t&&(h===0&&p===0&&this._generatePoleQuad(e,s,l,c,d,Pn),p===0&&m===0&&this._generatePoleQuad(e,l,u,d,f,Pn),m===0&&h===0&&this._generatePoleQuad(e,u,s,f,c,Pn)),i&&(h===a&&p===a&&this._generatePoleQuad(e,s,l,c,d,In),p===a&&m===a&&this._generatePoleQuad(e,l,u,d,f,In),m===a&&h===a&&this._generatePoleQuad(e,u,s,f,c,In))}}_initializeVertices(e){let t=[];for(let i=0;i<e.length;i+=2)t.push(this._vertexToIndex(e[i],e[i+1]));return t}subdividePolygonInternal(e,t){if(this._used)throw Error("Subdivision: multiple use not allowed.");this._used=!0;let{flattened:i,holeIndices:r}=DS(e),a=this._initializeVertices(i),o;try{let s=sS(i,r);o=this._subdivideTrianglesScanline(s,a)}catch(s){console.error(s)}let n=[];return t&&(n=this._generateOutline(e,a)),this._ensureNoPoleVertices(),this._handlePoles(o),this._granularity>=2&&this._canonical?.z===0&&(o=this._removeTrianglesOutsideTileX(o),n=n.map((s)=>this._removeLinesOutsideTileX(s))),{verticesFlattened:this._vertexBuffer,indicesTriangles:o,indicesLineList:n}}_vertexOutsideTileX(e){let t=this._vertexBuffer[e*2];return t<0||t>8192}_removeTrianglesOutsideTileX(e){let t=[];for(let i=0;i<e.length;i+=3)this._vertexOutsideTileX(e[i])||this._vertexOutsideTileX(e[i+1])||this._vertexOutsideTileX(e[i+2])||t.push(e[i],e[i+1],e[i+2]);return t}_removeLinesOutsideTileX(e){let t=[];for(let i=0;i<e.length;i+=2)this._vertexOutsideTileX(e[i])||this._vertexOutsideTileX(e[i+1])||t.push(e[i],e[i+1]);return t}_pointArrayToIndices(e){let t=[];for(let i of e)t.push(this._vertexToIndex(i.x,i.y));return t}},j2=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.hasDependencies=!1,this.sdfPatterns={},this.patternFeatures=[],this.layoutVertexArray=new vT,this.indexArray=new xr,this.indexArray2=new Od,this.programConfigurations=new Ia(e.layers,e.zoom),this.segments=new tt,this.segments2=new tt,this.stateDependentLayerIds=this.layers.filter((t)=>t.isStateDependent()).map((t)=>t.id)}populate(e,t,i){this.hasDependencies=hu("fill",this.layers,t);let r=this.layers[0].layout.get("fill-sort-key"),a=!r.isConstant(),o=[],n=new Me(this.zoom),s=this.layers[0]._featureFilter.needGeometry;for(let{feature:l,id:u,index:c,sourceLayerIndex:h}of e){let d=Oa(l,s);if(!this.layers[0]._featureFilter.filter(n,d,i))continue;let p=a?r.evaluate(d,{},i,t.availableImages):void 0,f={id:u,properties:l.properties,type:l.type,sourceLayerIndex:h,index:c,geometry:s?d.geometry:Ba(l),patterns:{},sortKey:p};o.push(f)}a&&o.sort((l,u)=>l.sortKey-u.sortKey);for(let l of o){let{geometry:u,index:c,sourceLayerIndex:h}=l;if(this.hasDependencies){let p=wf("fill",this.layers,l,{zoom:this.zoom},t);this.patternFeatures.push(p)}else this.addFeature(l,u,c,i,{},t.subdivisionGranularity);let d=e[c].feature;t.featureIndex.insert(d,u,c,h,this.index)}}update(e,t,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,{imagePositions:i})}addFeatures({options:e,canonical:t,patternPositions:i,patternMap:r}){this.detectSdfPatterns(r);for(let a of this.patternFeatures)this.addFeature(a,a.geometry,a.index,t,i,e.subdivisionGranularity)}detectSdfPatterns(e){for(let t of this.patternFeatures)for(let i in t.patterns){let r=t.patterns[i];this.recordSdfPattern(i,e[r.min]),this.recordSdfPattern(i,e[r.mid]),this.recordSdfPattern(i,e[r.max])}for(let t of this.layers){let i=t.paint.get("fill-pattern").constantOr(null);i&&(this.recordSdfPattern(t.id,e[i.from.toString()]),this.recordSdfPattern(t.id,e[i.to.toString()]))}}recordSdfPattern(e,t){if(!t)return;let i=t.sdf===!0,r=this.sdfPatterns[e];r===void 0?this.sdfPatterns[e]=i:r!==i&&he(`Style sheet warning: Cannot mix SDF and non-SDF fill patterns in layer "${e}"`)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,nS),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,r,a,o){for(let n of Ou(t,500)){let s=L2(n,r,o.fill.getGranularityForZoomLevel(r.z)),l=this.layoutVertexArray;O2((u,c)=>{l.emplaceBack(u,c)},this.segments,this.layoutVertexArray,this.indexArray,s.verticesFlattened,s.indicesTriangles,this.segments2,this.indexArray2,s.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,{imagePositions:a,canonical:r})}},FS,RS=()=>FS||=new Pt({"fill-sort-key":new ae(F.layout_fill["fill-sort-key"],"fill-sort-key")}),zS,LS=()=>zS||=new Pt({"fill-antialias":new q(F.paint_fill["fill-antialias"],"fill-antialias"),"fill-opacity":new ae(F.paint_fill["fill-opacity"],"fill-opacity"),"fill-layer-opacity":new q(F.paint_fill["fill-layer-opacity"],"fill-layer-opacity"),"fill-layer-blend":new q(F.paint_fill["fill-layer-blend"],"fill-layer-blend"),"fill-color":new ae(F.paint_fill["fill-color"],"fill-color"),"fill-outline-color":new ae(F.paint_fill["fill-outline-color"],"fill-outline-color"),"fill-translate":new q(F.paint_fill["fill-translate"],"fill-translate"),"fill-translate-anchor":new q(F.paint_fill["fill-translate-anchor"],"fill-translate-anchor"),"fill-pattern":new Wn(F.paint_fill["fill-pattern"],"fill-pattern")}),BS,N2=(e)=>e.type==="fill",OS,rp,jS,NS,fs=class{constructor(e,t,i,r,a){for(this.properties=Object.create(null),this.extent=i,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=r,this._values=a;e.pos<t;){let o=e.readVarint();if(o===8)this.id=e.readVarint();else if(o===18){let n=e.readVarint()+e.pos;for(;e.pos<n;){let s=r[e.readVarint()],l=a[e.readVarint()];this.properties[s]=l}}else o===24?this.type=e.readVarint():(o===34&&(this._geometry=e.pos),e.skip(o))}}loadGeometry(){if(this._geometry<0)throw Error("feature has no geometry");let e=this._pbf;e.pos=this._geometry;let t=e.readVarint()+e.pos,i=[],r,a=1,o=0,n=0,s=0;for(;e.pos<t;){if(o<=0){let l=e.readVarint();if(a=l&7,o=l>>3,o===0)continue}if(o--,a===1)n+=e.readSVarint(),s+=e.readSVarint(),r&&i.push(r),r=[new D(n,s)];else if(a===2)n+=e.readSVarint(),s+=e.readSVarint(),r&&r.push(new D(n,s));else if(a===7)r&&r.push(r[0].clone());else throw Error(`unknown command ${a}`)}return r&&i.push(r),i}bbox(){if(this._geometry<0)throw Error("feature has no geometry");let e=this._pbf;e.pos=this._geometry;let t=e.readVarint()+e.pos,i=1,r=0,a=0,o=0,n=1/0,s=-1/0,l=1/0,u=-1/0;for(;e.pos<t;){if(r<=0){let c=e.readVarint();if(i=c&7,r=c>>3,r===0)continue}if(r--,i===1||i===2)a+=e.readSVarint(),o+=e.readSVarint(),a<n&&(n=a),a>s&&(s=a),o<l&&(l=o),o>u&&(u=o);else if(i!==7)throw Error(`unknown command ${i}`)}return[n,l,s,u]}toGeoJSON(e,t,i){let r=this.extent*2**i,a=this.extent*e,o=this.extent*t,n=this.loadGeometry();function s(h){return[(h.x+a)*360/r-180,360/Math.PI*Math.atan(Math.exp((1-(h.y+o)*2/r)*Math.PI))-90]}function l(h){return h.map(s)}let u;if(this.type===1){let h=[];for(let p of n)h.push(p[0]);let d=l(h);u=h.length===1?{type:"Point",coordinates:d[0]}:{type:"MultiPoint",coordinates:d}}else if(this.type===2){let h=n.map(l);u=h.length===1?{type:"LineString",coordinates:h[0]}:{type:"MultiLineString",coordinates:h}}else if(this.type===3){let h=V2(n),d=[];for(let p of h)d.push(p.map(l));u=d.length===1?{type:"Polygon",coordinates:d[0]}:{type:"MultiPolygon",coordinates:d}}else throw Error("unknown feature type");let c={type:"Feature",geometry:u,properties:this.properties};return this.id!=null&&(c.id=this.id),c}},$S=class{constructor(e,t){for(this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],t===void 0&&(t=e.length);e.pos<t;){let i=e.readVarint();i===10?this.name=e.readString():i===18?(this._features.push(e.pos),e.skip(i)):i===26?this._keys.push(e.readString()):i===34?this._values.push(US(e)):i===40?this.extent=e.readVarint():i===120?this.version=e.readVarint():e.skip(i)}this.length=this._features.length}feature(e){if(e<0||e>=this._features.length)throw Error("feature index out of bounds");this._pbf.pos=this._features[e];let t=this._pbf.readVarint()+this._pbf.pos;return new fs(this._pbf,t,this.extent,this._keys,this._values)}},qS=class{constructor(e,t=e.length){let i=Object.create(null);for(;e.pos<t;){let r=e.readVarint();if(r===26){let a=new $S(e,e.readVarint()+e.pos);a.length&&(i[a.name]=a)}else e.skip(r)}this.layers=i}},ZS,Ah=8192,$2=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.hasDependencies=!1,this.layoutVertexArray=new xT,this.centroidVertexArray=new ba,this.indexArray=new xr,this.programConfigurations=new Ia(e.layers,e.zoom),this.segments=new tt,this.stateDependentLayerIds=this.layers.filter((t)=>t.isStateDependent()).map((t)=>t.id)}populate(e,t,i){this.features=[],this.hasDependencies=hu("fill-extrusion",this.layers,t);let r=new Me(this.zoom),a=this.layers[0],o=a.layout.get("fill-extrusion-rounded-corner-distance"),n=o>0?WS(o,i):0,s=a._featureFilter.needGeometry;for(let{feature:l,id:u,index:c,sourceLayerIndex:h}of e){let d=Oa(l,s);if(!a._featureFilter.filter(r,d,i))continue;let p={id:u,sourceLayerIndex:h,index:c,geometry:GS(s?d.geometry:Ba(l),n),properties:l.properties,type:l.type,patterns:{}};this.hasDependencies?this.features.push(wf("fill-extrusion",this.layers,p,{zoom:this.zoom},t)):this.addFeature(p,p.geometry,c,i,{},t.subdivisionGranularity),t.featureIndex.insert(l,p.geometry,c,h,this.index,!0)}}addFeatures({options:e,canonical:t,patternPositions:i}){for(let r of this.features){let{geometry:a}=r;this.addFeature(r,a,r.index,t,i,e.subdivisionGranularity)}}update(e,t,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,{imagePositions: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,NS),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,jS.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,r,a,o){for(let n of Ou(t,500)){let s={x:0,y:0,sampleCount:0},l=this.layoutVertexArray.length;this.processPolygon(s,r,e,n,o);let u=this.layoutVertexArray.length-l,c=Math.floor(s.x/s.sampleCount),h=Math.floor(s.y/s.sampleCount);for(let d=0;d<u;d++)this.centroidVertexArray.emplaceBack(c,h)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,{imagePositions:a,canonical:r})}processPolygon(e,t,i,r,a){if(r.length<1||k0(r[0]))return;for(let c of r)c.length!==0&&JS(e,c);let o={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},n=a.fill.getGranularityForZoomLevel(t.z),s=fs.types[i.type]==="Polygon";for(let c of r){if(c.length===0||k0(c))continue;let h=wa(c,n,s);this._generateSideFaces(h,o)}if(!s)return;let l=L2(r,t,n,!1),u=this.layoutVertexArray;O2((c,h)=>{dn(u,c,h,0,0,1,1,0)},this.segments,this.layoutVertexArray,this.indexArray,l.verticesFlattened,l.indicesTriangles)}_generateSideFaces(e,t){let i=0,r=this.layers[0].layout.get("fill-extrusion-rounded-corner-distance")>0?HS(e):null;for(let a=1;a<e.length;a++){let o=e[a],n=e[a-1];if(au(o,n)||r&&!r[a])continue;t.segment.vertexLength+4>tt.MAX_VERTEX_ARRAY_LENGTH&&(t.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let s=o.sub(n)._perp()._unit(),{start:l,end:u}=r?r[a]:{start:s,end:s},c=n.dist(o);i+c>32768&&(i=0),dn(this.layoutVertexArray,o.x,o.y,u.x,u.y,0,0,i),dn(this.layoutVertexArray,o.x,o.y,u.x,u.y,0,1,i),i+=c,dn(this.layoutVertexArray,n.x,n.y,l.x,l.y,0,0,i),dn(this.layoutVertexArray,n.x,n.y,l.x,l.y,0,1,i);let h=t.segment.vertexLength;this.indexArray.emplaceBack(h,h+2,h+1),this.indexArray.emplaceBack(h+1,h+2,h+3),t.segment.vertexLength+=4,t.segment.primitiveLength+=2}}},QS,eC=()=>QS||=new Pt({"fill-extrusion-rounded-corner-distance":new q(F["layout_fill-extrusion"]["fill-extrusion-rounded-corner-distance"],"fill-extrusion-rounded-corner-distance")}),tC,iC=()=>tC||=new Pt({"fill-extrusion-opacity":new q(F["paint_fill-extrusion"]["fill-extrusion-opacity"],"fill-extrusion-opacity"),"fill-extrusion-color":new ae(F["paint_fill-extrusion"]["fill-extrusion-color"],"fill-extrusion-color"),"fill-extrusion-translate":new q(F["paint_fill-extrusion"]["fill-extrusion-translate"],"fill-extrusion-translate"),"fill-extrusion-translate-anchor":new q(F["paint_fill-extrusion"]["fill-extrusion-translate-anchor"],"fill-extrusion-translate-anchor"),"fill-extrusion-pattern":new Wn(F["paint_fill-extrusion"]["fill-extrusion-pattern"],"fill-extrusion-pattern"),"fill-extrusion-height":new ae(F["paint_fill-extrusion"]["fill-extrusion-height"],"fill-extrusion-height"),"fill-extrusion-base":new ae(F["paint_fill-extrusion"]["fill-extrusion-base"],"fill-extrusion-base"),"fill-extrusion-vertical-gradient":new q(F["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"],"fill-extrusion-vertical-gradient")}),rC,aC=(e)=>e.type==="fill-extrusion",oC,sC=class{projectX(e){return e/360+0.5}projectY(e){let t=Math.sin(e*Math.PI/180),i=0.5-0.25*Math.log((1+t)/(1-t))/Math.PI;return i<0?0:i>1?1:i}unprojectX(e){return(e-0.5)*360}unprojectY(e){let t=(180-e*360)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}},lC=class{projectX(e){return e}projectY(e){return e}unprojectX(e){return e}unprojectY(e){return e}},ap,uC,op,cC,hC,U2=0.5,r1,q2=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.hasDependencies=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={};for(let t of this.layers)this.gradients[t.id]={};this.layoutVertexArray=new bT,this.layoutVertexArray2=new wT,this.indexArray=new xr,this.programConfigurations=new Ia(e.layers,e.zoom),this.segments=new tt,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((t)=>t.isStateDependent()).map((t)=>t.id)}populate(e,t,i){this.hasDependencies=hu("line",this.layers,t)||this.hasLineDasharray(this.layers);let r=this.layers[0].layout.get("line-sort-key"),a=!r.isConstant(),o=[],n=new Me(this.zoom),s=this.layers[0]._featureFilter.needGeometry;for(let{feature:l,id:u,index:c,sourceLayerIndex:h}of e){let d=Oa(l,s);if(!this.layers[0]._featureFilter.filter(n,d,i))continue;let p=a?r.evaluate(d,{},i):void 0,f={id:u,properties:l.properties,type:l.type,sourceLayerIndex:h,index:c,geometry:s?d.geometry:Ba(l),patterns:{},dashes:{},sortKey:p};o.push(f)}a&&o.sort((l,u)=>l.sortKey-u.sortKey);for(let l of o){let{geometry:u,index:c,sourceLayerIndex:h}=l;this.hasDependencies?(hu("line",this.layers,t)?wf("line",this.layers,l,{zoom:this.zoom},t):this.hasLineDasharray(this.layers)&&this.addLineDashDependencies(this.layers,l,this.zoom,t),this.patternFeatures.push(l)):this.addFeature(l,u,c,i,{},{},t.subdivisionGranularity);let d=e[c].feature;t.featureIndex.insert(d,u,c,h,this.index)}}update(e,t,i,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,{imagePositions:i,dashPositions:r})}addFeatures({options:e,canonical:t,patternPositions:i,dashPositions:r}){for(let a of this.patternFeatures)this.addFeature(a,a.geometry,a.index,t,i,r,e.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,cC)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,uC),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.hasOwn(e.properties,"geojsonvt_clip_start")&&Object.hasOwn(e.properties,"geojsonvt_clip_end"))return{start:+e.properties.geojsonvt_clip_start,end:+e.properties.geojsonvt_clip_end}}addFeature(e,t,i,r,a,o,n){let s=this.layers[0].layout,l=s.get("line-join").evaluate(e,{}),u=s.get("line-cap").evaluate(e,{}),c=s.get("line-miter-limit").evaluate(e,{}),h=s.get("line-round-limit").evaluate(e,{});this.lineClips=this.lineFeatureClips(e);for(let d of t)this.addLine(d,e,l,u,c,h,r,n);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,{imagePositions:a,dashPositions:o,canonical:r})}addLine(e,t,i,r,a,o,n,s){this.distance=0,this.scaledDistance=0,this.totalDistance=0;let l=n?s.line.getGranularityForZoomLevel(n.z):1;if(e=wa(e,l),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let v=0;v<e.length-1;v++)this.totalDistance+=e[v].dist(e[v+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let u=fs.types[t.type]==="Polygon",c=e.length;for(;c>=2&&e[c-1].equals(e[c-2]);)c--;let h=0;for(;h<c-1&&e[h].equals(e[h+1]);)h++;if(c-h<(u?3:2))return;i==="bevel"&&(a=1.05);let d=this.overscaling<=16?15*z/(512*this.overscaling):0,p=this.segments.prepareSegment(c*10,this.layoutVertexArray,this.indexArray),f,m,g,_,y;this.e1=this.e2=-1,u&&(f=e[c-2],y=e[h].sub(f)._unit()._perp());for(let v=h;v<c;v++){if(g=v===c-1?u?e[h+1]:void 0:e[v+1],g&&e[v].equals(g))continue;y&&(_=y),f&&(m=f),f=e[v],y=g?g.sub(f)._unit()._perp():_,_||=y;let x=_.add(y);(x.x!==0||x.y!==0)&&x._unit();let b=_.x*y.x+_.y*y.y,w=x.x*y.x+x.y*y.y,T=w===0?1/0:1/w,E=2*Math.sqrt(2-2*w),S=w<hC&&m&&g,A=_.x*y.y-_.y*y.x>0,I=x.mult(Math.min(T,2)),R=H((T-3)/5,0,1);if(S&&v>h){let C=f.dist(m);if(C>2*d){let P=f.sub(f.sub(m)._mult(d/C)._round());this.updateDistance(m,P),this.addCurrentVertex(P,_,0,0,p),m=P}}let k=m&&g,M=k?i:u?"butt":r;if(k&&M==="round"&&(T<o?M="miter":T<=2&&(M="fakeround")),M==="miter"&&T>a&&(M="bevel"),M==="bevel"&&(T>2&&(M="flipbevel"),T<a&&(M="miter")),m&&this.updateDistance(m,f),M==="miter")x._mult(T),this.addCurrentVertex(f,x,0,0,p,!1,I);else if(M==="flipbevel"){if(T>100)x=y.mult(-1);else{let C=T*_.add(y).mag()/_.sub(y).mag();x._perp()._mult(C*(A?-1:1))}this.addCurrentVertex(f,x,0,0,p,!1,I,R),this.addCurrentVertex(f,x.mult(-1),0,0,p,!1,I,R)}else if(M==="bevel"||M==="fakeround"){let C=-Math.sqrt(T*T-1),P=A?C:0,B=A?0:C;if(m&&this.addCurrentVertex(f,_,P,B,p,!1,I),M==="fakeround"){let N=Math.round(E*180/Math.PI/20);for(let L=1;L<N;L++){let W=L/N;if(W!==0.5){let be=W-0.5,le=1.0904+b*(-3.2452+b*(3.55645-b*1.43519)),je=0.848013+b*(-1.06021+b*0.215638);W+=W*be*(W-1)*(le*be*be+je)}let Q=y.sub(_)._mult(W)._add(_)._unit()._mult(A?-1:1);this.addHalfVertex(f,Q.x,Q.y,A?-I.x:I.x,A?-I.y:I.y,!1,A,p)}}g&&this.addCurrentVertex(f,y,-P,-B,p,!1,I)}else if(M==="butt")this.addCurrentVertex(f,x,0,0,p,!1,I);else if(M==="square"){let C=m?1:-1;this.addCurrentVertex(f,x,C,C,p,!1,I)}else M==="round"&&(m&&(this.addCurrentVertex(f,_,0,0,p,!1,I,R),this.addCurrentVertex(f,_,1,1,p,!0,I,R)),g&&(this.addCurrentVertex(f,y,-1,-1,p,!0,I,R),this.addCurrentVertex(f,y,0,0,p,!1,I,R)));if(S&&v<c-1){let C=f.dist(g);if(C>2*d){let P=f.add(g.sub(f)._mult(d/C)._round());this.updateDistance(f,P),this.addCurrentVertex(P,y,0,0,p),f=P}}}}addCurrentVertex(e,t,i,r,a,o=!1,n=t,s=0){let l=t.x+t.y*i,u=t.y-t.x*i,c=-t.x+t.y*r,h=-t.y-t.x*r,d=n.x+(t.x-n.x)*s,p=n.y+(t.y-n.y)*s;this.addHalfVertex(e,l,u,d,p,o,!1,a),this.addHalfVertex(e,c,h,-d,-p,o,!0,a),this.distance>r1/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,t,i,r,a,o,n,s))}addHalfVertex({x:e,y:t},i,r,a,o,n,s,l){let u=(this.lineClips?this.scaledDistance*(r1-1):this.scaledDistance)*U2;if(this.layoutVertexArray.emplaceBack((e<<1)+ +!!n,(t<<1)+ +!!s,Math.round(63*i)+128,Math.round(63*r)+128,(u&63)<<2,u>>6,Math.round(63*a),Math.round(63*o)),this.lineClips){let h=(this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start);this.layoutVertexArray2.emplaceBack(h,this.lineClipsArray.length)}let c=l.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,c,this.e2),l.primitiveLength++),s?this.e2=c:this.e1=c}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()}hasLineDasharray(e){for(let t of e){let i=t.paint.get("line-dasharray");if(i&&!i.isConstant())return!0}return!1}addLineDashDependencies(e,t,i,r){for(let a of e){let o=a.paint.get("line-dasharray");if(!o||o.value.kind==="constant")continue;let n=a.layout.get("line-cap").evaluate(t,{})==="round",s={dasharray:o.value.evaluate({zoom:i-1},t,{}),round:n},l={dasharray:o.value.evaluate({zoom:i},t,{}),round:n},u={dasharray:o.value.evaluate({zoom:i+1},t,{}),round:n},c=`${s.dasharray.join(",")},${s.round}`,h=`${l.dasharray.join(",")},${l.round}`,d=`${u.dasharray.join(",")},${u.round}`;r.dashDependencies[c]=s,r.dashDependencies[h]=l,r.dashDependencies[d]=u,t.dashes[a.id]={min:c,mid:h,max:d}}}},dC,pC=()=>dC||=new Pt({"line-cap":new ae(F.layout_line["line-cap"],"line-cap"),"line-join":new ae(F.layout_line["line-join"],"line-join"),"line-miter-limit":new ae(F.layout_line["line-miter-limit"],"line-miter-limit"),"line-round-limit":new ae(F.layout_line["line-round-limit"],"line-round-limit"),"line-sort-key":new ae(F.layout_line["line-sort-key"],"line-sort-key")}),fC,mC=()=>fC||=new Pt({"line-opacity":new ae(F.paint_line["line-opacity"],"line-opacity"),"line-layer-opacity":new q(F.paint_line["line-layer-opacity"],"line-layer-opacity"),"line-layer-blend":new q(F.paint_line["line-layer-blend"],"line-layer-blend"),"line-color":new ae(F.paint_line["line-color"],"line-color"),"line-translate":new q(F.paint_line["line-translate"],"line-translate"),"line-translate-anchor":new q(F.paint_line["line-translate-anchor"],"line-translate-anchor"),"line-width":new ae(F.paint_line["line-width"],"line-width"),"line-gap-width":new ae(F.paint_line["line-gap-width"],"line-gap-width"),"line-offset":new ae(F.paint_line["line-offset"],"line-offset"),"line-blur":new ae(F.paint_line["line-blur"],"line-blur"),"line-dasharray":new Wn(F.paint_line["line-dasharray"],"line-dasharray"),"line-pattern":new Wn(F.paint_line["line-pattern"],"line-pattern"),"line-gradient":new Zu(F.paint_line["line-gradient"],"line-gradient")}),a1,gC,ul,G2=(e)=>e.type==="line",_C,yC,vC,xC,n1,bC,wC,fu,IC,kC,FC,l1=1604,RC,W2,Z2,h1,d1,co,QC,eD,Ef=class e{constructor(t="",i=[],r=[]){this.text=t,this.sections=i,this.sectionIndex=r,this.imageSectionID=null,this.cachedGraphemes=null}graphemes(){return this.cachedGraphemes??=np(this.text),this.cachedGraphemes}static fromFeature(t,i,r,a){let o=new e;for(let n of t.sections)n.image?o.addImageSection(n):o.addTextSection(n,i);return r&&o.verticalizePunctuation(a),o}length(){return this.graphemes().length}getSection(t){return this.sections[this.sectionIndex[t]]}getSectionIndex(t){return this.sectionIndex[t]}verticalizePunctuation(t={},i){let r=JC(this.text),a=0;this.cachedGraphemes=this.graphemes().map((o,n)=>{let s=r.slice(a,a+o.length);a+=o.length;let l=this.getSection(n);return i?.[n]!==!1&&"fontStack"in l&&t[l.fontStack]?.vertical?.[o]?o:s}),this.text=this.cachedGraphemes.join("")}hasZeroWidthSpaces(){return this.text.includes("​")}trim(){let t=this.graphemes(),i=0;for(;i<t.length&&m1(t[i]);)i++;let r=t.length;for(;r>i&&m1(t[r-1]);)r--;this.text=t.slice(i,r).join(""),this.sectionIndex=this.sectionIndex.slice(i,r),this.cachedGraphemes=null}substring(t,i){let r=this.graphemes().slice(t,i).join(""),a=this.sectionIndex.slice(t,i);return new e(r,this.sections,a)}toCodeUnitIndex(t){return this.graphemes().slice(0,t).join("").length}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((t,i)=>Math.max(t,this.sections[i].scale),0)}getMaxImageSize(t){let i=0,r=0;for(let a=0;a<this.length();a++){let o=this.getSection(a);if("imageName"in o){let n=t[o.imageName];if(!n)continue;let s=n.displaySize;i=Math.max(i,s[0]),r=Math.max(r,s[1])}}return{maxImageWidth:i,maxImageHeight:r}}_appendSection(t,i){let r=this.graphemes(),a=r.length>0?r[r.length-1]:"",o=np(a+t);this.text+=t,this.cachedGraphemes=r.slice(0,a?-1:void 0).concat(o);let n=o.length-+!!a;for(let s=0;s<n;s++)this.sectionIndex.push(i)}addTextSection(t,i){this.sections.push({scale:t.scale||1,verticalAlign:t.verticalAlign||"bottom",fontStack:t.fontStack||i}),this._appendSection(t.text,this.sections.length-1)}addImageSection(t){let i=t.image?t.image.name:"";if(i.length===0){he("Can't add FormattedSection with an empty image.");return}let r=this.getNextImageSectionCharCode();r?(this.sections.push({scale:1,verticalAlign:t.verticalAlign||"bottom",imageName:i}),this._appendSection(String.fromCharCode(r),this.sections.length-1)):he("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}determineLineBreaks(t,i,r,a,o){let n=this.determineTotalWidth(t,r,a,o);if(t>=0&&n>0&&n<=i&&!/[\n\r]/.test(this.text))return[this.length()];let s=[],l=n/Math.max(1,Math.ceil(n/i)),u=this.hasZeroWidthSpaces(),c=this.graphemes(),h=null,d=0,p=0;for(let f=0;f<c.length;f++){let m=c[f];if(f>0){let g=c[f-1].codePointAt(0),_=m.codePointAt(0),y=DC(g),v=s1(g)&&s1(_);(QC[g]||y||("imageName"in this.getSection(f-1))||c[f+1]!==void 0&&eD[_]||v&&(h??=YC(this.text)).has(p))&&s.push(g1(f,d,l,s,tD(g,_,y&&u),!1))}rs(m.codePointAt(0))||(d+=p1(m,this.getSection(f),r,a,t,o)),p+=m.length}return J2(g1(this.length(),d,l,s,0,!0))}determineTotalWidth(t,i,r,a){let o=0,n=0;for(let s of this.graphemes()){let l=this.getSection(n);o+=p1(s,l,i,r,t,a),n++}return o}},Sf,rD,aD,oD,_1=4294967296,y1,ex=class{constructor(e){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer,this.buf.byteOffset,this.buf.byteLength),this.pos=0,this.type=0,this._valueStart=-1,this.length=this.buf.length}readFields(e,t,i=this.length){let r;for(;r=this.nextField(i);)e(r,t,this);return t}readMessage(e,t){return this.readFields(e,t,this.readVarint()+this.pos)}readFixed32(){let e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){let e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){let e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*_1;return this.pos+=8,e}readSFixed64(){let e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*_1;return this.pos+=8,e}readFloat(){let e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){let e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){let t=this.buf,i=t[this.pos++];if(i<128)return i;let r=i&127,a;return a=t[this.pos++],r|=(a&127)<<7,a<128||(a=t[this.pos++],r|=(a&127)<<14,a<128)||(a=t[this.pos++],r|=(a&127)<<21,a<128)?r:(a=t[this.pos],r|=(a&15)<<28,mD(r,e,this))}readSVarint(){let e=this.readVarint();return e%2==1?(e+1)/-2:e/2}readBoolean(){return!!this.readVarint()}readString(){let e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=12&&y1?y1.decode(this.buf.subarray(t,e)):_D(this.buf,t,e)}readBytes(){let e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t}readPackedVarint(e=[],t){let i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readVarint(t));return e}readPackedSVarint(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSVarint());return e}readPackedBoolean(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readBoolean());return e}readPackedFloat(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFloat());return e}readPackedDouble(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readDouble());return e}readPackedFixed32(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed32());return e}readPackedSFixed32(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed32());return e}readPackedFixed64(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed64());return e}readPackedSFixed64(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed64());return e}readPackedEnd(){return this.type===2?this.readVarint()+this.pos:this.pos+1}nextField(e=this.length){if(this.pos===this._valueStart&&this.skip(this.type),this.pos>=e)return 0;let t=this.readVarint();return this.type=t&7,this._valueStart=this.pos,t>>>3}skip(e){let t=e&7;if(t===0)for(;this.buf[this.pos++]>127;);else if(t===2)this.pos=this.readVarint()+this.pos;else if(t===5)this.pos+=4;else if(t===1)this.pos+=8;else throw Error(`Unimplemented type: ${t}`)}},Cf=class{constructor(e,{pixelRatio:t,version:i,isWebGLImage:r=!1,stretchX:a,stretchY:o,content:n,textFitWidth:s,textFitHeight:l}){this.paddedRect=e,this.pixelRatio=t,this.stretchX=a,this.stretchY=o,this.content=n,this.version=i,this.needsFirstWebGLRender=r,this.textFitWidth=s,this.textFitHeight=l}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}},TD=class{constructor(e,t){let i={},r={};this.haveRenderCallbacks=[],this.patchedUpdateVersion=-1;let a=[];this.addImages(e,i,a),this.addImages(t,r,a);let{w:o,h:n}=tx(a),s=new $e({width:o||1,height:n||1});for(let l in e){let u=e[l];if(u.isWebGLImage)continue;let c=i[l].paddedRect;$e.copy(u.data,s,{x:0,y:0},{x:c.x+1,y:c.y+1},u.data)}for(let l in t){let u=t[l],c=r[l].paddedRect,h=c.x+1,d=c.y+1,p=u.data.width,f=u.data.height;$e.copy(u.data,s,{x:0,y:0},{x:h,y:d},u.data),$e.copy(u.data,s,{x:0,y:f-1},{x:h,y:d-1},{width:p,height:1}),$e.copy(u.data,s,{x:0,y:0},{x:h,y:d+f},{width:p,height:1}),$e.copy(u.data,s,{x:p-1,y:0},{x:h-1,y:d},{width:1,height:f}),$e.copy(u.data,s,{x:0,y:0},{x:h+p,y:d},{width:1,height:f})}this.image=s,this.iconPositions=i,this.patternPositions=r}addImages(e,t,i){for(let r in e){let a=e[r],o={x:0,y:0,w:a.data.width+2,h:a.data.height+2};i.push(o),t[r]=new Cf(o,a),a.hasRenderCallback&&this.haveRenderCallbacks.push(r)}}patchUpdatedImages(e,t){if(e.dispatchRenderCallbacks(this.haveRenderCallbacks),this.patchedUpdateVersion!==e.updateVersion){this.patchedUpdateVersion=e.updateVersion;for(let i in this.iconPositions)this.patchUpdatedImage(this.iconPositions[i],e.getImage(i),t);for(let i in this.patternPositions)this.patchUpdatedImage(this.patternPositions[i],e.getImage(i),t)}}patchUpdatedImage(e,t,i){if(!e||!t||!e.needsFirstWebGLRender&&e.version===t.version)return;e.needsFirstWebGLRender=!1,e.version=t.version;let[r,a]=e.tl,o=t.userImage?.data;if(!mu(o)){i.update(t.data,void 0,{x:r,y:a});return}let{width:n,height:s}=t.data;i.context.setCustomLayerDefaults(),o.renderWithWebGL({gl:i.context.gl,texture:i.texture,x:r,y:a,width:n,height:s}),i.context.setDirty()}},ix,v1,T1=32640,vo,fl=class{constructor(e,t,i,r,a,o,n,s,l,u){if(this.boxStartIndex=e.length,l){let{top:c,bottom:h,collisionPadding:d}=o;d&&(c-=d[1],h+=d[3]);let p=h-c;p>0&&(p=Math.max(10,p),this.circleDiameter=p)}else{let c=o.image?.content&&(o.image.textFitWidth||o.image.textFitHeight)?cx(o):{x1:o.left,y1:o.top,x2:o.right,y2:o.bottom};c.y1=c.y1*n-s[0],c.y2=c.y2*n+s[2],c.x1=c.x1*n-s[3],c.x2=c.x2*n+s[1];let h=o.collisionPadding;if(h&&(c.x1-=h[0]*n,c.y1-=h[1]*n,c.x2+=h[2]*n,c.y2+=h[3]*n),u){let d=new D(c.x1,c.y1),p=new D(c.x2,c.y1),f=new D(c.x1,c.y2),m=new D(c.x2,c.y2),g=u*Math.PI/180;d._rotate(g),p._rotate(g),f._rotate(g),m._rotate(g),c.x1=Math.min(d.x,p.x,f.x,m.x),c.x2=Math.max(d.x,p.x,f.x,m.x),c.y1=Math.min(d.y,p.y,f.y,m.y),c.y2=Math.max(d.y,p.y,f.y,m.y)}e.emplaceBack(t.x,t.y,c.x1,c.y1,c.x2,c.y2,i,r,a)}this.boxEndIndex=e.length}},WD=class{constructor(e=[],t=(i,r)=>i<r?-1:+(i>r)){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,r=t[e];for(;e>0;){let a=e-1>>1,o=t[a];if(i(r,o)>=0)break;t[e]=o,e=a}t[e]=r}_down(e){let{data:t,compare:i}=this,r=this.length>>1,a=t[e];for(;e<r;){let o=(e<<1)+1,n=o+1;if(n<this.length&&i(t[n],t[o])<0&&(o=n),i(t[o],a)>=0)break;t[e]=t[o],e=o}t[e]=a}},so=class{constructor(e,t,i,r){this.p=new D(e,t),this.h=i,this.d=XD(this.p,r),this.max=this.d+this.h*Math.SQRT2}},up,Af=1/0,rA,hp=class{constructor(e){this.layoutVertexArray=new TT,this.indexArray=new xr,this.programConfigurations=e,this.segments=new tt,this.dynamicLayoutVertexArray=new ET,this.opacityVertexArray=new ST,this.hasVisibleVertices=!1,this.placedSymbolArray=new $v}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,t,i,r){this.isEmpty()||(i&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,yC.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,t),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,vC.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,rA,!0),this.opacityVertexBuffer.itemSize=1),(i||r)&&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())}},dp=class{constructor(e,t,i){this.layoutVertexArray=new e,this.layoutAttributes=t,this.indexArray=new i,this.segments=new tt,this.collisionVertexArray=new DT}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,xC.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}},yu=class{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((n)=>n.id),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasDependencies=!0,this.hasRTLText=!1,this.hasCursiveText=!1,this.maxHeightOffset=0,this.sortKeyRanges=[],this.collisionCircleArray=[],this.maxGlyphs=65535;let t=this.layers[0]._unevaluatedLayout._values;this.textSizeData=E1(this.zoom,t["text-size"]),this.iconSizeData=E1(this.zoom,t["icon-size"]);let i=this.layers[0].layout,r=i.get("symbol-sort-key"),a=i.get("symbol-z-order");this.canOverlap=gu(i,"text-overlap","text-allow-overlap")!=="never"||gu(i,"icon-overlap","icon-allow-overlap")!=="never"||i.get("text-ignore-placement")||i.get("icon-ignore-placement"),this.sortFeaturesByKey=a!=="viewport-y"&&!r.isConstant();let o=a==="viewport-y"||a==="auto"&&!this.sortFeaturesByKey;this.sortFeaturesByY=o&&this.canOverlap,i.get("symbol-placement")==="point"&&(this.writingModes=i.get("text-writing-mode").map((n)=>ix[n])),this.stateDependentLayerIds=this.layers.filter((n)=>n.isStateDependent()).map((n)=>n.id),this.sourceID=e.sourceID}createArrays(){this.text=new hp(new Ia(this.layers,this.zoom,(e)=>e.startsWith("text"))),this.icon=new hp(new Ia(this.layers,this.zoom,(e)=>e.startsWith("icon"))),this.glyphOffsetArray=new Gv,this.lineVertexArray=new Wv,this.symbolInstances=new qv,this.textAnchorOffsets=new Hv}calculateGlyphDependencies(e,t,i,r){let a=Ef.fromFeature(e,i,!1),o=a.graphemes();for(let n=0;n<o.length;n++){let s=a.getSection(n);if("imageName"in s)continue;t[s.fontStack]||={default:{},vertical:{}};let l=t[s.fontStack],u=o[n],c=r&&ID(u.codePointAt(0),this.allowVerticalPlacement);is(u)&&(l.default[u]=!0),c&&(l.vertical[u]=!0);for(let h of u){if(l.default[h]=!0,!r)continue;c&&is(u)&&(l.vertical[h]=!0);let d=co[h];d&&(l.default[d]=!0)}}}populate(e,t,i){let r=this.layers[0],a=r.layout,o=a.get("text-font"),n=a.get("text-field"),s=a.get("icon-image"),l=(n.value.kind!=="constant"||n.value.value instanceof Or&&!n.value.value.isEmpty()||n.value.value.toString().length>0)&&(o.value.kind!=="constant"||o.value.value.length>0),u=s.value.kind!=="constant"||!!s.value.value||Object.keys(s.parameters).length>0,c=a.get("symbol-sort-key"),h=a.get("symbol-placement")==="point";if(this.features=[],!l&&!u)return;let{iconDependencies:d,glyphDependencies:p,availableImages:f}=t,m=new Me(this.zoom),g=a.get("text-keep-upright");for(let{feature:_,id:y,index:v,sourceLayerIndex:x}of e){let b=r._featureFilter.needGeometry,w=Oa(_,b);if(!r._featureFilter.filter(m,w,i)||(b||(w.geometry=Ba(_)),h&&_.type===1&&nA(w.geometry)))continue;let T;if(l){let I=r.getValueAndResolveTokens("text-field",w,i,f),R=Or.factory(I);this.hasRTLText||=aA(R),this.hasCursiveText||=oA(R),T=ZC(R,r,w)}let E;if(u){let I=r.getValueAndResolveTokens("icon-image",w,i,f);E=I instanceof vr?I:vr.fromString(I)}if(!T&&!E)continue;let S=this.sortFeaturesByKey?c.evaluate(w,{},i):void 0,A={id:y,text:T,icon:E,index:v,sourceLayerIndex:x,geometry:w.geometry,properties:_.properties,type:fs.types[_.type],sortKey:S};if(this.features.push(A),E&&(d[E.name]=!0),T){let I=o.evaluate(w,{},i).join(","),R=a.get("text-rotation-alignment")!=="viewport"&&a.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes?.includes(2);let k=(R&&g||this.allowVerticalPlacement)&&sp(T.toString());this.calculateGlyphDependencies(T,p,I,k);for(let M of T.sections)M.image&&(d[M.image.name]=!0)}}a.get("symbol-placement")==="line"&&(this.features=XC(this.features)),this.sortFeaturesByKey&&this.features.sort((_,y)=>_.sortKey-y.sortKey)}update(e,t,i){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,t,this.layers,{imagePositions:i}),this.icon.programConfigurations.updatePaintArrays(e,t,this.layers,{imagePositions:i}))}addFeatures({options:e,canonical:t,glyphMap:i,glyphPositions:r,iconMap:a,iconPositions:o,showCollisionBoxes:n}){KD({bucket:this,glyphMap:i,glyphPositions:r,imageMap:a,imagePositions:o,showCollisionBoxes:n,canonical:t,subdivisionGranularity:e.subdivisionGranularity,hasPromoteId:e.featureIndex.promoteId!=null})}isEmpty(){return this.symbolInstances.length===0}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 r=e.dist(t[e.segment+1]),a=e.dist(t[e.segment]),o={};for(let n=e.segment+1;n<t.length;n++)o[n]={x:t[n].x,y:t[n].y,tileUnitDistanceFromAnchor:r},n<t.length-1&&(r+=t[n+1].dist(t[n]));for(let n=e.segment||0;n>=0;n--)o[n]={x:t[n].x,y:t[n].y,tileUnitDistanceFromAnchor:a},n>0&&(a+=t[n-1].dist(t[n]));for(let n=0;n<t.length;n++){let s=o[n];this.lineVertexArray.emplaceBack(s.x,s.y,s.tileUnitDistanceFromAnchor)}}return{lineStartIndex:i,lineLength:this.lineVertexArray.length-i}}addSymbols(e,t,i,r,a,o,n,s,l,u,c,h,d){let{indexArray:p,layoutVertexArray:f}=e,m=e.segments.prepareSegment(4*t.length,f,p,this.canOverlap?o.sortKey:void 0),g=this.glyphOffsetArray.length,_=m.vertexLength,y=this.allowVerticalPlacement&&n===2?Math.PI/2:0,v=o.text&&o.text.sections;for(let x=0;x<t.length;x++){let{tl:b,tr:w,bl:T,br:E,tex:S,pixelOffsetTL:A,pixelOffsetBR:I,minFontScaleX:R,minFontScaleY:k,glyphOffset:M,isSDF:C,sectionIndex:P}=t[x],B=m.vertexLength,N=M[1];ml(f,s.x,s.y,b.x,N+b.y,S.x,S.y,i,C,A.x,A.y,R,k,d),ml(f,s.x,s.y,w.x,N+w.y,S.x+S.w,S.y,i,C,I.x,A.y,R,k,d),ml(f,s.x,s.y,T.x,N+T.y,S.x,S.y+S.h,i,C,A.x,I.y,R,k,d),ml(f,s.x,s.y,E.x,N+E.y,S.x+S.w,S.y+S.h,i,C,I.x,I.y,R,k,d),_u(e.dynamicLayoutVertexArray,s,y),p.emplaceBack(B,B+2,B+1),p.emplaceBack(B+1,B+2,B+3),m.vertexLength+=4,m.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(M[0]),(x===t.length-1||P!==t[x+1].sectionIndex)&&e.programConfigurations.populatePaintArrays(f.length,o,o.index,{imagePositions:{},canonical:h,formattedSection:v?.[P]})}e.placedSymbolArray.emplaceBack(s.x,s.y,g,this.glyphOffsetArray.length-g,_,l,u,s.segment,i?i[0]:0,i?i[1]:0,r[0],r[1],n,0,!1,0,c,d)}_addCollisionDebugVertex(e,t,i,r,a,o){return t.emplaceBack(0,0),e.emplaceBack(i.x,i.y,r,a,Math.round(o.x),Math.round(o.y))}addCollisionDebugVertices(e,t,i,r,a,o,n){let s=a.segments.prepareSegment(4,a.layoutVertexArray,a.indexArray),l=s.vertexLength,{layoutVertexArray:u,collisionVertexArray:c}=a,{anchorX:h,anchorY:d}=n;this._addCollisionDebugVertex(u,c,o,h,d,new D(e,t)),this._addCollisionDebugVertex(u,c,o,h,d,new D(i,t)),this._addCollisionDebugVertex(u,c,o,h,d,new D(i,r)),this._addCollisionDebugVertex(u,c,o,h,d,new D(e,r)),s.vertexLength+=4;let p=a.indexArray;p.emplaceBack(l,l+1),p.emplaceBack(l+1,l+2),p.emplaceBack(l+2,l+3),p.emplaceBack(l+3,l),s.primitiveLength+=4}addDebugCollisionBoxes(e,t,i,r){for(let a=e;a<t;a++){let o=this.collisionBoxArray.get(a),{x1:n,y1:s,x2:l,y2:u}=o;this.addCollisionDebugVertices(n,s,l,u,r?this.textCollisionBox:this.iconCollisionBox,o.anchorPoint,i)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new dp(S0,n1.members,Od),this.iconCollisionBox=new dp(S0,n1.members,Od);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,r,a,o,n,s,l){let u={};for(let c=t;c<i;c++){let h=e.get(c);u.textBox={x1:h.x1,y1:h.y1,x2:h.x2,y2:h.y2,anchorPointX:h.anchorPointX,anchorPointY:h.anchorPointY},u.textFeatureIndex=h.featureIndex;break}for(let c=r;c<a;c++){let h=e.get(c);u.verticalTextBox={x1:h.x1,y1:h.y1,x2:h.x2,y2:h.y2,anchorPointX:h.anchorPointX,anchorPointY:h.anchorPointY},u.verticalTextFeatureIndex=h.featureIndex;break}for(let c=o;c<n;c++){let h=e.get(c);u.iconBox={x1:h.x1,y1:h.y1,x2:h.x2,y2:h.y2,anchorPointX:h.anchorPointX,anchorPointY:h.anchorPointY},u.iconFeatureIndex=h.featureIndex;break}for(let c=s;c<l;c++){let h=e.get(c);u.verticalIconBox={x1:h.x1,y1:h.y1,x2:h.x2,y2:h.y2,anchorPointX:h.anchorPointX,anchorPointY:h.anchorPointY},u.verticalIconFeatureIndex=h.featureIndex;break}return u}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),r=i.vertexStartIndex+i.numGlyphs*4;for(let a=i.vertexStartIndex;a<r;a+=4)e.indexArray.emplaceBack(a,a+2,a+1),e.indexArray.emplaceBack(a+1,a+2,a+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;let t=Math.sin(e),i=Math.cos(e),r=[],a=[],o=[];for(let n=0;n<this.symbolInstances.length;++n){o.push(n);let s=this.symbolInstances.get(n);r.push(Math.round(t*s.anchorX+i*s.anchorY)|0),a.push(s.featureIndex)}return o.sort((n,s)=>r[n]-r[s]||a[s]-a[n]),o}addToSortKeyRanges(e,t){let i=this.sortKeyRanges[this.sortKeyRanges.length-1];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);let r=[i.rightJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.leftJustifiedTextSymbolIndex];for(let a=0;a<r.length;a++){let o=r[a];o>=0&&r.indexOf(o)===a&&this.addIndicesForPlacedSymbol(this.text,o)}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)}}},lA,uA=()=>lA||=new Pt({"symbol-placement":new q(F.layout_symbol["symbol-placement"],"symbol-placement"),"symbol-spacing":new q(F.layout_symbol["symbol-spacing"],"symbol-spacing"),"symbol-avoid-edges":new q(F.layout_symbol["symbol-avoid-edges"],"symbol-avoid-edges"),"symbol-sort-key":new ae(F.layout_symbol["symbol-sort-key"],"symbol-sort-key"),"symbol-z-order":new q(F.layout_symbol["symbol-z-order"],"symbol-z-order"),"icon-allow-overlap":new q(F.layout_symbol["icon-allow-overlap"],"icon-allow-overlap"),"icon-overlap":new q(F.layout_symbol["icon-overlap"],"icon-overlap"),"icon-ignore-placement":new q(F.layout_symbol["icon-ignore-placement"],"icon-ignore-placement"),"icon-optional":new q(F.layout_symbol["icon-optional"],"icon-optional"),"icon-rotation-alignment":new ae(F.layout_symbol["icon-rotation-alignment"],"icon-rotation-alignment"),"icon-size":new ae(F.layout_symbol["icon-size"],"icon-size"),"icon-text-fit":new q(F.layout_symbol["icon-text-fit"],"icon-text-fit"),"icon-text-fit-padding":new q(F.layout_symbol["icon-text-fit-padding"],"icon-text-fit-padding"),"icon-image":new ae(F.layout_symbol["icon-image"],"icon-image"),"icon-rotate":new ae(F.layout_symbol["icon-rotate"],"icon-rotate"),"icon-padding":new ae(F.layout_symbol["icon-padding"],"icon-padding"),"icon-keep-upright":new q(F.layout_symbol["icon-keep-upright"],"icon-keep-upright"),"icon-offset":new ae(F.layout_symbol["icon-offset"],"icon-offset"),"icon-anchor":new ae(F.layout_symbol["icon-anchor"],"icon-anchor"),"icon-pitch-alignment":new q(F.layout_symbol["icon-pitch-alignment"],"icon-pitch-alignment"),"text-pitch-alignment":new q(F.layout_symbol["text-pitch-alignment"],"text-pitch-alignment"),"text-rotation-alignment":new q(F.layout_symbol["text-rotation-alignment"],"text-rotation-alignment"),"text-field":new ae(F.layout_symbol["text-field"],"text-field"),"text-font":new ae(F.layout_symbol["text-font"],"text-font"),"text-size":new ae(F.layout_symbol["text-size"],"text-size"),"text-max-width":new ae(F.layout_symbol["text-max-width"],"text-max-width"),"text-line-height":new q(F.layout_symbol["text-line-height"],"text-line-height"),"text-letter-spacing":new ae(F.layout_symbol["text-letter-spacing"],"text-letter-spacing"),"text-justify":new ae(F.layout_symbol["text-justify"],"text-justify"),"text-radial-offset":new ae(F.layout_symbol["text-radial-offset"],"text-radial-offset"),"text-variable-anchor":new q(F.layout_symbol["text-variable-anchor"],"text-variable-anchor"),"text-variable-anchor-offset":new ae(F.layout_symbol["text-variable-anchor-offset"],"text-variable-anchor-offset"),"text-anchor":new ae(F.layout_symbol["text-anchor"],"text-anchor"),"text-max-angle":new q(F.layout_symbol["text-max-angle"],"text-max-angle"),"text-writing-mode":new q(F.layout_symbol["text-writing-mode"],"text-writing-mode"),"text-rotate":new ae(F.layout_symbol["text-rotate"],"text-rotate"),"text-padding":new q(F.layout_symbol["text-padding"],"text-padding"),"text-keep-upright":new q(F.layout_symbol["text-keep-upright"],"text-keep-upright"),"text-transform":new ae(F.layout_symbol["text-transform"],"text-transform"),"text-offset":new ae(F.layout_symbol["text-offset"],"text-offset"),"text-allow-overlap":new q(F.layout_symbol["text-allow-overlap"],"text-allow-overlap"),"text-overlap":new q(F.layout_symbol["text-overlap"],"text-overlap"),"text-ignore-placement":new q(F.layout_symbol["text-ignore-placement"],"text-ignore-placement"),"text-optional":new q(F.layout_symbol["text-optional"],"text-optional"),"symbol-height-offset":new ae(F.layout_symbol["symbol-height-offset"],"symbol-height-offset"),"symbol-height-anchor":new q(F.layout_symbol["symbol-height-anchor"],"symbol-height-anchor")}),cA,hA=()=>cA||=new Pt({"icon-opacity":new ae(F.paint_symbol["icon-opacity"],"icon-opacity"),"icon-color":new ae(F.paint_symbol["icon-color"],"icon-color"),"icon-halo-color":new ae(F.paint_symbol["icon-halo-color"],"icon-halo-color"),"icon-halo-width":new ae(F.paint_symbol["icon-halo-width"],"icon-halo-width"),"icon-halo-blur":new ae(F.paint_symbol["icon-halo-blur"],"icon-halo-blur"),"icon-translate":new q(F.paint_symbol["icon-translate"],"icon-translate"),"icon-translate-anchor":new q(F.paint_symbol["icon-translate-anchor"],"icon-translate-anchor"),"text-opacity":new ae(F.paint_symbol["text-opacity"],"text-opacity"),"text-color":new ae(F.paint_symbol["text-color"],"text-color",{runtimeType:Xi,getOverride:(e)=>e.textColor,hasOverride:(e)=>!!e.textColor}),"text-halo-color":new ae(F.paint_symbol["text-halo-color"],"text-halo-color"),"text-halo-width":new ae(F.paint_symbol["text-halo-width"],"text-halo-width"),"text-halo-blur":new ae(F.paint_symbol["text-halo-blur"],"text-halo-blur"),"text-translate":new q(F.paint_symbol["text-translate"],"text-translate"),"text-translate-anchor":new q(F.paint_symbol["text-translate-anchor"],"text-translate-anchor")}),Ih,xx=class{constructor(e){if(e.property.overrides===void 0)throw Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:ns,this.defaultValue=e}evaluate(e){if(e.formattedSection){let t=this.defaultValue.property.overrides;if(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}},bx=(e)=>e.type==="symbol",dA,fA,mA=()=>fA||=new Pt({"background-color":new q(F.paint_background["background-color"],"background-color"),"background-pattern":new Ov(F.paint_background["background-pattern"],"background-pattern"),"background-opacity":new q(F.paint_background["background-opacity"],"background-opacity")}),gA,_A=(e)=>e.type==="background",yA,ic=(e)=>e.type==="custom",xA,TA,EA=class{constructor(e){this._imageManager=e,this._entries={},this._image=new $e({width:1,height:1}),this._dirty=!0}destroy(){this._texture&&=(this._texture.destroy(),null),this._entries={},this._image=new $e({width:1,height:1}),this._dirty=!0}getPixelSize(){let{width:e,height:t}=this._image;return{width:e,height:t}}getPattern(e){let t=this._imageManager.getImage(e);if(!t)return null;let i=this._entries[e];if(i?.image!==t){let r={w:t.data.width+2,h:t.data.height+2,x:0,y:0};this._entries[e]={bin:r,position:new Cf(r,t),image:t}}else if(i.position.version!==t.version)i.position.version=t.version;else return i.position;return this._update(),this._entries[e].position}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;let t=this.getPattern(e.from.toString()),i=this.getPattern(e.to.toString());return!t||!i}bind(e){let t=e.gl;this._texture?this._dirty&&=(this._texture.update(this._image),!1):(this._texture=new yt(e,this._image,t.RGBA),this._dirty=!1),this._texture.bind(t.LINEAR,t.CLAMP_TO_EDGE)}_update(){for(let a in this._entries)this._imageManager.getImage(a)||delete this._entries[a];let e=[];for(let a in this._entries)e.push(this._entries[a].bin);let{w:t,h:i}=tx(e),r=this._image;r.resize({width:t||1,height:i||1});for(let a in this._entries){let{bin:o}=this._entries[a],n=o.x+1,s=o.y+1,l=this._entries[a].image.data,{width:u,height:c}=l;$e.copy(l,r,{x:0,y:0},{x:n,y:s},{width:u,height:c}),$e.copy(l,r,{x:0,y:c-1},{x:n,y:s-1},{width:u,height:1}),$e.copy(l,r,{x:0,y:0},{x:n,y:s+c},{width:u,height:1}),$e.copy(l,r,{x:u-1,y:0},{x:n-1,y:s},{width:1,height:c}),$e.copy(l,r,{x:0,y:0},{x:n+u,y:s},{width:1,height:c})}this._dirty=!0}},pp=1114111,SA,CA=0,MA=class{constructor(e){this.requestManager=e,this._faces={},this._registered=new Set}setFontFaces(e){this._unregisterAll(),this._faces={};for(let[t,i]of Object.entries(e??{})){let r=Array.isArray(i)?i:[i];this._faces[t]=r.map((a)=>this._declareFontFace(t,a)).filter((a)=>a!==null)}}hasFontFaces(){return Object.keys(this._faces).length>0}async getFontFamily(e,t,i){for(let r of e.split(","))for(let a of this._faces[r.trim()]??[]){if(!AA(a,t))continue;a.loads.normal??=this._loadFontFace(a,"normal");let o=a.data,n=await a.loads.normal;if(n)return i==="normal"?n:(a.loads[i]??=this._loadFontFace(a,i,o),a.loads[i])}return null}_declareFontFace(e,t){let i=typeof t=="string"?{url:t}:t;if(typeof i?.url!="string")return he(`Ignoring the font face declared for "${e}": it has no URL.`),null;let r=`maplibre-gl-font-face-${CA++}`,a=i["unicode-range"];if(!a?.length)return{url:i.url,ranges:[SA],family:r,loads:{}};let o=[];for(let n of a){let s=DA(n);s?o.push(s):he(`Ignoring the unicode range "${n}" of the font face at ${i.url}: it is not a valid range.`)}return o.length?{url:i.url,ranges:o,family:r,loads:{}}:null}async _loadFontFace(e,t,i){let r=t==="normal"?"font face":`font face with "${t}" enabled`;if(typeof FontFace>"u"||typeof document>"u"||!document.fonts)return he(`Ignoring the ${r} at ${e.url}: this environment has no CSS Font Loading API.`),null;let a;try{i||=(e.data??=this._downloadFontFile(e.url),e.data);let o=t==="normal"?e.family:`${e.family}-${t}`;return a=new FontFace(o,await i,{featureSettings:t==="normal"?"normal":`"${t}" 1`}),!Object.values(this._faces).some((n)=>n.includes(e))||t!=="normal"&&(!a.featureSettings||a.featureSettings==="normal")?null:(document.fonts.add(a),this._registered.add(a),await a.load(),this._registered.has(a)?o:null)}catch(o){return a&&this._unregister(a),he(`Ignoring the ${r} at ${e.url}: ${Mt(o).message}`),null}finally{e.data===i&&delete e.data}}async _downloadFontFile(e){let t=await this.requestManager.transformRequest(e,"Glyphs"),i=await Cy(t,new AbortController);if(!i?.data)throw Error(`the response was empty for the font file at ${e}`);return i.data}_unregister(e){document.fonts?.delete(e),this._registered.delete(e)}_unregisterAll(){for(let e of Object.values(this._faces))for(let t of e)delete t.data;for(let e of this._registered)document.fonts?.delete(e);this._registered.clear()}destroy(){this._unregisterAll(),this._faces={}}},fp=100000000000000000000,Mf,PA=class{constructor({fontSize:e=24,buffer:t=3,radius:i=8,cutoff:r=0.25,fontFamily:a="sans-serif",fontWeight:o="normal",fontStyle:n="normal",lang:s=null}={}){t=this.buffer=Math.round(t),this.radius=i,this.cutoff=r,this.lang=s;let l=this.size=Math.ceil(e)+t*4,u=this._createCanvas(l),c=this.ctx=u.getContext("2d",{willReadFrequently:!0});c.font=`${n} ${o} ${e}px ${a}`,c.textBaseline="alphabetic",c.textAlign="left",c.fillStyle="black",s&&(c.lang=s);let h=(this.maxGlyphDim=l-t)+2*t;this.gridOuter=new Float64Array(h*h),this.gridInner=new Float64Array(h*h),this.f=new Float64Array(h),this.z=new Float64Array(h+1),this.v=new Uint16Array(h)}_createCanvas(e){if(typeof OffscreenCanvas<"u")return new OffscreenCanvas(e,e);let t=document.createElement("canvas");return t.width=t.height=e,t}draw(e){let{width:t,actualBoundingBoxAscent:i,actualBoundingBoxDescent:r,actualBoundingBoxLeft:a,actualBoundingBoxRight:o}=this.ctx.measureText(e),n=Math.ceil(i),s=Math.floor(-a),l=Math.max(0,Math.min(this.maxGlyphDim,Math.ceil(o)-s)),u=Math.max(0,Math.min(this.maxGlyphDim,n+Math.ceil(r))),c=l+2*this.buffer,h=u+2*this.buffer,d=c*h,p=new Uint8ClampedArray(d),f={data:p,width:c,height:h,glyphWidth:l,glyphHeight:u,glyphTop:n,glyphLeft:s,glyphAdvance:t};if(l===0||u===0)return f;let{ctx:m,buffer:g,gridInner:_,gridOuter:y}=this;m.clearRect(g,g,l,u),m.fillText(e,g-s,g+n);let v=m.getImageData(g,g,l,u);y.fill(fp,0,d),_.fill(0,0,d);let x=3;for(let E=0;E<u;E++){let S=(E+g)*c+g;for(let A=0;A<l;A++,x+=4,S++){let I=v.data[x];if(I===0)continue;let R=Mf[I];y[S]=Math.max(0,R),_[S]=Math.max(0,-R)}}P1(y,0,0,c,h,c,this.f,this.v,this.z,g);let b=Math.min(g,1);P1(_,g-b,g-b,l+2*b,u+2*b,c,this.f,this.v,this.z);let w=255/this.radius,T=255*(1-this.cutoff);for(let E=0;E<d;E++){let S=Math.sqrt(y[E])-Math.sqrt(_[E]);p[E]=T-w*S}return f}},IA,kA=(e,t)=>{let i=new PA(e);return i.buffer=t,i},k1,RA=class{constructor(e,t,i,r=kA){this.rasterizedGlyphs=new WeakMap,this.requestManager=e,this.localIdeographFontFamily=t,this.entries={},this.lang=i,this.fontFaceManager=new MA(e),this.createRasterizer=r}setURL(e){this.url=e}setFontFaces(e){this.fontFaceManager.setFontFaces(e),this.entries={}}async getGlyphs(e){let t=[],i=this.fontFaceManager.hasFontFaces();for(let o in e)for(let n in e[o])if(!k1[n]||i)for(let s of e[o][n])t.push(this._getAndCacheGlyphsPromise(o,s,n));let r=await Promise.all(t),a={};for(let{stack:o,id:n,variant:s,glyph:l}of r)a[o]||={},a[o][s]||={},a[o][s][n]=l&&{id:l.id,bitmap:l.bitmap.clone(),metrics:l.metrics};return a}async _getAndCacheGlyphsPromise(e,t,i){this.entries[e]??={glyphs:{default:{}},requests:{}};let r=this.entries[e],a=r.glyphs[i]||={},o=a[t];if(o!==void 0)return{stack:e,id:t,variant:i,glyph:o};if(i!=="default"){let l=k1[i];return o=l?await this._drawAlternateGlyph(r,e,t,l):null,a[t]=o,{stack:e,id:t,variant:i,glyph:o}}let n=t.codePointAt(0),s=this.fontFaceManager.hasFontFaces()?await this.fontFaceManager.getFontFamily(e,n,"normal"):null;return s?(o=await this._drawGlyph(r,e,t,s),a[t]=o,{stack:e,id:t,variant:i,glyph:o}):!this.url||is(t)||this._charUsesLocalIdeographFontFamily(n)||SC(n)?(o=await this._drawGlyph(r,e,t),a[t]=o,{stack:e,id:t,variant:i,glyph:o}):{...await this._downloadAndCacheRangePromise(e,t),variant:i}}async _drawAlternateGlyph(e,t,i,r){let a=await this._getFontFaceTinySDF(e,t,i,r);if(!a||this.entries[t]!==e)return null;let o=a.draw(i);if(!o.glyphWidth||!o.glyphHeight)return null;let n=await this._getFontFaceTinySDF(e,t,i,"normal");if(!n||this.entries[t]!==e)return null;let s=this._createGlyph(i,o);return FA(this._getRasterizedGlyph(n,i),s)?null:s}async _downloadAndCacheRangePromise(e,t){let i=t.codePointAt(0),r=this.entries[e],a=Math.floor(i/256);r.requests[a]||=this._loadGlyphRange(e,a);try{let o=(await r.requests[a])[i]||null;return r.glyphs.default[t]=o,{stack:e,id:t,glyph:o}}catch(o){let n=await this._drawGlyph(r,e,t);return r.glyphs.default[t]=n,this._warnOnMissingGlyphRange(n,a,i,Mt(o)),{stack:e,id:t,glyph:n}}}async _loadGlyphRange(e,t){let i=t*256,r=i+255,a=await this.requestManager.transformRequest(this.url.replace("{fontstack}",e).replace("{range}",`${i}-${r}`),"Glyphs"),o=await Cy(a,new AbortController);if(!o?.data)throw Error(`Could not load glyph range. range: ${t}, ${i}-${r}`);let n={};for(let s of bD(o.data))n[s.id]=s;return n}_warnOnMissingGlyphRange(e,t,i,r){let a=t*256;he(`Unable to load glyph range ${t}, ${a}-${a+255}. Rendering codepoint U+${i.toString(16).padStart(4,"0").toUpperCase()} locally instead. ${r}`)}_charUsesLocalIdeographFontFamily(e){return!!this.localIdeographFontFamily&&CC(e)}async _drawGlyph(e,t,i,r){let a=await this._getTinySDF(e,t,i,r);return this._getRasterizedGlyph(a,i)}_getRasterizedGlyph(e,t){let i=this.rasterizedGlyphs.get(e);return i||(i={},this.rasterizedGlyphs.set(e,i)),i[t]??=this._createGlyph(t,e.draw(t)),i[t]}_createGlyph(e,t){let i=/^\p{gc=Cf}+$/u.test(e);return{id:e.codePointAt(0),bitmap:new bf({width:t.width||60,height:t.height||60},t.data),metrics:{width:i?0:t.glyphWidth/2||24,height:t.glyphHeight/2||24,left:t.glyphLeft/2+0.5||0,top:t.glyphTop/2-27.5||-8,advance:i?0:t.glyphAdvance/2||24,isDoubleResolution:!0}}}async _getFontFaceTinySDF(e,t,i,r){if(this.entries[t]!==e)return null;let a=await this.fontFaceManager.getFontFamily(t,i.codePointAt(0),r);return!a||this.entries[t]!==e?null:this._getTinySDF(e,t,i,a)}_getTinySDF(e,t,i,r){let a=is(i);if(r){let l=a?"clusterTinySDFs":"fontFaceTinySDFs";return e[l]??={},e[l][r]||=this._createTinySDF(r,!1,a?3:1),e[l][r]}let o=t===IA&&this.localIdeographFontFamily!==""&&this._charUsesLocalIdeographFontFamily(i.codePointAt(0)),n=o?this.localIdeographFontFamily:t;if(a)return e.clusterTinySDFs??={},e.clusterTinySDFs[n]||=this._createTinySDF(n,!0,3),e.clusterTinySDFs[n];let s=o?"ideographTinySDF":"tinySDF";return e[s]||=this._createTinySDF(n),e[s]}async _createTinySDF(e,t=!0,i=1){let r=e?e.split(","):[];r.push("sans-serif");let a=r.map((s)=>/[-\w]+/.test(s)?s:`'${CSS.escape(s)}'`).join(","),o=t?this._fontWeight(r[0]):void 0,n=t?this._fontStyle(r[0]):"normal";if(typeof document<"u"&&document.fonts?.load)try{await document.fonts.load(`${n} ${o||"normal"} 48px ${a}`)}catch(s){he(`Failed to load font "${a}": ${Mt(s).message}`)}return this.createRasterizer({fontSize:48,buffer:Math.max(6,Math.ceil(48*(i-1)/4)),radius:16,cutoff:0.25,fontFamily:a,fontWeight:o,fontStyle:n,lang:this.lang},6)}_fontStyle(e){return/italic/i.test(e)?"italic":/oblique/i.test(e)?"oblique":"normal"}_fontWeight(e){let t={thin:100,hairline:100,"extra light":200,"ultra light":200,light:300,normal:400,regular:400,medium:500,semibold:600,demibold:600,bold:700,"extra bold":800,"ultra bold":800,black:900,heavy:900,"extra black":950,"ultra black":950},i;for(let[r,a]of Object.entries(t))RegExp(`\\b${r}\\b`,"i").test(e)&&(i=`${a}`);return i}destroy(){for(let e in this.entries){let t=this.entries[e];t.tinySDF=null,t.ideographTinySDF=null,t.fontFaceTinySDFs={},t.glyphs={default:{}},t.requests={}}this.entries={},this.fontFaceManager.destroy()}},zA,LA=()=>zA||=new Pt({anchor:new q(F.light.anchor,"anchor"),position:new q(F.light.position,"position"),color:new q(F.light.color,"color"),intensity:new q(F.light.intensity,"intensity")}),BA,OA,jA=()=>OA||=new Pt({"sky-color":new q(F.sky["sky-color"],"sky-color"),"horizon-color":new q(F.sky["horizon-color"],"horizon-color"),"fog-color":new q(F.sky["fog-color"],"fog-color"),"fog-ground-blend":new q(F.sky["fog-ground-blend"],"fog-ground-blend"),"horizon-fog-blend":new q(F.sky["horizon-fog-blend"],"horizon-fog-blend"),"sky-horizon-blend":new q(F.sky["sky-horizon-blend"],"sky-horizon-blend"),"atmosphere-blend":new q(F.sky["atmosphere-blend"],"atmosphere-blend")}),NA,$A=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.addDash(e,t),this.dashEntry[i]}getDashRanges(e,t,i){let r=e.length%2==1,a=[],o=r?-e[e.length-1]*i:0,n=e[0]*i,s=!0;a.push({left:o,right:n,isDash:s,zeroLength:e[0]===0});let l=e[0];for(let u=1;u<e.length;u++){s=!s;let c=e[u];o=l*i,l+=c,n=l*i,a.push({left:o,right:n,isDash:s,zeroLength:c===0})}return a}addRoundDash(e,t,i){let r=t/2;for(let a=-i;a<=i;a++){let o=this.nextRow+i+a,n=this.width*o,s=0,l=e[s];for(let u=0;u<this.width;u++){u/l.right>1&&(l=e[++s]);let c=Math.abs(u-l.left),h=Math.abs(u-l.right),d=Math.min(c,h),p,f=a/i*(r+1);if(l.isDash){let m=r-Math.abs(f);p=Math.sqrt(d*d+m*m)}else p=r-Math.sqrt(d*d+f*f);this.data[n+u]=Math.max(0,Math.min(255,p+128))}}}addRegularDash(e){for(let n=e.length-1;n>=0;--n){let s=e[n],l=e[n+1];s.zeroLength?e.splice(n,1):l?.isDash===s.isDash&&(l.left=s.left,e.splice(n,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 r=this.width*this.nextRow,a=0,o=e[a];for(let n=0;n<this.width;n++){n/o.right>1&&(o=e[++a]);let s=Math.abs(n-o.left),l=Math.abs(n-o.right),u=Math.min(s,l),c=o.isDash?u:-u;this.data[r+n]=Math.max(0,Math.min(255,c+128))}}addDash(e,t){let i=t?7:0,r=2*i+1;if(this.nextRow+r>this.height)return he("LineAtlas out of space"),null;let a=0;for(let n of e)a+=n;if(a!==0){let n=this.width/a,s=this.getDashRanges(e,this.width,n);t?this.addRoundDash(s,n,i):this.addRegularDash(s)}let o={y:this.nextRow+i,height:2*i,width:a};return this.nextRow+=r,this.dirty=!0,o}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))}},UA,Sx=class{constructor(e,t,i,r){this.bounds=Nr.convert(this.validateBounds(e)),this.minzoom=t||0,this.maxzoom=i||24,this._worldBox=h2(r,this.bounds.getWest(),this.bounds.getSouth(),this.bounds.getEast(),this.bounds.getNorth())}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=2**e.z,i={minX:Math.floor(this._worldBox.minX*t),minY:Math.floor(this._worldBox.minY*t),maxX:Math.ceil(this._worldBox.maxX*t),maxY:Math.ceil(this._worldBox.maxY*t)};return e.x>=i.minX&&e.x<i.maxX&&e.y>=i.minY&&e.y<i.maxY}},KA,Cx,JA,nM=class{constructor(e){this._waiting=[],this._sending=!1,this._replacedWhileSending=!1,this._handlers=e}isIdle(){return!this._sending&&this._waiting.length===0}top(){return this._waiting.length?this._waiting[this._waiting.length-1]:void 0}some(e){return this._waiting.some(e)}enqueue(e){this._waiting.push(e)}replace(e){this._waiting=[e],this._replacedWhileSending=this._sending}clear(){this._waiting=[]}flush(){if(this.isIdle())return Promise.resolve();if(!this._flushing){let t,i=new Promise((r)=>{t=r});this._flushing={promise:i,resolve:t}}let{promise:e}=this._flushing;return this._next(),e}_next(){if(this._sending)return;let e=this._waiting.shift();e===void 0?(this._flushing?.resolve(),this._flushing=void 0):(this._sending=!0,this._replacedWhileSending=!1,this._send(e).finally(()=>this._next()))}async _send(e){let t;try{t=await this._handlers.send(e)}catch(i){this._sending=!1,this._handlers.onError(e,i);return}this._sending=!1;try{this._handlers.onResult(e,t,this._replacedWhileSending)}catch(i){this._handlers.onError(e,i)}}},sM=class{constructor(e){this.wraps=!1,this._crs=e,this._originX=e.tileMatrixSet.origin[0],this._originY=e.tileMatrixSet.origin[1],this._extent=e.tileMatrixSet.extentAtZoom0}get name(){return this._crs.name}get tileMatrixSet(){return this._crs.tileMatrixSet}worldFromLngLat(e,t,i){let[r,a]=this._crs.projection.forward([e,t]);return new Ot((r-this._originX)/this._extent,(this._originY-a)/this._extent,i===void 0?0:i/this._extent)}lngLatFromWorld(e,t){let i=H(e,0,1),r=H(t,0,1),a=this._inverse(e,t)??this._inverse(i,r)??this._inverseTowardCenter(i,r)??this._finiteInverse(i,r);if(!a)throw Error(`The inverse of the projection "${this._crs.name}" has no answer inside its tile matrix set.`);return new Y(a[0],H(a[1],-90,90))}hasLngLat(e,t){let i=this._inverse(e,t);return i!==null&&Math.abs(i[1])<=90}_inverse(e,t){let i=this._finiteInverse(e,t);if(!i)return null;let r=this._originX+e*this._extent,a=this._originY-t*this._extent,[o,n]=this._crs.projection.forward(i);return Math.hypot(o-r,n-a)<=0.001*this._extent?i:null}_finiteInverse(e,t){let i;try{i=this._crs.projection.inverse([this._originX+e*this._extent,this._originY-t*this._extent])}catch{return null}return i&&Number.isFinite(i[0])&&Number.isFinite(i[1])?i:null}_inverseTowardCenter(e,t){let i=0,r=1;for(let a=0;a<30;a++){let o=(i+r)/2;this._inverse(0.5+(e-0.5)*o,0.5+(t-0.5)*o)?i=o:r=o}return this._inverse(0.5+(e-0.5)*i,0.5+(t-0.5)*i)}metersPerWorldUnit(e,t){return this._extent}worldZFromAltitude(e,t){return e/this._extent}get latitudeRange(){return this._latitudeRange??=[this._findLatitudeLimit(-90),this._findLatitudeLimit(90)],this._latitudeRange}_findLatitudeLimit(e){let t=this.lngLatFromWorld(0.5,0.5),i=10*this._meridianStretch(t.lng,t.lat);if(!(i>0))return e;let r=Math.sign(e-t.lat);for(let a=t.lat;Math.abs(e-a)>1;a+=r)if(!(this._meridianStretch(t.lng,a+r)<=i))return a;return e}_meridianStretch(e,t){let[i,r]=this._crs.projection.forward([e,t]),[a,o]=this._crs.projection.forward([e,t>=0?t-0.01:t+0.01]);return Math.hypot(a-i,o-r)}},lM=class{forward(e){return[e[0],e[1]]}inverse(e){return[e[0],e[1]]}},mp,uM,cM,xo,hM=(e,t)=>({u_tl_parent:new pe(e,t.u_tl_parent),u_scale_parent:new G(e,t.u_scale_parent),u_buffer_scale:new G(e,t.u_buffer_scale),u_image_warp:new Kt(e,t.u_image_warp),u_fade_t:new G(e,t.u_fade_t),u_opacity:new G(e,t.u_opacity),u_image0:new te(e,t.u_image0),u_image1:new te(e,t.u_image1),u_brightness_low:new G(e,t.u_brightness_low),u_brightness_high:new G(e,t.u_brightness_high),u_saturation_factor:new G(e,t.u_saturation_factor),u_contrast_factor:new G(e,t.u_contrast_factor),u_spin_weights:new Kt(e,t.u_spin_weights),u_coords_top:new Io(e,t.u_coords_top),u_coords_bottom:new Io(e,t.u_coords_bottom)}),dM=(e,t,i,r,a,o)=>({u_tl_parent:e,u_scale_parent:t,u_buffer_scale:1,u_image_warp:o,u_fade_t:i.mix,u_opacity:i.opacity*r.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:r.paint.get("raster-brightness-min"),u_brightness_high:r.paint.get("raster-brightness-max"),u_saturation_factor:mM(r.paint.get("raster-saturation")),u_contrast_factor:fM(r.paint.get("raster-contrast")),u_spin_weights:pM(r.paint.get("raster-hue-rotate")),u_coords_top:[a[0].x,a[0].y,a[1].x,a[1].y],u_coords_bottom:[a[3].x,a[3].y,a[2].x,a[2].y]}),as=class{constructor(e,t,i){this.vertexBuffer=e,this.indexBuffer=t,this.segments=i}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}},ho,gs,bM,wM,TM,EM=(e,t,i,r)=>{let a=new(SM(t.type))(e,t,i,r);if(a.id!==e)throw Error(`Expected Source id to be ${e} instead of ${a.id}`);return a},SM=(e)=>{switch(e){case"geojson":return cM;case"image":return gs;case"raster":return Cx;case"raster-dem":return JA;case"vector":return KA;case"video":return bM;case"canvas":return wM}return TM[e]},zl="_geojsonTileLayer",DM=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 Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}},Px,Va=class{constructor(e,t,i){this._name=e,this.dataBuffer=t,typeof i=="number"?this._size=i:(this.nullabilityBuffer=i,this._size=i.size())}getValue(e){return this.nullabilityBuffer&&!this.nullabilityBuffer.get(e)?null:this.getValueFromBuffer(e)}has(e){return this.nullabilityBuffer?.get(e)||!this.nullabilityBuffer}get name(){return this._name}get size(){return this._size}},ac,Pf,If,Ix,kf,Ff,AM=class{constructor(e,t,i,r,a=4096){if(this._name=e,this._geometryVector=t,this._idVector=i,this._propertyVectors=r,this._extent=a,e.length===0)throw Error("Missing layer name")}get name(){return this._name}get idVector(){return this._idVector}get geometryVector(){return this._geometryVector}get propertyVectors(){return this._propertyVectors??[]}getPropertyVector(e){return this.propertyVectorsMap||=new Map(this.propertyVectors.map((t)=>[t.name,t])),this.propertyVectorsMap.get(e)}get numFeatures(){return this.geometryVector.numGeometries}get extent(){return this._extent}getFeatures(){let e=[],t=this.geometryVector.getGeometries();for(let i=0;i<this.numFeatures;i++){let r;if(this.idVector){let n=this.idVector.getValue(i);n!==null&&(r=this.containsMaxSafeIntegerValues(this.idVector)?Number(n):n)}let a={coordinates:t[i],type:this.geometryVector.geometryType(i)},o={};for(let n of this.propertyVectors){if(!n)continue;let s=n.name,l=n.getValue(i);l!==null&&(o[s]=l)}e.push({id:r,geometry:a,properties:o})}return e}containsMaxSafeIntegerValues(e){return e instanceof Pf||e instanceof Ff||e instanceof kf||e instanceof If}},xn,Se,ia,kx,Fx=class{constructor(e){this.value=e}get(){return this.value}set(e){this.value=e}increment(){return this.value++}add(e){this.value+=e}},fe,Oi,Rf,gp,zf=65536,_p,QM,mt,Ht,Rr,bt,UP,j1,qP,GP,WP,ZP,Ge,Qi=class{constructor(e,t){this.values=e,this._size=t}get(e){let t=Math.floor(e/8),i=e%8;return(this.values[t]>>i&1)==1}set(e,t){let i=Math.floor(e/8),r=e%8;this.values[i]=this.values[i]|+!!t<<r}getInt(e){let t=Math.floor(e/8),i=e%8;return this.values[t]>>i&1}size(){return this._size}getBuffer(){return this.values}},t8,Zx,Hx,Lt,p8,Ua,Xx=class{constructor(e,t,i,r,a){this._vertexBufferType=e,this._topologyVector=t,this._vertexOffsets=i,this._vertexBuffer=r,this._mortonSettings=a}get vertexBufferType(){return this._vertexBufferType}get topologyVector(){return this._topologyVector}get vertexOffsets(){return this._vertexOffsets}get vertexBuffer(){return this._vertexBuffer}getSimpleEncodedVertex(e){let t=this.vertexOffsets?this.vertexOffsets[e]*2:e*2;return[this.vertexBuffer[t],this.vertexBuffer[t+1]]}getVertex(e){if(this.vertexOffsets&&this.mortonSettings){let i=this.vertexOffsets[e],r=this.vertexBuffer[i],a=$f(r,this.mortonSettings.numBits,this.mortonSettings.coordinateShift);return[a.x,a.y]}let t=this.vertexOffsets?this.vertexOffsets[e]*2:e*2;return[this.vertexBuffer[t],this.vertexBuffer[t+1]]}getGeometries(){return f8(this)}get mortonSettings(){return this._mortonSettings}},Yx,Jx,Qx,x8,b8,S8,C8,eb,Uf,q1,bo,tb,G1,zr,Ta,xt,eI,Z1="0-3(ID), 4(GEOMETRY), 10-29(scalars), 30(STRUCT), 31(MAP)",Rh,nI=class{constructor(e,t){switch(this._featureData=e,this.properties=this._featureData.properties||{},this._featureData.geometry?.type){case Lt.POINT:case Lt.MULTIPOINT:this.type=1;break;case Lt.LINESTRING:case Lt.MULTILINESTRING:this.type=2;break;case Lt.POLYGON:case Lt.MULTIPOLYGON:this.type=3;break;default:this.type=0}this.extent=t,this.id=Number(this._featureData.id)}loadGeometry(){let e=[];for(let t of this._featureData.geometry.coordinates){let i=[];for(let r of t)i.push(new D(r.x,r.y));e.push(i)}return e}},sI=class{constructor(e){this.features=[],this.featureTable=e,this.name=e.name,this.extent=e.extent,this.version=2,this.features=e.getFeatures(),this.length=this.features.length}feature(e){return new nI(this.features[e],this.extent)}},lI=class{constructor(e){this.layers={};let t=aI(new Uint8Array(e));this.layers=t.reduce((i,r)=>({...i,[r.name]:new sI(r)}),{})}},xp="RTLPluginLoaded",hI,X1=null,lb=class{constructor(e,t){this.timeAdded=0,this.fadeEndTime=0,this.fadeOpacity=1,this.tileID=e,this.uid=vy(),this.uses=0,this.tileSize=t,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rttObjects=[],this.rttFingerprint={},this.expiredRequestCount=0,this.state="loading",this.featureStateRevision=-1}isRenderable(e){return this.hasData()&&(!this.fadeEndTime||this.fadingDirection!==0||this.fadeOpacity>0)&&(e||!this.holdingForSymbolFade())}setCrossFadeLogic({fadingRole:e,fadingDirection:t,fadingParentID:i,fadeEndTime:r}){this.resetFadeLogic(),this.fadingRole=e,this.fadingDirection=t,this.fadingParentID=i,this.fadeEndTime=r}setSelfFadeLogic(e){this.resetFadeLogic(),this.selfFading=!0,this.fadeEndTime=e}resetFadeLogic(){this.fadingRole=null,this.fadingDirection=null,this.fadingParentID=null,this.selfFading=!1,this.timeAdded=Fe(),this.fadeEndTime=0,this.fadeOpacity=1}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(e){this.demTexture&&e.saveTileTexture(this.demTexture),this.demTexture=null}getRTT(e){return this.rttObjects[e]}acquireRTT(e,t,i){return this.rttObjects[t]=e.acquireRTT(i)}releaseRTT(e){if(this.rttObjects.length!==0){for(let t of this.rttObjects)t&&e.releaseRTT(t);this.rttObjects.length=0}}releaseRTTStack(e,t){let i=this.rttObjects[t];i&&(e.releaseRTT(i),this.rttObjects[t]=void 0)}loadVectorData(e,t,i){if(e?.etagUnmodified===!0)this.state="loaded";else if(this.hasData()&&this.unloadVectorData(),this.state="loaded",!e)this.collisionBoxArray=new Nv;else{e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestEncoding=e.encoding,this.latestFeatureIndex.rawTileData=e.rawTileData,this.latestFeatureIndex.encoding=e.encoding):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData,this.latestFeatureIndex.encoding=this.latestEncoding)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=CM(e.buckets,t),this.hasSymbolBuckets=!1;for(let r in this.buckets){let a=this.buckets[r];if(a instanceof yu)if(this.hasSymbolBuckets=!0,i)a.justReloaded=!0;else break}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let r in this.buckets){let a=this.buckets[r];if(a instanceof yu&&a.hasRTLText){this.hasRTLText=!0,bp().lazyLoad();break}}this.queryPadding=0;for(let r in this.buckets){let a=this.buckets[r];this.queryPadding=Math.max(this.queryPadding,t.getLayer(r).queryRadius(a))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage),this.dashPositions=e.dashPositions}}unloadVectorData(){for(let e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.imageAtlas=null,this.dashPositions=null,this.latestFeatureIndex=null,this.state="unloaded"}getBucket(e){return this.buckets[e.id]}upload(e){for(let i in this.buckets){let r=this.buckets[i];r.uploadPending()&&r.upload(e)}let t=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new yt(e,this.imageAtlas.image,t.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&=(this.glyphAtlasTexture=new yt(e,this.glyphAtlasImage,t.ALPHA),null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,t,i,r,a,o,n,s,l,u,c){return this.latestFeatureIndex?.rawTileData?this.latestFeatureIndex.query({queryGeometry:r,cameraQueryGeometry:a,scale:o,tileSize:this.tileSize,projectedCamera:s,worldCoordinateHelper:l,params:n,queryPadding:this.queryPadding*u,getElevation:c},e,t,i):{}}querySourceFeatures(e,t){let i=this.latestFeatureIndex;if(!i?.rawTileData)return;let r=i.loadVTLayers(),a=t.sourceLayer?t.sourceLayer:"",o=r._geojsonTileLayer||r[a];if(!o)return;let n=Un(t.filter,`querySourceFeatures[${a}].filter`,t.globalState),{z:s,x:l,y:u}=this.tileID.canonical,c={z:s,x:l,y:u};for(let h=0;h<o.length;h++){let d=o.feature(h);if(n.needGeometry){let f=Oa(d,!0);if(!n.filter(new Me(this.tileID.overscaledZ),f,this.tileID.canonical))continue}else if(!n.filter(new Me(this.tileID.overscaledZ),d))continue;let p=new Px(d,s,l,u,i.getId(d,a),t.worldCoordinateHelper);p.tile=c,e.push(p)}}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=e3(e.cacheControl);i["max-age"]&&(this.expirationTime=Date.now()+i["max-age"]*1000)}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){let i=Date.now(),r=!1;if(this.expirationTime>i)r=!1;else if(!t)r=!0;else if(this.expirationTime<t)r=!0;else{let a=this.expirationTime-t;a?this.expirationTime=i+Math.max(a,30000):r=!0}r?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1000*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),2147483647)}setFeatureState(e,t,i){if(!this.latestFeatureIndex?.rawTileData||Object.keys(e).length===0||this.featureStateRevision===i)return;this.featureStateRevision=i;let r=this.latestFeatureIndex.loadVTLayers();for(let a in this.buckets){if(!t.hasLayer(a))continue;let o=this.buckets[a],n=o.layers[0].sourceLayer||"_geojsonTileLayer",s=r[n],l=e[n];if(!s||!l||l.length===0)continue;o.update(l,s,this.imageAtlas?.patternPositions||{},this.dashPositions||{});let u=t.getLayer(a);u&&(this.queryPadding=Math.max(this.queryPadding,u.queryRadius(o)))}}holdingForSymbolFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<Fe()}clearSymbolFadeHold(){this.symbolFadeHoldUntil=void 0}setSymbolHoldDuration(e){this.symbolFadeHoldUntil=Fe()+e}setDependencies(e,t){let i={};for(let r of t)i[r]=!0;this.dependencies[e]=i}hasDependency(e,t){for(let i of e){let r=this.dependencies[i];if(r){for(let a of t)if(r[a])return!0}}return!1}},dI=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 r=e.wrapped().key;this.data[r]===void 0&&(this.data[r]=[]);let a={value:t,timeout:void 0};if(i!==void 0&&(a.timeout=setTimeout(()=>{this.remove(e,a)},i)),this.data[r].push(a),this.order.push(r),this.order.length>this.max){let o=this._getAndRemoveByKey(this.order[0]);o&&this.onRemove(o)}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,r=t===void 0?0:this.data[i].indexOf(t),a=this.data[i][r];return this.data[i].splice(r,1),a.timeout&&clearTimeout(a.timeout),this.data[i].length===0&&delete this.data[i],this.onRemove(a.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 r of this.data[i])e(r.value)||t.push(r);for(let i of t)this.remove(i.value.tileID,i)}},pI=class{constructor(){this.state={},this.stateChanges={},this.deletedStates={},this.revision=0}updateState(e,t,i){let r=String(t);if(this.stateChanges[e]||={},this.stateChanges[e][r]||={},ee(this.stateChanges[e][r],i),this.deletedStates[e]===null){this.deletedStates[e]={};for(let a in this.state[e])if(a===r){this.deletedStates[e][r]={};for(let o in this.state[e][a])i[o]===void 0&&(this.deletedStates[e][r][o]=null)}else this.deletedStates[e][a]=null}else if(this.deletedStates[e]?.[r]===null){this.deletedStates[e][r]={};for(let a in this.state[e][r])i[a]===void 0&&(this.deletedStates[e][r][a]=null)}else for(let a in i)this.deletedStates[e]?.[r]?.[a]===null&&delete this.deletedStates[e][r][a]}removeFeatureState(e,t,i){if(this.deletedStates[e]===null)return;let r=String(t);if(this.deletedStates[e]||={},i&&t!==void 0)this.deletedStates[e][r]!==null&&(this.deletedStates[e][r]||={},this.deletedStates[e][r][i]=null);else if(t!==void 0)if(this.stateChanges[e]?.[r])for(i in this.deletedStates[e][r]={},this.stateChanges[e][r])this.deletedStates[e][r][i]=null;else this.deletedStates[e][r]=null;else this.deletedStates[e]=null}getState(e,t){let i=String(t),r=this.state[e]||{},a=this.stateChanges[e]||{},o=ee({},r[i],a[i]);if(this.deletedStates[e]===null)return{};if(this.deletedStates[e]){let n=this.deletedStates[e][t];if(n===null)return{};for(let s in n)delete o[s]}return o}initializeTileState(e,t){let i={};for(let r in this.state)i[r]=Y1(this.state[r]);e.setFeatureState(i,t,this.revision)}coalesceChanges(e,t){let i={};for(let a in this.stateChanges){this.state[a]||={},i[a]||={};for(let o in this.stateChanges[a])this.state[a][o]||={},ee(this.state[a][o],this.stateChanges[a][o]),i[a][o]=this.state[a][o]}for(let a in this.deletedStates)if(this.state[a]||={},i[a]||={},this.deletedStates[a]===null)for(let o in this.state[a])this.state[a][o]={},i[a][o]={};else for(let o in this.deletedStates[a]){if(this.deletedStates[a][o]===null)this.state[a][o]={};else if(this.state[a][o])for(let n of Object.keys(this.deletedStates[a][o]))delete this.state[a][o][n];else continue;i[a][o]=this.state[a][o]}if(this.stateChanges={},this.deletedStates={},Object.keys(i).length===0)return;this.revision++;let r={};for(let a in i)r[a]=Y1(i[a]);e.setFeatureState(r,t,this.revision)}},fI=class e{constructor(t,i){this.min=t,this.max=i,this.center=Ue([],Bi([],this.min,this.max),0.5)}quadrant(t){let i=[t%2==0,t<2],r=id(this.min),a=id(this.max);for(let o=0;o<i.length;o++)r[o]=i[o]?this.min[o]:this.center[o],a[o]=i[o]?this.center[o]:this.max[o];return a[2]=this.max[2],new e(r,a)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}intersectsFrustum(t){let i=!0;for(let r of t.planes){let a=this.intersectsPlane(r);if(a===0)return 0;a===1&&(i=!1)}return i?2:t.aabb.min[0]>this.max[0]||t.aabb.min[1]>this.max[1]||t.aabb.min[2]>this.max[2]||t.aabb.max[0]<this.min[0]||t.aabb.max[1]<this.min[1]||t.aabb.max[2]<this.min[2]?0:1}intersectsPlane(t){let i=t[3],r=t[3];for(let a=0;a<3;a++)t[a]>0?(i+=t[a]*this.min[a],r+=t[a]*this.max[a]):(r+=t[a]*this.min[a],i+=t[a]*this.max[a]);return i>=0?2:r<0?0:1}},mI=class{getCenter(e){return e.center}distanceToTile2d(e,t,i,r){let a=r,o=a.distanceX([e,t]),n=a.distanceY([e,t]);return Math.hypot(o,n)}getWrap(e,t,i){return i}getTileBoundingVolume(e,t,i,r){let a=Math.min(0,i),o=Math.max(0,i);if(r?.terrain){let s=new Et(e.z,t,e.z,e.x,e.y),l=r.terrain.getMinMaxElevation(s);a=l.minElevation??a,o=l.maxElevation??o}let n=1<<e.z;return new fI([t+e.x/n,e.y/n,a],[t+(e.x+1)/n,(e.y+1)/n,o])}allowVariableZoom(e,t){let i=H(78.5-e.fov*(Math.abs(Math.cos(e.rollInRadians))*e.height+Math.abs(Math.sin(e.rollInRadians))*e.width)/e.height/2,0,60);return!!t.terrain||e.pitch>i}allowWorldCopies(){return!0}},_I=class{constructor(e,t=4096){this._volumes=new Map,this._boundingVolumeFactory=e,this._capacity=t}getTileBoundingVolume(e,t,i,r){let a=gI(e,t,i,r),o=this._volumes.get(a);return o?this._volumes.delete(a):(o=this._boundingVolumeFactory(e,t,i,r),this._volumes.size>=this._capacity&&this._volumes.delete(this._volumes.keys().next().value)),this._volumes.set(a,o),o}},zh=class e{constructor(t,i,r,a){this.min=r,this.max=a,this.points=t,this.planes=i}static fromAabb(t,i){let r=[];for(let a=0;a<8;a++)r.push([((a|0)&1)==1?i[0]:t[0],(a>>1&1)==1?i[1]:t[1],(a>>2&1)==1?i[2]:t[2]]);return new e(r,[[-1,0,0,i[0]],[1,0,0,-t[0]],[0,-1,0,i[1]],[0,1,0,-t[1]],[0,0,-1,i[2]],[0,0,1,-t[2]]],t,i)}static fromCenterSizeAngles(t,i,r){let a=zp([],r[0],r[1],r[2]),o=nh([],[i[0],0,0],a),n=nh([],[0,i[1],0],a),s=nh([],[0,0,i[2]],a),l=[...t],u=[...t];for(let h=0;h<8;h++)for(let d=0;d<3;d++){let p=t[d]+o[d]*(((h|0)&1)==1?1:-1)+n[d]*((h>>1&1)==1?1:-1)+s[d]*((h>>2&1)==1?1:-1);l[d]=Math.min(l[d],p),u[d]=Math.max(u[d],p)}let c=[];for(let h=0;h<8;h++){let d=[...t];Bi(d,d,Ue([],o,((h|0)&1)==1?1:-1)),Bi(d,d,Ue([],n,(h>>1&1)==1?1:-1)),Bi(d,d,Ue([],s,(h>>2&1)==1?1:-1)),c.push(d)}return new e(c,[[...o,-ft(o,c[0])],[...n,-ft(n,c[0])],[...s,-ft(s,c[0])],[-o[0],-o[1],-o[2],-ft(o,c[7])],[-n[0],-n[1],-n[2],-ft(n,c[7])],[-s[0],-s[1],-s[2],-ft(s,c[7])]],l,u)}intersectsFrustum(t){let i=!0,r=this.points.length,a=this.planes.length,o=t.planes.length,n=t.points.length;for(let s=0;s<o;s++){let l=t.planes[s],u=0;for(let c=0;c<r;c++){let h=this.points[c];l[0]*h[0]+l[1]*h[1]+l[2]*h[2]+l[3]>=0&&u++}if(u===0)return 0;u<r&&(i=!1)}if(i)return 2;for(let s=0;s<a;s++){let l=this.planes[s],u=0;for(let c=0;c<n;c++){let h=t.points[c];l[0]*h[0]+l[1]*h[1]+l[2]*h[2]+l[3]>=0&&u++}if(u===0)return 0}return 1}intersectsPlane(t){let i=this.points.length,r=0;for(let a=0;a<i;a++){let o=this.points[a];t[0]*o[0]+t[1]*o[1]+t[2]*o[2]+t[3]>=0&&r++}return r===i?2:r===0?0:1}},yI=class{constructor(){this._boundingVolumeCache=new _I(this._computeTileBoundingVolume)}getCenter(e){return new Y(e.center.lng,H(e.center.lat,-85.051129,ci))}distanceToTile2d(e,t,i,r){let a=1<<i.z,o=1/a,n=i.x/a,s=i.y/a,l=0.5,u=2;return u=Math.min(u,Lh(e,t,n,s,o)),u=Math.min(u,Lh(e,t,n+l,-s-o,o)),u=Math.min(u,Lh(e,t,n+l,2-s-o,o)),u}getWrap(e,t,i){let r=1<<t.z,a=1/r,o=t.x/r,n=Ll(e.x,o,a),s=Ll(e.x,o-1,a),l=Ll(e.x,o+1,a),u=Math.min(n,s,l);return u===l?1:u===s?-1:0}allowVariableZoom(e,t){return Zf(e,t)>4}allowWorldCopies(){return!1}getTileBoundingVolume(e,t,i,r){return this._boundingVolumeCache.getTileBoundingVolume(e,t,i,r)}_computeTileBoundingVolume(e,t,i,r){let a=Math.min(0,i),o=Math.max(0,i);if(r?.terrain){let n=new Et(e.z,t,e.z,e.x,e.y),s=r.terrain.getMinMaxElevation(n);a=s.minElevation??a,o=Math.max(s.maxElevation??o,o)}if(a/=Yt,o/=Yt,a+=1,o+=1,e.z<=0)return zh.fromAabb([-o,-o,-o],[o,o,o]);if(e.z===1)return zh.fromAabb([e.x===0?-o:0,e.y===0?0:-o,-o],[e.x===0?0:o,e.y===0?o:0,o]);{let n=[Hr(0,0,e.x,e.y,e.z),Hr(z,0,e.x,e.y,e.z),Hr(z,z,e.x,e.y,e.z),Hr(0,z,e.x,e.y,e.z)],s=[];for(let E of n)s.push(Ue([],E,o));if(o!==a)for(let E of n)s.push(Ue([],E,a));e.y===0&&s.push([0,1,0]),e.y===(1<<e.z)-1&&s.push([0,-1,0]);let l=[1,1,1],u=[-1,-1,-1];for(let E of s)for(let S=0;S<3;S++)l[S]=Math.min(l[S],E[S]),u[S]=Math.max(u[S],E[S]);let c=Hr(z/2,z/2,e.x,e.y,e.z),h=si([],[0,1,0],c);Rt(h,h);let d=si([],c,h);Rt(d,d);let p=si([],n[2],n[1]);Rt(p,p);let f=si([],n[0],n[3]);Rt(f,f),s.push(Ue([],c,o)),e.y>=(1<<e.z)/2&&s.push(Ue([],Hr(z/2,0,e.x,e.y,e.z),o)),e.y<(1<<e.z)/2&&s.push(Ue([],Hr(z/2,z,e.x,e.y,e.z),o));let m=K1(c,s),g=K1(d,s),_=[-c[0],-c[1],-c[2],m.max],y=[c[0],c[1],c[2],-m.min],v=[-d[0],-d[1],-d[2],g.max],x=[d[0],d[1],d[2],-g.min],b=[...p,0],w=[...f,0],T=[];return e.y===0?T.push(Di(w,b,_),Di(w,b,y)):T.push(Di(v,b,_),Di(v,b,y),Di(v,w,_),Di(v,w,y)),e.y===(1<<e.z)-1?T.push(Di(w,b,_),Di(w,b,y)):T.push(Di(x,b,_),Di(x,b,y),Di(x,w,_),Di(x,w,y)),new zh(T,[_,y,v,x,b,w],l,u)}}},J1=null,Q1=null,xI,a_=class{constructor(){this._tiles={}}handleWrapJump(e){let t={};for(let i in this._tiles){let r=this._tiles[i];r.tileID=r.tileID.unwrapTo(r.tileID.wrap+e),t[r.tileID.key]=r}this._tiles=t}setFeatureState(e,t,i){for(let r in this._tiles)this._tiles[r].setFeatureState(e,t,i)}getAllTiles(){return Object.values(this._tiles)}getAllIds(e=!1){return e?Object.values(this._tiles).map((t)=>t.tileID).sort(L0).map((t)=>t.key):Object.keys(this._tiles)}getTileById(e){return this._tiles[e]}setTile(e,t){this._tiles[e]=t}deleteTileById(e){delete this._tiles[e]}getLoadedTile(e){let t=this.getTileById(e.key);return t?.hasData()?t:null}isIdRenderable(e,t=!1){return this.getTileById(e)?.isRenderable(t)}getRenderableIds(e=0,t){let i=[];for(let r of this.getAllIds())this.isIdRenderable(r,t)&&i.push(this.getTileById(r));return t?i.sort((r,a)=>{let o=r.tileID,n=a.tileID,s=new D(o.canonical.x,o.canonical.y)._rotate(-e),l=new D(n.canonical.x,n.canonical.y)._rotate(-e);return o.overscaledZ-n.overscaledZ||l.y-s.y||l.x-s.x}).map((r)=>r.tileID.key):i.map((r)=>r.tileID).sort(L0).map((r)=>r.key)}},o_=0.5,bu,PI=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*0.5),this.paddedLength=this.length-this.padding*2}lerp(e){if(this.points.length===1)return this.points[0];e=H(e,0,1);let t=1,i=this._distances[t],r=e*this.paddedLength+this.padding;for(;i<r&&t<this._distances.length;)i=this._distances[++t];let a=t-1,o=this._distances[a],n=i-o,s=n>0?(r-o)/n:0;return this.points[a].mult(1-s).add(this.points[t].mult(s))}},n_=class{constructor(e,t,i){let r=this.boxCells=[],a=this.circleCells=[];this.xCellCount=Math.ceil(e/i),this.yCellCount=Math.ceil(t/i);for(let o=0;o<this.xCellCount*this.yCellCount;o++)r.push([]),a.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=t,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/t,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,t,i,r,a){this._forEachCell(t,i,r,a,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(t),this.bboxes.push(i),this.bboxes.push(r),this.bboxes.push(a)}insertCircle(e,t,i,r){this._forEachCell(t-r,i-r,t+r,i+r,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(t),this.circles.push(i),this.circles.push(r)}_insertBoxCell(e,t,i,r,a,o){this.boxCells[a].push(o)}_insertCircleCell(e,t,i,r,a,o){this.circleCells[a].push(o)}_query(e,t,i,r,a,o,n){if(i<0||e>this.width||r<0||t>this.height)return[];let s=[];if(e<=0&&t<=0&&this.width<=i&&this.height<=r){if(a)return[{key:null,x1:e,y1:t,x2:i,y2:r}];for(let l=0;l<this.boxKeys.length;l++)s.push({key:this.boxKeys[l],x1:this.bboxes[l*4],y1:this.bboxes[l*4+1],x2:this.bboxes[l*4+2],y2:this.bboxes[l*4+3]});for(let l=0;l<this.circleKeys.length;l++){let u=this.circles[l*3],c=this.circles[l*3+1],h=this.circles[l*3+2];s.push({key:this.circleKeys[l],x1:u-h,y1:c-h,x2:u+h,y2:c+h})}}else{let l={hitTest:a,overlapMode:o,seenUids:{box:{},circle:{}}};this._forEachCell(e,t,i,r,this._queryCell,s,l,n)}return s}query(e,t,i,r){return this._query(e,t,i,r,!1,null)}hitTest(e,t,i,r,a,o){return this._query(e,t,i,r,!0,a,o).length>0}hitTestCircle(e,t,i,r,a){let o=e-i,n=e+i,s=t-i,l=t+i;if(n<0||o>this.width||l<0||s>this.height)return!1;let u=[],c={hitTest:!0,overlapMode:r,circle:{x:e,y:t,radius:i},seenUids:{box:{},circle:{}}};return this._forEachCell(o,s,n,l,this._queryCellCircle,u,c,a),u.length>0}_queryCell(e,t,i,r,a,o,n,s){let{seenUids:l,hitTest:u,overlapMode:c}=n,h=this.boxCells[a],d=0.000001;if(h!==null){let f=this.bboxes;for(let m of h)if(!l.box[m]){l.box[m]=!0;let g=m*4,_=this.boxKeys[m];if(e<=f[g+2]+d&&t<=f[g+3]+d&&i>=f[g+0]-d&&r>=f[g+1]-d&&(!s||s(_))&&(!u||!gl(c,_.overlapMode))&&(o.push({key:_,x1:f[g],y1:f[g+1],x2:f[g+2],y2:f[g+3]}),u))return!0}}let p=this.circleCells[a];if(p!==null){let f=this.circles;for(let m of p)if(!l.circle[m]){l.circle[m]=!0;let g=m*3,_=this.circleKeys[m];if(this._circleAndRectCollide(f[g],f[g+1],f[g+2],e,t,i,r)&&(!s||s(_))&&(!u||!gl(c,_.overlapMode))){let y=f[g],v=f[g+1],x=f[g+2];if(o.push({key:_,x1:y-x,y1:v-x,x2:y+x,y2:v+x}),u)return!0}}}return!1}_queryCellCircle(e,t,i,r,a,o,n,s){let{circle:l,seenUids:u,overlapMode:c}=n,h=this.boxCells[a];if(h!==null){let p=this.bboxes;for(let f of h)if(!u.box[f]){u.box[f]=!0;let m=f*4,g=this.boxKeys[f];if(this._circleAndRectCollide(l.x,l.y,l.radius,p[m+0],p[m+1],p[m+2],p[m+3])&&(!s||s(g))&&!gl(c,g.overlapMode))return o.push(!0),!0}}let d=this.circleCells[a];if(d!==null){let p=this.circles;for(let f of d)if(!u.circle[f]){u.circle[f]=!0;let m=f*3,g=this.circleKeys[f];if(this._circlesCollide(p[m],p[m+1],p[m+2],l.x,l.y,l.radius)&&(!s||s(g))&&!gl(c,g.overlapMode))return o.push(!0),!0}}}_forEachCell(e,t,i,r,a,o,n,s){let l=this._convertToXCellCoord(e),u=this._convertToYCellCoord(t),c=this._convertToXCellCoord(i),h=this._convertToYCellCoord(r);for(let d=l;d<=c;d++)for(let p=u;p<=h;p++){let f=this.xCellCount*p+d;if(a.call(this,e,t,i,r,f,o,n,s))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,r,a,o){let n=r-e,s=a-t,l=i+o;return l*l>n*n+s*s}_circleAndRectCollide(e,t,i,r,a,o,n){let s=(o-r)/2,l=Math.abs(e-(r+s));if(l>s+i)return!1;let u=(n-a)/2,c=Math.abs(t-(a+u));if(c>u+i)return!1;if(l<=s||c<=u)return!0;let h=l-s,d=c-u;return h*h+d*d<=i*i}},II,BI,NI=class{constructor(e,t=new n_(e.width+200,e.height+200,25),i=new n_(e.width+200,e.height+200,25)){this.projectedCamera=e,this.grid=t,this.ignoredGrid=i,this.pitchFactor=Math.cos(e.pitch*Math.PI/180)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+100,this.screenBottomBoundary=e.height+100,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.perspectiveRatioCutoff=0.6}placeCollisionBox(e,t,i,r,a,o,n,s,l,u,c,h,d=0,p=!0){let f=e.anchorPointX+s[0],m=e.anchorPointY+s[1],g=this.projectAndGetPerspectiveRatio(f,m,a,Bl(u,f,m,d,p),h),_=i*g.perspectiveRatio,y;if(!o&&!n){let S=g.x+(c?c.x*_:0),A=g.y+(c?c.y*_:0);y={allPointsOccluded:!1,box:[S+e.x1*_,A+e.y1*_,S+e.x2*_,A+e.y2*_]}}else y=this._projectCollisionBox(e,_,r,a,o,n,s,g,u,c,h,d,p);let[v,x,b,w]=y.box,T=o?y.allPointsOccluded:g.isOccluded,E=T;return E||=g.perspectiveRatio<this.perspectiveRatioCutoff,E||=!this.isInsideGrid(v,x,b,w),E||t!=="always"&&this.grid.hitTest(v,x,b,w,t,l)?{box:[v,x,b,w],placeable:!1,offscreen:!1,occluded:T}:{box:[v,x,b,w],placeable:!0,offscreen:this.isOffscreen(v,x,b,w),occluded:T}}placeCollisionCircles(e,t,i,r,a,o,n,s,l,u,c,h,d,p){let f=[],m=new D(t.anchorX,t.anchorY),g=this.getPerspectiveRatio(m.x,m.y,o,p?.(m.x,m.y)),_=(l?a*V(this.projectedCamera).getPitchedTextCorrection(this.projectedCamera,t.anchorX,t.anchorY,o)/g:a*g)/24,y={projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},v=t.lineOffsetX*_,x=t.lineOffsetY*_,b={getElevation:p,pitchedLabelPlaneMatrix:n,lineVertexArray:i,pitchWithMap:l,projectionCache:y,projectedCamera:this.projectedCamera,tileAnchorPoint:m,unwrappedTileID:o,width:this.projectedCamera.width,height:this.projectedCamera.height,translation:d},w=cb(_,r,v,x,!1,t,!1,b),T=!1,E=!1,S=!0;if(w){let A=c*0.5*g+h,I=new D(-100,-100),R=new D(this.screenRightBoundary,this.screenBottomBoundary),k=new PI,{first:M,last:C}=w,P=[];for(let L=M.path.length-1;L>=1;L--)P.push(M.path[L]);for(let L=1;L<C.path.length;L++)P.push(C.path[L]);let B=A*2.5;if(l){let L=this.projectPathToScreenSpace(P,b);P=L.some((W)=>W.signedDistanceFromCamera<=0)?[]:L.map((W)=>W.point)}let N=[];if(P.length>0){let L=P[0].clone(),W=P[0].clone();for(let Q=1;Q<P.length;Q++)L.x=Math.min(L.x,P[Q].x),L.y=Math.min(L.y,P[Q].y),W.x=Math.max(W.x,P[Q].x),W.y=Math.max(W.y,P[Q].y);N=L.x>=I.x&&W.x<=R.x&&L.y>=I.y&&W.y<=R.y?[P]:W.x<I.x||L.x>R.x||W.y<I.y||L.y>R.y?[]:gx([P],I.x,I.y,R.x,R.y)}for(let L of N){k.reset(L,A*0.25);let W=0;W=k.length<=0.5*A?1:Math.ceil(k.paddedLength/B)+1;for(let Q=0;Q<W;Q++){let be=Q/Math.max(W-1,1),le=k.lerp(be),je=le.x+100,Le=le.y+100;f.push(je,Le,A,0);let Qe=je-A,Oe=Le-A,It=je+A,jt=Le+A;if(S&&=this.isOffscreen(Qe,Oe,It,jt),E||=this.isInsideGrid(Qe,Oe,It,jt),e!=="always"&&this.grid.hitTestCircle(je,Le,A,e,u)&&(T=!0,!s))return{circles:[],offscreen:!1,collisionDetected:T}}}}return{circles:!s&&T||!E||g<this.perspectiveRatioCutoff?[]:f,offscreen:S,collisionDetected:T}}projectPathToScreenSpace(e,t){return jI(OI(e,t))}queryRenderedSymbols(e){if(e.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};let t=[],i=new Yi;for(let c of e){let h=new D(c.x+100,c.y+100);i.extend(h),t.push(h)}let{minX:r,minY:a,maxX:o,maxY:n}=i,s=this.grid.query(r,a,o,n).concat(this.ignoredGrid.query(r,a,o,n)),l={},u={};for(let c of s){let h=c.key;l[h.bucketInstanceId]===void 0&&(l[h.bucketInstanceId]={}),!l[h.bucketInstanceId][h.featureIndex]&&t2(t,[new D(c.x1,c.y1),new D(c.x2,c.y1),new D(c.x2,c.y2),new D(c.x1,c.y2)])&&(l[h.bucketInstanceId][h.featureIndex]=!0,u[h.bucketInstanceId]===void 0&&(u[h.bucketInstanceId]=[]),u[h.bucketInstanceId].push(h.featureIndex))}return u}insertCollisionBox(e,t,i,r,a,o){let n=i?this.ignoredGrid:this.grid,s={bucketInstanceId:r,featureIndex:a,collisionGroupID:o,overlapMode:t};n.insert(s,e[0],e[1],e[2],e[3])}insertCollisionCircles(e,t,i,r,a,o){let n=i?this.ignoredGrid:this.grid,s={bucketInstanceId:r,featureIndex:a,collisionGroupID:o,overlapMode:t};for(let l=0;l<e.length;l+=4)n.insertCircle(s,e[l],e[l+1],e[l+2])}projectAndGetPerspectiveRatio(e,t,i,r,a){if(a){let o;r==null?(o=[e,t,0,1],ff(o,o,a)):(o=[e,t,r,1],$t(o,o,a));let n=o[3];return{x:(o[0]/n+1)/2*this.projectedCamera.width+100,y:(-o[1]/n+1)/2*this.projectedCamera.height+100,perspectiveRatio:0.5+0.5*(this.projectedCamera.cameraToCenterDistance/n),isOccluded:!1,signedDistanceFromCamera:n}}{let o=V(this.projectedCamera).projectTileCoordinates(this.projectedCamera,e,t,i,r);return{x:(o.point.x+1)/2*this.projectedCamera.width+100,y:(-o.point.y+1)/2*this.projectedCamera.height+100,perspectiveRatio:0.5+0.5*(this.projectedCamera.cameraToCenterDistance/o.signedDistanceFromCamera),isOccluded:o.isOccluded,signedDistanceFromCamera:o.signedDistanceFromCamera}}}getPerspectiveRatio(e,t,i,r){let a=V(this.projectedCamera).projectTileCoordinates(this.projectedCamera,e,t,i,r);return 0.5+0.5*(this.projectedCamera.cameraToCenterDistance/a.signedDistanceFromCamera)}isOffscreen(e,t,i,r){return i<100||e>=this.screenRightBoundary||r<100||t>this.screenBottomBoundary}isInsideGrid(e,t,i,r){return i>=0&&e<this.gridRightBoundary&&r>=0&&t<this.gridBottomBoundary}getViewportMatrix(){let e=er([]);return gt(e,e,[-100,-100,0]),e}_projectCollisionBox(e,t,i,r,a,o,n,s,l,u,c,h=0,d=!0){let p=1,f=0,m=0,g=1,_=e.anchorPointX+n[0],y=e.anchorPointY+n[1];if(o&&!a){let C=this.projectAndGetPerspectiveRatio(_+1,y,r,Bl(l,_+1,y,h,d),c),P=C.x-s.x,B=C.y-s.y,N=Math.atan(B/P)+(P<0?Math.PI:0),L=Math.sin(N),W=Math.cos(N);p=W,f=L,m=-L,g=W}else if(!o&&a){let C=Xf(this.projectedCamera);p=C.vecEast[0],f=C.vecEast[1],m=C.vecSouth[0],g=C.vecSouth[1]}let{x:v,y:x}=s,b=t;if(a&&(v=_,x=y,b=2**-(this.projectedCamera.zoom-i.overscaledZ),b*=V(this.projectedCamera).getPitchedTextCorrection(this.projectedCamera,_,y,r),!u)){let C=H(0.5+0.5*(s.signedDistanceFromCamera/this.projectedCamera.cameraToCenterDistance),0,4);b*=C}u&&(v+=p*u.x*b+m*u.y*b,x+=f*u.x*b+g*u.y*b);let w=e.x1*b,T=e.x2*b,E=(w+T)/2,S=e.y1*b,A=e.y2*b,I=(S+A)/2,R=[{offsetX:w,offsetY:S},{offsetX:E,offsetY:S},{offsetX:T,offsetY:S},{offsetX:T,offsetY:I},{offsetX:T,offsetY:A},{offsetX:E,offsetY:A},{offsetX:w,offsetY:A},{offsetX:w,offsetY:I}],k=[];for(let{offsetX:C,offsetY:P}of R)k.push(new D(v+p*C+m*P,x+f*C+g*P));let M=!1;if(a){let C=k.map((P)=>this.projectAndGetPerspectiveRatio(P.x,P.y,r,Bl(l,P.x,P.y,h,d),c));M=C.some((P)=>!P.isOccluded),k=C.map((P)=>new D(P.x,P.y))}else M=!0;return{box:Z5(k),allPointsOccluded:!M}}},u_=class{constructor(e,t,i,r){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?t:-t))):r&&i?1:0,this.placed=i}isHidden(){return this.opacity===0&&!this.placed}},fn=class{constructor(e,t,i,r,a){this.text=new u_(e?e.text:null,t,i,a),this.icon=new u_(e?e.icon:null,t,r,a)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}},c_=class{constructor(e,t,i){this.text=e,this.icon=t,this.skipFade=i}},VI=class{constructor(e,t,i,r,a){this.bucketInstanceId=e,this.featureIndex=t,this.sourceLayerIndex=i,this.bucketIndex=r,this.tileID=a}},$I=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]}},UI,qI=class{constructor(e,t,i,r,a){this.projectedCamera=e,this.terrain=t,this.collisionIndex=new NI(this.projectedCamera),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=i,this.retainedQueryData={},this.collisionGroups=new $I(r),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.lastOpacityInputs=new WeakMap,this.prevPlacement=a,a&&(a.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(e){let t=this.terrain;if(t)return(i,r)=>t.getElevation(e,i,r)}getBucketParts(e,t,i,r){let a=i.getBucket(t),o=i.latestFeatureIndex;if(!a||!o||t.id!==a.layerIds[0])return;let n=i.collisionBoxArray,s=a.layers[0].layout,l=a.layers[0].paint,u=2**(this.projectedCamera.zoom-i.tileID.overscaledZ),c=i.tileSize/z,h=i.tileID.toUnwrapped(),d=s.get("text-rotation-alignment")==="map",p=Ti(i,1,this.projectedCamera.zoom),f=aa(this.collisionIndex.projectedCamera,i,l.get("text-translate"),l.get("text-translate-anchor")),m=aa(this.collisionIndex.projectedCamera,i,l.get("icon-translate"),l.get("icon-translate-anchor")),g=Hf(d,this.projectedCamera,p);this.retainedQueryData[a.bucketInstanceId]=new VI(a.bucketInstanceId,o,a.sourceLayerIndex,a.index,i.tileID);let _={bucket:a,layout:s,translationText:f,translationIcon:m,unwrappedTileID:h,pitchedLabelPlaneMatrix:g,scale:u,textPixelRatio:c,holdingForFade:i.holdingForSymbolFade(),collisionBoxArray:n,partiallyEvaluatedTextSize:tc(a.textSizeData,this.projectedCamera.zoom),collisionGroup:this.collisionGroups.get(a.sourceID)};if(r)for(let y of a.sortKeyRanges){let{sortKey:v,symbolInstanceStart:x,symbolInstanceEnd:b}=y;e.push({sortKey:v,symbolInstanceStart:x,symbolInstanceEnd:b,parameters:_})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:a.symbolInstances.length,parameters:_})}attemptAnchorPlacement(e,t,i,r,a,o,n,s,l,u,c,h,d,p,f,m,g,_,y,v,x,b){let w=up[e.textAnchor],T=[e.textOffset0,e.textOffset1],E=h_(w,i,r,T,a),S=this.collisionIndex.placeCollisionBox(t,h,s,l,u,n,o,m,c.predicate,y,E,v,x,b);if((!_||this.collisionIndex.placeCollisionBox(_,h,s,l,u,n,o,g,c.predicate,y,E,v,x,b).placeable)&&S.placeable){let A;if(this.prevPlacement?.variableOffsets[d.crossTileID]&&this.prevPlacement?.placements[d.crossTileID]?.text&&(A=this.prevPlacement.variableOffsets[d.crossTileID].anchor),d.crossTileID===0)throw Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[d.crossTileID]={textOffset:T,width:i,height:r,anchor:w,textBoxScale:a,prevAnchor:A},this.markUsedJustification(p,w,d,f),p.allowVerticalPlacement&&(this.markUsedOrientation(p,f,d),this.placedOrientations[d.crossTileID]=f),{shift:E,placedGlyphBoxes:S}}}placeLayerBucketPart(e,t,i){let{bucket:r,layout:a,translationText:o,translationIcon:n,unwrappedTileID:s,pitchedLabelPlaneMatrix:l,textPixelRatio:u,holdingForFade:c,collisionBoxArray:h,partiallyEvaluatedTextSize:d,collisionGroup:p}=e.parameters,f=a.get("text-optional"),m=a.get("icon-optional"),g=gu(a,"text-overlap","text-allow-overlap"),_=g==="always",y=gu(a,"icon-overlap","icon-allow-overlap"),v=y==="always",x=a.get("text-rotation-alignment")==="map",b=a.get("text-pitch-alignment")==="map",w=a.get("icon-text-fit")!=="none",T=a.get("symbol-z-order")==="viewport-y",E=a.get("symbol-height-anchor")==="ground",S=_&&(v||!r.hasIconData()||m),A=v&&(_||!r.hasTextData()||f);!r.collisionArrays&&h&&r.deserializeCollisionBoxes(h);let I=this.retainedQueryData[r.bucketInstanceId].tileID,R=this._getTerrainElevationFunc(I),k=V(this.projectedCamera).getFastPathSimpleProjectionMatrix(this.projectedCamera,I),M=(C,P,B)=>{if(t[C.crossTileID])return;if(c){this.placements[C.crossTileID]=new c_(!1,!1,!1);return}let N=C.heightOffset,L=!1,W=!1,Q=!0,be=null,le={box:null,placeable:!1,offscreen:null,occluded:!1},je={box:null,placeable:!1,offscreen:null},Le=null,Qe=null,Oe=null,It=0,jt=0,Ut=0;P.textFeatureIndex?It=P.textFeatureIndex:C.useRuntimeCollisionCircles&&(It=C.featureIndex),P.verticalTextFeatureIndex&&(jt=P.verticalTextFeatureIndex);let vt=P.textBox;if(vt){let ge=(K)=>{let re=1;if(r.allowVerticalPlacement&&!K&&this.prevPlacement){let J=this.prevPlacement.placedOrientations[C.crossTileID];J&&(this.placedOrientations[C.crossTileID]=J,re=J,this.markUsedOrientation(r,re,C))}return re},ye=(K,re)=>{if(r.allowVerticalPlacement&&C.numVerticalGlyphVertices>0&&P.verticalTextBox){for(let J of r.writingModes)if(J===2?(le=re(),je=le):le=K(),le?.placeable)break}else le=K()},{textAnchorOffsetStartIndex:j,textAnchorOffsetEndIndex:ue}=C;if(ue===j){let K=(re,J)=>{let me=this.collisionIndex.placeCollisionBox(re,g,u,I,s,b,x,o,p.predicate,R,void 0,k,N,E);return me?.placeable&&(this.markUsedOrientation(r,J,C),this.placedOrientations[C.crossTileID]=J),me};ye(()=>K(vt,1),()=>{let re=P.verticalTextBox;return r.allowVerticalPlacement&&C.numVerticalGlyphVertices>0&&re?K(re,2):{box:null,offscreen:null}}),ge(le?.placeable)}else{let K=up[this.prevPlacement?.variableOffsets[C.crossTileID]?.anchor],re=(me,Ne,Ee)=>{let ct=me.x2-me.x1,ua=me.y2-me.y1,Sr=C.textBoxScale,rr=w&&y==="never"?Ne:null,Gt=null,Be=g==="never"?1:2,Ye="never";K&&Be++;for(let Wt=0;Wt<Be;Wt++){for(let Ei=j;Ei<ue;Ei++){let qa=r.textAnchorOffsets.get(Ei);if(K&&qa.textAnchor!==K)continue;let ht=this.attemptAnchorPlacement(qa,me,ct,ua,Sr,x,b,u,I,s,p,Ye,C,r,Ee,o,n,rr,R,k,N,E);if(ht&&(Gt=ht.placedGlyphBoxes,Gt?.placeable))return L=!0,be=ht.shift,Gt}K?K=null:Ye=g}if(!Gt&&(i||S)){let Wt=this.collisionIndex.placeCollisionBox(vt,"always",u,I,s,b,x,o,p.predicate,R,void 0,k,N,E);Gt={box:Wt.box,offscreen:!1,placeable:!1,occluded:Wt.occluded}}return Gt};ye(()=>re(vt,P.iconBox,1),()=>{let me=P.verticalTextBox,Ne=le?.placeable;return r.allowVerticalPlacement&&!Ne&&C.numVerticalGlyphVertices>0&&me?re(me,P.verticalIconBox,2):{box:null,occluded:!0,offscreen:null}}),le&&(L=le.placeable,Q=le.offscreen);let J=ge(le?.placeable);if(!L&&this.prevPlacement){let me=this.prevPlacement.variableOffsets[C.crossTileID];me&&(this.variableOffsets[C.crossTileID]=me,this.markUsedJustification(r,me.anchor,C,J))}}}if(Le=le,L=Le?.placeable,Q=Le?.offscreen,C.useRuntimeCollisionCircles&&C.centerJustifiedTextSymbolIndex>=0){let ge=r.text.placedSymbolArray.get(C.centerJustifiedTextSymbolIndex),ye=Df(r.textSizeData,d,ge),j=a.get("text-padding"),ue=C.collisionCircleDiameter;Qe=this.collisionIndex.placeCollisionCircles(g,ge,r.lineVertexArray,r.glyphOffsetArray,ye,s,l,i,b,p.predicate,ue,j,o,R),Qe.circles.length&&Qe.collisionDetected&&!i&&he("Collisions detected, but collision boxes are not shown"),L=_||Qe.circles.length>0&&!Qe.collisionDetected,Q&&=Qe.offscreen}if(P.iconFeatureIndex&&(Ut=P.iconFeatureIndex),P.iconBox){let ge=(ye)=>this.collisionIndex.placeCollisionBox(ye,y,u,I,s,b,x,n,p.predicate,R,w&&be?be:void 0,k,N,E);je&&je.placeable&&P.verticalIconBox?(Oe=ge(P.verticalIconBox),W=Oe.placeable):(Oe=ge(P.iconBox),W=Oe.placeable),Q&&=Oe.offscreen}let qt=f||C.numHorizontalGlyphVertices===0&&C.numVerticalGlyphVertices===0,ir=m||C.numIconVertices===0;!qt&&!ir?W=L=W&&L:ir?qt||(W&&=L):L=W&&L;let nt=L&&Le.placeable,hi=W&&Oe.placeable;if(nt&&(je&&je.placeable&&jt?this.collisionIndex.insertCollisionBox(Le.box,g,a.get("text-ignore-placement"),r.bucketInstanceId,jt,p.ID):this.collisionIndex.insertCollisionBox(Le.box,g,a.get("text-ignore-placement"),r.bucketInstanceId,It,p.ID)),hi&&this.collisionIndex.insertCollisionBox(Oe.box,y,a.get("icon-ignore-placement"),r.bucketInstanceId,Ut,p.ID),Qe&&L&&this.collisionIndex.insertCollisionCircles(Qe.circles,g,a.get("text-ignore-placement"),r.bucketInstanceId,It,p.ID),i&&this.storeCollisionData(r.bucketInstanceId,B,P,Le,Oe,Qe),C.crossTileID===0)throw Error("symbolInstance.crossTileID can't be 0");if(r.bucketInstanceId===0)throw Error("bucket.bucketInstanceId can't be 0");let di=(L||S)&&!Le?.occluded,X=(W||A)&&!Oe?.occluded;this.placements[C.crossTileID]=new c_(di,X,Q||r.justReloaded),t[C.crossTileID]=!0};if(T){if(e.symbolInstanceStart!==0)throw Error("bucket.bucketInstanceId should be 0");let C=r.getSortedSymbolIndexes(-this.projectedCamera.bearingInRadians);for(let P=C.length-1;P>=0;--P){let B=C[P];M(r.symbolInstances.get(B),r.collisionArrays[B],B)}}else for(let C=e.symbolInstanceStart;C<e.symbolInstanceEnd;C++)M(r.symbolInstances.get(C),r.collisionArrays[C],C);r.justReloaded=!1}storeCollisionData(e,t,i,r,a,o){if(i.textBox||i.iconBox){let n;this.collisionBoxArrays.has(e)?n=this.collisionBoxArrays.get(e):(n=new Map,this.collisionBoxArrays.set(e,n));let s;n.has(t)?s=n.get(t):(s={text:null,icon:null},n.set(t,s)),i.textBox&&(s.text=r.box),i.iconBox&&(s.icon=a.box)}if(o){let n=this.collisionCircleArrays[e];n===void 0&&(n=this.collisionCircleArrays[e]=[]);for(let s=0;s<o.circles.length;s+=4)n.push(o.circles[s+0]-100),n.push(o.circles[s+1]-100),n.push(o.circles[s+2]),n.push(+!!o.collisionDetected)}}markUsedJustification(e,t,i,r){let a={left:i.leftJustifiedTextSymbolIndex,center:i.centerJustifiedTextSymbolIndex,right:i.rightJustifiedTextSymbolIndex},o;o=r===2?i.verticalPlacedTextSymbolIndex:a[cp(t)];let n=[i.leftJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.rightJustifiedTextSymbolIndex,i.verticalPlacedTextSymbolIndex];for(let s of n)s>=0&&(o>=0&&s!==o?e.text.placedSymbolArray.get(s).crossTileID=0:e.text.placedSymbolArray.get(s).crossTileID=i.crossTileID)}markUsedOrientation(e,t,i){let r=t===1||t===3?t:0,a=t===2?t:0,o=[i.leftJustifiedTextSymbolIndex,i.centerJustifiedTextSymbolIndex,i.rightJustifiedTextSymbolIndex];for(let n of o)e.text.placedSymbolArray.get(n).placedOrientation=r;i.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(i.verticalPlacedTextSymbolIndex).placedOrientation=a)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.projectedCamera.zoom;let t=this.prevPlacement,i=!1;this.prevZoomAdjustment=t?t.zoomAdjustment(this.projectedCamera.zoom):0;let r=t?t.symbolFadeChange(e):1,a=t?t.opacities:{},o=t?t.variableOffsets:{},n=t?t.placedOrientations:{};for(let s in this.placements){let l=this.placements[s],u=a[s];u?(this.opacities[s]=new fn(u,r,l.text,l.icon),i||=l.text!==u.text.placed,i||=l.icon!==u.icon.placed):(this.opacities[s]=new fn(null,r,l.text,l.icon,l.skipFade),i||=l.text||l.icon)}for(let s in a){let l=a[s];if(!this.opacities[s]){let u=new fn(l,r,!1,!1);u.isHidden()||(this.opacities[s]=u,i||=l.text.placed,i||=l.icon.placed)}}for(let s in o)!this.variableOffsets[s]&&this.opacities[s]&&!this.opacities[s].isHidden()&&(this.variableOffsets[s]=o[s]);for(let s in n)!this.placedOrientations[s]&&this.opacities[s]&&!this.opacities[s].isHidden()&&(this.placedOrientations[s]=n[s]);if(t&&t.lastPlacementChangeTime===void 0)throw 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 r of t){let a=r.getBucket(e);if(!a||!r.latestFeatureIndex||e.id!==a.layerIds[0])continue;let{duplicates:o,changed:n}=this._markDuplicates(a,i),s=!!a.hasDebugData()||a.bucketInstanceId in this.collisionCircleArrays;(n||s)&&this.updateBucketOpacities(a,r.tileID,o,r.collisionBoxArray),a.sortFeatures(-this.projectedCamera.bearingInRadians),this.retainedQueryData[a.bucketInstanceId]&&(this.retainedQueryData[a.bucketInstanceId].featureSortOrder=a.featureSortOrder)}}_markDuplicates(e,t){let i=e.symbolInstances.length,r=this.lastOpacityInputs.get(e),a=!1;r||(r={crossTileIDs:Array(i).fill(0),duplicates:Array(i).fill(!1)},this.lastOpacityInputs.set(e,r),a=!0);let{crossTileIDs:o,duplicates:n}=r,s=e.symbolInstances.uint32,l=e.symbolInstances.bytesPerElement/4;for(let u=0;u<i;u++){let c=s[u*l+UI],h=!!t[c];t[c]=!0,(o[u]!==c||n[u]!==h)&&(o[u]=c,n[u]=h,a=!0)}return{duplicates:n,changed:a}}updateBucketOpacities(e,t,i,r){e.hasTextData()&&(e.text.opacityVertexArray.clear(),e.text.hasVisibleVertices=!1),e.hasIconData()&&(e.icon.opacityVertexArray.clear(),e.icon.hasVisibleVertices=!1),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();let a=e.layers[0],o=a.layout,n=new fn(null,0,!1,!1,!0),s=o.get("text-allow-overlap"),l=o.get("icon-allow-overlap"),u=a._unevaluatedLayout.hasValue("text-variable-anchor")||a._unevaluatedLayout.hasValue("text-variable-anchor-offset"),c=o.get("text-rotation-alignment")==="map",h=o.get("text-pitch-alignment")==="map",d=o.get("icon-text-fit")!=="none",p=new fn(null,0,s&&(l||!e.hasIconData()||o.get("icon-optional")),l&&(s||!e.hasTextData()||o.get("text-optional")),!0);!e.collisionArrays&&r&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(r);let f=(g,_,y)=>{for(let v=0;v<_/4;v++)g.opacityVertexArray.emplaceBack(y);g.hasVisibleVertices||=y!==0},m=this.collisionBoxArrays.get(e.bucketInstanceId);for(let g=0;g<e.symbolInstances.length;g++){let _=e.symbolInstances.get(g),{numHorizontalGlyphVertices:y,numVerticalGlyphVertices:v,crossTileID:x}=_,b=i[g],w=this.opacities[x];b?w=n:w||(w=p,this.opacities[x]=w);let T=y>0||v>0,E=_.numIconVertices>0,S=this.placedOrientations[_.crossTileID],A=S===2,I=S===1||S===3;if(T){let k=p_(w.text),M=A?0:k;f(e.text,y,M);let C=I?0:k;f(e.text,v,C);let P=w.text.isHidden(),B=[_.rightJustifiedTextSymbolIndex,_.centerJustifiedTextSymbolIndex,_.leftJustifiedTextSymbolIndex];for(let W of B)W>=0&&(e.text.placedSymbolArray.get(W).hidden=P||A?1:0);_.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(_.verticalPlacedTextSymbolIndex).hidden=P||I?1:0);let N=this.variableOffsets[_.crossTileID];N&&this.markUsedJustification(e,N.anchor,_,S);let L=this.placedOrientations[_.crossTileID];L&&(this.markUsedJustification(e,"left",_,L),this.markUsedOrientation(e,L,_))}if(E){let k=p_(w.icon),M=!(d&&_.verticalPlacedIconSymbolIndex&&A);if(_.placedIconSymbolIndex>=0){let C=M?k:0;f(e.icon,_.numIconVertices,C),e.icon.placedSymbolArray.get(_.placedIconSymbolIndex).hidden=w.icon.isHidden()}if(_.verticalPlacedIconSymbolIndex>=0){let C=M?0:k;f(e.icon,_.numVerticalIconVertices,C),e.icon.placedSymbolArray.get(_.verticalPlacedIconSymbolIndex).hidden=w.icon.isHidden()}}let R=m?.has(g)?m.get(g):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){let k=e.collisionArrays[g];if(k){let M=new D(0,0);if(k.textBox||k.verticalTextBox){let C=!0;if(u){let P=this.variableOffsets[x];P?(M=h_(P.anchor,P.width,P.height,P.textOffset,P.textBoxScale),c&&M._rotate(h?-this.projectedCamera.bearingInRadians:this.projectedCamera.bearingInRadians)):C=!1}if(k.textBox||k.verticalTextBox){let P;k.textBox&&(P=A),k.verticalTextBox&&(P=I),d_(e.textCollisionBox.collisionVertexArray,w.text.placed,!C||P,R.text,M.x,M.y)}}if(k.iconBox||k.verticalIconBox){let C=!(I||!k.verticalIconBox),P;k.iconBox&&(P=C),k.verticalIconBox&&(P=!C),d_(e.iconCollisionBox.collisionVertexArray,w.icon.placed,P,R.icon,d?M.x:0,d?M.y:0)}}}}if(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 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 Error(`bucket.icon.opacityVertexArray.length (= ${e.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${e.icon.layoutVertexArray.length}) / 4`);e.bucketInstanceId in this.collisionCircleArrays&&(e.collisionCircleArray=this.collisionCircleArrays[e.bucketInstanceId],delete this.collisionCircleArrays[e.bucketInstanceId])}symbolFadeChange(e){return this.fadeDuration===0?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.projectedCamera.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}},GI=33554432,WI=16777216,ZI=131072,HI=65536,XI=4294967295,YI=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,r,a){let o=this._bucketParts;for(;this._currentTileIndex<e.length;){let n=e[this._currentTileIndex];if(t.getBucketParts(o,r,n,this._sortAcrossTiles),this._currentTileIndex++,a())return!0}for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,o.sort((n,s)=>n.sortKey-s.sortKey));this._currentPartIndex<o.length;){let n=o[this._currentPartIndex];if(t.placeLayerBucketPart(n,this._seenCrossTileIDs,i),this._currentPartIndex++,a())return!0}return!1}},KI=class{constructor(e,t,i,r,a,o,n,s){this.placement=new qI(e,t,o,n,s),this._currentPlacementIndex=i.length-1,this._forceFullPlacement=r,this._showCollisionBoxes=a,this._done=!1}isDone(){return this._done}continuePlacement(e,t,i){let r=Fe(),a=()=>!this._forceFullPlacement&&Fe()-r>2;for(;this._currentPlacementIndex>=0;){let o=t[e[this._currentPlacementIndex]],n=this.placement.collisionIndex.projectedCamera.zoom;if(bx(o)&&o.layout&&(!o.minzoom||o.minzoom<=n)&&(!o.maxzoom||o.maxzoom>n)){if(this._inProgressLayer||=new YI(o),this._inProgressLayer.continuePlacement(i[o.source],this.placement,this._showCollisionBoxes,o,a))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}},f_,et,JI=class e{static from(t){if(!t||t.byteLength===void 0||t.buffer)throw Error("Data must be an instance of ArrayBuffer or SharedArrayBuffer.");let[i,r]=new Uint8Array(t,0,2);if(i!==219)throw Error("Data does not appear to be in a KDBush format.");let a=r>>4;if(a!==1)throw Error(`Got v${a} data when expected v1.`);let o=f_[r&15];if(!o)throw Error("Unrecognized array type.");let[n]=new Uint16Array(t,2,1),[s]=new Uint32Array(t,4,1);return new e(s,n,o,void 0,t)}constructor(t,i=64,r=Float64Array,a=ArrayBuffer,o){if(isNaN(t)||t<0)throw Error(`Unexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+i,2),65535),this.ArrayType=r,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;let n=f_.indexOf(this.ArrayType),s=t*2*this.ArrayType.BYTES_PER_ELEMENT,l=t*this.IndexArrayType.BYTES_PER_ELEMENT,u=(8-l%8)%8;if(n<0)throw Error(`Unexpected typed array class: ${r}.`);if(o)this.data=o,this.ids=new this.IndexArrayType(o,8,t),this.coords=new r(o,8+l+u,t*2),this._pos=t*2,this._finished=!0;else{let c=this.data=new a(8+s+l+u);this.ids=new this.IndexArrayType(c,8,t),this.coords=new r(c,8+l+u,t*2),this._pos=0,this._finished=!1,new Uint8Array(c,0,2).set([219,16+n]),new Uint16Array(c,2,1)[0]=i,new Uint32Array(c,4,1)[0]=t}}add(t,i){let r=this._pos>>1;return this.ids[r]=r,this.coords[this._pos++]=t,this.coords[this._pos++]=i,r}finish(){let t=this._pos>>1;if(t!==this.numItems)throw Error(`Added ${t} items when expected ${this.numItems}.`);return Sp(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,i,r,a){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:o,coords:n,nodeSize:s}=this;et[0]=0,et[1]=o.length-1,et[2]=0;let l=3,u=[];for(;l>0;){let c=et[--l],h=et[--l],d=et[--l];if(h-d<=s){for(let g=d;g<=h;g++){let _=n[2*g],y=n[2*g+1];_>=t&&_<=r&&y>=i&&y<=a&&u.push(o[g])}continue}let p=d+h>>1,f=n[2*p],m=n[2*p+1];f>=t&&f<=r&&m>=i&&m<=a&&u.push(o[p]),(c===0?t<=f:i<=m)&&(et[l++]=d,et[l++]=p-1,et[l++]=1-c),(c===0?r>=f:a>=m)&&(et[l++]=p+1,et[l++]=h,et[l++]=1-c)}return u}within(t,i,r){let a=[];return this.withinInto(t,i,r,a),a}withinInto(t,i,r,a){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:o,coords:n,nodeSize:s}=this;et[0]=0,et[1]=o.length-1,et[2]=0;let l=3,u=0,c=r*r;for(;l>0;){let h=et[--l],d=et[--l],p=et[--l];if(d-p<=s){for(let _=p;_<=d;_++)m_(n[2*_],n[2*_+1],t,i)<=c&&(a[u++]=o[_]);continue}let f=p+d>>1,m=n[2*f],g=n[2*f+1];m_(m,g,t,i)<=c&&(a[u++]=o[f]),(h===0?t-r<=m:i-r<=g)&&(et[l++]=p,et[l++]=f-1,et[l++]=1-h),(h===0?t+r>=m:i+r>=g)&&(et[l++]=f+1,et[l++]=d,et[l++]=1-h)}return u}},gn,QI=class{constructor(e,t,i){this.tileID=e,this.bucketInstanceId=i,this._symbolsByKey={};let r=new Map;for(let a=0;a<t.length;a++){let o=t.get(a),n=o.key,s=r.get(n);s?s.push(o):r.set(n,[o])}for(let[a,o]of r){let n={positions:o.map((s)=>({x:Math.floor(s.anchorX*gn),y:Math.floor(s.anchorY*gn)})),crossTileIDs:o.map((s)=>s.crossTileID)};if(n.positions.length>128){let s=new JI(n.positions.length,16,Uint16Array);for(let{x:l,y:u}of n.positions)s.add(l,u);s.finish(),delete n.positions,n.index=s}this._symbolsByKey[a]=n}}getScaledCoordinates(e,t){let{x:i,y:r,z:a}=this.tileID.canonical,{x:o,y:n,z:s}=t.canonical,l=s-a,u=gn/2**l,c=(o*z+e.anchorX)*u,h=(n*z+e.anchorY)*u,d=i*z*gn,p=r*z*gn;return{x:Math.floor(c-d),y:Math.floor(h-p)}}findMatches(e,t,i){let r=this.tileID.canonical.z<t.canonical.z?1:2**(this.tileID.canonical.z-t.canonical.z);for(let a=0;a<e.length;a++){let o=e.get(a);if(o.crossTileID)continue;let n=this._symbolsByKey[o.key];if(!n)continue;let s=this.getScaledCoordinates(o,t);n.index?this.findMatchesForIndexedEntry(n,o,s,r,i):n.positions&&this.findMatchesForNonIndexedEntry(n,o,s,r,i)}}findMatchesForIndexedEntry(e,t,i,r,a){let o=e.index.range(i.x-r,i.y-r,i.x+r,i.y+r),n=1/0;for(let s of o)s<n&&!a[e.crossTileIDs[s]]&&(n=s);if(n!==1/0){let s=e.crossTileIDs[n];a[s]=!0,t.crossTileID=s}}findMatchesForNonIndexedEntry(e,t,i,r,a){for(let o=0;o<e.positions.length;o++){let n=e.positions[o],s=e.crossTileIDs[o];if(Math.abs(n.x-i.x)<=r&&Math.abs(n.y-i.y)<=r&&!a[s]){a[s]=!0,t.crossTileID=s;break}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:e})=>e)}},e7=class{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}},t7=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 r=this.indexes[i],a={};for(let o in r){let n=r[o];n.tileID=n.tileID.unwrapTo(n.tileID.wrap+t),a[n.tileID.key]=n}this.indexes[i]=a}this.lng=e}addBucket(e,t,i){if(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 a=0;a<t.symbolInstances.length;a++){let o=t.symbolInstances.get(a);o.crossTileID=0}this.usedCrossTileIDs[e.overscaledZ]||={};let r=this.usedCrossTileIDs[e.overscaledZ];for(let a in this.indexes){let o=this.indexes[a];if(Number(a)>e.overscaledZ)for(let n in o){let s=o[n];s.tileID.isChildOf(e)&&s.findMatches(t.symbolInstances,e,r)}else{let n=o[e.scaledTo(Number(a)).key];n&&n.findMatches(t.symbolInstances,e,r)}}for(let a=0;a<t.symbolInstances.length;a++){let o=t.symbolInstances.get(a);o.crossTileID||(o.crossTileID=i.generate(),r[o.crossTileID]=!0)}return this.indexes[e.overscaledZ]===void 0&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new QI(e,t.symbolInstances,t.bucketInstanceId),!0}removeBucketCrossTileIDs(e,t){for(let i of t.getCrossTileIDsLists())for(let r of i)delete this.usedCrossTileIDs[e][r]}removeStaleBuckets(e){let t=!1;for(let i in this.indexes){let r=this.indexes[i];for(let a in r)e[r[a].bucketInstanceId]||(this.removeBucketCrossTileIDs(i,r[a]),delete r[a],t=!0)}return t}},i7=class{constructor(){this.layerIndexes={},this.crossTileIDs=new e7,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,t,i){let r=this.layerIndexes[e.id];r===void 0&&(r=this.layerIndexes[e.id]=new t7);let a=!1,o={};r.handleWrapJump(i);for(let n of t){let s=n.getBucket(e);e.id===s?.layerIds[0]&&(s.bucketInstanceId||=(this.maxBucketInstanceId+=1,this.maxBucketInstanceId),r.addBucket(n.tileID,s,this.crossTileIDs)&&(a=!0),o[s.bucketInstanceId]=!0)}return r.removeStaleBuckets(o)&&(a=!0),a}pruneUnusedLayers(e){let t={};for(let i of e)t[i]=!0;for(let i in this.layerIndexes)t[i]||delete this.layerIndexes[i]}},r7=`#ifdef GL_ES
54
+ precision mediump float;
55
+ #else
56
+ #if !defined(lowp)
57
+ #define lowp
58
+ #endif
59
+ #if !defined(mediump)
60
+ #define mediump
61
+ #endif
62
+ #if !defined(highp)
63
+ #define highp
64
+ #endif
65
+ #endif
66
+ out highp vec4 fragColor;layout(std140) uniform ProjectionUBO {highp mat4 u_projection_matrix;highp mat4 u_projection_fallback_matrix;highp vec4 u_projection_tile_mercator_coords;highp vec4 u_projection_clipping_plane;highp float u_projection_transition;highp int u_projection_clip_antimeridian;};layout(std140) uniform FrameUBO {highp vec2 u_units_to_pixels;highp vec2 u_world_size;highp float u_camera_to_center_distance;highp float u_symbol_fade_change;highp float u_aspect_ratio;highp float u_device_pixel_ratio;highp vec2 u_viewport_size;highp vec2 u_pixel_extrude_scale;highp float u_pitch;};`,a7=`#ifdef GL_ES
67
+ precision highp float;
68
+ #else
69
+ #if !defined(lowp)
70
+ #define lowp
71
+ #endif
72
+ #if !defined(mediump)
73
+ #define mediump
74
+ #endif
75
+ #if !defined(highp)
76
+ #define highp
77
+ #endif
78
+ #endif
79
+ vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const uint packedOpacity) {return vec2(float(packedOpacity >> 1u)/127.0,float(packedOpacity & 1u));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0
80
+ );}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}mat3 rotationMatrixFromAxisAngle(vec3 u,float angle) {float c=cos(angle);float s=sin(angle);float c2=1.0-c;return mat3(u.x*u.x*c2+ c,u.x*u.y*c2-u.z*s,u.x*u.z*c2+u.y*s,u.y*u.x*c2+u.z*s,u.y*u.y*c2+ c,u.y*u.z*c2-u.x*s,u.z*u.x*c2-u.y*s,u.z*u.y*c2+u.x*s,u.z*u.z*c2+ c
81
+ );}
82
+ #ifdef TERRAIN3D
83
+ uniform sampler2D u_terrain;uniform highp sampler2D u_depth;layout(std140) uniform TerrainUBO {highp mat4 u_terrain_matrix;highp vec4 u_terrain_unpack;highp float u_terrain_dim;highp float u_terrain_exaggeration;};
84
+ #endif
85
+ 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) {
86
+ #ifdef TERRAIN3D
87
+ highp float d=unpack(texture(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));
88
+ #else
89
+ return 1.0;
90
+ #endif
91
+ }float calculate_visibility(vec4 pos) {
92
+ #ifdef TERRAIN3D
93
+ 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;
94
+ #else
95
+ return 1.0;
96
+ #endif
97
+ }float ele(ivec2 pos) {
98
+ #ifdef TERRAIN3D
99
+ vec4 rgb=(texelFetch(u_terrain,pos,0)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;
100
+ #else
101
+ return 0.0;
102
+ #endif
103
+ }float get_elevation(vec2 pos) {
104
+ #ifdef TERRAIN3D
105
+ #ifdef GLOBE
106
+ if ((pos.y <-32767.5) || (pos.y > 32766.5)) {return 0.0;}
107
+ #endif
108
+ vec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.5;vec2 f=fract(coord);ivec2 c=ivec2(floor(coord));ivec2 hi=textureSize(u_terrain,0)-1;float tl=ele(clamp(c,ivec2(0),hi));float tr=ele(clamp(c+ivec2(1,0),ivec2(0),hi));float bl=ele(clamp(c+ivec2(0,1),ivec2(0),hi));float br=ele(clamp(c+ivec2(1,1),ivec2(0),hi));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;
109
+ #else
110
+ return 0.0;
111
+ #endif
112
+ }const float PI=3.141592653589793;
113
+ #define PROJECTION_UBO
114
+ layout(std140) uniform ProjectionUBO {highp mat4 u_projection_matrix;highp mat4 u_projection_fallback_matrix;highp vec4 u_projection_tile_mercator_coords;highp vec4 u_projection_clipping_plane;highp float u_projection_transition;highp int u_projection_clip_antimeridian;};layout(std140) uniform FrameUBO {highp vec2 u_units_to_pixels;highp vec2 u_world_size;highp float u_camera_to_center_distance;highp float u_symbol_fade_change;highp float u_aspect_ratio;highp float u_device_pixel_ratio;highp vec2 u_viewport_size;highp vec2 u_pixel_extrude_scale;highp float u_pitch;};`,o7=`uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity;
115
+ #ifdef OVERDRAW_INSPECTOR
116
+ fragColor=vec4(1.0);
117
+ #endif
118
+ }`,n7="layout(location=0) in vec2 a_pos;void main() {gl_Position=projectTile(a_pos,a_pos);}",s7=`uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_mix)*u_opacity;
119
+ #ifdef OVERDRAW_INSPECTOR
120
+ fragColor=vec4(1.0);
121
+ #endif
122
+ }`,l7="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;layout(location=0) in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;void main() {gl_Position=projectTile(a_pos,a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}",u7=`in vec3 v_data;in float v_visibility;
123
+ #pragma maplibre: define highp vec4 color
124
+ #pragma maplibre: define mediump float radius
125
+ #pragma maplibre: define lowp float blur
126
+ #pragma maplibre: define lowp float opacity
127
+ #pragma maplibre: define highp vec4 stroke_color
128
+ #pragma maplibre: define mediump float stroke_width
129
+ #pragma maplibre: define lowp float stroke_opacity
130
+ void main() {
131
+ #pragma maplibre: initialize highp vec4 color
132
+ #pragma maplibre: initialize mediump float radius
133
+ #pragma maplibre: initialize lowp float blur
134
+ #pragma maplibre: initialize lowp float opacity
135
+ #pragma maplibre: initialize highp vec4 stroke_color
136
+ #pragma maplibre: initialize mediump float stroke_width
137
+ #pragma maplibre: initialize lowp float stroke_opacity
138
+ vec2 extrude=v_data.xy;float extrude_length=length(extrude);float antialiased_blur=v_data.z;float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));fragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);const float epsilon=0.5/255.0;if (fragColor.r < epsilon && fragColor.g < epsilon && fragColor.b < epsilon && fragColor.a < epsilon) {discard;}
139
+ #ifdef OVERDRAW_INSPECTOR
140
+ fragColor=vec4(1.0);
141
+ #endif
142
+ }`,c7=`uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform highp float u_globe_extrude_scale;uniform vec2 u_translate;layout(location=0) in ivec2 a_pos;out vec3 v_data;out float v_visibility;
143
+ #pragma maplibre: define highp vec4 color
144
+ #pragma maplibre: define mediump float radius
145
+ #pragma maplibre: define lowp float blur
146
+ #pragma maplibre: define lowp float opacity
147
+ #pragma maplibre: define highp vec4 stroke_color
148
+ #pragma maplibre: define mediump float stroke_width
149
+ #pragma maplibre: define lowp float stroke_opacity
150
+ void main(void) {
151
+ #pragma maplibre: initialize highp vec4 color
152
+ #pragma maplibre: initialize mediump float radius
153
+ #pragma maplibre: initialize lowp float blur
154
+ #pragma maplibre: initialize lowp float opacity
155
+ #pragma maplibre: initialize highp vec4 stroke_color
156
+ #pragma maplibre: initialize mediump float stroke_width
157
+ #pragma maplibre: initialize lowp float stroke_opacity
158
+ ivec2 pos_raw=a_pos+32768;vec2 extrude=vec2(pos_raw & 7)/7.0*2.0-1.0;vec2 circle_center=vec2(pos_raw >> 3)+u_translate;float ele=get_elevation(circle_center);v_visibility=calculate_visibility(projectTileWithElevation(circle_center,ele));if (u_pitch_with_map) {
159
+ #ifdef GLOBE
160
+ vec3 center_vector=projectToSphere(circle_center);
161
+ #endif
162
+ float angle_scale=u_globe_extrude_scale;vec2 corner_position=circle_center;if (u_scale_with_map) {angle_scale*=(radius+stroke_width);corner_position+=extrude*u_extrude_scale*(radius+stroke_width);} else {
163
+ #ifdef GLOBE
164
+ vec4 projected_center=interpolateProjection(circle_center,center_vector,ele);
165
+ #else
166
+ vec4 projected_center=projectTileWithElevation(circle_center,ele);
167
+ #endif
168
+ corner_position+=extrude*u_extrude_scale*(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);angle_scale*=(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);}
169
+ #ifdef GLOBE
170
+ vec2 angles=extrude*angle_scale;vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(corner_position,corner_vector,ele);
171
+ #else
172
+ gl_Position=projectTileWithElevation(corner_position,ele);
173
+ #endif
174
+ } else {gl_Position=projectTileWithElevation(circle_center,ele);if (gl_Position.z/gl_Position.w > 1.0) {gl_Position.xy=vec2(10000.0);}if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`,g_="void main() {fragColor=vec4(1.0);}",dr,fb="#define PROJECTION_MERCATOR",mb="mercator",Ol=class{constructor(e=ja){this._cachedMesh=null,this._worldCoordinateHelper=e}get name(){return this._worldCoordinateHelper.name}get worldCoordinateHelper(){return this._worldCoordinateHelper}get useSubdivision(){return!1}get shaderVariantName(){return mb}get shaderDefine(){return fb}get shaderPreludeCode(){return dr.projectionMercator}get vertexShaderPreludeCode(){return dr.projectionMercator.vertexSource}get subdivisionGranularity(){return Tf.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}destroy(){}getMeshFromTileID(e,t,i,r,a){if(this._cachedMesh)return this._cachedMesh;let o=new ba;o.emplaceBack(0,0),o.emplaceBack(z,0),o.emplaceBack(0,z),o.emplaceBack(z,z);let n=e.createVertexBuffer(o,ho.members),s=tt.simpleSegment(0,0,4,2),l=new xr;l.emplaceBack(1,0,2),l.emplaceBack(1,2,3);let u=e.createIndexBuffer(l);return this._cachedMesh=new as(n,u,s),this._cachedMesh}recalculate(){}hasTransition(){return!1}},h7,d7=()=>h7||=new Pt({type:new q(F.projection.type,"type")}),Oh,gb=class{constructor(){this._tileMeshCache={}}get name(){return"vertical-perspective"}get worldCoordinateHelper(){return ja}get transitionState(){return 1}get useSubdivision(){return!0}get shaderVariantName(){return"globe"}get shaderDefine(){return"#define GLOBE"}get shaderPreludeCode(){return dr.projectionGlobe}get vertexShaderPreludeCode(){return dr.projectionMercator.vertexSource}get subdivisionGranularity(){return Oh}get useGlobeControls(){return!0}destroy(){}_getMeshKey(e){return`${e.granularity.toString(36)}_${e.generateBorders?"b":""}${e.extendToNorthPole?"n":""}${e.extendToSouthPole?"s":""}`}getMeshFromTileID(e,t,i,r,a){let o=(a==="stencil"?Oh.stencil:Oh.tile).getGranularityForZoomLevel(t.z),n=t.y===0&&r,s=t.y===(1<<t.z)-1&&r;return this._getMesh(e,{granularity:o,generateBorders:i,extendToNorthPole:n,extendToSouthPole:s})}_getMesh(e,t){let i=this._getMeshKey(t);if(i in this._tileMeshCache)return this._tileMeshCache[i];let r=Ax(e,t);return this._tileMeshCache[i]=r,r}recalculate(e){}hasTransition(){return!1}},__,f7,v_,m7,g7=class{constructor(e,t,i){this.context=e;let r=e.gl;this.buffer=r.createBuffer(),this.dynamicDraw=!!i,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),r.bufferData(r.ELEMENT_ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?r.DYNAMIC_DRAW:r.STATIC_DRAW),this.dynamicDraw||t.freeBufferAfterUpload()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){let t=this.context.gl;if(!this.dynamicDraw)throw 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)}},x_,_7=class{constructor(e,t,i,r){this.length=t.length,this.attributes=i,this.itemSize=t.bytesPerElement,this.dynamicDraw=r,this.context=e;let a=e.gl;this.buffer=a.createBuffer(),e.bindVertexBuffer.set(this.buffer),a.bufferData(a.ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?a.DYNAMIC_DRAW:a.STATIC_DRAW),this.dynamicDraw||t.freeBufferAfterUpload()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){if(e.length!==this.length)throw 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 of this.attributes){let r=t.attributes[i.name];r!==void 0&&e.enableVertexAttribArray(r.location)}}setVertexAttribPointers(e,t,i){for(let r of this.attributes){let a=t.attributes[r.name];if(a!==void 0){let o=r.offset+this.itemSize*(i||0);a.isInteger?e.vertexAttribIPointer(a.location,r.components,e[x_[r.type]],this.itemSize,o):e.vertexAttribPointer(a.location,r.components,e[x_[r.type]],!1,this.itemSize,o)}}}destroy(){let e=this.context.gl;this.buffer&&(e.deleteBuffer(this.buffer),delete this.buffer)}},Re=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)}},y7,v7,x7,b7,w7,T7,E7,S7,C7,D7,A7,M7,P7,I7,k7,F7,R7,z7,L7,B7,O7,j7,N7,V7,$7,U7,q7,G7,W7,Z7,H7,Kf,X7,Y7,K7,J7=class{constructor(e,t,i,r,a){this.context=e,this.width=t,this.height=i;let o=e.gl,n=this.framebuffer=o.createFramebuffer();if(this.colorAttachment=new X7(e,n),r)this.depthAttachment=a?new K7(e,n):new Y7(e,n);else if(a)throw Error("Stencil cannot be set without depth")}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)}},nc,ek,Qf=class{constructor(e,t,i){this.context=e,this.binding=t,this.contentWords=i.contentWords;let r=e.gl;this.buffer=r.createBuffer(),r.bindBuffer(r.UNIFORM_BUFFER,this.buffer),r.bufferData(r.UNIFORM_BUFFER,i.sizeWords*4,r.DYNAMIC_DRAW),this.uploaded=new Float32Array(i.sizeWords),this.pending=new Float32Array(i.sizeWords),this.uploadedWords=new Uint32Array(this.uploaded.buffer),this.pendingWords=new Uint32Array(this.pending.buffer),this.hasData=!1}upload(){let e=this.context.gl,t=!this.hasData;if(!t){let i=this.pendingWords,r=this.uploadedWords;for(let a=0;a<this.contentWords;a++)if(i[a]!==r[a]){t=!0;break}}t?(e.bindBufferBase(e.UNIFORM_BUFFER,this.binding,this.buffer),this.context.boundUniformBuffers[this.binding]=this.buffer,e.bufferData(e.UNIFORM_BUFFER,this.pending,e.DYNAMIC_DRAW),this.uploaded.set(this.pending),this.hasData=!0):this.bind()}bind(){let e=this.context.boundUniformBuffers;if(e[this.binding]===this.buffer)return;let t=this.context.gl;t.bindBufferBase(t.UNIFORM_BUFFER,this.binding,this.buffer),e[this.binding]=this.buffer}destroy(){let e=this.context.gl;this.buffer&&(e.deleteBuffer(this.buffer),delete this.buffer)}},_b,ro,vb,Zt,xb,yl,ze=class{constructor(e,t,i){this.blendFunction=e,this.blendColor=t,this.mask=i}},lk=class{constructor(e){this.gl=e,this.clearColor=new y7(this),this.clearDepth=new v7(this),this.clearStencil=new x7(this),this.colorMask=new b7(this),this.depthMask=new w7(this),this.stencilMask=new T7(this),this.stencilFunc=new E7(this),this.stencilOp=new S7(this),this.stencilTest=new C7(this),this.depthRange=new D7(this),this.depthTest=new A7(this),this.depthFunc=new M7(this),this.blend=new P7(this),this.blendFunc=new I7(this),this.blendColor=new k7(this),this.blendEquation=new F7(this),this.cullFace=new R7(this),this.cullFaceSide=new z7(this),this.frontFace=new L7(this),this.program=new B7(this),this.activeTexture=new O7(this),this.viewport=new j7(this),this.bindFramebuffer=new N7(this),this.bindRenderbuffer=new V7(this),this.bindTexture=new $7(this),this.bindVertexBuffer=new U7(this),this.bindElementBuffer=new q7(this),this.bindVertexArray=new G7(this),this.pixelStoreUnpack=new W7(this),this.pixelStoreUnpackPremultiplyAlpha=new Z7(this),this.pixelStoreUnpackFlipY=new H7(this),this.extTextureFilterAnisotropic=e.getExtension("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),e.getExtension("EXT_color_buffer_half_float"),e.getExtension("EXT_color_buffer_float"),this.boundUniformBuffers=[],this.projectionUniformBuffer=yb(this),this.keyedProjectionUniformBuffers=new Map,this.freeProjectionUniformBuffers=[],this.terrainUniformBuffer=nk(this),this.frameUniformBuffer=ak(this)}destroy(){rk(this),this.terrainUniformBuffer.destroy(),this.frameUniformBuffer.destroy()}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,this.boundUniformBuffers=[]}setCustomLayerDefaults(){this.unbindVAO(),this.cullFace.setDefault(),this.activeTexture.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}createIndexBuffer(e,t){return new g7(this,e,t)}createVertexBuffer(e,t,i){return new _7(this,e,t,i)}createRenderbuffer(e,t,i){let r=this.gl,a=r.createRenderbuffer();return this.bindRenderbuffer.set(a),r.renderbufferStorage(r.RENDERBUFFER,e,t,i),this.bindRenderbuffer.set(null),a}createFramebuffer(e,t,i,r){return new J7(this,e,t,i,r)}clear({color:e,depth:t,stencil:i}){let r=this.gl,a=0;e&&(a|=r.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),t!==void 0&&(a|=r.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(t),this.depthMask.set(!0)),i!==void 0&&(a|=r.STENCIL_BUFFER_BIT,this.clearStencil.set(i),this.stencilMask.set(255)),r.clear(a)}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){lr(e.blendFunction,ze.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 this.gl.createVertexArray()}deleteVertexArray(e){this.gl.deleteVertexArray(e)}unbindVAO(){this.bindVertexArray.set(null)}},uk=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,r,a,o,n,s,l){this.context=e;let u=this.boundPaintVertexBuffers.length!==r.length;for(let c=0;!u&&c<r.length;c++)this.boundPaintVertexBuffers[c]!==r[c]&&(u=!0);!this.vao||this.boundProgram!==t||this.boundLayoutVertexBuffer!==i||u||this.boundIndexBuffer!==a||this.boundVertexOffset!==o||this.boundDynamicVertexBuffer!==n||this.boundDynamicVertexBuffer2!==s||this.boundDynamicVertexBuffer3!==l?this.freshBind(t,i,r,a,o,n,s,l):e.bindVertexArray.set(this.vao)}freshBind(e,t,i,r,a,o,n,s){let l=e.numAttributes,u=this.context,c=u.gl;this.vao&&this.destroy(),this.vao=u.createVertexArray(),u.bindVertexArray.set(this.vao),this.boundProgram=e,this.boundLayoutVertexBuffer=t,this.boundPaintVertexBuffers=i,this.boundIndexBuffer=r,this.boundVertexOffset=a,this.boundDynamicVertexBuffer=o,this.boundDynamicVertexBuffer2=n,this.boundDynamicVertexBuffer3=s,t.enableAttributes(c,e);for(let h of i)h.enableAttributes(c,e);o&&o.enableAttributes(c,e),n&&n.enableAttributes(c,e),s&&s.enableAttributes(c,e),t.bind(),t.setVertexAttribPointers(c,e,a);for(let h of i)h.bind(),h.setVertexAttribPointers(c,e,a);o&&(o.bind(),o.setVertexAttribPointers(c,e,a)),r&&r.bind(),n&&(n.bind(),n.setVertexAttribPointers(c,e,a)),s&&(s.bind(),s.setVertexAttribPointers(c,e,a)),u.currentNumAttributes=l}destroy(){this.vao&&=(this.context.deleteVertexArray(this.vao),null)}},ck=(e,t)=>({u_depth:new te(e,t.u_depth),u_terrain:new te(e,t.u_terrain)}),hk=(e,t)=>({u_texture:new te(e,t.u_texture),u_ele_delta:new G(e,t.u_ele_delta),u_fog_matrix:new Ji(e,t.u_fog_matrix),u_fog_color:new na(e,t.u_fog_color),u_fog_ground_blend:new G(e,t.u_fog_ground_blend),u_fog_ground_blend_opacity:new G(e,t.u_fog_ground_blend_opacity),u_horizon_color:new na(e,t.u_horizon_color),u_horizon_fog_blend:new G(e,t.u_horizon_fog_blend),u_is_globe_mode:new G(e,t.u_is_globe_mode)}),dk=(e,t)=>({u_ele_delta:new G(e,t.u_ele_delta)}),pk=(e,t)=>({u_tile_bounds:new Io(e,t.u_tile_bounds)}),fk=(e,t,i,r,a)=>({u_texture:0,u_ele_delta:e,u_fog_matrix:t,u_fog_color:i?i["fog-color"]:se.white,u_fog_ground_blend:i?i["fog-ground-blend"]:1,u_fog_ground_blend_opacity:a?0:i?VA(r):0,u_horizon_color:i?i["horizon-color"]:se.white,u_horizon_fog_blend:i?i["horizon-fog-blend"]:1,u_is_globe_mode:+!!a}),mk=(e)=>({u_ele_delta:e}),gk=(e)=>({u_tile_bounds:e}),yk=class{constructor(e,t,i,r,a,o,n,s,l=[]){let u=e.gl;this.program=u.createProgram();let c=jh(t.staticAttributes),h=i?i.getBinderAttributes():[],d=c.concat(h),p=dr.prelude.staticUniforms?jh(dr.prelude.staticUniforms):[],f=t.staticUniforms?jh(t.staticUniforms):[],m=i?i.getBinderUniforms():[],g=p.concat(f).concat(m),_=[];for(let S of g)_.includes(S)||_.push(S);let y=i?i.defines():[];y.unshift("#version 300 es"),a&&y.push("#define OVERDRAW_INSPECTOR;"),o&&y.push("#define TERRAIN3D;"),s&&y.push(s),l&&y.push(...l);let v=y.concat(dr.prelude.fragmentSource,n.fragmentSource,t.fragmentSource).join(`
175
+ `),x=y.concat(dr.prelude.vertexSource,n.vertexSource,t.vertexSource).join(`
176
+ `),b=u.createShader(u.FRAGMENT_SHADER);if(u.isContextLost()){this.failedToCreate=!0;return}u.shaderSource(b,v),u.compileShader(b),u.attachShader(this.program,b);let w=u.createShader(u.VERTEX_SHADER);if(u.isContextLost()){this.failedToCreate=!0;return}u.shaderSource(w,x),u.compileShader(w),u.attachShader(this.program,w),this.attributes={};let T={};if(this.numAttributes=d.length,u.linkProgram(this.program),!u.getProgramParameter(this.program,u.LINK_STATUS)){if(u.isContextLost()||u.getProgramParameter(this.program,u.ATTACHED_SHADERS)===0){this.failedToCreate=!0;return}throw u.getShaderParameter(b,u.COMPILE_STATUS)?u.getShaderParameter(w,u.COMPILE_STATUS)?Error(`Program failed to link: ${u.getProgramInfoLog(this.program)}`):Error(`Could not compile vertex shader: ${u.getShaderInfoLog(w)}`):Error(`Could not compile fragment shader: ${u.getShaderInfoLog(b)}`)}Q7(u,this.program);let E=_k(u,this.program);for(let S of d){if(!S)continue;let A=u.getAttribLocation(this.program,S);A>=0&&(this.attributes[S]={location:A,isInteger:E.has(S)})}u.deleteShader(w),u.deleteShader(b);for(let S of _)if(S&&!T[S]){let A=u.getUniformLocation(this.program,S);A&&(T[S]=A)}this.fixedUniforms=r(e,T),this.terrainUniforms=ck(e,T),this.binderUniforms=i?i.getUniforms(e,T):[]}draw(e,t,i,r,a,o,n,s,l,u,c,h,d,p,f,m,g,_,y){let v=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.terrainUniformBuffer.bind(),e.frameUniformBuffer.bind(),e.setDepthMode(i),e.setStencilMode(r),e.setColorMode(a),e.setCullFace(o),s){e.activeTexture.set(v.TEXTURE2),v.bindTexture(v.TEXTURE_2D,s.depthTexture),e.activeTexture.set(v.TEXTURE3),v.bindTexture(v.TEXTURE_2D,s.texture);for(let b in this.terrainUniforms)this.terrainUniforms[b].set(s[b]);sk(e.terrainUniformBuffer,s)}if(tk(e,l),n)for(let b in this.fixedUniforms)this.fixedUniforms[b].set(n[b]);m&&m.setUniforms(e,this.binderUniforms,p,{zoom:f});let x=0;switch(t){case v.LINES:x=2;break;case v.TRIANGLES:x=3;break;case v.LINE_STRIP:x=1}for(let b of d.get())b.vaos||={},b.vaos[u]||=new uk,b.vaos[u].bind(e,this,c,m?m.getPaintVertexBuffers():[],h,b.vertexOffset,g,_,y),v.drawElements(t,b.primitiveLength*x,v.UNSIGNED_SHORT,b.primitiveOffset*x*2)}},xk=(e,t)=>({u_lightpos:new Kt(e,t.u_lightpos),u_lightpos_globe:new Kt(e,t.u_lightpos_globe),u_lightintensity:new G(e,t.u_lightintensity),u_lightcolor:new Kt(e,t.u_lightcolor),u_vertical_gradient:new G(e,t.u_vertical_gradient),u_opacity:new G(e,t.u_opacity),u_fill_translate:new pe(e,t.u_fill_translate)}),bk=(e,t)=>({u_lightpos:new Kt(e,t.u_lightpos),u_lightpos_globe:new Kt(e,t.u_lightpos_globe),u_lightintensity:new G(e,t.u_lightintensity),u_lightcolor:new Kt(e,t.u_lightcolor),u_vertical_gradient:new G(e,t.u_vertical_gradient),u_height_factor:new G(e,t.u_height_factor),u_opacity:new G(e,t.u_opacity),u_fill_translate:new pe(e,t.u_fill_translate),u_image:new te(e,t.u_image),u_texsize:new pe(e,t.u_texsize),u_pixel_coord_upper:new pe(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new pe(e,t.u_pixel_coord_lower),u_scale:new Kt(e,t.u_scale),u_fade:new G(e,t.u_fade)}),wb=(e,t,i,r,a)=>{let o=by(t.position),n=fy();t.anchor==="viewport"&&x5(n,e.bearingInRadians),P5(o,o,n);let s=V(e).transformLightDirection(e,o),l=t.color;return{u_lightpos:o,u_lightpos_globe:s,u_lightintensity:t.intensity,u_lightcolor:[l.r,l.g,l.b],u_vertical_gradient:+i,u_opacity:r,u_fill_translate:a}},wk=(e,t,i,r,a,o,n,s)=>ee(wb(e,t,i,r,a),bb(n,e,s),{u_height_factor:-(2**o.overscaledZ)/s.tileSize/8}),Tk=(e,t)=>({u_fill_translate:new pe(e,t.u_fill_translate)}),Ek=(e,t)=>({u_image:new te(e,t.u_image),u_texsize:new pe(e,t.u_texsize),u_pixel_coord_upper:new pe(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new pe(e,t.u_pixel_coord_lower),u_scale:new Kt(e,t.u_scale),u_fade:new G(e,t.u_fade),u_sdf_pattern:new te(e,t.u_sdf_pattern),u_fill_translate:new pe(e,t.u_fill_translate)}),Sk=(e,t)=>({u_fill_translate:new pe(e,t.u_fill_translate)}),Ck=(e,t)=>({u_image:new te(e,t.u_image),u_texsize:new pe(e,t.u_texsize),u_pixel_coord_upper:new pe(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new pe(e,t.u_pixel_coord_lower),u_scale:new Kt(e,t.u_scale),u_fade:new G(e,t.u_fade),u_sdf_pattern:new te(e,t.u_sdf_pattern),u_fill_translate:new pe(e,t.u_fill_translate)}),Tb=(e,t,i,r,a)=>ee(bb(t,e,i),{u_fill_translate:r,u_sdf_pattern:+!!a}),Dk=(e)=>({u_fill_translate:e}),Ak=(e)=>({u_fill_translate:e}),Mk=(e,t,i,r,a)=>Tb(e,t,i,r,a),Pk=(e,t)=>({u_scale_with_map:new te(e,t.u_scale_with_map),u_pitch_with_map:new te(e,t.u_pitch_with_map),u_extrude_scale:new pe(e,t.u_extrude_scale),u_globe_extrude_scale:new G(e,t.u_globe_extrude_scale),u_translate:new pe(e,t.u_translate)}),Ik=(e,t,i,r,a)=>{let o,n,s=0;if(i.paint.get("circle-pitch-alignment")==="map"){let l=Ti(t,1,e.zoom);o=!0,n=[l,l],s=l/(z*2**t.tileID.overscaledZ)*2*Math.PI*a}else o=!1,n=e.pixelsToGLUnits;return{u_scale_with_map:+(i.paint.get("circle-pitch-scale")==="map"),u_pitch_with_map:+o,u_extrude_scale:n,u_globe_extrude_scale:s,u_translate:r}},kk=(e,t)=>({u_color:new na(e,t.u_color),u_overlay:new te(e,t.u_overlay),u_overlay_scale:new G(e,t.u_overlay_scale)}),T_=(e,t=1)=>({u_color:e,u_overlay:0,u_overlay_scale:t}),Fk=(e,t)=>({u_extrude_scale:new G(e,t.u_extrude_scale),u_intensity:new G(e,t.u_intensity),u_globe_extrude_scale:new G(e,t.u_globe_extrude_scale)}),Rk=(e,t)=>({u_matrix:new Ji(e,t.u_matrix),u_image:new te(e,t.u_image),u_color_ramp:new te(e,t.u_color_ramp),u_opacity:new G(e,t.u_opacity)}),Eb=(e,t,i,r)=>{let a=Ti(e,1,t)/(z*2**e.tileID.overscaledZ)*2*Math.PI*r;return{u_extrude_scale:Ti(e,1,t),u_intensity:i,u_globe_extrude_scale:a}},Sb=(e,t,i,r)=>{let a=Lo();return Pr(a,0,e.width,e.height,0,0,1),{u_matrix:a,u_image:i,u_color_ramp:r,u_opacity:t.paint.get("heatmap-opacity")}},zk=(e,t)=>({u_image:new te(e,t.u_image),u_latrange:new pe(e,t.u_latrange),u_exaggeration:new G(e,t.u_exaggeration),u_altitudes:new M0(e,t.u_altitudes),u_azimuths:new M0(e,t.u_azimuths),u_accent:new na(e,t.u_accent),u_method:new te(e,t.u_method),u_shadows:new A0(e,t.u_shadows),u_highlights:new A0(e,t.u_highlights)}),Lk=(e,t)=>({u_matrix:new Ji(e,t.u_matrix),u_image:new te(e,t.u_image),u_dimension:new pe(e,t.u_dimension),u_zoom:new G(e,t.u_zoom),u_unpack:new Io(e,t.u_unpack),u_log2_world_width:new G(e,t.u_log2_world_width)}),Bk=(e,t,i,r)=>{let a=r.paint.get("hillshade-accent-color"),o;switch(r.paint.get("hillshade-method")){case"basic":o=4;break;case"combined":o=1;break;case"igor":o=2;break;case"multidirectional":o=3;break;default:o=0}let n=r.getIlluminationProperties();for(let s=0;s<n.directionRadians.length;s++)r.paint.get("hillshade-illumination-anchor")==="viewport"&&(n.directionRadians[s]+=e.bearingInRadians);return{u_image:0,u_latrange:Nk(t,i.tileID),u_exaggeration:r.paint.get("hillshade-exaggeration"),u_altitudes:n.altitudeRadians,u_azimuths:n.directionRadians,u_accent:a,u_method:o,u_highlights:n.highlightColor,u_shadows:n.shadowColor}},Ok=(e,t,i)=>{let r=i.stride,a=Lo();return Pr(a,0,z,-8192,0,0,1),gt(a,a,[0,-8192,0]),{u_matrix:a,u_image:1,u_dimension:[r,r],u_zoom:t.overscaledZ,u_unpack:i.getUnpackVector(),u_log2_world_width:jk(e)}},Vk=(e,t)=>({u_image:new te(e,t.u_image),u_unpack:new Io(e,t.u_unpack),u_dimension:new pe(e,t.u_dimension),u_elevation_stops:new te(e,t.u_elevation_stops),u_color_stops:new te(e,t.u_color_stops),u_color_ramp_size:new te(e,t.u_color_ramp_size),u_opacity:new G(e,t.u_opacity)}),$k=(e,t,i=0)=>({u_image:0,u_unpack:t.getUnpackVector(),u_dimension:[t.stride,t.stride],u_elevation_stops:1,u_color_stops:4,u_color_ramp_size:i,u_opacity:e.paint.get("color-relief-opacity")}),Uk=(e,t)=>({u_translation:new pe(e,t.u_translation),u_ratio:new G(e,t.u_ratio)}),qk=(e,t)=>({u_translation:new pe(e,t.u_translation),u_ratio:new G(e,t.u_ratio),u_image:new te(e,t.u_image),u_image_height:new G(e,t.u_image_height)}),Gk=(e,t)=>({u_translation:new pe(e,t.u_translation),u_texsize:new pe(e,t.u_texsize),u_ratio:new G(e,t.u_ratio),u_image:new te(e,t.u_image),u_scale:new Kt(e,t.u_scale),u_fade:new G(e,t.u_fade)}),Wk=(e,t)=>({u_translation:new pe(e,t.u_translation),u_ratio:new G(e,t.u_ratio),u_image:new te(e,t.u_image),u_mix:new G(e,t.u_mix),u_tileratio:new G(e,t.u_tileratio),u_crossfade_from:new G(e,t.u_crossfade_from),u_crossfade_to:new G(e,t.u_crossfade_to),u_lineatlas_width:new G(e,t.u_lineatlas_width),u_lineatlas_height:new G(e,t.u_lineatlas_height)}),Zk=(e,t)=>({u_translation:new pe(e,t.u_translation),u_ratio:new G(e,t.u_ratio),u_image:new te(e,t.u_image),u_image_height:new G(e,t.u_image_height),u_tileratio:new G(e,t.u_tileratio),u_crossfade_from:new G(e,t.u_crossfade_from),u_crossfade_to:new G(e,t.u_crossfade_to),u_image_dash:new te(e,t.u_image_dash),u_mix:new G(e,t.u_mix),u_lineatlas_width:new G(e,t.u_lineatlas_width),u_lineatlas_height:new G(e,t.u_lineatlas_height)}),sc=(e,t,i,r)=>({u_translation:Cb(e,t,i),u_ratio:r/Ti(t,1,e.zoom)}),Hk=(e,t,i,r,a)=>ee(sc(e,t,i,r),{u_image:0,u_image_height:a}),Xk=(e,t,i,r,a)=>{let o=em(t,e);return{u_translation:Cb(e,t,i),u_texsize:t.imageAtlasTexture.size,u_ratio:r/Ti(t,1,e.zoom),u_image:0,u_scale:[o,a.fromScale,a.toScale],u_fade:a.t}},Yk=(e,t,i,r,a,o)=>{let n=em(i,e);return ee(sc(e,i,r,a),{u_tileratio:n,u_crossfade_from:o.fromScale,u_crossfade_to:o.toScale,u_image:0,u_mix:o.t,u_lineatlas_width:t.width,u_lineatlas_height:t.height})},Kk=(e,t,i,r,a,o,n)=>{let s=em(i,e);return ee(sc(e,i,r,a),{u_image:0,u_image_height:n,u_tileratio:s,u_crossfade_from:o.fromScale,u_crossfade_to:o.toScale,u_image_dash:1,u_mix:o.t,u_lineatlas_width:t.width,u_lineatlas_height:t.height})},Jk=(e,t)=>({u_image:new te(e,t.u_image),u_backdrop:new te(e,t.u_backdrop),u_backdrop_offset:new pe(e,t.u_backdrop_offset),u_opacity:new G(e,t.u_opacity)}),Qk=(e,t,i,r)=>({u_image:t,u_backdrop:i,u_backdrop_offset:r,u_opacity:e}),e9=(e,t)=>({u_is_size_zoom_constant:new te(e,t.u_is_size_zoom_constant),u_is_size_feature_constant:new te(e,t.u_is_size_feature_constant),u_size_t:new G(e,t.u_size_t),u_size:new G(e,t.u_size),u_rotate_symbol:new te(e,t.u_rotate_symbol),u_label_plane_matrix:new Ji(e,t.u_label_plane_matrix),u_coord_matrix:new Ji(e,t.u_coord_matrix),u_is_text:new te(e,t.u_is_text),u_pitch_with_map:new te(e,t.u_pitch_with_map),u_is_along_line:new te(e,t.u_is_along_line),u_is_variable_anchor:new te(e,t.u_is_variable_anchor),u_texsize:new pe(e,t.u_texsize),u_texture:new te(e,t.u_texture),u_translation:new pe(e,t.u_translation),u_pitched_scale:new G(e,t.u_pitched_scale),u_is_offset:new te(e,t.u_is_offset),u_height_anchor_ground:new te(e,t.u_height_anchor_ground)}),t9=(e,t)=>({u_is_size_zoom_constant:new te(e,t.u_is_size_zoom_constant),u_is_size_feature_constant:new te(e,t.u_is_size_feature_constant),u_size_t:new G(e,t.u_size_t),u_size:new G(e,t.u_size),u_rotate_symbol:new te(e,t.u_rotate_symbol),u_label_plane_matrix:new Ji(e,t.u_label_plane_matrix),u_coord_matrix:new Ji(e,t.u_coord_matrix),u_is_text:new te(e,t.u_is_text),u_pitch_with_map:new te(e,t.u_pitch_with_map),u_is_along_line:new te(e,t.u_is_along_line),u_is_variable_anchor:new te(e,t.u_is_variable_anchor),u_texsize:new pe(e,t.u_texsize),u_texture:new te(e,t.u_texture),u_gamma_scale:new G(e,t.u_gamma_scale),u_is_halo:new te(e,t.u_is_halo),u_is_plain:new te(e,t.u_is_plain),u_translation:new pe(e,t.u_translation),u_pitched_scale:new G(e,t.u_pitched_scale),u_is_offset:new te(e,t.u_is_offset),u_height_anchor_ground:new te(e,t.u_height_anchor_ground)}),i9=(e,t)=>({u_is_size_zoom_constant:new te(e,t.u_is_size_zoom_constant),u_is_size_feature_constant:new te(e,t.u_is_size_feature_constant),u_size_t:new G(e,t.u_size_t),u_size:new G(e,t.u_size),u_rotate_symbol:new te(e,t.u_rotate_symbol),u_label_plane_matrix:new Ji(e,t.u_label_plane_matrix),u_coord_matrix:new Ji(e,t.u_coord_matrix),u_is_text:new te(e,t.u_is_text),u_pitch_with_map:new te(e,t.u_pitch_with_map),u_is_along_line:new te(e,t.u_is_along_line),u_is_variable_anchor:new te(e,t.u_is_variable_anchor),u_texsize:new pe(e,t.u_texsize),u_texsize_icon:new pe(e,t.u_texsize_icon),u_texture:new te(e,t.u_texture),u_texture_icon:new te(e,t.u_texture_icon),u_gamma_scale:new G(e,t.u_gamma_scale),u_is_halo:new te(e,t.u_is_halo),u_translation:new pe(e,t.u_translation),u_pitched_scale:new G(e,t.u_pitched_scale),u_is_offset:new te(e,t.u_is_offset),u_height_anchor_ground:new te(e,t.u_height_anchor_ground)}),Db=(e,t,i,r,a,o,n,s,l,u,c,h,d,p)=>({u_is_size_zoom_constant:+(e==="constant"||e==="source"),u_is_size_feature_constant:+(e==="constant"||e==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_rotate_symbol:+i,u_label_plane_matrix:n,u_coord_matrix:s,u_is_text:+u,u_pitch_with_map:+r,u_is_along_line:a,u_is_variable_anchor:o,u_texsize:c,u_texture:0,u_translation:l,u_pitched_scale:h,u_is_offset:d,u_height_anchor_ground:+p}),Ab=(e,t,i,r,a,o,n,s,l,u,c,h,d,p,f,m)=>ee(Db(e,t,i,r,a,o,s,l,u,c,h,p,f,m),{u_gamma_scale:r?Math.cos(n.pitch*Math.PI/180)*n.cameraToCenterDistance:1,u_is_halo:+!!d,u_is_plain:1}),r9=(e,t,i,r,a,o,n,s,l,u,c,h,d,p,f)=>ee(Ab(e,t,i,r,a,o,n,s,l,u,!0,c,!0,d,p,f),{u_texsize_icon:h,u_texture_icon:1}),a9=(e,t)=>({u_opacity:new G(e,t.u_opacity),u_color:new na(e,t.u_color)}),o9=(e,t)=>({u_opacity:new G(e,t.u_opacity),u_image:new te(e,t.u_image),u_pattern_tl_a:new pe(e,t.u_pattern_tl_a),u_pattern_br_a:new pe(e,t.u_pattern_br_a),u_pattern_tl_b:new pe(e,t.u_pattern_tl_b),u_pattern_br_b:new pe(e,t.u_pattern_br_b),u_texsize:new pe(e,t.u_texsize),u_mix:new G(e,t.u_mix),u_pattern_size_a:new pe(e,t.u_pattern_size_a),u_pattern_size_b:new pe(e,t.u_pattern_size_b),u_scale_a:new G(e,t.u_scale_a),u_scale_b:new G(e,t.u_scale_b),u_pixel_coord_upper:new pe(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new pe(e,t.u_pixel_coord_lower),u_tile_units_to_pixels:new G(e,t.u_tile_units_to_pixels)}),n9=(e,t)=>({u_opacity:e,u_color:t}),s9=(e,t,i,r,a,o)=>ee(vk(r,o,t,i,a),{u_opacity:e}),l9=(e,t)=>({u_sun_pos:new Kt(e,t.u_sun_pos),u_atmosphere_blend:new G(e,t.u_atmosphere_blend),u_globe_position:new Kt(e,t.u_globe_position),u_globe_radius:new G(e,t.u_globe_radius),u_inv_proj_matrix:new Ji(e,t.u_inv_proj_matrix)}),u9=(e,t,i,r,a)=>({u_sun_pos:e,u_atmosphere_blend:t,u_globe_position:i,u_globe_radius:r,u_inv_proj_matrix:a}),c9=(e,t)=>({u_sky_color:new na(e,t.u_sky_color),u_horizon_color:new na(e,t.u_horizon_color),u_horizon:new pe(e,t.u_horizon),u_horizon_normal:new pe(e,t.u_horizon_normal),u_sky_horizon_blend:new G(e,t.u_sky_horizon_blend),u_sky_blend:new G(e,t.u_sky_blend),u_inv_proj_matrix:new Ji(e,t.u_inv_proj_matrix),u_globe_position:new Kt(e,t.u_globe_position),u_globe_radius:new G(e,t.u_globe_radius),u_atmosphere_blend:new G(e,t.u_atmosphere_blend)}),h9=(e,t,i)=>{let r=Math.cos(t.rollInRadians),a=Math.sin(t.rollInRadians),o=Yu(t),n=V(t).getProjectionData(t,{overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition,s=b2(t),l=Na(t.worldSize,t.center.lat);return{u_sky_color:e["sky-color"],u_horizon_color:e["horizon-color"],u_horizon:[(t.width/2-o*a)*i,(t.height/2+o*r)*i],u_horizon_normal:[-a,r],u_sky_horizon_blend:e["sky-horizon-blend"]*t.height/2*i,u_sky_blend:n,u_inv_proj_matrix:t.inverseProjectionMatrix,u_globe_position:s,u_globe_radius:l,u_atmosphere_blend:e["atmosphere-blend"]*w2(Ki(s)-l,l)}},vl=(e,t)=>({}),d9,p9=class{constructor(e){this.programs={},this.context=e}getProgram(e){let t=e.programConfiguration?e.programConfiguration.cacheKey:"",i=`/${e.projectionShaderVariant.name}`,r=e.showOverdrawInspector?"/overdraw":"",a=e.useTerrain?"/terrain":"",o=e.defines?`/${e.defines.join("/")}`:"",n=e.name+t+i+r+a+o;return this.programs[n]||=new yk(this.context,dr[e.name],e.programConfiguration,d9[e.name],e.showOverdrawInspector,e.useTerrain,e.projectionShaderVariant.prelude,e.projectionShaderVariant.define,e.defines),this.programs[n]}destroy(){for(let e of Object.values(this.programs))e.program&&this.context.gl.deleteProgram(e.program);this.programs={}}},Nh=7680,Ce=class{constructor(e,t,i,r,a,o){this.test=e,this.ref=t,this.mask=i,this.fail=r,this.depthFail=a,this.pass=o}},E_=1029,Vh=2305,Ae=class{constructor(e,t,i){this.enable=e,this.mode=t,this.frontFace=i}},xe=class{constructor(e,t,i){this.func=e,this.mask=t,this.range=i}},xl,m9,Ib,P9,I9,P_=0,Gh,Y9,K9,J9,Q9,eF,mF,R_,z_=0.0000152587890625,gF,_F=class{constructor(e){this.currentLayer=0,this.opaquePassCutoff=1/0,this.depthRangeFor3D=[0,1],this.isRenderingToTexture=!1,this.layerCompositeSampled=!1,this.nextStencilID=1,this.tileClippingMaskIDs={},this.projectedCamera=e.projectedCamera,this.worldCoordinateHelper=e.worldCoordinateHelper,this.terrain=e.terrain,this.data=e.data,this.context=e.context,this.programCache=e.programCache,this.currentPass=e.currentPass,this.projection=e.projection}getProjectionDataForTile(e,t={}){let i=V(this.projectedCamera).getProjectionData(this.projectedCamera,{overscaledTileID:e,aligned:t.aligned,applyGlobeMatrix:!this.isRenderingToTexture,applyTerrainMatrix:t.applyTerrainMatrix??!0});return this.isRenderingToTexture||(i.uniformBufferKey=t.aligned?`${e.key}/aligned`:e.key),i}getTerrainDataForTile(e){return this.isRenderingToTexture?null:this.terrain?.getTerrainData(e)??null}getMeshFromTileID(e,t,i,r){return this.projection.getMeshFromTileID(this.context,e,t,i,r)}useProgram(e,t,i=!1,r=[]){return this.programCache.getProgram({name:e,programConfiguration:t,projectionShaderVariant:i?gF:this.data.projectionShaderVariant,showOverdrawInspector:this.data.showOverdrawInspector,useTerrain:this.terrain!==null,defines:r})}colorModeForRenderPass(){let e=this.context.gl;if(this.data.showOverdrawInspector){let t=0.125;return new ze([e.CONSTANT_COLOR,e.ONE],new se(t,t,t,0),[!0,!0,!0,!0])}return this.currentPass==="opaque"?ze.unblended:ze.alphaBlended}getDepthModeForSublayer(e,t,i){if(!this.opaquePassEnabledForLayer())return xe.disabled;let r=1-((1+this.currentLayer)*R_+e)*z_;return new xe(i||this.context.gl.LEQUAL,t,[r,r])}getDepthModeFor3D(){return new xe(this.context.gl.LEQUAL,xe.ReadWrite,this.depthRangeFor3D)}setDepthRangeFor3D(e){this.depthRangeFor3D=[0,1-(e+2)*R_*z_]}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}clearStencil(){this.nextStencilID=1,this.currentStencilSource=void 0,this.context.clear({stencil:0})}invalidateTileClippingMasks(){this.currentStencilSource=void 0}renderTileClippingMasks(e,t){if(this.currentStencilSource===e.source||!e.isTileClipped()||!t?.length)return;this.currentStencilSource=e.source,this.nextStencilID+t.length>256&&this.clearStencil();let i=this.context;i.setColorMode(ze.disabled),i.setDepthMode(xe.disabled);let r={};for(let a of t)r[a.key]=this.nextStencilID++;this.data.useSubdivision&&this.renderTileMasks(r,t,!0),this.renderTileMasks(r,t,!1),this.tileClippingMaskIDs=r}renderTileMasks(e,t,i){let r=this.context,a=r.gl,o=this.useProgram("clippingMask");for(let n of t){let s=e[n.key],l=this.getTerrainDataForTile(n),u=this.getMeshFromTileID(n.canonical,i,!0,"stencil"),c=this.getProjectionDataForTile(n);o.draw(r,a.TRIANGLES,xe.disabled,new Ce({func:a.ALWAYS,mask:0},s,255,a.KEEP,a.KEEP,a.REPLACE),ze.disabled,this.isRenderingToTexture?Ae.disabled:Ae.backCCW,null,l,c,"$clipping",u.vertexBuffer,u.indexBuffer,u.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let e=this.nextStencilID++,t=this.context.gl;return new Ce({func:t.NOTEQUAL,mask:255},e,255,t.KEEP,t.KEEP,t.REPLACE)}stencilModeForClipping(e){let t=this.context.gl;return new Ce({func:t.EQUAL,mask:255},this.tileClippingMaskIDs[e.key],0,t.KEEP,t.KEEP,t.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(e){let t=this.context.gl,i=e.sort((o,n)=>n.overscaledZ-o.overscaledZ),r=i[i.length-1].overscaledZ,a=i[0].overscaledZ-r+1;if(a>1){this.currentStencilSource=void 0,this.nextStencilID+a>256&&this.clearStencil();let o={};for(let n=0;n<a;n++)o[n+r]=new Ce({func:t.GEQUAL,mask:255},n+this.nextStencilID,255,t.KEEP,t.KEEP,t.REPLACE);return this.nextStencilID+=a,[o,i]}return[{[r]:Ce.disabled},i]}stencilConfigForOverlapTwoPass(e){let t=this.context.gl,i=e.sort((o,n)=>n.overscaledZ-o.overscaledZ),r=i[i.length-1].overscaledZ,a=i[0].overscaledZ-r+1;if(this.clearStencil(),a>1){let o={},n={};for(let s=0;s<a;s++)o[s+r]=new Ce({func:t.GREATER,mask:255},a+1+s,255,t.KEEP,t.KEEP,t.REPLACE),n[s+r]=new Ce({func:t.GREATER,mask:255},1+s,255,t.KEEP,t.KEEP,t.REPLACE);return this.nextStencilID=a*2+1,[o,n,i]}return this.nextStencilID=3,[{[r]:new Ce({func:t.GREATER,mask:255},2,255,t.KEEP,t.KEEP,t.REPLACE)},{[r]:new Ce({func:t.GREATER,mask:255},1,255,t.KEEP,t.KEEP,t.REPLACE)},i]}},yF,vF,xF=class{constructor(e){this._getHashParams=()=>new URLSearchParams(window.location.hash.replace("#","")),this._getCurrentHash=()=>{let t=this._getHashParams();return this._hashName?(t.get(this._hashName)||"").split("/"):([...t.keys()][0]??"").split("/")},this._onHashChange=()=>{let t=this._getCurrentHash();if(!this._isValidHash(t))return!1;let i=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:i,pitch:+(t[4]||0)}),!0},this._updateHashUnthrottled=()=>{let t=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,t)},this._removeHash=()=>{let t=this._getHashParams();if(this._hashName)t.delete(this._hashName);else{let o=Array.from(t.keys());o.length>0&&t.delete(o[0])}let i=decodeURIComponent(t.toString()).replace(/=&/g,"&").replace(/=$/g,""),r=i?`#${i}`:"",a=window.location.href.replace(/(#.+)?$/,r);a=a.replace("&&","&"),window.history.replaceState(window.history.state,null,a)},this._updateHash=am(this._updateHashUnthrottled,300),this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(e){let t=this._map.getCenter(),i=Math.round(this._map.getZoom()*100)/100,r=KT(this._map._camera.context.worldCoordinateHelper,t),a=10**Math.ceil((i*Math.LN2+Math.log(512/r/0.5))/Math.LN10),o=Math.round(t.lng*a)/a,n=Math.round(t.lat*a)/a,s=this._map.getBearing(),l=this._map.getPitch(),u="";if(u+=e?`/${o}/${n}/${i}`:`${i}/${n}/${o}`,(s||l)&&(u+=`/${Math.round(s*10)/10}`),l&&(u+=`/${Math.round(l)}`),this._hashName){let c=this._getHashParams();return c.set(this._hashName,u),`#${decodeURIComponent(c.toString()).replace(/=&/g,"&").replace(/=$/g,"")}`}return`#${u}`}_isValidHash(e){if(e.length<3||e.some((a)=>isNaN(+a)))return!1;try{new Y(+e[2],+e[1])}catch{return!1}let t=+e[0],i=+(e[3]||0),r=+(e[4]||0);return t>=this._map.getMinZoom()&&t<=this._map.getMaxZoom()&&i>=-180&&i<=180&&r>=this._map.getMinPitch()&&r<=this._map.getMaxPitch()}},B_,O_,j_,RF=class{setLocationAtPoint(e,t,i,r,a){let o=this.getCameraForLocationAtPoint(e,t,i,r,a);return o?Vb(e,o.center,o.zoom):e}getCameraForLocationAtPoint(e,t,i,r,a=e.elevation){let o=Cp(e,t),n=sr(o,r,a-o.elevation),s=sr(o,o.centerPoint,0),l=t.worldCoordinateHelper,u=l.worldFromLngLat(i.lng,i.lat),c=l.lngLatFromWorld(u.x-(n.x-s.x),u.y-(n.y-s.y)),h=c.lng!==o.center.lng||c.lat!==o.center.lat?Eu(e,t,c,o.zoom):null;if(o.renderWorldCopies&&l.wraps){let d=h??{center:o.center,zoom:o.zoom},p=d.center.wrap();p.lng!==d.center.lng&&(h=Eu(e,t,p,d.zoom))}return h}recenterOnTerrain(e,t,i){let r=e;for(let a=0;a<3;a++){let o=FF(r,t,i);if(o===null||(r=$b(r,t,o),!i||Math.abs(i.getElevationForLngLat(r.center,Li(r,t).tileZoom)-r.elevation)<=0.0001))return r}return r}calculateCameraOptionsFromTo(e,t,i,r,a,o){let n=Cp(e,t),s=t.worldCoordinateHelper,l=Y.convert(i),u=Y.convert(a),c=s.worldFromLngLat(l.lng,l.lat,r),h=s.worldFromLngLat(u.lng,u.lat,o),d=h.x-c.x,p=h.y-c.y,f=h.z-c.z,m=Math.hypot(d,p,f);if(m===0)throw Error("Can't calculate camera options with same From and To");let g=Math.hypot(d,p),_=wt(n.cameraToCenterDistance/m/n.tileSize),y=Wi(Math.atan2(d,-p)),v=Wi(Math.acos(g/m));return v=f<0?90-v:90+v,{center:s.lngLatFromWorld(h.x,h.y),elevation:o,zoom:_,pitch:v,bearing:y}}},V_=0.000000000001,zF=class{setLocationAtPoint(e,t,i,r){let a=this.getCameraForLocationAtPoint(e,t,i,r);return a?Vb(e,a.center,a.zoom):e}getCameraForLocationAtPoint(e,t,i,r){let a=$_(e,t),o=dt(Il(a,r)),n=dt(i),s=De();I5(s);let l=De();lo(l,o,s,-a.center.lng*Math.PI/180),zn(l,l,s,a.center.lat*Math.PI/180);let u=n[0]*n[0]+n[2]*n[2],c=l[0]*l[0];if(u<c)return null;let h=Math.sqrt(u-c),d=-h,p=Zs(n[0],n[2],l[0],h),f=Zs(n[0],n[2],l[0],d),m=De();lo(m,n,s,-p);let g=Zs(m[1],m[2],l[1],l[2]),_=De();lo(_,n,s,-f);let y=Zs(_[1],_[2],l[1],l[2]),v=Math.PI*0.5,x=g>=-v&&g<=v,b=y>=-v&&y<=v,w,T;if(x&&b){let M=a.center.lng*Math.PI/180,C=a.center.lat*Math.PI/180,P=Hs(p,M),B=Hs(g,C),N=Hs(f,M),L=Hs(y,C);P+B<N+L?(w=p,T=g):(w=f,T=y)}else if(x)w=p,T=g;else if(b)w=f,T=y;else return null;let E=w/Math.PI*180,S=H(T/Math.PI*180,-90,90),A=E!==a.center.lng||S!==a.center.lat,{center:I,zoom:R}=A?Eu(e,t,new Y(E,S),a.zoom):{center:a.center,zoom:a.zoom},k=Dt(e,t,I,R+Tt(a.center.lat,I.lat)).zoom;return k===R?A?{center:I,zoom:R}:null:Eu(e,t,I,k)}recenterOnTerrain(e,t,i){return i?(he("terrain is not fully supported on vertical perspective projection."),e):$b(e,t,0)}calculateCameraOptionsFromTo(e,t,i,r,a,o){let n=$_(e,t),s=Y.convert(a),l=dt(Y.convert(i));Ue(l,l,1+r/Yt);let u=dt(s),c=Ue(De(),u,1+o/Yt),h=Fp(De(),l,u),d=Ki(h);if(d<V_||Rp(l,c)<V_)throw Error("Can't calculate camera options with same From and To");let p=De();lo(h,h,p,-We(s.lng)),zn(h,h,p,We(s.lat));let f=Wi(Math.acos(H(h[2]/d,-1,1))),m=Math.hypot(h[0],h[1])<d*0.000000001?_o(n):Wi(Math.atan2(-h[0],-h[1]));return{center:s,elevation:o,zoom:wt(n.cameraToCenterDistance/d/Na(n.tileSize,s.lat)),pitch:f,bearing:m}}},Wh,jF,NF,VF=class{panInertia(e,t){let i=t.mag(),r=Math.abs(Yu(e));return{easingOffset:t.mult(Math.min(r*0.75/i,1)),easingCenter:e.center}}rollPitchBearingZoom(e,t,i){let{bearing:r,pitch:a,roll:o}=cr(e,t.worldCoordinateHelper);return i.bearingDelta&&(e=Zi(e,r+i.bearingDelta)),i.pitchDelta&&(e=Hi(e,a+i.pitchDelta)),i.rollDelta&&(e=ra(e,o+i.rollDelta)),i.zoomDelta&&(e=pt(e,t,e.zoom+i.zoomDelta)),e}pan(e,t,i,r){return i.around.distSqr(hr(e))<0.01?e:ui(t).setLocationAtPoint(e,t,r,i.around,i.aroundElevation)}cameraForBoxAndBearing(e,t,i,r,a,o,n){let s=n.worldCoordinateHelper,l=cr(o,s),u=ki(l.worldSize,r.getNorthWest(),s),c=ki(l.worldSize,r.getNorthEast(),s),h=ki(l.worldSize,r.getSouthEast(),s),d=ki(l.worldSize,r.getSouthWest(),s),[p,f]=s.wraps?[H(r.getSouth(),-85.051129,ci),H(r.getNorth(),-85.051129,ci)]:[r.getSouth(),r.getNorth()],{points:m,bulge:g}=c2(s,r.getWest(),p,r.getEast(),f),_=We(-a),y=1/0,v=1/0,x=-1/0,b=-1/0;for(let L of m){let{x:W,y:Q}=L.mult(l.worldSize).rotate(_);W<y&&(y=W),Q<v&&(v=Q),W>x&&(x=W),Q>b&&(b=Q)}let w=g*l.worldSize,T=new D(x+w,b+w),E=new D(y-w,v-w),S=T.sub(E),A=l.width-(i.left+i.right+t.left+t.right),I=l.height-(i.top+i.bottom+t.top+t.bottom),R=A/S.x,k=I/S.y;if(k<0||R<0||!Number.isFinite(S.x)||!Number.isFinite(S.y)){Gb();return}let M=Math.min(wt(l.scale*Math.min(R,k)),e.maxZoom),C=D.convert(e.offset),P=new D((t.left-t.right)/2,(t.top-t.bottom)/2).rotate(We(a)),B=C.add(P).mult(l.scale/St(M)),N=g===0&&u.add(h).equals(c.add(d))?u.add(h).div(2):T.add(E).div(2).rotate(-_);return{center:ta(l.worldSize,N.sub(B),s),zoom:M,bearing:a}}jumpToCenterZoom(e,t,i){return i.zoom!==void 0&&e.zoom!==+i.zoom&&(e=pt(e,t,+i.zoom)),i.center!==void 0&&(e=ii(e,t,Y.convert(i.center))),e}easeTo(e,t,i){let r=cr(e,t.worldCoordinateHelper),{zoom:a,padding:o}=e,n={roll:r.roll,pitch:r.pitch,bearing:r.bearing},s={roll:i.roll??r.roll,pitch:i.pitch??r.pitch,bearing:i.bearing??r.bearing},l=!wy(n,s),u=!Fo(e.padding,i.padding),c=i.zoom===void 0?a:+i.zoom,h=Li(e,t),d=V(h).screenPointToLocation(h,t.worldCoordinateHelper,r.centerPoint.add(i.offsetAsPoint)),{center:p,zoom:f}=Dt(e,t,Y.convert(i.center||d),c);Cu(e,t.worldCoordinateHelper,p);let m=t.worldCoordinateHelper,g=ki(r.worldSize,d,m),_=ki(r.worldSize,p,m).sub(g),y=St(f-a),v=f!==a,x=(w,T,E)=>{if(v&&(w=pt(w,T,Ze.number(a,f,E))),l&&(w=Wb(w,n,s,E,n.roll!==s.roll)),u&&(w=Su(w,T,o,i.padding,E)),i.around)return Zh(w,T,i.around,i.aroundPoint);let S=St(w.zoom-a),A=(f>a?Math.min(2,y):Math.max(0.5,y))**(1-E),I=cr(w,m).worldSize,R=ta(I,g.add(_.mult(E*A)).mult(S),m);w.renderWorldCopies&&m.wraps&&(R=R.wrap());let k=hr(w).add(i.offsetAsPoint);return Zh(w,T,R,k)},b=q_(e,t,f,s,i.padding);return{easeFunc:x,isZooming:v,elevationCenter:(i.around?ui(t).setLocationAtPoint(b,t,i.around,i.aroundPoint):ui(t).setLocationAtPoint(b,t,p,hr(b).add(i.offsetAsPoint))).center}}flyTo(e,t,i){let r=cr(e,t.worldCoordinateHelper),a=e.zoom,o=Dt(e,t,Y.convert(i.center||i.locationAtOffset),i.zoom===void 0?a:+i.zoom),{center:n,zoom:s}=o;Cu(e,t.worldCoordinateHelper,n);let l=t.worldCoordinateHelper,u=r.worldSize,c=ki(u,i.locationAtOffset,l),h=ki(u,n,l).sub(c),d=h.mag(),p=St(s-a),f=i.minZoom===void 0?e.minZoom:+i.minZoom,m=Math.max(f,e.minZoom),g=Dt(e,t,n,Math.min(m,a,s)).zoom,_=St(g-a),y=(x,b,w,T,E,S)=>{x=pt(x,b,w===1?s:a+wt(T));let A=w===1?n:ta(u,c.add(h.mult(E)),l);return x.renderWorldCopies&&l.wraps&&(A=A.wrap()),Zh(x,b,A,S)},v=q_(e,t,s,{roll:i.roll,pitch:i.pitch,bearing:i.bearing},i.padding);return{easeFunc:y,scaleOfZoom:p,targetCenter:ui(t).setLocationAtPoint(v,t,n,hr(v).add(i.offsetAsPoint)).center,scaleOfMinZoom:_,pixelPathLength:d}}},$F=class{constructor(e){this._mercator=e}panInertia(e,t){let i=EE(t,e);return Math.abs(i.lng-e.center.lng)>180&&(i.lng=e.center.lng+179.5*Math.sign(i.lng-e.center.lng)),{easingCenter:i,easingOffset:new D(0,0)}}rollPitchBearingZoom(e,t,i){let r=i.around,a=Li(e,t),o=V(a).screenPointToLocation(a,t.worldCoordinateHelper,r);i.bearingDelta&&(e=Zi(e,a.bearing+i.bearingDelta)),i.pitchDelta&&(e=Hi(e,a.pitch+i.pitchDelta)),i.rollDelta&&(e=ra(e,a.roll+i.rollDelta));let n=e.zoom;i.zoomDelta&&(e=pt(e,t,e.zoom+i.zoomDelta));let s=e.zoom-n;if(s===0)return e;let l=ti(e.center.lng,o.lng),u=l/(Math.abs(l/180)+1),c=ti(e.center.lat,o.lat),h=Li(e,t),d=V(h).getRayDirectionFromPixel(h,r),p=h.cameraPosition,f=ft(p,d)*-1,m=De();Bi(m,p,[d[0]*f,d[1]*f,d[2]*f]);let g=Ki(m),_=g-1,y=Math.exp(-Math.max(_-0.3,0)*0.5),v=bn(g,0.95,0.999,0,1),x=bn(Na(h.worldSize,e.center.lat)/Math.min(e.width,e.height),0.9,0.5,1,0.25),b=Math.min(y,ea(1,x,v)),w=(1-St(-s))*b,T=e.center.lat,E=e.zoom,S=new Y(e.center.lng+u*w,H(e.center.lat+c*w,-90,90)),A=ui(t).setLocationAtPoint(e,t,o,r),I=A.center,R=bn(Math.abs(l),45,85,0,1),k=Math.max(R,v)**0.25,M=ti(I.lng,S.lng),C=ti(I.lat,S.lat),P=ii(A,t,new Y(I.lng+M*k,H(I.lat+C*k,-90,90)).wrap());return pt(P,t,E+Tt(T,P.center.lat))}pan(e,t,i,r){if(!i.panDelta)return e;let a=Li(e,t);return LF(e,t,r,V(a).isPointOnMapSurface(a,t.worldCoordinateHelper,i.around)?i.around:hr(e),i.panDelta)}cameraForBoxAndBearing(e,t,i,r,a,o,n){let s=this._mercator.cameraForBoxAndBearing(e,t,i,r,a,o,n);if(!s)return;let{width:l,height:u}=o,c=t.left/l*2-1,h=(l-t.right)/l*2-1,d=t.top/u*-2+1,p=(u-t.bottom)/u*-2+1,f=ti(r.getWest(),r.getEast())<0,m=f?r.getEast():r.getWest(),g=f?r.getWest():r.getEast(),_=Math.max(r.getNorth(),r.getSouth()),y=Math.min(r.getNorth(),r.getSouth()),v=m+ti(m,g)*0.5,x=_+ti(_,y)*0.5,b=ii(o,n,s.center);b=nm(b,n,i),b=Zi(b,s.bearing),b=Hi(b,0),b=ra(b,0),b=pt(b,n,s.zoom);let w=Li(b,n).modelViewProjectionMatrix,T=[dt(r.getNorthWest()),dt(r.getNorthEast()),dt(r.getSouthWest()),dt(r.getSouthEast()),dt(new Y(g,x)),dt(new Y(m,x)),dt(new Y(v,_)),dt(new Y(v,y))],E=dt(s.center),S=1/0;for(let A of T)c<0&&(S=Tl(S,wl(A,E,w,"x",c))),h>0&&(S=Tl(S,wl(A,E,w,"x",h))),d>0&&(S=Tl(S,wl(A,E,w,"y",d))),p<0&&(S=Tl(S,wl(A,E,w,"y",p)));if(!Number.isFinite(S)||S===0)Gb();else return s.zoom=Math.min(b.zoom+wt(S),e.maxZoom),s}jumpToCenterZoom(e,t,i){let r=e.center.lat,a=i.center?Y.convert(i.center):e.center;e=ii(e,t,Dt(e,t,a,e.zoom).center.wrap());let o=i.zoom===void 0?e.zoom+Tt(r,e.center.lat):+i.zoom;return e.zoom===o?e:(e=pt(e,t,o),ii(e,t,Dt(e,t,a,e.zoom).center.wrap()))}easeTo(e,t,i){let r=cr(e,t.worldCoordinateHelper),{zoom:a,center:o,padding:n}=e,s={roll:r.roll,pitch:r.pitch,bearing:r.bearing},l={roll:i.roll??r.roll,pitch:i.pitch??r.pitch,bearing:i.bearing??r.bearing},u=!wy(s,l),c=i.zoom!==void 0,h=!Fo(e.padding,i.padding),d=i.center?Y.convert(i.center):o,p=Dt(e,t,d,c?+i.zoom:a).center;Cu(e,t.worldCoordinateHelper,p);let f=ii(e,t,p);f=pt(f,t,c?+i.zoom:a+Tt(o.lat,d.lat)),f=Zi(f,i.bearing);let m=new D(H(r.centerPoint.x+i.offsetAsPoint.x,0,e.width),H(r.centerPoint.y+i.offsetAsPoint.y,0,e.height));f=ui(t).setLocationAtPoint(f,t,p,m);let g=(i.offset&&i.offsetAsPoint.mag())>0?f.center:p,_=c?+i.zoom:a+Tt(o.lat,g.lat),y=a+Tt(o.lat,0),v=_+Tt(g.lat,0),x=ti(o.lng,g.lng),b=ti(o.lat,g.lat),w=St(v-y),T=_!==a;return{easeFunc:(E,S,A)=>{if(u&&(E=Wb(E,s,l,A,s.roll!==l.roll)),h&&(E=Su(E,S,n,i.padding,A)),i.around)he("Easing around a point is not supported under globe projection."),E=ui(S).setLocationAtPoint(E,S,i.around,i.aroundPoint);else{let I=A*(v>y?Math.min(2,w):Math.max(0.5,w))**(1-A),R=G0(o,x,b,I);E=ii(E,S,R.wrap())}if(T){let I=Ze.number(y,v,A);E=pt(E,S,I+Tt(0,E.center.lat))}return A===1&&!i.around&&(E=ii(E,S,g.wrap())),E},isZooming:T,elevationCenter:g}}flyTo(e,t,i){let r=cr(e,t.worldCoordinateHelper),a=i.zoom!==void 0,{center:o,zoom:n,padding:s}=e,l=!Fo(e.padding,i.padding),u=Dt(e,t,Y.convert(i.center||i.locationAtOffset),a?+i.zoom:n).center,c=a?+i.zoom:n+Tt(o.lat,u.lat),h=ii(e,t,u);h=pt(h,t,c),h=Zi(h,i.bearing);let d=new D(H(r.centerPoint.x+i.offsetAsPoint.x,0,e.width),H(r.centerPoint.y+i.offsetAsPoint.y,0,e.height)),p=ui(t).setLocationAtPoint(h,t,u,d).center;Cu(e,t.worldCoordinateHelper,p);let f=gE(r,o,p),m=n+Tt(o.lat,0),g=c+Tt(p.lat,0),_=St(g-m),y=typeof i.minZoom=="number"?+i.minZoom:e.minZoom,v=Math.max(y,e.minZoom)+Tt(p.lat,0),x=St(Dt(e,t,p,Math.min(v,m,g)+Tt(0,p.lat)).zoom+Tt(p.lat,0)-m),b=ti(o.lng,p.lng),w=ti(o.lat,p.lat);return{easeFunc:(T,E,S,A,I,R)=>{let k=G0(o,b,w,I);l&&(T=Su(T,E,s,i.padding,S));let M=S===1?p:k;T=ii(T,E,M.wrap());let C=m+wt(A);return T=pt(T,E,S===1?c:C+Tt(0,M.lat)),S===1&&(T=ii(T,E,p.wrap())),T},scaleOfZoom:_,targetCenter:p,scaleOfMinZoom:x,pixelPathLength:f}}},Zb,UF,uc,qF,GF,WF,ZF,HF,XF=class{constructor(e){this._camera=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:Fe(),settings:e})}_drainInertiaBuffer(){let e=this._inertiaBuffer,t=Fe();for(;e.length>0&&t-e[0].time>160;)e.shift()}_getVelocityEntries(){let e=this._inertiaBuffer,t=Fe()-60,i=Math.max(0,e.length-2);for(;i>0&&e[i-1].time>=t;)i--;return e.slice(i)}_onMoveEnd(e){this._drainInertiaBuffer();let t=this._getVelocityEntries();if(t.length<2){this.clear();return}let i={zoom:0,bearing:0,pitch:0,roll:0,pan:new D(0,0),pinchAround:void 0,around:void 0};for(let{settings:n}of t)n.around&&(i.around=n.around),n.pinchAround&&(i.pinchAround=n.pinchAround);for(let{settings:n}of t.slice(1))i.zoom+=n.zoomDelta||0,i.bearing+=n.bearingDelta||0,i.pitch+=n.pitchDelta||0,i.roll+=n.rollDelta||0,n.panDelta&&i.pan._add(n.panDelta);if(!i.pan.mag()&&!i.zoom&&!i.bearing&&!i.pitch&&!i.roll){this.clear();return}let r=Fe()-t[0].time,a={};if(i.pan.mag()){let n=El(i.pan.mag(),r,ee({},qF,e||{})),s=i.pan.mult(n.amount/i.pan.mag()),l=ri(this._camera.context).panInertia(this._camera.projectedCamera,s);a.center=l.easingCenter,a.offset=l.easingOffset,_n(a,n)}if(i.zoom){let n=El(i.zoom,r,GF);a.zoom=xi(this._camera.getZoom()+n.amount,this._camera.getZoomSnap(),n.amount),_n(a,n)}let o=i.bearing?YF(i.bearing,r,HF):void 0;if(o&&(a.bearing=this._camera.getBearing()+H(o.amount,-179,179),_n(a,o)),i.pitch){let n=El(i.pitch,r,WF);a.pitch=this._camera.getPitch()+n.amount,_n(a,n)}if(i.roll){let n=El(i.roll,r,ZF);a.roll=this._camera.getRoll()+H(n.amount,-179,179),_n(a,n)}if(a.duration===void 0)this.clear();else{if(a.zoom||a.bearing){let n=i.pinchAround===void 0?i.around:i.pinchAround;a.around=n?this._camera.unproject(n):this._camera.getCenter()}return this.clear(),ee(a,{noMoveStart:!0})}}},Sl=(e)=>e.zoom||e.drag||e.roll||e.pitch||e.rotate,KF,JF,QF=class{constructor(e){this._map=e}createMouseEvent(e,t,i){return new iT(e,this._map,t,i)}createTouchEvent(e,t){return new rT(e,this._map,t)}createWheelEvent(e){return new aT(this._map,e)}},eR,tR,iR,aR=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=rR(t),this.touches=Dp(i,t)))}touchmove(e,t,i){if(this.aborted||!this.centroid)return;let r=Dp(i,t);for(let a in this.touches){let o=this.touches[a],n=r[a];(!n||n.dist(o)>30)&&(this.aborted=!0)}}touchend(e,t,i){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),i.length===0){let r=!this.aborted&&this.centroid;if(this.reset(),r)return r}}},Mp=class{constructor(e){this.singleTap=new aR(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 r=this.singleTap.touchend(e,t,i);if(r){let a=e.timeStamp-this.lastTime<500,o=!this.lastTap||this.lastTap.dist(r)<30;if(a&&o||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=r,this.count===this.numTaps)return this.reset(),r}}},oR=class{constructor(e){this._camera=e,this._zoomIn=new Mp({numTouches:1,numTaps:2}),this._zoomOut=new Mp({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 r=this._zoomIn.touchend(e,t,i),a=this._zoomOut.touchend(e,t,i),{zoom:o}=this._camera.proposedProjectedCamera,n=this._camera.getZoomSnap();if(r)return this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{easeTo:{duration:300,zoom:xi(o+1,n),around:Ap(this._camera,r)}};if(a)return this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{easeTo:{duration:300,zoom:xi(o-1,n),around:Ap(this._camera,a)}}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},cc=class{constructor(e){this._enabled=!!e.enable,this._moveStateManager=e.moveStateManager,this._clickTolerance=e.clickTolerance||1,this._moveFunction=e.move,this._activateOnStart=e.activateOnStart??(()=>!1),e.assignEvents(this),this.reset()}reset(e){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._startPoint,this._moveStateManager.endMove(e)}_move(...e){let t=this._moveFunction(...e);if(t.bearingDelta||t.pitchDelta||t.rollDelta||t.around||t.panDelta)return this._active=!0,t}dragStart(e,t){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._startPoint=Array.isArray(t)?t[0]:t,this._lastPoint=this._startPoint,this._activateOnStart(e)&&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 r=Array.isArray(t)?t[0]:t;if(!(!this._moved&&r.dist(i)<this._clickTolerance))return this._moved=!0,this._lastPoint=r,this._move(i,r,this._startPoint)}dragEnd(e){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(e)&&(this._moved&&Ve.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}},nR,hc=class{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){this._eventButton=e.button}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!sR(e,this._eventButton)}isValidEndEvent(e){return e.button===this._eventButton}},dc=(e)=>{e.mousedown=e.dragStart,e.mousemoveWindow=e.dragMove,e.mouseup=e.dragEnd,e.contextmenu=(t)=>{t.preventDefault()}},dR=class{constructor(e,t){this._clickTolerance=e.clickTolerance||1,this._cooperativeGestures=t,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new D(0,0)}_shouldBePrevented(e){return e<(this._cooperativeGestures.isEnabled()?2:1)}touchstart(e,t,i){return this._calculateTransform(e,t,i)}touchmove(e,t,i){if(this._active)if(this._shouldBePrevented(i.length))this._cooperativeGestures.notifyGestureBlocked("touch_pan",e);else return e.preventDefault(),this._calculateTransform(e,t,i)}touchend(e,t,i){this._calculateTransform(e,t,i),this._active&&this._shouldBePrevented(i.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,t,i){i.length>0&&(this._active=!0);let r=Dp(i,t),a=new D(0,0),o=new D(0,0),n=0;for(let l in r){let u=r[l],c=this._touches[l];c&&(a._add(u),o._add(u.sub(c)),n++,r[l]=u)}if(this._touches=r,this._shouldBePrevented(n)||!o.mag())return;let s=o.div(n);if(this._sum._add(s),!(this._sum.mag()<this._clickTolerance))return{around:a.div(n),panDelta:s}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},lm=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[r,a]=this._firstTwoTouches,o=Cl(i,t,r),n=Cl(i,t,a);if(!o||!n)return;let s=this._aroundCenter?null:o.add(n).div(2);return this._move([o,n],s,e)}touchend(e,t,i){if(!this._firstTwoTouches)return;let[r,a]=this._firstTwoTouches,o=Cl(i,t,r),n=Cl(i,t,a);o&&n||(this._active&&Ve.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}},G_=0.1,pR,fR,mR,gR,_R=class{constructor(e){this._camera=e;let t=gR;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,r=0,a=0,o=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(),a=-1);break;case 39:e.shiftKey?i=1:(e.preventDefault(),a=1);break;case 38:e.shiftKey?r=1:(e.preventDefault(),o=-1);break;case 40:e.shiftKey?r=-1:(e.preventDefault(),o=1);break;default:return}this._rotationDisabled&&(i=0,r=0);let{zoom:n,bearing:s,pitch:l,center:u}=this._camera.proposedProjectedCamera;return{easeTo:{duration:300,easeId:"keyboardHandler",easing:yR,zoom:t?xi(n+t*(e.shiftKey?2:1),this._camera.getZoomSnap()):n,bearing:s+i*this._bearingStep,pitch:l+r*this._pitchStep,offset:[-a*this._panStep,-o*this._panStep],center:{lng:u.lng,lat:u.lat}}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}},H_=4.000244140625,vR=class{constructor(e,t,i){this._canvas=e,this._cooperativeGestures=t,this._camera=i,this._delta=0,this._defaultZoomRate=0.01,this._wheelZoomRate=0.0022222222222222222}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishWait!==void 0}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&e.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(e){return this._cooperativeGestures.isEnabled()?!(e.ctrlKey||this._cooperativeGestures.isBypassed(e)):!1}wheel(e){if(!this.isEnabled())return;if(this._shouldBePrevented(e)){this._cooperativeGestures.notifyGestureBlocked("wheel_zoom",e);return}let t=e.deltaMode===WheelEvent.DOM_DELTA_LINE?e.deltaY*40:e.deltaY,i,r=Fe(),a=r-(this._lastWheelEventTime||0);return this._lastWheelEventTime=r,t!==0&&t%H_==0?this._type="wheel":t!==0&&Math.abs(t)<4?this._type="trackpad":a>400?(this._type=null,this._lastValue=t,this._singleWheelWait={reason:"singleWheel",event:e},i={timeout:{delay:40,token:this._singleWheelWait}}):this._type||(this._type=Math.abs(a*t)<200?"trackpad":"wheel",this._singleWheelWait&&(this._singleWheelWait=void 0,t+=this._lastValue)),e.shiftKey&&t&&(t/=4),this._type&&(this._lastWheelEvent=e,this._delta-=t,this._active||(i=this._start(e))),e.preventDefault(),i}onTimeout(e){if(e===this._singleWheelWait||e===this._finishWait)switch(e.reason){case"singleWheel":return this._singleWheelWait=void 0,this._type="wheel",this._delta-=this._lastValue,this._active?void 0:this._start(e.event);case"finish":return this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishWait,{needsRenderFrame:!0}}}_start(e){if(!this._delta)return;this._needsRerender=!1,this._active=!0,this.isZooming()||(this._zooming=!0),delete this._finishWait;let t=Ve.mousePos(this._canvas,e);if(this._aroundCenter){let i=this._camera.proposedProjectedCamera;this._aroundPoint=V(i).locationToScreenPoint(i,this._camera.context.worldCoordinateHelper,i.center)}else this._aroundPoint=t;if(!this._needsRerender)return this._needsRerender=!0,{needsRenderFrame:!0}}renderFrame(){if(!this._needsRerender||(this._needsRerender=!1,!this.isActive()))return;let e=this._camera.proposedProjectedCamera;if(typeof this._lastExpectedZoom=="number"){let n=e.zoom-this._lastExpectedZoom;typeof this._startZoom=="number"&&(this._startZoom+=n),typeof this._targetZoom=="number"&&(this._targetZoom+=n)}if(this._delta!==0){let n=this._type==="wheel"&&Math.abs(this._delta)>H_?this._wheelZoomRate:this._defaultZoomRate,s=2/(1+Math.exp(-Math.abs(this._delta*n)));this._delta<0&&s!==0&&(s=1/s);let l=typeof this._targetZoom=="number"?St(this._targetZoom):e.scale,u=V(e).getCameraLngLat(e,this._camera.context.worldCoordinateHelper),c=Dt(this._camera.renderedState,this._camera.context,u,wt(l*s)).zoom,h=this._camera.getZoomSnap();if(this._type==="wheel"&&h>0){let d=xi(e.zoom,h);this._targetZoom=xi(c,h,c-d)}else this._targetZoom=c;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,r=this._easing,a=!1,o;if(this._type==="wheel"&&i&&r){let n=Fe()-this._lastWheelEventTime,s=Math.min((n+5)/200,1),l=r(s);o=Ze.number(i,t,l),s<1?this._needsRerender=!0:a=!0}else o=t,a=!0;return this._active=!0,a&&(this._active=!1,this._finishWait={reason:"finish"}),this._lastExpectedZoom=o,{noInertia:!0,needsRenderFrame:!a,zoomDelta:o-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent,timeout:a?{delay:200,token:this._finishWait}:void 0}}_smoothOutEasing(e){let t=nd;if(this._prevEase){let i=this._prevEase,r=(Fe()-i.start)/i.duration,a=i.easing(r+0.01)-i.easing(r),o=0.27/Math.sqrt(a*a+0.0001)*0.01;t=Lp(o,Math.sqrt(0.0729-o*o),0.25,1)}return this._prevEase={start:Fe(),duration:e,easing:t},t}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishWait}},xR=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()}},bR=class{constructor(e){this._camera=e,this.reset()}reset(){this._active=!1}dblclick(e,t){return e.preventDefault(),{easeTo:{duration:300,zoom:xi(this._camera.proposedProjectedCamera.zoom+(e.shiftKey?-1:1),this._camera.getZoomSnap()),around:Ap(this._camera,t)}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},wR=class{constructor(){this._tap=new Mp({numTouches:1,numTaps:1}),this._zoomRate=1,this.reset()}setZoomRate(e){this._zoomRate=e??1}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 r=t[0],a=e.timeStamp-this._tapTime<500,o=this._tapPoint.dist(r)<30;!a||!o?this.reset():i.length>0&&(this._swipePoint=r,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 r=t[0],a=r.y-this._swipePoint.y;return this._swipePoint=r,e.preventDefault(),this._active=!0,{zoomDelta:a/128*this._zoomRate}}}touchend(e,t,i){if(this._tapTime)this._swipePoint&&i.length===0&&this.reset();else{let r=this._tap.touchend(e,t,i);r&&(this._tapTime=e.timeStamp,this._tapPoint=r)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},TR=class{constructor(e,t,i){this._el=e,this._mousePan=t,this._touchPan=i}enable(e){this._inertiaOptions=e||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}},ER=class{constructor(e,t,i,r){this._pitchWithRotate=e.pitchWithRotate,this._rollEnabled=e.rollEnabled,this._mouseRotate=t,this._mousePitch=i,this._mouseRoll=r;let{aroundCenter:a=!0}=e;this._defaultMovement=a?"circular":"linear",this.around="center",this.movement=this._defaultMovement}enable(e){let t=typeof e=="object"?e:{};this.around=t.around??"center",this.movement=t.around==="pointer"?"linear":t.movement??this._defaultMovement,this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}},SR=class{constructor(e,t,i,r){this._el=e,this._touchZoom=t,this._touchRotate=i,this._tapDragZoom=r,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()}setZoomRate(e){this._touchZoom.setZoomRate(e),this._tapDragZoom.setZoomRate(e)}setZoomThreshold(e){this._touchZoom.setZoomThreshold(e)}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}},CR,Hb,Yh,RR,ey=(e)=>{let t,i=new Set,r=(s,l)=>{let u=typeof s=="function"?s(t):s;if(!Object.is(u,t)){let c=t;t=l??(typeof u!="object"||!u)?u:Object.assign({},t,u),i.forEach((h)=>h(t,c))}},a=()=>t,o={setState:r,getState:a,getInitialState:()=>n,subscribe:(s)=>(i.add(s),()=>i.delete(s))},n=t=e(r,a,o);return o},zR=(e)=>e?ey(e):ey,ty=0.01,OR,Jb,VR=class{constructor(e=Jb){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=(t)=>{t&&(t.type==="terrain"||t.dataType==="style"||t.dataType==="source"&&(t.sourceDataType==="metadata"||t.sourceDataType==="visibility"))&&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=Ve.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=Ve.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=Ve.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(){this._container.remove(),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((r)=>typeof r=="string"?r:"")):typeof this.options.customAttribution=="string"&&e.push(this.options.customAttribution)),this._map.style.stylesheet){let r=this._map.style.stylesheet;this.styleOwner=r.owner,this.styleId=r.id}let t=this._map.style.tileManagers;for(let r in t){let a=t[r];if(a.used||a.usedForTerrain){let o=a.getSource();o.attribution&&!e.includes(o.attribution)&&e.push(o.attribution)}}e=e.filter((r)=>String(r).trim()),e.sort((r,a)=>r.length-a.length),e=e.filter((r,a)=>{for(let o=a+1;o<e.length;o++)if(e[o].includes(r))return!1;return!0});let i=e.join(" | ");if(i!==this._attribHTML){if(this._attribHTML=i,e.length){let r=document.createDocumentFragment(),a=!0;for(let o of e){let n=Ve.sanitize(o);n.hasChildNodes()&&(a||r.append(" | "),r.append(n),a=!1)}this._innerContainer.replaceChildren(r),this._container.classList.remove("maplibregl-attrib-empty")}else this._container.classList.add("maplibregl-attrib-empty");this._updateCompact(),this._editLink=null}}},$R=class{constructor(e={}){this._updateCompact=()=>{let t=this._container.children;if(t.length){let i=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&i.classList.add("maplibregl-compact"):i.classList.remove("maplibregl-compact")}},this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){this._map=e,this._compact=this.options?.compact,this._container=Ve.create("div","maplibregl-ctrl");let t=Ve.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(){this._container.remove(),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}},UR=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 r of i)if(r.id===e){r.cancelled=!0;return}}run(e=0){if(this._currentlyRunning)throw Error("Attempting to run(), but is already running.");let t=this._currentlyRunning=this._queue;this._queue=[];let i=!1,r;for(let a of t)if(!a.cancelled){try{a.callback(e)}catch(o){i||(i=!0,r=o)}if(this._cleared)break}if(this._cleared=!1,this._currentlyRunning=!1,i)throw r}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}},qR,GR,WR=class{constructor(e,t,i,r="auto",a=()=>ja){this._meshCache={},this.painter=e,this._getWorldCoordinateHelper=a,this.tileManager=new GR(t),this.options=i,this.exaggeration=typeof i.exaggeration=="number"?i.exaggeration:1,this._terrainSkirtLength=r,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache=new Map,this._minMaxElevationCache=new Map,this.coverage=new hE(this.tileManager,this.exaggeration,()=>this._worldCoordinateHelper)}destroy(){this._fbo&&=(this._fbo.destroy(),null),this._heightMapFbo&&=(this._heightMapFbo.destroy(),null),this._fboDepthTexture&&=(this._fboDepthTexture.destroy(),null),this._emptyDemTexture&&=(this._emptyDemTexture.destroy(),null),this._emptyDepthTexture&&=(this._emptyDepthTexture.destroy(),null);for(let e in this._meshCache)this._meshCache[e].destroy();this._meshCache={},this.tileManager.destruct()}getDEMElevation(e,t,i,r=z){let a=e.normalizeCoordinates(t,i,r);if(!a)return 0;let o=this.coverage.getSampler(a.tileID);return o?o(a.x,a.y,r):0}getElevationForLngLatZoom(e,t){let i=this._worldCoordinateHelper;if(!wh(t,i.wraps?e.wrap():e,i))return 0;let{tileID:r,worldX:a,worldY:o}=this._getOverscaledTileIDFromLngLatZoom(e,t);return this.getElevation(r,a%z,o%z,z)}getElevationForLngLat(e,t){let i=this.getDrawnElevationForLngLat(e);return i===void 0?this.getElevationForLngLatZoom(e,this._getFallbackZoom(t)):i}getDrawnElevationForLngLat(e,t=!1){return this.coverage.sample(e,t)}getElevationAndDEMStateForLngLat(e,t){let i=this.getElevationForLngLat(e,t);if(i!==0||this.getDrawnElevationForLngLat(e)!==void 0)return{elevation:i,demState:"loaded"};let r=this._getFallbackZoom(t),a=this._worldCoordinateHelper;if(!wh(r,a.wraps?e.wrap():e,a))return{elevation:i,demState:"none"};let{tileID:o}=this._getOverscaledTileIDFromLngLatZoom(e,r);return this.tileManager.getSourceTile(o,!0)?.dem?{elevation:i,demState:"loaded"}:{elevation:i,demState:this.tileManager.isStillWaitingForDEM(o)?"loading":"none"}}_getFallbackZoom(e){return Math.min(e,this.tileManager.maxzoom)}getElevation(e,t,i,r=z){return this.getDEMElevation(e,t,i,r)*this.exaggeration}resetElevationCache(){this.coverage.reset(),this._minMaxElevationCache.clear()}getCoverageIndex(){return this.coverage.getIndex()}_getDEMTileMatrix(e,t){let i=`${t.tileID.key}/${e.key}`,r=this._demMatrixCache.get(i);if(r)return r;let a=e.canonical.z-t.tileID.canonical.z,o=e.canonical.x-(e.canonical.x>>a<<a),n=e.canonical.y-(e.canonical.y>>a<<a),s=T5(new Float64Array(16),[1/(z<<a),1/(z<<a),0]);return gt(s,s,[o*z,n*z,0]),this._demMatrixCache.set(i,s),s}getTerrainData(e){if(!this._emptyDemTexture){let r=this.painter.context,a=new $e({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new yt(r,a,r.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new yt(r,new $e({width:1,height:1}),r.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(r.gl.NEAREST,r.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=er([])}let t=this.tileManager.getSourceTile(e,!0);if(t?.dem&&(!t.demTexture||t.needsTerrainPrepare)){let r=this.painter.context;t.demTexture||=this.painter.getTileTexture(t.dem.stride),t.demTexture?t.demTexture.update(t.dem.getPixels(),{premultiply:!1}):t.demTexture=new yt(r,t.dem.getPixels(),r.gl.RGBA,{premultiply:!1}),t.demTexture.bind(r.gl.NEAREST,r.gl.CLAMP_TO_EDGE),t.needsTerrainPrepare=!1}let i=t?this._getDEMTileMatrix(e,t):this._emptyDemMatrix;return{u_depth:2,u_terrain:3,u_terrain_dim:t?.dem?.dim||1,u_terrain_matrix:i,u_terrain_unpack:t?.dem?.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(t?.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:t}}getFramebuffer(){let e=this.painter,t=e.width/devicePixelRatio,i=e.height/devicePixelRatio;return this._fbo&&(this._fbo.width!==t||this._fbo.height!==i)&&(this._fbo.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture),this._fboDepthTexture||(this._fboDepthTexture=new yt(e.context,{width:t,height:i,data:null},e.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(e.context.gl.NEAREST,e.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=e.context.createFramebuffer(t,i,!0,!1),this._fbo.depthAttachment.set(e.context.createRenderbuffer(e.context.gl.DEPTH_COMPONENT16,t,i))),this._fbo.colorAttachment.set(this._fboDepthTexture.texture),this._fbo}getHeightMapFramebuffer(e){return this._heightMapFbo||=this.painter.context.createFramebuffer(1,1,!1,!1),this._heightMapFbo.colorAttachment.set(e),this._heightMapFbo}getTerrainMesh(e,t){let i=t&&e.canonical.y===0,r=t&&e.canonical.y===(1<<e.canonical.z)-1,a=`m_${i?"n":""}_${r?"s":""}`;if(this._meshCache[a])return this._meshCache[a];let o=this.painter.context,n=new gT,s=new xr,l=this.meshSize,u=z/l,c=l*l;for(let d=0;d<=l;d++)for(let p=0;p<=l;p++)n.emplaceBack(p*u,d*u,0);for(let d=0;d<c;d+=l+1)for(let p=0;p<l;p++)s.emplaceBack(p+d,l+p+d+1,l+p+d+2),s.emplaceBack(p+d,l+p+d+2,p+d+1);this._terrainSkirtLength!=="none"&&this._buildSkirts(n,s,l,u,i,r);let h=new as(o.createVertexBuffer(n,qR.members),o.createIndexBuffer(s),tt.simpleSegment(0,0,n.length,s.length));return this._meshCache[a]=h,h}getSkirtLength(e){return this._worldCoordinateHelper.metersPerWorldUnit(0.5,0.5)/2**Math.max(e,0)/5}getMinTileElevationForLngLatZoom(e,t){let i=this._worldCoordinateHelper;if(!wh(t,i.wraps?e.wrap():e,i))return 0;let{tileID:r}=this._getOverscaledTileIDFromLngLatZoom(e,t);return this.getMinMaxElevation(r).minElevation??0}getMinMaxElevation(e){let t=this._minMaxElevationCache.get(e.key);if(t)return t;let i=this.tileManager.getSourceTile(e,!0);return t={minElevation:null,maxElevation:null},i?.dem&&(t.minElevation=i.dem.min*this.exaggeration,t.maxElevation=i.dem.max*this.exaggeration),this._minMaxElevationCache.set(e.key,t),t}get _worldCoordinateHelper(){return this._getWorldCoordinateHelper()}_getOverscaledTileIDFromLngLatZoom(e,t){let i=this._worldCoordinateHelper,r=i.wraps?e.wrap():e,a=i.worldFromLngLat(r.lng,r.lat),o=(1<<t)*z,n=a.x*o,s=a.y*o;return{tileID:new Et(t,0,t,Math.floor(n/z),Math.floor(s/z)),worldX:n,worldY:s}}_buildSkirts(e,t,i,r,a,o){let n=e.length,s=n+(i+1),l=(i+1)*i,u=a?Pn:0,c=+!a,h=o?In:z,d=+!o;for(let m=0;m<=i;m++)e.emplaceBack(m*r,u,c);for(let m=0;m<=i;m++)e.emplaceBack(m*r,h,d);for(let m=0;m<i;m++)t.emplaceBack(l+m,s+m,s+m+1),t.emplaceBack(l+m,s+m+1,l+m+1),t.emplaceBack(0+m,n+m+1,n+m),t.emplaceBack(0+m,0+m+1,n+m+1);let p=e.length,f=p+(i+1)*2;for(let m of[0,1])for(let g=0;g<=i;g++)for(let _ of[0,1])e.emplaceBack(m*z,g*r,_);for(let m=0;m<i*2;m+=2)t.emplaceBack(p+m,p+m+1,p+m+3),t.emplaceBack(p+m,p+m+3,p+m+2),t.emplaceBack(f+m,f+m+3,f+m+1),t.emplaceBack(f+m,f+m+2,f+m+3)}},oy,ny=class{constructor(e,t,i,r){this._tileKeys=e.map((a)=>a.key).sort().join(),this._revision=t,this._zoom=i,this._visibleLayerIds=r}difference(e){return this._revision===e?._revision?this._visibleLayerIds===e._visibleLayerIds?this._tileKeys===e._tileKeys?this._zoom===e._zoom?"none":"zoom":"sourceTiles":"visibleLayers":"revision"}},Qb,HR=class{constructor(e,t){this.needsFollowUpFrame=!1,this.painter=e,this.terrain=t,this.rttSize=t.tileManager.tileSize*t.qualityFactor}getTexture(e){return e.getRTT(this._stacks.length-1).texture}prepareForRender(e,t,i){let r=t!==this._lastPrepareZoom;this._lastPrepareZoom=t,this._stacks=[],this._prevRenderedToTexture=!1,this._rttTiles=[],this._renderableTiles=this.terrain.tileManager.getRenderableTiles(),this._renderableLayerIds=e._order.filter((u)=>!e._layers[u].isHidden(t));let a=ZR(e,this._renderableLayerIds),o=this._renderableLayerIds.join(),n=new Set;for(let u of this._renderableLayerIds){let c=e._layers[u],h=c.source;h&&Qb[c.type]&&n.add(h)}this._coordsAscending={},this._rttFingerprints={};for(let u of n){let c=e.tileManagers[u];if(!c)continue;this._coordsAscending[u]={};let h=this._coordsAscending[u],d=c.getSource(),p=d instanceof gs?d.terrainTileRanges:null;for(let g of c.getVisibleCoordinates()){let _=this.terrain.tileManager.getTerrainCoords(g,p);for(let y in _)h[y]||=[],h[y].push(_[y])}this._rttFingerprints[u]={};let f=this._rttFingerprints[u],m=c.getState().revision;for(let g in h)f[g]=new ny(h[g],m,t,o)}for(let u of this._renderableLayerIds){let c=e._layers[u];if(!ic(c)||!Pp(c))continue;let h=c.implementation.terrainTileRevision??0,d={};for(let p of this._renderableTiles)d[p.tileID.key]=new ny([p.tileID],h,t,o);this._rttFingerprints[Kh(c)]=d}this.needsFollowUpFrame=!1;let s=r||i,l=!1;for(let u of this._renderableTiles){let c=this._textureDifference(u);c!=="none"&&(c==="zoom"&&s||c==="visibleLayers"&&r?this.needsFollowUpFrame=!0:c==="zoom"||c==="sourceTiles"?(l?this.needsFollowUpFrame=!0:this._releaseChangedTextures(u,e,a),l=!0):this._releaseChangedTextures(u,e,a))}}_releaseChangedTextures(e,t,i){let r=i.map((a)=>this._hasStackChanged(e,t,a));if(!r.includes(!1))e.releaseRTT(this.painter);else for(let[a,o]of r.entries())o&&e.releaseRTTStack(this.painter,a)}_hasStackChanged(e,t,i){let r=!1;for(let a of i){let o=Kh(t._layers[a]),n=this._rttFingerprints[o]?.[e.tileID.key],s=e.rttFingerprint[o];if(n||s){if(n?.difference(s)!=="none")return!0;r=!0}}return!r}_textureDifference(e){let t="none";for(let i in this._rttFingerprints){let r=this._rttFingerprints[i][e.tileID.key];if(!r)continue;let a=r.difference(e.rttFingerprint[i]);oy.indexOf(a)>oy.indexOf(t)&&(t=a)}return t}renderLayer(e,t,i){if(e.isHidden(i.projectedCamera.zoom))return!1;let r=Pp(e),a=this.painter,o=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(r&&(this._prevRenderedToTexture||this._stacks.push([]),this._prevRenderedToTexture=!0,this._stacks[this._stacks.length-1].push(e.id),!o))return!0;if(this._prevRenderedToTexture||r&&o){this._prevRenderedToTexture=r;let n=this._stacks.length-1,s=this._stacks[n]||[];i.isRenderingToTexture=!0,w_(a.context.frameUniformBuffer,this.rttSize,this.rttSize);for(let l of this._renderableTiles){if(this._rttTiles.push(l),l.getRTT(n))continue;let u=l.acquireRTT(a,n,this.rttSize);a.bindRTT(u),a.context.clear({color:se.transparent,stencil:0}),i.invalidateTileClippingMasks();for(let c of s){let h=t._layers[c],d=h.source?this._coordsAscending[h.source][l.tileID.key]:[l.tileID];a.context.viewport.set([0,0,this.rttSize,this.rttSize]),i.renderTileClippingMasks(h,d),a.renderLayer(a,t.tileManagers[h.source],h,d,i);let p=Kh(h);p&&(l.rttFingerprint[p]=this._rttFingerprints[p][l.tileID.key])}u.texture.generateMipmap()}return i.isRenderingToTexture=!1,w_(a.context.frameUniformBuffer,a.context.gl.drawingBufferWidth,a.context.gl.drawingBufferHeight),lF(this.painter,this.terrain,this._rttTiles,i),this._rttTiles=[],r}return!1}},XR,YR,sy,ew,um,ly,rw="#3FB1CE",Jh,ao,QR,pc,ez,uy,aw;var sw=$c(()=>{u5=Object.create,cy=Object.defineProperty,c5=Object.getOwnPropertyDescriptor,h5=Object.getOwnPropertyNames,d5=Object.getPrototypeOf,hy=Object.prototype.hasOwnProperty;D.prototype={clone(){return new D(this.x,this.y)},add(e){return this.clone()._add(e)},sub(e){return this.clone()._sub(e)},multByPoint(e){return this.clone()._multByPoint(e)},divByPoint(e){return this.clone()._divByPoint(e)},mult(e){return this.clone()._mult(e)},div(e){return this.clone()._div(e)},rotate(e){return this.clone()._rotate(e)},rotateAround(e,t){return this.clone()._rotateAround(e,t)},matMult(e){return this.clone()._matMult(e)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(e){return this.x===e.x&&this.y===e.y},dist(e){return Math.sqrt(this.distSqr(e))},distSqr(e){let t=e.x-this.x,i=e.y-this.y;return t*t+i*i},angle(){return Math.atan2(this.y,this.x)},angleTo(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith(e){return this.angleWithSep(e.x,e.y)},angleWithSep(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult(e){let t=e[0]*this.x+e[1]*this.y,i=e[2]*this.x+e[3]*this.y;return this.x=t,this.y=i,this},_add(e){return this.x+=e.x,this.y+=e.y,this},_sub(e){return this.x-=e.x,this.y-=e.y,this},_mult(e){return this.x*=e,this.y*=e,this},_div(e){return this.x/=e,this.y/=e,this},_multByPoint(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint(e){return this.x/=e.x,this.y/=e.y,this},_unit(){return this._div(this.mag()),this},_perp(){let e=this.y;return this.y=this.x,this.x=-e,this},_rotate(e){let t=Math.cos(e),i=Math.sin(e),r=t*this.x-i*this.y,a=i*this.x+t*this.y;return this.x=r,this.y=a,this},_rotateAround(e,t){let i=Math.cos(e),r=Math.sin(e),a=t.x+i*(this.x-t.x)-r*(this.y-t.y),o=t.y+r*(this.x-t.x)+i*(this.y-t.y);return this.x=a,this.y=o,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:D},D.convert=function(e){if(e instanceof D)return e;if(Array.isArray(e))return new D(+e[0],+e[1]);if(e.x!==void 0&&e.y!==void 0)return new D(+e.x,+e.y);throw Error("Expected [x, y] or {x, y} point format")};At=typeof Float32Array<"u"?Float32Array:Array;td=E5;Pr=S5;Br=Fp,Ul=Ki;(function(){var e=gy();return function(t,i,r,a,o,n){var s,l;for(i||=3,r||=0,l=a?Math.min(a*i+r,t.length):t.length,s=r;s<l;s+=i)e[0]=t[s],e[1]=t[s+1],e[2]=t[s+2],o(e,e,n),t[s]=e[0],t[s+1]=e[1],t[s+2]=e[2];return t}})();B5=R5;(function(){var e=k5();return function(t,i,r,a,o,n){var s,l;for(i||=4,r||=0,l=a?Math.min(a*i+r,t.length):t.length,s=r;s<l;s+=i)e[0]=t[s],e[1]=t[s+1],e[2]=t[s+2],e[3]=t[s+3],o(e,e,n),t[s]=e[0],t[s+1]=e[1],t[s+2]=e[2],t[s+3]=e[3];return t}})();$5=F5,Rg=L5;(function(){var e=gy(),t=kg(1,0,0),i=kg(0,1,0);return function(r,a,o){var n=ft(a,o);return n<-0.999999?(si(e,t,a),Ul(e)<0.000001&&si(e,i,a),Rt(e,e),j5(r,e,Math.PI),r):n>0.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(si(e,a,o),r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=1+n,Rg(r,r))}})(),function(){var e=Fg(),t=Fg();return function(i,r,a,o,n,s){return Al(e,r,n,s),Al(t,a,o,s),Al(i,e,t,2*s*(1-s)),i}}(),function(){var e=fy();return function(t,i,r,a){return e[0]=r[0],e[3]=r[1],e[6]=r[2],e[1]=a[0],e[4]=a[1],e[7]=a[2],e[2]=-i[0],e[5]=-i[1],e[8]=-i[2],Rg(t,V5(t,e))}}();G5=U5;(function(){var e=ad();return function(t,i,r,a,o,n){var s,l;for(i||=2,r||=0,l=a?Math.min(a*i+r,t.length):t.length,s=r;s<l;s+=i)e[0]=t[s],e[1]=t[s+1],o(e,e,n),t[s]=e[0],t[s+1]=e[1];return t}})();nd=Lp(0.25,0.1,0.25,1);jg={};Ty={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},Ey={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0};os=class extends Error{constructor(e=Vg){super(e instanceof Error?e.message:e),this.name=Vg,e instanceof Error&&e.stack&&(this.stack=e.stack)}};li={frame(e,t,i,r){let a=r||window,o=a.requestAnimationFrame((s)=>{n(),t(s)}),{unsubscribe:n}=ql(e.signal,"abort",()=>{n(),a.cancelAnimationFrame(o),i(new os(e.signal.reason))},!1)},frameAsync(e,t){return new Promise((i,r)=>{this.frame(e,i,r,t)})},getImageData(e,t=0){return this.getImageCanvasContext(e).getImageData(-t,-t,e.width+2*t,e.height+2*t)},getImageCanvasContext(e){let t;if(kp()&&!py())t=new OffscreenCanvas(e.width,e.height).getContext("2d",{willReadFrequently:!0});else{let i=window.document.createElement("canvas");i.width=e.width,i.height=e.height,t=i.getContext("2d",{willReadFrequently:!0})}if(!t)throw Error("failed to create canvas 2d context");return t.drawImage(e,0,0,e.width,e.height),t},resolveURL(e){return lh||=document.createElement("a"),lh.href=e,lh.href},get hardwareConcurrency(){return typeof navigator<"u"&&navigator.hardwareConcurrency||4},get prefersReducedMotion(){return uh===void 0?matchMedia?($g??=matchMedia("(prefers-reduced-motion: reduce)"),$g.matches):!1:uh},set prefersReducedMotion(e){uh=e}},h3=new class{constructor(){this._frozenAt=null}getCurrentTime(){return this._frozenAt===null?performance.now():this._frozenAt}setNow(e){this._frozenAt=e}restoreNow(){this._frozenAt=null}isFrozen(){return this._frozenAt!==null}};f3=new Set("a.abbr.b.bdi.bdo.br.cite.code.del.div.em.i.img.ins.kbd.li.mark.ol.p.q.s.samp.small.span.strong.sub.sup.time.u.ul.var.wbr".split(".")),m3=new Set(["alt","class","datetime","dir","height","href","hreflang","lang","referrerpolicy","rel","role","src","target","title","translate","type","width"]),g3=new Set(["href","src"]),_3=new Set(["http:","https:","mailto:"]);Ve=class e{static{this.docStyle=typeof window<"u"&&window.document?.documentElement.style}static{this.selectProp=!e.docStyle||"userSelect"in e.docStyle?"userSelect":"webkitUserSelect"}static create(t,i,r){let a=window.document.createElement(t);return i!==void 0&&(a.className=i),r&&r.appendChild(a),a}static createNS(t,i){return window.document.createElementNS(t,i)}static disableDrag(){e.docStyle&&e.selectProp&&(e.userSelect=e.docStyle[e.selectProp],e.docStyle[e.selectProp]="none")}static enableDrag(){e.docStyle&&e.selectProp&&(e.docStyle[e.selectProp]=e.userSelect)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",e.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",e.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",e.suppressClickInternal,!0)},0)}static getScale(t){let i=t.getBoundingClientRect();return{x:i.width/t.offsetWidth||1,y:i.height/t.offsetHeight||1,boundingClientRect:i}}static getPoint(t,i,r){let a=i.boundingClientRect;return new D((r.clientX-a.left)/i.x-t.clientLeft,(r.clientY-a.top)/i.y-t.clientTop)}static mousePos(t,i){let r=e.getScale(t);return e.getPoint(t,r,i)}static touchPos(t,i){let r=[],a=e.getScale(t);for(let o of i)r.push(e.getPoint(t,a,o));return r}static sanitize(t){let i=new DOMParser().parseFromString(d3(t),"text/html").body,{querySelectorAll:r,remove:a}=ch();for(let n of Array.from(r.call(i,"*")))e.isAllowedElement(n)?e.removeDisallowedAttributes(n):a.call(n);let o=document.createDocumentFragment();return o.append(...i.childNodes),o}static isAllowedElement(t){let{namespaceURI:i,localName:r}=ch();return i.call(t)==="http://www.w3.org/1999/xhtml"&&f3.has(r.call(t))}static removeDisallowedAttributes(t){let{getAttributeNames:i,getAttribute:r,removeAttribute:a}=ch();for(let o of i.call(t))e.isAllowedAttribute(o,r.call(t,o))||a.call(t,o)}static isAllowedAttribute(t,i){if(!m3.has(t)&&!t.startsWith("aria-"))return!1;if(!g3.has(t))return!0;try{return _3.has(new URL(i,"https://maplibre.invalid/").protocol)}catch{return!1}}},Ma={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};Wl=class extends Error{constructor(e,t,i,r){super(`AJAXError: ${t} (${e}): ${i}`),this.status=e,this.statusText=t,this.url=i,this.body=r}};ie=class extends sa{constructor(e,t={}){super("error",ee({error:e},t))}},Ay={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number",length:2},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},"font-faces":{type:"fontFaces"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{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"},sparse:{type:"boolean",default:!1},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{type:"*"}},source_raster:{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:"*"}},source_raster_dem:{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:"*"}},source_geojson:{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:"filter"},tolerance:{type:"number",default:0.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"}},source_video:{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"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"},"fill-extrusion-rounded-corner-distance":{type:"number",default:0,minimum:0,units:"meters","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"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","feature"]},"property-type":"data-driven"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_symbol:{"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","feature"]},"property-type":"data-driven"},"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"},"symbol-height-offset":{type:"number",default:0,units:"meters",requires:[{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-height-anchor":{type:"enum",values:{ground:{},absolute:{}},default:"ground",requires:["symbol-height-offset"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:{type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},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:{},oklch:{},oklab:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"expression_name",minimum:1},light:{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:0.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"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:0.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:0.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:0.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:0.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],paint_fill:{"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-layer-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","global-state"]},"property-type":"data-constant"},"fill-layer-blend":{type:"enum",values:{normal:{},multiply:{},color:{},luminosity:{},"plus-lighter":{},screen:{},overlay:{}},default:"normal","property-type":"constant",transition:!1},"fill-color":{type:"color",default:"#000000",transition:!0,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"}},"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","elevation"]},"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,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default: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:{"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-layer-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","global-state"]},"property-type":"data-constant"},"line-layer-blend":{type:"enum",values:{normal:{},multiply:{},color:{},luminosity:{},"plus-lighter":{},screen:{},overlay:{}},default:"normal","property-type":"constant",transition:!1},"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","feature"]},"property-type":"cross-faded-data-driven"},"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"}},paint_circle:{"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"}},paint_heatmap:{"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)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.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"}},paint_symbol:{"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"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-layer-blend":{type:"enum",values:{normal:{},multiply:{},color:{},luminosity:{},"plus-lighter":{},screen:{},overlay:{}},default:"normal","property-type":"constant",transition:!1},"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"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,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"}},paint_hillshade:{"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:0.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"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"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"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:{"*":{type:"string"}},interpolation:{type:"array",value:"interpolation_name",minimum:1},interpolation_name:{type:"enum",values:{linear:{syntax:{overloads:[{parameters:[],"output-type":"interpolation"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:["base"],"output-type":"interpolation"}],parameters:[{name:"base",type:"number literal"}]}},"cubic-bezier":{syntax:{overloads:[{parameters:["x1","y1","x2","y2"],"output-type":"interpolation"}],parameters:[{name:"x1",type:"number literal"},{name:"y1",type:"number literal"},{name:"x2",type:"number literal"},{name:"y2",type:"number literal"}]}}}}},F=Ay,w3=["type","source","source-layer","minzoom","maxzoom","filter","layout"];ur=class extends Error{constructor(e,t){super(t),this.message=t,this.key=e}},ns={kind:"null"},U={kind:"number"},ce={kind:"string"},ve={kind:"boolean"},Xi={kind:"color"},Iu={kind:"projectionDefinition"},Ca={kind:"object"},de={kind:"value"},P3={kind:"error"},ku={kind:"collator"},ss={kind:"formatted"},Fu={kind:"padding"},Bn={kind:"colorArray"},Ru={kind:"numberArray"},ls={kind:"resolvedImage"},zu={kind:"variableAnchorOffsetCollection"};I3=[ns,U,ce,ve,Xi,Iu,ss,Ca,Vt(de),Fu,Ru,Bn,ls,zu];Ry=3*ud*ud,zy=Math.PI/180,Np=180/Math.PI;Oy=[[0.4123907992659595,0.35758433938387796,0.1804807884018343],[0.21263900587151036,0.7151686787677559,0.07219231536073371],[0.01933081871559185,0.11919477979462599,0.9505321522496606]],jy=[[3.2409699419045213,-1.5373831775700935,-0.4986107602930033],[-0.9692436362808798,1.8759675015077206,0.04155505740717561],[0.05563007969699361,-0.20397695888897657,1.0569715142428786]],z3=[[0.819022437996703,0.3619062600528904,-0.1288737815209879],[0.0329836539323885,0.9292868615863434,0.0361446663506424],[0.0481771893596242,0.2642395317527308,0.6335478284694309]],L3=[[0.210454268309314,0.7936177747023054,-0.0040720430116193],[1.9779985324311684,-2.42859224204858,0.450593709617411],[0.0259040424655478,0.7827717124575296,-0.8086757549230774]],B3=[[1,0.3963377773761749,0.2158037573099136],[1,-0.1055613458156586,-0.0638541728258133],[1,-0.0894841775298119,-1.2914855480194092]],O3=[[1.2268798758459243,-0.5578149944602171,0.2813910456659647],[-0.0405757452148008,1.112286803280317,-0.0717110580655164],[-0.0763729366746601,-0.4214933324022432,1.5869240198367816]];$3=[[0.48657094864821626,0.26566769316909294,0.1982172852343625],[0.22897456406974884,0.6917385218365062,0.079286914093745],[0,0.045113381858902575,1.0439443689009757]],U3=[[2.4934969119414245,-0.9313836179191236,-0.40271078445071684],[-0.829488969561575,1.7626640603183468,0.02362468584194359],[0.035845830243784335,-0.07617238926804171,0.9568845240076873]];W3=Object.hasOwn||function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};H3=RegExp(`^oklch\\(\\s*(none|${Ri}%?)\\s+(none|${Ri}%?)\\s+(none|${Ri}(?:deg|grad|rad|turn)?)\\s*(?:\\/\\s*(none|${Ri}%?)\\s*)?\\)$`),X3=RegExp(`^oklab\\(\\s*(none|${Ri}%?)\\s+(none|${Ri}%?)\\s+(none|${Ri}%?)\\s*(?:\\/\\s*(none|${Ri}%?)\\s*)?\\)$`),Y3=RegExp(`^color\\(\\s*display-p3\\s+(none|${Ri}%?)\\s+(none|${Ri}%?)\\s+(none|${Ri}%?)\\s*(?:\\/\\s*(none|${Ri}%?)\\s*)?\\)$`),Xg={deg:1,grad:0.9,rad:180/Math.PI,turn:360};K3={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]};se=class e{constructor(t,i,r,a=1,o=!0){!o&&(Math.min(t,i,r)<0||Math.max(t,i,r)>1)&&(this.overwriteGetter("unclippedRgb",[t,i,r,a]),t=Math.min(Math.max(t,0),1),i=Math.min(Math.max(i,0),1),r=Math.min(Math.max(r,0),1)),this.r=t,this.g=i,this.b=r,this.a=a,o||(this.r*=a,this.g*=a,this.b*=a,a||this.overwriteGetter("rgb",[t,i,r,a]))}static{this.black=new e(0,0,0,1)}static{this.white=new e(1,1,1,1)}static{this.transparent=new e(0,0,0,0)}static{this.red=new e(1,0,0,1)}static parse(t){if(t instanceof e)return t;if(typeof t!="string")return;let i=Z3(t);if(i)return new e(...i,!1)}get rgb(){let{r:t,g:i,b:r,a}=this,o=a||1/0;return this.overwriteGetter("rgb",[t/o,i/o,r/o,a])}get hcl(){return this.overwriteGetter("hcl",k3(this.unclippedRgb))}get lab(){return this.overwriteGetter("lab",Ly(this.unclippedRgb))}get oklch(){return this.overwriteGetter("oklch",V3(this.unclippedRgb))}get oklab(){return this.overwriteGetter("oklab",N3(this.unclippedRgb))}get displayP3(){return this.overwriteGetter("displayP3",G3(this.unclippedRgb))}get unclippedRgb(){return this.rgb}overwriteGetter(t,i){return Object.defineProperty(this,t,{value:i}),i}toString(){let[t,i,r,a]=this.rgb;return`rgba(${[t,i,r].map((o)=>Math.round(o*255)).join(",")},${a})`}static interpolate(t,i,r,a="rgb"){switch(a){case"rgb":{let[o,n,s,l]=So(t.unclippedRgb,i.unclippedRgb,r);return new e(o,n,s,l,!1)}case"hcl":{let[o,n,s,l]=t.hcl,[u,c,h,d]=i.hcl,p,f;if(!isNaN(o)&&!isNaN(u)){let v=u-o;u>o&&v>180?v-=360:u<o&&o-u>180&&(v+=360),p=o+r*v}else isNaN(o)?isNaN(u)?p=NaN:(p=u,(s===1||s===0)&&(f=c)):(p=o,(h===1||h===0)&&(f=n));let[m,g,_,y]=F3([p,f??Nt(n,c,r),Nt(s,h,r),Nt(l,d,r)]);return new e(m,g,_,y,!1)}case"lab":{let[o,n,s,l]=By(So(t.lab,i.lab,r));return new e(o,n,s,l,!1)}case"oklch":{let[o,n,s,l]=t.oklch,[u,c,h,d]=i.oklch,p=isNaN(s)?h:s,f=isNaN(h)?s:h;f-p>180?p+=360:f-p<-180&&(f+=360);let m=Nt(l,d,r),g=m===0?1:m,[_,y,v]=$p([Nt(o*l,u*d,r)/g,Nt(n*l,c*d,r)/g,Nt(p,f,r),m]);return new e(_,y,v,m,!1)}case"oklab":{let[o,n,s,l]=t.oklab,[u,c,h,d]=i.oklab,p=Nt(l,d,r),f=p===0?1:p,[m,g,_]=Vy([Nt(o*l,u*d,r)/f,Nt(n*l,c*d,r)/f,Nt(s*l,h*d,r)/f,p]);return new e(m,g,_,p,!1)}}}},Q3=["bottom","center","top"],Je=class extends Error{constructor(e,t){super(e),this.name="RuntimeError",this.path=t}toJSON(){return this.message}},e4=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);Ks={string:ce,number:U,boolean:ve,object:Ca},Jg={"to-boolean":ve,"to-color":Xi,"to-number":U,"to-string":ce},t4=["Unknown","Point","LineString","Polygon"];Ze={color:se.interpolate,number:Nt,padding:br.interpolate,numberArray:wr.interpolate,colorArray:oi.interpolate,variableAnchorOffsetCollection:yr.interpolate,array:So};x4=Bo("==",u4,Hy),b4=Bo("!=",c4,m4),w4=Bo("<",h4,g4),T4=Bo(">",d4,_4),E4=Bo("<=",p4,y4),S4=Bo(">=",f4,v4);r0=Math.PI/180;fo={"==":x4,"!=":b4,">":T4,"<":w4,">=":S4,"<=":E4,array:Ir,at:i4,boolean:Ir,case:n4,coalesce:Zy,collator:Xy,format:Yy,image:D4,in:r4,"index-of":a4,interpolate:ni,"interpolate-hcl":ni,"interpolate-lab":ni,"interpolate-oklch":ni,"interpolate-oklab":ni,length:A4,let:Gy,literal:Do,match:o4,number:Ir,"number-format":C4,object:Ir,semiliteral:e6,slice:s4,step:qp,string:Ir,"to-boolean":uo,"to-color":uo,"to-number":uo,"to-string":uo,var:Wy,within:Zp,distance:Kp,"global-state":Jp};La.register(fo,{error:[P3,[ce],(e,[t],i)=>{throw new Je(t.evaluate(e),i)}],typeof:[ce,[de],(e,[t])=>it(ut(t.evaluate(e)))],"to-rgba":[Vt(U,4),[Xi],(e,[t])=>{let[i,r,a,o]=t.evaluate(e).rgb;return[i*255,r*255,a*255,o]}],rgb:[Xi,[U,U,U],s0],rgba:[Xi,[U,U,U,U],s0],has:{type:ve,overloads:[[[ce],(e,[t])=>l0(t.evaluate(e),e.properties())],[[ce,Ca],(e,[t,i])=>l0(t.evaluate(e),i.evaluate(e))]]},get:{type:de,overloads:[[[ce],(e,[t])=>_h(t.evaluate(e),e.properties())],[[ce,Ca],(e,[t,i])=>_h(t.evaluate(e),i.evaluate(e))]]},"feature-state":[de,[ce],(e,[t])=>_h(t.evaluate(e),e.featureState||{})],properties:[Ca,[],(e)=>e.properties()],"geometry-type":[ce,[],(e)=>e.geometryType()],id:[de,[],(e)=>e.id()],zoom:[U,[],(e)=>e.globals.zoom],"heatmap-density":[U,[],(e)=>e.globals.heatmapDensity||0],elevation:[U,[],(e)=>e.globals.elevation||0],"line-progress":[U,[],(e)=>e.globals.lineProgress||0],accumulated:[de,[],(e)=>e.globals.accumulated===void 0?null:e.globals.accumulated],"+":[U,fa(U),(e,t)=>{let i=0;for(let r of t)i+=r.evaluate(e);return i}],"*":[U,fa(U),(e,t)=>{let i=1;for(let r of t)i*=r.evaluate(e);return i}],"-":{type:U,overloads:[[[U,U],(e,[t,i])=>t.evaluate(e)-i.evaluate(e)],[[U],(e,[t])=>-t.evaluate(e)]]},"/":[U,[U,U],(e,[t,i])=>t.evaluate(e)/i.evaluate(e)],"%":[U,[U,U],(e,[t,i])=>t.evaluate(e)%i.evaluate(e)],ln2:[U,[],()=>Math.LN2],pi:[U,[],()=>Math.PI],e:[U,[],()=>Math.E],"^":[U,[U,U],(e,[t,i])=>t.evaluate(e)**+i.evaluate(e)],sqrt:[U,[U],(e,[t])=>Math.sqrt(t.evaluate(e))],log10:[U,[U],(e,[t])=>Math.log(t.evaluate(e))/Math.LN10],ln:[U,[U],(e,[t])=>Math.log(t.evaluate(e))],log2:[U,[U],(e,[t])=>Math.log(t.evaluate(e))/Math.LN2],sin:[U,[U],(e,[t])=>Math.sin(t.evaluate(e))],cos:[U,[U],(e,[t])=>Math.cos(t.evaluate(e))],tan:[U,[U],(e,[t])=>Math.tan(t.evaluate(e))],asin:[U,[U],(e,[t])=>Math.asin(t.evaluate(e))],acos:[U,[U],(e,[t])=>Math.acos(t.evaluate(e))],atan:[U,[U],(e,[t])=>Math.atan(t.evaluate(e))],min:[U,fa(U),(e,t)=>Math.min(...t.map((i)=>i.evaluate(e)))],max:[U,fa(U),(e,t)=>Math.max(...t.map((i)=>i.evaluate(e)))],abs:[U,[U],(e,[t])=>Math.abs(t.evaluate(e))],round:[U,[U],(e,[t])=>{let i=t.evaluate(e);return i<0?-Math.round(-i):Math.round(i)}],floor:[U,[U],(e,[t])=>Math.floor(t.evaluate(e))],ceil:[U,[U],(e,[t])=>Math.ceil(t.evaluate(e))],"filter-==":[ve,[ce,de],(e,[t,i])=>e.properties()[t.value]===i.value],"filter-id-==":[ve,[de],(e,[t])=>e.id()===t.value],"filter-type-==":[ve,[ce],(e,[t])=>e.geometryType()===t.value],"filter-<":[ve,[ce,de],(e,[t,i])=>{let r=e.properties()[t.value],a=i.value;return typeof r==typeof a&&r<a}],"filter-id-<":[ve,[de],(e,[t])=>{let i=e.id(),r=t.value;return typeof i==typeof r&&i<r}],"filter->":[ve,[ce,de],(e,[t,i])=>{let r=e.properties()[t.value],a=i.value;return typeof r==typeof a&&r>a}],"filter-id->":[ve,[de],(e,[t])=>{let i=e.id(),r=t.value;return typeof i==typeof r&&i>r}],"filter-<=":[ve,[ce,de],(e,[t,i])=>{let r=e.properties()[t.value],a=i.value;return typeof r==typeof a&&r<=a}],"filter-id-<=":[ve,[de],(e,[t])=>{let i=e.id(),r=t.value;return typeof i==typeof r&&i<=r}],"filter->=":[ve,[ce,de],(e,[t,i])=>{let r=e.properties()[t.value],a=i.value;return typeof r==typeof a&&r>=a}],"filter-id->=":[ve,[de],(e,[t])=>{let i=e.id(),r=t.value;return typeof i==typeof r&&i>=r}],"filter-has":[ve,[de],(e,[t])=>{let i=t.value,r=e.properties();return i in r&&r[i]!==void 0}],"filter-has-id":[ve,[],(e)=>e.id()!==null&&e.id()!==void 0],"filter-type-in":[ve,[Vt(ce)],(e,[t])=>t.value.indexOf(e.geometryType())>=0],"filter-id-in":[ve,[Vt(de)],(e,[t])=>t.value.indexOf(e.id())>=0],"filter-in-small":[ve,[ce,Vt(de)],(e,[t,i])=>i.value.indexOf(e.properties()[t.value])>=0],"filter-in-large":[ve,[ce,Vt(de)],(e,[t,i])=>t6(e.properties()[t.value],i.value,0,i.value.length-1)],all:{type:ve,overloads:[[[ve,ve],(e,[t,i])=>t.evaluate(e)&&i.evaluate(e)],[fa(ve),(e,t)=>{for(let i of t)if(!i.evaluate(e))return!1;return!0}]]},any:{type:ve,overloads:[[[ve,ve],(e,[t,i])=>t.evaluate(e)||i.evaluate(e)],[fa(ve),(e,t)=>{for(let i of t)if(i.evaluate(e))return!0;return!1}]]},"!":[ve,[ve],(e,[t])=>!t.evaluate(e)],"is-supported-script":[ve,[ce],(e,[t])=>{let i=e.globals&&e.globals.isSupportedScript;return!i||i(t.evaluate(e))}],upcase:[ce,[ce],(e,[t])=>t.evaluate(e).toUpperCase()],downcase:[ce,[ce],(e,[t])=>t.evaluate(e).toLowerCase()],concat:[ce,fa(de),(e,t)=>t.map((i)=>En(i.evaluate(e))).join("")],split:[Vt(ce),[ce,ce],(e,[t,i])=>t.evaluate(e).split(i.evaluate(e))],join:[ce,[Vt(ce),ce],(e,[t,i])=>t.evaluate(e).join(i.evaluate(e))],"resolved-locale":[ce,[ku],(e,[t])=>t.evaluate(e).resolvedLocale()]});ef=/^(.*)-transition$/;g6={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};d0={promoteId:E6};z6=/^u\+(?:([0-9a-f]{1,6})(?:-([0-9a-f]{1,6}))?|([0-9a-f]{0,5}\?{1,6}))$/i;f0={"*"(){return[]},array:of,boolean:x6,number:qu,color:md,constants:fv,enum:qn,filter:nf,function:mv,layer:xv,object:wi,source:bv,light:wv,sky:Tv,terrain:Ev,projection:I6,projectionDefinition:k6,string:oa,formatted:S6,resolvedImage:C6,padding:D6,numberArray:A6,colorArray:M6,variableAnchorOffsetCollection:P6,sprite:Sv,state:Cv,fontFaces:Dv};_i.source=Pi(Mi(bv)),_i.sprite=Pi(Mi(Sv)),_i.glyphs=Pi(Mi(Av)),_i.fontFaces=Pi(Mi(Dv)),_i.light=Pi(Mi(wv)),_i.sky=Pi(Mi(Tv)),_i.terrain=Pi(Mi(Ev)),_i.state=Pi(Mi(Cv)),_i.layer=Pi(Mi(xv)),_i.filter=Pi(Mi(nf)),_i.paintProperty=Pi(Mi(yv)),_i.layoutProperty=Pi(Mi(vv));B6={type:"enum","property-type":"data-constant",expression:{interpolated:!1,parameters:["global-state"]},values:{visible:{},none:{}},transition:!1,default:"visible"};kr={};Z("Object",Object),Z("Set",Set),Z("TransferableGridIndex",ld),Z("Color",se),Z("Error",Error),Z("AJAXError",Wl),Z("ResolvedImage",vr),Z("StylePropertyFunction",uv),Z("StyleExpression",tf,{omit:["_evaluator"]}),Z("ZoomDependentExpression",Kl),Z("ZoomConstantExpression",$n),Z("CompoundExpression",La,{omit:["_evaluate"]});for(let e in fo)fo[e]._classRegistryKey||Z(`Expression_${e}`,fo[e]);$6={once:!0};Rv=class e extends qe{constructor(){super(),this.active={},this.workersPromise=null}acquire(t){return this.active[t]=!0,this.start()}async start(){if(this.workersPromise)return(await this.workersPromise).slice();let t=[];for(;t.length<e.workerCount;)t.push(K6());let i=this.workersPromise=Promise.all(t),r=await i;return this.workersPromise===i&&this.fire("create"),r.slice()}async restart(){if(this.workersPromise){this.terminate();try{await this.start()}catch(t){he(`Failed to create replacement workers: ${t}`);return}this.fire("restart")}}async release(t){delete this.active[t],this.numActive()===0&&await this.terminate()}async terminate(){let t=this.workersPromise;if(t){this.workersPromise=null,this.fire("terminate");try{for(let i of await t)i.terminate()}catch(i){he(`The terminated workers were never created: ${i}`)}}}isStarted(){return!!this.workersPromise}isPreloaded(){return!!this.active[J6]}numActive(){return Object.keys(this.active).length}},Q6=Math.floor(li.hardwareConcurrency/2);Rv.workerCount=t3(globalThis)?Math.max(Math.min(Q6,3),1):1;eT=class extends qe{constructor(e){super(),this.importedScriptUrls=new Set,this.messageHandlers={},this.watchingWorkers=!1,this.workerPool=e,e.on("create",()=>this.buildActorsInBackground()),e.on("terminate",()=>this.handleWorkersTerminated()),e.isStarted()&&this.buildActorsInBackground()}async buildActorsInBackground(){try{await this.getActors()}catch(e){pr(e)||he(`Failed to connect to the workers: ${e}`)}}handleWorkersTerminated(){this.workersAbortController?.abort(Error("The workers were terminated while a message was in flight.")),this.actorsPromise=void 0}getActors(){return this.actorsPromise??=this.buildActors(),this.actorsPromise}async buildActors(){let e=new AbortController;this.workersAbortController=e;let t=await this.workerPool.start();Ln(e.signal);let{actors:i,workerErrorSubscriptions:r}=kv(t,sd,this);e.signal.addEventListener("abort",()=>{for(let a of i)a.remove();for(let a of r)a.unsubscribe()},{once:!0});for(let a of i)for(let[o,n]of Object.entries(this.messageHandlers))a.registerMessageHandler(o,n);for(let a of this.importedScriptUrls)this.importScriptInto(i,e,a);return this.fire("workerscreate"),i}async getBuiltActors(){try{return await this.actorsPromise??[]}catch{return[]}}async importScriptInto(e,t,i){try{await Promise.all(e.map((r)=>r.sendAsync({type:"IS",data:i},t)))}catch(r){he(`Failed to import script ${i} into the workers: ${r}`)}}async broadcast(e,t){let i=this.getActors(),r=this.workersAbortController,a=await i;return Ln(r.signal),Promise.all(a.map((o)=>o.sendAsync({type:e,data:t},r)))}async registerMessageHandler(e,t){this.messageHandlers[e]=t;for(let i of await this.getBuiltActors())i.registerMessageHandler(e,t)}async unregisterMessageHandler(e){delete this.messageHandlers[e];for(let t of await this.getBuiltActors())t.unregisterMessageHandler(e)}async importScript(e){this.importedScriptUrls.add(e),await this.broadcast("IS",e)}watchWorkers(){this.watchingWorkers||typeof document>"u"||(this.watchingWorkers=!0,document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&this.ensureWorkers()},!1))}ensureWorkers(){return this.ensureWorkersPromise??=this.ensureWorkersInternal(),this.ensureWorkersPromise}async ensureWorkersInternal(){try{await this.ping()||await this.workerPool.restart()}finally{this.ensureWorkersPromise=void 0}}async ping(e=500){if(!this.workerPool.isStarted())return!0;let t;try{return await Promise.race([this.answersPing(),new Promise((i)=>{t=setTimeout(()=>i(!1),e)})])}finally{clearTimeout(t)}}async answersPing(){try{await this.broadcast("PI",void 0)}catch{}return!0}};(function(e){let t,i,r,a;e.resetRequestQueue=()=>{t=[],i=0,r=0,a={}},e.addThrottleControl=(h)=>{let d=r++;return a[d]=h,d},e.removeThrottleControl=(h)=>{delete a[h],u()};let o=()=>{for(let h of Object.keys(a))if(a[h]())return!0;return!1};async function n(h,d,p,f,m=!0,g){let _=await h.transformRequest(d,p);return Ln(f.signal),_r.getImage(_,f,m,g)}e.transformAndGetImage=n,e.getImage=(h,d,p=!0,f)=>new Promise((m,g)=>{h.headers||={},h.headers.accept="image/webp,*/*",ee(h,{type:"image"});let _={abortController:d,requestParameters:h,supportImageRefresh:p,imageBitmapOptions:f,state:"queued",onError:(y)=>{g(y)},onSuccess:(y)=>{m(y)}};t.push(_),u()});let s=(h,d)=>typeof createImageBitmap=="function"?i3(h,d):r3(h),l=async(h)=>{h.state="running";let{requestParameters:d,supportImageRefresh:p,imageBitmapOptions:f,onError:m,onSuccess:g,abortController:_}=h,y=p===!1&&!f&&!Eo(self)&&!Sy(d.url)&&(!d.headers||Object.keys(d.headers).reduce((x,b)=>x&&b==="accept",!0));i++;let v=y?c(d,_):Mu(d,_);try{let x=await v;delete h.abortController,h.state="completed",x.data instanceof HTMLImageElement||Sa(x.data)?g(x):!x.data||x.data.byteLength===0?g({data:null,cacheControl:x.cacheControl,expires:x.expires}):g({data:await s(x.data,f),cacheControl:x.cacheControl,expires:x.expires})}catch(x){delete h.abortController,m(Mt(x))}finally{i--,u()}},u=()=>{let h=o()?Ma.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:Ma.MAX_PARALLEL_IMAGE_REQUESTS;for(let d=i;d<h&&t.length>0;d++){let p=t.shift();p.abortController.signal.aborted?d--:l(p)}},c=(h,d)=>new Promise((p,f)=>{let m=new Image,{url:g,credentials:_}=h;_&&_==="include"?m.crossOrigin="use-credentials":(_&&_==="same-origin"||!Dy(g))&&(m.crossOrigin="anonymous"),d.signal.addEventListener("abort",()=>{m.src="",f(new os(d.signal.reason))}),m.fetchPriority="high",m.onload=()=>{m.onerror=m.onload=null,p({data:m})},m.onerror=()=>{m.onerror=m.onload=null,d.signal.aborted||f(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."))},m.src=g})})(_r||={}),_r.resetRequestQueue();Ct=class extends sa{},oe=class extends Ct{},g0=class extends Ct{constructor(e={}){super("style.load",e)}},qi=class extends Ct{constructor(e,t={}){super(e,t),this.dataType="style"}},He=class extends Ct{constructor(e,t={}){super(e,t),this.dataType="source"}},iT=class extends Ct{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,i,r={}){i=i instanceof MouseEvent?i:new MouseEvent(e,i);let a=Ve.mousePos(t.getCanvas(),i),o=t.unproject(a);super(e,ee({point:a,lngLat:o,originalEvent:i},r)),this._defaultPrevented=!1,this.target=t}},rT=class extends Ct{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,i){let r=e==="touchend"?i.changedTouches:i.touches,a=Ve.touchPos(t.getCanvasContainer(),r),o=a.map((l)=>t.unproject(l)),n=a.reduce((l,u,c,h)=>l.add(u.div(h.length)),new D(0,0)),s=t.unproject(n);super(e,{points:a,point:n,lngLats:o,lngLat:s,originalEvent:i}),this._defaultPrevented=!1}},aT=class extends Ct{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t){super("wheel",{originalEvent:t}),this._defaultPrevented=!1}},_0=class extends Ct{},oT=class extends Ct{constructor(e={}){super("terrain",e)}},nT=class extends Ct{constructor(e={}){super("projectiontransition",e)}},il=class extends Ct{},sT=class extends Ct{constructor(e={}){super("styleimagemissing",e)}},ai=_i,Lv=new Set(Object.keys(F).filter((e)=>e.startsWith("source_")).map((e)=>e.slice(7).replaceAll("_","-")));Wn=class extends ae{possiblyEvaluate(e,t,i,r){if(e.value===void 0)return new zi(this,{kind:"constant",value:void 0},t);if(e.expression.kind==="constant"){let a=e.expression.evaluate(t,null,{},i,r),o=e.property.specification.type==="resolvedImage"&&typeof a!="string"?a.name:a,n=this._calculate(o,o,o,t);return new zi(this,{kind:"constant",value:n},t)}if(e.expression.kind==="camera"){let a=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 zi(this,{kind:"constant",value:a},t)}return new zi(this,e.expression,t)}evaluate(e,t,i,r,a,o){if(e.kind==="source"){let n=e.evaluate(t,i,r,a,o);return this._calculate(n,n,n,t)}return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(t.zoom)-1},i,r),e.evaluate({zoom:Math.floor(t.zoom)},i,r),e.evaluate({zoom:Math.floor(t.zoom)+1},i,r),t):e.value}_calculate(e,t,i,r){return r.zoom>r.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:i,to:t}}interpolate(e){return e}};Z("DataDrivenProperty",ae),Z("DataConstantProperty",q),Z("CrossFadedDataDrivenProperty",Wn),Z("CrossFadedProperty",Ov),Z("ColorRampProperty",Zu);tr=class extends qe{constructor(e,t,i){if(super(),this.id=e.id,this.type=e.type,this._globalState=i,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},this._visibilityExpression=j6(this.visibility,`layers[${this.id}].layout.visibility`,i),e.type!=="custom"&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!=="background"&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter,this._featureFilter=Un(e.filter,`layers[${this.id}].filter`,i)),t.layout&&(this._unevaluatedLayout=new uT(t.layout,`layers[${this.id}].layout`,i)),t.paint)){this._transitionablePaint=new Gu(t.paint,`layers[${this.id}].paint`,i);for(let r in e.paint)this.setPaintProperty(r,e.paint[r],{validate:!1});for(let r in e.layout)this.setLayoutProperty(r,e.layout[r],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Wu(t.paint)}}setFilter(e){this.filter=e,this._featureFilter=Un(e,`layers[${this.id}].filter`,this._globalState)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){if(e==="visibility")return this.visibility;if(this._transitionablePaint?.hasProperty(e))throw Error(e+w0);if(!this._unevaluatedLayout)throw Error(`Cannot get layout property "${e}" on layer type "${this.type}" which has no layout properties.`);return this._unevaluatedLayout.getValue(e)}getLayoutAffectingGlobalStateRefs(){let e=new Set;for(let t of this._visibilityExpression.getGlobalStateRefs())e.add(t);if(this._unevaluatedLayout)for(let t in this._unevaluatedLayout._values){let i=this._unevaluatedLayout._values[t];for(let r of i.getGlobalStateRefs())e.add(r)}for(let t of this._featureFilter.getGlobalStateRefs())e.add(t);return e}getPaintAffectingGlobalStateRefs(){let e=new globalThis.Map;if(this._transitionablePaint)for(let t in this._transitionablePaint._values){let i=this._transitionablePaint._values[t].value;for(let r of i.getGlobalStateRefs()){let a=e.get(r)??[];a.push({name:t,value:i.value}),e.set(r,a)}}return e}getVisibilityAffectingGlobalStateRefs(){return this._visibilityExpression.getGlobalStateRefs()}setLayoutProperty(e,t,i={}){e==="visibility"?(this.visibility=t,this._visibilityExpression.setValue(t),this.recalculateVisibility()):this._transitionablePaint?.hasProperty(e)?this.fire(new ie(Error(e+w0))):t!=null&&this._validate(ai.layoutProperty,`layers.${this.id}.layout.${e}`,e,t,i)||this._unevaluatedLayout.setValue(e,t)}getPaintProperty(e){if(e.endsWith("-transition")){let t=e.slice(0,-11);if(t==="visibility"||this._unevaluatedLayout?.hasProperty(t))throw Error(e+xh);return this._transitionablePaint.getTransition(t)}if(e==="visibility"||this._unevaluatedLayout?.hasProperty(e))throw Error(e+xh);return this._transitionablePaint.getValue(e)}setPaintProperty(e,t,i={}){if(e==="visibility"||this._unevaluatedLayout?.hasProperty(e))return this.fire(new ie(Error(e+xh))),!1;if(t!=null&&this._validate(ai.paintProperty,`layers.${this.id}.paint.${e}`,e,t,i))return!1;if(e.endsWith("-transition"))return this._transitionablePaint.setTransition(e.slice(0,-11),t||void 0),!1;{let r=this._transitionablePaint._values[e],a=r.property.specification["property-type"]==="cross-faded-data-driven",o=r.value.isDataDriven(),n=r.value;this._transitionablePaint.setValue(e,t),this._handleSpecialPaintPropertyUpdate(e);let s=this._transitionablePaint._values[e].value;return s.isDataDriven()||o||a||this._handleOverridablePaintPropertyUpdate(e,n,s)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,t,i){return!1}isHidden(e=this.minzoom,t=!1){return this.minzoom&&e<(t?Math.floor(this.minzoom):this.minzoom)||this.maxzoom&&e>=this.maxzoom?!0:this._evaluatedVisibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}retainPriorGlobalState(e,t){this._transitionablePaint?.retainPriorGlobalState(e,t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculateVisibility(){this._evaluatedVisibility=this._visibilityExpression.evaluate()}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?.serialize(),paint:this._transitionablePaint?.serialize()};return this.visibility&&(e.layout||={},e.layout.visibility=this.visibility),xy(e,(t,i)=>t!==void 0&&!(i==="layout"&&!Object.keys(t).length)&&!(i==="paint"&&!Object.keys(t).length))}_validate(e,t,i,r,a={}){return ds(this,e,{key:t,layerType:this.type,objectKey:i,value:r},a)}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 zi&&Ao(t.property.specification)&&(t.value.kind==="source"||t.value.kind==="composite")&&t.value.isStateDependent)return!0}return!1}},dT={get paint(){return hT()}},pT=class extends tr{constructor(e,t){super(e,dT,t)}},fT={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};Hn=class extends at{_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 r=e*2;return this.int16[r+0]=t,this.int16[r+1]=i,e}};Hn.prototype.bytesPerElement=4,Z("StructArrayLayout2i4",Hn);eu=class extends at{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i){let r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){let a=e*3;return this.int16[a+0]=t,this.int16[a+1]=i,this.int16[a+2]=r,e}};eu.prototype.bytesPerElement=6,Z("StructArrayLayout3i6",eu);vd=class extends at{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r){let a=this.length;return this.resize(a+1),this.emplace(a,e,t,i,r)}emplace(e,t,i,r,a){let o=e*4;return this.int16[o+0]=t,this.int16[o+1]=i,this.int16[o+2]=r,this.int16[o+3]=a,e}};vd.prototype.bytesPerElement=8,Z("StructArrayLayout4i8",vd);xd=class extends at{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,a,o){let n=this.length;return this.resize(n+1),this.emplace(n,e,t,i,r,a,o)}emplace(e,t,i,r,a,o,n){let s=e*6;return this.int16[s+0]=t,this.int16[s+1]=i,this.int16[s+2]=r,this.int16[s+3]=a,this.int16[s+4]=o,this.int16[s+5]=n,e}};xd.prototype.bytesPerElement=12,Z("StructArrayLayout2i4i12",xd);bd=class extends at{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.int8=new Int8Array(this.arrayBuffer)}emplaceBack(e,t,i,r,a,o,n,s){let l=this.length;return this.resize(l+1),this.emplace(l,e,t,i,r,a,o,n,s)}emplace(e,t,i,r,a,o,n,s,l){let u=e*5,c=e*10;return this.int16[u+0]=t,this.int16[u+1]=i,this.uint8[c+4]=r,this.uint8[c+5]=a,this.uint8[c+6]=o,this.uint8[c+7]=n,this.int8[c+8]=s,this.int8[c+9]=l,e}};bd.prototype.bytesPerElement=10,Z("StructArrayLayout2i4ub2b10",bd);Xn=class extends at{_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 r=e*2;return this.float32[r+0]=t,this.float32[r+1]=i,e}};Xn.prototype.bytesPerElement=8,Z("StructArrayLayout2f8",Xn);wd=class extends at{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,a,o,n,s,l,u){let c=this.length;return this.resize(c+1),this.emplace(c,e,t,i,r,a,o,n,s,l,u)}emplace(e,t,i,r,a,o,n,s,l,u,c){let h=e*10;return this.uint16[h+0]=t,this.uint16[h+1]=i,this.uint16[h+2]=r,this.uint16[h+3]=a,this.uint16[h+4]=o,this.uint16[h+5]=n,this.uint16[h+6]=s,this.uint16[h+7]=l,this.uint16[h+8]=u,this.uint16[h+9]=c,e}};wd.prototype.bytesPerElement=20,Z("StructArrayLayout10ui20",wd);Td=class extends at{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,a,o,n,s){let l=this.length;return this.resize(l+1),this.emplace(l,e,t,i,r,a,o,n,s)}emplace(e,t,i,r,a,o,n,s,l){let u=e*8;return this.uint16[u+0]=t,this.uint16[u+1]=i,this.uint16[u+2]=r,this.uint16[u+3]=a,this.uint16[u+4]=o,this.uint16[u+5]=n,this.uint16[u+6]=s,this.uint16[u+7]=l,e}};Td.prototype.bytesPerElement=16,Z("StructArrayLayout8ui16",Td);Ed=class extends at{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r,a,o,n,s,l,u,c,h,d){let p=this.length;return this.resize(p+1),this.emplace(p,e,t,i,r,a,o,n,s,l,u,c,h,d)}emplace(e,t,i,r,a,o,n,s,l,u,c,h,d,p){let f=e*14,m=e*7;return this.int16[f+0]=t,this.int16[f+1]=i,this.int16[f+2]=r,this.int16[f+3]=a,this.uint16[f+4]=o,this.uint16[f+5]=n,this.uint16[f+6]=s,this.uint16[f+7]=l,this.int16[f+8]=u,this.int16[f+9]=c,this.int16[f+10]=h,this.int16[f+11]=d,this.float32[m+6]=p,e}};Ed.prototype.bytesPerElement=28,Z("StructArrayLayout4i4ui4i1f28",Ed);Sd=class extends at{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i){let r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){let a=e*3;return this.float32[a+0]=t,this.float32[a+1]=i,this.float32[a+2]=r,e}};Sd.prototype.bytesPerElement=12,Z("StructArrayLayout3f12",Sd);Cd=class extends at{_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}};Cd.prototype.bytesPerElement=4,Z("StructArrayLayout1ul4",Cd);Dd=class extends at{_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,r,a,o,n,s,l){let u=this.length;return this.resize(u+1),this.emplace(u,e,t,i,r,a,o,n,s,l)}emplace(e,t,i,r,a,o,n,s,l,u){let c=e*10,h=e*5;return this.int16[c+0]=t,this.int16[c+1]=i,this.int16[c+2]=r,this.int16[c+3]=a,this.int16[c+4]=o,this.int16[c+5]=n,this.uint32[h+3]=s,this.uint16[c+8]=l,this.uint16[c+9]=u,e}};Dd.prototype.bytesPerElement=20,Z("StructArrayLayout6i1ul2ui20",Dd);Ad=class extends at{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,a,o){let n=this.length;return this.resize(n+1),this.emplace(n,e,t,i,r,a,o)}emplace(e,t,i,r,a,o,n){let s=e*6;return this.int16[s+0]=t,this.int16[s+1]=i,this.int16[s+2]=r,this.int16[s+3]=a,this.int16[s+4]=o,this.int16[s+5]=n,e}};Ad.prototype.bytesPerElement=12,Z("StructArrayLayout2i2i2i12",Ad);Md=class extends at{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,a){let o=this.length;return this.resize(o+1),this.emplace(o,e,t,i,r,a)}emplace(e,t,i,r,a,o){let n=e*4,s=e*8;return this.float32[n+0]=t,this.float32[n+1]=i,this.float32[n+2]=r,this.int16[s+6]=a,this.int16[s+7]=o,e}};Md.prototype.bytesPerElement=16,Z("StructArrayLayout2f1f2i16",Md);Pd=class extends at{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,i,r,a,o){let n=this.length;return this.resize(n+1),this.emplace(n,e,t,i,r,a,o)}emplace(e,t,i,r,a,o,n){let s=e*16,l=e*4,u=e*8;return this.uint8[s+0]=t,this.uint8[s+1]=i,this.float32[l+1]=r,this.float32[l+2]=a,this.int16[u+6]=o,this.int16[u+7]=n,e}};Pd.prototype.bytesPerElement=16,Z("StructArrayLayout2ub2f2i16",Pd);tu=class extends at{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i){let r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){let a=e*3;return this.uint16[a+0]=t,this.uint16[a+1]=i,this.uint16[a+2]=r,e}};tu.prototype.bytesPerElement=6,Z("StructArrayLayout3ui6",tu);Id=class extends at{_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,r,a,o,n,s,l,u,c,h,d,p,f,m,g,_){let y=this.length;return this.resize(y+1),this.emplace(y,e,t,i,r,a,o,n,s,l,u,c,h,d,p,f,m,g,_)}emplace(e,t,i,r,a,o,n,s,l,u,c,h,d,p,f,m,g,_,y){let v=e*26,x=e*13,b=e*52;return this.int16[v+0]=t,this.int16[v+1]=i,this.uint16[v+2]=r,this.uint16[v+3]=a,this.uint32[x+2]=o,this.uint32[x+3]=n,this.uint32[x+4]=s,this.uint16[v+10]=l,this.uint16[v+11]=u,this.uint16[v+12]=c,this.float32[x+7]=h,this.float32[x+8]=d,this.uint8[b+36]=p,this.uint8[b+37]=f,this.uint8[b+38]=m,this.uint32[x+10]=g,this.int16[v+22]=_,this.float32[x+12]=y,e}};Id.prototype.bytesPerElement=52,Z("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i1f52",Id);kd=class extends at{_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,r,a,o,n,s,l,u,c,h,d,p,f,m,g,_,y,v,x,b,w,T,E,S,A,I,R){let k=this.length;return this.resize(k+1),this.emplace(k,e,t,i,r,a,o,n,s,l,u,c,h,d,p,f,m,g,_,y,v,x,b,w,T,E,S,A,I,R)}emplace(e,t,i,r,a,o,n,s,l,u,c,h,d,p,f,m,g,_,y,v,x,b,w,T,E,S,A,I,R,k){let M=e*34,C=e*17;return this.int16[M+0]=t,this.int16[M+1]=i,this.int16[M+2]=r,this.int16[M+3]=a,this.int16[M+4]=o,this.int16[M+5]=n,this.int16[M+6]=s,this.int16[M+7]=l,this.uint16[M+8]=u,this.uint16[M+9]=c,this.uint16[M+10]=h,this.uint16[M+11]=d,this.uint16[M+12]=p,this.uint16[M+13]=f,this.uint16[M+14]=m,this.uint16[M+15]=g,this.uint16[M+16]=_,this.uint16[M+17]=y,this.uint16[M+18]=v,this.uint16[M+19]=x,this.uint16[M+20]=b,this.uint16[M+21]=w,this.uint16[M+22]=T,this.uint32[C+12]=E,this.float32[C+13]=S,this.float32[C+14]=A,this.uint16[M+30]=I,this.uint16[M+31]=R,this.float32[C+16]=k,e}};kd.prototype.bytesPerElement=68,Z("StructArrayLayout8i15ui1ul2f2ui1f68",kd);iu=class extends at{_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}};iu.prototype.bytesPerElement=4,Z("StructArrayLayout1f4",iu);Fd=class extends at{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i){let r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){let a=e*6,o=e*3;return this.uint16[a+0]=t,this.float32[o+1]=i,this.float32[o+2]=r,e}};Fd.prototype.bytesPerElement=12,Z("StructArrayLayout1ui2f12",Fd);Rd=class extends at{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,i){let r=this.length;return this.resize(r+1),this.emplace(r,e,t,i)}emplace(e,t,i,r){let a=e*2,o=e*4;return this.uint32[a+0]=t,this.uint16[o+2]=i,this.uint16[o+3]=r,e}};Rd.prototype.bytesPerElement=8,Z("StructArrayLayout1ul2ui8",Rd);zd=class extends at{_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 r=e*2;return this.uint16[r+0]=t,this.uint16[r+1]=i,e}};zd.prototype.bytesPerElement=4,Z("StructArrayLayout2ui4",zd);Ld=class extends at{_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}};Ld.prototype.bytesPerElement=2,Z("StructArrayLayout1ui2",Ld);Bd=class extends at{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,i,r){let a=this.length;return this.resize(a+1),this.emplace(a,e,t,i,r)}emplace(e,t,i,r,a){let o=e*4;return this.float32[o+0]=t,this.float32[o+1]=i,this.float32[o+2]=r,this.float32[o+3]=a,e}};Bd.prototype.bytesPerElement=16,Z("StructArrayLayout4f16",Bd);jv=class extends ps{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 D(this.anchorPointX,this.anchorPointY)}};jv.prototype.size=20;Nv=class extends Dd{get(e){return new jv(this,e)}};Z("CollisionBoxArray",Nv);Vv=class extends ps{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]}get heightOffset(){return this._structArray.float32[this._pos4+12]}};Vv.prototype.size=52;$v=class extends Id{get(e){return new Vv(this,e)}};Z("PlacedSymbolArray",$v);Uv=class extends ps{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]}get heightOffset(){return this._structArray.float32[this._pos4+16]}};Uv.prototype.size=68;qv=class extends kd{get(e){return new Uv(this,e)}};Z("SymbolInstanceArray",qv);Gv=class extends iu{getoffsetX(e){return this.float32[e*1+0]}};Z("GlyphOffsetArray",Gv);Wv=class extends eu{getx(e){return this.int16[e*3+0]}gety(e){return this.int16[e*3+1]}gettileUnitDistanceFromAnchor(e){return this.int16[e*3+2]}};Z("SymbolLineVertexArray",Wv);Zv=class extends ps{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]}};Zv.prototype.size=12;Hv=class extends Fd{get(e){return new Zv(this,e)}};Z("TextAnchorOffsetArray",Hv);Xv=class extends ps{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]}};Xv.prototype.size=8;Yv=class extends Rd{get(e){return new Xv(this,e)}};Z("FeatureIndexArray",Yv);ba=class extends Hn{},gT=class extends eu{},_T=class extends vd{},yT=class extends Hn{},vT=class extends Hn{},xT=class extends xd{},bT=class extends bd{},wT=class extends Xn{},to=class extends wd{},E0=class extends Td{},TT=class extends Ed{},ET=class extends Sd{},ST=class extends Cd{},S0=class extends Ad{},CT=class extends Md{},DT=class extends Pd{},AT=class extends tu{},xr=class extends tu{},Od=class extends zd{},MT=class extends Ld{},jd=rt([{name:"a_pos",components:2,type:"Int16"}],4),PT=jd.members;jd.size,jd.alignment;tt.MAX_VERTEX_ARRAY_LENGTH=65535,Z("SegmentVector",tt);IT=rt([{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"}]),kT=rt([{name:"a_dasharray_from",components:4,type:"Uint16"},{name:"a_dasharray_to",components:4,type:"Uint16"}]),FT=Ip((e,t)=>{function i(r,a){for(var o=r.length&3,n=r.length-o,s=a,l,u=3432918353,c=461845907,h,d=0;d<n;)h=r.charCodeAt(d)&255|(r.charCodeAt(++d)&255)<<8|(r.charCodeAt(++d)&255)<<16|(r.charCodeAt(++d)&255)<<24,++d,h=(h&65535)*u+(((h>>>16)*u&65535)<<16)|0,h=h<<15|h>>>17,h=(h&65535)*c+(((h>>>16)*c&65535)<<16)|0,s^=h,s=s<<13|s>>>19,l=(s&65535)*5+(((s>>>16)*5&65535)<<16)|0,s=(l&65535)+27492+(((l>>>16)+58964&65535)<<16);switch(h=0,o){case 3:h^=(r.charCodeAt(d+2)&255)<<16;case 2:h^=(r.charCodeAt(d+1)&255)<<8;case 1:h^=r.charCodeAt(d)&255,h=(h&65535)*u+(((h>>>16)*u&65535)<<16)|0,h=h<<15|h>>>17,h=(h&65535)*c+(((h>>>16)*c&65535)<<16)|0,s^=h}return s^=r.length,s^=s>>>16,s=(s&65535)*2246822507+(((s>>>16)*2246822507&65535)<<16)|0,s^=s>>>13,s=(s&65535)*3266489909+(((s>>>16)*3266489909&65535)<<16)|0,s^=s>>>16,s>>>0}t!==void 0&&(t.exports=i)}),RT=Ip((e,t)=>{function i(r,a){for(var o=r.length,n=a^o,s=0,l;o>=4;)l=r.charCodeAt(s)&255|(r.charCodeAt(++s)&255)<<8|(r.charCodeAt(++s)&255)<<16|(r.charCodeAt(++s)&255)<<24,l=(l&65535)*1540483477+(((l>>>16)*1540483477&65535)<<16),l^=l>>>24,l=(l&65535)*1540483477+(((l>>>16)*1540483477&65535)<<16),n=(n&65535)*1540483477+(((n>>>16)*1540483477&65535)<<16)^l,o-=4,++s;switch(o){case 3:n^=(r.charCodeAt(s+2)&255)<<16;case 2:n^=(r.charCodeAt(s+1)&255)<<8;case 1:n^=r.charCodeAt(s)&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}t.exports=i}),ru=f5(Ip((e,t)=>{var i=FT(),r=RT();t.exports=i,t.exports.murmur3=i,t.exports.murmur2=r})(),1);Z("FeaturePositionMap",Kv);te=class extends Vr{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1i(this.location,e))}},G=class extends Vr{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}},pe=class extends Vr{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]))}},Kt=class extends Vr{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]))}},Io=class extends Vr{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]))}},na=class extends Vr{constructor(e,t){super(e,t),this.current=se.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))}},A0=class extends Vr{constructor(e,t){super(e,t),this.current=[]}set(e){if(e!=this.current){this.current=e;let t=new Float32Array(e.length*4);for(let i=0;i<e.length;i++)t[4*i]=e[i].r,t[4*i+1]=e[i].g,t[4*i+2]=e[i].b,t[4*i+3]=e[i].a;this.gl.uniform4fv(this.location,t)}}},M0=class extends Vr{constructor(e,t){super(e,t),this.current=[]}set(e){if(e!=this.current){this.current=e;let t=new Float32Array(e);this.gl.uniform1fv(this.location,t)}}},zT=new Float32Array(16),Ji=class extends Vr{constructor(e,t){super(e,t),this.current=zT}set(e){if(e[12]!==this.current[12]||e[0]!==this.current[0])this.current=e,this.gl.uniformMatrix4fv(this.location,!1,e);else for(let t=1;t<16;t++)if(e[t]!==this.current[t]){this.current=e,this.gl.uniformMatrix4fv(this.location,!1,e);break}}};Jv=class extends Xr{getPositions(e){return e.imagePositions}getPositionIds(e){return e.patterns?.[this.layerId]}getVertexAttributes(){return IT.members}emplace(e,t,i,r){e.emplace(t,i.tlbr[0],i.tlbr[1],i.tlbr[2],i.tlbr[3],r.tlbr[0],r.tlbr[1],r.tlbr[2],r.tlbr[3],i.pixelRatio,r.pixelRatio)}},Qv=class extends Xr{getPositions(e){return e.dashPositions}getPositionIds(e){return e.dashes?.[this.layerId]}getVertexAttributes(){return kT.members}emplace(e,t,i,r){e.emplace(t,0,i.y,i.height,i.width,0,r.y,r.height,r.width)}};Z("ConstantBinder",yn),Z("CrossFadedConstantBinder",va),Z("SourceExpressionBinder",Mr),Z("CrossFadedPatternBinder",Jv),Z("CrossFadedDasharrayBinder",Qv),Z("CompositeExpressionBinder",Ui),Z("ProgramConfiguration",e2,{omit:["_buffers"]}),Z("ProgramConfigurationSet",Ia);I0=-$d-1;OT=Yi.fromPoints([new D(0,0),new D(z,z)]);Z("CircleBucket",cf,{omit:["layers"]});qd={origin:[-Math.PI*bh,Math.PI*bh],extentAtZoom0:2*Math.PI*bh},df=2*Math.PI*Yt;ja=new class{constructor(){this.name="mercator",this.wraps=!0,this.tileMatrixSet=qd}worldFromLngLat(e,t,i){return new Ot(ou(e),nu(t),i===void 0?0:Gd(i,t))}lngLatFromWorld(e,t){return new Y(o2(e),Yn(t))}hasLngLat(e,t){return!0}metersPerWorldUnit(e,t){return 1/(1/df*n2(Yn(t)))}worldZFromAltitude(e,t){return Gd(e,t.lat)}};Z("CanonicalTileID",Xu),Z("OverscaledTileID",Et,{omit:["terrainRttPosMatrix32f"]});B0=z*0.999999999999,j0={covered:!1,demLoaded:!1,elevation:0};N0=new WeakMap;S2=new mE,C2=new DE,ME=new AE(S2,C2);VE={get paint(){return NE()},get layout(){return OE()}},UE=class extends tr{constructor(e,t){super(e,VE,t)}createBucket(e){return new cf(e)}queryRadius(e){let t=e;return yo("circle-radius",this,t)+yo("circle-stroke-width",this,t)+Ku(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:i,geometry:r,projectedCamera:a,pixelsToTileUnits:o,unwrappedTileID:n,getElevation:s}){let l=Ju(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-a.bearingInRadians,o),u=this.paint.get("circle-radius").evaluate(t,i)+this.paint.get("circle-stroke-width").evaluate(t,i),c=this.paint.get("circle-pitch-scale"),h=this.paint.get("circle-pitch-alignment"),d,p;return h==="map"?(d=l,p=u*o):(d=LE(l,a,n,s),p=u),D2({queryGeometry:d,size:p,projectedCamera:a,unwrappedTileID:n,getElevation:s,pitchAlignment:h,pitchScale:c},r)}},A2=class extends cf{};Z("HeatmapBucket",A2,{omit:["layers"]});WE={get paint(){return GE()}};Z("AlphaImage",bf),Z("RGBAImage",$e);HE=class extends tr{createBucket(e){return new A2(e)}constructor(e,t){super(e,WE,t),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){e==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){let e=this._transitionablePaint._values["heatmap-color"].value.expression;this.colorRamp=P2({expression:e,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has("big-fb")&&this.heatmapFbos.delete(cu)}queryRadius(e){return yo("heatmap-radius",this,e)}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:i,geometry:r,projectedCamera:a,pixelsToTileUnits:o,unwrappedTileID:n,getElevation:s}){return D2({queryGeometry:e,size:this.paint.get("heatmap-radius").evaluate(t,i)*o,projectedCamera:a,unwrappedTileID:n,getElevation:s},r)}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&!this.isHidden()}},KE={get paint(){return YE()}},QE=class extends tr{constructor(e,t){super(e,KE,t),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let e=this.paint.get("hillshade-illumination-direction").values,t=this.paint.get("hillshade-illumination-altitude").values,i=this.paint.get("hillshade-highlight-color").values,r=this.paint.get("hillshade-shadow-color").values,a=Math.max(e.length,t.length,i.length,r.length);e=e.concat(Array(a-e.length).fill(e.at(-1))),t=t.concat(Array(a-t.length).fill(t.at(-1))),i=i.concat(Array(a-i.length).fill(i.at(-1))),r=r.concat(Array(a-r.length).fill(r.at(-1)));let o=t.map(We);return{directionRadians:e.map(We),altitudeRadians:o,shadowColor:r,highlightColor:i}}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&!this.isHidden()}},iS={get paint(){return tS()}};rS=class e{static{this.byteViewCache=new WeakMap}constructor(t,i,r,a=1,o=1,n=1,s=0){if(this.uid=t,i.height!==i.width)throw RangeError("DEM tiles must be square");if(r&&!["mapbox","terrarium","custom"].includes(r)){he(`"${r}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);return}this.stride=i.height;let l=this.dim=i.height-4;switch(this.data=new Uint32Array(i.data.buffer),e.byteViewCache.set(this,new Uint8Array(this.data.buffer)),r){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=0.00390625,this.baseShift=32768;break;case"custom":this.redFactor=a,this.greenFactor=o,this.blueFactor=n,this.baseShift=s;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=0.1,this.baseShift=1e4}for(let c=-2;c<l+2;c++){let h=this._idx(0,Math.max(0,Math.min(l-1,c)));(c<0||c>=l)&&this.data.copyWithin(this._idx(0,c),h,h+l),this.data.fill(this.data[h],this._idx(-2,c),this._idx(0,c)),this.data.fill(this.data[h+l-1],this._idx(l,c),this._idx(l+1,c)+1)}let u=this._getByteView();this.min=9007199254740991,this.max=-9007199254740991;for(let c=0;c<l;c++)for(let h=0;h<l;h++){let d=this._idx(c,h)*4,p=this._unpackAtIndex(u,d);p>this.max&&(this.max=p),p<this.min&&(this.min=p)}}get(t,i){let r=this._getByteView(),a=this._idx(t,i)*4;return this._unpackAtIndex(r,a)}sampleBilinear(t,i){let r=Math.floor(t),a=Math.floor(i);if(r<-1||r>=this.dim||a<-1||a>=this.dim)throw RangeError(`Out of range source coordinates for DEM data. x: ${t}, y: ${i}, dim: ${this.dim}`);let o=this._getByteView(),n=((a+2)*this.stride+r+2)*4,s=this.stride*4,l=t-r,u=i-a,c=this._unpackAtIndex(o,n),h=this._unpackAtIndex(o,n+4),d=this._unpackAtIndex(o,n+s),p=this._unpackAtIndex(o,n+s+4);return c*(1-l)*(1-u)+h*l*(1-u)+d*(1-l)*u+p*l*u}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(t,i){if(t<-2||t>=this.dim+2||i<-2||i>=this.dim+2)throw RangeError(`Out of range source coordinates for DEM data. x: ${t}, y: ${i}, dim: ${this.dim}`);return(i+2)*this.stride+(t+2)}unpack(t,i,r){return t*this.redFactor+i*this.greenFactor+r*this.blueFactor-this.baseShift}pack(t){return I2(t,this.getUnpackVector())}getPixels(){return new $e({width:this.stride,height:this.stride},this._getByteView())}backfillBorder(t,i,r){if(this.dim!==t.dim)throw Error("dem dimension mismatch");let a=i*this.dim,o=i*this.dim+this.dim,n=r*this.dim,s=r*this.dim+this.dim;switch(i){case-1:a=o-2;break;case 1:o=a+2}switch(r){case-1:n=s-2;break;case 1:s=n+2}let l=-i*this.dim,u=-r*this.dim;for(let c=n;c<s;c++)for(let h=a;h<o;h++)this.data[this._idx(h,c)]=t.data[this._idx(h+l,c+u)]}_getByteView(){let t=e.byteViewCache.get(this);return t?.buffer!==this.data.buffer&&(t=new Uint8Array(this.data.buffer),e.byteViewCache.set(this,t)),t}_unpackAtIndex(t,i){return this.unpack(t[i],t[i+1],t[i+2])}};Z("DEMData",rS);oS=class extends tr{constructor(e,t){super(e,iS,t)}_createColorRamp(e){let t={elevationStops:[],colorStops:[]},i=this._transitionablePaint._values["color-relief-color"].value.expression;if(i instanceof $n&&i._styleExpression.expression instanceof ni){this.colorRampExpression=i;let o=i._styleExpression.expression;t.elevationStops=o.labels,t.colorStops=[];for(let n of t.elevationStops)t.colorStops.push(o.evaluate({globals:{elevation:n}}))}if(t.elevationStops.length<1&&(t.elevationStops=[0],t.colorStops=[se.transparent]),t.elevationStops.length<2&&(t.elevationStops.push(t.elevationStops[0]+1),t.colorStops.push(t.colorStops[0])),t.elevationStops.length<=e)return t;let r={elevationStops:[],colorStops:[]},a=(t.elevationStops.length-1)/(e-1);for(let o=0;o<t.elevationStops.length-0.5;o+=a)r.elevationStops.push(t.elevationStops[Math.round(o)]),r.colorStops.push(t.colorStops[Math.round(o)]);return he(`Too many colors in specification of ${this.id} color-relief layer, may not render properly. Max possible colors: ${e}, provided: ${t.elevationStops.length}`),r}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values["color-relief-color"].value.expression}getColorRampTextures(e,t,i){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;let r=this._createColorRamp(t),a=new $e({width:r.colorStops.length,height:1}),o=new $e({width:r.colorStops.length,height:1});for(let n=0;n<r.elevationStops.length;n++){let s=I2(r.elevationStops[n],i);o.setPixel(0,n,new se(s.r/255,s.g/255,s.b/255,1)),a.setPixel(0,n,r.colorStops[n])}return this.colorRampTextures={elevationTexture:new yt(e,o,e.gl.RGBA),colorTexture:new yt(e,a,e.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return!this.isHidden()&&!!this.colorRampTextures}},Xd=rt([{name:"a_pos",components:2,type:"Int16"}],4),nS=Xd.members;Xd.size,Xd.alignment;Jn=new Set;st=new Float64Array,Qd=[],ep=[];yi=[],no=[],ma=new Uint32Array,cn=new Uint32Array,hn=new Uint32Array(256);Tf=class e{constructor(t){this.fill=t.fill,this.line=t.line,this.tile=t.tile,this.stencil=t.stencil,this.circle=t.circle}static{this.noSubdivision=new e({fill:new Fr(0,0),line:new Fr(0,0),tile:new Fr(0,0),stencil:new Fr(0,0),circle:1})}};Z("SubdivisionGranularityExpression",Fr),Z("SubdivisionGranularitySetting",Tf);Z("FillBucket",j2,{omit:["layers","patternFeatures"]});BS={get paint(){return LS()},get layout(){return RS()}},OS=class extends tr{constructor(e,t){super(e,BS,t)}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 j2(e)}queryRadius(){return Ku(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:e,geometry:t,projectedCamera:i,pixelsToTileUnits:r}){return i2(Ju(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-i.bearingInRadians,r),t)}isTileClipped(){return!0}},rp=rt([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),jS=rt([{name:"a_centroid",components:2,type:"Int16"}],4),NS=rp.members;rp.size,rp.alignment;fs.types=["Unknown","Point","LineString","Polygon"];ZS=Math.cos(35*Math.PI/180);Z("FillExtrusionBucket",$2,{omit:["layers","features"]});rC={get paint(){return iC()},get layout(){return eC()}},oC=class extends tr{constructor(e,t){super(e,rC,t)}createBucket(e){return new $2(e)}queryRadius(){return Ku(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:i,geometry:r,projectedCamera:a,pixelsToTileUnits:o,unwrappedTileID:n}){let s=Ju(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-a.bearingInRadians,o),l=this.paint.get("fill-extrusion-height").evaluate(t,i),u=this.paint.get("fill-extrusion-base").evaluate(t,i),c=s.map((h)=>Mh(h,0,a,n));return nC(r.map((h)=>h.map((d)=>Mh(d,u,a,n))),r.map((h)=>h.map((d)=>Mh(d,l,a,n))),c)}};new sC,new lC;ap=rt([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_offset_normal",components:2,type:"Int8"}],2),uC=ap.members;ap.size,ap.alignment;op=rt([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),cC=op.members;op.size,op.alignment;hC=Math.cos(37.5*(Math.PI/180)),r1=16384/U2;Z("LineBucket",q2,{omit:["layers","patternFeatures"]});a1={get paint(){return mC()},get layout(){return pC()}},gC=class extends ae{possiblyEvaluate(e,t){return t=new Me(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,zoomHistory:t.zoomHistory,transition:t.transition}),super.possiblyEvaluate(e,t)}evaluate(e,t,i,r){return t=ee({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(e,t,i,r)}},_C=class extends tr{constructor(e,t){super(e,a1,t),this.gradientVersion=0,ul||(ul=new gC(a1.paint.properties["line-width"].specification,"line-floorwidth"),ul.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){let t=this.gradientExpression();this.stepInterpolant=c6(t)?t._styleExpression.expression instanceof qp:!1,this.gradientVersion=(this.gradientVersion+1)%9007199254740991}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,t){super.recalculate(e,t),this.paint._values["line-floorwidth"]=ul.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new q2(e)}queryRadius(e){let t=e,i=o1(yo("line-width",this,t),yo("line-gap-width",this,t)),r=yo("line-offset",this,t);return i/2+Math.abs(r)+Ku(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:i,geometry:r,projectedCamera:a,pixelsToTileUnits:o}){let n=Ju(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-a.bearingInRadians,o),s=o/2*o1(this.paint.get("line-width").evaluate(t,i),this.paint.get("line-gap-width").evaluate(t,i)),l=this.paint.get("line-offset").evaluate(t,i);return l&&(r=IE(r,l*o)),NT(n,r,s)}isTileClipped(){return!0}};yC=rt([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"},{name:"a_height_offset",components:1,type:"Float32"}],4),vC=rt([{name:"a_projected_pos",components:3,type:"Float32"}],4);rt([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);xC=rt([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);rt([{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"}]);n1=rt([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),bC=rt([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);rt([{name:"triangle",components:3,type:"Uint16"}]),rt([{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"},{type:"Float32",name:"heightOffset"}]);wC=rt([{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"},{type:"Float32",name:"heightOffset"}]);rt([{type:"Float32",name:"offsetX"}]),rt([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),rt([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);fu=new class{constructor(){this.TIMEOUT=5000,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(e){this.pluginStatus=e.pluginStatus,this.pluginURL=e.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(e){if(fu.isParsed())throw Error("RTL text plugin already registered.");this.applyArabicShaping=e.applyArabicShaping,this.processBidirectionalText=e.processBidirectionalText,this.processStyledBidirectionalText=e.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}async syncState(e,t){if(this.isParsed())return this.getState();if(e.pluginStatus!=="loading")return this.setState(e),e;let i=e.pluginURL,r=new Promise((o)=>{this.loadScriptResolve=o}),a=new Promise((o)=>setTimeout(()=>o(),this.TIMEOUT));if(await t(i),await Promise.race([r,a]),this.isParsed()){let o={pluginStatus:"loaded",pluginURL:i};return this.setState(o),o}throw this.setState({pluginStatus:"error",pluginURL:""}),Error(`RTL Text Plugin failed to import scripts from ${i}`)}};IC={C:"18g,1;g2,3;4nb,1",D:"17k,1;5,1;1,1;1,5;4,d;1,7;1,2;z,2;8,g;i,12;1,2;9,1;1,1;1,2;14,3;2,1;28,9;3,f;2,4;1,1;2,3;2,6;7a,1;2,5;1,1;g,a;5,2;2,6;1,f",R:"17m,4;1,1;1,1;5,4;l,1;14,3;1,3;g,i;12,1;2,9;1,1;1,1;2,2;1,1;o,2;2x,3;f,2;4,1;1,2;3,2;6u,j;b,1;r,3;1,1;2,2;6,1",T:"174,b;1,1;1a,l;g,1;2t,7;2,6;2,2;1,4;bt,9;16,o;1,t;1clb,1"},kC={1569:[65152,0,0,0],1570:[65153,65154,0,0],1571:[65155,65156,0,0],1572:[65157,65158,0,0],1573:[65159,65160,0,0],1574:[65161,65162,65163,65164],1575:[65165,65166,0,0],1576:[65167,65168,65169,65170],1577:[65171,65172,0,0],1578:[65173,65174,65175,65176],1579:[65177,65178,65179,65180],1580:[65181,65182,65183,65184],1581:[65185,65186,65187,65188],1582:[65189,65190,65191,65192],1583:[65193,65194,0,0],1584:[65195,65196,0,0],1585:[65197,65198,0,0],1586:[65199,65200,0,0],1587:[65201,65202,65203,65204],1588:[65205,65206,65207,65208],1589:[65209,65210,65211,65212],1590:[65213,65214,65215,65216],1591:[65217,65218,65219,65220],1592:[65221,65222,65223,65224],1593:[65225,65226,65227,65228],1594:[65229,65230,65231,65232],1601:[65233,65234,65235,65236],1602:[65237,65238,65239,65240],1603:[65241,65242,65243,65244],1604:[65245,65246,65247,65248],1605:[65249,65250,65251,65252],1606:[65253,65254,65255,65256],1607:[65257,65258,65259,65260],1608:[65261,65262,0,0],1609:[65263,65264,64488,64489],1610:[65265,65266,65267,65268],1611:[65136,0,0,65137],1612:[65138,0,0,0],1613:[65140,0,0,0],1614:[65142,0,0,65143],1615:[65144,0,0,65145],1616:[65146,0,0,65147],1617:[65148,0,0,65149],1618:[65150,0,0,65151],1649:[64336,64337,0,0],1655:[64477,0,0,0],1657:[64358,64359,64360,64361],1658:[64350,64351,64352,64353],1659:[64338,64339,64340,64341],1662:[64342,64343,64344,64345],1663:[64354,64355,64356,64357],1664:[64346,64347,64348,64349],1667:[64374,64375,64376,64377],1668:[64370,64371,64372,64373],1670:[64378,64379,64380,64381],1671:[64382,64383,64384,64385],1672:[64392,64393,0,0],1676:[64388,64389,0,0],1677:[64386,64387,0,0],1678:[64390,64391,0,0],1681:[64396,64397,0,0],1688:[64394,64395,0,0],1700:[64362,64363,64364,64365],1702:[64366,64367,64368,64369],1705:[64398,64399,64400,64401],1709:[64467,64468,64469,64470],1711:[64402,64403,64404,64405],1713:[64410,64411,64412,64413],1715:[64406,64407,64408,64409],1722:[64414,64415,0,0],1723:[64416,64417,64418,64419],1726:[64426,64427,64428,64429],1728:[64420,64421,0,0],1729:[64422,64423,64424,64425],1733:[64480,64481,0,0],1734:[64473,64474,0,0],1735:[64471,64472,0,0],1736:[64475,64476,0,0],1737:[64482,64483,0,0],1739:[64478,64479,0,0],1740:[64508,64509,64510,64511],1744:[64484,64485,64486,64487],1746:[64430,64431,0,0],1747:[64432,64433,0,0]},FC={لآ:[65269,65270],لأ:[65271,65272],لإ:[65273,65274],لا:[65275,65276]},RC=/[\u0600-\u06ff\u0750-\u077f\u0870-\u089f\u08a0-\u08ff\ufb50-\ufdff\ufe70-\ufeff]/;W2=new Map;for(let[e,t]of Object.entries(IC))zC(t,e,W2);Z2=typeof Intl<"u"&&"Segmenter"in Intl;co={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","⋯":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};QC={10:!0,13:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},eD={40:!0};Sf=iD(),rD=/[\u061c\u200e\u200f\u202a-\u202e\u2066-\u2069]/,aD=new Set(["WS","FSI","LRI","RLI","PDI"]),oD=new Set(["S","B"]);y1=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");Z("ImagePosition",Cf),Z("ImageAtlas",TD);ix=function(e){return e[e.none=0]="none",e[e.horizontal=1]="horizontal",e[e.vertical=2]="vertical",e[e.horizontalOnly=3]="horizontalOnly",e}(ix||{});v1=/^\p{gc=M}$/u;vo=class e extends D{constructor(t,i,r,a){super(t,i),this.angle=r,a!==void 0&&(this.segment=a)}clone(){return new e(this.x,this.y,this.angle,this.segment)}};Z("Anchor",vo);up=function(e){return e[e.center=1]="center",e[e.left=2]="left",e[e.right=3]="right",e[e.top=4]="top",e[e.bottom=5]="bottom",e[e["top-left"]=6]="top-left",e[e["top-right"]=7]="top-right",e[e["bottom-left"]=8]="bottom-left",e[e["bottom-right"]=9]="bottom-right",e}({});rA=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];Z("SymbolBuffers",hp);Z("CollisionBuffers",dp);Z("SymbolBucket",yu,{omit:["layers","collisionBoxArray","features","compareText"]});Ih={get paint(){return hA()},get layout(){return uA()}};Z("FormatSectionOverride",xx,{omit:["defaultValue"]});dA=class e extends tr{constructor(t,i){super(t,Ih,i)}recalculate(t,i){super.recalculate(t,i);let r=this.layout.get("icon-rotation-alignment");if((r.value.kind!=="constant"||r.value.value==="auto")&&(this.layout._values["icon-rotation-alignment"]=new zi(r.property,{kind:"constant",value:this.layout.get("symbol-placement")==="point"?"viewport":"map"},r.parameters)),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout.get("symbol-placement")==="point"?this.layout._values["text-rotation-alignment"]="viewport":this.layout._values["text-rotation-alignment"]="map"),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").constantOr("viewport")),this.layout.get("symbol-placement")==="point"){let a=this.layout.get("text-writing-mode");if(a){let o=[];for(let n of a)o.includes(n)||o.push(n);this.layout._values["text-writing-mode"]=o}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,i,r,a){let o=this.layout.get(t).evaluate(i,{},r,a),n=this._unevaluatedLayout._values[t];return!n.isDataDriven()&&!$u(n.value)&&o?sA(i.properties,o):o}createBucket(t){return new yu(t)}queryRadius(){return 0}queryIntersectsFeature(){throw Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let t of Ih.paint.overridableProperties){if(!e.hasPaintOverride(this.layout,t))continue;let i=this.paint.get(t),r=new tf(new xx(i),`layers[${this.id}].paint.${i.property.name}`,i.property.specification),a=null;a=i.value.kind==="constant"||i.value.kind==="source"?new $n("source",r):new Kl("composite",r,i.value.zoomStops),this.paint._values[t]=new zi(i.property,a,i.parameters)}}_handleOverridablePaintPropertyUpdate(t,i,r){return!this.layout||i.isDataDriven()||r.isDataDriven()?!1:e.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,i){let r=t.get("text-field"),a=Ih.paint.properties[i],o=!1,n=(s)=>{for(let l of s)if(a.overrides?.hasOverride(l)){o=!0;return}};if(r.value.kind==="constant"&&r.value.value instanceof Or)n(r.value.value.sections);else if(r.value.kind==="source"||r.value.kind==="composite"){let s=(u)=>{if(!o)if(u instanceof Do&&ut(u.value)===ss){let c=u.value;n(c.sections)}else u instanceof Yy?n(u.sections):u.eachChild(s)},l=r.value;l._styleExpression&&s(l._styleExpression.expression)}return o}};gA={get paint(){return mA()}},yA=class extends tr{constructor(e,t){super(e,gA,t)}};xA=class extends tr{constructor(e,t){super(e,{},t),this.onAdd=(i)=>{this.implementation.onAdd&&this.implementation.onAdd(i,i.painter.context.gl)},this.onRemove=(i)=>{this.implementation.onRemove&&this.implementation.onRemove(i,i.painter.context.gl)},this.implementation=e}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw Error("Custom layers cannot be serialized")}};TA=class extends qe{constructor(){super(),this.images={},this.updateVersion=0,this.loaded=!1,this.requestors=[],this.missingImageResolver=null,this._spriteImagesIds={},this._imagesIds=null,this._renderCallbacksDispatchedThisFrame={}}destroy(){for(let e of Object.keys(this.images))this.removeImage(e);this._spriteImagesIds={}}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 $e({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 Error(`Image id ${e} already exist, use updateImage instead`);this._validate(e,t)&&(this.images[e]=t,this._imagesIds=null,t.isWebGLImage&&this.updateImage(e,t,!1))}_validate(e,t){let i=!0,r=t.data||t.spriteData;return this._validateStretch(t.stretchX,r?.width)||(this.fire(new ie(Error(`Image "${e}" has invalid "stretchX" value`))),i=!1),this._validateStretch(t.stretchY,r?.height)||(this.fire(new ie(Error(`Image "${e}" has invalid "stretchY" value`))),i=!1),this._validateContent(t.content,t)||(this.fire(new ie(Error(`Image "${e}" has invalid "content" value`))),i=!1),i}_validateStretch(e,t){if(!e)return!0;let i=0;for(let r of e){if(r[0]<i||r[1]<r[0]||t<r[1])return!1;i=r[1]}return!0}_validateContent(e,t){if(!e)return!0;if(e.length!==4)return!1;let i=t.spriteData,r=i?.width||t.data.width,a=i?.height||t.data.height;return e[0]<0||r<e[0]||e[1]<0||a<e[1]||e[2]<0||r<e[2]||e[3]<0||a<e[3]||e[2]<e[0]?!1:e[3]>=e[1]}updateImage(e,t,i=!0){let r=this.images[e];if(i){let a=r.data||r.spriteData;if(a.width!==t.data.width||a.height!==t.data.height)throw Error(`size mismatch between old image (${a.width}x${a.height}) and new image (${t.data.width}x${t.data.height}).`)}t.version=(r.version??0)+1,this.images[e]=t,this.updateVersion++}removeImage(e){let t=this.images[e];t&&(delete this.images[e],this._imagesIds=null,t.userImage?.onRemove&&t.userImage.onRemove())}listImages(){return this._imagesIds??=Object.keys(this.images),this._imagesIds}_getSpriteImageId(e,t){return e==="default"?t:`${e}:${t}`}setSpriteImages(e,t){let i=this._spriteImagesIds[e]??[],r=[];for(let n in t){let s=this._getSpriteImageId(e,n);r.push(s),s in this.images?this.updateImage(s,t[n],!1):this.addImage(s,t[n])}let a=new Set(r),o=i.filter((n)=>!a.has(n));for(let n of o)this.removeImage(n);return this._spriteImagesIds[e]=r,{loaded:r,removed:o}}removeSpriteImages(e){let t=this._spriteImagesIds[e]??[];for(let i of t)this.removeImage(i);return delete this._spriteImagesIds[e],t}removeAllSpriteImages(){let e=Object.values(this._spriteImagesIds).flat();for(let t of e)this.removeImage(t);return this._spriteImagesIds={},e}setMissingImageResolver(e){this.missingImageResolver=e}getImages(e){return new Promise((t,i)=>{let r=!0;if(!this.isLoaded())for(let a of e)this.images[a]||(r=!1);this.isLoaded()||r?t(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:t})})}async _getImagesForIds(e){let t=new Set(e.filter((a)=>!this.getImage(a))),i=this.missingImageResolver;i&&await Promise.allSettled(Array.from(t,(a)=>i(a)));let r={};for(let a of e){let o=this.getImage(a);o&&(t.delete(a),r[a]={data:o.data.clone(),pixelRatio:o.pixelRatio,sdf:o.sdf,version:o.version,stretchX:o.stretchX,stretchY:o.stretchY,content:o.content,textFitWidth:o.textFitWidth,textFitHeight:o.textFitHeight,hasRenderCallback:!!o.userImage?.render,isWebGLImage:o.isWebGLImage})}for(let a of t)this.fire(new sT({id:a})),he(`Image "${a}" could not be loaded. Please make sure you have added the image before it is needed with map.addImage(), resolved it with map.setMissingStyleImageResolver(), or included it in a "sprite" property in your style.`);return r}beginFrame(){this._renderCallbacksDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(let t of e){if(this._renderCallbacksDispatchedThisFrame[t])continue;this._renderCallbacksDispatchedThisFrame[t]=!0;let i=this.getImage(t);i||he(`Image with ID: "${t}" was not found`),wD(i)&&this.updateImage(t,i)}}cloneImages(){let e={};for(let t in this.images){let i=this.images[t];e[t]={...i,data:i.data?i.data.clone():null}}return e}},SA={start:0,end:pp};Mf=new Float64Array(256);for(let e=0;e<256;e++){let t=0.5-(e/255)**0.45454545454545453;Mf[e]=t*Math.abs(t)}Mf[255]=-100000000000000000000;IA=F.layout_symbol["text-font"].default.join(","),k1={vertical:"vert"};BA=class extends qe{constructor(e,t){super(),this._transitionable=new Gu(LA(),"light",t),this.setLight(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new Me(0))}getLight(){return this._transitionable.serialize()}getEvaluated(){return{anchor:this.properties.get("anchor"),position:this.properties.get("position"),color:this.properties.get("color"),intensity:this.properties.get("intensity")}}setLight(e,t={}){this._validate(ai.light,e,t)||this._transitionable.setValues(e)}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}applyGlobalStateChange(e,t,i){this._transitioning=this._transitionable.applyGlobalStateChange(e,t,this._transitioning,i)}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,t,i){return ds(this,e,{value:t},i)}},NA=class extends qe{constructor(e,t){super(),this._transitionable=new Gu(jA(),"sky",t),this.setSky(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new Me(0))}setSky(e,t={}){return!this._validate(ai.sky,e,t)&&(e||={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0},this._transitionable.setValues(e),!0)}getSky(){return this._transitionable.serialize()}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}applyGlobalStateChange(e,t,i){this._transitioning=this._transitionable.applyGlobalStateChange(e,t,this._transitioning,i)}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,t,i={}){return ds(this,e,{value:t},i)}getEvaluated(){return{"sky-color":this.properties.get("sky-color"),"horizon-color":this.properties.get("horizon-color"),"fog-color":this.properties.get("fog-color"),"fog-ground-blend":this.properties.get("fog-ground-blend"),"horizon-fog-blend":this.properties.get("horizon-fog-blend"),"sky-horizon-blend":this.properties.get("sky-horizon-blend"),"atmosphere-blend":this.properties.get("atmosphere-blend")}}};UA=class extends qe{constructor(e,t){super(),this.workerPool=e,this.actors=[],this.currentActor=0,this.id=t,this.removed=!1,this.workerErrorSubscriptions=[],this.actorsPromise=this.initActors(t)}async initActors(e){let t=await this.workerPool.acquire(e);if(this.removed)return[];let{actors:i,workerErrorSubscriptions:r}=kv(t,e,this);if(this.actors=i,this.workerErrorSubscriptions=r,!this.actors.length)throw Error("No actors found");return this.actors}async broadcast(e,t){let i=await this.actorsPromise;return Promise.all(i.map((r)=>r.sendAsync({type:e,data:t})))}async getActor(){let e=await this.actorsPromise;return this.currentActor=(this.currentActor+1)%e.length,e[this.currentActor]}async waitForInitComplete(){this.actors.length===0&&await this.actorsPromise}getReadyActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(e=!0){this.removed=!0;for(let t of this.actors)t.remove();for(let t of this.workerErrorSubscriptions)t.unsubscribe();this.actors=[],this.workerErrorSubscriptions=[],this.setEventedParent(null),e&&this.workerPool.release(this.id)}async registerMessageHandler(e,t){let i=await this.actorsPromise;for(let r of i)r.registerMessageHandler(e,t)}async unregisterMessageHandler(e){let t=await this.actorsPromise;for(let i of t)i.unregisterMessageHandler(e)}};KA=class extends qe{constructor(e,t,i,r){if(super(),this.id=e,this.dispatcher=i,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.sparse=!1,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,ee(this,Au(t,["url","scheme","tileSize","promoteId","encoding"])),this._options=ee({type:"vector"},t),this._collectResourceTiming=t.collectResourceTiming,this.tileSize!==512)throw Error("vector tile sources must have a tileSize of 512");this.setEventedParent(r)}async load(e=!1){this._loaded=!1,this.fire(new He("dataloading")),this._tileJSONRequest=new AbortController;try{let t=await Ex(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,t&&(ee(this,t),t.bounds&&(this.tileBounds=new Sx(t.bounds,this.minzoom,this.maxzoom,this.map.style.projection.worldCoordinateHelper)),this.fire(new He("data",{sourceDataType:"metadata"})),this.fire(new He("data",{sourceDataType:"content",sourceDataChanged:e})))}catch(t){this._tileJSONRequest=null,this._loaded=!0,pr(t)||this.fire(new ie(Mt(t)))}}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(!0)}setTiles(e){return this.setSourceProperty(()=>{this.tiles=e,this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}onRemove(){this._tileJSONRequest&&=(this._tileJSONRequest.abort(),null)}serialize(){return ee({},this._options)}async loadTile(e){let t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme,this.map.style.projection.worldCoordinateHelper.tileMatrixSet),i={request:await this.map._requestManager.transformRequest(t,"Tile"),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,encoding:this.encoding,overzoomParameters:await this._getOverzoomParameters(e),etag:e.etag};if(this._setAcceptHeader(i.request),i.request.collectResourceTiming=this._collectResourceTiming,await this.dispatcher.waitForInitComplete(),e.aborted)return;let r="RT";if(!e.actor||e.state==="expired")e.actor=this.dispatcher.getReadyActor(),r="LT";else if(e.state==="loading")return new Promise((n,s)=>{e.reloadPromise={resolve:n,reject:s}});e.abortController=new AbortController;let a;try{a=await e.actor.sendAsync({type:r,data:i},e.abortController)}catch(n){if(delete e.abortController,e.aborted||pr(n))return;if(n&&n.status!==404)throw n;a=null}if(delete e.abortController,e.aborted)return;let o={};if(a?.resourceTiming&&(e.resourceTiming=a.resourceTiming),!(a===null&&this.sparse&&(a=await this._loadFromNearestAncestor(e,i),e.aborted)))return this._afterTileLoadWorkerResponse(e,a),a?.etagUnmodified&&(o.unmodified=!0),this._reloadIfRequestedWhileLoading(e),o}async _loadFromNearestAncestor(e,t){let i=Math.min(e.tileID.canonical.z,this.maxzoom),r=Math.max(i-bu.maxUnderzooming,this.minzoom);for(let a=i-1;a>=r;a--){let o=e.tileID.scaledTo(a).canonical;t.overzoomParameters={maxZoomTileID:o,overzoomRequest:await this._getTileRequest(o)},e.abortController=new AbortController;try{let n=await e.actor.sendAsync({type:"LT",data:t},e.abortController);return delete e.abortController,n}catch(n){if(delete e.abortController,e.aborted||pr(n))return null;if(n&&n.status!==404)throw n}}return null}async _getOverzoomParameters(e){if(e.tileID.canonical.z<=this.maxzoom||this.map._zoomLevelsToOverscale===void 0)return;let t=e.tileID.scaledTo(this.maxzoom).canonical;return{maxZoomTileID:t,overzoomRequest:await this._getTileRequest(t)}}async _getTileRequest(e){let t=e.url(this.tiles,this.map.getPixelRatio(),this.scheme,this.map.style.projection.worldCoordinateHelper.tileMatrixSet),i=await this.map._requestManager.transformRequest(t,"Tile");return this._setAcceptHeader(i),i}_setAcceptHeader(e){this.encoding==="mlt"&&(e.headers??={},e.headers.Accept??="application/vnd.maplibre-tile")}_afterTileLoadWorkerResponse(e,t){t&&this.map._refreshExpiredTiles&&e.setExpiryData(t),e.etag=t?.etag,e.loadVectorData(t,this.map.style)}_reloadIfRequestedWhileLoading(e){if(e.reloadPromise){let t=e.reloadPromise;e.reloadPromise=null,this.loadTile(e).then(t.resolve).catch(t.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 this.dispatcher.broadcast("RMT",{uid:e.uid,type:this.type,source:this.id})}hasTransition(){return!1}},Cx=class extends qe{constructor(e,t,i,r){super(),this.id=e,this.dispatcher=i,this.setEventedParent(r),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._premultiplyAlpha=!0,this._options=ee({type:"raster"},t),ee(this,Au(t,["url","scheme","tileSize"]))}async load(e=!1){this._loaded=!1,this.fire(new He("dataloading")),this._tileJSONRequest=new AbortController;try{let t=await Ex(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,t&&(ee(this,t),t.bounds&&(this.tileBounds=new Sx(t.bounds,this.minzoom,this.maxzoom,this.map.style.projection.worldCoordinateHelper)),this.fire(new He("data",{sourceDataType:"metadata"})),this.fire(new He("data",{sourceDataType:"content",sourceDataChanged:e})))}catch(t){this._tileJSONRequest=null,this._loaded=!0,pr(t)||this.fire(new ie(Mt(t)))}}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&=(this._tileJSONRequest.abort(),null)}setSourceProperty(e){this._tileJSONRequest&&=(this._tileJSONRequest.abort(),null),e(),this.load(!0)}setTiles(e){return this.setSourceProperty(()=>{this.tiles=e,this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}serialize(){return ee({},this._options)}setPremultiplyAlpha(e){return this._premultiplyAlpha===e||this.setSourceProperty(()=>{this._premultiplyAlpha=e}),this}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,this.map.style.projection.worldCoordinateHelper.tileMatrixSet),i=this._premultiplyAlpha,r=i?void 0:{premultiplyAlpha:"none"};e.abortController=new AbortController;try{let a=await _r.transformAndGetImage(this.map._requestManager,t,"Tile",e.abortController,this.map._refreshExpiredTiles,r);if(delete e.abortController,e.aborted){e.state="unloaded";return}if(a){this.map._refreshExpiredTiles&&(a.cacheControl||a.expires)&&e.setExpiryData({cacheControl:a.cacheControl,expires:a.expires});let o=this.map.painter.context,n=o.gl,s=a.data??new $e({width:1,height:1},new Uint8Array(4));e.texture=this.map.painter.getTileTexture(s.width),e.texture?e.texture.update(s,{useMipmap:!0,premultiply:i}):(e.texture=new yt(o,s,n.RGBA,{useMipmap:!0,premultiply:i}),e.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE,n.LINEAR_MIPMAP_NEAREST)),e.state="loaded"}}catch(a){if(delete e.abortController,e.aborted)e.state="unloaded";else if(a)throw e.state="errored",a}}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}},JA=class extends Cx{constructor(e,t,i,r){super(e,t,i,r),this.type="raster-dem",this.maxzoom=22,this._options=ee({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,this.map.style.projection.worldCoordinateHelper.tileMatrixSet);e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{let i=await _r.transformAndGetImage(this.map._requestManager,t,"Tile",e.abortController,this.map._refreshExpiredTiles,{colorSpaceConversion:"none"});if(delete e.abortController,e.aborted){e.state="unloaded";return}if(i){if(this.map._refreshExpiredTiles&&(i.cacheControl||i.expires)&&e.setExpiryData({cacheControl:i.cacheControl,expires:i.expires}),!i.data){e.state="loaded";return}let r=i.data,a=Sa(r)&&kp()?r:await this.readImageNow(r),o={type:this.type,uid:e.uid,source:this.id,rawImageData:a,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(e.actor&&e.state!=="expired"&&e.state!=="reloading")return;await this.dispatcher.waitForInitComplete(),e.actor&&e.state!=="expired"||(e.actor=this.dispatcher.getReadyActor()),e.dem=await e.actor.sendAsync({type:"LDT",data:o}),e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.needsColorReliefPrepare=!0,e.state="loaded"}}catch(i){if(delete e.abortController,e.aborted)e.state="unloaded";else if(i)throw e.state="errored",i}}async readImageNow(e){if(typeof VideoFrame<"u"&&py()){let t=e.width+4,i=e.height+4;try{return new $e({width:t,height:i},await o3(e,-2,-2,t,i))}catch{}}return li.getImageData(e,2)}_getNeighboringTiles(e){let t=e.canonical,i=2**t.z,r=(t.x-1+i)%i,a=t.x===0?e.wrap-1:e.wrap,o=(t.x+1+i)%i,n=t.x+1===i?e.wrap+1:e.wrap,s={};return s[new Et(e.overscaledZ,a,t.z,r,t.y).key]={backfilled:!1},s[new Et(e.overscaledZ,n,t.z,o,t.y).key]={backfilled:!1},t.y>0&&(s[new Et(e.overscaledZ,a,t.z,r,t.y-1).key]={backfilled:!1},s[new Et(e.overscaledZ,e.wrap,t.z,t.x,t.y-1).key]={backfilled:!1},s[new Et(e.overscaledZ,n,t.z,o,t.y-1).key]={backfilled:!1}),t.y+1<i&&(s[new Et(e.overscaledZ,a,t.z,r,t.y+1).key]={backfilled:!1},s[new Et(e.overscaledZ,e.wrap,t.z,t.x,t.y+1).key]={backfilled:!1},s[new Et(e.overscaledZ,n,t.z,o,t.y+1).key]={backfilled:!1}),s}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}})}};mp=new class{constructor(){this.name="identity",this.projection=new lM,this.tileMatrixSet={origin:[-90,90],extentAtZoom0:180}}},uM=new Map([[mp.name,mp]]);cM=class extends qe{constructor(e,t,i,r){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._workerUpdates=new nM({send:(a)=>this._sendWorkerUpdate(a),onResult:(a,o,n)=>this._onWorkerUpdateResult(a,o,n),onError:(a,o)=>this._onWorkerUpdateError(o)}),t.data!==void 0&&this._workerUpdates.enqueue({data:t.data}),this.actorPromise=i.getActor(),this.setEventedParent(r),this._data=typeof t.data=="string"?{url:t.data}:{geojson:t.data},this._options=ee({},t),this._collectResourceTiming=t.collectResourceTiming,t.maxzoom!==void 0&&(this.maxzoom=t.maxzoom),t.type&&(this.type=t.type),t.attribution&&(this.attribution=t.attribution),this.promoteId=t.promoteId,t.clusterMaxZoom!==void 0&&this.maxzoom<=t.clusterMaxZoom&&he(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${t.clusterMaxZoom}".`),this.workerOptions=ee({source:this.id,geojsonVtOptions:{buffer:this._pixelsToTileUnits(t.buffer===void 0?128:t.buffer),tolerance:this._pixelsToTileUnits(t.tolerance===void 0?0.375:t.tolerance),extent:z,maxZoom:this.maxzoom,lineMetrics:t.lineMetrics||!1,generateId:t.generateId||!1,promoteId:this._promoteIdKey,cluster:t.cluster||!1,clusterOptions:{maxZoom:this._getClusterMaxZoom(t.clusterMaxZoom),minPoints:Math.max(2,t.clusterMinPoints||2),extent:z,radius:this._pixelsToTileUnits(t.clusterRadius||50),log:!1,generateId:t.generateId||!1}},clusterProperties:t.clusterProperties,filter:t.filter},t.workerOptions)}get _promoteIdKey(){return typeof this.promoteId=="string"?this.promoteId:void 0}_pixelsToTileUnits(e){return e*(z/this.tileSize)}_tileUnitsToPixels(e){return e/(z/this.tileSize)}_getClusterMaxZoom(e){let t=e?Math.round(e):this.maxzoom-1;return Number.isInteger(e)||e===void 0||he(`Integer expected for option 'clusterMaxZoom': provided value "${e}" rounded to "${t}"`),t}async load(){this._workerUpdates.isIdle()?he(`No pending worker updates for GeoJSONSource ${this.id}.`):await this._workerUpdates.flush()}onAdd(e){this.map=e,this.load()}setData(e){return this._data=typeof e=="string"?{url:e}:{geojson:e},this._workerUpdates.replace({data:e}),this._workerUpdates.flush()}updateData(e){let t=this._getWaitingWorkerChange();return t?t.diff=tM(t.diff,e,this._promoteIdKey):this._workerUpdates.enqueue({diff:e}),this._workerUpdates.flush()}async getData(){for(;this._data.url;)await this.once("data");return this._data.geojson?this._data.geojson:{type:"FeatureCollection",features:Array.from(this._data.updateable.values())}}async getBounds(){return R1(await this.getData())}setClusterOptions(e){if(this.workerOptions.geojsonVtOptions.cluster=e.cluster,e.clusterRadius!==void 0&&(this.workerOptions.geojsonVtOptions.clusterOptions.radius=this._pixelsToTileUnits(e.clusterRadius)),e.clusterMaxZoom!==void 0&&(this.workerOptions.geojsonVtOptions.clusterOptions.maxZoom=this._getClusterMaxZoom(e.clusterMaxZoom)),!this._workerUpdates.some((t)=>("data"in t))){let t=this._getWaitingWorkerChange();t?t.updateCluster=!0:this._workerUpdates.enqueue({updateCluster:!0})}return this._workerUpdates.flush()}_getWaitingWorkerChange(){let e=this._workerUpdates.top();return e&&!("data"in e)?e:void 0}getClusterOptions(){let{cluster:e,clusterOptions:t}=this.workerOptions.geojsonVtOptions;return{cluster:e,clusterMaxZoom:t.maxZoom,clusterRadius:this._tileUnitsToPixels(t.radius)}}async getClusterExpansionZoom(e){return(await this.actorPromise).sendAsync({type:"GCEZ",data:{type:this.type,clusterId:e,source:this.id}})}async getClusterChildren(e){return(await this.actorPromise).sendAsync({type:"GCC",data:{type:this.type,clusterId:e,source:this.id}})}async getClusterLeaves(e,t,i){return(await this.actorPromise).sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:e,limit:t,offset:i}})}async _getLoadGeoJSONParameters(e){let t=ee({type:this.type,source:this.id},this.workerOptions),i=this._getCRSParameters();return i&&(t.crs=i),"data"in e?typeof e.data=="string"?(t.request=await this.map._requestManager.transformRequest(li.resolveURL(e.data),"Source"),t.request.collectResourceTiming=this._collectResourceTiming,t):(t.data=e.data,t):(e.diff&&(t.dataDiff=e.diff),e.updateCluster&&(t.updateCluster=!0),t)}_getCRSParameters(){let e=rc(this.map?.style?.projection?.name);if(e)if(!e.definition&&e!==mp)he(`GeoJSON source "${this.id}" is drawn in the wrong place: the projection "${e.name}" has no \`definition\` to project its data with.`);else return{name:e.name,definition:e.definition,tileMatrixSet:e.tileMatrixSet}}async _sendWorkerUpdate(e){this.fire(new He("dataloading"));let t=await this._getLoadGeoJSONParameters(e);return(await this.actorPromise).sendAsync({type:"LD",data:t})}_onWorkerUpdateResult(e,t,i){if(this._removed||t.abandoned){this.fire(new He("dataabort"));return}t.data&&!i&&(this._data={geojson:t.data});let r="data"in e||i?void 0:e.diff,a=this._applyDiffToSource(r),o=!("data"in e)&&e.updateCluster||this.map?.style?.projection?.worldCoordinateHelper.wraps===!1?void 0:this._getShouldReloadTileOptions(a),n={};this._applyResourceTiming(n,t),this.fire(new He("data",{...n,sourceDataType:"metadata"})),this.fire(new He("data",{...n,sourceDataType:"content",shouldReloadTileOptions:o}))}_onWorkerUpdateError(e){this._removed?this.fire(new He("dataabort")):this.fire(new ie(Mt(e)))}_applyResourceTiming(e,t){if(!this._collectResourceTiming)return;let i=t.resourceTiming?.[this.id];if(!i)return;let r=i.slice(0);r?.length&&ee(e,{resourceTiming:r})}_applyDiffToSource(e){if(!e)return;let t=this._promoteIdKey;if(!this._data.url&&!this._data.updateable){let r=QA(this._data.geojson,t);if(!r)throw Error(`GeoJSONSource "${this.id}": GeoJSON data is not compatible with updateData`);this._data={updateable:r}}if(!this._data.updateable)return;let i=eM(this._data.updateable,e,t);if(!(e.removeAll||this.workerOptions.geojsonVtOptions.cluster))return i}_getShouldReloadTileOptions(e){if(e)return{affectedBounds:e.filter(Boolean).map((t)=>R1(t))}}shouldReloadTile(e,{affectedBounds:t}){if(e.state==="loading")return!0;if(e.state==="unloaded")return!1;let{buffer:i,extent:r}=this.workerOptions.geojsonVtOptions,a=oM(e.tileID.canonical,i/r,this.map.style.projection.worldCoordinateHelper);for(let o of t)if(a.intersects(o))return!0;return!1}loaded(){return this._workerUpdates.isIdle()}async loadTile(e){let t=e.actor?"RT":"LT";e.actor=await this.actorPromise;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,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};e.abortController=new AbortController;try{let r=await(await this.actorPromise).sendAsync({type:t,data:i},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(r,this.map.style,t==="RT")}catch(r){if(delete e.abortController,e.aborted||pr(r))return;throw r}}async abortTile(e){e.abortController&&(e.abortController.abort(),delete e.abortController),e.aborted=!0}async unloadTile(e){e.unloadVectorData(),await(await this.actorPromise).sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}})}onRemove(){this._removed=!0,this._workerUpdates.clear(),this.actorPromise.then((e)=>e.sendAsync({type:"RS",data:{type:this.type,source:this.id}}))}serialize(){return ee({},this._options,{type:this.type,data:this._data.updateable?{type:"FeatureCollection",features:Array.from(this._data.updateable.values())}:this._data.url||this._data.geojson})}hasTransition(){return!1}},xo=[0,0,1];ho=rt([{name:"a_pos",type:"Int16",components:2}]);gs=class extends qe{constructor(e,t,i,r){super(),this.imageWarp=xo,this.flippedWindingOrder=!1,this._warp="auto",this._imageDirty=!1,this._subdividedQuad=!1,this._subdividedMesh=null,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(r),this.options=t}async load(e){if(this.options.url===void 0)this._loaded=!0,this._finishLoading();else{this._loaded=!1,this.fire(new He("dataloading")),this.url=this.options.url,this._abortController=new AbortController;try{let t=await _r.transformAndGetImage(this.map._requestManager,this.url,"Image",this._abortController);this._abortController=null,this._loaded=!0,t?.data?(this._setImage(t.data),e&&(this.coordinates=e),this._finishLoading()):this.fire(new ie(Error(`Could not load image ${this.url}: the response is empty`)))}catch(t){if(pr(t))return;this._abortController=null,this._loaded=!0,this.fire(new ie(Mt(t)))}}}loaded(){return this._loaded}updateImage(e){return this._abortController&&=(this._abortController.abort(),null),"image"in e?(this._loaded=!0,this._setImage(e.image),e.coordinates&&(this.coordinates=e.coordinates),this._finishLoading(),this):(e.url&&(this.options.url=e.url,this.load(e.coordinates)),this)}_setImage(e){this.image=e,this._imageDirty=!0}getMesh(e,t){return!this._subdividedQuad||t?null:(this._subdividedMesh??=Ax(e,{granularity:16}),this._subdividedMesh)}_disposeTexture(){this.texture?.destroy(),this.texture=null}_finishLoading(){if(this.map)try{this.setCoordinates(this.coordinates),this.fire(new He("data",{sourceDataType:"metadata"}))}catch(e){this.fire(new ie(Mt(e)))}}onAdd(e){this.map=e,this.load()}onRemove(){this._abortController&&=(this._abortController.abort(),null),this._disposeTexture(),this._subdividedMesh?.destroy(),this._subdividedMesh=null,this.image=null,this.tiles={}}setWarp(e){return this._warp===e||(this._warp=e,this.tileCoords&&this.setCoordinates(this.coordinates)),this}getWarp(){return this._warp}setCoordinates(e){this.coordinates=e;let t=this.map.style.projection.worldCoordinateHelper,i=e.map((r)=>{let a=Y.convert(r);return t.worldFromLngLat(a.lng,a.lat)});return this.tileID=_M(i),this.terrainTileRanges=this._getOverlappingTileRanges(i),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=i.map((r)=>this.tileID.getTilePoint(r)._round()),this.imageWarp=vM(this.tileCoords,this._warp),this._subdividedQuad=this.imageWarp[2]>0&&!Mx(this.tileCoords),this.flippedWindingOrder=yM(this.tileCoords),this.fire(new He("data",{sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;let e=this.map.painter.context,t=e.gl;this.texture?this._imageDirty&&(this.texture.update(this.image),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE)):(this.texture=new yt(e,this.image,t.RGBA),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE)),this._imageDirty=!1;let i=!1;for(let r in this.tiles){let a=this.tiles[r];a.state!=="loaded"&&(a.state="loaded",a.texture=this.texture,i=!0)}i&&this.fire(new He("data",{sourceDataType:"idle",sourceId:this.id}))}async loadTile(e){this.tileID?.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={}):e.state="errored"}serialize(){let e={type:"image",coordinates:this.coordinates};return this.options.url!==void 0&&(e.url=this.options.url),e}hasTransition(){return!1}_getOverlappingTileRanges(e){let{minX:t,minY:i,maxX:r,maxY:a}=Yi.fromPoints(e),o={};for(let n=0;n<=25;n++){let s=2**n,l=Math.floor(t*s),u=Math.floor(i*s),c=Math.floor(r*s),h=Math.floor(a*s),d=(l%s+s)%s,p=c%s,f=Math.floor(l/s),m=Math.floor(c/s);o[n]={minWrap:f,maxWrap:m,minTileXWrapped:d,maxTileXWrapped:p,minTileY:u,maxTileY:h}}return o}};bM=class extends gs{constructor(e,t,i,r){super(e,t,i,r),this._onPlayingHandler=()=>{this.map?.triggerRepaint()},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((await this.map._requestManager.transformRequest(t,"Source")).url);try{let t=await b3(this.urls);if(this._loaded=!0,!t)return;this.video=t,this.video.loop=!0,this.video.addEventListener("playing",this._onPlayingHandler),this.map&&this.video.play(),this._finishLoading()}catch(t){this.fire(new ie(Mt(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 ie(new O(`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)))}onRemove(){super.onRemove(),this.video&&(this.video.removeEventListener("playing",this._onPlayingHandler),this.video.pause())}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;let e=this.map.painter.context,t=e.gl;this.texture?this.video.paused||(this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE),t.texSubImage2D(t.TEXTURE_2D,0,0,0,t.RGBA,t.UNSIGNED_BYTE,this.video)):(this.texture=new yt(e,this.video,t.RGBA),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE));let i=!1;for(let r in this.tiles){let a=this.tiles[r];a.state!=="loaded"&&(a.state="loaded",a.texture=this.texture,i=!0)}i&&this.fire(new He("data",{sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},wM=class extends gs{constructor(e,t,i,r){super(e,t,i,r),t.coordinates?(!Array.isArray(t.coordinates)||t.coordinates.length!==4||t.coordinates.some((a)=>!Array.isArray(a)||a.length!==2||a.some((o)=>typeof o!="number")))&&this.fire(new ie(new O(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new ie(new O(`sources.${e}`,null,'missing required property "coordinates"'))),t.animate&&typeof t.animate!="boolean"&&this.fire(new ie(new O(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),t.canvas?typeof t.canvas!="string"&&!(t.canvas instanceof HTMLCanvasElement)&&this.fire(new ie(new O(`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 ie(new O(`sources.${e}`,null,'missing required property "canvas"'))),this.options=t,this.animate=t.animate===void 0||t.animate}async load(){this._loaded=!0,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 ie(Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&=(this.prepare(),!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this._playing=!1,super.onRemove()}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.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):(this.texture=new yt(t,this.canvas,i.RGBA,{premultiply:!0}),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let r=!1;for(let a in this.tiles){let o=this.tiles[a];o.state!=="loaded"&&(o.state="loaded",o.texture=this.texture,r=!0)}r&&this.fire(new He("data",{sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",animate:this.animate,canvas:this.options.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}},TM={};Px=class e{static{this.worldCoordinateHelpers=new WeakMap}constructor(t,i,r,a,o,n){this.type="Feature",this._vectorTileFeature=t,this._x=r,this._y=a,this._z=i,n!==ja&&e.worldCoordinateHelpers.set(this,n);for(let s in t.properties)typeof t.properties[s]=="string"&&t.properties[s].startsWith("__$json__:")&&(t.properties[s]=JSON.parse(t.properties[s].slice(10)));this.properties=t.properties,this.id=o}projectPoint(t,i,r,a,o){if(o){let n=o.lngLatFromWorld((t.x+i)/a,(t.y+r)/a);return[n.lng,n.lat]}return[(t.x+i)*360/a-180,360/Math.PI*Math.atan(Math.exp((1-(t.y+r)*2/a)*Math.PI))-90]}projectLine(t,i,r,a,o){return t.map((n)=>this.projectPoint(n,i,r,a,o))}get geometry(){if(this._geometry)return this._geometry;let t=this._vectorTileFeature,i=e.worldCoordinateHelpers.get(this),r=t.extent*2**this._z,a=t.extent*this._x,o=t.extent*this._y,n=t.loadGeometry();switch(t.type){case 1:{let s=[];for(let u of n)s.push(u[0]);let l=this.projectLine(s,a,o,r,i);this._geometry=s.length===1?{type:"Point",coordinates:l[0]}:{type:"MultiPoint",coordinates:l};break}case 2:{let s=n.map((l)=>this.projectLine(l,a,o,r,i));this._geometry=s.length===1?{type:"LineString",coordinates:s[0]}:{type:"MultiLineString",coordinates:s};break}case 3:{let s=V2(n),l=[];for(let u of s)l.push(u.map((c)=>this.projectLine(c,a,o,r,i)));this._geometry=l.length===1?{type:"Polygon",coordinates:l[0]}:{type:"MultiPolygon",coordinates:l};break}default:throw Error(`unknown feature type: ${t.type}`)}return this._geometry}set geometry(t){this._geometry=t}toJSON(){let t={geometry:this.geometry};for(let i in this)i!=="_geometry"&&i!=="_vectorTileFeature"&&i!=="_x"&&i!=="_y"&&i!=="_z"&&(t[i]=this[i]);return t}},ac=class extends Va{},Pf=class extends ac{getValueFromBuffer(e){return this.dataBuffer[e]}},If=class extends ac{getValueFromBuffer(e){return this.dataBuffer[e]}},Ix=class extends Va{constructor(e,t,i,r){super(e,t,r),this.delta=i}},kf=class extends Ix{constructor(e,t,i,r,a){super(e,a?Int32Array.of(t):Uint32Array.of(t),i,r)}getValueFromBuffer(e){return this.dataBuffer[0]+e*this.delta}},Ff=class extends Va{constructor(e,t,i,r){super(e,r?Int32Array.of(t):Uint32Array.of(t),i)}getValueFromBuffer(e){return this.dataBuffer[0]}},xn={FEATURE:0,VERTEX:1},Se={BOOLEAN:0,INT_8:1,UINT_8:2,INT_32:3,UINT_32:4,INT_64:5,UINT_64:6,FLOAT:7,DOUBLE:8,STRING:9},ia={GEOMETRY:0,STRUCT:1,MAP:2},kx={ID:0};(function(e){e.NONE="NONE",e.DELTA="DELTA",e.COMPONENTWISE_DELTA="COMPONENTWISE_DELTA",e.RLE="RLE",e.MORTON="MORTON"})(fe||={});(function(e){e.NONE="NONE",e.FAST_PFOR="FAST_PFOR",e.VARINT="VARINT"})(Oi||={});Rf=new Uint32Array(33);Rf[0]=0;for(let e=1;e<=32;e++)Rf[e]=e===32?4294967295:4294967295>>>32-e;gp=Rf;_p=Rx(zf),QM=3*_p/256+_p|0;(function(e){e.PRESENT="PRESENT",e.DATA="DATA",e.OFFSET="OFFSET",e.LENGTH="LENGTH"})(mt||={});(function(e){e.NONE="NONE",e.SINGLE="SINGLE",e.SHARED="SHARED",e.VERTEX="VERTEX",e.MORTON="MORTON",e.FSST="FSST"})(Ht||={});(function(e){e.VERTEX="VERTEX",e.INDEX="INDEX",e.STRING="STRING",e.KEY="KEY"})(Rr||={});(function(e){e.VAR_BINARY="VAR_BINARY",e.GEOMETRIES="GEOMETRIES",e.PARTS="PARTS",e.RINGS="RINGS",e.TRIANGLES="TRIANGLES",e.SYMBOL="SYMBOL",e.DICTIONARY="DICTIONARY"})(bt||={});UP=[mt.PRESENT,mt.DATA,mt.OFFSET,mt.LENGTH],j1=[fe.NONE,fe.DELTA,fe.COMPONENTWISE_DELTA,fe.RLE,fe.MORTON],qP=[Oi.NONE,Oi.FAST_PFOR,Oi.VARINT],GP=[Ht.NONE,Ht.SINGLE,Ht.SHARED,Ht.VERTEX,Ht.MORTON,Ht.FSST],WP=[Rr.VERTEX,Rr.INDEX,Rr.STRING,Rr.KEY],ZP=[bt.VAR_BINARY,bt.GEOMETRIES,bt.PARTS,bt.RINGS,bt.TRIANGLES,bt.SYMBOL,bt.DICTIONARY];(function(e){e[e.FLAT=0]="FLAT",e[e.CONST=1]="CONST",e[e.SEQUENCE=2]="SEQUENCE",e[e.DICTIONARY=3]="DICTIONARY",e[e.FSST_DICTIONARY=4]="FSST_DICTIONARY"})(Ge||={});t8=new TextDecoder;Zx=class extends ac{getValueFromBuffer(e){return this.dataBuffer[e]}},Hx=class extends Ix{constructor(e,t,i,r,a){super(e,a?BigInt64Array.of(t):BigUint64Array.of(t),i,r)}getValueFromBuffer(e){return this.dataBuffer[0]+BigInt(e)*this.delta}};(function(e){e[e.POINT=0]="POINT",e[e.LINESTRING=1]="LINESTRING",e[e.POLYGON=2]="POLYGON",e[e.MULTIPOINT=3]="MULTIPOINT",e[e.MULTILINESTRING=4]="MULTILINESTRING",e[e.MULTIPOLYGON=5]="MULTIPOLYGON"})(Lt||={});(function(e){e[e.POINT=0]="POINT",e[e.LINESTRING=1]="LINESTRING",e[e.POLYGON=2]="POLYGON"})(p8||={});(function(e){e[e.MORTON=0]="MORTON",e[e.VEC_2=1]="VEC_2",e[e.VEC_3=2]="VEC_3"})(Ua||={});Yx=class extends Xx{constructor(e,t,i,r,a,o,n){super(i,r,a,o,n),this._numGeometries=e,this._geometryType=t}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsPolygonGeometry(){return this._geometryType===Lt.POLYGON||this._geometryType===Lt.MULTIPOLYGON}containsSingleGeometryType(){return!0}};Jx=class extends Xx{constructor(e,t,i,r,a,o){super(e,i,r,a,o),this._geometryTypes=t}geometryType(e){return this._geometryTypes[e]}get numGeometries(){return this._geometryTypes.length}containsPolygonGeometry(){for(let e=0;e<this.numGeometries;e++)if(this.geometryType(e)===Lt.POLYGON||this.geometryType(e)===Lt.MULTIPOLYGON)return!0;return!1}containsSingleGeometryType(){return!1}},Qx=class{constructor(e,t,i,r){this._triangleOffsets=e,this._indexBuffer=t,this._vertexBuffer=i,this._topologyVector=r}get triangleOffsets(){return this._triangleOffsets}get indexBuffer(){return this._indexBuffer}get vertexBuffer(){return this._vertexBuffer}get topologyVector(){return this._topologyVector}getGeometries(){if(!this._topologyVector)throw Error("Cannot convert GpuVector to coordinates without topology information");let e=new Uint32Array(this.numGeometries);for(let t=0;t<this.numGeometries;t++)e[t]=this.geometryType(t);return Kx(e,this._topologyVector,void 0,this._vertexBuffer).getGeometries()}[Symbol.iterator](){return null}};x8=class extends Qx{constructor(e,t,i,r,a,o){super(i,r,a,o),this._numGeometries=e,this._geometryType=t}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsSingleGeometryType(){return!0}};b8=class extends Qx{constructor(e,t,i,r,a){super(t,i,r,a),this._geometryTypes=e}geometryType(e){return this._geometryTypes[e]}get numGeometries(){return this._geometryTypes.length}containsSingleGeometryType(){return!1}};S8=class extends Va{constructor(e,t,i){super(e,t.getBuffer(),i),this.dataVector=t}getValueFromBuffer(e){return this.dataVector.get(e)}},C8=class extends ac{getValueFromBuffer(e){return this.dataBuffer[e]}},eb=class extends Va{constructor(e,t,i,r){super(e,r?BigInt64Array.of(t):BigUint64Array.of(t),i)}getValueFromBuffer(e){return this.dataBuffer[0]}},Uf=class extends Va{constructor(e,t,i,r){super(e,i,r),this.offsetBuffer=t}},q1=class extends Uf{constructor(e,t,i,r){super(e,t,i,r??t.length-1)}getValueFromBuffer(e){let t=this.offsetBuffer[e],i=this.offsetBuffer[e+1];return jf(this.dataBuffer,t,i)}},bo=class extends Uf{constructor(e,t,i,r,a){super(e,i,r,a??t.length),this.indexBuffer=t,this.indexBuffer=t}getValueFromBuffer(e){let t=this.indexBuffer[e],i=this.offsetBuffer[t],r=this.offsetBuffer[t+1];return jf(this.dataBuffer,i,r)}};tb=class extends Uf{constructor(e,t,i,r,a,o,n,s){super(e,i,r,n??t.length),this.indexBuffer=t,this.symbolOffsetBuffer=a,this.symbolTableBuffer=o,this.sharedDictionaryCache=s}getValueFromBuffer(e){this.decodedDictionary??(this.decodedDictionary=this.sharedDictionaryCache?.decodedDictionary,this.decodedDictionary??(this.decodedDictionary=this.decodeDictionary(),this.sharedDictionaryCache&&(this.sharedDictionaryCache.decodedDictionary=this.decodedDictionary)));let t=this.indexBuffer[e],i=this.offsetBuffer[t],r=this.offsetBuffer[t+1];return jf(this.decodedDictionary,i,r)}decodeDictionary(){return this.symbolLengthBuffer??=this.offsetToLengthBuffer(this.symbolOffsetBuffer),A8(this.symbolTableBuffer,this.symbolLengthBuffer,this.dataBuffer)}offsetToLengthBuffer(e){let t=new Uint32Array(e.length-1),i=e[0];for(let r=1;r<e.length;r++){let a=e[r];t[r-1]=a-i,i=a}return t}};G1=class extends Va{constructor(e,t,i){super(e,new Uint8Array,i??t.length),this.values=t}getValueFromBuffer(e){return this.values[e]}};(function(e){e[e.STRING=1]="STRING",e[e.INT32=2]="INT32",e[e.UINT32=4]="UINT32",e[e.INT64=8]="INT64",e[e.UINT64=16]="UINT64",e[e.FLOAT=32]="FLOAT",e[e.DOUBLE=64]="DOUBLE",e[e.PRESENCE=128]="PRESENCE"})(zr||={});(function(e){e[e.FALSE=0]="FALSE",e[e.TRUE=1]="TRUE",e[e.START_MAP=2]="START_MAP",e[e.START_LIST=3]="START_LIST",e[e.COUNT=4]="COUNT"})(Ta||={});xt={ID:0,ID_NULLABLE:1,ID_LONG:2,GEOMETRY:4,SCALAR_BASE:10,STRUCT:30,MAP:31};eI=new TextDecoder;Rh=Rx(zf);Rh/32*4,3*Rh/256+Rh|0;Z("FeatureIndex",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 ld(z,16,0),this.grid3D=new ld(z,16,0),this.featureIndexArray=new Yv,this.promoteId=t}insert(e,t,i,r,a,o){let n=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(i,r,a);let s=o?this.grid3D:this.grid;for(let l of t){let u=[1/0,1/0,-1/0,-1/0];for(let c of l)u[0]=Math.min(u[0],c.x),u[1]=Math.min(u[1],c.y),u[2]=Math.max(u[2],c.x),u[3]=Math.max(u[3],c.y);u[0]<8192&&u[1]<8192&&u[2]>=0&&u[3]>=0&&s.insert(n,u[0],u[1],u[2],u[3])}}loadVTLayers(){if(!this.vtLayers){switch(this.encoding){case"mlt":this.vtLayers=new lI(this.rawTileData).layers;break;default:this.vtLayers=new qS(new ex(this.rawTileData)).layers}this.sourceLayerCoder=new DM(this.vtLayers?Object.keys(this.vtLayers).sort():[zl])}return this.vtLayers}query(e,t,i,r){this.loadVTLayers();let a=e.params,o=z/e.tileSize/e.scale,n=Un(a.filter,"queryRenderedFeatures filter",a.globalState),s=e.queryGeometry,l=e.queryPadding*o,u=Yi.fromPoints(s),c=this.grid.query(u.minX-l,u.minY-l,u.maxX+l,u.maxY+l),h=Yi.fromPoints(e.cameraQueryGeometry).expandBy(l),d=this.grid3D.query(h.minX,h.minY,h.maxX,h.maxY,(m,g,_,y)=>UT(e.cameraQueryGeometry,m-l,g-l,_+l,y+l));for(let m of d)c.push(m);c.sort(cI);let p={},f;for(let m of c){if(m===f)continue;f=m;let g=this.featureIndexArray.get(m),_=null;this.loadMatchingFeature(p,g.bucketIndex,g.sourceLayerIndex,g.featureIndex,n,a.layers,a.availableImages,t,i,e.worldCoordinateHelper,r,(y,v,x)=>(_||=Ba(y),v.queryIntersectsFeature({queryGeometry:s,feature:y,featureState:x,geometry:_,zoom:this.z,projectedCamera:e.projectedCamera,pixelsToTileUnits:o,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:e.getElevation})))}return p}loadMatchingFeature(e,t,i,r,a,o,n,s,l,u,c,h){let d=this.bucketLayerIDs[t];if(o&&!d.some((g)=>o.has(g)))return;let p=this.sourceLayerCoder.decode(i),f=this.vtLayers[p].feature(r);if(a.needGeometry){let g=Oa(f,!0);if(!a.filter(new Me(this.tileID.overscaledZ),g,this.tileID.canonical))return}else if(!a.filter(new Me(this.tileID.overscaledZ),f))return;let m=this.getId(f,p);for(let g of d){if(o&&!o.has(g))continue;let _=s[g];if(!_)continue;let y={};m&&c&&(y=c.getState(_.sourceLayer||"_geojsonTileLayer",m));let v=ee({},l[g]);v.paint=H1(v.paint,_.paint,f,y,n),v.layout=H1(v.layout,_.layout,f,y,n);let x=!h||h(f,_,y);if(!x)continue;let b=new Px(f,this.z,this.x,this.y,m,u);b.layer=v;let w=e[g];w===void 0&&(w=e[g]=[]),w.push({featureIndex:r,feature:b,intersectionZ:x})}}lookupSymbolFeatures(e,t,i,r,a,o,n,s){let l={};this.loadVTLayers();let u=Un(a.filterSpec,"queryRenderedFeatures symbol filter",a.globalState);for(let c of e)this.loadMatchingFeature(l,i,r,c,u,o,n,s,t,a.worldCoordinateHelper);return l}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 r=typeof this.promoteId=="string"?this.promoteId:this.promoteId[t];i=e.properties[r],typeof i=="boolean"&&(i=Number(i)),i===void 0&&e.properties?.cluster&&this.promoteId&&(i=Number(e.properties.cluster_id))}return i}},{omit:["rawTileData","sourceLayerCoder"]});hI=class extends qe{constructor(){super(),this.status="unavailable",this.url=null,this.dispatcher=zv(),this.dispatcher.on("workerscreate",()=>this._resyncWorkers())}async _resyncWorkers(){try{this.status==="deferred"?await this._syncState("deferred"):this.status==="loaded"&&await this._requestImport()}catch(e){he(`Failed to load the RTL text plugin into the new workers: ${e}`)}}_syncState(e){return this.status=e,this.dispatcher.broadcast("SRPS",{pluginStatus:e,pluginURL:this.url}).catch((t)=>{throw this.status="error",t})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}async setRTLTextPlugin(e,t=!1){if(this.url)throw Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=li.resolveURL(e),!this.url)throw Error(`requested url ${e} is invalid`);if(this.status==="unavailable")if(t)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 sa(xp))}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}};xI=wp(9.314,3);bu=class e extends qe{static{this.maxUnderzooming=10}static{this.maxOverzooming=3}constructor(t,i,r){super(),this._maxContentElevationSeen=0,this.id=t,this.dispatcher=r,this.on("data",(a)=>{this._dataHandler(a)}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",(a)=>{a.tile||(this._sourceErrored=this._source.loaded())}),this._source=EM(t,i,r,this),this._inViewTiles=new a_,this._outOfViewCache=new dI(0,(a)=>this._unloadTile(a)),this._timers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._rasterFadeDuration=0,this._maxFadingAncestorLevels=5,this._state=new pI,this._didEmitContent=!1,this._updated=!1}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._maxTileCacheZoomLevels=t?t._maxTileCacheZoomLevels:null,this._source?.onAdd&&this._source.onAdd(t)}onRemove(t){for(let i of this._inViewTiles.getAllTiles())i.unloadVectorData();this.clearTiles(),this._source?.onRemove&&this._source.onRemove(t),this._inViewTiles=new a_}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 t of this._inViewTiles.getAllTiles())if(t.state!=="loaded"&&t.state!=="errored")return!1;return!0}getSource(){return this._source}getState(){return this._state}pause(){this._paused=!0}resume(){if(!this._paused)return;let t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.projectedCamera&&this.update(this.projectedCamera,this.worldCoordinateHelper,this.terrain)}async _loadTile(t,i,r,a){try{let o=await this._source.loadTile(t);this._tileLoaded(t,i,r,a,o)}catch(o){t.state="errored",o.status===404?this.update(this.projectedCamera,this.worldCoordinateHelper,this.terrain):this._source.fire(new ie(Mt(o),{tile:t}))}}_unloadTile(t){this._source.unloadTile&&this._source.unloadTile(t)}_abortTile(t){this._source.abortTile&&this._source.abortTile(t),this._source.fire(new He("dataabort",{tile:t,coord:t.tileID}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._inViewTiles,this.style);for(let i of this._inViewTiles.getAllTiles())i.upload(t),i.prepare(this.map.style.imageManager)}getIds(){return this._inViewTiles.getAllIds(!0)}getRenderableIds(t){return this._inViewTiles.getRenderableIds(this.projectedCamera?.bearingInRadians,t)}hasRenderableParent(t){let i=t.overscaledZ-1;if(i>=this._source.minzoom){let r=this.getLoadedTile(t.scaledTo(i));if(r)return this._inViewTiles.isIdRenderable(r.tileID.key)}return!1}reload(t,i=void 0){if(this._paused)this._shouldReloadOnResume=!0;else{this._outOfViewCache.reset();for(let r of this._inViewTiles.getAllIds()){let a=this._inViewTiles.getTileById(r);(!i||this._source.shouldReloadTile(a,i))&&(t?this._reloadTile(r,a.state==="errored"?"loading":"expired"):a.state!=="errored"&&this._reloadTile(r,"reloading"))}}}async _reloadTile(t,i){let r=this._inViewTiles.getTileById(t);if(!r)return;let a=r.hasData();r.state!=="loading"&&(r.state=i),await this._loadTile(r,t,i,a)}_tileLoaded(t,i,r,a,o){a||(t.timeAdded=Fe(),t.selfFading&&(t.fadeEndTime=t.timeAdded+this._rasterFadeDuration)),r==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(i,t),o?.unmodified||(this.getSource().type==="raster-dem"&&t.dem&&MI(t,this._inViewTiles),t.featureStateRevision=-1,this._state.initializeTileState(t,this.style),t.aborted||this._source.fire(new He("data",{tile:t,coord:t.tileID})))}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._inViewTiles.getTileById(t)}_retainLoadedChildren(t,i){let r=this._getLoadedDescendents(i),a=new Set;for(let o of i){let n=r[o.key];if(!n?.length){a.add(o);continue}let s=o.overscaledZ+e.maxOverzooming,l=n.filter((h)=>h.tileID.overscaledZ<=s);if(!l.length){a.add(o);continue}let u=Math.min(...l.map((h)=>h.tileID.overscaledZ)),c=l.filter((h)=>h.tileID.overscaledZ===u).map((h)=>h.tileID);for(let h of c)t[h.key]=h;this._areDescendentsComplete(c,u,o.overscaledZ)||a.add(o)}return a}_getLoadedDescendents(t){let i={};for(let r of this._inViewTiles.getAllTiles().filter((a)=>a.hasData()))for(let a of t)r.tileID.isChildOf(a)&&(i[a.key]||=[],i[a.key].push(r));return i}_areDescendentsComplete(t,i,r){return t.length===1&&t[0].isOverscaled()?t[0].overscaledZ===i:4**(i-r)===t.length}getLoadedTile(t){return this._inViewTiles.getLoadedTile(t)}updateCacheSize(t){let i=(Math.ceil(t.width/this._source.tileSize)+1)*(Math.ceil(t.height/this._source.tileSize)+1),r=this._maxTileCacheZoomLevels===null?Ma.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels,a=Math.floor(i*r),o=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,a):a;this._outOfViewCache.setMaxSize(o)}handleWrapJump(t){let i=(t-(this._prevLng===void 0?t:this._prevLng))/360,r=Math.round(i);this._prevLng=t,r&&(this._inViewTiles.handleWrapJump(r),this._resetTileReloadTimers())}_updateMaxContentElevation(){let t=this._maxContentElevationSeen,i=this.map?.style?._layers;if(!i)return t;let r=this._inViewTiles.getAllTiles();for(let a in i){let o=i[a];if(o.type!=="symbol"||o.source!==this.id||o.isHidden(this.projectedCamera.zoom))continue;let n=o;if(!n.layout)continue;let s=n.layout.get("symbol-height-offset");if(t=Math.max(t,s.constantOr(0)),!s.isConstant())for(let l of r){let u=l.getBucket(o);u&&u.maxHeightOffset>t&&(t=u.maxHeightOffset)}}return this._maxContentElevationSeen=t,t}update(t,i,r){if(!this._sourceLoaded||this._paused)return;this.projectedCamera=t,this.worldCoordinateHelper=i,this.terrain=r,this.updateCacheSize(t),i.wraps&&this.handleWrapJump(this.projectedCamera.center.lng);let a;!this.used&&!this.usedForTerrain?a=[]:this._source.tileID?a=V(t).getVisibleUnwrappedCoordinates(t,i,this._source.tileID).map((u)=>new Et(u.canonical.z,u.wrap,u.canonical.z,u.canonical.x,u.canonical.y)):(a=vs(t,i,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.type==="vector"&&this.map._zoomLevelsToOverscale!==void 0?Math.max(this._source.maxzoom,t.maxZoom-this.map._zoomLevelsToOverscale):this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:r,calculateTileZoom:this._source.calculateTileZoom,maxContentElevation:this._updateMaxContentElevation()}),this._source.hasTile&&(a=a.filter((u)=>this._source.hasTile(u)))),this.usedForTerrain&&(a=this._addTerrainIdealTiles(a));let o=a.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,o&&this.fire(new He("data",{sourceDataType:"idle",sourceId:this.id}));let n=Zf(t,this._source),s=this._updateRetainedTiles(a,n),l=t_(this._source.type);l&&this._rasterFadeDuration>0&&!r&&EI(this._inViewTiles,a,s,this._maxFadingAncestorLevels,this._source.minzoom,this._source.maxzoom,this._rasterFadeDuration),l?this._cleanUpRasterTiles(s):this._cleanUpVectorTiles(s)}_cleanUpRasterTiles(t){for(let i of this._inViewTiles.getAllIds())t[i]||this._removeTile(i)}_cleanUpVectorTiles(t){for(let i of this._inViewTiles.getAllIds()){let r=this._inViewTiles.getTileById(i);t[i]?r.clearSymbolFadeHold():r.hasSymbolBuckets?r.holdingForSymbolFade()?r.symbolFadeFinished()&&this._removeTile(i):r.setSymbolHoldDuration(this.map._fadeDuration):this._removeTile(i)}}_addTerrainIdealTiles(t){let i=[];for(let r of t)if(r.canonical.z>this._source.minzoom){let a=r.scaledTo(r.canonical.z-1);i.push(a);let o=r.scaledTo(Math.max(this._source.minzoom,Math.min(r.canonical.z,5)));i.push(o)}return t.concat(i)}releaseSymbolFadeTiles(){for(let t of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(t).holdingForSymbolFade()&&this._removeTile(t)}_updateRetainedTiles(t,i){let r=new Set;for(let l of t)this._addTile(l).hasData()||r.add(l);let a=t.reduce((l,u)=>(l[u.key]=u,l),{}),o=this._retainLoadedChildren(a,r),n={},s=Math.max(i-e.maxUnderzooming,this._source.minzoom);for(let l of o){let u=this._inViewTiles.getTileById(l.key),c=u?.wasRequested();for(let h=l.overscaledZ-1;h>=s;--h){let d=l.scaledTo(h);if(n[d.key])break;if(n[d.key]=!0,u=this.getTile(d),!u&&c&&(u=this._addTile(d)),u){let p=u.hasData();if((p||!this.map?.cancelPendingTileRequestsWhileZooming||c)&&(a[d.key]=d),c=u.wasRequested(),p)break}}}return a}_addTile(t){let i=this._inViewTiles.getTileById(t.key);if(i)return i;i=this._outOfViewCache.getAndRemove(t),i&&(i.resetFadeLogic(),this._setTileReloadTimer(t.key,i),i.tileID=t,this._state.initializeTileState(i,this.style));let r=i;return i||(i=new lb(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(i,t.key,i.state,!1)),i.uses++,this._inViewTiles.setTile(t.key,i),r||this._source.fire(new He("dataloading",{tile:i,coord:i.tileID})),i}_setTileReloadTimer(t,i){this._clearTileReloadTimer(t);let r=i.getExpiryTimeout();if(r){let a=()=>{this._reloadTile(t,"expired"),delete this._timers[t]};this._timers[t]=setTimeout(a,r)}}_clearTileReloadTimer(t){let i=this._timers[t];i&&(clearTimeout(i),delete this._timers[t])}_resetTileReloadTimers(){for(let t in this._timers)clearTimeout(this._timers[t]),delete this._timers[t];for(let t of this._inViewTiles.getAllIds()){let i=this._inViewTiles.getTileById(t);this._setTileReloadTimer(t,i)}}refreshTiles(t){for(let i of this._inViewTiles.getAllIds()){let r=this._inViewTiles.getTileById(i);(this._inViewTiles.isIdRenderable(i)||r.state=="errored")&&t.some((a)=>a.equals(r.tileID.canonical))&&this._reloadTile(i,"expired")}}_removeTile(t){let i=this._inViewTiles.getTileById(t);i&&(i.uses--,this._inViewTiles.deleteTileById(t),this._clearTileReloadTimer(t),i.uses>0||(i.hasData()&&i.state!=="reloading"?this._outOfViewCache.add(i.tileID,i,i.getExpiryTimeout()):(i.aborted=!0,this._abortTile(i),this._unloadTile(i))))}_dataHandler(t){t.dataType==="source"&&(t.sourceDataType==="metadata"?this._sourceLoaded=!0:t.sourceDataType==="content"&&this._sourceLoaded&&!this._paused&&(this.reload(t.sourceDataChanged,t.shouldReloadTileOptions),this.projectedCamera&&this.update(this.projectedCamera,this.worldCoordinateHelper,this.terrain),this._didEmitContent=!0))}resetMaxContentElevation(){this._maxContentElevationSeen=0}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1,this.resetMaxContentElevation();for(let t of this._inViewTiles.getAllIds())this._removeTile(t);this._outOfViewCache.reset()}tilesIn(t,i,r,a=this.projectedCamera,o=this.worldCoordinateHelper){let n=[];if(!a)return n;let s=Wf(a).allowWorldCopies(),l=r?V(a).getCameraQueryGeometry(a,t):t,u=(f)=>V(a).screenPointToMercatorCoordinate(a,o,f,this.terrain),c=this.transformBbox(t,u,!s),h=this.transformBbox(l,u,!s),d=this.getIds(),p=Yi.fromPoints(h);for(let f of d){let m=this._inViewTiles.getTileById(f);if(m.holdingForSymbolFade())continue;let g=s?[m.tileID]:[m.tileID.unwrapTo(-1),m.tileID.unwrapTo(0)],_=2**(a.zoom-m.tileID.overscaledZ),y=i*m.queryPadding*z/m.tileSize/_;for(let v of g){let x=p.map((b)=>v.getTilePoint(new Ot(b.x,b.y)));if(x.expandBy(y),x.intersects(OT)){let b=c.map((T)=>v.getTilePoint(T)),w=h.map((T)=>v.getTilePoint(T));n.push({tile:m,tileID:s?v:v.unwrapTo(0),queryGeometry:b,cameraQueryGeometry:w,scale:_})}}}return n}transformBbox(t,i,r){let a=t.map(i);if(r){let o=Yi.fromPoints(t);o.shrinkBy(Math.min(o.width(),o.height())*0.001);let n=o.map(i),s=Yi.fromPoints(a);s.width()>o_&&!s.covers(n)&&(a=a.map((l)=>l.x>o_?new Ot(l.x-1,l.y,l.z):l))}return a}getVisibleCoordinates(t){return this.getRenderableIds(t).map((i)=>this._inViewTiles.getTileById(i).tileID)}hasTransition(){return this._source.hasTransition()?!0:t_(this._source.type)&&AI(this._inViewTiles,this._rasterFadeDuration)}setRasterFadeDuration(t){this._rasterFadeDuration=t}setFeatureState(t,i,r){t||=zl,this._state.updateState(t,i,r)}removeFeatureState(t,i,r){t||=zl,this._state.removeFeatureState(t,i,r)}getFeatureState(t,i){return t||=zl,this._state.getState(t,i)}setDependencies(t,i,r){let a=this._inViewTiles.getTileById(t);a&&a.setDependencies(i,r)}reloadTilesForDependencies(t,i){for(let r of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(r).hasDependency(t,i)&&this._reloadTile(r,"reloading");this._outOfViewCache.filter((r)=>!r.hasDependency(t,i))}areTilesLoaded(){for(let t of this._inViewTiles.getAllTiles())if(t.state!=="loaded"&&t.state!=="errored")return!1;return!0}};II=Lo();BI=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);UI=wC.members.find((e)=>e.name==="crossTileID").offset/4;f_=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],et=new Uint32Array(96);gn=512/z/2,dr={prelude:Te(r7,a7),projectionMercator:Te(`
177
+ void clipAntimeridian() {}`,"float projectLineThickness(float tileY) {return 1.0;}float projectCircleRadius(float tileY) {return 1.0;}vec4 projectTile(vec2 p) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);return result;}vec4 projectTile(vec2 p,vec2 rawPos) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);if (rawPos.y <-32767.5 || rawPos.y > 32766.5) {result.z=-10000000.0;}return result;}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_projection_matrix*vec4(posInTile,elevation,1.0);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {return projectTileWithElevation(posInTile,elevation);}"),projectionGlobe:Te("in highp float v_projection_tile_x;void clipAntimeridian() {if (u_projection_clip_antimeridian !=0 && (v_projection_tile_x < 0.0 || v_projection_tile_x >=8192.0)) {discard;}}",`#define GLOBE_RADIUS 6371008.8
178
+ #ifndef PROJECTION_UBO
179
+ uniform highp vec4 u_projection_tile_mercator_coords;uniform highp vec4 u_projection_clipping_plane;uniform highp float u_projection_transition;uniform mat4 u_projection_fallback_matrix;
180
+ #endif
181
+ out highp float v_projection_tile_x;vec3 globeRotateVector(vec3 vec,vec2 angles) {vec3 axisRight=vec3(vec.z,0.0,-vec.x);vec3 axisUp=cross(axisRight,vec);axisRight=normalize(axisRight);axisUp=normalize(axisUp);vec2 t=tan(angles);return normalize(vec+axisRight*t.x+axisUp*t.y);}mat3 globeGetRotationMatrix(vec3 spherePos) {vec3 axisRight=vec3(spherePos.z,0.0,-spherePos.x);vec3 axisDown=cross(axisRight,spherePos);axisRight=normalize(axisRight);axisDown=normalize(axisDown);return mat3(axisRight,axisDown,spherePos
182
+ );}float circumferenceRatioAtTileY(float tileY) {float mercator_pos_y=u_projection_tile_mercator_coords.y+u_projection_tile_mercator_coords.w*tileY;float t=exp(PI-(mercator_pos_y*PI*2.0));return (2.0*t)/(t*t+1.0);}float projectLineThickness(float tileY) {float thickness=1.0/circumferenceRatioAtTileY(tileY);if (u_projection_transition < 0.999) {return mix(1.0,thickness,u_projection_transition);} else {return thickness;}}vec3 projectToSphere(vec2 translatedPos,vec2 rawPos) {vec2 mercator_pos=u_projection_tile_mercator_coords.xy+u_projection_tile_mercator_coords.zw*translatedPos;float spherical_x=mercator_pos.x*PI*2.0+PI;float t=exp(PI-(mercator_pos.y*PI*2.0));float t2=t*t;float denom=t2+1.0;float sin_sy=(t2-1.0)/denom;float cos_sy=(2.0*t)/denom;vec3 pos=vec3(sin(spherical_x)*cos_sy,sin_sy,cos(spherical_x)*cos_sy
183
+ );if (rawPos.y <-32767.5) {pos=vec3(0.0,1.0,0.0);}if (rawPos.y > 32766.5) {pos=vec3(0.0,-1.0,0.0);}return pos;}vec3 projectToSphere(vec2 posInTile) {return projectToSphere(posInTile,vec2(0.0,0.0));}float globeComputeClippingZ(vec3 spherePos) {return (1.0-(dot(spherePos,u_projection_clipping_plane.xyz)+u_projection_clipping_plane.w));}vec4 interpolateProjection(vec2 posInTile,vec3 spherePos,float elevation) {v_projection_tile_x=posInTile.x;vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);globePosition.z=globeComputeClippingZ(elevatedPos)*globePosition.w;if (u_projection_transition > 0.999) {return globePosition;}vec4 flatPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);const float z_globeness_threshold=0.2;vec4 result=globePosition;result.z=mix(0.0,globePosition.z,clamp((u_projection_transition-z_globeness_threshold)/(1.0-z_globeness_threshold),0.0,1.0));result.xyw=mix(flatPosition.xyw,globePosition.xyw,u_projection_transition);if ((posInTile.y <-32767.5) || (posInTile.y > 32766.5)) {result=globePosition;const float poles_hidden_anim_percentage=0.02;result.z=mix(globePosition.z,100.0,pow(max((1.0-u_projection_transition)/poles_hidden_anim_percentage,0.0),8.0));}return result;}vec4 interpolateProjectionFor3D(vec2 posInTile,vec3 spherePos,float elevation) {v_projection_tile_x=posInTile.x;vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);if (u_projection_transition > 0.999) {return globePosition;}vec4 fallbackPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);return mix(fallbackPosition,globePosition,u_projection_transition);}vec4 projectTile(vec2 posInTile) {return interpolateProjection(posInTile,projectToSphere(posInTile),0.0);}vec4 projectTile(vec2 posInTile,vec2 rawPos) {return interpolateProjection(posInTile,projectToSphere(posInTile,rawPos),0.0);}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return interpolateProjection(posInTile,projectToSphere(posInTile),elevation);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {vec3 spherePos=projectToSphere(posInTile,posInTile);return interpolateProjectionFor3D(posInTile,spherePos,elevation);}`),background:Te(o7,n7),backgroundPattern:Te(s7,l7),circle:Te(u7,c7),clippingMask:Te(g_,"layout(location=0) in vec2 a_pos;void main() {gl_Position=projectTile(a_pos,a_pos);}"),heatmap:Te(`uniform highp float u_intensity;in vec2 v_extrude;
184
+ #pragma maplibre: define highp float weight
185
+ #define GAUSS_COEF 0.3989422804014327
186
+ void main() {
187
+ #pragma maplibre: initialize highp float weight
188
+ float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);fragColor=vec4(val,1.0,1.0,1.0);
189
+ #ifdef OVERDRAW_INSPECTOR
190
+ fragColor=vec4(1.0);
191
+ #endif
192
+ }`,`uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;uniform highp float u_globe_extrude_scale;layout(location=0) in ivec2 a_pos;out vec2 v_extrude;
193
+ #pragma maplibre: define highp float weight
194
+ #pragma maplibre: define mediump float radius
195
+ const highp float ZERO=1.0/255.0/16.0;
196
+ #define GAUSS_COEF 0.3989422804014327
197
+ void main(void) {
198
+ #pragma maplibre: initialize highp float weight
199
+ #pragma maplibre: initialize mediump float radius
200
+ ivec2 pos_raw=a_pos+32768;vec2 unscaled_extrude=vec2(pos_raw & 7)/7.0*2.0-1.0;float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 circle_center=vec2(pos_raw >> 3);
201
+ #ifdef GLOBE
202
+ vec2 angles=v_extrude*radius*u_globe_extrude_scale;vec3 center_vector=projectToSphere(circle_center);vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(circle_center+extrude,corner_vector,0.0);
203
+ #else
204
+ gl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center));
205
+ #endif
206
+ }`),heatmapTexture:Te(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));fragColor=color*u_opacity;
207
+ #ifdef OVERDRAW_INSPECTOR
208
+ fragColor=vec4(0.0);
209
+ #endif
210
+ }`,"uniform mat4 u_matrix;layout(location=0) in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world_size,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:Te("in float v_placed;in float v_notUsed;void main() {float alpha=0.5;fragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {fragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {fragColor*=.1;}}","layout(location=0) in vec2 a_anchor_pos;layout(location=1) in vec2 a_placed;layout(location=2) in vec2 a_box_real;out float v_placed;out float v_notUsed;void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:Te("in float v_radius;in vec2 v_extrude;in float v_collision;void main() {float alpha=0.5;float stroke_radius=0.9;float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);fragColor=color*alpha*opacity_t;}","layout(location=0) in vec2 a_pos;layout(location=1) in float a_radius;layout(location=2) in vec2 a_flags;out float v_radius;out vec2 v_extrude;out float v_collision;void main() {float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_collision=collision;gl_Position=vec4((a_pos/u_viewport_size*2.0-1.0)*vec2(1.0,-1.0),0.0,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),colorRelief:Te(`#ifdef GL_ES
211
+ precision highp float;
212
+ #endif
213
+ uniform sampler2D u_image;uniform vec4 u_unpack;uniform sampler2D u_elevation_stops;uniform sampler2D u_color_stops;uniform int u_color_ramp_size;uniform float u_opacity;in vec2 v_pos;float getElevation(vec2 coord) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}float getElevationStop(int stop) {vec4 data=texelFetch(u_elevation_stops,ivec2(stop,0),0)*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {float el=getElevation(v_pos);int r=(u_color_ramp_size-1);int l=0;float el_l=getElevationStop(l);float el_r=getElevationStop(r);while(r-l > 1){int m=(r+l)/2;float el_m=getElevationStop(m);if(el < el_m){r=m;el_r=el_m;}else
214
+ {l=m;el_l=el_m;}}float x=(float(l)+(el-el_l)/(el_r-el_l)+0.5)/float(u_color_ramp_size);fragColor=u_opacity*texture(u_color_stops,vec2(x,0));
215
+ #ifdef OVERDRAW_INSPECTOR
216
+ fragColor=vec4(1.0);
217
+ #endif
218
+ }`,"uniform vec2 u_dimension;layout(location=0) in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);highp vec2 epsilon=2.0/u_dimension;float scale=(u_dimension.x-4.0)/u_dimension.x;v_pos=(a_pos/8192.0)*scale+epsilon;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),debug:Te("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);fragColor=mix(u_color,overlay_color,overlay_color.a);}","layout(location=0) in vec2 a_pos;out vec2 v_uv;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=projectTileWithElevation(a_pos*u_overlay_scale,get_elevation(a_pos));}"),depth:Te(g_,`layout(location=0) in vec2 a_pos;void main() {
219
+ #ifdef GLOBE
220
+ gl_Position=projectTileFor3D(a_pos,0.0);
221
+ #else
222
+ gl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0);
223
+ #endif
224
+ }`),fill:Te(`#pragma maplibre: define highp vec4 color
225
+ #pragma maplibre: define lowp float opacity
226
+ void main() {
227
+ #pragma maplibre: initialize highp vec4 color
228
+ #pragma maplibre: initialize lowp float opacity
229
+ fragColor=color*opacity;
230
+ #ifdef OVERDRAW_INSPECTOR
231
+ fragColor=vec4(1.0);
232
+ #endif
233
+ }`,`uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;
234
+ #pragma maplibre: define highp vec4 color
235
+ #pragma maplibre: define lowp float opacity
236
+ void main() {
237
+ #pragma maplibre: initialize highp vec4 color
238
+ #pragma maplibre: initialize lowp float opacity
239
+ if (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}gl_Position=projectTile(a_pos+u_fill_translate,a_pos);}`),fillOutline:Te(`in vec2 v_pos;
240
+ #ifdef GLOBE
241
+ in float v_depth;
242
+ #endif
243
+ #pragma maplibre: define highp vec4 outline_color
244
+ #pragma maplibre: define lowp float opacity
245
+ void main() {
246
+ #pragma maplibre: initialize highp vec4 outline_color
247
+ #pragma maplibre: initialize lowp float opacity
248
+ float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=outline_color*(alpha*opacity);
249
+ #ifdef GLOBE
250
+ if (v_depth > 1.0) {discard;}
251
+ #endif
252
+ #ifdef OVERDRAW_INSPECTOR
253
+ fragColor=vec4(1.0);
254
+ #endif
255
+ }`,`uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;out vec2 v_pos;
256
+ #ifdef GLOBE
257
+ out float v_depth;
258
+ #endif
259
+ #pragma maplibre: define highp vec4 outline_color
260
+ #pragma maplibre: define lowp float opacity
261
+ void main() {
262
+ #pragma maplibre: initialize highp vec4 outline_color
263
+ #pragma maplibre: initialize lowp float opacity
264
+ if (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world_size;
265
+ #ifdef GLOBE
266
+ v_depth=gl_Position.z/gl_Position.w;
267
+ #endif
268
+ }`),fillOutlinePattern:Te(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;uniform bool u_sdf_pattern;in vec2 v_pos_a;in vec2 v_pos_b;in vec2 v_pos;
269
+ #ifdef GLOBE
270
+ in float v_depth;
271
+ #endif
272
+ #pragma maplibre: define lowp float opacity
273
+ #pragma maplibre: define highp vec4 color
274
+ #pragma maplibre: define lowp vec4 pattern_from
275
+ #pragma maplibre: define lowp vec4 pattern_to
276
+ void main() {
277
+ #pragma maplibre: initialize lowp float opacity
278
+ #pragma maplibre: initialize highp vec4 color
279
+ #pragma maplibre: initialize mediump vec4 pattern_from
280
+ #pragma maplibre: initialize mediump vec4 pattern_to
281
+ vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);if (u_sdf_pattern) {highp float sdf_edge=(256.0-64.0)/256.0;highp float sdf_gamma_a=max(fwidth(color1.a)*0.5,1.0/255.0/16.0);highp float sdf_gamma_b=max(fwidth(color2.a)*0.5,1.0/255.0/16.0);float sdf_alpha_a=smoothstep(sdf_edge-sdf_gamma_a,sdf_edge+sdf_gamma_a,color1.a);float sdf_alpha_b=smoothstep(sdf_edge-sdf_gamma_b,sdf_edge+sdf_gamma_b,color2.a);fragColor=mix(color*sdf_alpha_a,color*sdf_alpha_b,u_fade)*alpha*opacity;} else {fragColor=mix(color1,color2,u_fade)*alpha*opacity;}
282
+ #ifdef GLOBE
283
+ if (v_depth > 1.0) {discard;}
284
+ #endif
285
+ #ifdef OVERDRAW_INSPECTOR
286
+ fragColor=vec4(1.0);
287
+ #endif
288
+ }`,`uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;out vec2 v_pos;
289
+ #ifdef GLOBE
290
+ out float v_depth;
291
+ #endif
292
+ #pragma maplibre: define lowp float opacity
293
+ #pragma maplibre: define highp vec4 color
294
+ #pragma maplibre: define lowp vec4 pattern_from
295
+ #pragma maplibre: define lowp vec4 pattern_to
296
+ #pragma maplibre: define lowp float pixel_ratio_from
297
+ #pragma maplibre: define lowp float pixel_ratio_to
298
+ void main() {
299
+ #pragma maplibre: initialize lowp float opacity
300
+ #pragma maplibre: initialize highp vec4 color
301
+ #pragma maplibre: initialize mediump vec4 pattern_from
302
+ #pragma maplibre: initialize mediump vec4 pattern_to
303
+ #pragma maplibre: initialize lowp float pixel_ratio_from
304
+ #pragma maplibre: initialize lowp float pixel_ratio_to
305
+ if (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world_size;
306
+ #ifdef GLOBE
307
+ v_depth=gl_Position.z/gl_Position.w;
308
+ #endif
309
+ }`),fillPattern:Te(`#ifdef GL_ES
310
+ precision highp float;
311
+ #endif
312
+ uniform vec2 u_texsize;uniform float u_fade;uniform bool u_sdf_pattern;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;
313
+ #pragma maplibre: define lowp float opacity
314
+ #pragma maplibre: define highp vec4 color
315
+ #pragma maplibre: define lowp vec4 pattern_from
316
+ #pragma maplibre: define lowp vec4 pattern_to
317
+ void main() {
318
+ #pragma maplibre: initialize lowp float opacity
319
+ #pragma maplibre: initialize highp vec4 color
320
+ #pragma maplibre: initialize mediump vec4 pattern_from
321
+ #pragma maplibre: initialize mediump vec4 pattern_to
322
+ vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);if (u_sdf_pattern) {highp float sdf_edge=(256.0-64.0)/256.0;highp float sdf_gamma_a=max(fwidth(color1.a)*0.5,1.0/255.0/16.0);highp float sdf_gamma_b=max(fwidth(color2.a)*0.5,1.0/255.0/16.0);float sdf_alpha_a=smoothstep(sdf_edge-sdf_gamma_a,sdf_edge+sdf_gamma_a,color1.a);float sdf_alpha_b=smoothstep(sdf_edge-sdf_gamma_b,sdf_edge+sdf_gamma_b,color2.a);fragColor=mix(color*sdf_alpha_a,color*sdf_alpha_b,u_fade)*opacity;} else {fragColor=mix(color1,color2,u_fade)*opacity;}
323
+ #ifdef OVERDRAW_INSPECTOR
324
+ fragColor=vec4(1.0);
325
+ #endif
326
+ }`,`uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;
327
+ #pragma maplibre: define lowp float opacity
328
+ #pragma maplibre: define highp vec4 color
329
+ #pragma maplibre: define lowp vec4 pattern_from
330
+ #pragma maplibre: define lowp vec4 pattern_to
331
+ #pragma maplibre: define lowp float pixel_ratio_from
332
+ #pragma maplibre: define lowp float pixel_ratio_to
333
+ void main() {
334
+ #pragma maplibre: initialize lowp float opacity
335
+ #pragma maplibre: initialize highp vec4 color
336
+ #pragma maplibre: initialize mediump vec4 pattern_from
337
+ #pragma maplibre: initialize mediump vec4 pattern_to
338
+ #pragma maplibre: initialize lowp float pixel_ratio_from
339
+ #pragma maplibre: initialize lowp float pixel_ratio_to
340
+ if (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}`),fillExtrusion:Te(`in vec4 v_color;void main() {fragColor=v_color;
341
+ #ifdef OVERDRAW_INSPECTOR
342
+ fragColor=vec4(1.0);
343
+ #endif
344
+ }`,`uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;layout(location=1) in ivec4 a_normal_ed;
345
+ #ifdef TERRAIN3D
346
+ layout(location=2) in vec2 a_centroid;
347
+ #endif
348
+ out vec4 v_color;
349
+ #pragma maplibre: define highp float base
350
+ #pragma maplibre: define highp float height
351
+ #pragma maplibre: define highp vec4 color
352
+ void main() {
353
+ #pragma maplibre: initialize highp float base
354
+ #pragma maplibre: initialize highp float height
355
+ #pragma maplibre: initialize highp vec4 color
356
+ vec3 normal=vec3(a_normal_ed.xyz);float gradient_base=max(0.0,base);float gradient_height=max(0.0,height);
357
+ #ifdef TERRAIN3D
358
+ float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
359
+ #else
360
+ float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
361
+ #endif
362
+ base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=float(a_normal_ed.x & 1);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;
363
+ #ifdef GLOBE
364
+ vec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);
365
+ #else
366
+ gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);
367
+ #endif
368
+ float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;vec3 normalForLighting=normal/16384.0;float directional=clamp(dot(normalForLighting,u_lightpos),0.0,1.0);
369
+ #ifdef GLOBE
370
+ mat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition);
371
+ #endif
372
+ directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.z==0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+gradient_base)*pow(gradient_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;}`),fillExtrusionPattern:Te(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;in vec4 v_lighting;
373
+ #pragma maplibre: define lowp float base
374
+ #pragma maplibre: define lowp float height
375
+ #pragma maplibre: define lowp vec4 pattern_from
376
+ #pragma maplibre: define lowp vec4 pattern_to
377
+ #pragma maplibre: define lowp float pixel_ratio_from
378
+ #pragma maplibre: define lowp float pixel_ratio_to
379
+ void main() {
380
+ #pragma maplibre: initialize lowp float base
381
+ #pragma maplibre: initialize lowp float height
382
+ #pragma maplibre: initialize mediump vec4 pattern_from
383
+ #pragma maplibre: initialize mediump vec4 pattern_to
384
+ #pragma maplibre: initialize lowp float pixel_ratio_from
385
+ #pragma maplibre: initialize lowp float pixel_ratio_to
386
+ vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);fragColor=mixedColor*v_lighting;
387
+ #ifdef OVERDRAW_INSPECTOR
388
+ fragColor=vec4(1.0);
389
+ #endif
390
+ }`,`uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;layout(location=0) in vec2 a_pos;layout(location=1) in ivec4 a_normal_ed;
391
+ #ifdef TERRAIN3D
392
+ layout(location=2) in vec2 a_centroid;
393
+ #endif
394
+ #ifdef GLOBE
395
+ out vec3 v_sphere_pos;
396
+ #endif
397
+ out vec2 v_pos_a;out vec2 v_pos_b;out vec4 v_lighting;
398
+ #pragma maplibre: define lowp float base
399
+ #pragma maplibre: define lowp float height
400
+ #pragma maplibre: define lowp vec4 pattern_from
401
+ #pragma maplibre: define lowp vec4 pattern_to
402
+ #pragma maplibre: define lowp float pixel_ratio_from
403
+ #pragma maplibre: define lowp float pixel_ratio_to
404
+ void main() {
405
+ #pragma maplibre: initialize lowp float base
406
+ #pragma maplibre: initialize lowp float height
407
+ #pragma maplibre: initialize mediump vec4 pattern_from
408
+ #pragma maplibre: initialize mediump vec4 pattern_to
409
+ #pragma maplibre: initialize lowp float pixel_ratio_from
410
+ #pragma maplibre: initialize lowp float pixel_ratio_to
411
+ 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=vec3(a_normal_ed.xyz);float edgedistance=float(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;float gradient_base=max(0.0,base);float gradient_height=max(0.0,height);
412
+ #ifdef TERRAIN3D
413
+ float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
414
+ #else
415
+ float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
416
+ #endif
417
+ base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=float(a_normal_ed.x & 1);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;
418
+ #ifdef GLOBE
419
+ vec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);
420
+ #else
421
+ gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);
422
+ #endif
423
+ vec2 pos=a_normal_ed.x==1 && a_normal_ed.y==0 && a_normal_ed.z==16384
424
+ ? a_pos
425
+ : vec2(edgedistance,elevation*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.z==0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+gradient_base)*pow(gradient_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;}`),hillshadePrepare:Te(`#ifdef GL_ES
426
+ precision highp float;
427
+ #endif
428
+ uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;uniform float u_log2_world_width;float getElevation(ivec2 texel) {vec4 data=texelFetch(u_image,texel,0)*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {ivec2 pos=ivec2(gl_FragCoord.xy)+ivec2(1);float tileSize=u_dimension.x-4.0;float a=getElevation(pos+ivec2(-1,-1));float b=getElevation(pos+ivec2(0,-1));float c=getElevation(pos+ivec2(1,-1));float d=getElevation(pos+ivec2(-1,0));float e=getElevation(pos);float f=getElevation(pos+ivec2(1,0));float g=getElevation(pos+ivec2(-1,1));float h=getElevation(pos+ivec2(0,1));float i=getElevation(pos+ivec2(1,1));float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))*tileSize/pow(2.0,exaggeration+(3.0+u_log2_world_width-u_zoom));fragColor=clamp(vec4(deriv.x/8.0+128.0/255.0,deriv.y/8.0+128.0/255.0,1.0,1.0),0.0,1.0);
429
+ #ifdef OVERDRAW_INSPECTOR
430
+ fragColor=vec4(1.0);
431
+ #endif
432
+ }`,"uniform mat4 u_matrix;uniform vec2 u_dimension;layout(location=0) in vec2 a_pos;layout(location=1) in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:Te(`uniform sampler2D u_image;in highp vec2 v_pos;uniform vec2 u_latrange;uniform float u_exaggeration;uniform vec4 u_accent;uniform int u_method;uniform float u_altitudes[NUM_ILLUMINATION_SOURCES];uniform float u_azimuths[NUM_ILLUMINATION_SOURCES];uniform vec4 u_shadows[NUM_ILLUMINATION_SOURCES];uniform vec4 u_highlights[NUM_ILLUMINATION_SOURCES];
433
+ #define PI 3.141592653589793
434
+ #define STANDARD 0
435
+ #define COMBINED 1
436
+ #define IGOR 2
437
+ #define MULTIDIRECTIONAL 3
438
+ #define BASIC 4
439
+ float get_aspect(vec2 deriv){return deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);}void igor_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float aspect=get_aspect(deriv);float azimuth=u_azimuths[0]+PI;float slope_stength=atan(length(deriv))*2.0/PI;float aspect_strength=1.0-abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);float shadow_strength=slope_stength*aspect_strength;float highlight_strength=slope_stength*(1.0-aspect_strength);fragColor=u_shadows[0]*shadow_strength+u_highlights[0]*highlight_strength;}void standard_hillshade(vec2 deriv){float azimuth=u_azimuths[0]+PI;float slope=atan(0.625*length(deriv));float aspect=get_aspect(deriv);float intensity=u_exaggeration;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadows[0],u_highlights[0],shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);fragColor=accent_color*(1.0-shade_color.a)+shade_color;}void basic_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor=u_highlights[0]*(2.0*shade-1.0);}else
440
+ {fragColor=u_shadows[0]*(1.0-2.0*shade);}}void multidirectional_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;fragColor=vec4(0,0,0,0);for(int i=0; i < NUM_ILLUMINATION_SOURCES; i++){float cos_alt=cos(u_altitudes[i]);float sin_alt=sin(u_altitudes[i]);float cos_az=-cos(u_azimuths[i]);float sin_az=-sin(u_azimuths[i]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor+=u_highlights[i]*(2.0*shade-1.0)/float(NUM_ILLUMINATION_SOURCES);}else
441
+ {fragColor+=u_shadows[i]*(1.0-2.0*shade)/float(NUM_ILLUMINATION_SOURCES);}}}void combined_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=acos((sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv)));cang=clamp(cang,0.0,PI/2.0);float shade=cang*atan(length(deriv))*4.0/PI/PI;float highlight=(PI/2.0-cang)*atan(length(deriv))*4.0/PI/PI;fragColor=u_shadows[0]*shade+u_highlights[0]*highlight;}void main() {highp vec2 size=vec2(textureSize(u_image,0));highp vec2 texturePos=(v_pos*(size-2.0)+1.0)/size;vec4 pixel=texture(u_image,texturePos);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));vec2 deriv=(pixel.rg-128.0/255.0)*8.0/scaleFactor;if (u_method==BASIC) {basic_hillshade(deriv);} else if (u_method==COMBINED) {combined_hillshade(deriv);} else if (u_method==IGOR) {igor_hillshade(deriv);} else if (u_method==MULTIDIRECTIONAL) {multidirectional_hillshade(deriv);} else if (u_method==STANDARD) {standard_hillshade(deriv);} else {standard_hillshade(deriv);}
442
+ #ifdef OVERDRAW_INSPECTOR
443
+ fragColor=vec4(1.0);
444
+ #endif
445
+ }`,"uniform mat4 u_matrix;layout(location=0) in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);v_pos=a_pos/8192.0;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),line:Te(`in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;
446
+ #ifdef GLOBE
447
+ in float v_depth;
448
+ #endif
449
+ #pragma maplibre: define highp vec4 color
450
+ #pragma maplibre: define lowp float blur
451
+ #pragma maplibre: define lowp float opacity
452
+ void main() {
453
+ #pragma maplibre: initialize highp vec4 color
454
+ #pragma maplibre: initialize lowp float blur
455
+ #pragma maplibre: initialize lowp float opacity
456
+ clipAntimeridian();float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);fragColor=color*(alpha*opacity);
457
+ #ifdef GLOBE
458
+ if (v_depth > 1.0) {discard;}
459
+ #endif
460
+ #ifdef OVERDRAW_INSPECTOR
461
+ fragColor=vec4(1.0);
462
+ #endif
463
+ }`,`
464
+ #define scale 0.015873016
465
+ layout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;layout(location=2) in vec2 a_offset_normal;uniform vec2 u_translation;uniform mediump float u_ratio;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp float v_linesofar;
466
+ #ifdef GLOBE
467
+ out float v_depth;
468
+ #endif
469
+ #pragma maplibre: define highp vec4 color
470
+ #pragma maplibre: define lowp float blur
471
+ #pragma maplibre: define lowp float opacity
472
+ #pragma maplibre: define mediump float gapwidth
473
+ #pragma maplibre: define lowp float offset
474
+ #pragma maplibre: define mediump float width
475
+ void main() {
476
+ #pragma maplibre: initialize highp vec4 color
477
+ #pragma maplibre: initialize lowp float blur
478
+ #pragma maplibre: initialize lowp float opacity
479
+ #pragma maplibre: initialize mediump float gapwidth
480
+ #pragma maplibre: initialize lowp float offset
481
+ #pragma maplibre: initialize mediump float width
482
+ if (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(ivec2(a_data.xy)-128);v_linesofar=float((a_data.z >> 2u)+a_data.w*64u)*2.0;vec2 pos=vec2(a_pos_normal >> 1);mediump vec2 normal=vec2(a_pos_normal & 1);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 vec2 offset2=offset*a_offset_normal*scale*normal.y;float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
483
+ #ifdef GLOBE
484
+ v_depth=gl_Position.z/gl_Position.w;
485
+ #endif
486
+ #ifdef TERRAIN3D
487
+ v_gamma_scale=1.0;
488
+ #else
489
+ float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
490
+ #endif
491
+ v_width2=vec2(outset,inset);}`),lineGradient:Te(`uniform sampler2D u_image;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec2 v_uv;
492
+ #ifdef GLOBE
493
+ in float v_depth;
494
+ #endif
495
+ #pragma maplibre: define lowp float blur
496
+ #pragma maplibre: define lowp float opacity
497
+ void main() {
498
+ #pragma maplibre: initialize lowp float blur
499
+ #pragma maplibre: initialize lowp float opacity
500
+ clipAntimeridian();float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);fragColor=color*(alpha*opacity);
501
+ #ifdef GLOBE
502
+ if (v_depth > 1.0) {discard;}
503
+ #endif
504
+ #ifdef OVERDRAW_INSPECTOR
505
+ fragColor=vec4(1.0);
506
+ #endif
507
+ }`,`
508
+ #define scale 0.015873016
509
+ layout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;layout(location=2) in vec2 a_offset_normal;layout(location=3) in float a_uv_x;layout(location=4) in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform float u_image_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;
510
+ #ifdef GLOBE
511
+ out float v_depth;
512
+ #endif
513
+ #pragma maplibre: define lowp float blur
514
+ #pragma maplibre: define lowp float opacity
515
+ #pragma maplibre: define mediump float gapwidth
516
+ #pragma maplibre: define lowp float offset
517
+ #pragma maplibre: define mediump float width
518
+ void main() {
519
+ #pragma maplibre: initialize lowp float blur
520
+ #pragma maplibre: initialize lowp float opacity
521
+ #pragma maplibre: initialize mediump float gapwidth
522
+ #pragma maplibre: initialize lowp float offset
523
+ #pragma maplibre: initialize mediump float width
524
+ if (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(ivec2(a_data.xy)-128);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=vec2(a_pos_normal >> 1);mediump vec2 normal=vec2(a_pos_normal & 1);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 vec2 offset2=offset*a_offset_normal*scale*normal.y;float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
525
+ #ifdef GLOBE
526
+ v_depth=gl_Position.z/gl_Position.w;
527
+ #endif
528
+ #ifdef TERRAIN3D
529
+ v_gamma_scale=1.0;
530
+ #else
531
+ float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
532
+ #endif
533
+ v_width2=vec2(outset,inset);}`),linePattern:Te(`#ifdef GL_ES
534
+ precision highp float;
535
+ #endif
536
+ uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;in vec2 v_normal;in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;in float v_width;
537
+ #ifdef GLOBE
538
+ in float v_depth;
539
+ #endif
540
+ #pragma maplibre: define lowp vec4 pattern_from
541
+ #pragma maplibre: define lowp vec4 pattern_to
542
+ #pragma maplibre: define lowp float pixel_ratio_from
543
+ #pragma maplibre: define lowp float pixel_ratio_to
544
+ #pragma maplibre: define lowp float blur
545
+ #pragma maplibre: define lowp float opacity
546
+ void main() {
547
+ #pragma maplibre: initialize mediump vec4 pattern_from
548
+ #pragma maplibre: initialize mediump vec4 pattern_to
549
+ #pragma maplibre: initialize lowp float pixel_ratio_from
550
+ #pragma maplibre: initialize lowp float pixel_ratio_to
551
+ #pragma maplibre: initialize lowp float blur
552
+ #pragma maplibre: initialize lowp float opacity
553
+ clipAntimeridian();vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture(u_image,pos_a),texture(u_image,pos_b),u_fade);fragColor=color*alpha*opacity;
554
+ #ifdef GLOBE
555
+ if (v_depth > 1.0) {discard;}
556
+ #endif
557
+ #ifdef OVERDRAW_INSPECTOR
558
+ fragColor=vec4(1.0);
559
+ #endif
560
+ }`,`
561
+ #define scale 0.015873016
562
+ #define LINE_DISTANCE_SCALE 2.0
563
+ layout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;layout(location=2) in vec2 a_offset_normal;uniform vec2 u_translation;uniform mediump float u_ratio;out vec2 v_normal;out vec2 v_width2;out float v_linesofar;out float v_gamma_scale;out float v_width;
564
+ #ifdef GLOBE
565
+ out float v_depth;
566
+ #endif
567
+ #pragma maplibre: define lowp float blur
568
+ #pragma maplibre: define lowp float opacity
569
+ #pragma maplibre: define lowp float offset
570
+ #pragma maplibre: define mediump float gapwidth
571
+ #pragma maplibre: define mediump float width
572
+ #pragma maplibre: define lowp float floorwidth
573
+ #pragma maplibre: define lowp vec4 pattern_from
574
+ #pragma maplibre: define lowp vec4 pattern_to
575
+ #pragma maplibre: define lowp float pixel_ratio_from
576
+ #pragma maplibre: define lowp float pixel_ratio_to
577
+ void main() {
578
+ #pragma maplibre: initialize lowp float blur
579
+ #pragma maplibre: initialize lowp float opacity
580
+ #pragma maplibre: initialize lowp float offset
581
+ #pragma maplibre: initialize mediump float gapwidth
582
+ #pragma maplibre: initialize mediump float width
583
+ #pragma maplibre: initialize lowp float floorwidth
584
+ #pragma maplibre: initialize mediump vec4 pattern_from
585
+ #pragma maplibre: initialize mediump vec4 pattern_to
586
+ #pragma maplibre: initialize lowp float pixel_ratio_from
587
+ #pragma maplibre: initialize lowp float pixel_ratio_to
588
+ if (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(ivec2(a_data.xy)-128);float a_linesofar=float((a_data.z >> 2u)+a_data.w*64u)*LINE_DISTANCE_SCALE;vec2 pos=vec2(a_pos_normal >> 1);mediump vec2 normal=vec2(a_pos_normal & 1);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 vec2 offset2=offset*a_offset_normal*scale*normal.y;float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
589
+ #ifdef GLOBE
590
+ v_depth=gl_Position.z/gl_Position.w;
591
+ #endif
592
+ #ifdef TERRAIN3D
593
+ v_gamma_scale=1.0;
594
+ #else
595
+ float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
596
+ #endif
597
+ v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:Te(`uniform lowp float u_lineatlas_width;uniform sampler2D u_image;uniform float u_mix;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;
598
+ #ifdef GLOBE
599
+ in float v_depth;
600
+ #endif
601
+ #pragma maplibre: define highp vec4 color
602
+ #pragma maplibre: define lowp float blur
603
+ #pragma maplibre: define lowp float opacity
604
+ #pragma maplibre: define mediump float width
605
+ #pragma maplibre: define lowp float floorwidth
606
+ #pragma maplibre: define mediump vec4 dasharray_from
607
+ #pragma maplibre: define mediump vec4 dasharray_to
608
+ void main() {
609
+ #pragma maplibre: initialize highp vec4 color
610
+ #pragma maplibre: initialize lowp float blur
611
+ #pragma maplibre: initialize lowp float opacity
612
+ #pragma maplibre: initialize mediump float width
613
+ #pragma maplibre: initialize lowp float floorwidth
614
+ #pragma maplibre: initialize mediump vec4 dasharray_from
615
+ #pragma maplibre: initialize mediump vec4 dasharray_to
616
+ clipAntimeridian();float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture(u_image,v_tex_a).a;float sdfdist_b=texture(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);float sdfgamma=(u_lineatlas_width/256.0/u_device_pixel_ratio)/min(dasharray_from.w,dasharray_to.w);alpha*=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*opacity);
617
+ #ifdef GLOBE
618
+ if (v_depth > 1.0) {discard;}
619
+ #endif
620
+ #ifdef OVERDRAW_INSPECTOR
621
+ fragColor=vec4(1.0);
622
+ #endif
623
+ }`,`
624
+ #define scale 0.015873016
625
+ #define LINE_DISTANCE_SCALE 2.0
626
+ layout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;layout(location=2) in vec2 a_offset_normal;uniform vec2 u_translation;uniform mediump float u_ratio;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;out vec2 v_width2;out vec2 v_tex_a;out vec2 v_tex_b;out float v_gamma_scale;
627
+ #ifdef GLOBE
628
+ out float v_depth;
629
+ #endif
630
+ #pragma maplibre: define highp vec4 color
631
+ #pragma maplibre: define lowp float blur
632
+ #pragma maplibre: define lowp float opacity
633
+ #pragma maplibre: define mediump float gapwidth
634
+ #pragma maplibre: define lowp float offset
635
+ #pragma maplibre: define mediump float width
636
+ #pragma maplibre: define lowp float floorwidth
637
+ #pragma maplibre: define mediump vec4 dasharray_from
638
+ #pragma maplibre: define mediump vec4 dasharray_to
639
+ void main() {
640
+ #pragma maplibre: initialize highp vec4 color
641
+ #pragma maplibre: initialize lowp float blur
642
+ #pragma maplibre: initialize lowp float opacity
643
+ #pragma maplibre: initialize mediump float gapwidth
644
+ #pragma maplibre: initialize lowp float offset
645
+ #pragma maplibre: initialize mediump float width
646
+ #pragma maplibre: initialize lowp float floorwidth
647
+ #pragma maplibre: initialize mediump vec4 dasharray_from
648
+ #pragma maplibre: initialize mediump vec4 dasharray_to
649
+ if (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(ivec2(a_data.xy)-128);float a_linesofar=float((a_data.z >> 2u)+a_data.w*64u)*LINE_DISTANCE_SCALE;vec2 pos=vec2(a_pos_normal >> 1);mediump vec2 normal=vec2(a_pos_normal & 1);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 vec2 offset2=offset*a_offset_normal*scale*normal.y;float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
650
+ #ifdef GLOBE
651
+ v_depth=gl_Position.z/gl_Position.w;
652
+ #endif
653
+ #ifdef TERRAIN3D
654
+ v_gamma_scale=1.0;
655
+ #else
656
+ float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
657
+ #endif
658
+ float u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}`),lineGradientSDF:Te(`uniform sampler2D u_image;uniform sampler2D u_image_dash;uniform float u_mix;uniform lowp float u_lineatlas_width;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;in highp vec2 v_uv;
659
+ #ifdef GLOBE
660
+ in float v_depth;
661
+ #endif
662
+ #pragma maplibre: define lowp float blur
663
+ #pragma maplibre: define lowp float opacity
664
+ #pragma maplibre: define mediump float width
665
+ #pragma maplibre: define lowp float floorwidth
666
+ #pragma maplibre: define mediump vec4 dasharray_from
667
+ #pragma maplibre: define mediump vec4 dasharray_to
668
+ void main() {
669
+ #pragma maplibre: initialize lowp float blur
670
+ #pragma maplibre: initialize lowp float opacity
671
+ #pragma maplibre: initialize mediump float width
672
+ #pragma maplibre: initialize lowp float floorwidth
673
+ #pragma maplibre: initialize mediump vec4 dasharray_from
674
+ #pragma maplibre: initialize mediump vec4 dasharray_to
675
+ clipAntimeridian();float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);float sdfdist_a=texture(u_image_dash,v_tex_a).a;float sdfdist_b=texture(u_image_dash,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);float sdfgamma=(u_lineatlas_width/256.0)/min(dasharray_from.w,dasharray_to.w);float dash_alpha=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*dash_alpha*opacity);
676
+ #ifdef GLOBE
677
+ if (v_depth > 1.0) {discard;}
678
+ #endif
679
+ #ifdef OVERDRAW_INSPECTOR
680
+ fragColor=vec4(1.0);
681
+ #endif
682
+ }`,`
683
+ #define scale 0.015873016
684
+ #define LINE_DISTANCE_SCALE 2.0
685
+ layout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;layout(location=2) in vec2 a_offset_normal;layout(location=3) in float a_uv_x;layout(location=4) in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform float u_image_height;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;out vec2 v_tex_a;out vec2 v_tex_b;
686
+ #ifdef GLOBE
687
+ out float v_depth;
688
+ #endif
689
+ #pragma maplibre: define lowp float blur
690
+ #pragma maplibre: define lowp float opacity
691
+ #pragma maplibre: define mediump float gapwidth
692
+ #pragma maplibre: define lowp float offset
693
+ #pragma maplibre: define mediump float width
694
+ #pragma maplibre: define lowp float floorwidth
695
+ #pragma maplibre: define mediump vec4 dasharray_from
696
+ #pragma maplibre: define mediump vec4 dasharray_to
697
+ void main() {
698
+ #pragma maplibre: initialize lowp float blur
699
+ #pragma maplibre: initialize lowp float opacity
700
+ #pragma maplibre: initialize mediump float gapwidth
701
+ #pragma maplibre: initialize lowp float offset
702
+ #pragma maplibre: initialize mediump float width
703
+ #pragma maplibre: initialize lowp float floorwidth
704
+ #pragma maplibre: initialize mediump vec4 dasharray_from
705
+ #pragma maplibre: initialize mediump vec4 dasharray_to
706
+ if (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(ivec2(a_data.xy)-128);float a_linesofar=float((a_data.z >> 2u)+a_data.w*64u)*LINE_DISTANCE_SCALE;float texel_height=1.0/u_image_height;float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=vec2(a_pos_normal >> 1);mediump vec2 normal=vec2(a_pos_normal & 1);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 vec2 offset2=offset*a_offset_normal*scale*normal.y;float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
707
+ #ifdef GLOBE
708
+ v_depth=gl_Position.z/gl_Position.w;
709
+ #endif
710
+ #ifdef TERRAIN3D
711
+ v_gamma_scale=1.0;
712
+ #else
713
+ float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
714
+ #endif
715
+ float u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}`),layerComposite:Te(`uniform sampler2D u_image;uniform float u_opacity;
716
+ #ifdef LAYER_BLEND
717
+ uniform sampler2D u_backdrop;uniform highp vec2 u_backdrop_offset;
718
+ #ifdef LAYER_BLEND_NONSEPARABLE
719
+ float lum(vec3 c) {return dot(c,vec3(0.3,0.59,0.11));}vec3 clipColor(vec3 c) {float l=lum(c);float n=min(min(c.r,c.g),c.b);float x=max(max(c.r,c.g),c.b);if (n < 0.0) c=l+(c-l)*l/(l-n);if (x > 1.0) c=l+(c-l)*(1.0-l)/(x-l);return c;}vec3 setLum(vec3 c,float l) {return clipColor(c+(l-lum(c)));}
720
+ #endif
721
+ vec4 composite(vec4 src,vec4 dst) {vec3 co=vec3(0.0);float invDstA=1.0-dst.a;float invSrcA=1.0-src.a;
722
+ #ifdef LAYER_BLEND_MULTIPLY
723
+ co=invDstA*src.rgb+invSrcA*dst.rgb+src.rgb*dst.rgb;
724
+ #endif
725
+ #ifdef LAYER_BLEND_OVERLAY
726
+ vec3 cond=step(dst.a,2.0*dst.rgb);vec3 case1=invDstA*src.rgb+invSrcA*dst.rgb+2.0*dst.rgb*src.rgb;vec3 case2=src.rgb+dst.rgb+dst.a*src.rgb+src.a*dst.rgb-vec3(src.a*dst.a)-2.0*dst.rgb*src.rgb;co=mix(case1,case2,cond);
727
+ #endif
728
+ #ifdef LAYER_BLEND_NONSEPARABLE
729
+ vec3 cs=src.rgb/src.a;vec3 cb=dst.a > 0.0 ? dst.rgb/dst.a : vec3(0.0);
730
+ #ifdef LAYER_BLEND_COLOR
731
+ vec3 blended=setLum(cs,lum(cb));
732
+ #else
733
+ vec3 blended=setLum(cb,lum(cs));
734
+ #endif
735
+ co=invDstA*src.rgb+invSrcA*dst.rgb+src.a*dst.a*blended;
736
+ #endif
737
+ return vec4(co,src.a+dst.a*invSrcA);}
738
+ #endif
739
+ void main() {ivec2 texel=ivec2(gl_FragCoord.xy);
740
+ #ifdef OVERDRAW_INSPECTOR
741
+ fragColor=texelFetch(u_image,texel,0);
742
+ #else
743
+ vec4 src=texelFetch(u_image,texel,0)*u_opacity;if (src.a==0.0) {discard;}
744
+ #ifdef LAYER_BLEND
745
+ vec4 dst=texelFetch(u_backdrop,texel-ivec2(u_backdrop_offset),0);fragColor=composite(src,dst);
746
+ #else
747
+ fragColor=src;
748
+ #endif
749
+ #endif
750
+ }`,"layout(location=0) in vec2 a_pos;void main() {gl_Position=vec4(a_pos.x*2.0-1.0,1.0-a_pos.y*2.0,0.0,1.0);}"),raster:Te(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;in vec3 v_pos0;in vec3 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture(u_image0,v_pos0.xy/v_pos0.z);vec4 color1=texture(u_image1,v_pos1.xy/v_pos1.z);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);fragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);
751
+ #ifdef OVERDRAW_INSPECTOR
752
+ fragColor=vec4(1.0);
753
+ #endif
754
+ }`,`uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;uniform vec3 u_image_warp;uniform vec4 u_coords_top;uniform vec4 u_coords_bottom;layout(location=0) in vec2 a_pos;out vec3 v_pos0;out vec3 v_pos1;void main() {vec2 fractionalPos=a_pos/8192.0;vec2 topLeft=u_coords_top.xy;vec2 topRight=u_coords_top.zw;vec2 bottomLeft=u_coords_bottom.xy;vec2 bottomRight=u_coords_bottom.zw;vec2 bilinearPos=mix(mix(topLeft,topRight,fractionalPos.x),mix(bottomLeft,bottomRight,fractionalPos.x),fractionalPos.y);float denominator=dot(u_image_warp.xy,fractionalPos)+1.0;vec2 acrossTop=topRight-topLeft+u_image_warp.x*topRight;vec2 downLeft=bottomLeft-topLeft+u_image_warp.y*bottomLeft;vec2 projectivePos=(acrossTop*fractionalPos.x+downLeft*fractionalPos.y+topLeft)/denominator;vec2 position=mix(projectivePos,bilinearPos,u_image_warp.z);gl_Position=projectTile(position,position);vec2 texturePos=((fractionalPos-0.5)/u_buffer_scale)+0.5;
755
+ #ifdef GLOBE
756
+ if (a_pos.y <-32767.5) {texturePos.y=0.0;}if (a_pos.y > 32766.5) {texturePos.y=1.0;}
757
+ #endif
758
+ float perspectiveRatio=mix(1.0/denominator,1.0,u_image_warp.z);v_pos0=vec3(texturePos*perspectiveRatio,perspectiveRatio);vec2 parentPos=(texturePos*u_scale_parent)+u_tl_parent;v_pos1=vec3(parentPos*perspectiveRatio,perspectiveRatio);}`),symbolIcon:Te(`uniform sampler2D u_texture;in vec2 v_tex;in float v_total_opacity;void main() {fragColor=texture(u_texture,v_tex)*v_total_opacity;
759
+ #ifdef OVERDRAW_INSPECTOR
760
+ fragColor=vec4(1.0);
761
+ #endif
762
+ }`,`layout(location=0) in vec4 a_pos_offset;layout(location=1) in uvec4 a_data;layout(location=2) in vec4 a_pixeloffset;layout(location=3) in vec3 a_projected_pos;layout(location=4) in uint a_fade_opacity;layout(location=5) in float a_height_offset;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 bool u_rotate_symbol;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;uniform bool u_is_offset;uniform bool u_height_anchor_ground;out vec2 v_tex;out float v_total_opacity;
763
+ #pragma maplibre: define lowp float opacity
764
+ void main() {
765
+ #pragma maplibre: initialize lowp float opacity
766
+ vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=vec2(a_data.xy);vec2 a_size=vec2(a_data.zw);float a_size_min=float(a_data.z >> 1u);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=a_height_offset+(u_height_anchor_ground ? get_elevation(a_pos) : 0.0);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=mix(-u_symbol_fade_change,u_symbol_fade_change,fade_opacity[1]);float visibility=calculate_visibility(projectedPoint);v_total_opacity=opacity*max(0.0,min(visibility,fade_opacity[0]+fade_change));if (v_total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
767
+ camera_to_anchor_distance/u_camera_to_center_distance :
768
+ u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);if (!u_is_offset) {size*=perspective_ratio;}float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;
769
+ #ifdef GLOBE
770
+ if(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}
771
+ #endif
772
+ vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;}`),symbolSDF:Te(`#define SDF_PX 8.0
773
+ uniform bool u_is_halo;uniform bool u_is_plain;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform bool u_is_text;in vec2 v_data0;in vec3 v_data1;
774
+ #pragma maplibre: define highp vec4 fill_color
775
+ #pragma maplibre: define highp vec4 halo_color
776
+ #pragma maplibre: define lowp float halo_width
777
+ #pragma maplibre: define lowp float halo_blur
778
+ void main() {
779
+ #pragma maplibre: initialize highp vec4 fill_color
780
+ #pragma maplibre: initialize highp vec4 halo_color
781
+ #pragma maplibre: initialize lowp float halo_width
782
+ #pragma maplibre: initialize lowp float halo_blur
783
+ 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 total_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;lowp float dist=texture(u_texture,tex).a;lowp vec4 color_alpha_out_text,color_alpha_out_halo;if (u_is_plain){highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);color_alpha_out_text=total_opacity*alpha*fill_color;}if (u_is_halo) {float gamma_halo=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);float inner_edge_halo=inner_edge+gamma_halo*gamma_scale;highp float gamma_scaled_halo=gamma_halo*gamma_scale;highp float alpha_halo=smoothstep(inner_edge_halo-gamma_scaled_halo,inner_edge_halo+gamma_scaled_halo,dist);highp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha_halo= min(smoothstep(halo_edge-gamma_scaled_halo,halo_edge+gamma_scaled_halo,dist),1.0-alpha_halo);color_alpha_out_halo=total_opacity*alpha_halo*halo_color;}if (u_is_plain && u_is_halo) {fragColor=color_alpha_out_text+(1.-color_alpha_out_text.a)*color_alpha_out_halo;} else if (u_is_halo){fragColor=color_alpha_out_halo;} else {fragColor=color_alpha_out_text;}
784
+ #ifdef OVERDRAW_INSPECTOR
785
+ fragColor=vec4(1.0);
786
+ #endif
787
+ }`,`layout(location=0) in vec4 a_pos_offset;layout(location=1) in uvec4 a_data;layout(location=2) in vec4 a_pixeloffset;layout(location=3) in vec3 a_projected_pos;layout(location=4) in uint a_fade_opacity;layout(location=5) in float a_height_offset;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform bool u_rotate_symbol;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;uniform bool u_is_offset;uniform bool u_height_anchor_ground;out vec2 v_data0;out vec3 v_data1;
788
+ #pragma maplibre: define highp vec4 fill_color
789
+ #pragma maplibre: define highp vec4 halo_color
790
+ #pragma maplibre: define lowp float opacity
791
+ #pragma maplibre: define lowp float halo_width
792
+ #pragma maplibre: define lowp float halo_blur
793
+ void main() {
794
+ #pragma maplibre: initialize highp vec4 fill_color
795
+ #pragma maplibre: initialize highp vec4 halo_color
796
+ #pragma maplibre: initialize lowp float opacity
797
+ #pragma maplibre: initialize lowp float halo_width
798
+ #pragma maplibre: initialize lowp float halo_blur
799
+ vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=vec2(a_data.xy);vec2 a_size=vec2(a_data.zw);float a_size_min=float(a_data.z >> 1u);vec2 a_pxoffset=a_pixeloffset.xy/16.0;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=a_height_offset+(u_height_anchor_ground ? get_elevation(a_pos) : 0.0);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=mix(-u_symbol_fade_change,u_symbol_fade_change,fade_opacity[1]);float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));float total_opacity=opacity*interpolated_fade_opacity;if (total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
800
+ camera_to_anchor_distance/u_camera_to_center_distance :
801
+ u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);if (!u_is_offset) {size*=perspective_ratio;}float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;
802
+ #ifdef GLOBE
803
+ if(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}
804
+ #endif
805
+ vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,total_opacity);}`),symbolTextAndIcon:Te(`#define SDF_PX 8.0
806
+ #define SDF 1.0
807
+ #define ICON 0.0
808
+ uniform bool u_is_halo;uniform bool u_is_text;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;in vec4 v_data0;in vec3 v_data1;in float v_is_sdf;
809
+ #pragma maplibre: define highp vec4 fill_color
810
+ #pragma maplibre: define highp vec4 halo_color
811
+ #pragma maplibre: define lowp float halo_width
812
+ #pragma maplibre: define lowp float halo_blur
813
+ void main() {
814
+ #pragma maplibre: initialize highp vec4 fill_color
815
+ #pragma maplibre: initialize highp vec4 halo_color
816
+ #pragma maplibre: initialize lowp float halo_width
817
+ #pragma maplibre: initialize lowp float halo_blur
818
+ float total_opacity=v_data1[2];if (v_is_sdf==ICON) {vec2 tex_icon=v_data0.zw;fragColor=texture(u_texture_icon,tex_icon)*total_opacity;
819
+ #ifdef OVERDRAW_INSPECTOR
820
+ fragColor=vec4(1.0);
821
+ #endif
822
+ 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;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;lowp float dist=texture(u_texture,tex).a;lowp vec4 color_alpha_out,color_alpha_out_halo;if (u_is_text) {highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);color_alpha_out=fill_color*(alpha*total_opacity);}if (u_is_halo) {highp float gamma_halo=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);lowp float buff_halo=(6.0-halo_width/fontScale)/SDF_PX;highp float gamma_scaled_halo=gamma_halo*gamma_scale;highp float alpha_halo=smoothstep(buff_halo-gamma_scaled_halo,buff_halo+gamma_scaled_halo,dist);color_alpha_out_halo=halo_color*(alpha_halo*total_opacity);}if (u_is_text && u_is_halo) {fragColor=color_alpha_out+(1.-color_alpha_out.a)*color_alpha_out_halo;} else if (u_is_halo) {fragColor=color_alpha_out_halo;} else {fragColor=color_alpha_out;}
823
+ #ifdef OVERDRAW_INSPECTOR
824
+ fragColor=vec4(1.0);
825
+ #endif
826
+ }`,`layout(location=0) in vec4 a_pos_offset;layout(location=1) in uvec4 a_data;layout(location=2) in vec3 a_projected_pos;layout(location=3) in uint a_fade_opacity;layout(location=4) in float a_height_offset;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;uniform bool u_is_offset;uniform bool u_height_anchor_ground;out vec4 v_data0;out vec3 v_data1;out float v_is_sdf;
827
+ #pragma maplibre: define highp vec4 fill_color
828
+ #pragma maplibre: define highp vec4 halo_color
829
+ #pragma maplibre: define lowp float opacity
830
+ #pragma maplibre: define lowp float halo_width
831
+ #pragma maplibre: define lowp float halo_blur
832
+ void main() {
833
+ #pragma maplibre: initialize highp vec4 fill_color
834
+ #pragma maplibre: initialize highp vec4 halo_color
835
+ #pragma maplibre: initialize lowp float opacity
836
+ #pragma maplibre: initialize lowp float halo_width
837
+ #pragma maplibre: initialize lowp float halo_blur
838
+ vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=vec2(a_data.xy);vec2 a_size=vec2(a_data.zw);float a_size_min=float(a_data.z >> 1u);float is_sdf=float(a_data.z & 1u);float ele=a_height_offset+(u_height_anchor_ground ? get_elevation(a_pos) : 0.0);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=mix(-u_symbol_fade_change,u_symbol_fade_change,fade_opacity[1]);float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));float total_opacity=opacity*interpolated_fade_opacity;if (total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
839
+ camera_to_anchor_distance/u_camera_to_center_distance :
840
+ u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);if (!u_is_offset) {size*=perspective_ratio;}float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;
841
+ #ifdef GLOBE
842
+ if(u_pitch_with_map && !u_is_along_line) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}
843
+ #endif
844
+ vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec3(gamma_scale,size,total_opacity);v_is_sdf=is_sdf;}`),terrain:Te("uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;uniform bool u_is_globe_mode;in vec2 v_texture_pos;in float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture(u_texture,vec2(v_texture_pos.x,1.0-v_texture_pos.y));if (!u_is_globe_mode && u_fog_ground_blend_opacity > 0.0 && v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);fragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {fragColor=surface_color;}}","layout(location=0) in vec3 a_pos3d;uniform mat4 u_fog_matrix;uniform float u_ele_delta;out vec2 v_texture_pos;out float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:Te("in float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {fragColor=pack(v_depth);}","layout(location=0) in vec3 a_pos3d;uniform float u_ele_delta;out float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);v_depth=gl_Position.z/gl_Position.w;}"),terrainHeight:Te("in highp float v_elevation;void main() {fragColor=vec4(v_elevation,0.0,0.0,1.0);}","layout(location=0) in vec3 a_pos3d;uniform vec4 u_tile_bounds;out highp float v_elevation;void main() {v_elevation=get_elevation(a_pos3d.xy);vec2 position=u_tile_bounds.xy+a_pos3d.xy/8192.0*u_tile_bounds.zw;gl_Position=vec4(position.x*2.0-1.0,1.0-position.y*2.0,0.0,1.0);}"),atmosphere:Te(`#ifdef GL_ES
845
+ precision highp float;
846
+ #endif
847
+ in vec3 view_direction;uniform vec3 u_sun_pos;uniform vec3 u_globe_position;uniform float u_globe_radius;uniform float u_atmosphere_blend;/**Shader use from https:*Made some change to adapt to MapLibre Globe geometry*/const float PI=3.141592653589793;const int iSteps=5;const int jSteps=3;/*radius of the planet*/const float EARTH_RADIUS=6371e3;/*radius of the atmosphere*/const float ATMOS_RADIUS=6471e3;vec2 rsi(vec3 r0,vec3 rd,float sr) {float a=dot(rd,rd);float b=2.0*dot(rd,r0);float c=dot(r0,r0)-(sr*sr);float d=(b*b)-4.0*a*c;if (d < 0.0) return vec2(1e5,-1e5);return vec2((-b-sqrt(d))/(2.0*a),(-b+sqrt(d))/(2.0*a));}vec4 atmosphere(vec3 r,vec3 r0,vec3 pSun,float iSun,float rPlanet,float rAtmos,vec3 kRlh,float kMie,float shRlh,float shMie,float g) {pSun=normalize(pSun);r=normalize(r);vec2 p=rsi(r0,r,rAtmos);if (p.x > p.y) {return vec4(0.0,0.0,0.0,1.0);}if (p.x < 0.0) {p.x=0.0;}vec3 pos=r0+r*p.x;vec2 p2=rsi(r0,r,rPlanet);if (p2.x <=p2.y && p2.x > 0.0) {p.y=min(p.y,p2.x);}float iStepSize=(p.y-p.x)/float(iSteps);float iTime=p.x+iStepSize*0.5;vec3 totalRlh=vec3(0,0,0);vec3 totalMie=vec3(0,0,0);float iOdRlh=0.0;float iOdMie=0.0;float mu=dot(r,pSun);float mumu=mu*mu;float gg=g*g;float pRlh=3.0/(16.0*PI)*(1.0+mumu);float pMie=3.0/(8.0*PI)*((1.0-gg)*(mumu+1.0))/(pow(1.0+gg-2.0*mu*g,1.5)*(2.0+gg));for (int i=0; i < iSteps; i++) {vec3 iPos=r0+r*iTime;float iHeight=length(iPos)-rPlanet;float odStepRlh=exp(-iHeight/shRlh)*iStepSize;float odStepMie=exp(-iHeight/shMie)*iStepSize;iOdRlh+=odStepRlh;iOdMie+=odStepMie;float jStepSize=rsi(iPos,pSun,rAtmos).y/float(jSteps);float jTime=jStepSize*0.5;float jOdRlh=0.0;float jOdMie=0.0;for (int j=0; j < jSteps; j++) {vec3 jPos=iPos+pSun*jTime;float jHeight=length(jPos)-rPlanet;jOdRlh+=exp(-jHeight/shRlh)*jStepSize;jOdMie+=exp(-jHeight/shMie)*jStepSize;jTime+=jStepSize;}vec3 attn=exp(-(kMie*(iOdMie+jOdMie)+kRlh*(iOdRlh+jOdRlh)));totalRlh+=odStepRlh*attn;totalMie+=odStepMie*attn;iTime+=iStepSize;}float opacity=exp(-(length(kRlh)*length(totalRlh)+kMie*length(totalMie)));vec3 color=iSun*(pRlh*kRlh*totalRlh+pMie*kMie*totalMie);return vec4(color,opacity);}void main() {vec3 scale_camera_pos=-u_globe_position*EARTH_RADIUS/u_globe_radius;vec4 color=atmosphere(normalize(view_direction),scale_camera_pos,u_sun_pos,22.0,EARTH_RADIUS,ATMOS_RADIUS,vec3(5.5e-6,13.0e-6,22.4e-6),21e-6,8e3,1.2e3,0.758
848
+ );color.rgb=1.0-exp(-1.0*color.rgb);color=pow(color,vec4(1.0/2.2));fragColor=vec4(color.rgb,1.0-color.a)*u_atmosphere_blend;}`,"layout(location=0) in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 view_direction;void main() {view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,0.0,1.0);}"),sky:Te("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform vec2 u_horizon;uniform vec2 u_horizon_normal;uniform float u_sky_horizon_blend;uniform float u_sky_blend;uniform vec3 u_globe_position;uniform float u_globe_radius;uniform float u_atmosphere_blend;in vec3 v_view_direction;const float ATMOSPHERE_HEIGHT_TO_GLOBE_RADIUS=100000.0/6371000.0;void main() {float x=gl_FragCoord.x;float y=gl_FragCoord.y;float blend=(y-u_horizon.y)*u_horizon_normal.y+(x-u_horizon.x)*u_horizon_normal.x;float opacity=1.0;if (u_sky_blend > 0.0) {vec3 ray=normalize(v_view_direction);float globe_distance=length(u_globe_position);float angle_to_globe_center=acos(clamp(dot(ray,u_globe_position)/globe_distance,-1.0,1.0));float horizon_angle=asin(min(u_globe_radius/globe_distance,1.0));blend=mix(blend,((angle_to_globe_center-horizon_angle)*u_camera_to_center_distance+1.0)*u_device_pixel_ratio,u_sky_blend);float closest_approach=max(dot(ray,u_globe_position),0.0);float lowest_altitude=sqrt(max(globe_distance*globe_distance-closest_approach*closest_approach,0.0))-u_globe_radius;float atmosphere_height=u_globe_radius*ATMOSPHERE_HEIGHT_TO_GLOBE_RADIUS;float inside_atmosphere=1.0-smoothstep(atmosphere_height,10.0*atmosphere_height,globe_distance-u_globe_radius);float through_atmosphere=1.0-smoothstep(0.0,atmosphere_height,lowest_altitude);opacity=inside_atmosphere*through_atmosphere*(1.0-u_atmosphere_blend);}if (blend > 0.0) {if (blend < u_sky_horizon_blend) {fragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {fragColor=u_sky_color;}}fragColor*=mix(1.0,opacity,u_sky_blend);}","layout(location=0) in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 v_view_direction;void main() {v_view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,1.0,1.0);}")};Oh=new Tf({fill:new Fr(128,2),line:new Fr(512,0),tile:new Fr(128,32),stencil:new Fr(128,1),circle:3}),__=class extends qe{constructor(e,t){super(),this._transitionable=new Gu(d7(),"projection",t),this.setProjection(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new Me(0)),this._mercatorProjection=new Ol,this._verticalPerspectiveProjection=new gb}get transitionState(){let e=this.properties.get("type");if(typeof e=="string"&&e==="mercator")return 0;if(typeof e=="string"&&e==="vertical-perspective")return 1;if(e instanceof la){if(e.from===e.to)return e.from==="mercator"?0:1;if(e.from==="vertical-perspective"&&e.to==="mercator")return 1-e.transition;if(e.from==="mercator"&&e.to==="vertical-perspective")return e.transition}return 1}get useGlobeRendering(){return this.transitionState>0}get currentProjection(){return this.useGlobeRendering?this._verticalPerspectiveProjection:this._mercatorProjection}get name(){return"globe"}get worldCoordinateHelper(){return this.currentProjection.worldCoordinateHelper}get useSubdivision(){return this.currentProjection.useSubdivision}get shaderVariantName(){return this.currentProjection.shaderVariantName}get shaderDefine(){return this.currentProjection.shaderDefine}get shaderPreludeCode(){return this.currentProjection.shaderPreludeCode}get vertexShaderPreludeCode(){return this.currentProjection.vertexShaderPreludeCode}get subdivisionGranularity(){return this.currentProjection.subdivisionGranularity}get useGlobeControls(){return this.transitionState>0}destroy(){this._mercatorProjection.destroy(),this._verticalPerspectiveProjection.destroy()}getMeshFromTileID(e,t,i,r,a){return this.currentProjection.getMeshFromTileID(e,t,i,r,a)}setProjection(e){this._transitionable.setValue("type",e?.type||"mercator")}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()||this.currentProjection.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}};f7=v6(),v_=class extends qe{constructor(e,t={}){super(),this._rtlPluginLoaded=()=>{for(let r in this.tileManagers){let a=this.tileManagers[r].getSource().type;(a==="vector"||a==="geojson")&&this.tileManagers[r].reload()}},this.map=e,this.dispatcher=new UA(Ql(),e._getMapId()).setEventedParent(this),this.dispatcher.registerMessageHandler("GG",(r,a)=>this.getGlyphs(r,a)),this.dispatcher.registerMessageHandler("GI",(r,a)=>this.getImages(r,a)),this.dispatcher.registerMessageHandler("GDA",(r,a)=>this.getDashes(r,a)),this.imageManager=new TA,this.imageManager.setEventedParent(this),this.imageManager.setMissingImageResolver(e._missingStyleImageResolver),this.patternAtlas=new EA(this.imageManager);let i=e._container?.lang||typeof document<"u"&&document.documentElement?.lang||void 0;this.glyphManager=new RA(e._requestManager,t.localIdeographFontFamily,i),this.lineAtlas=new $A(256,512),this.crossTileSymbolIndex=new i7,this._setInitialValues(),this._initialGlobalState=t.globalState??{},this._resetUpdates(),this.dispatcher.broadcast("SR",Op()),bp().on(xp,this._rtlPluginLoaded),this.on("data",(r)=>{if(r.dataType!=="source"||r.sourceDataType!=="metadata")return;let a=this.tileManagers[r.sourceId];if(!a)return;let o=a.getSource();if(o?.vectorLayerIds)for(let n in this._layers){let s=this._layers[n];s.source===o.id&&this._validateLayer(s)}})}_setInitialValues(){this._layers={},this._order=[],this.tileManagers={},this.zoomHistory=new _d,this._imagesListDirty=!1,this._initialGlobalState={},this._globalState={},this._serializedLayers={},this.stylesheet=null,this.light=null,this.sky=null,this.projection&&(this.projection.destroy(),delete this.projection),this._loaded=!1,this._changed=!1,this._updatedLayers={},this._updatedSources={},this._changedImages={},this._glyphsDidChange=!1,this._updatedPaintProps={},this._layerOrderChanged=!1,this._symbolPlacementTriggered=!1,this._placedProjectionTransition=void 0,this.crossTileSymbolIndex=new(this.crossTileSymbolIndex?.constructor||Object),this.pauseablePlacement=void 0,this.placement=void 0,this.z=0}setGlobalStateProperty(e,t){this._checkLoaded();let i=t===null?this.stylesheet.state?.[e]?.default??null:t;return this._setGlobalStateValues({[e]:i}),this}getGlobalState(){return this._globalState}setGlobalState(e){this._checkLoaded();let t={},i=new Set([...Object.keys(e??{}),...Object.keys(this._initialGlobalState)]);for(let r of i)t[r]=this._initialGlobalState[r]??e[r]?.default??null;this._setGlobalStateValues(t)}_setGlobalStateValues(e){let t=[];for(let r in e)lr(e[r],this._globalState[r])||t.push(r);if(t.length===0)return;let i={...this._globalState};for(let r of t)this._globalState[r]=e[r];this._applyGlobalStateChanges(t,i)}_applyGlobalStateChanges(e,t){let i=new Set,r={};for(let o of e)r[o]=this._globalState[o];for(let o in this._layers){let n=this._layers[o];n.retainPriorGlobalState(e,t);let s=n.getLayoutAffectingGlobalStateRefs(),l=n.getPaintAffectingGlobalStateRefs(),u=n.getVisibilityAffectingGlobalStateRefs();for(let c of e){if(s.has(c)&&i.add(n.source),l.has(c))for(let{name:h,value:d}of l.get(c))this._updatePaintProperty(n,h,d,{validate:!1});u?.has(c)&&(n.recalculateVisibility(),this._updateLayer(n))}}let a={now:Fe(),transition:this.getTransition()};this.light?.applyGlobalStateChange(e,t,a),this.sky?.applyGlobalStateChange(e,t,a),this.dispatcher.broadcast("UGS",r);for(let o in this.tileManagers)i.has(o)&&(this._reloadSource(o),this._changed=!0)}async loadURL(e,t={},i){this.fire(new qi("dataloading")),t.validate=typeof t.validate!="boolean"||t.validate,this._loadStyleRequest=new AbortController;let r=this._loadStyleRequest;try{let a=await this.map._requestManager.transformRequest(e,"Style");Ln(r.signal);let o=await Pu(a,r);this._loadStyleRequest===r&&(this._loadStyleRequest=null),this._load(o.data,t,i)}catch(a){this._loadStyleRequest===r&&(this._loadStyleRequest=null),a&&!r.signal.aborted&&this.fire(new ie(Mt(a)))}}loadJSON(e,t={},i){this.fire(new qi("dataloading")),this._frameRequest=new AbortController,li.frameAsync(this._frameRequest,this.map._ownerWindow).then(()=>{this._frameRequest=null,t.validate=t.validate!==!1,this._load(e,t,i)}).catch(()=>{})}loadEmpty(){this.fire(new qi("dataloading")),this._load(f7,{validate:!1})}_load(e,t,i){let r=t.transformStyle?t.transformStyle(i,e):e;if(t.validate&&y0(this,r))return;r={...r},this._loaded=!0,this.stylesheet=r,this.setGlobalState(this.stylesheet.state??null);let a=y_(this.stylesheet.projection?.type||"mercator",this._globalState);this.projection=a.projection;for(let o in r.sources)this.addSource(o,r.sources[o],{validate:!1});r.sprite?this._loadSprite(r.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(r.glyphs),this.glyphManager.setFontFaces(r["font-faces"]),this._createLayers(),this.light=new BA(this.stylesheet.light??{},this._globalState),this._applyProjection(a),this.sky=new NA(this.stylesheet.sky,this._globalState),this.sky.setEventedParent(this),this.map.setTerrain(this.stylesheet.terrain??null,{validate:!1}),this.fire(new qi("data")),this.fire(new g0)}_createLayers(){let e=Gg(this.stylesheet.layers);this.dispatcher.broadcast("SL",e),this._order=e.map((t)=>t.id),this._layers={},this._serializedLayers=null;for(let t of e){let i=kh(t,this._globalState);if(i.setEventedParent(this,{layer:{id:t.id}}),this._layers[t.id]=i,Zn(i)&&this.tileManagers[i.source]){let r=t.paint?.["raster-fade-duration"]??i.paint.get("raster-fade-duration");this.tileManagers[i.source].setRasterFadeDuration(r)}}}async _loadSprite(e,t=!1,i=void 0){this.imageManager.setLoaded(!1);let r=new AbortController;this._spriteRequest=r;let a;try{let o=await bA(e,this.map._requestManager,this.map.getPixelRatio(),r);if(!o)return;for(let n in o){let{loaded:s,removed:l}=this.imageManager.setSpriteImages(n,o[n]);this._markImagesChanged(l),t&&this._markImagesChanged(s)}}catch(o){a=o,r.signal.aborted||this.fire(new ie(a))}finally{this._spriteRequest=null,this.imageManager.setLoaded(!0),t&&(this._changed=!0),this.dispatcher.broadcast("SI",this.imageManager.listImages()),this.fire(new qi("data")),i?.(a)}}_unloadSprite(){this._markImagesChanged(this.imageManager.removeAllSpriteImages()),this._imagesListDirty=!0,this._changed=!0,this.fire(new qi("data"))}_validateLayer(e){let t=this.tileManagers[e.source];if(!t)return;let i=e.sourceLayer;if(!i)return;let r=t.getSource();(r.type==="geojson"||r.vectorLayerIds&&!r.vectorLayerIds.includes(i))&&this.fire(new ie(Error(`Source layer "${i}" does not exist on source "${r.id}" as specified by style layer "${e.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let e in this.tileManagers)if(!this.tileManagers[e].loaded())return!1;return this.imageManager.isLoaded()}_serializeByIds(e,t=!1){let i=this._serializedAllLayers();if(!e||e.length===0)return Object.values(t?bi(i):i);let r=[];for(let a of e)if(i[a]){let o=t?bi(i[a]):i[a];r.push(o)}return r}_serializedAllLayers(){let e=this._serializedLayers;if(e)return e;e=this._serializedLayers={};let t=Object.keys(this._layers);for(let i of t){let r=this._layers[i];r.type!=="custom"&&(e[i]=r.serialize())}return e}hasTransitions(){if(this.light?.hasTransition()||this.sky?.hasTransition()||this.projection?.hasTransition())return!0;for(let e in this.tileManagers)if(this.tileManagers[e].hasTransition())return!0;for(let e in this._layers)if(this._layers[e].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw Error("Style is not done loading.")}update(e){if(!this._loaded)return;let t=this._changed;if(t){this._imagesListDirty&&=(this.dispatcher.broadcast("SI",this.imageManager.listImages()),!1);let a=Object.keys(this._updatedLayers),o=Object.keys(this._removedLayers);(a.length||o.length)&&this._updateWorkerLayers(a,o);for(let n in this._updatedSources){let s=this._updatedSources[n];if(s==="reload")this._reloadSource(n);else if(s==="clear")this._clearSource(n);else throw Error(`Invalid action ${s}`)}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(let n in this._updatedPaintProps)this._layers[n].updateTransitions(e);this._resetUpdates()}let i={};for(let a in this.tileManagers){let o=this.tileManagers[a];i[a]=o.used,o.used=!1}let r=this.imageManager.listImages();for(let a of this._order){let o=this._layers[a];o.recalculate(e,r),!o.isHidden(e.zoom)&&o.source&&(this.tileManagers[o.source].used=!0)}for(let a in i){let o=this.tileManagers[a];!!i[a]!=!!o.used&&o.fire(new He("data",{sourceDataType:"visibility",sourceId:a}))}this.light.recalculate(e),this.sky.recalculate(e),this.projection.recalculate(e),this.z=e.zoom,t&&this.fire(new qi("data"))}_updateTilesForChangedImages(){let e=Object.keys(this._changedImages);if(e.length){for(let t in this.tileManagers)this.tileManagers[t].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(let e in this.tileManagers)this.tileManagers[e].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(e,t){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(e,!1),removedIds:t})}resize(){for(let e of this._order)this._layers[e].resize()}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(e,t={}){this._checkLoaded();let i=this.serialize();if(e=t.transformStyle?t.transformStyle(i,e):e,(t.validate??!0)&&y0(this,e))return!1;e=bi(e),e.layers=Gg(e.layers);let r=A3(i,e),a=this._getOperationsToPerform(r);if(a.unimplemented.length>0)throw Error(`Unimplemented: ${a.unimplemented.join(", ")}.`);if(a.operations.length===0)return!1;this._initialGlobalState=t.globalState??{};for(let o of a.operations)o();return this.stylesheet=e,this._serializedLayers=null,this.fire(new g0({style:this})),!0}_getOperationsToPerform(e){let t=[],i=[];for(let r of e)switch(r.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":{let[a,o]=r.args;t.push(()=>this.addLayer(a,o));break}case"removeLayer":{let[a]=r.args;t.push(()=>this.removeLayer(a));break}case"setPaintProperty":{let[a,o,n]=r.args;t.push(()=>this.setPaintProperty(a,o,n));break}case"setLayoutProperty":{let[a,o,n]=r.args;t.push(()=>this.setLayoutProperty(a,o,n));break}case"setFilter":{let[a,o]=r.args;t.push(()=>this.setFilter(a,o));break}case"addSource":{let[a,o]=r.args;t.push(()=>this.addSource(a,o));break}case"removeSource":{let[a]=r.args;t.push(()=>this.removeSource(a));break}case"setLayerZoomRange":{let[a,o,n]=r.args;t.push(()=>this.setLayerZoomRange(a,o,n));break}case"setLight":{let[a]=r.args;t.push(()=>this.setLight(a));break}case"setGeoJSONSourceData":{let[a,o]=r.args;t.push(()=>this.setGeoJSONSourceData(a,o));break}case"setGlyphs":{let[a]=r.args;t.push(()=>this.setGlyphs(a));break}case"setFontFaces":{let[a]=r.args;t.push(()=>this.setFontFaces(a));break}case"setSprite":{let[a]=r.args;t.push(()=>this.setSprite(a));break}case"setTerrain":{let[a]=r.args;t.push(()=>this.map.setTerrain(a));break}case"setSky":{let[a]=r.args;t.push(()=>this.setSky(a));break}case"setProjection":{let[a]=r.args;t.push(()=>this.setProjection(a));break}case"setGlobalState":{let[a]=r.args;t.push(()=>this.setGlobalState(a));break}case"setTransition":t.push(()=>{});break;default:i.push(r.command)}return{operations:t,unimplemented:i}}addImage(e,t){this.getImage(e)?this.fire(new ie(Error(`An image named "${e}" already exists.`))):(this.imageManager.addImage(e,t),this._afterImageUpdated(e))}updateImage(e,t){this.imageManager.updateImage(e,t)}getImage(e){return this.imageManager.getImage(e)}setMissingImageResolver(e){this.imageManager.setMissingImageResolver(e)}removeImage(e){this.getImage(e)?(this.imageManager.removeImage(e),this._afterImageUpdated(e)):this.fire(new ie(Error(`An image named "${e}" does not exist.`)))}_markImagesChanged(e){for(let t of e)this._changedImages[t]=!0}_afterImageUpdated(e){this._changedImages[e]=!0,this._imagesListDirty=!0,this._changed=!0,this.fire(new qi("data"))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,t,i={}){if(this._checkLoaded(),this.tileManagers[e]!==void 0)throw Error(`Source "${e}" already exists.`);if(!t.type)throw Error(`The type property must be defined, but only the following properties were given: ${Object.keys(t).join(", ")}.`);if(Lv.has(t.type)&&this._validate(ai.source,`sources.${e}`,t,null,i))return;this.map?._collectResourceTiming&&(t.collectResourceTiming=!0);let r=this.tileManagers[e]=new bu(e,t,this.dispatcher);r.style=this,r.setEventedParent(this,()=>({isSourceLoaded:r.loaded(),source:r.serialize(),sourceId:e})),r.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),this.tileManagers[e]===void 0)throw Error(`There is no source with this ID=${e}`);for(let i in this._layers)if(this._layers[i].source===e)return this.fire(new ie(Error(`Source "${e}" cannot be removed while layer "${i}" is using it.`)));let t=this.tileManagers[e];delete this.tileManagers[e],delete this._updatedSources[e],t.fire(new He("data",{sourceDataType:"metadata",sourceId:e})),t.setEventedParent(null),t.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,t){if(this._checkLoaded(),this.tileManagers[e]===void 0)throw Error(`There is no source with this ID=${e}`);let i=this.tileManagers[e].getSource();if(i.type!=="geojson")throw Error(`geojsonSource.type is ${i.type}, which is !== 'geojson`);i.setData(t),this._changed=!0}getSource(e){return this.tileManagers[e]?.getSource()}addLayer(e,t,i={}){this._checkLoaded();let r=e.id;if(this.getLayer(r)){this.fire(new ie(Error(`Layer "${r}" already exists on this map.`)));return}let a;if(e.type==="custom"){if(lf(this,vA(e)))return;a=kh(e,this._globalState)}else{if("source"in e&&typeof e.source=="object"&&(this.addSource(r,e.source),e={...e,source:r}),this._validate(ai.layer,`layers.${r}`,e,{arrayIndex:-1},i))return;a=kh(e,this._globalState),this._validateLayer(a),a.setEventedParent(this,{layer:{id:r}})}let o=t?this._order.indexOf(t):this._order.length;if(t&&o===-1)this.fire(new ie(Error(`Cannot add layer "${r}" before non-existing layer "${t}".`)));else{if(this._order.splice(o,0,r),this._layerOrderChanged=!0,this._layers[r]=a,this._removedLayers[r]&&a.source&&a.type!=="custom"){let n=this._removedLayers[r];delete this._removedLayers[r],n.type===a.type?(this._updatedSources[a.source]="reload",this.tileManagers[a.source].pause()):this._updatedSources[a.source]="clear"}this._updateLayer(a),a.onAdd&&a.onAdd(this.map)}}moveLayer(e,t){if(this._checkLoaded(),this._changed=!0,!this._layers[e]){this.fire(new ie(Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));return}if(e===t)return;if(t&&!this._order.includes(t)){this.fire(new ie(Error(`Cannot move layer "${e}" before non-existing layer "${t}".`)));return}let i=this._order.indexOf(e);this._order.splice(i,1);let r=t?this._order.indexOf(t):this._order.length;this._order.splice(r,0,e),this._layerOrderChanged=!0}removeLayer(e){this._checkLoaded();let t=this._layers[e];if(!t){this.fire(new ie(Error(`Cannot remove non-existing layer "${e}".`)));return}t.setEventedParent(null);let i=this._order.indexOf(e);this._order.splice(i,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=t,delete this._layers[e],this._serializedLayers&&delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],t.type==="symbol"&&t.source&&this.tileManagers[t.source]?.resetMaxContentElevation(),t.onRemove&&t.onRemove(this.map)}getLayer(e){return this._layers[e]}getLayersOrder(){return[...this._order]}hasLayer(e){return e in this._layers}setLayerZoomRange(e,t,i){this._checkLoaded();let r=this.getLayer(e);r?(r.minzoom!==t||r.maxzoom!==i)&&(t!=null&&(r.minzoom=t),i!=null&&(r.maxzoom=i),this._updateLayer(r)):this.fire(new ie(Error(`Cannot set the zoom range of non-existing layer "${e}".`)))}setFilter(e,t,i={}){this._checkLoaded();let r=this.getLayer(e);r?lr(r.filter,t)||(t==null?(r.setFilter(void 0),this._updateLayer(r)):this._validate(ai.filter,`layers.${r.id}.filter`,t,null,i)||(r.setFilter(bi(t)),this._updateLayer(r))):this.fire(new ie(Error(`Cannot filter non-existing layer "${e}".`)))}getFilter(e){return bi(this.getLayer(e).filter)}setLayoutProperty(e,t,i,r={}){this._checkLoaded();let a=this.getLayer(e);a?lr(a.getLayoutProperty(t),i)||(a.setLayoutProperty(t,i,r),this._updateLayer(a)):this.fire(new ie(Error(`Cannot style non-existing layer "${e}".`)))}getLayoutProperty(e,t){let i=this.getLayer(e);if(!i)this.fire(new ie(Error(`Cannot get style of non-existing layer "${e}".`)));else return i.getLayoutProperty(t)}setPaintProperty(e,t,i,r={}){this._checkLoaded();let a=this.getLayer(e);a?lr(a.getPaintProperty(t),i)||this._updatePaintProperty(a,t,i,r):this.fire(new ie(Error(`Cannot style non-existing layer "${e}".`)))}_updatePaintProperty(e,t,i,r={}){e.setPaintProperty(t,i,r)&&this._updateLayer(e),Zn(e)&&t==="raster-fade-duration"&&this.tileManagers[e.source].setRasterFadeDuration(i),this._changed=!0,this._updatedPaintProps[e.id]=!0,e.type==="symbol"&&this.triggerSymbolPlacement(),this._serializedLayers=null}getPaintProperty(e,t){return this.getLayer(e).getPaintProperty(t)}setFeatureState(e,t){this._checkLoaded();let{source:i,sourceLayer:r}=e,a=this.tileManagers[i];if(a===void 0){this.fire(new ie(Error(`The source '${i}' does not exist in the map's style.`)));return}let o=a.getSource().type;if(o==="geojson"&&r){this.fire(new ie(Error("GeoJSON sources cannot have a sourceLayer parameter.")));return}if(o==="vector"&&!r){this.fire(new ie(Error("The sourceLayer parameter must be provided for vector source types.")));return}if(e.id===void 0){this.fire(new ie(Error("The feature id parameter must be provided.")));return}let n=["__proto__","constructor","prototype"];t&&Object.keys(t).some((s)=>n.includes(s))?this.fire(new ie(Error(`The feature state should not include one of the following keys: ${n}`))):a.setFeatureState(r,e.id,t)}removeFeatureState(e,t){this._checkLoaded();let i=e.source,r=this.tileManagers[i];if(r===void 0){this.fire(new ie(Error(`The source '${i}' does not exist in the map's style.`)));return}let a=r.getSource().type,o=a==="vector"?e.sourceLayer:void 0;a==="vector"&&!o?this.fire(new ie(Error("The sourceLayer parameter must be provided for vector source types."))):t&&typeof e.id!="string"&&typeof e.id!="number"?this.fire(new ie(Error("A feature id is required to remove its specific state property."))):r.removeFeatureState(o,e.id,t)}getFeatureState(e){this._checkLoaded();let{source:t,sourceLayer:i}=e,r=this.tileManagers[t];if(r===void 0)this.fire(new ie(Error(`The source '${t}' does not exist in the map's style.`)));else if(r.getSource().type==="vector"&&!i)this.fire(new ie(Error("The sourceLayer parameter must be provided for vector source types.")));else return e.id===void 0&&this.fire(new ie(Error("The feature id parameter must be provided."))),r.getFeatureState(i,e.id)}getTransition(){return ee({duration:300,delay:0},this.stylesheet?.transition)}serialize(){if(!this._loaded)return;let e=Bp(this.tileManagers,(a)=>a.serialize()),t=this._serializeByIds(this._order,!0),i=this.map.getTerrain()||void 0,r=this.stylesheet;return xy({version:r.version,name:r.name,metadata:r.metadata,light:r.light,sky:r.sky,center:r.center,zoom:r.zoom,bearing:r.bearing,pitch:r.pitch,sprite:r.sprite,glyphs:r.glyphs,"font-faces":r["font-faces"],transition:r.transition,projection:r.projection,state:r.state,sources:e,layers:t,terrain:i},(a)=>a!==void 0)}_updateLayer(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&this.tileManagers[e.source].getSource().type!=="raster"&&(this._updatedSources[e.source]="reload",this.tileManagers[e.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(e){let t=(o)=>this._layers[o].type==="fill-extrusion",i={},r=[];for(let o=this._order.length-1;o>=0;o--){let n=this._order[o];if(t(n)){i[n]=o;for(let s of e){let l=s[n];if(l)for(let u of l)r.push(u)}}}r.sort((o,n)=>n.intersectionZ-o.intersectionZ);let a=[];for(let o=this._order.length-1;o>=0;o--){let n=this._order[o];if(t(n))for(let s=r.length-1;s>=0;s--){let l=r[s].feature;if(i[l.layer.id]<o)break;a.push(l),r.pop()}else for(let s of e){let l=s[n];if(l)for(let u of l)a.push(u.feature)}}return a}queryRenderedFeatures(e,t,i,r){t?.filter&&this._validate(ai.filter,"queryRenderedFeatures.filter",t.filter,null,t);let a={};if(t?.layers){if(!(Array.isArray(t.layers)||t.layers instanceof Set))return this.fire(new ie(Error("parameters.layers must be an Array or a Set of strings"))),[];for(let u of t.layers){let c=this._layers[u];if(!c)return this.fire(new ie(Error(`The layer '${u}' does not exist in the map's style and cannot be queried for features.`))),[];a[c.source]=!0}}let o=[];t.availableImages=this.imageManager.listImages();let n=this._serializedAllLayers(),s=t.layers instanceof Set?t.layers:Array.isArray(t.layers)?new Set(t.layers):null,l={...t,layers:s,globalState:this._globalState};for(let u in this.tileManagers)(!t.layers||a[u])&&o.push(GA(this.tileManagers[u],this._layers,n,e,l,i,r,this.map.terrain?(c,h,d)=>this.map.terrain.getElevation(c,h,d):void 0));return this.placement&&o.push(WA(this._layers,n,this.tileManagers,e,l,this.placement.collisionIndex,this.placement.retainedQueryData,r)),this._flattenAndSortRenderedFeatures(o)}querySourceFeatures(e,t){t?.filter&&this._validate(ai.filter,"querySourceFeatures.filter",t.filter,null,t);let i=this.tileManagers[e];return i?ZA(i,{...t,globalState:this._globalState,worldCoordinateHelper:this.projection.worldCoordinateHelper}):[]}getLight(){return this.light.getLight()}setLight(e,t={}){this._checkLoaded();let i=this.light.getLight(),r=!1;for(let o in e)if(!lr(e[o],i[o])){r=!0;break}if(!r)return;let a={now:Fe(),transition:ee({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,t),this.light.updateTransitions(a)}getProjection(){return this.stylesheet?.projection}setProjection(e){this._checkLoaded();let t=e??{type:"mercator"};if(this.stylesheet.projection=e,this.projection){if(this.projection.name===t.type)return;this.projection.destroy(),delete this.projection}this._setProjectionInternal(t.type)}getSky(){return this.stylesheet?.sky}setSky(e,t={}){this._checkLoaded();let i=this.getSky(),r=!1;if(!e&&!i)return;if(e&&!i)r=!0;else if(!e&&i)r=!0;else for(let o in e)if(!lr(e[o],i[o])){r=!0;break}if(!r)return;let a={now:Fe(),transition:ee({duration:300,delay:0},this.stylesheet.transition)};this.sky.setSky(e,t)&&(this.stylesheet.sky=e,this.sky.updateTransitions(a))}_setProjectionInternal(e){this._applyProjection(y_(e,this._globalState))}_applyProjection(e){this.projection=e.projection,this.map.migrateProjection(e.cameraProjection,e.projection.worldCoordinateHelper);for(let t in this.tileManagers)this.tileManagers[t].reload()}_validate(e,t,i,r,a={}){return a.validate!==!1&&ds(this,e,{key:t,style:this.serialize(),value:i,...r},a)}_remove(e=!0){this._frameRequest&&=(this._frameRequest.abort(),null),this._loadStyleRequest&&=(this._loadStyleRequest.abort(),null),this._spriteRequest&&=(this._spriteRequest.abort(),null),bp().off(xp,this._rtlPluginLoaded);for(let t in this._layers)this._layers[t].setEventedParent(null);for(let t in this.tileManagers){let i=this.tileManagers[t];i.setEventedParent(null),i.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),e&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(e)}_clearSource(e){this.tileManagers[e].clearTiles()}_reloadSource(e){this.tileManagers[e].resume(),this.tileManagers[e].reload()}_updateSources(e,t){for(let i in this.tileManagers)this.tileManagers[i].update(e,t,this.map.terrain)}_generateCollisionBoxes(){for(let e in this.tileManagers)this._reloadSource(e)}triggerSymbolPlacement(){this._symbolPlacementTriggered=!0}_placementInputsChanged(e,t,i){let r=this.pauseablePlacement;return!r||this._symbolPlacementTriggered||this._placedProjectionTransition!==this.projection?.transitionState||r._showCollisionBoxes!==t||r.placement.collisionGroups.crossSourceCollisions!==i||r.placement.projectedCamera.renderWorldCopies!==e.renderWorldCopies||!C5(r.placement.projectedCamera.modelViewProjectionMatrix,e.modelViewProjectionMatrix)}_updatePlacement(e,t,i,r,a,o=!1){let n=!1,s=!1,l={};for(let h of this._order){let d=this._layers[h];if(d.type!=="symbol")continue;if(!l[d.source]){let f=this.tileManagers[d.source];l[d.source]=f.getRenderableIds(!0).map((m)=>f.getTileByID(m)).sort((m,g)=>g.tileID.overscaledZ-m.tileID.overscaledZ||(m.tileID.isLessThan(g.tileID)?-1:1))}let p=this.crossTileSymbolIndex.addLayer(d,l[d.source],t.wraps?e.center.lng:0);n||=p}this.crossTileSymbolIndex.pruneUnusedLayers(this._order),o||=this._layerOrderChanged||r===0;let u=n||this._placementInputsChanged(e,i,a),c=this.pauseablePlacement?.isDone()&&!this.placement.stillRecent(Fe(),e.zoom);if((o||!this.pauseablePlacement||c&&(u||this.placement.stale))&&(this._symbolPlacementTriggered=!1,this._placedProjectionTransition=this.projection?.transitionState,this.pauseablePlacement=new KI(e,this.map.terrain,this._order,o,i,r,a,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?u&&this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,l),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(Fe()),s=!0),n&&this.pauseablePlacement.placement.setStale()),s||n)for(let h of this._order){let d=this._layers[h];d.type==="symbol"&&this.placement.updateLayerOpacities(d,l[d.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(Fe())}_releaseSymbolFadeTiles(){for(let e in this.tileManagers)this.tileManagers[e].releaseSymbolFadeTiles()}async getImages(e,t){let i=await this.imageManager.getImages(t.icons);this._updateTilesForChangedImages();let r=this.tileManagers[t.source];return r&&r.setDependencies(t.tileID.key,t.type,t.icons),i}async getGlyphs(e,t){let i=await this.glyphManager.getGlyphs(t.stacks),r=this.tileManagers[t.source];return r&&r.setDependencies(t.tileID.key,t.type,[""]),i}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,t={}){this._checkLoaded(),e&&this._validate(ai.glyphs,"glyphs",e,null,t)||(this._changed=!0,this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}getFontFaces(){return this.stylesheet["font-faces"]||null}setFontFaces(e){this._checkLoaded(),this._changed=!0,this._glyphsDidChange=!0,this.stylesheet["font-faces"]=e,this.glyphManager.setFontFaces(e)}async getDashes(e,t){let i={};for(let[r,a]of Object.entries(t.dashes))i[r]=this.lineAtlas.getDash(a.dasharray,a.round);return i}addSprite(e,t,i={},r){this._checkLoaded();let a=[{id:e,url:t}],o=[...Fl(this.stylesheet.sprite),...a];this._validate(ai.sprite,"sprite",o,null,i)||(this.stylesheet.sprite=o,this._loadSprite(a,!0,r))}removeSprite(e){this._checkLoaded();let t=Fl(this.stylesheet.sprite);if(!t.find((r)=>r.id===e)){this.fire(new ie(Error(`Sprite "${e}" doesn't exists on this map.`)));return}let i=this.imageManager.removeSpriteImages(e);this._markImagesChanged(i),t.splice(t.findIndex((r)=>r.id===e),1),this.stylesheet.sprite=t.length>0?t:void 0,this._imagesListDirty=!0,this._changed=!0,this.fire(new qi("data"))}getSprite(){return Fl(this.stylesheet.sprite)}setSprite(e,t={},i){this._checkLoaded(),e&&this._validate(ai.sprite,"sprite",e,null,t)||(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,i):(this._unloadSprite(),i&&i(null)))}destroy(){this._frameRequest&&=(this._frameRequest.abort(),null),this._loadStyleRequest&&=(this._loadStyleRequest.abort(),null),this._spriteRequest&&=(this._spriteRequest.abort(),null);for(let e in this.tileManagers){let t=this.tileManagers[e];t.setEventedParent(null),t.onRemove(this.map)}this.tileManagers={},this.imageManager&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this.patternAtlas.destroy()),this.glyphManager&&this.glyphManager.destroy();for(let e in this._layers){let t=this._layers[e];t.setEventedParent(null),t.onRemove&&t.onRemove(this.map)}this._setInitialValues(),this.setEventedParent(null),this.dispatcher.unregisterMessageHandler("GG"),this.dispatcher.unregisterMessageHandler("GI"),this.dispatcher.unregisterMessageHandler("GDA"),this.dispatcher.remove(!0),this._listeners={},this._oneTimeListeners={}}},m7=rt([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]),x_={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"},y7=class extends Re{getDefault(){return se.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)}},v7=class extends Re{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}},x7=class extends Re{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}},b7=class extends Re{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)}},w7=class extends Re{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}},T7=class extends Re{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}},E7=class extends Re{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)}},S7=class extends Re{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)}},C7=class extends Re{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}},D7=class extends Re{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)}},A7=class extends Re{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}},M7=class extends Re{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}},P7=class extends Re{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}},I7=class extends Re{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)}},k7=class extends Re{getDefault(){return se.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)}},F7=class extends Re{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}},R7=class extends Re{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}},z7=class extends Re{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}},L7=class extends Re{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}},B7=class extends Re{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}},O7=class extends Re{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}},j7=class extends Re{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)}},N7=class extends Re{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}},V7=class extends Re{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}},$7=class extends Re{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}},U7=class extends Re{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}},q7=class extends Re{getDefault(){return null}set(e){let t=this.gl;t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}},G7=class extends Re{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.bindVertexArray(e),this.current=e,this.dirty=!1)}},W7=class extends Re{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}},Z7=class extends Re{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}},H7=class extends Re{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}},Kf=class extends Re{constructor(e,t){super(e),this.context=e,this.parent=t}getDefault(){return null}},X7=class extends Kf{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}},Y7=class extends Kf{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}},K7=class extends Kf{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}},nc={ProjectionUBO:0,TerrainUBO:1,FrameUBO:2};ek={float:[1,1],int:[1,1],vec2:[2,2],vec4:[4,4],mat4:[16,4]};_b=Jf([{name:"u_projection_matrix",type:"mat4"},{name:"u_projection_fallback_matrix",type:"mat4"},{name:"u_projection_tile_mercator_coords",type:"vec4"},{name:"u_projection_clipping_plane",type:"vec4"},{name:"u_projection_transition",type:"float"},{name:"u_projection_clip_antimeridian",type:"int"}]),ro=_b.offsets;vb=Jf([{name:"u_units_to_pixels",type:"vec2"},{name:"u_world_size",type:"vec2"},{name:"u_camera_to_center_distance",type:"float"},{name:"u_symbol_fade_change",type:"float"},{name:"u_aspect_ratio",type:"float"},{name:"u_device_pixel_ratio",type:"float"},{name:"u_viewport_size",type:"vec2"},{name:"u_pixel_extrude_scale",type:"vec2"},{name:"u_pitch",type:"float"}]),Zt=vb.offsets;xb=Jf([{name:"u_terrain_matrix",type:"mat4"},{name:"u_terrain_unpack",type:"vec4"},{name:"u_terrain_dim",type:"float"},{name:"u_terrain_exaggeration",type:"float"}]),yl=xb.offsets;ze.Replace=[1,0],ze.disabled=new ze(ze.Replace,se.transparent,[!1,!1,!1,!1]),ze.unblended=new ze(ze.Replace,se.transparent,[!0,!0,!0,!0]),ze.alphaBlended=new ze([1,771],se.transparent,[!0,!0,!0,!0]),ze.plusLighter=new ze([1,1],se.transparent,[!0,!0,!0,!0]),ze.screen=new ze([1,769],se.transparent,[!0,!0,!0,!0]);d9={fillExtrusion:xk,fillExtrusionPattern:bk,fill:Tk,fillPattern:Ek,fillOutline:Sk,fillOutlinePattern:Ck,circle:Pk,collisionBox:vl,collisionCircle:vl,debug:kk,depth:vl,clippingMask:vl,heatmap:Fk,heatmapTexture:Rk,hillshade:zk,hillshadePrepare:Lk,colorRelief:Vk,line:Uk,lineGradient:qk,linePattern:Gk,lineSDF:Wk,lineGradientSDF:Zk,layerComposite:Jk,raster:hM,symbolIcon:e9,symbolSDF:t9,symbolTextAndIcon:i9,background:a9,backgroundPattern:o9,terrain:hk,terrainDepth:dk,terrainHeight:pk,atmosphere:l9,sky:c9};Ce.disabled=new Ce({func:519,mask:0},0,0,Nh,Nh,Nh);Ae.disabled=new Ae(!1,E_,Vh),Ae.backCCW=new Ae(!0,E_,Vh),Ae.frontCCW=new Ae(!0,1028,Vh);xe.ReadOnly=!1,xe.ReadWrite=!0,xe.disabled=new xe(519,xe.ReadOnly,[0,1]);m9=er(new Float32Array(16));Ib={multiply:["#define LAYER_BLEND;","#define LAYER_BLEND_MULTIPLY;"],overlay:["#define LAYER_BLEND;","#define LAYER_BLEND_OVERLAY;"],color:["#define LAYER_BLEND;","#define LAYER_BLEND_NONSEPARABLE;","#define LAYER_BLEND_COLOR;"],luminosity:["#define LAYER_BLEND;","#define LAYER_BLEND_NONSEPARABLE;"]};P9={"plus-lighter":ze.plusLighter,screen:ze.screen},I9=[[0,0],[z,0],[0,z],[z,z]];Gh=[new D(0,0),new D(z,0),new D(z,z),new D(0,z)];Y9=new se(1,0,0,1),K9=new se(0,1,0,1),J9=new se(0,0,1,1),Q9=new se(1,0,1,1),eF=new se(0,1,1,1);mF={symbol:g9,circle:w9,heatmap:T9,line:j9,fill:N9,fillExtrusion:V9,hillshade:$9,colorRelief:q9,raster:G9,background:X9,sky:dF,atmosphere:fF,custom:cF,debug:rF,debugPadding:tF,terrainDepth:sF},R_=bu.maxOverzooming+bu.maxUnderzooming+1,gF={name:mb,define:fb,prelude:dr.projectionMercator},yF=class e{constructor(t){this.drawFunctions=mF,this.context=new lk(t),this.programCache=new p9(this.context),this.layerCompositeFbo=null,this.layerCompositeBackdrop=null,this._tileTextures={},this._rttObjectRecyclePool=[],this._rttSharedFbo=null,this.terrainFacilitator={depthDirty:!0,matrix:er(new Float64Array(16)),renderTime:0},this.setup()}resize(t,i,r){this.width=Math.round(t*r),this.height=Math.round(i*r),this.context.viewport.set([0,0,this.width,this.height])}setup(){let t=this.context,i=new ba;i.emplaceBack(0,0),i.emplaceBack(z,0),i.emplaceBack(0,z),i.emplaceBack(z,z),this.tileExtentBuffer=t.createVertexBuffer(i,ho.members),this.tileExtentSegments=tt.simpleSegment(0,0,4,2);let r=new ba;r.emplaceBack(0,0),r.emplaceBack(z,0),r.emplaceBack(0,z),r.emplaceBack(z,z),this.debugBuffer=t.createVertexBuffer(r,ho.members),this.debugSegments=tt.simpleSegment(0,0,4,5);let a=new _T;a.emplaceBack(0,0,0,0),a.emplaceBack(z,0,z,0),a.emplaceBack(0,z,0,z),a.emplaceBack(z,z,z,z),this.rasterBoundsBuffer=t.createVertexBuffer(a,m7.members),this.rasterBoundsSegments=tt.simpleSegment(0,0,4,2);let o=new ba;o.emplaceBack(0,0),o.emplaceBack(1,0),o.emplaceBack(0,1),o.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(o,ho.members),this.viewportSegments=tt.simpleSegment(0,0,4,2);let n=new MT;n.emplaceBack(0),n.emplaceBack(1),n.emplaceBack(3),n.emplaceBack(2),n.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(n);let s=new xr;s.emplaceBack(1,0,2),s.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(s),this.tileExtentMesh=new as(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments);let l=new ba;l.emplaceBack(-1,-1),l.emplaceBack(1,-1),l.emplaceBack(1,1),l.emplaceBack(-1,1);let u=new xr;u.emplaceBack(0,1,2),u.emplaceBack(0,2,3),this.skyMesh=new as(t.createVertexBuffer(l,ho.members),t.createIndexBuffer(u),tt.simpleSegment(0,0,l.length,u.length))}_renderTilesDepthBuffer(t){let i=this.context,r=i.gl,a=t.projectedCamera,o=t.useProgram("depth"),n=t.getDepthModeFor3D(),s=vs(a,t.worldCoordinateHelper,{tileSize:a.tileSize});for(let l of s){let u=t.getTerrainDataForTile(l),c=t.getMeshFromTileID(l.canonical,!0,!0,"raster"),h=t.getProjectionDataForTile(l);o.draw(i,r.TRIANGLES,n,Ce.disabled,ze.disabled,Ae.backCCW,null,u,h,"$clipping",c.vertexBuffer,c.indexBuffer,c.segments)}}render(t,i,r,a){if(this.context.gl.isContextLost())return;let o=new _F({projectedCamera:i,worldCoordinateHelper:r,terrain:t.map.terrain??null,data:a,context:this.context,programCache:this.programCache,currentPass:"offscreen",projection:t.projection});this.lineAtlas=t.lineAtlas,this.patternAtlas=t.patternAtlas,ok(this.context.frameUniformBuffer,i,a),t.imageManager.beginFrame(),ik(this.context);let{_order:n,tileManagers:s}=t,l={},u={},c={};for(let d in s){let p=s[d];p.used&&p.prepare(this.context),l[d]=p.getVisibleCoordinates(!1),u[d]=l[d].slice().reverse(),c[d]=p.getVisibleCoordinates(!0).reverse()}o.opaquePassCutoff=1/0;for(let d=0;d<n.length;d++){let p=t._layers[n[d]];if(p.is3D()||M9(p)){o.opaquePassCutoff=d;break}}this.maybeDrawDepth(o),this.renderToTexture&&(this.renderToTexture.prepareForRender(t,i.zoom,a.moving),o.opaquePassCutoff=0),o.currentPass="offscreen";for(let d of n){let p=t._layers[d];if(!p.hasOffscreenPass()||p.isHidden(i.zoom))continue;let f=u[p.source];(p.type==="custom"||f.length)&&this.renderLayer(this,s[p.source],p,f,o)}if(this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:a.showOverdrawInspector?se.black:se.transparent,depth:1}),o.clearStencil(),a.sky&&this.drawFunctions.sky(this.skyMesh,o),o.setDepthRangeFor3D(t._order.length),!this.renderToTexture)for(o.currentPass="opaque",o.currentLayer=n.length-1;o.currentLayer>=0;o.currentLayer--){let d=t._layers[n[o.currentLayer]];if(d.isHidden(i.zoom))continue;let p=s[d.source],f=l[d.source];o.renderTileClippingMasks(d,f),this.renderLayer(this,p,d,f,o)}o.currentPass="translucent";let h=!1;for(o.currentLayer=0;o.currentLayer<n.length;o.currentLayer++){let d=t._layers[n[o.currentLayer]];if(d.isHidden(i.zoom))continue;let p=s[d.source];if(this.renderToTexture?.renderLayer(d,t,o))continue;!o.opaquePassEnabledForLayer()&&!h&&(h=!0,a.isRenderingGlobe&&!o.terrain&&this._renderTilesDepthBuffer(o));let f=(d.type==="symbol"?c:u)[d.source];o.renderTileClippingMasks(d,l[d.source]),this.renderLayer(this,p,d,f,o)}if(a.isRenderingGlobe&&this.drawFunctions.atmosphere(this.skyMesh,o),a.showTileBoundaries){let d=nF(t,i.zoom);d&&this.drawFunctions.debug(this,d,d.getVisibleCoordinates(),o)}a.showPadding&&this.drawFunctions.debugPadding(o),this.renderToTexture&&!a.moving&&this.clearRTTPool(),this.context.setDefault()}markTerrainDepthDirty(){this.terrainFacilitator.depthDirty=!0}maybeDrawDepth(t){if(!t.data.projectionShaderVariant||!t.terrain)return;let i=this.terrainFacilitator.matrix,r=t.projectedCamera.modelViewProjectionMatrix,a=this.terrainFacilitator.depthDirty;a||=!D5(i,r),a||=t.terrain.tileManager.anyTilesAfterTime(this.terrainFacilitator.renderTime),a&&(w5(i,r),this.terrainFacilitator.renderTime=Fe(),this.terrainFacilitator.depthDirty=!1,this.drawFunctions.terrainDepth(this,t.terrain,t))}renderLayer(t,i,r,a,o){if(r.isHidden(o.projectedCamera.zoom)||r.type!=="background"&&r.type!=="custom"&&!(a||[]).length)return;let n=this.drawFunctions;bx(r)?n.symbol(t,i,r,a,o):$E(r)?n.circle(i,r,a,o):ZE(r)?n.heatmap(t,i,r,a,o):G2(r)?n.line(t,i,r,a,o):N2(r)?n.fill(t,i,r,a,o):aC(r)?n.fillExtrusion(i,r,a,o):JE(r)?n.hillshade(t,i,r,a,o):aS(r)?n.colorRelief(t,i,r,a,o):Zn(r)?n.raster(t,i,r,a,o):_A(r)?n.background(t,i,r,a,o):ic(r)&&n.custom(t,i,r,a,o)}static{this.MAX_TEXTURE_POOL_SIZE_PER_BUCKET=50}saveTileTexture(t){let i=this._tileTextures[t.size[0]];i?i.length<e.MAX_TEXTURE_POOL_SIZE_PER_BUCKET?i.push(t):t.destroy():this._tileTextures[t.size[0]]=[t]}getTileTexture(t){let i=this._tileTextures[t];return i&&i.length>0?i.pop():null}acquireRTT(t){let i=this.context.gl,r=this._rttObjectRecyclePool.pop();if(r)return r.size!==t&&(r.texture.update({width:t,height:t,data:null},{premultiply:!1,useMipmap:!0}),r.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE,i.LINEAR_MIPMAP_LINEAR),this.context.extTextureFilterAnisotropic&&i.texParameterf(i.TEXTURE_2D,this.context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this.context.extTextureFilterAnisotropicMax),r.size=t),r;let a=new yt(this.context,{width:t,height:t,data:null},i.RGBA,{premultiply:!1,useMipmap:!0});return a.bind(i.LINEAR,i.CLAMP_TO_EDGE,i.LINEAR_MIPMAP_LINEAR),this.context.extTextureFilterAnisotropic&&i.texParameterf(i.TEXTURE_2D,this.context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this.context.extTextureFilterAnisotropicMax),{texture:a,size:t}}bindRTT(t){let i=this.context.gl,r=t.size;if(!this._rttSharedFbo){let a=this.context.createFramebuffer(r,r,!0,!0),o=this.context.createRenderbuffer(i.DEPTH_STENCIL,r,r);a.depthAttachment.set(o),this._rttSharedFbo={fbo:a,depthRenderbuffer:o,size:r}}this._rttSharedFbo.size!==r&&(this.context.bindRenderbuffer.set(this._rttSharedFbo.depthRenderbuffer),i.renderbufferStorage(i.RENDERBUFFER,i.DEPTH_STENCIL,r,r),this.context.bindRenderbuffer.set(null),this._rttSharedFbo.fbo.width=r,this._rttSharedFbo.fbo.height=r,this._rttSharedFbo.size=r),this._rttSharedFbo.fbo.colorAttachment.set(t.texture.texture),this.context.bindFramebuffer.set(this._rttSharedFbo.fbo.framebuffer)}releaseRTT(t){this._rttObjectRecyclePool.push(t)}clearRTTPool(){for(let t of this._rttObjectRecyclePool)t.texture.destroy();this._rttObjectRecyclePool.length=0}destroyRTTResources(){if(this.clearRTTPool(),!this._rttSharedFbo)return;this._rttSharedFbo.fbo.colorAttachment.set(null),this._rttSharedFbo.fbo.depthAttachment.set(null);let t=this.context.gl;t.deleteRenderbuffer(this._rttSharedFbo.depthRenderbuffer),t.deleteFramebuffer(this._rttSharedFbo.fbo.framebuffer),this._rttSharedFbo=null}setBaseState(){let t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){if(this.debugOverlayCanvas==null){this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512;let t=this.context.gl;this.debugOverlayTexture=new yt(this.context,this.debugOverlayCanvas,t.RGBA)}}destroy(){if(this._tileTextures){for(let t in this._tileTextures){let i=this._tileTextures[t];if(i)for(let r of i)r.destroy()}this._tileTextures={}}this.destroyRTTResources(),this.layerCompositeFbo?.destroy(),this.layerCompositeFbo=null,this.layerCompositeBackdrop&&=(this.context.gl.deleteTexture(this.layerCompositeBackdrop.texture),null),this.tileExtentBuffer&&this.tileExtentBuffer.destroy(),this.debugBuffer&&this.debugBuffer.destroy(),this.rasterBoundsBuffer&&this.rasterBoundsBuffer.destroy(),this.viewportBuffer&&this.viewportBuffer.destroy(),this.tileBorderIndexBuffer&&this.tileBorderIndexBuffer.destroy(),this.quadTriangleIndexBuffer&&this.quadTriangleIndexBuffer.destroy(),this.tileExtentMesh&&this.tileExtentMesh.vertexBuffer?.destroy(),this.tileExtentMesh&&this.tileExtentMesh.indexBuffer?.destroy(),this.skyMesh?.destroy(),this.skyMesh=null,this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.context.destroy(),this.programCache.destroy(),this.context&&this.context.setDefault()}overLimit(){let{drawingBufferWidth:t,drawingBufferHeight:i}=this.context.gl;return this.width!==t||this.height!==i}},vF=class extends Error{constructor(e,t){super("WebGL2 is required to display this map. We are sorry, but it seems that your browser does not support WebGL2, a technology for rendering 3D graphics on the web. Read more on https://wiki.openstreetmap.org/wiki/This_map_requires_WebGL"),this.name="GPUInitializationError",this.requestedAttributes=e,this.statusMessage=t?.statusMessage??null}};B_=new WeakMap;O_=new WeakMap,j_=new WeakMap;Wh=Math.PI*0.98;jF=new RF,NF=new zF;Zb=new VF,UF=new $F(Zb);uc={linearity:0.3,easing:Lp(0,0,0.3,1)},qF=ee({deceleration:2500,maxSpeed:1400},uc),GF=ee({deceleration:20,maxSpeed:1400},uc),WF=ee({deceleration:1000,maxSpeed:90},uc),ZF=ee({deceleration:1000,maxSpeed:360},uc),HF={halfLife:140,minSpeed:60,maxSpeed:1200,stopSpeed:1};KF=class extends sa{};JF=class extends qe{get _ownerDocument(){return this._el?.ownerDocument||document}get _ownerWindow(){return this._el?.ownerDocument?.defaultView||window}constructor(e){super(),this._terrainGesture={inFlight:!1,anchorElevation:null,anchorCenterElevation:null},this._rotationPivot=null,this._timeouts=new Set,this.handleWindowEvent=(i)=>{this.handleEvent(i,`${i.type}Window`)},this.handleEvent=(i,r)=>{if(i.type==="blur"){this.stop(!0);return}this._updatingCamera=!0;let a=i.type==="renderFrame"?void 0:i,o={needsRenderFrame:!1},n={},s={};for(let{handlerName:c,handler:h,allowed:d}of this._handlers){if(!h.isEnabled())continue;let p;if(this._blockedByActive(s,d,c))h.reset();else if(h[r||i.type]){if(u3(i,r||i.type)){let f=Ve.mousePos(this._canvas,i);p=h[r||i.type](i,f)}else if(l3(i,r||i.type)){let f=i.touches,m=this._getMapTouches(f),g=Ve.touchPos(this._canvas,m);p=h[r||i.type](i,g,m)}else c3(r||i.type)||(p=h[r||i.type](i));this.mergeHandlerResult(o,n,p,c,a),p?.needsRenderFrame&&this._triggerRenderFrame(),p?.timeout&&this._startTimeout(h,p.timeout)}(p||h.isActive())&&(s[c]=h)}let l={};for(let c in this._previousActiveHandlers)s[c]||(l[c]=a);this._previousActiveHandlers=s,(Object.keys(l).length||Hh(o))&&(this._changes.push([o,n,l]),this._triggerRenderFrame()),(Object.keys(s).length||Hh(o))&&this._camera.stop(),this._updatingCamera=!1;let{easeTo:u}=o;u&&(this.stop(!0),this._camera.easeTo(u,{originalEvent:a}))},this._camera=e.camera,this._dragPan=e.dragPan,this._el=e.canvasContainer,this._canvas=e.canvas,this._renderLoop=e.renderLoop,this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new XF(this._camera),this._bearingSnap=e.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={};for(let{handlerName:i,handler:r,allowed:a}of e.registrations)r instanceof qe&&r.setEventedParent(this),this._add(i,r,a);let t=this._el;this._domListeners=[[t,"touchstart",{passive:!0}],[t,"touchmove",{passive:!1}],[t,"touchend",void 0],[t,"touchcancel",void 0],[t,"mousedown",void 0],[t,"mousemove",void 0],[t,"mouseup",void 0],[this._ownerDocument,"mousemove",{capture:!0}],[this._ownerDocument,"mouseup",void 0],[t,"mouseover",void 0],[t,"mouseout",void 0],[t,"dblclick",void 0],[t,"click",void 0],[t,"keydown",{capture:!1}],[t,"keyup",void 0],[t,"wheel",{passive:!1}],[t,"contextmenu",void 0],[this._ownerWindow,"blur",void 0]];for(let[i,r,a]of this._domListeners)i.addEventListener(r,i===this._ownerDocument?this.handleWindowEvent:this.handleEvent,a)}destroy(){this._frameId!==void 0&&this._renderLoop.cancelRenderFrame(this._frameId);for(let e of this._timeouts)clearTimeout(e);for(let[e,t,i]of this._domListeners)e.removeEventListener(t,e===this._ownerDocument?this.handleWindowEvent:this.handleEvent,i)}_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._handlers.some(({handler:e})=>e.isZooming?.())}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Sl(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,t,i){for(let r in e)if(r!==i&&!t?.includes(r))return!0;return!1}_getMapTouches(e){let t=[];for(let i of e){let r=i.target;this._el.contains(r)&&t.push(i)}return t}mergeHandlerResult(e,t,i,r,a){if(!i)return;ee(e,i);let o={handlerName:r,originalEvent:i.originalEvent||a};i.zoomDelta!==void 0&&(t.zoom=o),i.panDelta!==void 0&&(t.drag=o),i.rollDelta!==void 0&&(t.roll=o),i.pitchDelta!==void 0&&(t.pitch=o),i.bearingDelta!==void 0&&(t.rotate=o)}_applyChanges(){let e={},t={},i={};for(let[r,a,o]of this._changes)r.panDelta&&(e.panDelta=(e.panDelta||new D(0,0))._add(r.panDelta)),r.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+r.zoomDelta),r.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+r.bearingDelta),r.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+r.pitchDelta),r.rollDelta&&(e.rollDelta=(e.rollDelta||0)+r.rollDelta),r.around!==void 0&&(e.around=r.around),r.pinchAround!==void 0&&(e.pinchAround=r.pinchAround),r.noInertia&&(e.noInertia=r.noInertia),ee(t,a),ee(i,o);this._updateMapCamera(e,t,i),this._changes=[]}_updateMapCamera(e,t,i){let r=this._camera.terrain;if(!Hh(e)){this._fireEvents(t,i,!0);return}this._camera.stop();let a=this._camera.getStateForUpdate();if(this._turnsAroundPivot(e,t)){this._commitFrame(this._orbitRotationPivot(a,e,r),e,t,i);return}let{panDelta:o,zoomDelta:n,bearingDelta:s,pitchDelta:l,rollDelta:u}=e;n>0&&this._terrainGesture.inFlight&&(a=this._camera.moveCenterOntoTerrain(a,n));let c=this._camera._projectState(a),{around:h,aroundOnSurface:d}=this._resolveAround(e,r,c),p=r?this._terrainGestureElevation(r,h,d,c,t):void 0,f={panDelta:o,zoomDelta:n,rollDelta:u,pitchDelta:l,bearingDelta:s,around:h,aroundElevation:p};Fn(this._camera.context)&&!V(c).isPointOnMapSurface(c,this._camera.context.worldCoordinateHelper,h)&&(h=c.centerPoint);let m=this._computePreZoomAroundLoc(c,h,o,p);a=this._handleMapControls({terrain:r,state:a,deltas:f,preZoomAroundLoc:m,combinedEventsInProgress:t,panDelta:o}),this._commitFrame(a,e,t,i)}_commitFrame(e,t,i,r){this._camera.applyUpdatedState(e),t.noInertia||this._inertia.record(t),this._fireEvents(i,r,!0)}_turnsAroundPivot(e,t){return e.around?!t.drag&&!t.zoom:!1}_orbitRotationPivot(e,t,i){i&&!this._terrainGesture.inFlight&&(this._terrainGesture.inFlight=!0,this._camera.holdElevation("gesture"));let{panDelta:r,zoomDelta:a,bearingDelta:o,pitchDelta:n,rollDelta:s,around:l}=t;this._rotationPivot??=this._camera.captureRotationPivot(this._camera._projectState(e),l);let u=this._camera.orbitRotationPivot(e,this._rotationPivot,{panDelta:r,zoomDelta:a,bearingDelta:o,pitchDelta:n,rollDelta:s,around:l});return u.held||(this._rotationPivot=null),u.state}_resolveAround(e,t,i){let r=e.pinchAround===void 0?e.around:e.pinchAround;return r||=this._camera.projectedCamera.centerPoint,t&&!V(i).isPointOnMapSurface(i,this._camera.context.worldCoordinateHelper,r)?{around:i.centerPoint,aroundOnSurface:!1}:{around:r,aroundOnSurface:!0}}_terrainGestureElevation(e,t,i,r,a){if(!i)return;if(this._terrainGesture.anchorCenterElevation!==r.elevation&&(a.drag||a.zoom)){let n=V(r).screenTerrainPointToMercatorCoordinate(r,this._camera.context.worldCoordinateHelper,t,e);this._terrainGesture.anchorElevation=n?n.z:void 0,this._terrainGesture.anchorCenterElevation=r.elevation}let o=this._terrainGesture.anchorElevation;if(o!=null&&!(t.distSqr(r.centerPoint)<0.01)&&!(o-r.elevation>=0.9*(V(r).getCameraAltitude(r)-r.elevation)))return o}_computePreZoomAroundLoc(e,t,i,r){if(t.distSqr(e.centerPoint)<0.01)return e.center;let a=i?t.sub(i):t;return r===void 0?V(e).screenPointToLocation(e,this._camera.context.worldCoordinateHelper,a):V(e).screenPointToLocationAtElevation(e,this._camera.context.worldCoordinateHelper,a,r)}_handleMapControls({terrain:e,state:t,deltas:i,preZoomAroundLoc:r,combinedEventsInProgress:a,panDelta:o}){let n=this._camera.context;t=ri(n).rollPitchBearingZoom(t,n,i);let s=this._camera._projectState(t);return!e&&!Fn(n)&&!V(s).isPointOnMapSurface(s,this._camera.context.worldCoordinateHelper,i.around)?o?this._panByPixels(t,s,o):t:e?this._terrainGesture.inFlight?!Fn(n)&&i.aroundElevation===void 0&&a.drag&&o?this._panByPixels(t,s,o):ri(n).pan(t,n,i,r):(this._terrainGesture.inFlight=!0,this._camera.holdElevation("gesture"),ri(n).pan(t,n,i,r)):ri(n).pan(t,n,i,r)}_panByPixels(e,t,i){return ii(e,this._camera.context,V(t).screenPointToLocation(t,this._camera.context.worldCoordinateHelper,t.centerPoint.sub(i)))}_fireEvents(e,t,i){let r=Sl(this._eventsInProgress),a=Sl(e),o={};for(let c in e){let{originalEvent:h}=e[c];this._eventsInProgress[c]||(o[`${c}start`]=h),this._eventsInProgress[c]=e[c]}!r&&a&&this._fireEvent("movestart",a.originalEvent);for(let c in o)this._fireEvent(c,o[c]);a&&this._fireEvent("move",a.originalEvent);for(let c in e){let{originalEvent:h}=e[c];this._fireEvent(c,h)}let n={},s;for(let c in this._eventsInProgress){let{handlerName:h,originalEvent:d}=this._eventsInProgress[c];this._handlersById[h].isActive()||(delete this._eventsInProgress[c],s=t[h]||d,n[`${c}end`]=s)}for(let c in n)this._fireEvent(c,n[c]);let l=Sl(this._eventsInProgress),u=(r||a)&&!l;if(u&&this._terrainGesture.inFlight&&(this._terrainGesture={inFlight:!1,anchorElevation:null,anchorCenterElevation:null},this._camera.releaseElevation()),i&&u){this._updatingCamera=!0;let c=this._inertia._onMoveEnd(this._dragPan._inertiaOptions),h=(d)=>d!==0&&-this._bearingSnap<d&&d<this._bearingSnap;c&&(c.essential||!li.prefersReducedMotion)?(h(c.bearing||this._camera.getBearing())&&(c.bearing=0),c.freezeElevation=!0,this._camera.easeTo(c,{originalEvent:s})):(this._fireEvent("moveend",s),h(this._camera.getBearing())&&this._camera.resetNorth()),this._updatingCamera=!1}u&&(this._rotationPivot=null)}_fireEvent(e,t){this._camera.fire(new oe(e,t?{originalEvent:t}:{}))}_requestFrame(){return this._renderLoop.requestRenderFrame((e)=>{delete this._frameId,this.handleEvent(new KF("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}_startTimeout(e,{delay:t,token:i}){let r=setTimeout(()=>{this._timeouts.delete(r);let a=e.onTimeout?.(i);a&&a.needsRenderFrame&&this._triggerRenderFrame()},t);this._timeouts.add(r)}},eR=class extends qe{constructor(e,t){super(),this._eventFactory=e,this._clickTolerance=t.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(this._eventFactory.createWheelEvent(e))}mousedown(e,t){return this._mousedownPos=t,this._firePreventable(this._eventFactory.createMouseEvent(e.type,e))}mouseup(e){this.fire(this._eventFactory.createMouseEvent(e.type,e))}click(e,t){this._mousedownPos&&this._mousedownPos.dist(t)>=this._clickTolerance||this.fire(this._eventFactory.createMouseEvent(e.type,e))}dblclick(e){return this._firePreventable(this._eventFactory.createMouseEvent(e.type,e))}mouseover(e){this.fire(this._eventFactory.createMouseEvent(e.type,e))}mouseout(e){this.fire(this._eventFactory.createMouseEvent(e.type,e))}touchstart(e){return this._firePreventable(this._eventFactory.createTouchEvent(e.type,e))}touchmove(e){this.fire(this._eventFactory.createTouchEvent(e.type,e))}touchend(e){this.fire(this._eventFactory.createTouchEvent(e.type,e))}touchcancel(e){this.fire(this._eventFactory.createTouchEvent(e.type,e))}_firePreventable(e){if(this.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}},tR=class extends qe{constructor(e,t){super(),this._eventFactory=e,this._clickTolerance=t.clickTolerance}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent,this._clearLongPress(),this._touchActive=!1}mousemove(e){this.fire(this._eventFactory.createMouseEvent(e.type,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this.fire(this._eventFactory.createMouseEvent("contextmenu",this._contextMenuEvent)),delete this._contextMenuEvent)}touchstart(e,t,i){if(this._clearLongPress(),this._touchActive=i.length>0,i.length!==1)return;this._longPressStart=t[0];let r=i[0];this._longPressTimer=setTimeout(()=>{this._longPressTimer=void 0;let a=new MouseEvent("contextmenu",{clientX:r.clientX,clientY:r.clientY,button:2,bubbles:!0,cancelable:!0});this.fire(this._eventFactory.createMouseEvent("contextmenu",a))},500)}touchmove(e,t,i){this._longPressTimer&&(i.length!==1||!this._longPressStart||t[0].dist(this._longPressStart)>this._clickTolerance)&&this._clearLongPress()}touchend(){this._touchActive=!1,this._clearLongPress()}touchcancel(){this._touchActive=!1,this._clearLongPress()}_clearLongPress(){this._longPressTimer&&=(clearTimeout(this._longPressTimer),void 0),this._longPressStart=void 0}contextmenu(e){this._touchActive?e.preventDefault():(this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this.fire(this._eventFactory.createMouseEvent(e.type,e)),this.listens("contextmenu")&&e.preventDefault())}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}},iR=class extends qe{constructor(e,t,i,r,a){super(),this._camera=r,this._el=e,this._container=t,this._clickTolerance=i.clickTolerance||1,this._boxZoomEnd=a}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,t){this.isEnabled()&&e.shiftKey&&e.button===0&&(Ve.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 r=this._startPos;this._lastPos=i,this._box||(this._box=Ve.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",e));let a=Math.min(r.x,i.x),o=Math.max(r.x,i.x),n=Math.min(r.y,i.y),s=Math.max(r.y,i.y);this._box.style.transform=`translate(${a}px,${n}px)`,this._box.style.width=`${o-a}px`,this._box.style.height=`${s-n}px`}mouseupWindow(e,t){if(!this._active||e.button!==0)return;let i=this._startPos,r=t;if(this.reset(),Ve.suppressClick(),i.x===r.x&&i.y===r.y)this._fireEvent("boxzoomcancel",e);else{if(this.fire(new _0("boxzoomend",{originalEvent:e})),this._boxZoomEnd){this._boxZoomEnd(i,r,e);return}let a=this._camera.cameraForScreenBox(i,r,this._camera.proposedProjectedCamera.bearing);if(a)return{easeTo:a}}}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&&=(this._box.remove(),null),Ve.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,t){return this.fire(new _0(e,{originalEvent:t}))}};nR={0:1,2:2};pR=class extends lm{constructor(){super(),this._zoomRate=1,this._zoomThreshold=G_}setZoomRate(e){this._zoomRate=e??1}setZoomThreshold(e){this._zoomThreshold=e??G_}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(W_(this._distance,this._startDistance))<this._zoomThreshold))return this._active=!0,{zoomDelta:W_(this._distance,i)*this._zoomRate,pinchAround:t}}};fR=class extends lm{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 r=this._vector;if(this._vector=e[0].sub(e[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:Z_(this._vector,r),pinchAround:t}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());let t=25/(Math.PI*this._minDiameter)*360,i=Z_(e,this._startVector);return Math.abs(i)<t}};mR=class extends lm{constructor(e){super(),this._currentTouchCount=0,this._cooperativeGestures=e}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(e,t,i){super.touchstart(e,t,i),this._currentTouchCount=i.length}_start(e){this._lastPoints=e,Xh(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,t,i){if(this._cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;let r=e[0].sub(this._lastPoints[0]),a=e[1].sub(this._lastPoints[1]);if(this._valid=this.gestureBeginsVertically(r,a,i.timeStamp),this._valid)return this._lastPoints=e,this._active=!0,{pitchDelta:(r.y+a.y)/2*-0.5}}gestureBeginsVertically(e,t,i){if(this._valid!==void 0)return this._valid;let r=e.mag()>=2,a=t.mag()>=2;if(!r&&!a)return;if(!r||!a)return this._firstMove===void 0&&(this._firstMove=i),i-this._firstMove<100&&void 0;let o=e.y>0==t.y>0;return Xh(e)&&Xh(t)&&o}},gR={panStep:100,bearingStep:15,pitchStep:10};CR=class extends qe{constructor(e,t,i){super(),this._bypassKey=navigator.userAgent.includes("Mac")?"metaKey":"ctrlKey",this._canvasContainer=e,this._locale=t,this._options=i,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;let e=this._canvasContainer;e.classList.add("maplibregl-cooperative-gestures"),this._container=Ve.create("div","maplibregl-cooperative-gesture-screen",e);let t=this._locale["CooperativeGesturesHandler.WindowsHelpText"];this._bypassKey==="metaKey"&&(t=this._locale["CooperativeGesturesHandler.MacHelpText"]);let i=this._locale["CooperativeGesturesHandler.MobileHelpText"],r=document.createElement("div");r.className="maplibregl-desktop-message",r.textContent=t,this._container.appendChild(r);let a=document.createElement("div");a.className="maplibregl-mobile-message",a.textContent=i,this._container.appendChild(a),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(this._container.remove(),this._canvasContainer.classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(e){return e[this._bypassKey]}notifyGestureBlocked(e,t){this._enabled&&(this.fire(new Ct("cooperativegestureprevented",{gestureType:e,originalEvent:t})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}};Hb={moving:!1,adjustment:null};Yh=["zoom","rotate","pitch","roll"];RR=class extends qe{constructor(e){super(),this._currentSegment=null,this._frameRequestId=null,this._movingAxes=Q_(),this._pendingEvents=[],this._deliveringEvents=!1,this._onRenderFrame=()=>{if(this._frameRequestId=null,!this._currentSegment)return;let{startTime:t,options:{duration:i,easing:r}}=this._currentSegment,a=Math.min((Fe()-t)/i,1);this._runSegmentFrame(this._currentSegment,r(a),a===1)},this._renderLoop=e}isMoving(){return this._currentSegment!==null}isMovingAxis(e){return this._movingAxes[e]}isContinuedBy(e){return!!e&&this._currentSegment?.options.easeId===e}scheduleSegment(e,t){let i=this.isContinuedBy(t.easeId);i?this._stopSegment(this._currentSegment):this.interrupt(),this._currentSegment={segment:e,options:t,startTime:Fe()},this._queueStartEvents(t,i),t.duration===0?this._runSegmentFrame(this._currentSegment,1,!0):(this._requestRenderFrame(),this._deliverPendingEvents())}interrupt(){if(!this._currentSegment)return;let{eventData:e}=this._currentSegment.options;this._stopSegment(this._currentSegment),this._queueEndEvents(e),this._deliverPendingEvents()}fireAfterQueued(e){for(let t of e)this._pendingEvents.push({event:t});this._deliverPendingEvents()}_runSegmentFrame(e,t,i){e.segment.onFrame(t),this._queueFrameEvents(e),i||this._requestRenderFrame(),this._deliverPendingEvents(),i&&this._currentSegment===e&&(this._finishSegment(e),this._queueEndEvents(e.options.eventData),this._deliverPendingEvents())}_stopSegment(e){this._cancelRenderFrame(),this._pendingEvents=this._pendingEvents.filter((t)=>t.frameSegment!==e),this._finishSegment(e)}_finishSegment(e){this._currentSegment=null,e.segment.onFinish()}_requestRenderFrame(){this._frameRequestId=this._renderLoop.requestRenderFrame(this._onRenderFrame)}_cancelRenderFrame(){this._frameRequestId!==null&&(this._renderLoop.cancelRenderFrame(this._frameRequestId),this._frameRequestId=null)}_queueStartEvents(e,t){!t&&!e.movestartFired&&this._pendingEvents.push({event:new oe("movestart",e.eventData)});for(let i of Yh)e.axes[i]&&!this._movingAxes[i]&&(this._movingAxes[i]=!0,this._pendingEvents.push({event:new oe(`${i}start`,e.eventData)}))}_queueFrameEvents(e){let{eventData:t}=e.options;this._pendingEvents.push({event:new oe("move",t),frameSegment:e});for(let i of Yh)this._movingAxes[i]&&this._pendingEvents.push({event:new oe(i,t),frameSegment:e})}_queueEndEvents(e){let t=this._movingAxes;this._movingAxes=Q_();for(let i of Yh)t[i]&&this._pendingEvents.push({event:new oe(`${i}end`,e)});this._pendingEvents.push({event:new oe("moveend",e)})}_deliverPendingEvents(){if(!this._deliveringEvents){this._deliveringEvents=!0;try{for(;this._pendingEvents.length;)this.fire(this._pendingEvents.shift().event)}catch(e){throw this._pendingEvents=[],e}finally{this._deliveringEvents=!1}}}};OR=class extends qe{get renderedState(){let{view:e,motion:t,terrainRevision:i,centerElevation:r}=this._state,a=this.context,o=this.terrain,n=this._centerClampedToGround,s=this._renderedFrom;return(s?.view!==e||s.motion!==t||s.terrainRevision!==i||s.centerElevation!==r||s.context!==a||s.terrain!==o||s.centerClampedToGround!==n)&&(this._renderedFrom={view:e,motion:t,terrainRevision:i,centerElevation:r,context:a,terrain:o,centerClampedToGround:n,rendered:this._renderedFromProposal()}),this._renderedFrom.rendered}get projectedCamera(){return Li(this.renderedState,this.context)}get context(){let{projection:e,projectionTransition:t}=this._state,i=this._context;return(i?.projection!==e||i.projectionTransition!==t||i.worldCoordinateHelper!==this._worldCoordinateHelper||i.constrainOverride!==this._constrainOverride)&&(this._context=L_({projection:e,projectionTransition:t,worldCoordinateHelper:this._worldCoordinateHelper,constrainOverride:this._constrainOverride})),this._context}constructor(e){super(),this._context=null,this._renderedFrom=null,this._batching=0,this._changedInBatch=!1,this._onStateChange=(r,a)=>{(r.view!==a.view||r.centerElevation!==a.centerElevation||r.terrainRevision!==a.terrainRevision)&&(this._changedInBatch=!0)},this._worldCoordinateHelper=ja,this._constrainOverride=e.transformConstrain??null;let t=L_({constrainOverride:this._constrainOverride}),i=d2();e.minZoom!==void 0&&(i=Lb(i,t,e.minZoom)),e.maxZoom!==void 0&&(i=Bb(i,t,e.maxZoom)),e.minPitch!==void 0&&(i=Ob(i,e.minPitch)),e.maxPitch!==void 0&&(i=jb(i,e.maxPitch)),e.renderWorldCopies!==void 0&&(i=Nb(i,t.worldCoordinateHelper,e.renderWorldCopies)),this._elevationHandedOut=i.elevation,this._store=e.store,this._store.setState({camera:Xb(i)}),BR(this._store,(r)=>r.camera,this._onStateChange),this._bearingSnap=e.bearingSnap,this._zoomSnap=e.zoomSnap,this.terrain=e.terrain,this._centerClampedToGround=e.centerClampedToGround??!0,this.transformCameraUpdate=e.transformCameraUpdate??null,this._scheduler=new RR(e.renderLoop),this._scheduler.setEventedParent(this),this.on("moveend",()=>{this._scheduler.isMoving()||this._dispatch(K_(this.renderedState))})}get _state(){return this._store.getState().camera}_dispatch(e){this._batch(()=>{this._store.setState((t)=>{let i=Yb(t.camera,e);return i===t.camera?t:{camera:i}})})}_batch(e){this._batching++;try{e()}finally{this._batching--}if(this._batching)return;let t=this._changedInBatch;this._changedInBatch=!1,t&&this._adjustMovement()}get proposedProjectedCamera(){return this._projectState(this._viewAsDrawn())}_projectState(e){return Li(e,this.context)}_metricsOf(e){return cr(e,this.context.worldCoordinateHelper)}setTerrain(e){this.terrain=e,this._batch(()=>{let t=this._state.centerElevation;if(!e||t.rule!=="held"||!this.getCenterClampedToGround())return;let i=this.proposedProjectedCamera;e.getElevationAndDEMStateForLngLat(i.center,i.tileZoom).demState!=="loaded"&&this._dispatch(X_(Dl(0),ya({...t,dem:"awaiting"})))}),this.applyTerrainChange()}migrateProjection(e,t){this._worldCoordinateHelper=t,this._batch(()=>{this._dispatch(kR(e)),this._dispatch(PR(this.context))})}setConstrainOverride(e){this._constrainOverride!==e&&(this._constrainOverride=e,this.applyStateChange(Tr))}resize(e,t,i){this._dispatch(MR(this.context,e,t,i))}setProjectionTransition(e){this._dispatch(FR(e))}getCenter(){return new Y(this.renderedState.center.lng,this.renderedState.center.lat)}unproject(e){let t=this.projectedCamera;return V(t).screenPointToLocation(t,this.context.worldCoordinateHelper,D.convert(e),this.terrain)}setCenter(e,t){return this.jumpTo({center:e},t)}getCenterElevation(){return this.renderedState.elevation}setCenterElevation(e,t){return this.jumpTo({elevation:e},t),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(e){this._centerClampedToGround=e}panBy(e,t,i){return e=D.convert(e).mult(-1),this.panTo(this.renderedState.center,ee({offset:e},t),i)}panTo(e,t,i){return this.easeTo(ee({center:e},t),i)}getZoom(){return this.renderedState.zoom}setZoom(e,t){return this.jumpTo({zoom:e},t),this}zoomTo(e,t,i){return this.easeTo(ee({zoom:e},t),i)}zoomIn(e,t){return this.zoomTo(xi(this.getZoom()+1,this._zoomSnap),e,t),this}zoomOut(e,t){return this.zoomTo(xi(this.getZoom()-1,this._zoomSnap),e,t),this}getVerticalFieldOfView(){return gf(this.renderedState)}setVerticalFieldOfView(e,t){return e!=this.getVerticalFieldOfView()&&(this.applyStateChange((i)=>MF(i,e)),this.fire(new oe("movestart",t)).fire(new oe("move",t)).fire(new oe("moveend",t))),this}getBearing(){return _o(this.renderedState)}setZoomSnap(e){return this._zoomSnap=e,this}getZoomSnap(){return this._zoomSnap}setBearing(e,t){return this.jumpTo({bearing:e},t),this}getPadding(){return{...this.renderedState.padding}}setPadding(e,t){return this.jumpTo({padding:e},t),this}rotateTo(e,t,i){return this.easeTo(ee({bearing:e},t),i)}resetNorth(e,t){return this.rotateTo(0,ee({duration:1000},e),t),this}resetNorthPitch(e,t){return this.easeTo(ee({bearing:0,pitch:0,roll:0,duration:1000},e),t),this}snapToNorth(e,t){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,t):this}getPitch(){return Gi(this.renderedState)}setPitch(e,t){return this.jumpTo({pitch:e},t),this}getRoll(){return vn(this.renderedState)}setRoll(e,t){return this.jumpTo({roll:e},t),this}cameraForBounds(e,t){e=Nr.convert(e).adjustAntiMeridian();let i=t?.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),i,t)}_cameraForBoxAndBearing(e,t,i,r){let a={top:0,bottom:0,right:0,left:0};if(r=ee({padding:a,offset:[0,0],maxZoom:this.renderedState.maxZoom},r),typeof r.padding=="number"){let h=r.padding;r.padding={top:h,bottom:h,right:h,left:h}}let o=ee(a,r.padding);r.padding=o;let n=new Nr(e,t),s={top:0,bottom:0,right:0,left:0},l=r.absolutePadding?s:o,u=r.absolutePadding?o:ee(s,this.renderedState.padding),c=ri(this.context).cameraForBoxAndBearing(r,l,u,n,i,this.renderedState,this.context);if(c)return this._zoomSnap&&(c.zoom=xi(c.zoom,this._zoomSnap,-1)),r.absolutePadding?{...c,padding:o}:c}fitBounds(e,t,i){return this._fitInternal(this.cameraForBounds(e,t),t,i)}fitScreenCoordinates(e,t,i,r,a){return this._fitInternal(this.cameraForScreenBox(e,t,i,r),r,a)}cameraForScreenBox(e,t,i,r){let a=this.projectedCamera,o=V(a),{worldCoordinateHelper:n}=this.context;return this._cameraForBoxAndBearing(o.screenPointToLocation(a,n,D.convert(e)),o.screenPointToLocation(a,n,D.convert(t)),i,r)}_fitInternal(e,t,i){return e?(t=ee(e,t),t.absolutePadding?(t.padding=e.padding,delete t.absolutePadding):delete t.padding,t.linear?this.easeTo(t,i):this.flyTo(t,i)):this}jumpTo(e,t){this._scheduler.interrupt(),e.zoom!==void 0&&this._zoomSnap&&(e.zoom=xi(e.zoom,this._zoomSnap));let i=this.getStateForUpdate(),r=this.context,a=i.zoom;if(this.terrain&&this.getCenterClampedToGround()){let c=e.center?Y.convert(e.center):i.center,{elevation:h,demState:d}=this.terrain.getElevationAndDEMStateForLngLat(c,this._metricsOf(i).tileZoom);d!=="loading"&&(i=_a(i,r,h))}i=ri(r).jumpToCenterZoom(i,r,e);let o=i.zoom!==a,n=e.bearing!==void 0&&_o(i)!==+e.bearing,s=e.pitch!==void 0&&Gi(i)!==+e.pitch,l=e.roll!==void 0&&vn(i)!==+e.roll;e.elevation!==void 0&&i.elevation!==+e.elevation&&(i=_a(i,r,+e.elevation)),n&&(i=Zi(i,+e.bearing)),s&&(i=Hi(i,+e.pitch)),l&&(i=ra(i,+e.roll)),e.padding!=null&&!Fo(i.padding,e.padding)&&(i=nm(i,r,e.padding)),this.applyUpdatedState(i);let u=[new oe("movestart",t),new oe("move",t)];return o&&u.push(new oe("zoomstart",t),new oe("zoom",t),new oe("zoomend",t)),n&&u.push(new oe("rotatestart",t),new oe("rotate",t),new oe("rotateend",t)),s&&u.push(new oe("pitchstart",t),new oe("pitch",t),new oe("pitchend",t)),l&&u.push(new oe("rollstart",t),new oe("roll",t),new oe("rollend",t)),u.push(new oe("moveend",t)),this._scheduler.fireAfterQueued(u),this}calculateAnchoredCameraOptions(e){let t=this.projectedCamera,i=Y.convert(e.anchorLocation),r=D.convert(e.anchorScreenPoint),a={panDelta:r.sub(V(t).locationToScreenPoint(t,this.context.worldCoordinateHelper,i,this.terrain)),zoomDelta:e.zoom===void 0?0:e.zoom-t.zoom,bearingDelta:0,pitchDelta:0,rollDelta:0,around:r,aroundElevation:this.terrain?.getElevationForLngLat(i,t.tileZoom)},o=ri(this.context).rollPitchBearingZoom(this.renderedState,this.context,a),n=ri(this.context).pan(o,this.context,a,i);return{center:n.center,zoom:n.zoom}}calculateCameraOptionsFromCameraLngLatAltRotation(e,t,i,r,a){let o=kF(this.renderedState,this.context.worldCoordinateHelper,e,t,i,r);return{center:o.center,elevation:o.elevation,zoom:o.zoom,bearing:i,pitch:r,roll:a}}easeTo(e,t){this._scheduler.isContinuedBy(e.easeId)||this._scheduler.interrupt(),e=ee({offset:[0,0],duration:500,easing:nd},e),e.zoom!==void 0&&this._zoomSnap&&(e.zoom=xi(e.zoom,this._zoomSnap)),(e.animate===!1||!e.essential&&li.prefersReducedMotion)&&(e.duration=0);let i=this.getStateForUpdate(),r=this.getBearing(),a=Gi(i),o=vn(i),n=e.bearing===void 0?r:this._normalizeBearing(e.bearing,r),s=e.pitch===void 0?a:+e.pitch,l=e.roll===void 0?o:this._normalizeBearing(e.roll,o),u=e.padding===void 0?i.padding:e.padding,c=D.convert(e.offset),h,d;if(e.around){h=Y.convert(e.around);let m=this._projectState(i);d=V(m).locationToScreenPoint(m,this.context.worldCoordinateHelper,h)}let p=ri(this.context).easeTo(i,this.context,{bearing:n,pitch:s,roll:l,padding:u,around:h,aroundPoint:d,offsetAsPoint:c,offset:e.offset,zoom:e.zoom,center:e.center}),f=this._createElevationEase(i,p.elevationCenter,e.freezeElevation);return this._scheduler.scheduleSegment({onFrame:(m)=>{let g=p.easeFunc(this._viewForUpdate(),this.context,m);this.applyUpdatedState(f.easeFunc(g,m))},onFinish:()=>this._finishAnimationElevation(e.freezeElevation)},{duration:e.duration,easing:e.easing,axes:{zoom:p.isZooming,rotate:r!==n,pitch:s!==a,roll:l!==o},eventData:t,easeId:e.easeId,movestartFired:e.noMoveStart}),this}_createElevationEase(e,t,i){if(i)return this.terrain&&this.holdElevation("animation"),{easeFunc:(a)=>a};let r=this.terrain?this._startElevationEasing(t,e):null;return{easeFunc:(a,o)=>this.terrain?(r??=this._startElevationEasing(a.center,a),r(a,o)):a}}_startElevationEasing(e,t){this._dispatch(ya({rule:"eased"}));let i=this._metricsOf(t).tileZoom,r=this.terrain.getElevationAndDEMStateForLngLat(e,i),a=t.elevation,o=r.demState==="loading"?t.elevation:r.elevation;return(n,s)=>{let{elevation:l,demState:u}=this.terrain.getElevationAndDEMStateForLngLat(e,i);if(s<1&&u!=="loading"&&l!==o){let c=Ze.number(a,o,s);a=c-s*((l-c)/(1-s)),o=l}return this.getCenterClampedToGround()?_a(n,this.context,Ze.number(a,o,s)):n}}holdElevation(e){let t=this.proposedProjectedCamera,i=!!this.terrain&&this.getCenterClampedToGround()&&this.terrain.getElevationAndDEMStateForLngLat(t.center,t.tileZoom).demState!=="loaded",r=this.terrain?this._terrainHeightAboveMaxZoomForCenter(t):void 0;this._dispatch(ya({rule:"held",holder:e,dem:i?"awaiting":"loaded",keepsTerrainBelowMaxZoomForCenter:r!==void 0&&r<=ty}))}isHoldingElevation(){return this._state.centerElevation.rule==="held"}releaseElevation(){let e=this._state.centerElevation;e.rule==="held"&&this._batch(()=>{let t=this.getStateForUpdate();this._dispatch(ya({rule:"ground"})),this.getCenterClampedToGround()&&(t=this.terrain?this.putCenterBackOnTerrain(t,this.terrain,e.dem==="taken"):_a(t,this.context,0)),this.applyUpdatedState(t)})}putCenterBackOnTerrain(e,t,i){if(!i||t.getDrawnElevationForLngLat(e.center,!0)!==void 0)return ui(this.context).recenterOnTerrain(e,this.context,t);let r=t.getElevationForLngLat(e.center,this._metricsOf(e).tileZoom);return this._raiseCameraByPitchAndZoom(_a(e,this.context,r))}applyTerrainChange(){this._batch(()=>{this._dispatch(J_()),this._followTerrainByRule()})}followTerrain(){let e=this.renderedState,t=this._minElevationUnder(e)!==e.minElevationForCurrentTile;this._batch(()=>{t&&this._dispatch(J_()),this._state.motion.moving||this._followTerrainByRule()})}_followTerrainByRule(){if(!this.getCenterClampedToGround())return;let e=this._state.centerElevation;if(e.rule==="eased")return;if(!this.terrain){e.rule==="ground"&&this._dispatch(Dl(0));return}let t=this.proposedProjectedCamera;if(e.rule==="ground"){let{elevation:r,demState:a}=this.terrain.getElevationAndDEMStateForLngLat(t.center,t.tileZoom);a!=="loading"&&this._dispatch(Dl(r));return}let i=AR(e,t.center,this.terrain);i&&this._dispatch(X_(ya(i.hold),Dl(i.elevation))),this._noteTerrainBelowMaxZoomForCenter()}_noteTerrainBelowMaxZoomForCenter(){let e=this._state.centerElevation;if(e.rule!=="held"||e.keepsTerrainBelowMaxZoomForCenter)return;let t=this.proposedProjectedCamera;if(t.pitch>=90||V(t).getClippingPlane(t))return;let i=this._terrainHeightAboveMaxZoomForCenter(t);i!==void 0&&i<=ty&&this._dispatch(ya({...e,keepsTerrainBelowMaxZoomForCenter:!0}))}_minElevationUnder(e){return this.terrain?this.terrain.getMinTileElevationForLngLatZoom(e.center,this._metricsOf(e).tileZoom):0}_viewAsDrawn(){let{view:e}=this._state,t=N_(e,this._minElevationUnder(e)),i=this._drawnElevation(t);return i===t.elevation?t:_a(t,this.context,i)}_viewForUpdate(){let e=this._viewAsDrawn();return this._elevationHandedOut=e.elevation,e}_drawnElevation(e){if(!this.getCenterClampedToGround())return e.elevation;if(!this.terrain)return 0;let t=this._state.centerElevation;if(t.rule!=="held"||Gi(e)>=90)return e.elevation;let i=this._projectState(e);if(V(i).getClippingPlane(i))return e.elevation;let r=(t.keepsTerrainBelowMaxZoomForCenter?this._terrainHeightAboveMaxZoomForCenter(i):void 0)??-1/0,a=t.holder==="gesture"?this._terrainHeightAboveCamera(i):-1/0;return e.elevation+Math.max(0,a,r)}_isLiftedByHold(e){let t=this._state.centerElevation;return!!this.terrain&&t.rule==="held"&&t.holder==="gesture"&&this.getCenterClampedToGround()&&Gi(e)<90&&!An(this._projectState(e))}getStateForUpdate(){return this._dispatch(IR()),this._viewForUpdate()}_raiseCameraByPitchAndZoom(e){let t=this._projectState(e);if(!this.terrain&&e.elevation>=0&&t.pitch<=90||V(t).getClippingPlane(t))return e;let i=V(t).getCameraLngLat(t,this.context.worldCoordinateHelper),r=this._heightAboveCamera(t);if(r<=0)return e;let a=e;for(let o=0;o<3&&r>0;o++){let n=this._projectState(a),s=V(n).getCameraAltitude(n),{zoom:l,pitch:u}=ui(this.context).calculateCameraOptionsFromTo(a,this.context,i,s+r,a.center,a.elevation);a=Hi(pt(a,this.context,l),u),r=this._heightAboveCamera(this._projectState(a))}return a}_heightAboveCamera(e){return this.terrain?this._terrainHeightAboveCamera(e):-V(e).getCameraAltitude(e)}_terrainHeightAboveCamera(e){let t=this.terrain.getElevationForLngLat(V(e).getCameraLngLat(e,this.context.worldCoordinateHelper),e.tileZoom)-V(e).getCameraAltitude(e),i=V(e).getClippingPlane(e)?null:this.terrain.getCoverageIndex();if(!i)return t;let[r,a,o,n]=V(e).getCameraFrustum(e).points;for(let s=0;s<=2;s++){let l=s/2;for(let u=0;u<=2;u++){let c=u/2,h=(1-c)*(1-l),d=c*(1-l),p=c*l,f=(1-c)*l,m=h*r[0]+d*a[0]+p*o[0]+f*n[0],g=h*r[1]+d*a[1]+p*o[1]+f*n[1],_=h*r[2]+d*a[2]+p*o[2]+f*n[2],y=Ro(i,this.terrain.exaggeration,m,g,this.context.worldCoordinateHelper.wraps);y.covered&&(t=Math.max(t,y.elevation-_))}}return t}_terrainHeightAboveMaxZoomForCenter(e){let t=this.terrain.getCoverageIndex();if(!t)return;let i=this.context.worldCoordinateHelper,r=V(e).getCameraLngLat(e,this.context.worldCoordinateHelper),a=i.worldFromLngLat(r.lng,r.lat),o=i.worldFromLngLat(e.center.lng,e.center.lat),n=St(e.zoom-e.maxZoom),s=Ro(t,this.terrain.exaggeration,ea(a.x,o.x,n),ea(a.y,o.y,n),i.wraps);return s.covered?s.elevation-ea(V(e).getCameraAltitude(e),e.elevation,n):void 0}moveCenterOntoTerrain(e,t){if(!this.terrain||!this.getCenterClampedToGround()||An(this._projectState(e)))return e;let i=ui(this.context).recenterOnTerrain(e,this.context,this.terrain);if(!(i.zoom>e.zoom-t&&i.zoom<i.maxZoom))return e;let r=this.terrain.getElevationForLngLat(i.center,this._metricsOf(i).tileZoom);return Math.abs(r-i.elevation)<1?i:e}captureRotationPivot(e,t){if(!ay(e,this.context.worldCoordinateHelper,t))return{point:e.centerPoint,location:e.center,distance:Nl(e,this.context.worldCoordinateHelper,e.center)};let i=this.terrain?V(e).screenTerrainPointToMercatorCoordinate(e,this.context.worldCoordinateHelper,t,this.terrain):null,r=i?i.toLngLat():V(e).screenPointToLocation(e,this.context.worldCoordinateHelper,t);return i&&Fn(this.context)?{point:V(e).locationToScreenPoint(e,this.context.worldCoordinateHelper,r),location:r,distance:Nl(e,this.context.worldCoordinateHelper,r)}:{point:t,location:r,elevation:i?.z,distance:Nl(e,this.context.worldCoordinateHelper,r,i?.z)}}orbitRotationPivot(e,t,i){if(t.point.equals(hr(e)))return{state:ri(this.context).rollPitchBearingZoom(e,this.context,i),held:!0};let r=this._turnAroundPivot(e,t,i)??this._turnAroundPivot(e,t,{...i,pitchDelta:0,rollDelta:0});return r?{state:r,held:!0}:{state:ri(this.context).rollPitchBearingZoom(e,this.context,i),held:!1}}_turnAroundPivot(e,t,i){let r=ri(this.context).rollPitchBearingZoom(e,this.context,i);if(Gi(r)>=90||!ay(this._projectState(r),this.context.worldCoordinateHelper,t.point))return null;let a=jR(r,this.context,t);return a&&NR(this._projectState(a),this.context.worldCoordinateHelper,t)?a:null}applyUpdatedState(e){this._batch(()=>{this._dispatch(Kb(e.elevation===this._elevationHandedOut?{...e,elevation:this._state.view.elevation}:e)),this._followTerrainByRule()})}applyStateChange(e){let t=this._state.motion.moving;this.applyUpdatedState(e(this.getStateForUpdate(),this.context)),t||this._dispatch(K_(this.renderedState))}_renderedFromProposal(){let e=this._viewAsDrawn(),t=this._state.motion;if(!t.moving)return e;let i=this._correctedForMovement(e),r=t.adjustment;if(!r)return i;let a=this._applyAdjustment(i,r);return N_(a,this._minElevationUnder(a))}_correctedForMovement(e){return this._isLiftedByHold(e)?e:this._raiseCameraByPitchAndZoom(e)}_adjustMovement(){if(!this._state.motion.moving)return;if(!this.transformCameraUpdate){this._dispatch(Y_(null));return}let e=this._correctedForMovement(this._viewAsDrawn());this._dispatch(Y_(this.transformCameraUpdate(this._metricsOf(e))))}_applyAdjustment(e,{center:t,zoom:i,roll:r,pitch:a,bearing:o,elevation:n}){let s=this.context,l=e;return t&&(l=ii(l,s,t)),n!==void 0&&(l=_a(l,s,n)),i!==void 0&&(l=pt(l,s,i)),r!==void 0&&(l=ra(l,r)),a!==void 0&&(l=Hi(l,a)),o!==void 0&&(l=Zi(l,o)),n===void 0?l:this._raiseCameraByPitchAndZoom(l)}_finishAnimationElevation(e=!1){let t=this._state.centerElevation;t.rule==="eased"?this._dispatch(ya({rule:"ground"})):t.rule==="held"?(this._followTerrainByRule(),this.releaseElevation()):e&&this.terrain&&this.getCenterClampedToGround()&&this.applyUpdatedState(this.putCenterBackOnTerrain(this.getStateForUpdate(),this.terrain,!1))}flyTo(e,t){if(!e.essential&&li.prefersReducedMotion)return this.easeTo(e,t);this._scheduler.interrupt(),e=ee({offset:[0,0],speed:1.2,curve:1.42,easing:nd},e),e.zoom!==void 0&&this._zoomSnap&&(e.zoom=xi(e.zoom,this._zoomSnap));let i=this.getStateForUpdate(),r=_o(i),a=Gi(i),o=vn(i),n=i.padding,s=e.bearing===void 0?r:this._normalizeBearing(e.bearing,r),l=e.pitch===void 0?a:+e.pitch,u=e.roll===void 0?o:this._normalizeBearing(e.roll,o),c=e.padding===void 0?i.padding:e.padding,h=D.convert(e.offset),d=hr(i).add(h),p=this._projectState(i),f=V(p).screenPointToLocation(p,this.context.worldCoordinateHelper,d),m=ri(this.context).flyTo(i,this.context,{bearing:s,pitch:l,roll:u,padding:c,locationAtOffset:f,offsetAsPoint:h,center:e.center,minZoom:e.minZoom,zoom:e.zoom}),g=e.curve,_=Math.max(i.width,i.height),y=_/m.scaleOfZoom,v=m.pixelPathLength,x=_/m.scaleOfMinZoom;g=Math.min(g,Math.sqrt(x/v*2));let b=g*g;function w(L){let W=(y*y-_*_+(L?-1:1)*b*b*v*v)/(2*(L?y:_)*b*v);return Math.log(Math.sqrt(W*W+1)-W)}function T(L){return(Math.exp(L)-Math.exp(-L))/2}function E(L){return(Math.exp(L)+Math.exp(-L))/2}function S(L){return T(L)/E(L)}let A=w(!1),I=function(L){return E(A)/E(A+g*L)},R=function(L){return _*((E(A)*S(A+g*L)-T(A))/b)/v},k=(w(!0)-A)/g;if(Math.abs(v)<0.000002||!isFinite(k)){if(Math.abs(_-y)<0.000001)return this.easeTo(e,t);let L=y<_?-1:1;k=Math.abs(Math.log(y/_))/g,R=()=>0,I=(W)=>Math.exp(L*g*W)}if(e.duration!==void 0)e.duration=+e.duration;else{let L=e.screenSpeed===void 0?+e.speed:+e.screenSpeed/g;e.duration=1000*k/L}e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0);let M=r!==s,C=l!==a,P=u!==o,B=!Fo(i.padding,c),N=this._createElevationEase(i,m.targetCenter,e.freezeElevation);return this._scheduler.scheduleSegment({onFrame:(L)=>{let W=this.context,Q=this._viewForUpdate(),be=L*k,le=1/I(be),je=R(be);M&&(Q=Zi(Q,Ze.number(r,s,L))),C&&(Q=Hi(Q,Ze.number(a,l,L))),P&&(Q=ra(Q,Ze.number(o,u,L))),B&&(Q=Su(Q,W,n,c,L),d=hr(Q).add(h)),Q=m.easeFunc(Q,W,L,le,je,d),this.applyUpdatedState(N.easeFunc(Q,L))},onFinish:()=>this._finishAnimationElevation(e.freezeElevation)},{duration:e.animate===!1?0:e.duration,easing:e.easing,axes:{zoom:!0,rotate:M,pitch:C,roll:P},eventData:t}),this}stop(){return this._scheduler.interrupt(),this}_normalizeBearing(e,t){e=Fi(e,-180,180);let i=Math.abs(e-t);return Math.abs(e-360-t)<i&&(e-=360),Math.abs(e+360-t)<i&&(e+=360),e}isMoving(){return this._scheduler.isMoving()}isZooming(){return this._scheduler.isMovingAxis("zoom")}isRotating(){return this._scheduler.isMovingAxis("rotate")}isPitching(){return this._scheduler.isMovingAxis("pitch")}isRolling(){return this._scheduler.isMovingAxis("roll")}};Jb={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'},qR=rt([{name:"a_pos3d",type:"Int16",components:3}]),GR=class extends qe{constructor(e){super(),this._lastTilesetChange=Fe(),this.tileManager=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=e._source.tileSize*2**this.deltaZoom,e.usedForTerrain=!0,e.tileSize=this.tileSize}destruct(){this.tileManager.usedForTerrain=!1,this.tileManager.tileSize=null,this.releaseAllRTT()}getSource(){return this.tileManager._source}update(e,t,i){this.tileManager.update(e,t,i),this._renderableTilesKeys=[];let r={},a=!1;for(let o of vs(e,t,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:i}))r[o.key]=!0,this._renderableTilesKeys.push(o.key),this._tiles[o.key]||(o.terrainRttPosMatrix32f=new Float32Array(16),Pr(o.terrainRttPosMatrix32f,0,z,z,0,0,1),this._tiles[o.key]=new lb(o,this.tileSize),this._lastTilesetChange=Fe(),a=!0);for(let o in this._tiles)r[o]||(this._tiles[o].releaseRTT(this.tileManager.map.painter),delete this._tiles[o],a=!0);return a}releaseRTT(e){for(let t in this._tiles){let i=this._tiles[t];(i.tileID.equals(e)||i.tileID.isChildOf(e)||e.isChildOf(i.tileID))&&i.releaseRTT(this.tileManager.map.painter)}}releaseAllRTT(){for(let e in this._tiles)this._tiles[e].releaseRTT(this.tileManager.map.painter)}getRenderableTiles(){return this._renderableTilesKeys.map((e)=>this.getTileByID(e))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e,t){return t?this._getTerrainCoordsForTileRanges(e,t):this._getTerrainCoordsForRegularTile(e)}_getTerrainCoordsForRegularTile(e){let t={};for(let i of this._renderableTilesKeys){let r=this._tiles[i].tileID,a=e.clone(),o=Ea();if(r.canonical.equals(e.canonical))Pr(o,0,z,z,0,0,1);else if(r.canonical.isChildOf(e.canonical)){let n=r.canonical.z-e.canonical.z,s=r.canonical.x-(r.canonical.x>>n<<n),l=r.canonical.y-(r.canonical.y>>n<<n),u=z>>n;Pr(o,0,u,u,0,0,1),gt(o,o,[-s*u,-l*u,0])}else if(e.canonical.isChildOf(r.canonical)){let n=e.canonical.z-r.canonical.z,s=e.canonical.x-(e.canonical.x>>n<<n),l=e.canonical.y-(e.canonical.y>>n<<n),u=z>>n;Pr(o,0,z,z,0,0,1),gt(o,o,[s*u,l*u,0]),Xt(o,o,[1/2**n,1/2**n,0])}else continue;a.terrainRttPosMatrix32f=new Float32Array(o),t[i]=a}return t}_getTerrainCoordsForTileRanges(e,t){let i={};for(let r of this._renderableTilesKeys){let a=this._tiles[r].tileID;if(!this._isWithinTileRanges(a,t))continue;let o=e.clone(),n=Ea();if(a.canonical.z===e.canonical.z){let s=e.canonical.x-a.canonical.x+e.wrap*(1<<e.canonical.z),l=e.canonical.y-a.canonical.y;Pr(n,0,z,z,0,0,1),gt(n,n,[s*z,l*z,0])}else if(a.canonical.z>e.canonical.z){let s=a.canonical.z-e.canonical.z,l=a.canonical.x-(a.canonical.x>>s<<s)+e.wrap*(1<<a.canonical.z),u=a.canonical.y-(a.canonical.y>>s<<s),c=e.canonical.x-(a.canonical.x>>s),h=e.canonical.y-(a.canonical.y>>s),d=z>>s;Pr(n,0,d,d,0,0,1),gt(n,n,[-l*d+c*z,-u*d+h*z,0])}else{let s=e.canonical.z-a.canonical.z,l=e.canonical.x-(e.canonical.x>>s<<s)+e.wrap*(1<<e.canonical.z),u=e.canonical.y-(e.canonical.y>>s<<s),c=(e.canonical.x>>s)-a.canonical.x,h=(e.canonical.y>>s)-a.canonical.y,d=z<<s;Pr(n,0,d,d,0,0,1),gt(n,n,[l*z+c*d,u*z+h*d,0])}o.terrainRttPosMatrix32f=new Float32Array(n),i[r]=o}return i}getSourceTile(e,t){let i=this.tileManager._source,r=this._getSourceZoom(e,i);if(r===void 0)return;this._sourceTileCache[e.key]?.zoom!==r&&(this._sourceTileCache[e.key]={zoom:r,key:e.scaledTo(r).key});let a=this.findTileInCaches(this._sourceTileCache[e.key].key);if(!a?.dem&&t)for(;r>=i.minzoom&&!a?.dem;)a=this.findTileInCaches(e.scaledTo(r--).key);return a}isStillWaitingForDEM(e){let t=this.tileManager._source,i=this._getSourceZoom(e,t);if(i===void 0)return!1;let r=e.scaledTo(i);return t.hasTile&&!t.hasTile(r)?!1:this.findTileInCaches(r.key)?.state!=="errored"}_getSourceZoom(e,t){let i=Math.min(e.overscaledZ-this.deltaZoom,t.maxzoom);return i<t.minzoom&&(i=t.minzoom),i<=e.overscaledZ?i:void 0}findTileInCaches(e){let t=this.tileManager.getTileByID(e);return t||(t=this.tileManager._outOfViewCache.getByKey(e),t)}anyTilesAfterTime(e=Fe()){return this._lastTilesetChange>=e}_isWithinTileRanges(e,t){let i=t[e.canonical.z];return!!i&&(e.wrap>i.minWrap||e.wrap<i.maxWrap||e.canonical.x>=i.minTileXWrapped&&e.canonical.x<=i.maxTileXWrapped&&e.canonical.y>=i.minTileY&&e.canonical.y<=i.maxTileY)}},oy=["none","zoom","sourceTiles","visibleLayers","revision"],Qb={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0};XR={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Drag to rotate map, click to reset north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","GlobeControl.Enable":"Enable globe","GlobeControl.Disable":"Disable globe","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use ⌘ + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},YR=dy,sy={hash:!1,interactive:!0,bearingSnap:7,zoomSnap:0,attributionControl:Jb,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 0},scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:Ma.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,transformConstrain:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,rotateSpeed:0.8,pitchSpeed:-0.5,reduceMotion:void 0,validateStyle:!0,globalState:void 0,transformStyle:void 0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0,terrainSkirtLength:"auto",zoomLevelsToOverscale:4,anisotropicFilterPitch:20},ew=class extends qe{get _ownerWindow(){return this._container?.ownerDocument?.defaultView||window}constructor(e){super(),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new UR,this._controls=[],this._mapId=vy(),this._styleUrl=null,this._missingStyleImageResolver=null,this._lostContextSnapshot={style:null,images:{}},this._contextLost=(u)=>{u.preventDefault(),this._frameRequest&&=(this._frameRequest.abort(),null),this.painter.destroy(),this._lostContextSnapshot=this._takeStyleSnapshot(),this.style&&=(this._warnAboutUnrestorableLayers(),this.style.off("error",this._onStyleError),this.style.destroy(),null),this.fire(new il("webglcontextlost",{originalEvent:u}))},this._contextRestored=(u)=>{this._restoreStyleSnapshot(this._lostContextSnapshot),this._lostContextSnapshot={style:null,images:{}};try{this._setupPainter()}catch(c){this.fire(new ie(c));return}this.resize(),this._update(),this._resizeInternal(),this.fire(new il("webglcontextrestored",{originalEvent:u}))},this._handleWorkersRestarted=()=>{if(!this.style)return;if(!this.style._loaded){this.style.off("style.load",this._handleWorkersRestarted),this.style.once("style.load",this._handleWorkersRestarted);return}let u=this._takeStyleSnapshot();this._warnAboutUnrestorableLayers(),this.fire(new il("webglcontextlost",{originalEvent:new globalThis.Event("webglcontextlost")})),this._restoreStyleSnapshot(u),this._update(),this.fire(new il("webglcontextrestored",{originalEvent:new globalThis.Event("webglcontextrestored")}))},this._onMapScroll=(u)=>{if(u.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onStyleError=(u)=>{u.tile&&this.triggerRepaint()},this._onWindowOnline=()=>{this._update()},Ql().on("restart",this._handleWorkersRestarted),zv().watchWorkers();let t={...sy,...e,canvasContextAttributes:{...sy.canvasContextAttributes,...e.canvasContextAttributes}};if(t.minZoom!=null&&t.maxZoom!=null&&t.minZoom>t.maxZoom)throw Error("maxZoom must be greater than or equal to minZoom");if(t.minPitch!=null&&t.maxPitch!=null&&t.minPitch>t.maxPitch)throw Error("maxPitch must be greater than or equal to minPitch");if(t.minPitch!=null&&t.minPitch<0)throw Error("minPitch must be greater than or equal to 0");if(t.maxPitch!=null&&t.maxPitch>180)throw Error("maxPitch must be less than or equal to 180");let i={requestRenderFrame:(u)=>this._requestRenderFrame(u),cancelRenderFrame:(u)=>this._cancelRenderFrame(u)};this._store=LR(),this._camera=new OR({store:this._store,minZoom:t.minZoom,maxZoom:t.maxZoom,minPitch:t.minPitch,maxPitch:t.maxPitch,bearingSnap:t.bearingSnap,zoomSnap:t.zoomSnap,renderWorldCopies:t.renderWorldCopies,centerClampedToGround:t.centerClampedToGround,terrain:this.terrain,transformConstrain:t.transformConstrain,renderLoop:i,transformCameraUpdate:t.transformCameraUpdate}),this._camera.setEventedParent(this),this._interactive=t.interactive,this._maxTileCacheSize=t.maxTileCacheSize,this._maxTileCacheZoomLevels=t.maxTileCacheZoomLevels,this._canvasContextAttributes={...t.canvasContextAttributes},this._trackResize=t.trackResize===!0,this._terrainSkirtLength=t.terrainSkirtLength,this._refreshExpiredTiles=t.refreshExpiredTiles===!0,this._fadeDuration=t.fadeDuration,this._crossSourceCollisions=t.crossSourceCollisions===!0,this._collectResourceTiming=t.collectResourceTiming===!0,this._locale={...XR,...t.locale},this._clickTolerance=t.clickTolerance,this._overridePixelRatio=t.pixelRatio,this._maxCanvasSize=t.maxCanvasSize,this._zoomLevelsToOverscale=t.zoomLevelsToOverscale,this.cancelPendingTileRequestsWhileZooming=t.cancelPendingTileRequestsWhileZooming===!0,this.setAnisotropicFilterPitch(t.anisotropicFilterPitch),t.reduceMotion!==void 0&&(li.prefersReducedMotion=t.reduceMotion),this._requestManager=new tT(t.transformRequest),this._container=this._resolveContainer(t.container),t.maxBounds&&this.setMaxBounds(t.maxBounds),this._setupContainer();try{this._setupPainter()}catch(u){throw this._cleanupContainer(),u}this._imageQueueHandle=_r.addThrottleControl(()=>this.isMoving()),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.markTerrainDepthDirty(),this._update(!0)}),this.once("idle",()=>this._idleTriggered=!0),this._eventFactory=new QF(this);let r=typeof t.boxZoom=="object"?t.boxZoom.boxZoomEnd:void 0,{registrations:a,mapHandlers:o}=DR({camera:this._camera,canvas:this._canvas,canvasContainer:this._canvasContainer,container:this._container,locale:this._locale,eventFactory:this._eventFactory,boxZoomEnd:r&&((u,c,h)=>r(this,u,c,h))},t);this.boxZoom=o.boxZoom,this.cooperativeGestures=o.cooperativeGestures,this.doubleClickZoom=o.doubleClickZoom,this.touchPitch=o.touchPitch,this.dragRotate=o.dragRotate,this.dragPan=o.dragPan,this.touchZoomRotate=o.touchZoomRotate,this.scrollZoom=o.scrollZoom,this.keyboard=o.keyboard,this._handlerManager=new JF({camera:this._camera,renderLoop:i,canvas:this._canvas,canvasContainer:this._canvasContainer,bearingSnap:t.bearingSnap,dragPan:o.dragPan,registrations:a}).setEventedParent(this),typeof window<"u"&&(this._ownerWindow.addEventListener("online",this._onWindowOnline,!1),this._setupResizeObserver());let n=typeof t.hash=="string"&&t.hash||void 0;this._hash=t.hash?new xF(n).addTo(this):void 0,this._hash?._onHashChange()||(this.jumpTo({center:t.center,elevation:t.elevation,zoom:t.zoom,bearing:t.bearing,pitch:t.pitch,roll:t.roll}),t.bounds&&(this.resize(),this.fitBounds(t.bounds,ee({},t.fitBoundsOptions,{duration:0}))));let s=typeof t.style=="string"?void 0:t.style?.projection?.type,l=s!=="globe"&&!rc(s);this.resize(null,l),this._localIdeographFontFamily=t.localIdeographFontFamily,this._validateStyle=t.validateStyle,this._initialGlobalState=t.globalState,this._transformStyle=t.transformStyle,t.style&&this.setStyle(t.style,{localIdeographFontFamily:t.localIdeographFontFamily}),t.attributionControl&&this.addControl(new VR(typeof t.attributionControl=="boolean"?void 0:t.attributionControl)),t.maplibreLogo&&this.addControl(new $R,t.logoPosition),this.on("style.load",()=>{if(l||this._resizeCameraView(),this._camera.renderedState.unmodified){let u=Au(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(u)}}),this.on("data",(u)=>{this._update(u.dataType==="style"),this.fire(u.dataType==="style"?new qi("styledata",u):new He("sourcedata",u))}),this.on("dataloading",(u)=>{this.fire(u.dataType==="style"?new qi("styledataloading",u):new He("sourcedataloading",u))}),this.on("dataabort",(u)=>{this.fire(new He("sourcedataabort",u))})}_getMapId(){return this._mapId}setGlobalStateProperty(e,t){return this.style.setGlobalStateProperty(e,t),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(e,t){if(t===void 0&&(t=e.getDefaultPosition?e.getDefaultPosition():"top-right"),!e?.onAdd)return this.fire(new ie(Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let i=e.onAdd(this);this._controls.push(e);let r=this._controlPositions[t];return t.includes("bottom")?r.insertBefore(i,r.firstChild):r.appendChild(i),this}removeControl(e){if(!e?.onRemove)return this.fire(new ie(Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let t=this._controls.indexOf(e);return t>-1&&this._controls.splice(t,1),e.onRemove(this),this}hasControl(e){return this._controls.includes(e)}coveringTiles(e){return vs(this._camera.projectedCamera,this._camera.context.worldCoordinateHelper,e)}setTransformCameraUpdate(e){this._camera.transformCameraUpdate=e}getCenter(){return this._camera.getCenter()}setCenter(e,t){return this._camera.setCenter(e,t),this}getCenterElevation(){return this._camera.getCenterElevation()}setCenterElevation(e,t){return this._camera.setCenterElevation(e,t),this}setCenterClampedToGround(e){this._camera.setCenterClampedToGround(e)}panBy(e,t,i){return this._camera.panBy(e,t,i),this}panTo(e,t,i){return this._camera.panTo(e,t,i),this}getZoom(){return this._camera.getZoom()}setZoom(e,t){return this._camera.setZoom(e,t),this}zoomTo(e,t,i){return this._camera.zoomTo(e,t,i),this}zoomIn(e,t){return this._camera.zoomIn(e,t),this}zoomOut(e,t){return this._camera.zoomOut(e,t),this}getVerticalFieldOfView(){return this._camera.getVerticalFieldOfView()}setVerticalFieldOfView(e,t){return this._camera.setVerticalFieldOfView(e,t),this}getBearing(){return this._camera.getBearing()}setBearing(e,t){return this._camera.setBearing(e,t),this}getZoomSnap(){return this._camera.getZoomSnap()}setZoomSnap(e){return this._camera.setZoomSnap(e),this}getPadding(){return this._camera.getPadding()}setPadding(e,t){return this._camera.setPadding(e,t),this}rotateTo(e,t,i){return this._camera.rotateTo(e,t,i),this}resetNorth(e,t){return this._camera.resetNorth(e,t),this}resetNorthPitch(e,t){return this._camera.resetNorthPitch(e,t),this}snapToNorth(e,t){return this._camera.snapToNorth(e,t),this}getPitch(){return this._camera.getPitch()}setPitch(e,t){return this._camera.setPitch(e,t),this}getRoll(){return this._camera.getRoll()}setRoll(e,t){return this._camera.setRoll(e,t),this}cameraForBounds(e,t){return this._camera.cameraForBounds(e,t)}fitBounds(e,t,i){return this._camera.fitBounds(e,t,i),this}fitScreenCoordinates(e,t,i,r,a){return this._camera.fitScreenCoordinates(e,t,i,r,a),this}jumpTo(e,t){return this._camera.jumpTo(e,t),this}calculateAnchoredCameraOptions(e){return this._camera.calculateAnchoredCameraOptions(e)}calculateCameraOptionsFromCameraLngLatAltRotation(e,t,i,r,a){return this._camera.calculateCameraOptionsFromCameraLngLatAltRotation(e,t,i,r,a)}easeTo(e,t){return this._camera.easeTo(e,t),this}flyTo(e,t){return this._camera.flyTo(e,t),this}stop(){return this._camera.stop(),this._handlerManager?.stop(!1),this}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLat(Y.convert(e),this._camera.projectedCamera.tileZoom):null}getCenterClampedToGround(){return this._camera.getCenterClampedToGround()}calculateCameraOptionsFromTo(e,t,i,r){return r==null&&this.terrain&&(r=this.terrain.getElevationForLngLat(i,this._camera.projectedCamera.tileZoom)),ui(this._camera.context).calculateCameraOptionsFromTo(this._camera.renderedState,this._camera.context,e,t,i,r??0)}resize(e,t=!0){if(this._lostContextSnapshot.style!==null)return this;this._resizeInternal(t);let i=!this._camera.isMoving();return i&&(this.stop(),this.fire(new oe("movestart",e)).fire(new oe("move",e))),this.fire(new Ct("resize",e)),i&&this.fire(new oe("moveend",e)),this}_resizeInternal(e=!0){let[t,i]=this._containerDimensions();this._clampedPixelRatio=this._getClampedPixelRatio(t,i),this._resizeCanvas(t,i,this._clampedPixelRatio),this.painter.resize(t,i,this._clampedPixelRatio);let r=this.painter.context.gl;!r.isContextLost()&&this.painter.overLimit()&&(this._maxCanvasSize=[r.drawingBufferWidth,r.drawingBufferHeight],this._clampedPixelRatio=this._getClampedPixelRatio(t,i),this._resizeCanvas(t,i,this._clampedPixelRatio),this.painter.resize(t,i,this._clampedPixelRatio)),this.style?.resize(),this._resizeCameraView(e)}_resizeCameraView(e=!0){let[t,i]=this._containerDimensions();this._camera.resize(t,i,e)}_getClampedPixelRatio(e,t){let{0:i,1:r}=this._maxCanvasSize,a=this.getPixelRatio(),o=e*a,n=t*a,s=o>i?i/o:1,l=n>r?r/n:1,u=Math.min(s,l);return u<1&&he("The canvas is larger than maxCanvasSize and is rendered at a lower pixel ratio to fit. Increase maxCanvasSize, within MAX_TEXTURE_SIZE, to render at full resolution."),u*a}getPixelRatio(){return this._overridePixelRatio??devicePixelRatio}setPixelRatio(e){this._overridePixelRatio=e,this.resize()}getBounds(){return V(this._camera.projectedCamera).getBounds(this._camera.projectedCamera,this._camera.context.worldCoordinateHelper)}getMaxBounds(){return tE(this._camera.renderedState)}setMaxBounds(e){let t=this.getCenter(),i=this.getZoom();this._camera.applyStateChange((n,s)=>IF(n,s,Nr.convert(e))),this._update();let r=this.getCenter(),a=i!==this.getZoom(),o=t.lat!==r.lat||t.lng!==r.lng;return a&&this.fire(new oe("zoomstart")).fire(new oe("zoom")).fire(new oe("zoomend")),(a||o)&&this.fire(new oe("movestart")).fire(new oe("move")).fire(new oe("moveend")),this}setMinZoom(e){if(e??=-2,e>=-2&&e<=this.getMaxZoom()){let t=this.getZoom();return this._camera.applyStateChange((i,r)=>Lb(i,r,e)),this._update(),t!==this.getZoom()&&this.fire(new oe("zoomstart")).fire(new oe("zoom")).fire(new oe("zoomend")).fire(new oe("movestart")).fire(new oe("move")).fire(new oe("moveend")),this}throw Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(e=!1){let t=this._camera.renderedState;return e?Dt(t,this._camera.context,t.center,t.minZoom).zoom:t.minZoom}setMaxZoom(e){if(e??=22,e>=this.getMinZoom()){let t=this.getZoom();return this._camera.applyStateChange((i,r)=>Bb(i,r,e)),this._update(),t!==this.getZoom()&&this.fire(new oe("zoomstart")).fire(new oe("zoom")).fire(new oe("zoomend")).fire(new oe("movestart")).fire(new oe("move")).fire(new oe("moveend")),this}throw Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this._camera.renderedState.maxZoom}setMinPitch(e){if(e??=0,e<0)throw Error("minPitch must be greater than or equal to 0");if(e>=0&&e<=this.getMaxPitch()){let t=this.getPitch();return this._camera.applyStateChange((i)=>Ob(i,e)),this._update(),t!==this.getPitch()&&this.fire(new oe("pitchstart")).fire(new oe("pitch")).fire(new oe("pitchend")).fire(new oe("movestart")).fire(new oe("move")).fire(new oe("moveend")),this}throw Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this._camera.renderedState.minPitch}setMaxPitch(e){if(e??=60,e>180)throw Error("maxPitch must be less than or equal to 180");if(e>=this.getMinPitch()){let t=this.getPitch();return this._camera.applyStateChange((i)=>jb(i,e)),this._update(),t!==this.getPitch()&&this.fire(new oe("pitchstart")).fire(new oe("pitch")).fire(new oe("pitchend")).fire(new oe("movestart")).fire(new oe("move")).fire(new oe("moveend")),this}throw Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this._camera.renderedState.maxPitch}getAnisotropicFilterPitch(){return this._anisotropicFilterPitch}setAnisotropicFilterPitch(e){if(e??=20,e>180)throw Error("anisotropicFilterPitch must be less than or equal to 180");if(e<0)throw Error("anisotropicFilterPitch must be greater than or equal to 0");return this._anisotropicFilterPitch=e,this._update()}getRenderWorldCopies(){return this._camera.renderedState.renderWorldCopies}setRenderWorldCopies(e){return this._camera.applyStateChange((t,i)=>Nb(t,i.worldCoordinateHelper,e)),this._update()}setTransformConstrain(e){return this._camera.setConstrainOverride(e??null),this._update()}project(e){let t=this._camera.projectedCamera;return V(t).locationToScreenPoint(t,this._camera.context.worldCoordinateHelper,Y.convert(e),this.style&&this.terrain)}unproject(e){return this._camera.unproject(e)}isMoving(){return this._camera.isMoving()||this._handlerManager?.isMoving()||!1}isZooming(){return this._camera.isZooming()||this._handlerManager?.isZooming()||!1}isRotating(){return this._camera.isRotating()||this._handlerManager?.isRotating()||!1}_createDelegates(e,t,i){if(e==="mouseenter"||e==="mouseover"){let r=!1;return{mousemove:(a)=>{let o=t.filter((s)=>this.getLayer(s)),n=o.length===0?[]:this.queryRenderedFeatures(a.point,{layers:o});n.length?r||(r=!0,i.call(this,this._eventFactory.createMouseEvent(e,a.originalEvent,{features:n}))):r=!1},mouseout:()=>{r=!1}}}if(e==="mouseleave"||e==="mouseout"){let r=!1;return{mousemove:(a)=>{let o=t.filter((n)=>this.getLayer(n));(o.length===0?[]:this.queryRenderedFeatures(a.point,{layers:o})).length?r=!0:r&&(r=!1,i.call(this,this._eventFactory.createMouseEvent(e,a.originalEvent)))},mouseout:(a)=>{r&&(r=!1,i.call(this,this._eventFactory.createMouseEvent(e,a.originalEvent)))}}}{let r=(a)=>{let o=t.filter((s)=>this.getLayer(s)),n=o.length===0?[]:this.queryRenderedFeatures(a.point,{layers:o});n.length&&(a.features=n,i.call(this,a),delete a.features)};return{[e]:r}}}_addDelegatedListener(e,t){this._delegatedListeners||={},this._delegatedListeners[e]||=[],this._delegatedListeners[e].push(t);for(let i in t.delegates)this.on(i,t.delegates[i])}_removeDelegatedListener(e,t,i){if(!this._delegatedListeners?.[e])return;let r=this._delegatedListeners[e];for(let a=0;a<r.length;a++){let o=r[a];if(o.listener===i&&o.layers.length===t.length&&o.layers.every((n)=>t.includes(n))){for(let n in o.delegates)this.off(n,o.delegates[n]);r.splice(a,1);return}}}on(e,t,i){if(i===void 0)return super.on(e,t);let r=typeof t=="string"?[t]:t,a={layers:r,listener:i,delegates:this._createDelegates(e,r,i)};return this._addDelegatedListener(e,a),{unsubscribe:()=>{this._removeDelegatedListener(e,r,i)}}}once(e,t,i){if(i===void 0)return super.once(e,t);let r=typeof t=="string"?[t]:t,a={layers:r,listener:i,delegates:this._createDelegates(e,r,(o)=>{this._removeDelegatedListener(e,r,i),i.call(this,o)})};return this._addDelegatedListener(e,a),this}off(e,t,i){if(i===void 0)return super.off(e,t);let r=typeof t=="string"?[t]:t;return this._removeDelegatedListener(e,r,i),this}queryRenderedFeatures(e,t){if(!this.style)return[];let i,r=e instanceof D||Array.isArray(e),a=r?e:[[0,0],[this._camera.renderedState.width,this._camera.renderedState.height]];if(t||=(r?{}:e)||{},a instanceof D||typeof a[0]=="number")i=[D.convert(a)];else{let o=D.convert(a[0]),n=D.convert(a[1]);i=[o,new D(n.x,o.y),n,new D(o.x,n.y),o]}return this.style.queryRenderedFeatures(i,t,this._camera.projectedCamera,this._camera.context.worldCoordinateHelper)}querySourceFeatures(e,t){return this.style.querySourceFeatures(e,t)}setStyle(e,t){return t=ee({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle,globalState:this._initialGlobalState,transformStyle:this._transformStyle},t),this._styleUrl=typeof e=="string"?e:null,t.diff!==!1&&t.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&e?(this._diffStyle(e,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._updateStyle(e,t))}setTransformRequest(e){return this._requestManager.setTransformRequest(e),this}getTransformRequest(){return this._requestManager.getTransformRequest()}_getUIString(e){let t=this._locale[e];if(t==null)throw Error(`Missing UI string '${e}'`);return t}_updateStyle(e,t){if(this._diffStyleRequest?.abort(),this._diffStyleRequest=null,t.transformStyle&&this.style&&!this.style._loaded){this.style.once("style.load",()=>this._updateStyle(e,t));return}let i=this.style&&t.transformStyle?this.style.serialize():void 0;if(this.style&&(this.style.off("error",this._onStyleError),this.style.setEventedParent(null),this.style._remove(!e)),e)this.style=new v_(this,t||{});else return this._frameRequest&&=(this._frameRequest.abort(),null),this.style?.projection?.destroy(),delete this.style,this;return this.style.setEventedParent(this,{style:this.style}),this.style.on("error",this._onStyleError),typeof e=="string"?this.style.loadURL(e,t,i):this.style.loadJSON(e,t,i),this}_lazyInitEmptyStyle(){this.style||(this.style=new v_(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.on("error",this._onStyleError),this.style.loadEmpty())}async _diffStyle(e,t){if(this._diffStyleRequest?.abort(),typeof e=="string"){let i=e;this._diffStyleRequest=new AbortController;let r=this._diffStyleRequest;try{let a=await this._requestManager.transformRequest(i,"Style");if(r.signal.aborted){this._diffStyleRequest=null;return}let o=await Pu(a,r);this._diffStyleRequest=null,this._updateDiff(o.data,t)}catch(a){this._diffStyleRequest=null,pr(a)||this.fire(new ie(Mt(a)))}}else typeof e=="object"&&(this._diffStyleRequest=null,this._updateDiff(e,t))}_updateDiff(e,t){try{this.style.setState(e,t)&&this._update(!0)}catch(i){he(`Unable to perform style diff: ${Mt(i).message}. Rebuilding the style from scratch.`),this._updateStyle(e,t)}}getStyle(){if(this.style)return this.style.serialize()}getStyleUrl(){return this._styleUrl}_takeStyleSnapshot(){return this.style?{style:this.style.serialize(),images:this.style.imageManager.cloneImages()}:{style:null,images:{}}}isStyleLoaded(){if(!this.style)he("There is no style added to the map.");else return this.style.loaded()}addSource(e,t){return this._lazyInitEmptyStyle(),this.style.addSource(e,t),this._update(!0)}isSourceLoaded(e){let t=this.style?.tileManagers[e];if(t===void 0)this.fire(new ie(Error(`There is no tile manager with ID '${e}'`)));else return t.loaded()}setTerrain(e,t={}){if(this.style._checkLoaded(),e&&ds(this,ai.terrain,{value:e},t))return this;if(this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),!e)this.terrain&&this.terrain.destroy(),this.terrain=null,this.painter.renderToTexture=null,this.painter.destroyRTTResources(),this._camera.setTerrain(null);else{let i=this.style.tileManagers[e.source];if(!i)throw Error(`cannot load terrain, because there exists no source with ID: ${e.source}`);this.terrain===null&&i.reload();for(let r in this.style._layers){let a=this.style._layers[r];a.type==="hillshade"&&a.source===e.source&&he("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality."),a.type==="color-relief"&&a.source===e.source&&he("You are using the same source for a color-relief layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain&&this.terrain.destroy(),this.terrain=new WR(this.painter,i,e,this._terrainSkirtLength,()=>this._camera.context.worldCoordinateHelper),this.painter.renderToTexture=new HR(this.painter,this.terrain),this._camera.setTerrain(this.terrain),this._terrainDataCallback=(r)=>this._handleTerrainDataEvent(r,e.source),this.style.on("data",this._terrainDataCallback)}return this.style.triggerSymbolPlacement(),this.fire(new oT({terrain:e})),this}_handleTerrainDataEvent(e,t){if(e.dataType==="style"){this.terrain.tileManager.releaseAllRTT();return}let i=e.sourceId===t;i&&(this.terrain.resetElevationCache(),this.style.triggerSymbolPlacement()),i&&e.tile&&(this.painter.markTerrainDepthDirty(),this._camera.applyTerrainChange()),e.tile&&(e.source?.type==="image"?this.terrain.tileManager.releaseAllRTT():this.terrain.tileManager.releaseRTT(e.tile.tileID))}getTerrain(){return this.terrain?.options??null}areTilesLoaded(){let e=this.style?.tileManagers;for(let t of Object.values(e))if(!t.areTilesLoaded())return!1;return!0}removeSource(e){return this.style.removeSource(e),this._update(!0)}getSource(e){return this.style?.getSource(e)}setSourceTileLodParams(e,t,i){if(i){let r=this.getSource(i);if(!r)throw Error(`There is no source with ID "${i}", cannot set LOD parameters`);r.calculateTileZoom=wp(Math.max(1,e),Math.max(1,t))}else for(let r in this.style.tileManagers)this.style.tileManagers[r].getSource().calculateTileZoom=wp(Math.max(1,e),Math.max(1,t));return this._update(!0),this}refreshTiles(e,t){let i=this.style.tileManagers[e];if(!i)throw Error(`There is no tile manager with ID "${e}", cannot refresh tile`);t===void 0?i.reload(!0):i.refreshTiles(t.map((r)=>new Xu(r.z,r.x,r.y)))}addImage(e,t,i={}){this._lazyInitEmptyStyle();let r=this._createStyleImage(t,i);return r&&(this.style.addImage(e,r),r.userImage?.onAdd&&r.userImage.onAdd(this,e)),this}setMissingStyleImageResolver(e){return this._missingStyleImageResolver=e,this.style?.setMissingImageResolver(e),this}_createStyleImage(e,t={}){let{pixelRatio:i=1,sdf:r=!1,stretchX:a,stretchY:o,content:n,textFitWidth:s,textFitHeight:l}=t;if(e instanceof HTMLImageElement||Sa(e)){let{width:u,height:c,data:h}=li.getImageData(e);return{data:new $e({width:u,height:c},h),pixelRatio:i,stretchX:a,stretchY:o,content:n,textFitWidth:s,textFitHeight:l,sdf:r,version:0}}if(e.width===void 0||e.height===void 0)return this.fire(new ie(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`"))),null;{let{width:u,height:c,data:h}=e,d=e,p=mu(d.data);return{data:p?new $e({width:u,height:c}):new $e({width:u,height:c},new Uint8Array(h)),pixelRatio:i,stretchX:a,stretchY:o,content:n,textFitWidth:s,textFitHeight:l,sdf:r,version:0,isWebGLImage:p,userImage:d}}}updateImage(e,t){let i=this.style.getImage(e);if(!i)return this.fire(new ie(Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let{width:r,height:a,data:o}=t instanceof HTMLImageElement||Sa(t)?li.getImageData(t):t;if(r===void 0||a===void 0)return this.fire(new ie(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(r!==i.data.width||a!==i.data.height)return this.fire(new ie(Error("The width and height of the updated image must be that same as the previous version of the image")));if(i.isWebGLImage=mu(o),i.isWebGLImage)i.userImage=t;else{let n=!(t instanceof HTMLImageElement||Sa(t));i.data.replace(o,n)}return this.style.updateImage(e,i),this}getImage(e){return this.style.getImage(e)}hasImage(e){return e?!!this.style.getImage(e):(this.fire(new ie(Error("Missing required image id"))),!1)}removeImage(e){this.style.removeImage(e)}async loadImage(e){let t=await _r.getImage(await this._requestManager.transformRequest(e,"Image"),new AbortController);if(!t.data)throw Error(`Could not load image ${e}: the response is empty`);return t}listImages(){return this.style?.listImages()??[]}addLayer(e,t){return this._lazyInitEmptyStyle(),this.style.addLayer(e,t),this._update(!0)}moveLayer(e,t){return this.style.moveLayer(e,t),this._update(!0)}removeLayer(e){return this.style.removeLayer(e),this._update(!0)}getLayer(e){return this.style?.getLayer(e)}getLayersOrder(){return this.style?.getLayersOrder()??[]}setLayerZoomRange(e,t,i){return this.style.setLayerZoomRange(e,t,i),this._update(!0)}setFilter(e,t,i={}){return this.style?.setFilter(e,t,i),this._update(!0)}getFilter(e){return this.style.getFilter(e)}setPaintProperty(e,t,i,r={}){return this.style?.setPaintProperty(e,t,i,r),this._update(!0)}getPaintProperty(e,t){return this.style.getPaintProperty(e,t)}setLayoutProperty(e,t,i,r={}){return this.style.setLayoutProperty(e,t,i,r),this._update(!0)}getLayoutProperty(e,t){return this.style.getLayoutProperty(e,t)}setGlyphs(e,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(e,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}setFontFaces(e){return this._lazyInitEmptyStyle(),this.style.setFontFaces(e),this._update(!0)}getFontFaces(){return this.style.getFontFaces()}addSprite(e,t,i={}){return this._lazyInitEmptyStyle(),this.style.addSprite(e,t,i,(r)=>{r||this._update(!0)}),this}removeSprite(e){return this._lazyInitEmptyStyle(),this.style.removeSprite(e),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(e,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(e,t,(i)=>{i||this._update(!0)}),this}setLight(e,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(e,t),this._update(!0)}getLight(){return this.style.getLight()}setSky(e,t={}){return this._lazyInitEmptyStyle(),this.style.setSky(e,t),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(e,t){return this.style.setFeatureState(e,t),this._update()}removeFeatureState(e,t){return this.style.removeFeatureState(e,t),this._update()}getFeatureState(e){return this.style.getFeatureState(e)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let e=0,t=0;return this._container&&(e=Math.floor(this._container.clientWidth)||400,t=Math.floor(this._container.clientHeight)||300),[e,t]}_shouldHandleInitialResize(){if(!this._container?.clientWidth||!this._container.clientHeight)return!1;let[e,t]=this._containerDimensions();return e!==this._camera.renderedState.width||t!==this._camera.renderedState.height}_setupResizeObserver(){let e=!1,t=am((r)=>{this._trackResize&&!this._removed&&(this.resize(r),this.redraw())},50),i=this._ownerWindow.ResizeObserver??ResizeObserver;this._resizeObserver=new i((r)=>{!e&&(e=!0,!this._shouldHandleInitialResize())||t(r)}),this._resizeObserver.observe(this._container)}_resolveContainer(e){if(typeof e=="string"){let t=document.getElementById(e);if(!t)throw Error(`Container '${e}' not found.`);return t}if(e instanceof HTMLElement||e&&typeof e=="object"&&e.nodeType===1)return e;throw Error("Invalid type: 'container' must be a String or HTMLElement.")}_setupContainer(){let e=this._containerDimensions(),t=this._getClampedPixelRatio(e[0],e[1]),i=this._container;i.classList.add("maplibregl-map");let r=this._canvasContainer=Ve.create("div","maplibregl-canvas-container",i);this._interactive&&r.classList.add("maplibregl-interactive"),this._canvas=Ve.create("canvas","maplibregl-canvas",r),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region"),this._resizeCanvas(e[0],e[1],t);let a=this._controlContainer=Ve.create("div","maplibregl-control-container",i),o=this._controlPositions={};for(let n of["top-left","top-right","bottom-left","bottom-right"])o[n]=Ve.create("div",`maplibregl-ctrl-${n} `,a);this._container.addEventListener("scroll",this._onMapScroll,!1)}_cleanupContainer(){this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map")}_resizeCanvas(e,t,i){let r=Math.round(i*e),a=Math.round(i*t);this._canvas.width=r,this._canvas.height=a,this._canvas.style.width=`${r/i}px`,this._canvas.style.height=`${a/i}px`}_setupPainter(){let e={...this._canvasContextAttributes,alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0},t=null;this._canvas.addEventListener("webglcontextcreationerror",(r)=>{t=r},{once:!0});let i=this._canvas.getContext("webgl2",e);if(!i)throw new vF(e,t);this.painter=new yF(i)}migrateProjection(e,t){this._camera.migrateProjection(e,t),this.fire(new nT({newProjection:this.style.projection.name}))}_warnAboutUnrestorableLayers(){for(let e of Object.values(this.style._layers))if(e.type==="custom"&&console.warn(`Custom layer with id '${e.id}' cannot be restored after WebGL context loss. You will need to re-add it manually after context restoration.`),e._listeners)for(let[t]of Object.entries(e._listeners))console.warn(`Custom layer with id '${e.id}' had event listeners for event '${t}' which cannot be restored after WebGL context loss. You will need to re-add them manually after context restoration.`)}_restoreStyleSnapshot({style:e,images:t}){if(e&&(this.setStyle(e,{diff:!1}),this.style)){this.style.imageManager.images=t;for(let[i,r]of Object.entries(t))r.isWebGLImage&&this.style.imageManager.updateImage(i,r,!1)}}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(e){return this.style?._loaded&&(this._styleDirty||=e,this._sourcesDirty=!0,this.triggerRepaint()),this}_requestRenderFrame(e){return this._update(),this.triggerRepaint(),this._renderTaskQueue.add(e)}_cancelRenderFrame(e){this._renderTaskQueue.remove(e)}_render(e){let t=this._idleTriggered?this._fadeDuration:0,i=this.style.projection?.transitionState>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(e),this._removed)return;let r=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let l=this._camera.renderedState.zoom,u=Fe();this.style.zoomHistory.update(l,u);let c=new Me(l,{now:u,fadeDuration:t,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),h=c.crossFadingFactor();(h!==1||h!==this._crossFadingFactor)&&(r=!0,this._crossFadingFactor=h),this.style.update(c)}let a=this.style.projection?.transitionState>0!==i;this._camera.setProjectionTransition(this.style.projection?.transitionState),this.style&&(this._sourcesDirty||a)&&(this._sourcesDirty=!1,this.style._updateSources(this._camera.projectedCamera,this._camera.context.worldCoordinateHelper)),this.terrain&&this.terrain.tileManager.update(this._camera.projectedCamera,this._camera.context.worldCoordinateHelper,this.terrain)&&this.terrain.resetElevationCache(),this._camera.followTerrain(),this._placementDirty=this.style?._updatePlacement(this._camera.projectedCamera,this._camera.context.worldCoordinateHelper,this.showCollisionBoxes,t,this._crossSourceCollisions,a);let o=this.style.projection,n=o?.transitionState??0;this.painter.render(this.style,this._camera.projectedCamera,this._camera.context.worldCoordinateHelper,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:t,symbolFadeChange:this.style.placement.symbolFadeChange(Fe()),variableOffsets:this.style.placement.variableOffsets,showPadding:this.showPadding,anisotropicFilterPitch:this.getAnisotropicFilterPitch(),projectionTransition:n,isRenderingGlobe:n>0,projectionShaderVariant:o?{name:o.shaderVariantName,define:o.shaderDefine,prelude:o.shaderPreludeCode}:void 0,useSubdivision:o?.useSubdivision??!1,pixelRatio:this._clampedPixelRatio,light:this.style.light?.getEvaluated(),sky:this.style.sky?.getEvaluated()}),this.fire(new Ct("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new Ct("load"))),this.style&&(this.style.hasTransitions()||r)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let s=this._sourcesDirty||this._styleDirty||this._placementDirty||this.painter.renderToTexture?.needsFollowUpFrame;return s||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new Ct("idle")),this._loaded&&!this._fullyLoaded&&!s&&(this._fullyLoaded=!0),this}redraw(){return this.style&&(this._frameRequest&&=(this._frameRequest.abort(),null),this._render(0)),this}remove(){this._hash&&this._hash.remove();for(let t of this._controls)t.onRemove(this);this._controls=[],this._frameRequest&&=(this._frameRequest.abort(),null),this._renderTaskQueue.clear(),this._diffStyleRequest?.abort(),this.painter.destroy(),this._handlerManager.destroy(),Ql().off("restart",this._handleWorkersRestarted),this.setStyle(null),typeof window<"u"&&this._ownerWindow.removeEventListener("online",this._onWindowOnline,!1),_r.removeThrottleControl(this._imageQueueHandle),this._resizeObserver?.disconnect();let e=this.painter.context.gl.getExtension("WEBGL_lose_context");e?.loseContext&&e.loseContext(),this._cleanupContainer(),this._removed=!0,this.fire(new Ct("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,li.frame(this._frameRequest,(e)=>{this._frameRequest=null;try{this._render(e)}catch(t){if(!pr(t))throw t}},()=>{},this._ownerWindow))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(e){this._showTileBoundaries!==e&&(this._showTileBoundaries=e,this._update())}get showPadding(){return!!this._showPadding}set showPadding(e){this._showPadding!==e&&(this._showPadding=e,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(e){this._showCollisionBoxes!==e&&(this._showCollisionBoxes=e,e?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(e){this._showOverdrawInspector!==e&&(this._showOverdrawInspector=e,this._update())}get repaint(){return!!this._repaint}set repaint(e){this._repaint!==e&&(this._repaint=e,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(e){this._vertices=e,this._update()}get version(){return YR}getCameraTargetElevation(){return this._camera.renderedState.elevation}getProjection(){return this.style.getProjection()}setProjection(e){return this._lazyInitEmptyStyle(),this.style.setProjection(e),this._update(!0)}};um={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%)"};ly={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]};ao=class extends sa{},QR=class extends sa{},pc=class extends qe{constructor(e){if(super(),this._onClick=(t)=>{this.fire(new QR("click",{originalEvent:t}))},this._onKeyPress=(t)=>{(t.code==="Space"||t.code==="Enter")&&this.togglePopup()},this._onKeyDown=(t)=>{if(!this._defaultMarker||!this._draggable||!this._map||!this._lngLat||t.composedPath()[0]!==this._element||t.altKey||t.ctrlKey||t.metaKey)return;let i=ly[t.key];if(!i)return;t.preventDefault(),t.stopPropagation();let r=t.shiftKey?10:1,a=this._map.project(this._lngLat);this.setLngLat(this._map.unproject(new D(a.x+i[0]*r,a.y+i[1]*r))),this._keyboardDragActive||(this._keyboardDragActive=!0,this.fire(new ao("dragstart"))),this.fire(new ao("drag"))},this._onKeyUp=(t)=>{ly[t.key]&&this._endKeyboardDrag()},this._onBlur=()=>{this._endKeyboardDrag()},this._onMapClick=(t)=>{let i=t.originalEvent.target,r=this._element;this._popup&&(i===r||r.contains(i))&&this.togglePopup()},this._updateCoveredUnthrottled=()=>{let t=this._map?.terrain;if(!t||!this._isInViewport())return;let i=this._isCovered(t);i&&this._popup?.isOpen()&&this._popup.remove(),this._element.style.opacity=i?this._opacityWhenCovered:this._opacity,this._element.classList.toggle("maplibregl-marker-covered",i)},this._updateCovered=am(this._updateCoveredUnthrottled,100),this._update=(t)=>{if(!this._map)return;this._lngLat=tw(this._lngLat,this._flatPos,this._map._camera.projectedCamera,this._map._camera.context.worldCoordinateHelper),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=V(this._map._camera.projectedCamera).locationToScreenPoint(this._map._camera.projectedCamera,this._map._camera.context.worldCoordinateHelper,this._lngLat)._add(this._offset));let i="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?i=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(i=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let r="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?r="rotateX(0deg)":this._pitchAlignment==="map"&&(r=`rotateX(${this._map.getPitch()}deg)`),!this._subpixelPositioning&&t?.type!=="move"&&(this._pos=this._pos.round()),this._element.style.transform=`${um[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${r} ${i}`,this._updateOpacity()},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 ao("dragstart"))),this.fire(new ao("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 ao("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))},this._anchor=e?.anchor||"center",this._color=e?.color||rw,this._scale=e?.scale||1,this._draggable=e?.draggable||!1,this._clickTolerance=e?.clickTolerance||0,this._subpixelPositioning=e?.subpixelPositioning||!1,this._isDragging=!1,this._roleManaged=!1,this._tabIndexManaged=!1,this._keyboardDragActive=!1,this._state="inactive",this._rotation=e?.rotation||0,this._rotationAlignment=e?.rotationAlignment||"auto",this._pitchAlignment=e?.pitchAlignment&&e.pitchAlignment!=="auto"?e.pitchAlignment:this._rotationAlignment,this.setOpacity(e?.opacity,e?.opacityWhenCovered),e?.element)this._element=e.element,this._offset=D.convert(e?.offset||[0,0]);else{this._defaultMarker=!0,this._element=Ve.create("div");let t=KR().cloneNode(!0);t.setAttributeNS(null,"height",`${41*this._scale}px`),t.setAttributeNS(null,"width",`${27*this._scale}px`),JR(t).setAttributeNS(null,"fill",this._color),this._element.appendChild(t),this._offset=D.convert(e?.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",(t)=>{t.preventDefault()}),this._element.addEventListener("mousedown",(t)=>{t.preventDefault()}),iw(this._element,this._anchor,"marker"),e?.className)for(let t of e.className.split(" "))this._element.classList.add(t);this._popup=null}addTo(e){return this.remove(),this._map=e,this._defaultMarker&&!this._element.hasAttribute("aria-label")&&this._element.setAttribute("aria-label",e._getUIString("Marker.Title")),this._updateAccessibilityRole(),e.getCanvasContainer().appendChild(this._element),e.on("move",this._update),e.on("moveend",this._update),e.on("terrain",this._update),e.on("projectiontransition",this._update),e.on("idle",this._update),this._element.addEventListener("click",this._onClick),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("idle",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),this._element.removeEventListener("click",this._onClick),this._element.removeEventListener("keydown",this._onKeyDown),this._element.removeEventListener("keyup",this._onKeyUp),this._element.removeEventListener("blur",this._onBlur),this._element.removeEventListener("keypress",this._onKeyPress),this._keyboardDragActive=!1,this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=Y.convert(e),this._pos=null,this._update(),this._popup&&this._popup.setLngLat(this._lngLat),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress)),e){if(!("offset"in e.options)){let t=13.5/Math.SQRT2;e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[t,(24.6+t)*-1],"bottom-right":[-t,(24.6+t)*-1],left:[13.5,-24.6],right:[-13.5,-24.6]}:this._offset}this._popup=e,this._element.addEventListener("keypress",this._onKeyPress)}return this._updateTabIndex(),this._updateAccessibilityRole(),this}setSubpixelPositioning(e){return this._subpixelPositioning=e,this}_endKeyboardDrag(){this._keyboardDragActive&&(this._keyboardDragActive=!1,this.fire(new ao("dragend")))}getPopup(){return this._popup}togglePopup(){let e=this._popup;if(this._element.style.opacity===this._opacityWhenCovered)return this;if(e)e.isOpen()?e.remove():(e.setLngLat(this._lngLat),e.addTo(this._map));else return this;return this}_updateOpacity(){if(!this._isInViewport())return;let e=this._map?.terrain,t=V(this._map._camera.projectedCamera).isLocationOccluded(this._map._camera.projectedCamera,this._map._camera.context.worldCoordinateHelper,this._lngLat);if(!e||t){let i=t?this._opacityWhenCovered:this._opacity;this._element.style.opacity!==i&&(this._element.style.opacity=i,this._element.classList.toggle("maplibregl-marker-covered",t))}else this._updateCovered()}_isInViewport(){let{width:e,height:t}=this._map._camera.renderedState;return!!this._pos&&this._pos.x>=0&&this._pos.y>=0&&this._pos.x<=e&&this._pos.y<=t}_isCovered(e){let t=this._map._camera.projectedCamera,i=e.getElevationForLngLat(this._lngLat,t.tileZoom),r=Math.max(0,-this._offset.y)/t.pixelsPerMeter,a=Math.sin(this._map.getPitch()*Math.PI/180)*r;return V(t).isLocationOccluded(t,this._map._camera.context.worldCoordinateHelper,this._lngLat,e,i+a)}getOffset(){return this._offset}setOffset(e){return this._offset=D.convert(e),this._update(),this}addClassName(e){this._element.classList.add(e)}removeClassName(e){this._element.classList.remove(e)}toggleClassName(e){return this._element.classList.toggle(e)}setDraggable(e){return this._draggable=!!e,this._element.classList.toggle("maplibregl-marker-draggable",this._draggable),this._map&&(e?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this._defaultMarker&&(this._draggable?(this._element.addEventListener("keydown",this._onKeyDown),this._element.addEventListener("keyup",this._onKeyUp),this._element.addEventListener("blur",this._onBlur)):(this._element.removeEventListener("keydown",this._onKeyDown),this._element.removeEventListener("keyup",this._onKeyUp),this._element.removeEventListener("blur",this._onBlur),this._endKeyboardDrag())),this._updateTabIndex(),this._updateAccessibilityRole(),this}isDraggable(){return this._draggable}_updateTabIndex(){this._popup||this._defaultMarker&&this._draggable?this._element.hasAttribute("tabindex")||(this._element.setAttribute("tabindex","0"),this._tabIndexManaged=!0):this._tabIndexManaged&&=(this._element.getAttribute("tabindex")==="0"&&this._element.removeAttribute("tabindex"),!1)}_updateAccessibilityRole(){if(!this._defaultMarker||this._element.hasAttribute("role")&&!this._roleManaged)return;let e=this._draggable||this._popup?"button":"img";this._element.setAttribute("role",e),this._roleManaged=!0}setRotation(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e&&e!=="auto"?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(e,t){return(this._opacity===void 0||e===void 0&&t===void 0)&&(this._opacity="1",this._opacityWhenCovered="0.2"),e!==void 0&&(this._opacity=String(e)),t!==void 0&&(this._opacityWhenCovered=String(t)),this._map&&this._updateOpacity(),this}},ez={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0,padding:void 0},uy=class extends sa{},aw=class extends qe{constructor(e){super(),this._updateOpacity=()=>{this.options.locationOccludedOpacity!==void 0&&(V(this._map._camera.projectedCamera).isLocationOccluded(this._map._camera.projectedCamera,this._map._camera.context.worldCoordinateHelper,this.getLngLat())?this._container.style.opacity=`${this.options.locationOccludedOpacity}`:this._container.style.opacity="")},this.remove=()=>(this._content&&this._content.remove(),this._container&&(this._container.remove(),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("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("idle",this._update),this._map.off("mousemove",this._update),this._map.off("mouseup",this._update),this._map.off("drag",this._update),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new uy("close"))),this),this._update=(t)=>{let i=this._lngLat||this._trackPointer;if(!this._map||!i||!this._content)return;if(!this._container){if(this._container=Ve.create("div","maplibregl-popup",this._map.getContainer()),this._tip=Ve.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._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=tw(this._lngLat,this._flatPos,this._map._camera.projectedCamera,this._map._camera.context.worldCoordinateHelper,this._trackPointer);let r;if(t&&"point"in t&&t.point&&(r=t.point),this._trackPointer&&!r)return;let a=this._flatPos=this._pos=this._trackPointer&&r?r:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&r?r:V(this._map._camera.projectedCamera).locationToScreenPoint(this._map._camera.projectedCamera,this._map._camera.context.worldCoordinateHelper,this._lngLat));let o=this.options.anchor,n=ow(this.options.offset);if(!o){let l=this._container.offsetWidth,u=this._container.offsetHeight,c=tz(this.options.padding),h;h=a.y+n.bottom.y<u+c.top?["top"]:a.y>this._map._camera.renderedState.height-u-c.bottom?["bottom"]:[],a.x<l/2+c.left?h.push("left"):a.x>this._map._camera.renderedState.width-l/2-c.right&&h.push("right"),o=h.length===0?"bottom":h.join("-")}let s=a.add(n[o]);this.options.subpixelPositioning||(s=s.round()),this._container.style.transform=`${um[o]} translate(${s.x}px,${s.y}px)`,iw(this._container,o,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=ee(Object.create(ez),e)}addTo(e){return this._map&&this.remove(),this._map=e,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._map.on("terrain",this._update),this._map.on("projectiontransition",this._update),this._map.on("idle",this._update),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._update),this._map.on("mouseup",this._update),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 uy("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=Y.convert(e),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._update),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._update),this._map.on("drag",this._update),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(e){return this.setDOMContent(document.createTextNode(e))}setHTML(e){let t=document.createDocumentFragment(),i=document.createElement("body"),r;for(i.innerHTML=e;r=i.firstChild,r;)t.appendChild(r);return this.setDOMContent(t)}getMaxWidth(){return this._container?.style.maxWidth}setMaxWidth(e){return this.options.maxWidth=e,this._update(),this}setDOMContent(e){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=Ve.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(e),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(e){return this._container&&this._container.classList.add(e),this}removeClassName(e){return this._container&&this._container.classList.remove(e),this}setOffset(e){return this.options.offset=e,this._update(),this}toggleClassName(e){if(this._container)return this._container.classList.toggle(e)}setSubpixelPositioning(e){this.options.subpixelPositioning=e}setPadding(e){this.options.padding=e,this._update()}_createCloseButton(){this.options.closeButton&&(this._closeButton=Ve.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.textContent="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;let e=this._container.querySelector("a[href], [tabindex]:not([tabindex='-1']), [contenteditable]:not([contenteditable='false']), button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])");e&&e.focus()}}});var uw=".maplibregl-map{font:12px/20px Helvetica Neue,Arial,Helvetica,sans-serif;overflow:hidden;position:relative;-webkit-tap-highlight-color:rgb(0 0 0/0);-webkit-touch-callout:none}.maplibregl-canvas{position:absolute;left:0;top:0}.maplibregl-map:fullscreen{width:100%;height:100%}.maplibregl-ctrl-group button.maplibregl-ctrl-compass{touch-action:none}.maplibregl-canvas-container.maplibregl-interactive,.maplibregl-ctrl-group button.maplibregl-ctrl-compass{cursor:grab;-webkit-user-select:none;-moz-user-select:none;user-select:none}.maplibregl-canvas-container.maplibregl-interactive.maplibregl-track-pointer{cursor:pointer}.maplibregl-canvas-container.maplibregl-interactive:active,.maplibregl-ctrl-group button.maplibregl-ctrl-compass:active{cursor:grabbing}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-canvas-container.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:pinch-zoom}.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan,.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan .maplibregl-canvas{touch-action:none}.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures,.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures .maplibregl-canvas{touch-action:pan-x pan-y}.maplibregl-ctrl-bottom-left,.maplibregl-ctrl-bottom-right,.maplibregl-ctrl-top-left,.maplibregl-ctrl-top-right{position:absolute;pointer-events:none;z-index:2}.maplibregl-ctrl-top-left{top:0;left:0}.maplibregl-ctrl-top-right{top:0;right:0}.maplibregl-ctrl-bottom-left{bottom:0;left:0}.maplibregl-ctrl-bottom-right{right:0;bottom:0}.maplibregl-ctrl{clear:both;pointer-events:auto;transform:translate(0)}.maplibregl-ctrl-top-left .maplibregl-ctrl{margin:10px 0 0 10px;float:left}.maplibregl-ctrl-top-right .maplibregl-ctrl{margin:10px 10px 0 0;float:right}.maplibregl-ctrl-bottom-left .maplibregl-ctrl{margin:0 0 10px 10px;float:left}.maplibregl-ctrl-bottom-right .maplibregl-ctrl{margin:0 10px 10px 0;float:right}.maplibregl-ctrl-group{border-radius:4px;background:#fff}.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px rgba(0,0,0,.1)}.maplibregl-ctrl-group button{width:29px;height:29px;display:block;padding:0;outline:none;border:0;box-sizing:border-box;background-color:transparent;cursor:pointer}.maplibregl-ctrl button{-webkit-user-select:none;-moz-user-select:none;user-select:none}.maplibregl-ctrl-group button+button{border-top:1px solid #ddd}.maplibregl-ctrl button .maplibregl-ctrl-icon{display:block;width:100%;height:100%;background-repeat:no-repeat;background-position:50%}@media(forced-colors:active){.maplibregl-ctrl-group:not(:empty){box-shadow:0 0 0 2px ButtonText}.maplibregl-ctrl-icon{background-color:transparent}.maplibregl-ctrl-group button+button{border-top:1px solid buttontext}}.maplibregl-ctrl button::-moz-focus-inner{border:0;padding:0}.maplibregl-ctrl-attrib-button:focus,.maplibregl-ctrl-group button:focus{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl button:disabled{cursor:not-allowed}.maplibregl-ctrl button:disabled .maplibregl-ctrl-icon{opacity:.25}@media(hover:hover){.maplibregl-ctrl button:not(:disabled):hover{background-color:rgba(0,0,0,.05)}}.maplibregl-ctrl button:not(:disabled):active{background-color:rgba(0,0,0,.05)}.maplibregl-ctrl-group button:focus:focus-visible{box-shadow:0 0 2px 2px #0096ff}.maplibregl-ctrl-group button:focus:not(:focus-visible){box-shadow:none}.maplibregl-ctrl-group button:focus:first-child{border-radius:4px 4px 0 0}.maplibregl-ctrl-group button:focus:last-child{border-radius:0 0 4px 4px}.maplibregl-ctrl-group button:focus:only-child{border-radius:inherit}.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29' fill='%23333'%3E %3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E %3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29' fill='%23333'%3E %3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E %3C/svg%3E\")}@media(forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29' fill='%23fff'%3E %3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E %3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29' fill='%23fff'%3E %3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E %3C/svg%3E\")}}@media(forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29' fill='%23000'%3E %3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E %3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29' fill='%23000'%3E %3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E %3C/svg%3E\")}}.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29' fill='%23333'%3E %3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E %3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E %3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E %3C/svg%3E\")}@media(forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29' fill='%23fff'%3E %3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E %3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29' fill='%23fff'%3E %3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E %3C/svg%3E\")}}@media(forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29' fill='%23000'%3E %3Cpath d='M24 16v5.5c0 1.75-.75 2.5-2.5 2.5H16v-1l3-1.5-4-5.5 1-1 5.5 4 1.5-3zM6 16l1.5 3 5.5-4 1 1-4 5.5 3 1.5v1H7.5C5.75 24 5 23.25 5 21.5V16zm7-11v1l-3 1.5 4 5.5-1 1-5.5-4L6 13H5V7.5C5 5.75 5.75 5 7.5 5zm11 2.5c0-1.75-.75-2.5-2.5-2.5H16v1l3 1.5-4 5.5 1 1 5.5-4 1.5 3h1z'/%3E %3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29' fill='%23000'%3E %3Cpath d='M18.5 16c-1.75 0-2.5.75-2.5 2.5V24h1l1.5-3 5.5 4 1-1-4-5.5 3-1.5v-1zM13 18.5c0-1.75-.75-2.5-2.5-2.5H5v1l3 1.5L4 24l1 1 5.5-4 1.5 3h1zm3-8c0 1.75.75 2.5 2.5 2.5H24v-1l-3-1.5L25 5l-1-1-5.5 4L17 5h-1zM10.5 13c1.75 0 2.5-.75 2.5-2.5V5h-1l-1.5 3L5 4 4 5l4 5.5L5 12v1z'/%3E %3C/svg%3E\")}}.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29' fill='%23333'%3E %3Cpath d='m10.5 14 4-8 4 8z'/%3E %3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E %3C/svg%3E\")}@media(forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29' fill='%23fff'%3E %3Cpath d='m10.5 14 4-8 4 8z'/%3E %3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E %3C/svg%3E\")}}@media(forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29' fill='%23000'%3E %3Cpath d='m10.5 14 4-8 4 8z'/%3E %3Cpath fill='%23ccc' d='m10.5 16 4 8 4-8z'/%3E %3C/svg%3E\")}}.maplibregl-ctrl button.maplibregl-ctrl-globe .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='none' viewBox='0 0 22 22' stroke='%23333'%3E %3Ccircle cx='11' cy='11' r='8.5'/%3E %3Cpath d='M17.5 11c0 4.819-3.02 8.5-6.5 8.5S4.5 15.819 4.5 11 7.52 2.5 11 2.5s6.5 3.681 6.5 8.5Z'/%3E %3Cpath d='M13.5 11c0 2.447-.331 4.64-.853 6.206-.262.785-.562 1.384-.872 1.777-.314.399-.58.517-.775.517-.195 0-.461-.118-.775-.517-.31-.393-.61-.992-.872-1.777C8.831 15.64 8.5 13.446 8.5 11c0-2.447.331-4.64.853-6.206.262-.785.562-1.384.872-1.777.314-.399.58-.517.775-.517.195 0 .461.118.775.517.31.393.61.992.872 1.777.522 1.565.853 3.76.853 6.206Z'/%3E %3Cpath d='M11 7.5c-1.909 0-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.333 1.333 0 0 1-.224-.138c.047-.038.12-.085.224-.138.299-.151.763-.302 1.379-.434C7.378 5.666 9.091 5.5 11 5.5c1.909 0 3.622.166 4.845.428.616.132 1.08.283 1.379.434.105.053.177.1.224.138-.047.038-.12.085-.224.138-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428ZM4.486 6.436ZM11 16.5c-1.909 0-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.33 1.33 0 0 1-.224-.138 1.33 1.33 0 0 1 .224-.138c.299-.151.763-.302 1.379-.434C7.378 14.666 9.091 14.5 11 14.5c1.909 0 3.622.166 4.845.428.616.132 1.08.283 1.379.434.105.053.177.1.224.138a1.33 1.33 0 0 1-.224.138c-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428Zm-6.514-1.064ZM11 12.5c-2.46 0-4.672-.222-6.255-.574-.796-.177-1.406-.38-1.805-.59a1.465 1.465 0 0 1-.39-.272.293.293 0 0 1-.047-.064.293.293 0 0 1 .048-.064c.066-.073.189-.167.389-.272.399-.21 1.009-.413 1.805-.59C6.328 9.722 8.54 9.5 11 9.5s4.672.222 6.256.574c.795.177 1.405.38 1.804.59.2.105.323.2.39.272a.33.33 0 0 1 .047.064.293.293 0 0 1-.048.064 1.435 1.435 0 0 1-.389.272c-.399.21-1.009.413-1.804.59-1.584.352-3.796.574-6.256.574Zm-8.501-1.51v.002-.002Zm0 .018v.002-.002Zm17.002.002v-.002.002Zm0-.018v-.002.002Z'/%3E %3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-globe-enabled .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='none' viewBox='0 0 22 22' stroke='%2333b5e5'%3E %3Ccircle cx='11' cy='11' r='8.5'/%3E %3Cpath d='M17.5 11c0 4.819-3.02 8.5-6.5 8.5S4.5 15.819 4.5 11 7.52 2.5 11 2.5s6.5 3.681 6.5 8.5Z'/%3E %3Cpath d='M13.5 11c0 2.447-.331 4.64-.853 6.206-.262.785-.562 1.384-.872 1.777-.314.399-.58.517-.775.517-.195 0-.461-.118-.775-.517-.31-.393-.61-.992-.872-1.777C8.831 15.64 8.5 13.446 8.5 11c0-2.447.331-4.64.853-6.206.262-.785.562-1.384.872-1.777.314-.399.58-.517.775-.517.195 0 .461.118.775.517.31.393.61.992.872 1.777.522 1.565.853 3.76.853 6.206Z'/%3E %3Cpath d='M11 7.5c-1.909 0-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.333 1.333 0 0 1-.224-.138c.047-.038.12-.085.224-.138.299-.151.763-.302 1.379-.434C7.378 5.666 9.091 5.5 11 5.5c1.909 0 3.622.166 4.845.428.616.132 1.08.283 1.379.434.105.053.177.1.224.138-.047.038-.12.085-.224.138-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428ZM4.486 6.436ZM11 16.5c-1.909 0-3.622-.166-4.845-.428-.616-.132-1.08-.283-1.379-.434a1.33 1.33 0 0 1-.224-.138 1.33 1.33 0 0 1 .224-.138c.299-.151.763-.302 1.379-.434C7.378 14.666 9.091 14.5 11 14.5c1.909 0 3.622.166 4.845.428.616.132 1.08.283 1.379.434.105.053.177.1.224.138a1.33 1.33 0 0 1-.224.138c-.299.151-.763.302-1.379.434-1.223.262-2.936.428-4.845.428Zm-6.514-1.064ZM11 12.5c-2.46 0-4.672-.222-6.255-.574-.796-.177-1.406-.38-1.805-.59a1.465 1.465 0 0 1-.39-.272.293.293 0 0 1-.047-.064.293.293 0 0 1 .048-.064c.066-.073.189-.167.389-.272.399-.21 1.009-.413 1.805-.59C6.328 9.722 8.54 9.5 11 9.5s4.672.222 6.256.574c.795.177 1.405.38 1.804.59.2.105.323.2.39.272a.33.33 0 0 1 .047.064.293.293 0 0 1-.048.064 1.435 1.435 0 0 1-.389.272c-.399.21-1.009.413-1.804.59-1.584.352-3.796.574-6.256.574Zm-8.501-1.51v.002-.002Zm0 .018v.002-.002Zm17.002.002v-.002.002Zm0-.018v-.002.002Z'/%3E %3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-terrain .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 22 22' fill='%23333'%3E %3Cpath d='m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0'/%3E %3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-terrain-enabled .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 22 22' fill='%2333b5e5'%3E %3Cpath d='m1.754 13.406 4.453-4.851 3.09 3.09 3.281 3.277.969-.969-3.309-3.312 3.844-4.121 6.148 6.886h1.082v-.855l-7.207-8.07-4.84 5.187L6.169 6.57l-5.48 5.965v.871ZM.688 16.844h20.625v1.375H.688Zm0 0'/%3E %3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 20 20' fill='%23333'%3E %3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E %3Ccircle id='dot' cx='10' cy='10' r='2'/%3E %3Cpath id='stroke' d='m14 5 1 1-9 9-1-1z' display='none'/%3E %3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 20 20' fill='%23aaa'%3E %3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E %3Ccircle id='dot' cx='10' cy='10' r='2'/%3E %3Cpath id='stroke' d='m14 5 1 1-9 9-1-1z' fill='%23f00'/%3E %3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 20 20' fill='%2333b5e5'%3E %3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E %3Ccircle id='dot' cx='10' cy='10' r='2'/%3E %3Cpath id='stroke' d='m14 5 1 1-9 9-1-1z' display='none'/%3E %3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 20 20' fill='%23e58978'%3E %3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E %3Ccircle id='dot' cx='10' cy='10' r='2'/%3E %3Cpath id='stroke' d='m14 5 1 1-9 9-1-1z' display='none'/%3E %3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 20 20' fill='%2333b5e5'%3E %3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E %3Ccircle id='dot' cx='10' cy='10' r='2' display='none'/%3E %3Cpath id='stroke' d='m14 5 1 1-9 9-1-1z' display='none'/%3E %3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 20 20' fill='%23e54e33'%3E %3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E %3Ccircle id='dot' cx='10' cy='10' r='2' display='none'/%3E %3Cpath id='stroke' d='m14 5 1 1-9 9-1-1z' display='none'/%3E %3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-waiting .maplibregl-ctrl-icon{animation:maplibregl-spin 2s linear infinite}@media(forced-colors:active){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 20 20' fill='%23fff'%3E %3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E %3Ccircle id='dot' cx='10' cy='10' r='2'/%3E %3Cpath id='stroke' d='m14 5 1 1-9 9-1-1z' display='none'/%3E %3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 20 20' fill='%23999'%3E %3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E %3Ccircle id='dot' cx='10' cy='10' r='2'/%3E %3Cpath id='stroke' d='m14 5 1 1-9 9-1-1z' fill='%23f00'/%3E %3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 20 20' fill='%2333b5e5'%3E %3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E %3Ccircle id='dot' cx='10' cy='10' r='2'/%3E %3Cpath id='stroke' d='m14 5 1 1-9 9-1-1z' display='none'/%3E %3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active-error .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 20 20' fill='%23e58978'%3E %3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E %3Ccircle id='dot' cx='10' cy='10' r='2'/%3E %3Cpath id='stroke' d='m14 5 1 1-9 9-1-1z' display='none'/%3E %3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 20 20' fill='%2333b5e5'%3E %3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E %3Ccircle id='dot' cx='10' cy='10' r='2' display='none'/%3E %3Cpath id='stroke' d='m14 5 1 1-9 9-1-1z' display='none'/%3E %3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background-error .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 20 20' fill='%23e54e33'%3E %3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E %3Ccircle id='dot' cx='10' cy='10' r='2' display='none'/%3E %3Cpath id='stroke' d='m14 5 1 1-9 9-1-1z' display='none'/%3E %3C/svg%3E\")}}@media(forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 20 20' fill='%23000'%3E %3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E %3Ccircle id='dot' cx='10' cy='10' r='2'/%3E %3Cpath id='stroke' d='m14 5 1 1-9 9-1-1z' display='none'/%3E %3C/svg%3E\")}.maplibregl-ctrl button.maplibregl-ctrl-geolocate:disabled .maplibregl-ctrl-icon{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 20 20' fill='%23666'%3E %3Cpath d='M10 4C9 4 9 5 9 5v.1A5 5 0 0 0 5.1 9H5s-1 0-1 1 1 1 1 1h.1A5 5 0 0 0 9 14.9v.1s0 1 1 1 1-1 1-1v-.1a5 5 0 0 0 3.9-3.9h.1s1 0 1-1-1-1-1-1h-.1A5 5 0 0 0 11 5.1V5s0-1-1-1m0 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7'/%3E %3Ccircle id='dot' cx='10' cy='10' r='2'/%3E %3Cpath id='stroke' d='m14 5 1 1-9 9-1-1z' fill='%23f00'/%3E %3C/svg%3E\")}}@keyframes maplibregl-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}a.maplibregl-ctrl-logo{width:88px;height:23px;margin:0 0 -4px -4px;display:block;background-repeat:no-repeat;cursor:pointer;overflow:hidden;background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E %3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E %3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E %3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E %3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E %3Cg style='stroke-width:1.12603545'%3E %3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E %3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E %3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E %3C/g%3E %3C/svg%3E\")}a.maplibregl-ctrl-logo.maplibregl-compact{width:14px}@media(forced-colors:active){a.maplibregl-ctrl-logo{background-color:transparent;background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E %3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E %3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E %3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E %3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E %3Cg style='stroke-width:1.12603545'%3E %3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E %3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E %3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E %3C/g%3E %3C/svg%3E\")}}@media(forced-colors:active) and (prefers-color-scheme:light){a.maplibregl-ctrl-logo{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='23' fill='none'%3E %3Cpath fill='%23000' fill-opacity='.4' fill-rule='evenodd' d='M17.408 16.796h-1.827l2.501-12.095h.198l3.324 6.533.988 2.19.988-2.19 3.258-6.533h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.929 5.644h-.098l-2.914-5.644-.757-1.71-.345 1.71zm1.958-3.42-.726 3.663a1.255 1.255 0 0 1-1.232 1.011h-1.827a1.255 1.255 0 0 1-1.229-1.509l2.501-12.095a1.255 1.255 0 0 1 1.23-1.001h.197a1.25 1.25 0 0 1 1.12.685l3.19 6.273 3.125-6.263a1.25 1.25 0 0 1 1.123-.695h.181a1.255 1.255 0 0 1 1.227.991l1.443 6.71a5 5 0 0 1 .314-.787l.009-.016a4.6 4.6 0 0 1 1.777-1.887c.782-.46 1.668-.667 2.611-.667a4.6 4.6 0 0 1 1.7.32l.306.134c.21-.16.474-.256.759-.256h1.694a1.255 1.255 0 0 1 1.212.925 1.255 1.255 0 0 1 1.212-.925h1.711c.284 0 .545.094.755.252.613-.3 1.312-.45 2.075-.45 1.356 0 2.557.445 3.482 1.4q.47.48.763 1.064V4.701a1.255 1.255 0 0 1 1.255-1.255h1.86A1.255 1.255 0 0 1 54.44 4.7v9.194h2.217c.19 0 .37.043.532.118v-4.77c0-.356.147-.678.385-.906a2.42 2.42 0 0 1-.682-1.71c0-.665.267-1.253.735-1.7a2.45 2.45 0 0 1 1.722-.674 2.43 2.43 0 0 1 1.705.675q.318.302.504.683V4.7a1.255 1.255 0 0 1 1.255-1.255h1.744A1.255 1.255 0 0 1 65.812 4.7v3.335a4.8 4.8 0 0 1 1.526-.246c.938 0 1.817.214 2.59.69a4.47 4.47 0 0 1 1.67 1.743v-.98a1.255 1.255 0 0 1 1.256-1.256h1.777c.233 0 .451.064.639.174a3.4 3.4 0 0 1 1.567-.372c.346 0 .861.02 1.285.232a1.25 1.25 0 0 1 .689 1.004 4.7 4.7 0 0 1 .853-.588c.795-.44 1.675-.647 2.61-.647 1.385 0 2.65.39 3.525 1.396.836.938 1.168 2.173 1.168 3.528q-.001.515-.056 1.051a1.255 1.255 0 0 1-.947 1.09l.408.952a1.255 1.255 0 0 1-.477 1.552c-.418.268-.92.463-1.458.612-.613.171-1.304.244-2.049.244-1.06 0-2.043-.207-2.886-.698l-.015-.008c-.798-.48-1.419-1.135-1.818-1.963l-.004-.008a5.8 5.8 0 0 1-.548-2.512q0-.429.053-.843a1.3 1.3 0 0 1-.333-.086l-.166-.004c-.223 0-.426.062-.643.228-.03.024-.142.139-.142.59v3.883a1.255 1.255 0 0 1-1.256 1.256h-1.777a1.255 1.255 0 0 1-1.256-1.256V15.69l-.032.057a4.8 4.8 0 0 1-1.86 1.833 5.04 5.04 0 0 1-2.484.634 4.5 4.5 0 0 1-1.935-.424 1.25 1.25 0 0 1-.764.258h-1.71a1.255 1.255 0 0 1-1.256-1.255V7.687a2.4 2.4 0 0 1-.428.625c.253.23.412.561.412.93v7.553a1.255 1.255 0 0 1-1.256 1.255h-1.843a1.25 1.25 0 0 1-.894-.373c-.228.23-.544.373-.894.373H51.32a1.255 1.255 0 0 1-1.256-1.255v-1.251l-.061.117a4.7 4.7 0 0 1-1.782 1.884 4.77 4.77 0 0 1-2.485.67 5.6 5.6 0 0 1-1.485-.188l.009 2.764a1.255 1.255 0 0 1-1.255 1.259h-1.729a1.255 1.255 0 0 1-1.255-1.255v-3.537a1.255 1.255 0 0 1-1.167.793h-1.679a1.25 1.25 0 0 1-.77-.263 4.5 4.5 0 0 1-1.945.429c-.885 0-1.724-.21-2.495-.632l-.017-.01a5 5 0 0 1-1.081-.836 1.255 1.255 0 0 1-1.254 1.312h-1.81a1.255 1.255 0 0 1-1.228-.99l-.782-3.625-2.044 3.939a1.25 1.25 0 0 1-1.115.676h-.098a1.25 1.25 0 0 1-1.116-.68l-2.061-3.994zM35.92 16.63l.207-.114.223-.15q.493-.356.735-.785l.061-.118.033 1.332h1.678V9.242h-1.694l-.033 1.267q-.133-.329-.526-.658l-.032-.028a3.2 3.2 0 0 0-.668-.428l-.27-.12a3.3 3.3 0 0 0-1.235-.23q-1.136-.001-1.974.493a3.36 3.36 0 0 0-1.3 1.382q-.445.89-.444 2.074 0 1.2.51 2.107a3.8 3.8 0 0 0 1.382 1.381 3.9 3.9 0 0 0 1.893.477q.795 0 1.455-.33zm-2.789-5.38q-.576.675-.575 1.762 0 1.102.559 1.794.576.675 1.645.675a2.25 2.25 0 0 0 .934-.19 2.2 2.2 0 0 0 .468-.29l.178-.161a2.2 2.2 0 0 0 .397-.561q.244-.5.244-1.15v-.115q0-.708-.296-1.267l-.043-.077a2.2 2.2 0 0 0-.633-.709l-.13-.086-.047-.028a2.1 2.1 0 0 0-1.073-.285q-1.052 0-1.629.692zm2.316 2.706c.163-.17.28-.407.28-.83v-.114c0-.292-.06-.508-.15-.68a.96.96 0 0 0-.353-.389.85.85 0 0 0-.464-.127c-.4 0-.56.114-.664.239l-.01.012c-.148.174-.275.45-.275.945 0 .506.122.801.27.99.097.11.266.224.68.224.303 0 .504-.09.687-.269zm7.545 1.705a2.6 2.6 0 0 0 .331.423q.319.33.755.548l.173.074q.65.255 1.49.255 1.02 0 1.844-.493a3.45 3.45 0 0 0 1.316-1.4q.493-.904.493-2.089 0-1.909-.988-2.913-.988-1.02-2.584-1.02-.898 0-1.575.347a3 3 0 0 0-.415.262l-.199.166a3.4 3.4 0 0 0-.64.82V9.242h-1.712v11.553h1.729l-.017-5.134zm.53-1.138q.206.29.48.5l.155.11.053.034q.51.296 1.119.297 1.07 0 1.645-.675.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.435 0-.835.16a2 2 0 0 0-.284.136 2 2 0 0 0-.363.254 2.2 2.2 0 0 0-.46.569l-.082.162a2.6 2.6 0 0 0-.213 1.072v.115q0 .707.296 1.267l.135.211zm.964-.818a1.1 1.1 0 0 0 .367.385.94.94 0 0 0 .476.118c.423 0 .59-.117.687-.23.159-.194.28-.478.28-.95 0-.53-.133-.8-.266-.952l-.021-.025c-.078-.094-.231-.221-.68-.221a1 1 0 0 0-.503.135l-.012.007a.86.86 0 0 0-.335.343c-.073.133-.132.324-.132.614v.115a1.4 1.4 0 0 0 .14.66zm15.7-6.222q.347-.346.346-.856a1.05 1.05 0 0 0-.345-.79 1.18 1.18 0 0 0-.84-.329q-.51 0-.855.33a1.05 1.05 0 0 0-.346.79q0 .51.346.855.345.346.856.346.51 0 .839-.346zm4.337 9.314.033-1.332q.191.403.59.747l.098.081a4 4 0 0 0 .316.224l.223.122a3.2 3.2 0 0 0 1.44.322 3.8 3.8 0 0 0 1.875-.477 3.5 3.5 0 0 0 1.382-1.366q.527-.89.526-2.09 0-1.184-.444-2.073a3.24 3.24 0 0 0-1.283-1.399q-.823-.51-1.942-.51a3.5 3.5 0 0 0-1.527.344l-.086.043-.165.09a3 3 0 0 0-.33.214q-.432.315-.656.707a2 2 0 0 0-.099.198l.082-1.283V4.701h-1.744v12.095zm.473-2.509a2.5 2.5 0 0 0 .566.7q.117.098.245.18l.144.08a2.1 2.1 0 0 0 .975.232q1.07 0 1.645-.675.576-.69.576-1.778 0-1.102-.576-1.777-.56-.691-1.645-.692a2.2 2.2 0 0 0-1.015.235q-.22.113-.415.282l-.15.142a2.1 2.1 0 0 0-.42.594q-.223.479-.223 1.1v.115q0 .705.293 1.26zm2.616-.293c.157-.191.28-.479.28-.967 0-.51-.13-.79-.276-.961l-.021-.026c-.082-.1-.232-.225-.67-.225a.87.87 0 0 0-.681.279l-.012.011c-.154.155-.274.38-.274.807v.115c0 .285.057.499.144.669a1.1 1.1 0 0 0 .367.405c.137.082.28.123.455.123.423 0 .59-.118.686-.23zm8.266-3.013q.345-.13.724-.14l.069-.002q.493 0 .642.099l.247-1.794q-.196-.099-.717-.099a2.3 2.3 0 0 0-.545.063 2 2 0 0 0-.411.148 2.2 2.2 0 0 0-.4.249 2.5 2.5 0 0 0-.485.499 2.7 2.7 0 0 0-.32.581l-.05.137v-1.48h-1.778v7.553h1.777v-3.884q0-.546.159-.943a1.5 1.5 0 0 1 .466-.636 2.5 2.5 0 0 1 .399-.253 2 2 0 0 1 .224-.099zm9.784 2.656.05-.922q0-1.743-.856-2.698-.838-.97-2.584-.97-1.119-.001-2.007.493a3.46 3.46 0 0 0-1.4 1.382q-.493.906-.493 2.106 0 1.07.428 1.975.428.89 1.332 1.432.906.526 2.255.526.973 0 1.668-.185l.044-.012.135-.04q.613-.184.984-.421l-.542-1.267q-.3.162-.642.274l-.297.087q-.51.131-1.3.131-.954 0-1.497-.444a1.6 1.6 0 0 1-.192-.193q-.366-.44-.512-1.234l-.004-.021zm-5.427-1.256-.003.022h3.752v-.138q-.011-.727-.288-1.118a1 1 0 0 0-.156-.176q-.46-.428-1.316-.428-.986 0-1.494.604-.379.45-.494 1.234zm-27.053 2.77V4.7h-1.86v12.095h5.333V15.15zm7.103-5.908v7.553h-1.843V9.242h1.843z'/%3E %3Cpath fill='%23fff' d='m19.63 11.151-.757-1.71-.345 1.71-1.12 5.644h-1.827L18.083 4.7h.197l3.325 6.533.988 2.19.988-2.19L26.839 4.7h.181l2.6 12.095h-1.81l-1.218-5.644-.362-1.71-.658 1.71-2.93 5.644h-.098l-2.913-5.644zm14.836 5.81q-1.02 0-1.893-.478a3.8 3.8 0 0 1-1.381-1.382q-.51-.906-.51-2.106 0-1.185.444-2.074a3.36 3.36 0 0 1 1.3-1.382q.839-.494 1.974-.494a3.3 3.3 0 0 1 1.234.231 3.3 3.3 0 0 1 .97.575q.396.33.527.659l.033-1.267h1.694v7.553H37.18l-.033-1.332q-.279.593-1.02 1.053a3.17 3.17 0 0 1-1.662.444zm.296-1.482q.938 0 1.58-.642.642-.66.642-1.711v-.115q0-.708-.296-1.267a2.2 2.2 0 0 0-.807-.872 2.1 2.1 0 0 0-1.119-.313q-1.053 0-1.629.692-.575.675-.575 1.76 0 1.103.559 1.795.577.675 1.645.675zm6.521-6.237h1.711v1.4q.906-1.597 2.83-1.597 1.596 0 2.584 1.02.988 1.005.988 2.914 0 1.185-.493 2.09a3.46 3.46 0 0 1-1.316 1.399 3.5 3.5 0 0 1-1.844.493q-.954 0-1.662-.329a2.67 2.67 0 0 1-1.086-.97l.017 5.134h-1.728zm4.048 6.22q1.07 0 1.645-.674.577-.69.576-1.762 0-1.119-.576-1.777-.558-.675-1.645-.675-.592 0-1.12.296-.51.28-.822.823-.296.527-.296 1.234v.115q0 .708.296 1.267.313.543.823.855.51.296 1.119.297z'/%3E %3Cpath fill='%23e1e3e9' d='M51.325 4.7h1.86v10.45h3.473v1.646h-5.333zm7.12 4.542h1.843v7.553h-1.843zm.905-1.415a1.16 1.16 0 0 1-.856-.346 1.17 1.17 0 0 1-.346-.856 1.05 1.05 0 0 1 .346-.79q.346-.329.856-.329.494 0 .839.33a1.05 1.05 0 0 1 .345.79 1.16 1.16 0 0 1-.345.855q-.33.346-.84.346zm7.875 9.133a3.17 3.17 0 0 1-1.662-.444q-.723-.46-1.004-1.053l-.033 1.332h-1.71V4.701h1.743v4.657l-.082 1.283q.279-.658 1.086-1.119a3.5 3.5 0 0 1 1.778-.477q1.119 0 1.942.51a3.24 3.24 0 0 1 1.283 1.4q.445.888.444 2.072 0 1.201-.526 2.09a3.5 3.5 0 0 1-1.382 1.366 3.8 3.8 0 0 1-1.876.477zm-.296-1.481q1.069 0 1.645-.675.577-.69.577-1.778 0-1.102-.577-1.776-.56-.691-1.645-.692a2.12 2.12 0 0 0-1.58.659q-.642.641-.642 1.694v.115q0 .71.296 1.267a2.4 2.4 0 0 0 .807.872 2.1 2.1 0 0 0 1.119.313zm5.927-6.237h1.777v1.481q.263-.757.856-1.217a2.14 2.14 0 0 1 1.349-.46q.527 0 .724.098l-.247 1.794q-.149-.099-.642-.099-.774 0-1.416.494-.626.493-.626 1.58v3.883h-1.777V9.242zm9.534 7.718q-1.35 0-2.255-.526-.904-.543-1.332-1.432a4.6 4.6 0 0 1-.428-1.975q0-1.2.493-2.106a3.46 3.46 0 0 1 1.4-1.382q.889-.495 2.007-.494 1.744 0 2.584.97.855.956.856 2.7 0 .444-.05.92h-5.43q.18 1.005.708 1.45.542.443 1.497.443.79 0 1.3-.131a4 4 0 0 0 .938-.362l.542 1.267q-.411.263-1.119.46-.708.198-1.711.197zm1.596-4.558q.016-1.02-.444-1.432-.46-.428-1.316-.428-1.728 0-1.991 1.86z'/%3E %3Cpath d='M5.074 15.948a.484.657 0 0 0-.486.659v1.84a.484.657 0 0 0 .486.659h4.101a.484.657 0 0 0 .486-.659v-1.84a.484.657 0 0 0-.486-.659zm3.56 1.16H5.617v.838h3.017z' style='fill:%23fff;fill-rule:evenodd;stroke-width:1.03600001'/%3E %3Cg style='stroke-width:1.12603545'%3E %3Cpath d='M-9.408-1.416c-3.833-.025-7.056 2.912-7.08 6.615-.02 3.08 1.653 4.832 3.107 6.268.903.892 1.721 1.74 2.32 2.902l-.525-.004c-.543-.003-.992.304-1.24.639a1.87 1.87 0 0 0-.362 1.121l-.011 1.877c-.003.402.104.787.347 1.125.244.338.688.653 1.23.656l4.142.028c.542.003.99-.306 1.238-.641a1.87 1.87 0 0 0 .363-1.121l.012-1.875a1.87 1.87 0 0 0-.348-1.127c-.243-.338-.688-.653-1.23-.656l-.518-.004c.597-1.145 1.425-1.983 2.348-2.87 1.473-1.414 3.18-3.149 3.2-6.226-.016-3.59-2.923-6.684-6.993-6.707m-.006 1.1v.002c3.274.02 5.92 2.532 5.9 5.6-.017 2.706-1.39 4.026-2.863 5.44-1.034.994-2.118 2.033-2.814 3.633-.018.041-.052.055-.075.065q-.013.004-.02.01a.34.34 0 0 1-.226.084.34.34 0 0 1-.224-.086l-.092-.077c-.699-1.615-1.768-2.669-2.781-3.67-1.454-1.435-2.797-2.762-2.78-5.478.02-3.067 2.7-5.545 5.975-5.523m-.02 2.826c-1.62-.01-2.944 1.315-2.955 2.96-.01 1.646 1.295 2.988 2.916 2.999h.002c1.621.01 2.943-1.316 2.953-2.961.011-1.646-1.294-2.988-2.916-2.998m-.005 1.1c1.017.006 1.829.83 1.822 1.89s-.83 1.874-1.848 1.867c-1.018-.006-1.829-.83-1.822-1.89s.83-1.874 1.848-1.868m-2.155 11.857 4.14.025c.271.002.49.305.487.676l-.013 1.875c-.003.37-.224.67-.495.668l-4.14-.025c-.27-.002-.487-.306-.485-.676l.012-1.875c.003-.37.224-.67.494-.668' style='color:%23000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:%23000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:evenodd;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:%23000;solid-opacity:1;vector-effect:none;fill:%23000;fill-opacity:.4;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto' transform='translate(15.553 2.85)scale(.88807)'/%3E %3Cpath d='M-9.415-.316C-12.69-.338-15.37 2.14-15.39 5.207c-.017 2.716 1.326 4.041 2.78 5.477 1.013 1 2.081 2.055 2.78 3.67l.092.076a.34.34 0 0 0 .225.086.34.34 0 0 0 .227-.083l.019-.01c.022-.009.057-.024.074-.064.697-1.6 1.78-2.64 2.814-3.634 1.473-1.414 2.847-2.733 2.864-5.44.02-3.067-2.627-5.58-5.901-5.601m-.057 8.784c1.621.011 2.944-1.315 2.955-2.96.01-1.646-1.295-2.988-2.916-2.999-1.622-.01-2.945 1.315-2.955 2.96s1.295 2.989 2.916 3' style='clip-rule:evenodd;fill:%23e1e3e9;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E %3Cpath d='M-11.594 15.465c-.27-.002-.492.297-.494.668l-.012 1.876c-.003.371.214.673.485.675l4.14.027c.271.002.492-.298.495-.668l.012-1.877c.003-.37-.215-.672-.485-.674z' style='clip-rule:evenodd;fill:%23fff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2.47727823;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:.4' transform='translate(15.553 2.85)scale(.88807)'/%3E %3C/g%3E %3C/svg%3E\")}}.maplibregl-ctrl.maplibregl-ctrl-attrib{padding:0 5px;background-color:hsla(0,0%,100%,.5);margin:0}@media screen{.maplibregl-ctrl-attrib.maplibregl-compact{min-height:20px;padding:2px 24px 2px 0;margin:10px;position:relative;background-color:#fff;color:#000;border-radius:12px;box-sizing:content-box}.maplibregl-ctrl-attrib.maplibregl-compact-show{padding:2px 28px 2px 8px;visibility:visible}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact-show,.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact-show{padding:2px 8px 2px 28px;border-radius:12px}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-inner{display:none}.maplibregl-ctrl-attrib-button{display:none;cursor:pointer;position:absolute;background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill-rule='evenodd' viewBox='0 0 20 20'%3E %3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E %3C/svg%3E\");background-color:hsla(0,0%,100%,.5);width:24px;height:24px;box-sizing:border-box;border-radius:12px;outline:none;top:0;right:0;border:0}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button{-webkit-appearance:none;-moz-appearance:none;appearance:none;list-style:none}.maplibregl-ctrl-attrib summary.maplibregl-ctrl-attrib-button::-webkit-details-marker{display:none}.maplibregl-ctrl-bottom-left .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-top-left .maplibregl-ctrl-attrib-button{left:0}.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-button,.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-inner{display:block}.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-button{background-color:rgba(0,0,0,.05)}.maplibregl-ctrl-bottom-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;right:0}.maplibregl-ctrl-top-right>.maplibregl-ctrl-attrib.maplibregl-compact:after{top:0;right:0}.maplibregl-ctrl-top-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{top:0;left:0}.maplibregl-ctrl-bottom-left>.maplibregl-ctrl-attrib.maplibregl-compact:after{bottom:0;left:0}}@media screen and (forced-colors:active){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill-rule='evenodd' viewBox='0 0 20 20' fill='%23fff'%3E %3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E %3C/svg%3E\")}}@media screen and (forced-colors:active) and (prefers-color-scheme:light){.maplibregl-ctrl-attrib.maplibregl-compact:after{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill-rule='evenodd' viewBox='0 0 20 20'%3E %3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E %3C/svg%3E\")}}.maplibregl-ctrl-attrib a{color:rgba(0,0,0,.75);text-decoration:none}.maplibregl-ctrl-attrib a:hover{color:inherit;text-decoration:underline}.maplibregl-attrib-empty{display:none}.maplibregl-ctrl-scale{background-color:hsla(0,0%,100%,.75);font-size:10px;white-space:nowrap;border-color:#333;border-style:none solid solid;border-width:medium 2px 2px;padding:0 5px;color:#333;box-sizing:border-box}.maplibregl-popup{position:absolute;top:0;left:0;display:flex;will-change:transform;pointer-events:none}.maplibregl-popup-anchor-top,.maplibregl-popup-anchor-top-left,.maplibregl-popup-anchor-top-right{flex-direction:column}.maplibregl-popup-anchor-bottom,.maplibregl-popup-anchor-bottom-left,.maplibregl-popup-anchor-bottom-right{flex-direction:column-reverse}.maplibregl-popup-anchor-left{flex-direction:row}.maplibregl-popup-anchor-right,[dir=rtl] .maplibregl-popup-anchor-left{flex-direction:row-reverse}.maplibregl-popup-tip{width:0;height:0;border:10px solid transparent;z-index:1}.maplibregl-popup-anchor-top .maplibregl-popup-tip{align-self:center;border-top:none;border-bottom-color:#fff}.maplibregl-popup-anchor-top-left .maplibregl-popup-tip{align-self:flex-start;border-top:none;border-left:none;border-bottom-color:#fff}.maplibregl-popup-anchor-top-right .maplibregl-popup-tip{align-self:flex-end;border-top:none;border-right:none;border-bottom-color:#fff}.maplibregl-popup-anchor-bottom .maplibregl-popup-tip{align-self:center;border-bottom:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip{align-self:flex-start;border-bottom:none;border-left:none;border-top-color:#fff}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip{align-self:flex-end;border-bottom:none;border-right:none;border-top-color:#fff}.maplibregl-popup-anchor-left .maplibregl-popup-tip{align-self:center;border-left:none;border-right-color:#fff}.maplibregl-popup-anchor-right .maplibregl-popup-tip{align-self:center;border-right:none;border-left-color:#fff}[dir=rtl] .maplibregl-popup-anchor-right{flex-direction:row}[dir=rtl] .maplibregl-popup-anchor-top-left .maplibregl-popup-tip{align-self:flex-end}[dir=rtl] .maplibregl-popup-anchor-top-right .maplibregl-popup-tip{align-self:flex-start}[dir=rtl] .maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip{align-self:flex-end}[dir=rtl] .maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip{align-self:flex-start}.maplibregl-popup-close-button{position:absolute;right:0;top:0;border:0;border-radius:0 3px 0 0;cursor:pointer;background-color:transparent}.maplibregl-popup-close-button:hover{background-color:rgba(0,0,0,.05)}.maplibregl-popup-content{position:relative;background:#fff;border-radius:3px;box-shadow:0 1px 2px rgba(0,0,0,.1);padding:15px 10px;pointer-events:auto}.maplibregl-popup-anchor-top-left .maplibregl-popup-content{border-top-left-radius:0}.maplibregl-popup-anchor-top-right .maplibregl-popup-content{border-top-right-radius:0}.maplibregl-popup-anchor-bottom-left .maplibregl-popup-content{border-bottom-left-radius:0}.maplibregl-popup-anchor-bottom-right .maplibregl-popup-content{border-bottom-right-radius:0}.maplibregl-popup-track-pointer{display:none}.maplibregl-popup-track-pointer *{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.maplibregl-map:hover .maplibregl-popup-track-pointer{display:flex}.maplibregl-map:active .maplibregl-popup-track-pointer{display:none}.maplibregl-marker{position:absolute;top:0;left:0;will-change:transform;transition:opacity .2s}.maplibregl-marker-draggable{cursor:grab}.maplibregl-user-location-dot,.maplibregl-user-location-dot:before{background-color:#1da1f2;width:15px;height:15px;border-radius:50%}.maplibregl-user-location-dot:before{content:\"\";position:absolute;animation:maplibregl-user-location-dot-pulse 2s infinite}.maplibregl-user-location-dot:after{border-radius:50%;border:2px solid #fff;content:\"\";height:19px;left:-2px;position:absolute;top:-2px;width:19px;box-sizing:border-box;box-shadow:0 0 3px rgba(0,0,0,.35)}@media(prefers-reduced-motion:reduce){.maplibregl-user-location-dot:before{animation:none}}@keyframes maplibregl-user-location-dot-pulse{0%{transform:scale(1);opacity:1}70%{transform:scale(3);opacity:0}to{transform:scale(1);opacity:0}}.maplibregl-user-location-dot-stale{background-color:#aaa}.maplibregl-user-location-dot-stale:after{display:none}.maplibregl-user-location-accuracy-circle{background-color:#1da1f233;width:1px;height:1px;border-radius:100%}.maplibregl-crosshair,.maplibregl-crosshair .maplibregl-interactive,.maplibregl-crosshair .maplibregl-interactive:active{cursor:crosshair}.maplibregl-boxzoom{position:absolute;top:0;left:0;width:0;height:0;background:#fff;border:2px dotted #202020;opacity:.5}.maplibregl-cooperative-gesture-screen{background:rgba(0,0,0,.4);position:absolute;inset:0;display:flex;justify-content:center;align-items:center;color:#fff;padding:1rem;font-size:1.4em;line-height:1.2;opacity:0;pointer-events:none;transition:opacity 1s 1s;z-index:99999}.maplibregl-cooperative-gesture-screen.maplibregl-show{opacity:1;transition:opacity .05s}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:none}@media(hover:none),(pointer:coarse){.maplibregl-cooperative-gesture-screen .maplibregl-desktop-message{display:none}.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message{display:block}}.maplibregl-pseudo-fullscreen{position:fixed!important;width:100%!important;height:100%!important;top:0!important;left:0!important;z-index:99999}";var lw=()=>{};function nz(e){if(dw&&!e)return;let t=e??new URL("./maplibre-gl-worker.mjs",import.meta.url).href;if(/^(https?:|blob:)/.test(t))nw(t);dw=!0}function sz(){return{version:8,sources:{imagery:{type:"raster",tiles:[rz],tileSize:256,maxzoom:18,attribution:'Imagery © <a href="https://www.esri.com" target="_blank" rel="noopener">Esri</a>, Maxar, Earthstar Geographics'},terrain:{type:"raster-dem",tiles:[cw],tileSize:256,maxzoom:15,encoding:"terrarium",attribution:'Terrain © <a href="https://registry.opendata.aws/terrain-tiles/" target="_blank" rel="noopener">Mapzen, AWS</a>'},hillshade:{type:"raster-dem",tiles:[cw],tileSize:256,maxzoom:15,encoding:"terrarium"}},sky:{"sky-color":"#0d1a2b","horizon-color":"#4d6a86","fog-color":"#1b2a3a","sky-horizon-blend":0.6,"horizon-fog-blend":0.6,"fog-ground-blend":0.7,"atmosphere-blend":["interpolate",["linear"],["zoom"],0,1,12,0.4,16,0]},layers:[{id:"background",type:"background",paint:{"background-color":"#0b1724"}},{id:"imagery",type:"raster",source:"imagery",paint:{"raster-saturation":0.1,"raster-contrast":0.12,"raster-brightness-max":0.88,"raster-fade-duration":200}},{id:"hillshade",type:"hillshade",source:"hillshade",paint:{"hillshade-exaggeration":0.45,"hillshade-shadow-color":"#0a0f18","hillshade-highlight-color":"#fff4e0","hillshade-accent-color":"#1a2433"}}]}}function $o(e,t){if(t>=1)return["interpolate",["linear"],["line-progress"],0,e,1,e];let i=Math.max(0.0001,Math.min(0.9999,t));return["step",["line-progress"],e,i,"rgba(0,0,0,0)"]}function hm(e,t,i){let r=document.createElement("div");if(r.className=e,r.innerHTML=t,i)r.setAttribute("role","img"),r.setAttribute("aria-label",i);return r}function pw(e){return e.replace(/[&<>"']/g,(t)=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t])}class dm{map;options;colors;track=null;profile=null;markers=[];kmMarkers=[];kmVisibilityFrame=0;revealFrame=0;flightFrame=0;flightActive=!1;flightBearing=0;styleReady;terrainOn=!0;overviewZoom=12;disposed=!1;reducedMotion=matchMedia("(prefers-reduced-motion: reduce)");constructor(e){this.options=e,this.colors=e.colors,this.terrainOn=e.threeD,nz(e.workerUrl);let t=document.createElement("style");t.textContent=uw,e.container.before(t),this.map=new ew({container:e.container,style:sz(),center:[0,30],zoom:1.5,pitch:this.terrainOn?cm:0,maxPitch:80,attributionControl:{compact:!0},cooperativeGestures:e.cooperative,locale:{"CooperativeGesturesHandler.WindowsHelpText":e.labels.cooperativeDesktop,"CooperativeGesturesHandler.MacHelpText":e.labels.cooperativeMac,"CooperativeGesturesHandler.MobileHelpText":e.labels.cooperativeMobile},fadeDuration:150,canvasContextAttributes:{antialias:!0}});let i=e.container;this.styleReady=new Promise((r)=>{this.map.once("load",()=>{i.querySelector(".maplibregl-ctrl-attrib")?.classList.remove("maplibregl-compact-show"),this.map.setTerrain(this.terrainOn?{source:"terrain",exaggeration:hw}:null),this.addRouteLayers(),r()})}),this.map.on("error",(r)=>{let a=String(r.error?.message??"");if(/webgl|context/i.test(a))this.options.onFail()}),this.map.on("rotate",this.emitBearing),this.map.on("pitch",this.emitBearing),this.map.on("move",this.scheduleKmVisibility),this.map.on("resize",this.scheduleKmVisibility),this.map.on("idle",this.scheduleKmVisibility);for(let r of["dragstart","wheel","touchstart","boxzoomstart"])this.map.on(r,()=>this.stopFlight())}emitBearing=()=>this.options.onBearing(this.map.getBearing(),this.map.getPitch());addRouteLayers(){let e={type:"FeatureCollection",features:[]};this.map.addSource(Vo,{type:"geojson",data:e,lineMetrics:!0}),this.map.addSource(fc,{type:"geojson",data:e});let t=this.colors.route;this.map.addLayer({id:"route-glow",type:"line",source:Vo,layout:{"line-join":"round","line-cap":"round"},paint:{"line-width":["interpolate",["linear"],["zoom"],8,10,14,22],"line-blur":["interpolate",["linear"],["zoom"],8,6,14,14],"line-opacity":0.55,"line-gradient":$o(this.colors.glow,0)}}),this.map.addLayer({id:"route-line",type:"line",source:Vo,layout:{"line-join":"round","line-cap":"round"},paint:{"line-width":["interpolate",["linear"],["zoom"],8,3,14,6],"line-gradient":$o(t,0)}}),this.map.addLayer({id:"route-highlight",type:"line",source:Vo,layout:{"line-join":"round","line-cap":"round"},paint:{"line-width":["interpolate",["linear"],["zoom"],8,1,14,2],"line-opacity":0.85,"line-gradient":$o(this.colors.highlight,0)}}),this.map.addLayer({id:"route-hit",type:"line",source:Vo,paint:{"line-width":28,"line-opacity":0}}),this.map.addLayer({id:"cursor-halo",type:"circle",source:fc,paint:{"circle-radius":14,"circle-color":t,"circle-opacity":0.3,"circle-blur":0.6,"circle-pitch-alignment":"map"}}),this.map.addLayer({id:"cursor-dot",type:"circle",source:fc,paint:{"circle-radius":6,"circle-color":"#ffffff","circle-stroke-color":t,"circle-stroke-width":3,"circle-pitch-alignment":"map"}}),this.map.on("mousemove","route-hit",(i)=>{this.map.getCanvas().style.cursor="crosshair",this.hoverAt(i.lngLat)}),this.map.on("mouseleave","route-hit",()=>{this.map.getCanvas().style.cursor="",this.options.onHover(null)}),this.map.on("click","route-hit",(i)=>this.hoverAt(i.lngLat))}hoverAt(e){if(!this.track||!this.profile||this.flightActive)return;this.options.onHover(Us(this.track.points,this.profile,{lat:e.lat,lon:e.lng}))}async setTrack(e,t,i){if(await this.styleReady,this.disposed)return;if(this.stopFlight(),this.track=e,this.profile=t,this.map.getSource(Vo)?.setData({type:"Feature",properties:{},geometry:{type:"LineString",coordinates:e.points.map((a)=>a.ele===void 0?[a.lon,a.lat]:[a.lon,a.lat,a.ele])}}),this.setCursor(null),this.placeMarkers(),this.frame(i?1800:0),i&&!this.reducedMotion.matches)this.reveal();else this.paintReveal(1)}placeMarkers(){for(let l of[...this.markers,...this.kmMarkers])l.remove();this.markers=[],this.kmMarkers=[];let e=this.track,t=this.profile;if(!e||!t||e.points.length<2)return;let i=this.options.labels,r=e.points[0],a=e.points[e.points.length-1],o=Pg(e.points),n=(l,u,c)=>new pc({element:hm(`wr-pin wr-pin--${c}`,`<span class="wr-pin__dot"></span><span class="wr-pin__label">${pw(u)}</span>`,u),anchor:"bottom",className:"wr-pin-marker"}).setLngLat([l.lon,l.lat]).addTo(this.map);if(o)this.markers.push(n(r,i.startFinish,"start"));else this.markers.push(n(r,i.start,"start")),this.markers.push(n(a,i.finish,"finish"));for(let l of e.waypoints){if(l.type==="START"||l.type==="FINISH"||l.type==="KM")continue;let u=l.name||i.waypoints[l.type];this.markers.push(new pc({element:hm(`wr-poi wr-poi--${l.type.toLowerCase()}`,`<span aria-hidden="true">${lz[l.type]}</span>`,u)}).setLngLat([l.lon,l.lat]).setPopup(new aw({offset:16,closeButton:!1,className:"wr-popup"}).setText(u)).addTo(this.map))}let s=qs(t.distanceM);for(let l=s;l*1000<t.distanceM-s*300;l+=s){let u=Ci(e.points,t,l*1000);if(!u)continue;this.kmMarkers.push(new pc({element:hm("wr-km-anchor wr-km--hidden",`<span class="wr-km">${l} ${pw(i.km)}</span>`)}).setLngLat([u.lon,u.lat]).addTo(this.map))}this.scheduleKmVisibility()}scheduleKmVisibility=()=>{if(this.disposed||this.kmVisibilityFrame||!this.kmMarkers.length)return;this.kmVisibilityFrame=requestAnimationFrame(()=>{this.kmVisibilityFrame=0,this.updateKmVisibility()})};updateKmVisibility(){let e=this.kmMarkers.map((r)=>r.getElement());if(this.map.getZoom()<this.overviewZoom+az){for(let r of e)r.classList.add("wr-km--hidden");return}let t=this.markers.map((r)=>r.getElement().getBoundingClientRect()),i=e.map((r)=>r.getBoundingClientRect());e.forEach((r,a)=>{let o=i[a],n=oz.find((s)=>!t.some((l)=>o.left<l.right+mc&&o.right>l.left-mc&&o.top+s<l.bottom+mc&&o.bottom+s>l.top-mc));if(r.classList.toggle("wr-km--hidden",n===void 0),n===void 0)return;if(n)r.style.setProperty("--km-offset",`${n}px`);else r.style.removeProperty("--km-offset");t.push(new DOMRect(o.x,o.y+n,o.width,o.height))})}paintReveal(e){if(!this.map.getLayer("route-line"))return;this.map.setPaintProperty("route-glow","line-gradient",$o(this.colors.glow,e)),this.map.setPaintProperty("route-line","line-gradient",$o(this.colors.route,e)),this.map.setPaintProperty("route-highlight","line-gradient",$o(this.colors.highlight,e))}reveal(){cancelAnimationFrame(this.revealFrame);let e=performance.now(),t=2600,i=(r)=>{let a=Math.min(1,(r-e)/t);if(this.paintReveal(1-(1-a)**3),a<1&&!this.disposed)this.revealFrame=requestAnimationFrame(i)};this.paintReveal(0),setTimeout(()=>{if(!this.disposed)this.revealFrame=requestAnimationFrame(i)},900)}frame(e=1200){let t=this.track;if(!t||t.points.length<2)return;let[i,r,a,o]=Mg(t.points),n=[[i,r],[a,o]],s=this.map.getContainer(),l={top:Math.round(s.clientHeight*0.18),bottom:Math.round(s.clientHeight*0.3),left:Math.round(s.clientWidth*0.08),right:Math.round(s.clientWidth*0.08)},u=this.terrainOn?-12:0,c=this.map.cameraForBounds(n,{padding:l,bearing:u});if(!c)return;if(typeof c.zoom==="number")this.overviewZoom=c.zoom;let h={...c,bearing:u,pitch:this.terrainOn?cm-10:0,duration:this.reducedMotion.matches?0:e,essential:!1};if(e===0)this.map.jumpTo(h);else this.map.flyTo({...h,curve:1.3})}setCursor(e){let t=this.map.getSource(fc);if(!t)return;let i=e!==null&&this.track&&this.profile?Ci(this.track.points,this.profile,e):null;t.setData(i?{type:"Feature",properties:{},geometry:{type:"Point",coordinates:[i.lon,i.lat]}}:{type:"FeatureCollection",features:[]})}setColors(e){if(this.colors=e,!this.map.getLayer("cursor-dot"))return;this.paintReveal(1),this.map.setPaintProperty("cursor-halo","circle-color",e.route),this.map.setPaintProperty("cursor-dot","circle-stroke-color",e.route)}set3d(e){this.terrainOn=e,this.styleReady.then(()=>{if(this.disposed||this.terrainOn!==e)return;this.map.setTerrain(e?{source:"terrain",exaggeration:hw}:null),this.map.setLayoutProperty("hillshade","visibility","visible"),this.frame(900)})}setCooperative(e){if(e)this.map.cooperativeGestures.enable();else this.map.cooperativeGestures.disable()}zoomBy(e){this.stopFlight(),this.map.easeTo({zoom:this.map.getZoom()+e,duration:250})}resetNorth(){this.stopFlight(),this.map.easeTo({bearing:0,pitch:this.terrainOn?cm-10:0,duration:500})}get flying(){return this.flightActive}fly(e=0){let t=this.track,i=this.profile;if(!t||!i||i.distanceM<=0)return;this.stopFlight(),this.map.stop();let r=Math.max(25,Math.min(120,i.distanceM/1000*1.4)),a=i.distanceM/r,o=Math.max(250,i.distanceM/60),n=e>=i.distanceM-1?0:e,s=Ci(t.points,i,n),l=Ci(t.points,i,n+o);this.flightBearing=$s(s,l),this.flightActive=!0,this.options.onFlight(n),this.setCursor(n);let u=0,c=(h)=>{if(!this.flightActive)return;let d=u?Math.min(0.1,(h-u)/1000):0;if(u=h,n+=a*d,n>=i.distanceM){this.stopFlight(),this.frame(1600);return}let p=Ci(t.points,i,n),f=Ci(t.points,i,n+o),m=($s(p,f)-this.flightBearing+540)%360-180;this.flightBearing=(this.flightBearing+m*Math.min(1,d*1.5)+360)%360,this.map.jumpTo({center:[p.lon,p.lat],bearing:this.flightBearing}),this.setCursor(n),this.options.onFlight(n),this.flightFrame=requestAnimationFrame(c)};this.map.once("moveend",()=>{if(this.flightActive)this.flightFrame=requestAnimationFrame(c)}),this.map.easeTo({center:[s.lon,s.lat],zoom:14.2,pitch:66,bearing:this.flightBearing,duration:this.reducedMotion.matches?0:1400})}stopFlight(){if(!this.flightActive)return;this.flightActive=!1,cancelAnimationFrame(this.flightFrame),this.flightFrame=0,this.options.onFlight(null)}resize(){this.map.resize()}dispose(){this.disposed=!0,cancelAnimationFrame(this.kmVisibilityFrame),cancelAnimationFrame(this.revealFrame),this.stopFlight(),this.map.remove()}}var Vo="wodira-route",fc="wodira-cursor",cw="https://s3.amazonaws.com/elevation-tiles-prod/terrarium/{z}/{x}/{y}.png",rz="https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}",hw=1.5,cm=62,az=0.9,mc=5,oz,dw=!1,lz;var fw=$c(()=>{sw();lw();oz=[0,-36,36];lz={START:"▶",FINISH:"⚑",AID:"\uD83C\uDF4C",FOOD:"\uD83C\uDF7D",WATER:"\uD83D\uDCA7",MEDICAL:"✚",KM:"•",OTHER:"●"}});var Ls=globalThis,Uc=Ls.ShadowRoot&&(Ls.ShadyCSS===void 0||Ls.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,qc=Symbol(),$m=new WeakMap;class Gc{constructor(e,t,i){if(this._$cssResult$=!0,i!==qc)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this._strings=t}get styleSheet(){let e=this._styleSheet,t=this._strings;if(Uc&&e===void 0){let i=t!==void 0&&t.length===1;if(i)e=$m.get(t);if(e===void 0){if((this._styleSheet=e=new CSSStyleSheet).replaceSync(this.cssText),i)$m.set(t,e)}}return e}toString(){return this.cssText}}var Ew=(e)=>{if(e._$cssResult$===!0)return e.cssText;else if(typeof e==="number")return e;else throw Error(`Value passed to 'css' function must be a 'css' function result: ${e}. Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.`)},Sw=(e)=>new Gc(typeof e==="string"?e:String(e),void 0,qc),Um=(e,...t)=>{let i=e.length===1?e[0]:t.reduce((r,a,o)=>r+Ew(a)+e[o+1],e[0]);return new Gc(i,e,qc)},qm=(e,t)=>{if(Uc)e.adoptedStyleSheets=t.map((i)=>i instanceof CSSStyleSheet?i:i.styleSheet);else for(let i of t){let r=document.createElement("style"),a=Ls.litNonce;if(a!==void 0)r.setAttribute("nonce",a);r.textContent=i.cssText,e.appendChild(r)}},Cw=(e)=>{let t="";for(let i of e.cssRules)t+=i.cssText;return Sw(t)},Wc=Uc?(e)=>e:(e)=>e instanceof CSSStyleSheet?Cw(e):e;var{is:Dw,defineProperty:Aw,getOwnPropertyDescriptor:Gm,getOwnPropertyNames:Mw,getOwnPropertySymbols:Pw,getPrototypeOf:Wm}=Object,Iw=!1,ei=globalThis;if(Iw)ei.customElements??=customElements;var fi=!0,Ni,Zm=ei.trustedTypes,kw=Zm?Zm.emptyScript:"",Xm=fi?ei.reactiveElementPolyfillSupportDevMode:ei.reactiveElementPolyfillSupport;if(fi)ei.litIssuedWarnings??=new Set,Ni=(e,t)=>{if(t+=` See https://lit.dev/msg/${e} for more information.`,!ei.litIssuedWarnings.has(t)&&!ei.litIssuedWarnings.has(e))console.warn(t),ei.litIssuedWarnings.add(t)},queueMicrotask(()=>{if(Ni("dev-mode","Lit is in dev mode. Not recommended for production!"),ei.ShadyDOM?.inUse&&Xm===void 0)Ni("polyfill-support-missing","Shadow DOM is being polyfilled via `ShadyDOM` but the `polyfill-support` module has not been loaded.")});var Fw=fi?(e)=>{if(!ei.emitLitDebugLogEvents)return;ei.dispatchEvent(new CustomEvent("lit-debug",{detail:e}))}:void 0,Ka=(e,t)=>e,Zc={toAttribute(e,t){switch(t){case Boolean:e=e?kw:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e);break}return e},fromAttribute(e,t){let i=e;switch(t){case Boolean:i=e!==null;break;case Number:i=e===null?null:Number(e);break;case Object:case Array:try{i=JSON.parse(e)}catch(r){i=null}break}return i}},Ym=(e,t)=>!Dw(e,t),Hm={attribute:!0,type:String,converter:Zc,reflect:!1,useDefault:!1,hasChanged:Ym};Symbol.metadata??=Symbol("metadata");ei.litPropertyMetadata??=new WeakMap;class mi extends HTMLElement{static addInitializer(e){this.__prepare(),(this._initializers??=[]).push(e)}static get observedAttributes(){return this.finalize(),this.__attributeToPropertyMap&&[...this.__attributeToPropertyMap.keys()]}static createProperty(e,t=Hm){if(t.state)t.attribute=!1;if(this.__prepare(),this.prototype.hasOwnProperty(e))t=Object.create(t),t.wrapped=!0;if(this.elementProperties.set(e,t),!t.noAccessor){let i=fi?Symbol.for(`${String(e)} (@property() cache)`):Symbol(),r=this.getPropertyDescriptor(e,i,t);if(r!==void 0)Aw(this.prototype,e,r)}}static getPropertyDescriptor(e,t,i){let{get:r,set:a}=Gm(this.prototype,e)??{get(){return this[t]},set(o){this[t]=o}};if(fi&&r==null){if("value"in(Gm(this.prototype,e)??{}))throw Error(`Field ${JSON.stringify(String(e))} on ${this.name} was declared as a reactive property but it's actually declared as a value on the prototype. Usually this is due to using @property or @state on a method.`);Ni("reactive-property-without-getter",`Field ${JSON.stringify(String(e))} on ${this.name} was declared as a reactive property but it does not have a getter. This will be an error in a future version of Lit.`)}return{get:r,set(o){let n=r?.call(this);a?.call(this,o),this.requestUpdate(e,n,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Hm}static __prepare(){if(this.hasOwnProperty(Ka("elementProperties",this)))return;let e=Wm(this);if(e.finalize(),e._initializers!==void 0)this._initializers=[...e._initializers];this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Ka("finalized",this)))return;if(this.finalized=!0,this.__prepare(),this.hasOwnProperty(Ka("properties",this))){let t=this.properties,i=[...Mw(t),...Pw(t)];for(let r of i)this.createProperty(r,t[r])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[i,r]of t)this.elementProperties.set(i,r)}this.__attributeToPropertyMap=new Map;for(let[t,i]of this.elementProperties){let r=this.__attributeNameForProperty(t,i);if(r!==void 0)this.__attributeToPropertyMap.set(r,t)}if(this.elementStyles=this.finalizeStyles(this.styles),fi){if(this.hasOwnProperty("createProperty"))Ni("no-override-create-property","Overriding ReactiveElement.createProperty() is deprecated. The override will not be called with standard decorators");if(this.hasOwnProperty("getPropertyDescriptor"))Ni("no-override-get-property-descriptor","Overriding ReactiveElement.getPropertyDescriptor() is deprecated. The override will not be called with standard decorators")}}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let i=new Set(e.flat(1/0).reverse());for(let r of i)t.unshift(Wc(r))}else if(e!==void 0)t.push(Wc(e));return t}static __attributeNameForProperty(e,t){let i=t.attribute;return i===!1?void 0:typeof i==="string"?i:typeof e==="string"?e.toLowerCase():void 0}constructor(){super();this.__instanceProperties=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this.__reflectingProperty=null,this.__initialize()}__initialize(){this.__updatePromise=new Promise((e)=>this.enableUpdating=e),this._$changedProperties=new Map,this.__saveInstanceProperties(),this.requestUpdate(),this.constructor._initializers?.forEach((e)=>e(this))}addController(e){if((this.__controllers??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected)e.hostConnected?.()}removeController(e){this.__controllers?.delete(e)}__saveInstanceProperties(){let e=new Map,t=this.constructor.elementProperties;for(let i of t.keys())if(this.hasOwnProperty(i))e.set(i,this[i]),delete this[i];if(e.size>0)this.__instanceProperties=e}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return qm(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this.__controllers?.forEach((e)=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this.__controllers?.forEach((e)=>e.hostDisconnected?.())}attributeChangedCallback(e,t,i){this._$attributeToProperty(e,i)}__propertyToAttribute(e,t){let r=this.constructor.elementProperties.get(e),a=this.constructor.__attributeNameForProperty(e,r);if(a!==void 0&&r.reflect===!0){let n=(r.converter?.toAttribute!==void 0?r.converter:Zc).toAttribute(t,r.type);if(fi&&this.constructor.enabledWarnings.includes("migration")&&n===void 0)Ni("undefined-attribute-value",`The attribute value for the ${e} property is undefined on element ${this.localName}. The attribute will be removed, but in the previous version of \`ReactiveElement\`, the attribute would not have changed.`);if(this.__reflectingProperty=e,n==null)this.removeAttribute(a);else this.setAttribute(a,n);this.__reflectingProperty=null}}_$attributeToProperty(e,t){let i=this.constructor,r=i.__attributeToPropertyMap.get(e);if(r!==void 0&&this.__reflectingProperty!==r){let a=i.getPropertyOptions(r),o=typeof a.converter==="function"?{fromAttribute:a.converter}:a.converter?.fromAttribute!==void 0?a.converter:Zc;this.__reflectingProperty=r;let n=o.fromAttribute(t,a.type);this[r]=n??this.__defaultValues?.get(r)??n,this.__reflectingProperty=null}}requestUpdate(e,t,i,r=!1,a){if(e!==void 0){if(fi&&e instanceof Event)Ni("","The requestUpdate() method was called with an Event as the property name. This is probably a mistake caused by binding this.requestUpdate as an event listener. Instead bind a function that will call it with no arguments: () => this.requestUpdate()");let o=this.constructor;if(r===!1)a=this[e];if(i??=o.getPropertyOptions(e),(i.hasChanged??Ym)(a,t)||i.useDefault&&i.reflect&&a===this.__defaultValues?.get(e)&&!this.hasAttribute(o.__attributeNameForProperty(e,i)))this._$changeProperty(e,t,i);else return}if(this.isUpdatePending===!1)this.__updatePromise=this.__enqueueUpdate()}_$changeProperty(e,t,{useDefault:i,reflect:r,wrapped:a},o){if(i&&!(this.__defaultValues??=new Map).has(e)){if(this.__defaultValues.set(e,o??t??this[e]),a!==!0||o!==void 0)return}if(!this._$changedProperties.has(e)){if(!this.hasUpdated&&!i)t=void 0;this._$changedProperties.set(e,t)}if(r===!0&&this.__reflectingProperty!==e)(this.__reflectingProperties??=new Set).add(e)}async __enqueueUpdate(){this.isUpdatePending=!0;try{await this.__updatePromise}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();if(e!=null)await e;return!this.isUpdatePending}scheduleUpdate(){let e=this.performUpdate();if(fi&&this.constructor.enabledWarnings.includes("async-perform-update")&&typeof e?.then==="function")Ni("async-perform-update",`Element ${this.localName} returned a Promise from performUpdate(). This behavior is deprecated and will be removed in a future version of ReactiveElement.`);return e}performUpdate(){if(!this.isUpdatePending)return;if(Fw?.({kind:"update"}),!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),fi){let a=[...this.constructor.elementProperties.keys()].filter((o)=>this.hasOwnProperty(o)&&(o in Wm(this)));if(a.length)throw Error(`The following properties on element ${this.localName} will not trigger updates as expected because they are set using class fields: ${a.join(", ")}. Native class fields and some compiled output will overwrite accessors used for detecting changes. See https://lit.dev/msg/class-field-shadowing for more information.`)}if(this.__instanceProperties){for(let[r,a]of this.__instanceProperties)this[r]=a;this.__instanceProperties=void 0}let i=this.constructor.elementProperties;if(i.size>0)for(let[r,a]of i){let{wrapped:o}=a,n=this[r];if(o===!0&&!this._$changedProperties.has(r)&&n!==void 0)this._$changeProperty(r,void 0,a,n)}}let e=!1,t=this._$changedProperties;try{if(e=this.shouldUpdate(t),e)this.willUpdate(t),this.__controllers?.forEach((i)=>i.hostUpdate?.()),this.update(t);else this.__markUpdated()}catch(i){throw e=!1,this.__markUpdated(),i}if(e)this._$didUpdate(t)}willUpdate(e){}_$didUpdate(e){if(this.__controllers?.forEach((t)=>t.hostUpdated?.()),!this.hasUpdated)this.hasUpdated=!0,this.firstUpdated(e);if(this.updated(e),fi&&this.isUpdatePending&&this.constructor.enabledWarnings.includes("change-in-update"))Ni("change-in-update",`Element ${this.localName} scheduled an update (generally because a property was set) after an update completed, causing a new update to be scheduled. This is inefficient and should be avoided unless the next update can only be scheduled as a side effect of the previous update.`)}__markUpdated(){this._$changedProperties=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this.__updatePromise}shouldUpdate(e){return!0}update(e){this.__reflectingProperties&&=this.__reflectingProperties.forEach((t)=>this.__propertyToAttribute(t,this[t])),this.__markUpdated()}updated(e){}firstUpdated(e){}}mi.elementStyles=[];mi.shadowRootOptions={mode:"open"};mi[Ka("elementProperties",mi)]=new Map;mi[Ka("finalized",mi)]=new Map;Xm?.({ReactiveElement:mi});if(fi){mi.enabledWarnings=["change-in-update","async-perform-update"];let e=function(t){if(!t.hasOwnProperty(Ka("enabledWarnings",t)))t.enabledWarnings=t.enabledWarnings.slice()};mi.enableWarning=function(t){if(e(this),!this.enabledWarnings.includes(t))this.enabledWarnings.push(t)},mi.disableWarning=function(t){e(this);let i=this.enabledWarnings.indexOf(t);if(i>=0)this.enabledWarnings.splice(i,1)}}(ei.reactiveElementVersions??=[]).push("2.1.2");if(fi&&ei.reactiveElementVersions.length>1)queueMicrotask(()=>{Ni("multiple-versions","Multiple versions of Lit loaded. Loading multiple versions is not recommended.")});var gi=globalThis,Pe=(e)=>{if(!gi.emitLitDebugLogEvents)return;gi.dispatchEvent(new CustomEvent("lit-debug",{detail:e}))},Rw=0,tn;gi.litIssuedWarnings??=new Set,tn=(e,t)=>{if(t+=e?` See https://lit.dev/msg/${e} for more information.`:"",!gi.litIssuedWarnings.has(t)&&!gi.litIssuedWarnings.has(e))console.warn(t),gi.litIssuedWarnings.add(t)},queueMicrotask(()=>{tn("dev-mode","Lit is in dev mode. Not recommended for production!")});var Vi=gi.ShadyDOM?.inUse&&gi.ShadyDOM?.noPatch===!0?gi.ShadyDOM.wrap:(e)=>e,Bs=gi.trustedTypes,Km=Bs?Bs.createPolicy("lit-html",{createHTML:(e)=>e}):void 0,zw=(e)=>e,Vs=(e,t,i)=>zw,Lw=(e)=>{if(pa!==Vs)throw Error("Attempted to overwrite existing lit-html security policy. setSanitizeDOMValueFactory should be called at most once.");pa=e},Bw=()=>{pa=Vs},Jc=(e,t,i)=>pa(e,t,i),ag="$lit$",Cr=`lit$${Math.random().toFixed(9).slice(2)}$`,og="?"+Cr,Ow=`<${og}>`,da=document,rn=()=>da.createComment(""),an=(e)=>e===null||typeof e!="object"&&typeof e!="function",Qc=Array.isArray,jw=(e)=>Qc(e)||typeof e?.[Symbol.iterator]==="function",Hc=`[
849
+ \f\r]`,Nw=`[^
850
+ \f\r"'\`<>=]`,Vw=`[^\\s"'>=/]`,Qo=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Jm=1,Xc=2,$w=3,Qm=/-->/g,eg=/>/g,qr=new RegExp(`>|${Hc}(?:(${Vw}+)(${Hc}*=${Hc}*(?:${Nw}|("|')|))|$)`,"g"),Uw=0,tg=1,qw=2,ig=3,Yc=/'/g,Kc=/"/g,ng=/^(?:script|style|textarea|title)$/i,Gw=1,Os=2,js=3,eh=1,Ns=2,Ww=3,Zw=4,Hw=5,th=6,Xw=7,ih=(e)=>(t,...i)=>{if(t.some((r)=>r===void 0))console.warn(`Some template strings are undefined.
851
+ This is probably caused by illegal octal escape sequences.`);if(i.some((r)=>r?._$litStatic$))tn("",`Static values 'literal' or 'unsafeStatic' cannot be used as values to non-static templates.
852
+ Please use the static 'html' tag function. See https://lit.dev/docs/templates/expressions/#static-expressions`);return{["_$litType$"]:e,strings:t,values:i}},Ke=ih(Gw),Qa=ih(Os),gz=ih(js),Dr=Symbol.for("lit-noChange"),Ie=Symbol.for("lit-nothing"),rg=new WeakMap,ha=da.createTreeWalker(da,129),pa=Vs;function sg(e,t){if(!Qc(e)||!e.hasOwnProperty("raw")){let i="invalid template strings array";throw i=`
853
+ Internal Error: expected template strings to be an array
854
+ with a 'raw' field. Faking a template strings array by
855
+ calling html or svg like an ordinary function is effectively
856
+ the same as calling unsafeHtml and can lead to major security
857
+ issues, e.g. opening your code up to XSS attacks.
858
+ If you're using the html or svg tagged template functions normally
859
+ and still seeing this error, please file a bug at
860
+ https://github.com/lit/lit/issues/new?template=bug_report.md
861
+ and include information about your build tooling, if any.
862
+ `.trim().replace(/\n */g,`
863
+ `),Error(i)}return Km!==void 0?Km.createHTML(t):t}var Yw=(e,t)=>{let i=e.length-1,r=[],a=t===Os?"<svg>":t===js?"<math>":"",o,n=Qo;for(let l=0;l<i;l++){let u=e[l],c=-1,h,d=0,p;while(d<u.length){if(n.lastIndex=d,p=n.exec(u),p===null)break;if(d=n.lastIndex,n===Qo){if(p[Jm]==="!--")n=Qm;else if(p[Jm]!==void 0)n=eg;else if(p[Xc]!==void 0){if(ng.test(p[Xc]))o=new RegExp(`</${p[Xc]}`,"g");n=qr}else if(p[$w]!==void 0)throw Error("Bindings in tag names are not supported. Please use static templates instead. See https://lit.dev/docs/templates/expressions/#static-expressions")}else if(n===qr)if(p[Uw]===">")n=o??Qo,c=-1;else if(p[tg]===void 0)c=-2;else c=n.lastIndex-p[qw].length,h=p[tg],n=p[ig]===void 0?qr:p[ig]==='"'?Kc:Yc;else if(n===Kc||n===Yc)n=qr;else if(n===Qm||n===eg)n=Qo;else n=qr,o=void 0}console.assert(c===-1||n===qr||n===Yc||n===Kc,"unexpected parse state B");let f=n===qr&&e[l+1].startsWith("/>")?" ":"";a+=n===Qo?u+Ow:c>=0?(r.push(h),u.slice(0,c)+ag+u.slice(c))+Cr+f:u+Cr+(c===-2?l:f)}let s=a+(e[i]||"<?>")+(t===Os?"</svg>":t===js?"</math>":"");return[sg(e,s),r]};class on{constructor({strings:e,["_$litType$"]:t},i){this.parts=[];let r,a=0,o=0,n=e.length-1,s=this.parts,[l,u]=Yw(e,t);if(this.el=on.createElement(l,i),ha.currentNode=this.el.content,t===Os||t===js){let c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}while((r=ha.nextNode())!==null&&s.length<n){if(r.nodeType===1){{let c=r.localName;if(/^(?:textarea|template)$/i.test(c)&&r.innerHTML.includes(Cr)){let h=`Expressions are not supported inside \`${c}\` elements. See https://lit.dev/msg/expression-in-${c} for more information.`;if(c==="template")throw Error(h);else tn("",h)}}if(r.hasAttributes()){for(let c of r.getAttributeNames())if(c.endsWith(ag)){let h=u[o++],p=r.getAttribute(c).split(Cr),f=/([.?@])?(.*)/.exec(h);s.push({type:eh,index:a,name:f[2],strings:p,ctor:f[1]==="."?ug:f[1]==="?"?cg:f[1]==="@"?hg:sn}),r.removeAttribute(c)}else if(c.startsWith(Cr))s.push({type:th,index:a}),r.removeAttribute(c)}if(ng.test(r.tagName)){let c=r.textContent.split(Cr),h=c.length-1;if(h>0){r.textContent=Bs?Bs.emptyScript:"";for(let d=0;d<h;d++)r.append(c[d],rn()),ha.nextNode(),s.push({type:Ns,index:++a});r.append(c[h],rn())}}}else if(r.nodeType===8)if(r.data===og)s.push({type:Ns,index:a});else{let h=-1;while((h=r.data.indexOf(Cr,h+1))!==-1)s.push({type:Xw,index:a}),h+=Cr.length-1}a++}if(u.length!==o)throw Error('Detected duplicate attribute bindings. This occurs if your template has duplicate attributes on an element tag. For example "<input ?disabled=${true} ?disabled=${false}>" contains a duplicate "disabled" attribute. The error was detected in the following template: \n`'+e.join("${...}")+"`");Pe&&Pe({kind:"template prep",template:this,clonableTemplate:this.el,parts:this.parts,strings:e})}static createElement(e,t){let i=da.createElement("template");return i.innerHTML=e,i}}function Ja(e,t,i=e,r){if(t===Dr)return t;let a=r!==void 0?i.__directives?.[r]:i.__directive,o=an(t)?void 0:t._$litDirective$;if(a?.constructor!==o){if(a?._$notifyDirectiveConnectionChanged?.(!1),o===void 0)a=void 0;else a=new o(e),a._$initialize(e,i,r);if(r!==void 0)(i.__directives??=[])[r]=a;else i.__directive=a}if(a!==void 0)t=Ja(e,a._$resolve(e,t.values),a,r);return t}class lg{constructor(e,t){this._$parts=[],this._$disconnectableChildren=void 0,this._$template=e,this._$parent=t}get parentNode(){return this._$parent.parentNode}get _$isConnected(){return this._$parent._$isConnected}_clone(e){let{el:{content:t},parts:i}=this._$template,r=(e?.creationScope??da).importNode(t,!0);ha.currentNode=r;let a=ha.nextNode(),o=0,n=0,s=i[0];while(s!==void 0){if(o===s.index){let l;if(s.type===Ns)l=new nn(a,a.nextSibling,this,e);else if(s.type===eh)l=new s.ctor(a,s.name,s.strings,this,e);else if(s.type===th)l=new dg(a,this,e);this._$parts.push(l),s=i[++n]}if(o!==s?.index)a=ha.nextNode(),o++}return ha.currentNode=da,r}_update(e){let t=0;for(let i of this._$parts){if(i!==void 0)if(Pe&&Pe({kind:"set part",part:i,value:e[t],valueIndex:t,values:e,templateInstance:this}),i.strings!==void 0)i._$setValue(e,i,t),t+=i.strings.length-2;else i._$setValue(e[t]);t++}}}class nn{get _$isConnected(){return this._$parent?._$isConnected??this.__isConnected}constructor(e,t,i,r){this.type=Ns,this._$committedValue=Ie,this._$disconnectableChildren=void 0,this._$startNode=e,this._$endNode=t,this._$parent=i,this.options=r,this.__isConnected=r?.isConnected??!0,this._textSanitizer=void 0}get parentNode(){let e=Vi(this._$startNode).parentNode,t=this._$parent;if(t!==void 0&&e?.nodeType===11)e=t.parentNode;return e}get startNode(){return this._$startNode}get endNode(){return this._$endNode}_$setValue(e,t=this){if(this.parentNode===null)throw Error("This `ChildPart` has no `parentNode` and therefore cannot accept a value. This likely means the element containing the part was manipulated in an unsupported way outside of Lit's control such that the part's marker nodes were ejected from DOM. For example, setting the element's `innerHTML` or `textContent` can do this.");if(e=Ja(this,e,t),an(e)){if(e===Ie||e==null||e===""){if(this._$committedValue!==Ie)Pe&&Pe({kind:"commit nothing to child",start:this._$startNode,end:this._$endNode,parent:this._$parent,options:this.options}),this._$clear();this._$committedValue=Ie}else if(e!==this._$committedValue&&e!==Dr)this._commitText(e)}else if(e._$litType$!==void 0)this._commitTemplateResult(e);else if(e.nodeType!==void 0){if(this.options?.host===e){this._commitText("[probable mistake: rendered a template's host in itself (commonly caused by writing ${this} in a template]"),console.warn("Attempted to render the template host",e,"inside itself. This is almost always a mistake, and in dev mode ","we render some warning text. In production however, we'll ","render it, which will usually result in an error, and sometimes ","in the element disappearing from the DOM.");return}this._commitNode(e)}else if(jw(e))this._commitIterable(e);else this._commitText(e)}_insert(e){return Vi(Vi(this._$startNode).parentNode).insertBefore(e,this._$endNode)}_commitNode(e){if(this._$committedValue!==e){if(this._$clear(),pa!==Vs){let t=this._$startNode.parentNode?.nodeName;if(t==="STYLE"||t==="SCRIPT"){let i="Forbidden";if(t==="STYLE")i="Lit does not support binding inside style nodes. This is a security risk, as style injection attacks can exfiltrate data and spoof UIs. Consider instead using css`...` literals to compose styles, and do dynamic styling with css custom properties, ::parts, <slot>s, and by mutating the DOM rather than stylesheets.";else i="Lit does not support binding inside script nodes. This is a security risk, as it could allow arbitrary code execution.";throw Error(i)}}Pe&&Pe({kind:"commit node",start:this._$startNode,parent:this._$parent,value:e,options:this.options}),this._$committedValue=this._insert(e)}}_commitText(e){if(this._$committedValue!==Ie&&an(this._$committedValue)){let t=Vi(this._$startNode).nextSibling;if(this._textSanitizer===void 0)this._textSanitizer=Jc(t,"data","property");e=this._textSanitizer(e),Pe&&Pe({kind:"commit text",node:t,value:e,options:this.options}),t.data=e}else{let t=da.createTextNode("");if(this._commitNode(t),this._textSanitizer===void 0)this._textSanitizer=Jc(t,"data","property");e=this._textSanitizer(e),Pe&&Pe({kind:"commit text",node:t,value:e,options:this.options}),t.data=e}this._$committedValue=e}_commitTemplateResult(e){let{values:t,["_$litType$"]:i}=e,r=typeof i==="number"?this._$getTemplate(e):(i.el===void 0&&(i.el=on.createElement(sg(i.h,i.h[0]),this.options)),i);if(this._$committedValue?._$template===r)Pe&&Pe({kind:"template updating",template:r,instance:this._$committedValue,parts:this._$committedValue._$parts,options:this.options,values:t}),this._$committedValue._update(t);else{let a=new lg(r,this),o=a._clone(this.options);Pe&&Pe({kind:"template instantiated",template:r,instance:a,parts:a._$parts,options:this.options,fragment:o,values:t}),a._update(t),Pe&&Pe({kind:"template instantiated and updated",template:r,instance:a,parts:a._$parts,options:this.options,fragment:o,values:t}),this._commitNode(o),this._$committedValue=a}}_$getTemplate(e){let t=rg.get(e.strings);if(t===void 0)rg.set(e.strings,t=new on(e));return t}_commitIterable(e){if(!Qc(this._$committedValue))this._$committedValue=[],this._$clear();let t=this._$committedValue,i=0,r;for(let a of e){if(i===t.length)t.push(r=new nn(this._insert(rn()),this._insert(rn()),this,this.options));else r=t[i];r._$setValue(a),i++}if(i<t.length)this._$clear(r&&Vi(r._$endNode).nextSibling,i),t.length=i}_$clear(e=Vi(this._$startNode).nextSibling,t){this._$notifyConnectionChanged?.(!1,!0,t);while(e!==this._$endNode){let i=Vi(e).nextSibling;Vi(e).remove(),e=i}}setConnected(e){if(this._$parent===void 0)this.__isConnected=e,this._$notifyConnectionChanged?.(e);else throw Error("part.setConnected() may only be called on a RootPart returned from render().")}}class sn{get tagName(){return this.element.tagName}get _$isConnected(){return this._$parent._$isConnected}constructor(e,t,i,r,a){if(this.type=eh,this._$committedValue=Ie,this._$disconnectableChildren=void 0,this.element=e,this.name=t,this._$parent=r,this.options=a,i.length>2||i[0]!==""||i[1]!=="")this._$committedValue=Array(i.length-1).fill(new String),this.strings=i;else this._$committedValue=Ie;this._sanitizer=void 0}_$setValue(e,t=this,i,r){let a=this.strings,o=!1;if(a===void 0){if(e=Ja(this,e,t,0),o=!an(e)||e!==this._$committedValue&&e!==Dr,o)this._$committedValue=e}else{let n=e;e=a[0];let s,l;for(s=0;s<a.length-1;s++){if(l=Ja(this,n[i+s],t,s),l===Dr)l=this._$committedValue[s];if(o||=!an(l)||l!==this._$committedValue[s],l===Ie)e=Ie;else if(e!==Ie)e+=(l??"")+a[s+1];this._$committedValue[s]=l}}if(o&&!r)this._commitValue(e)}_commitValue(e){if(e===Ie)Vi(this.element).removeAttribute(this.name);else{if(this._sanitizer===void 0)this._sanitizer=pa(this.element,this.name,"attribute");e=this._sanitizer(e??""),Pe&&Pe({kind:"commit attribute",element:this.element,name:this.name,value:e,options:this.options}),Vi(this.element).setAttribute(this.name,e??"")}}}class ug extends sn{constructor(){super(...arguments);this.type=Ww}_commitValue(e){if(this._sanitizer===void 0)this._sanitizer=pa(this.element,this.name,"property");e=this._sanitizer(e),Pe&&Pe({kind:"commit property",element:this.element,name:this.name,value:e,options:this.options}),this.element[this.name]=e===Ie?void 0:e}}class cg extends sn{constructor(){super(...arguments);this.type=Zw}_commitValue(e){Pe&&Pe({kind:"commit boolean attribute",element:this.element,name:this.name,value:!!(e&&e!==Ie),options:this.options}),Vi(this.element).toggleAttribute(this.name,!!e&&e!==Ie)}}class hg extends sn{constructor(e,t,i,r,a){super(e,t,i,r,a);if(this.type=Hw,this.strings!==void 0)throw Error(`A \`<${e.localName}>\` has a \`@${t}=...\` listener with invalid content. Event listeners in templates must have exactly one expression and no surrounding text.`)}_$setValue(e,t=this){if(e=Ja(this,e,t,0)??Ie,e===Dr)return;let i=this._$committedValue,r=e===Ie&&i!==Ie||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,a=e!==Ie&&(i===Ie||r);if(Pe&&Pe({kind:"commit event listener",element:this.element,name:this.name,value:e,options:this.options,removeListener:r,addListener:a,oldListener:i}),r)this.element.removeEventListener(this.name,this,i);if(a)this.element.addEventListener(this.name,this,e);this._$committedValue=e}handleEvent(e){if(typeof this._$committedValue==="function")this._$committedValue.call(this.options?.host??this.element,e);else this._$committedValue.handleEvent(e)}}class dg{constructor(e,t,i){this.element=e,this.type=th,this._$disconnectableChildren=void 0,this._$parent=t,this.options=i}get _$isConnected(){return this._$parent._$isConnected}_$setValue(e){Pe&&Pe({kind:"commit to element binding",element:this.element,value:e,options:this.options}),Ja(this,e)}}var Kw=gi.litHtmlPolyfillSupportDevMode;Kw?.(on,nn);(gi.litHtmlVersions??=[]).push("3.3.3");if(gi.litHtmlVersions.length>1)queueMicrotask(()=>{tn("multiple-versions","Multiple versions of Lit loaded. Loading multiple versions is not recommended.")});var en=(e,t,i)=>{if(t==null)throw TypeError(`The container to render into may not be ${t}`);let r=Rw++,a=i?.renderBefore??t,o=a._$litPart$;if(Pe&&Pe({kind:"begin render",id:r,value:e,container:t,options:i,part:o}),o===void 0){let n=i?.renderBefore??null;a._$litPart$=o=new nn(t.insertBefore(rn(),n),n,void 0,i??{})}return o._$setValue(e),Pe&&Pe({kind:"end render",id:r,value:e,container:t,options:i,part:o}),o};en.setSanitizer=Lw,en.createSanitizer=Jc,en._testOnlyClearSanitizerFactoryDoNotCallOrElse=Bw;var Jw=(e,t)=>e,rh=!0,Ar=globalThis,pg;if(rh)Ar.litIssuedWarnings??=new Set,pg=(e,t)=>{if(t+=` See https://lit.dev/msg/${e} for more information.`,!Ar.litIssuedWarnings.has(t)&&!Ar.litIssuedWarnings.has(e))console.warn(t),Ar.litIssuedWarnings.add(t)};class Gr extends mi{constructor(){super(...arguments);this.renderOptions={host:this},this.__childPart=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();if(!this.hasUpdated)this.renderOptions.isConnected=this.isConnected;super.update(e),this.__childPart=en(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this.__childPart?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this.__childPart?.setConnected(!1)}render(){return Dr}}Gr._$litElement$=!0;Gr[Jw("finalized",Gr)]=!0;Ar.litElementHydrateSupport?.({LitElement:Gr});var Qw=rh?Ar.litElementPolyfillSupportDevMode:Ar.litElementPolyfillSupport;Qw?.({LitElement:Gr});(Ar.litElementVersions??=[]).push("4.2.2");if(rh&&Ar.litElementVersions.length>1)queueMicrotask(()=>{pg("multiple-versions","Multiple versions of Lit loaded. Loading multiple versions is not recommended.")});var fg={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},mg=(e)=>(...t)=>({["_$litDirective$"]:e,values:t});class ah{constructor(e){}get _$isConnected(){return this._$parent._$isConnected}_$initialize(e,t,i){this.__part=e,this._$parent=t,this.__attributeIndex=i}_$resolve(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}var gg="important",_g=" !"+gg,e5=0-_g.length;class yg extends ah{constructor(e){super(e);if(e.type!==fg.ATTRIBUTE||e.name!=="style"||e.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce((t,i)=>{let r=e[i];if(r==null)return t;return i=i.includes("-")?i:i.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase(),t+`${i}:${r};`},"")}update(e,[t]){let{style:i}=e.element;if(this._previousStyleProperties===void 0)return this._previousStyleProperties=new Set(Object.keys(t)),this.render(t);for(let r of this._previousStyleProperties)if(t[r]==null)if(this._previousStyleProperties.delete(r),r.includes("-"))i.removeProperty(r);else i[r]=null;for(let r in t){let a=t[r];if(a!=null){this._previousStyleProperties.add(r);let o=typeof a==="string"&&a.endsWith(_g);if(r.includes("-")||o)i.setProperty(r,o?a.slice(0,e5):a,o?gg:"");else i[r]=a}}return Dr}}var vg=mg(yg);class bg extends Error{status;statusText;payload;constructor(e){super(e.message);this.name="WodiraBrowserApiError",this.status=e.status,this.statusText=e.statusText,this.payload=e.payload}}var t5="https://api.wodira.app",i5="/external/v1/browser";class wg{publishableKey;baseUrl;fetcher;headers;checkoutSecrets=new Map;constructor(e){if(!e.publishableKey?.trim())throw Error("WodiraBrowserClient requires a publishableKey.");if(!e.publishableKey.startsWith("wpk_live_"))throw Error("Wodira browser publishable keys must start with wpk_live_.");this.publishableKey=e.publishableKey.trim(),this.baseUrl=(e.baseUrl??t5).replace(/\/+$/,""),this.fetcher=e.fetch??globalThis.fetch.bind(globalThis),this.headers=e.headers}searchEvents(e={},t){return this.request("/events/search",{method:"POST",body:e,signal:t})}getEvent(e,t){return this.request(`/events/${encodeURIComponent(e)}`,{signal:t})}getShirtSponsorCampaign(e,t){return this.request(`/shirt-sponsors/${encodeURIComponent(e)}`,{signal:t})}getEventRoutes(e,t){return this.request(`/events/${encodeURIComponent(e)}/routes`,{signal:t})}eventRouteGpxUrl(e,t){return`${this.baseUrl}/events/${encodeURIComponent(e)}/routes/${encodeURIComponent(t)}/gpx`}getEventShirtSponsorCampaign(e,t){return this.request(`/events/${encodeURIComponent(e)}/shirt-sponsor`,{signal:t,credentials:"omit",cache:"no-store"})}requestShirtGuestCode(e,t,i){return this.shirtGuestPost(e,"code",t,i)}verifyShirtGuestCode(e,t,i){return this.shirtGuestPost(e,"verify",t,i)}createShirtGuestCheckout(e,t,i){return this.shirtGuestPost(e,"checkout",t,i)}getShirtGuestCheckoutStatus(e,t,i){return this.shirtGuestPost(e,"status",t,i)}shirtGuestPost(e,t,i,r){return this.request(`/events/${encodeURIComponent(e)}/shirt-sponsor/guest/${t}`,{method:"POST",body:i,signal:r,credentials:"omit",cache:"no-store"})}getPricingCards(e,t){return this.request(`/events/${encodeURIComponent(e)}/pricing-cards`,{signal:t})}getRegistrationSummary(e,t){return this.request("/checkout/registration/summary",{method:"POST",body:e,signal:t})}createRegistrationCheckoutSession(e,t){let i=e.checkoutResumeSecret;if(!i&&e.idempotencyKey){if(i=this.checkoutSecrets.get(e.idempotencyKey),!i){if(i=globalThis.crypto.randomUUID(),this.checkoutSecrets.size>=128)this.checkoutSecrets.delete(this.checkoutSecrets.keys().next().value);this.checkoutSecrets.set(e.idempotencyKey,i)}}return this.request("/checkout/registration/session",{method:"POST",body:o5({...e,...i?{checkoutResumeSecret:i}:{}}),signal:t})}lookupRegistrationReceipts(e,t,i){return this.request(`/events/${encodeURIComponent(e)}/registration-receipts/lookup`,{method:"POST",body:t,signal:i})}sendRegistrationReceipts(e,t,i){return this.request(`/events/${encodeURIComponent(e)}/registration-receipts/send`,{method:"POST",body:t,signal:i})}async request(e,t={}){let i=new Headers(this.headers);i.set("accept","application/json"),i.set("x-publishable-key",this.publishableKey);let r={method:t.method??"GET",headers:i};if(t.credentials)r.credentials=t.credentials;if(t.cache)r.cache=t.cache;if(t.signal)r.signal=t.signal;if(t.body!==void 0)i.set("content-type","application/json"),r.body=JSON.stringify(t.body);let a=await this.fetcher(`${this.baseUrl}${i5}${e}`,r);if(!a.ok){let n=await r5(a);throw new bg({status:a.status,statusText:a.statusText,message:a5(n,a),payload:n})}let o=await a.text();return o?JSON.parse(o):void 0}}function Tg(e){return new wg(e)}async function r5(e){let t=await e.text();if(!t)return null;try{return JSON.parse(t)}catch{return t}}function a5(e,t){if(typeof e==="string")return e;let i=e?.message,r=i!==null&&typeof i==="object"&&"message"in i?i.message:i;if(typeof r==="string")return r;if(Array.isArray(r))return r.filter((a)=>typeof a==="string").join(", ");if(typeof e?.error==="string")return e.error;return`WODira browser API request failed with ${t.status} ${t.statusText}`}function o5(e){return{...e,athletes:e.athletes.map(xg),...e.guestRegistrations?{guestRegistrations:e.guestRegistrations.map((t)=>({...t,athletes:t.athletes.map(xg)}))}:{}}}function xg(e){return{...e,birthDate:e.birthDate instanceof Date?e.birthDate.toISOString().slice(0,10):e.birthDate}}function oh(e){if(e===null||e===void 0||e.trim()==="")return null;let t=Number(e);return Number.isFinite(t)?t:null}function ln(e,t){return Array.from(e.getElementsByTagName("*")).filter((i)=>i.localName===t)}function eo(e,t){for(let i of Array.from(e.childNodes))if(i.localName===t)return i.textContent?.trim()||null;return null}function Eg(e){let t=oh(e.getAttribute("lat")),i=oh(e.getAttribute("lon"));if(t===null||i===null||Math.abs(t)>90||Math.abs(i)>180)return null;let r=oh(eo(e,"ele"));return r===null?{lat:t,lon:i}:{lat:t,lon:i,ele:r}}function n5(e){let t=e.normalize("NFD").replace(/\p{Diacritic}/gu,"").toLowerCase();if(/\b(start|salida|saida|partida|inicio)\b/.test(t))return"START";if(/\b(finish|meta|chegada|llegada|fin)\b/.test(t))return"FINISH";if(/(medic|first aid|botiquin|cruz roja|ambul)/.test(t))return"MEDICAL";if(/(food|comida|comer|alimento|restaurant)/.test(t))return"FOOD";if(/(aid|avituall|abastec|refresh|cp\d|checkpoint|control)/.test(t))return"AID";if(/(water|agua|agua|fuente|font|drink)/.test(t))return"WATER";if(/^(km|kilometr)/.test(t))return"KM";return"OTHER"}function Sg(e){let t=new DOMParser().parseFromString(e,"application/xml"),i=t.documentElement;if(!i||i.localName!=="gpx"||ln(t,"parsererror").length)throw Error("Not a GPX document");let r=(u)=>{let c=[];for(let h of ln(t,u)){let d=Eg(h);if(d)c.push(d);if(c.length>=50000)break}return c},a=r("trkpt");if(a.length<2)a=r("rtept");let o=[];for(let u of ln(t,"wpt")){let c=Eg(u);if(!c)continue;let h=eo(u,"name"),d=[eo(u,"type"),eo(u,"sym"),h].filter(Boolean).join(" ");o.push({...c,type:n5(d),...h?{name:h}:{}})}let n=ln(t,"trk")[0],s=ln(t,"metadata")[0];return{name:n&&eo(n,"name")||s&&eo(s,"name")||null,points:a,waypoints:o}}var uz={es:{label:"Mapa 3D del recorrido",loading:"Cargando el recorrido…",error:"No se ha podido cargar el recorrido.",invalid:"Indica un archivo GPX o un evento y una clave publicable.",empty:"Este evento todavía no tiene recorrido publicado.",retry:"Reintentar",noMap:"El mapa 3D no está disponible en este dispositivo.",distance:"Distancia",ascent:"Desnivel +",descent:"Desnivel −",highest:"Altitud máx.",routes:"Recorridos",download:"Descargar GPX",zoomIn:"Acercar",zoomOut:"Alejar",north:"Orientar al norte",view3d:"Vista 3D",view2d:"Vista 2D",fullscreen:"Pantalla completa",exitFullscreen:"Salir de pantalla completa",frame:"Ver todo el recorrido",fly:"Vuela el recorrido",stop:"Detener",profile:"Perfil de altitud. Usa las flechas para recorrerlo.",startFinish:"Salida / Meta",start:"Salida",finish:"Meta",km:"km",slope:"pendiente",cooperativeDesktop:"Usa Ctrl + rueda para hacer zoom",cooperativeMac:"Usa ⌘ + rueda para hacer zoom",cooperativeMobile:"Usa dos dedos para mover el mapa",waypoints:{START:"Salida",FINISH:"Meta",AID:"Avituallamiento",FOOD:"Comida",WATER:"Agua",MEDICAL:"Asistencia médica",KM:"Kilómetro",OTHER:"Punto de interés"}},en:{label:"3D course map",loading:"Loading the course…",error:"The course could not be loaded.",invalid:"Set a GPX file, or an event and a publishable key.",empty:"This event has no published course yet.",retry:"Retry",noMap:"The 3D map is not available on this device.",distance:"Distance",ascent:"Elevation gain",descent:"Elevation loss",highest:"Highest point",routes:"Courses",download:"Download GPX",zoomIn:"Zoom in",zoomOut:"Zoom out",north:"Face north",view3d:"3D view",view2d:"2D view",fullscreen:"Full screen",exitFullscreen:"Exit full screen",frame:"Show the whole course",fly:"Fly the course",stop:"Stop",profile:"Elevation profile. Use the arrow keys to move along it.",startFinish:"Start / Finish",start:"Start",finish:"Finish",km:"km",slope:"grade",cooperativeDesktop:"Use Ctrl + scroll to zoom the map",cooperativeMac:"Use ⌘ + scroll to zoom the map",cooperativeMobile:"Use two fingers to move the map",waypoints:{START:"Start",FINISH:"Finish",AID:"Aid station",FOOD:"Food",WATER:"Water",MEDICAL:"Medical point",KM:"Kilometre",OTHER:"Point of interest"}},pt:{label:"Mapa 3D do percurso",loading:"A carregar o percurso…",error:"Não foi possível carregar o percurso.",invalid:"Indica um ficheiro GPX ou um evento e uma chave publicável.",empty:"Este evento ainda não tem percurso publicado.",retry:"Tentar novamente",noMap:"O mapa 3D não está disponível neste dispositivo.",distance:"Distância",ascent:"Desnível +",descent:"Desnível −",highest:"Altitude máx.",routes:"Percursos",download:"Descarregar GPX",zoomIn:"Aproximar",zoomOut:"Afastar",north:"Orientar a norte",view3d:"Vista 3D",view2d:"Vista 2D",fullscreen:"Ecrã inteiro",exitFullscreen:"Sair do ecrã inteiro",frame:"Ver o percurso inteiro",fly:"Voa o percurso",stop:"Parar",profile:"Perfil de altitude. Usa as setas para o percorrer.",startFinish:"Partida / Meta",start:"Partida",finish:"Meta",km:"km",slope:"inclinação",cooperativeDesktop:"Usa Ctrl + roda para fazer zoom",cooperativeMac:"Usa ⌘ + roda para fazer zoom",cooperativeMobile:"Usa dois dedos para mover o mapa",waypoints:{START:"Partida",FINISH:"Meta",AID:"Abastecimento",FOOD:"Comida",WATER:"Água",MEDICAL:"Posto médico",KM:"Quilómetro",OTHER:"Ponto de interesse"}}},mw="#ff7a1a",gc=1000,Er=140;function gw(e){try{let t=new URL(e,document.baseURI),i=["localhost","127.0.0.1","[::1]"].includes(t.hostname);if(t.username||t.password)return null;return t.protocol==="https:"||i&&t.protocol==="http:"?t:null}catch{return null}}function cz(e,t){return{id:e.id,name:e.name,points:e.points,waypoints:e.waypoints,color:e.color,gpxUrl:t,distanceM:e.distanceM,ascentM:e.ascentM,descentM:e.descentM}}class pm extends Gr{static properties={eventId:{type:String,attribute:"event-id"},publishableKey:{type:String,attribute:"publishable-key"},baseUrl:{type:String,attribute:"base-url"},routeId:{type:String,attribute:"route-id"},gpxUrl:{type:String,attribute:"gpx-url"},label:{type:String},locale:{type:String},workerUrl:{type:String,attribute:"worker-url"},freeGestures:{type:Boolean,attribute:"free-gestures"},gpx:{attribute:!1},tracks:{attribute:!1},loaded:{state:!0},loading:{state:!0},failed:{state:!0},activeIndex:{state:!0},hoverDistance:{state:!0},flightDistance:{state:!0},flying:{state:!0},threeD:{state:!0},fullscreen:{state:!0},mapFailed:{state:!0},mapLoading:{state:!0},bearing:{state:!0}};static styles=Um`
864
+ :host {
865
+ --_route: var(--wodira-route-color, #ff7a1a);
866
+ --_profile-height: clamp(7rem, 22cqi, 9.5rem);
867
+ --_panel: var(--wodira-route-panel-background, rgb(8 12 20 / 0.72));
868
+ --_panel-text: var(--wodira-route-panel-text, #f4f6fa);
869
+ --_panel-muted: var(--wodira-route-panel-muted, #aab4c3);
870
+ --_panel-border: var(--wodira-route-panel-border, rgb(255 255 255 / 0.12));
871
+ --_radius: var(--wodira-radius, 1rem);
872
+ --_radius-sm: var(--wodira-radius-sm, 0.625rem);
873
+ box-sizing: border-box;
874
+ color: var(--_panel-text);
875
+ container-type: inline-size;
876
+ display: block;
877
+ font-family: var(--wodira-font-family, inherit);
878
+ font-size: var(--wodira-font-size, 1rem);
879
+ line-height: 1.4;
880
+ }
881
+
882
+ *,
883
+ *::before,
884
+ *::after {
885
+ box-sizing: inherit;
886
+ }
887
+
888
+ [part~='container'] {
889
+ background: radial-gradient(120% 90% at 30% 20%, #1c3247 0%, #0b1724 60%, #060c14 100%);
890
+ border-radius: var(--_radius);
891
+ box-shadow: var(--wodira-shadow, 0 24px 60px rgb(5 10 20 / 0.35));
892
+ height: var(--wodira-route-height, clamp(28rem, 72vh, 46rem));
893
+ isolation: isolate;
894
+ overflow: hidden;
895
+ position: relative;
896
+ width: 100%;
897
+ }
898
+
899
+ [part~='container'].is-fullscreen {
900
+ border-radius: 0;
901
+ height: 100%;
902
+ }
903
+
904
+ [part~='container'].is-pseudo-fullscreen {
905
+ border-radius: 0;
906
+ height: 100dvh;
907
+ inset: 0;
908
+ position: fixed;
909
+ width: 100vw;
910
+ z-index: 2147483000;
911
+ }
912
+
913
+ [part~='map'] {
914
+ inset: 0;
915
+ position: absolute;
916
+ }
917
+
918
+ .glass {
919
+ backdrop-filter: blur(14px) saturate(140%);
920
+ -webkit-backdrop-filter: blur(14px) saturate(140%);
921
+ background: var(--_panel);
922
+ border: 1px solid var(--_panel-border);
923
+ color: var(--_panel-text);
924
+ }
925
+
926
+ [part~='header'] {
927
+ border-radius: var(--_radius);
928
+ display: grid;
929
+ gap: 0.5rem;
930
+ left: 0.75rem;
931
+ max-width: min(30rem, calc(100% - 5.5rem));
932
+ padding: 0.85rem 1rem;
933
+ position: absolute;
934
+ top: 0.75rem;
935
+ z-index: 2;
936
+ }
937
+
938
+ [part~='title'] {
939
+ font-size: clamp(1.15rem, 3.4cqi, 1.75rem);
940
+ font-weight: 800;
941
+ letter-spacing: -0.01em;
942
+ line-height: 1.05;
943
+ margin: 0;
944
+ text-transform: var(--wodira-route-title-transform, uppercase);
945
+ }
946
+
947
+ [part~='stats'] {
948
+ display: flex;
949
+ flex-wrap: wrap;
950
+ gap: 0.25rem 1.1rem;
951
+ margin: 0;
952
+ }
953
+
954
+ [part~='stat'] {
955
+ display: grid;
956
+ margin: 0;
957
+ }
958
+
959
+ [part~='stat'] dt {
960
+ color: var(--_panel-muted);
961
+ font-size: 0.7rem;
962
+ font-weight: 600;
963
+ letter-spacing: 0.08em;
964
+ text-transform: uppercase;
965
+ }
966
+
967
+ [part~='stat'] dd {
968
+ font-size: clamp(1rem, 2.6cqi, 1.35rem);
969
+ font-variant-numeric: tabular-nums;
970
+ font-weight: 800;
971
+ margin: 0;
972
+ }
973
+
974
+ [part~='stat-primary'] dd {
975
+ color: var(--_route);
976
+ }
977
+
978
+ [part~='route-tabs'] {
979
+ display: flex;
980
+ flex-wrap: wrap;
981
+ gap: 0.35rem;
982
+ }
983
+
984
+ [part~='route-tab'],
985
+ [part~='control'],
986
+ [part~='play'],
987
+ [part~='download'] {
988
+ align-items: center;
989
+ border: 1px solid var(--_panel-border);
990
+ color: var(--_panel-text);
991
+ cursor: pointer;
992
+ display: inline-flex;
993
+ font: inherit;
994
+ justify-content: center;
995
+ text-decoration: none;
996
+ transition:
997
+ background-color 0.15s ease,
998
+ border-color 0.15s ease;
999
+ }
1000
+
1001
+ [part~='route-tab'] {
1002
+ background: rgb(255 255 255 / 0.06);
1003
+ border-radius: 999px;
1004
+ font-size: 0.8125rem;
1005
+ font-weight: 600;
1006
+ min-height: 2rem;
1007
+ padding: 0.25rem 0.8rem;
1008
+ }
1009
+
1010
+ [part~='route-tab-active'] {
1011
+ background: var(--_route);
1012
+ border-color: var(--_route);
1013
+ color: var(--wodira-route-color-contrast, #160a02);
1014
+ }
1015
+
1016
+ [part~='download'] {
1017
+ background: none;
1018
+ border: 0;
1019
+ color: var(--_panel-muted);
1020
+ font-size: 0.8125rem;
1021
+ gap: 0.35rem;
1022
+ justify-self: start;
1023
+ padding: 0;
1024
+ text-decoration: underline;
1025
+ text-underline-offset: 3px;
1026
+ }
1027
+
1028
+ [part~='controls'] {
1029
+ border-radius: var(--_radius);
1030
+ display: grid;
1031
+ gap: 0.25rem;
1032
+ padding: 0.3rem;
1033
+ position: absolute;
1034
+ right: 0.75rem;
1035
+ top: 0.75rem;
1036
+ z-index: 2;
1037
+ }
1038
+
1039
+ [part~='control'] {
1040
+ background: transparent;
1041
+ border-color: transparent;
1042
+ border-radius: var(--_radius-sm);
1043
+ font-size: 1.05rem;
1044
+ font-weight: 700;
1045
+ height: 2.5rem;
1046
+ width: 2.5rem;
1047
+ }
1048
+
1049
+ [part~='control-active'] {
1050
+ background: rgb(255 255 255 / 0.14);
1051
+ }
1052
+
1053
+ .compass {
1054
+ display: block;
1055
+ transition: transform 0.1s linear;
1056
+ }
1057
+
1058
+ [part~='play'] {
1059
+ border-radius: 999px;
1060
+ bottom: calc(var(--_profile-height, 9.5rem) + 1.25rem);
1061
+ font-size: 0.875rem;
1062
+ font-weight: 700;
1063
+ gap: 0.5rem;
1064
+ left: 0.75rem;
1065
+ min-height: 2.75rem;
1066
+ padding: 0 1.1rem 0 0.9rem;
1067
+ position: absolute;
1068
+ z-index: 2;
1069
+ }
1070
+
1071
+ [part~='play'] .dot {
1072
+ background: var(--_route);
1073
+ border-radius: 999px;
1074
+ box-shadow: 0 0 12px var(--_route);
1075
+ height: 0.65rem;
1076
+ width: 0.65rem;
1077
+ }
1078
+
1079
+ @media (hover: hover) {
1080
+ [part~='route-tab']:not([part~='route-tab-active']):hover,
1081
+ [part~='control']:hover,
1082
+ [part~='play']:hover {
1083
+ background: rgb(255 255 255 / 0.14);
1084
+ }
1085
+ }
1086
+
1087
+ [part~='route-tab']:focus-visible,
1088
+ [part~='control']:focus-visible,
1089
+ [part~='play']:focus-visible,
1090
+ [part~='download']:focus-visible,
1091
+ [part~='profile']:focus-visible {
1092
+ outline: 3px solid var(--_route);
1093
+ outline-offset: 2px;
1094
+ }
1095
+
1096
+ [part~='profile'] {
1097
+ border-radius: var(--_radius);
1098
+ bottom: 0.75rem;
1099
+ height: var(--_profile-height);
1100
+ left: 0.75rem;
1101
+ margin: 0;
1102
+ padding: 0.6rem 0.9rem 1.5rem 2.6rem;
1103
+ position: absolute;
1104
+ right: 0.75rem;
1105
+ touch-action: pan-y;
1106
+ z-index: 2;
1107
+ }
1108
+
1109
+ [part~='profile'] svg {
1110
+ display: block;
1111
+ height: 100%;
1112
+ overflow: visible;
1113
+ width: 100%;
1114
+ }
1115
+
1116
+ .axis {
1117
+ white-space: nowrap;
1118
+ color: var(--_panel-muted);
1119
+ font-size: 0.7rem;
1120
+ font-variant-numeric: tabular-nums;
1121
+ pointer-events: none;
1122
+ position: absolute;
1123
+ }
1124
+
1125
+ .axis-y {
1126
+ left: 0.5rem;
1127
+ transform: translateY(-50%);
1128
+ }
1129
+
1130
+ .axis-x {
1131
+ bottom: 0.3rem;
1132
+ transform: translateX(-50%);
1133
+ }
1134
+
1135
+ .axis-x.first {
1136
+ transform: none;
1137
+ }
1138
+
1139
+ .axis-x.last {
1140
+ color: var(--_route);
1141
+ font-weight: 700;
1142
+ transform: translateX(-100%);
1143
+ }
1144
+
1145
+ .axis-x.first {
1146
+ color: var(--_route);
1147
+ font-weight: 700;
1148
+ }
1149
+
1150
+ [part~='profile-tooltip'] {
1151
+ background: #fff;
1152
+ border-radius: 0.5rem;
1153
+ box-shadow: 0 6px 18px rgb(0 0 0 / 0.35);
1154
+ color: #10131a;
1155
+ font-size: 0.75rem;
1156
+ font-variant-numeric: tabular-nums;
1157
+ font-weight: 700;
1158
+ padding: 0.3rem 0.55rem;
1159
+ pointer-events: none;
1160
+ position: absolute;
1161
+ top: -0.6rem;
1162
+ transform: translate(-50%, -100%);
1163
+ white-space: nowrap;
1164
+ }
1165
+
1166
+ [part~='status'] {
1167
+ align-items: center;
1168
+ color: var(--_panel-muted);
1169
+ display: grid;
1170
+ gap: 0.75rem;
1171
+ inset: 0;
1172
+ justify-items: center;
1173
+ margin: 0;
1174
+ padding: 2rem;
1175
+ position: absolute;
1176
+ text-align: center;
1177
+ z-index: 1;
1178
+ }
1179
+
1180
+ [part~='status'] button {
1181
+ background: var(--_route);
1182
+ border: 0;
1183
+ border-radius: var(--_radius-sm);
1184
+ color: #160a02;
1185
+ cursor: pointer;
1186
+ font: inherit;
1187
+ font-weight: 700;
1188
+ min-height: 2.75rem;
1189
+ padding: 0 1rem;
1190
+ }
1191
+
1192
+ .spinner {
1193
+ animation: spin 0.9s linear infinite;
1194
+ border: 3px solid rgb(255 255 255 / 0.15);
1195
+ border-radius: 999px;
1196
+ border-top-color: var(--_route);
1197
+ height: 2rem;
1198
+ width: 2rem;
1199
+ }
1200
+
1201
+ @keyframes spin {
1202
+ to {
1203
+ transform: rotate(1turn);
1204
+ }
1205
+ }
1206
+
1207
+ /* Markers live inside the MapLibre container, which is in this shadow root. */
1208
+ .wr-pin {
1209
+ align-items: center;
1210
+ display: flex;
1211
+ flex-direction: column;
1212
+ pointer-events: none;
1213
+ }
1214
+
1215
+ .wr-pin__label {
1216
+ background: var(--wodira-route-start-color, #2f7d32);
1217
+ border: 1px solid rgb(255 255 255 / 0.5);
1218
+ border-radius: 0.3rem;
1219
+ box-shadow: 0 4px 14px rgb(0 0 0 / 0.4);
1220
+ color: #fff;
1221
+ font-size: 0.75rem;
1222
+ font-weight: 800;
1223
+ letter-spacing: 0.04em;
1224
+ order: -1;
1225
+ padding: 0.2rem 0.5rem;
1226
+ text-transform: uppercase;
1227
+ white-space: nowrap;
1228
+ }
1229
+
1230
+ .wr-pin--finish .wr-pin__label {
1231
+ background: var(--wodira-route-finish-color, #b3261e);
1232
+ }
1233
+
1234
+ .wr-pin__dot {
1235
+ background: #fff;
1236
+ border: 4px solid var(--_route);
1237
+ border-radius: 999px;
1238
+ box-shadow:
1239
+ 0 0 0 4px rgb(255 255 255 / 0.25),
1240
+ 0 0 18px var(--_route);
1241
+ height: 1.1rem;
1242
+ margin-top: 0.3rem;
1243
+ width: 1.1rem;
1244
+ }
1245
+
1246
+ .wr-poi {
1247
+ align-items: center;
1248
+ background: rgb(8 12 20 / 0.82);
1249
+ border: 2px solid #fff;
1250
+ border-radius: 999px;
1251
+ box-shadow: 0 4px 12px rgb(0 0 0 / 0.4);
1252
+ cursor: pointer;
1253
+ display: flex;
1254
+ font-size: 0.85rem;
1255
+ height: 1.9rem;
1256
+ justify-content: center;
1257
+ width: 1.9rem;
1258
+ }
1259
+
1260
+ .wr-km-anchor {
1261
+ pointer-events: none;
1262
+ }
1263
+
1264
+ .wr-km {
1265
+ background: rgb(8 12 20 / 0.78);
1266
+ border: 1px solid var(--_route);
1267
+ border-radius: 999px;
1268
+ color: #fff;
1269
+ display: block;
1270
+ font-size: 0.68rem;
1271
+ font-weight: 800;
1272
+ padding: 0.05rem 0.4rem;
1273
+ transition: opacity 0.2s ease;
1274
+ translate: 0 var(--km-offset, 0);
1275
+ white-space: nowrap;
1276
+ }
1277
+
1278
+ /* MapLibre writes an inline opacity for terrain occlusion, so hide with visibility. */
1279
+ .wr-km--hidden {
1280
+ visibility: hidden;
1281
+ }
1282
+
1283
+ .wr-popup .maplibregl-popup-content {
1284
+ background: rgb(8 12 20 / 0.9);
1285
+ border-radius: 0.5rem;
1286
+ color: #fff;
1287
+ font: 600 0.8rem var(--wodira-font-family, inherit);
1288
+ padding: 0.4rem 0.6rem;
1289
+ }
1290
+
1291
+ /* Keep MapLibre's attribution readable, dark and clear of the elevation profile. */
1292
+ .maplibregl-ctrl-bottom-right {
1293
+ bottom: calc(var(--_profile-height) + 1rem);
1294
+ right: 0.5rem;
1295
+ }
1296
+
1297
+ .maplibregl-ctrl.maplibregl-ctrl-attrib {
1298
+ background: rgb(8 12 20 / 0.6);
1299
+ border-radius: 999px;
1300
+ color: var(--_panel-muted);
1301
+ font-size: 0.65rem;
1302
+ margin: 0;
1303
+ }
1304
+
1305
+ .maplibregl-ctrl-attrib a {
1306
+ color: inherit;
1307
+ }
1308
+
1309
+ .maplibregl-ctrl-attrib.maplibregl-compact-show {
1310
+ border-radius: 0.5rem;
1311
+ }
1312
+
1313
+ .maplibregl-ctrl-attrib-button {
1314
+ background-color: rgb(255 255 255 / 0.85);
1315
+ }
1316
+
1317
+ .wr-pin-marker {
1318
+ z-index: 3;
1319
+ }
1320
+
1321
+ @container (max-width: 40rem) {
1322
+ [part~='header'] {
1323
+ max-width: calc(100% - 4.75rem);
1324
+ padding: 0.65rem 0.75rem;
1325
+ }
1326
+
1327
+ [part~='stat-secondary'] {
1328
+ display: none;
1329
+ }
1330
+
1331
+ [part~='control'] {
1332
+ height: 2.25rem;
1333
+ width: 2.25rem;
1334
+ }
1335
+
1336
+ [part~='profile'] {
1337
+ padding-left: 2.3rem;
1338
+ }
1339
+ }
1340
+
1341
+ @media (prefers-reduced-motion: reduce) {
1342
+ .spinner {
1343
+ animation-duration: 2.5s;
1344
+ }
1345
+
1346
+ .compass,
1347
+ .wr-km,
1348
+ [part~='route-tab'],
1349
+ [part~='control'],
1350
+ [part~='play'] {
1351
+ transition: none;
1352
+ }
1353
+ }
1354
+ `;view=null;viewContainer=null;viewGeneration=0;abort=null;profileCache=null;themeObserver=null;drawnTrack=null;constructor(){super();this.eventId="",this.publishableKey="",this.baseUrl="",this.routeId="",this.gpxUrl="",this.label="",this.locale="auto",this.workerUrl="",this.freeGestures=!1,this.gpx=null,this.tracks=null,this.loaded=[],this.loading=!1,this.failed=null,this.activeIndex=0,this.hoverDistance=null,this.flightDistance=null,this.flying=!1,this.threeD=!0,this.fullscreen=!1,this.mapFailed=!1,this.mapLoading=!0,this.bearing=0}refreshTheme(){this.view?.setColors(this.colors())}connectedCallback(){if(super.connectedCallback(),this.requestUpdate(),this.loading&&this.abort?.signal.aborted)this.load();document.addEventListener("fullscreenchange",this.onFullscreenChange),document.addEventListener("keydown",this.onDocumentKey),this.themeObserver=new MutationObserver(()=>this.refreshTheme());for(let e of[this,this.ownerDocument.documentElement,this.ownerDocument.body])if(e)this.themeObserver.observe(e,{attributes:!0,attributeFilter:["class","style","data-theme"]})}disconnectedCallback(){document.removeEventListener("fullscreenchange",this.onFullscreenChange),document.removeEventListener("keydown",this.onDocumentKey),this.themeObserver?.disconnect(),this.abort?.abort(),this.disposeView(),this.setPseudoFullscreen(!1),super.disconnectedCallback()}willUpdate(e){if(e.has("eventId")||e.has("publishableKey")||e.has("baseUrl")||e.has("gpxUrl")||e.has("gpx")||e.has("tracks"))this.load();if(e.has("routeId")&&this.routeId){let t=this.loaded.findIndex((i)=>i.id===this.routeId);if(t>=0)this.activeIndex=t}}updated(){if(!this.isConnected)return;let e=this.renderRoot.querySelector('[part~="map"]');if(e!==this.viewContainer){if(this.disposeView(),e&&!this.mapFailed)this.startView(e)}let t=this.activeTrack;if(this.view&&t&&t!==this.drawnTrack)this.drawTrack(t);this.view?.setCursor(this.flightDistance??this.hoverDistance)}get language(){let t=(this.locale&&this.locale!=="auto"?this.locale:this.ownerDocument.documentElement.lang||navigator.language||"es").toLowerCase().split("-")[0];return t==="en"||t==="pt"?t:"es"}get numberLocale(){return this.locale&&this.locale!=="auto"?this.locale:this.ownerDocument.documentElement.lang||navigator.language||"es-ES"}get text(){return uz[this.language]}async load(){this.abort?.abort();let e=new AbortController;this.abort=e,this.failed=null,this.loading=!0;try{let t=await this.fetchTracks(e.signal);if(e.signal.aborted)return;if(t===null){this.loaded=[],this.failed="invalid";return}let i=t.filter((a)=>a.points.length>=2);this.loaded=i;let r=i.findIndex((a)=>a.id===this.routeId);if(this.activeIndex=r>=0?r:0,!i.length)this.failed="empty"}catch{if(!e.signal.aborted)this.loaded=[],this.failed="error"}finally{if(!e.signal.aborted)this.loading=!1}}async fetchTracks(e){if(this.tracks?.length)return this.tracks;if(this.gpx)return[this.trackFromGpx(this.gpx,"gpx",null)];if(this.gpxUrl){let t=gw(this.gpxUrl);if(!t)return null;let i=await fetch(t,{signal:e});if(!i.ok)throw Error(`GPX request failed (${i.status})`);return[this.trackFromGpx(await i.text(),t.pathname,t.href)]}if(this.eventId&&this.publishableKey?.startsWith("wpk_live_")){let t={publishableKey:this.publishableKey};if(this.baseUrl){if(!gw(this.baseUrl))return null;t.baseUrl=this.baseUrl}let i=Tg(t);return(await i.getEventRoutes(this.eventId,e)).map((a)=>cz(a,i.eventRouteGpxUrl(this.eventId,a.id)))}return null}trackFromGpx(e,t,i){let r=Sg(e),a=t.split("/").pop()?.replace(/\.gpx$/i,"")??"";return{id:t,name:r.name||decodeURIComponent(a)||this.text.label,points:r.points,waypoints:r.waypoints,gpxUrl:i}}get activeTrack(){return this.loaded[this.activeIndex]??this.loaded[0]??null}get profile(){let e=this.activeTrack;if(!e)return null;if(this.profileCache?.track!==e){let t=Dg(e.points);this.profileCache={track:e,profile:t,waypointMarks:t.hasElevation?e.waypoints.filter((i)=>!["START","FINISH","KM"].includes(i.type)).map((i)=>Us(e.points,t,i)):[]}}return this.profileCache.profile}selectTrack(e){if(e===this.activeIndex)return;this.view?.stopFlight(),this.activeIndex=e,this.hoverDistance=null;let t=this.activeTrack;if(t)this.dispatchEvent(new CustomEvent("wodira:route:selected",{bubbles:!0,composed:!0,detail:{routeId:t.id}}))}colors(){let e=getComputedStyle(this),t=(r)=>e.getPropertyValue(r).trim(),i=t("--wodira-route-color")||this.activeTrack?.color||mw;return{route:i,glow:t("--wodira-route-glow")||i,highlight:t("--wodira-route-highlight")||"#fff1df"}}labels(){let e=this.text;return{startFinish:e.startFinish,start:e.start,finish:e.finish,km:e.km,waypoints:{...e.waypoints},cooperativeDesktop:e.cooperativeDesktop,cooperativeMac:e.cooperativeMac,cooperativeMobile:e.cooperativeMobile}}async startView(e){let t=++this.viewGeneration;this.viewContainer=e,this.mapLoading=!0;try{await Promise.resolve().then(() => fw());if(t!==this.viewGeneration)return;let r={container:e,colors:this.colors(),labels:this.labels(),cooperative:!this.freeGestures&&!this.fullscreen,threeD:this.threeD,onHover:(o)=>{if(!this.flying)this.hoverDistance=o},onFlight:(o)=>{this.flightDistance=o,this.flying=o!==null},onBearing:(o)=>{this.bearing=o},onFail:()=>{if(t===this.viewGeneration)this.disposeView(),this.mapFailed=!0}};if(this.workerUrl)r.workerUrl=this.workerUrl;this.view=new dm(r);let a=this.activeTrack;if(a)this.drawTrack(a)}catch{if(t===this.viewGeneration)this.disposeView(),this.mapFailed=!0}}drawTrack(e){let t=this.profile,i=this.view;if(!i||!t)return;this.drawnTrack=e,i.setColors(this.colors()),i.setTrack(e,t,!0).then(()=>{if(!this.isConnected||this.view!==i||this.activeTrack!==e)return;this.mapLoading=!1,this.dispatchEvent(new CustomEvent("wodira:route:ready",{bubbles:!0,composed:!0,detail:{routeId:e.id,distanceM:e.distanceM??t.distanceM,ascentM:e.ascentM??t.ascentM}}))})}disposeView(){this.viewGeneration++,this.view?.dispose(),this.view=null,this.viewContainer=null,this.drawnTrack=null,this.flying=!1,this.flightDistance=null}toggle3d(){this.threeD=!this.threeD,this.view?.set3d(this.threeD)}toggleFlight(){if(!this.view)return;if(this.view.flying)this.view.stopFlight();else this.view.fly(this.hoverDistance??0)}async toggleFullscreen(){let e=this.renderRoot.querySelector('[part~="container"]');if(!e)return;if(this.fullscreen){if(document.fullscreenElement)await document.exitFullscreen().catch(()=>{});else this.setPseudoFullscreen(!1);return}if(e.requestFullscreen&&document.fullscreenEnabled)await e.requestFullscreen().catch(()=>this.setPseudoFullscreen(!0));else this.setPseudoFullscreen(!0)}pseudoFullscreen=!1;setPseudoFullscreen(e){if(this.pseudoFullscreen===e)return;this.pseudoFullscreen=e,this.ownerDocument.documentElement.style.overflow=e?"hidden":"",this.fullscreen=e,this.view?.setCooperative(!e&&!this.freeGestures),requestAnimationFrame(()=>this.view?.resize())}onFullscreenChange=()=>{let e=this.renderRoot.querySelector('[part~="container"]'),t=!!e&&document.fullscreenElement===this,i=!!e&&this.shadowRoot?.fullscreenElement===e;this.fullscreen=t||i,this.view?.setCooperative(!this.fullscreen&&!this.freeGestures),requestAnimationFrame(()=>this.view?.resize())};onDocumentKey=(e)=>{if(e.key==="Escape"&&this.pseudoFullscreen)this.setPseudoFullscreen(!1)};profileDistanceAt(e){let t=this.profile,i=this.renderRoot.querySelector('[part~="profile"] svg');if(!t||!i)return null;let r=i.getBoundingClientRect();return Math.max(0,Math.min(1,(e.clientX-r.left)/r.width))*t.distanceM}onProfilePointer(e){if(this.flying)return;let t=this.profileDistanceAt(e);if(t!==null)this.hoverDistance=t}onProfileLeave(e){if(e.pointerType==="mouse")this.hoverDistance=null}onProfileKey(e){let t=this.profile;if(!t)return;let i=t.distanceM/100,r=this.hoverDistance??0,o={ArrowRight:r+i,ArrowLeft:r-i,PageUp:r+i*10,PageDown:r-i*10,Home:0,End:t.distanceM}[e.key];if(o===void 0)return;e.preventDefault(),this.hoverDistance=Math.max(0,Math.min(t.distanceM,o))}formatKm(e,t=1){let i=e/1000;return new Intl.NumberFormat(this.numberLocale,{maximumFractionDigits:i>=100?0:t}).format(i)}formatMetres(e){return new Intl.NumberFormat(this.numberLocale,{maximumFractionDigits:0}).format(e)}render(){let e=this.text,t=[this.fullscreen&&!this.pseudoFullscreen?"is-fullscreen":"",this.pseudoFullscreen?"is-pseudo-fullscreen":""].join(" ");return Ke`<section
1355
+ part="container"
1356
+ class=${t}
1357
+ aria-label=${e.label}
1358
+ style=${vg({"--_route":`var(--wodira-route-color, ${this.activeTrack?.color||mw})`})}
1359
+ >
1360
+ ${this.renderBody()}
1361
+ </section>`}renderBody(){let e=this.text;if(this.loading&&!this.loaded.length)return Ke`<div part="status loader" role="status">
1362
+ <span class="spinner" aria-hidden="true"></span>${e.loading}
1363
+ </div>`;if(this.failed)return Ke`<div part="status error" role=${this.failed==="empty"?"status":"alert"}>
1364
+ <span>${e[this.failed]}</span>
1365
+ ${this.failed==="error"?Ke`<button type="button" @click=${()=>this.load()}>${e.retry}</button>`:Ie}
1366
+ </div>`;let t=this.activeTrack,i=this.profile;if(!t||!i)return Ie;return Ke`
1367
+ ${this.mapFailed?Ke`<p part="status">${e.noMap}</p>`:Ke`<div part="map"></div>`}
1368
+ ${this.mapLoading&&!this.mapFailed?Ke`<div part="status loader" role="status" style="pointer-events:none">
1369
+ <span class="spinner" aria-hidden="true"></span>
1370
+ </div>`:Ie}
1371
+ ${this.renderHeader(t,i)} ${this.renderControls()}
1372
+ ${this.mapFailed?Ie:Ke`<button
1373
+ part="play"
1374
+ class="glass"
1375
+ type="button"
1376
+ aria-pressed=${String(this.flying)}
1377
+ @click=${this.toggleFlight}
1378
+ >
1379
+ <span class="dot" aria-hidden="true"></span>${this.flying?e.stop:e.fly}
1380
+ </button>`}
1381
+ ${this.renderProfile(t,i)}
1382
+ `}renderHeader(e,t){let i=this.text,r=e.distanceM??t.distanceM,a=e.ascentM??t.ascentM,o=e.descentM??t.descentM;return Ke`<header part="header" class="glass">
1383
+ <h2 part="title">${this.label||e.name}</h2>
1384
+ <dl part="stats">
1385
+ <div part="stat stat-primary">
1386
+ <dt>${i.distance}</dt>
1387
+ <dd>${this.formatKm(r)} km</dd>
1388
+ </div>
1389
+ ${t.hasElevation||e.ascentM?Ke`<div part="stat stat-primary">
1390
+ <dt>${i.ascent}</dt>
1391
+ <dd>${this.formatMetres(a)} m</dd>
1392
+ </div>
1393
+ <div part="stat stat-secondary">
1394
+ <dt>${i.descent}</dt>
1395
+ <dd>${this.formatMetres(o)} m</dd>
1396
+ </div>`:Ie}
1397
+ ${t.maxEleM!==null?Ke`<div part="stat stat-secondary">
1398
+ <dt>${i.highest}</dt>
1399
+ <dd>${this.formatMetres(t.maxEleM)} m</dd>
1400
+ </div>`:Ie}
1401
+ </dl>
1402
+ ${this.loaded.length>1?Ke`<div part="route-tabs" role="group" aria-label=${i.routes}>
1403
+ ${this.loaded.map((n,s)=>Ke`<button
1404
+ part=${s===this.activeIndex?"route-tab route-tab-active":"route-tab"}
1405
+ type="button"
1406
+ aria-pressed=${String(s===this.activeIndex)}
1407
+ @click=${()=>this.selectTrack(s)}
1408
+ >
1409
+ ${n.name}
1410
+ </button>`)}
1411
+ </div>`:Ie}
1412
+ ${e.gpxUrl?Ke`<a part="download" href=${e.gpxUrl} download rel="noopener"
1413
+ >↓ ${i.download}</a
1414
+ >`:Ie}
1415
+ </header>`}renderControls(){let e=this.text;if(this.mapFailed)return Ie;let t=(i,r,a,o=!1)=>Ke`<button
1416
+ part=${o?"control control-active":"control"}
1417
+ type="button"
1418
+ aria-label=${i}
1419
+ title=${i}
1420
+ @click=${a}
1421
+ >
1422
+ ${r}
1423
+ </button>`;return Ke`<div part="controls" class="glass" role="toolbar" aria-label=${e.label}>
1424
+ ${t(e.zoomIn,"+",()=>this.view?.zoomBy(1))}
1425
+ ${t(e.zoomOut,"−",()=>this.view?.zoomBy(-1))}
1426
+ ${t(e.north,Ke`<svg
1427
+ class="compass"
1428
+ style=${`transform: rotate(${-this.bearing}deg)`}
1429
+ width="18"
1430
+ height="18"
1431
+ viewBox="0 0 24 24"
1432
+ aria-hidden="true"
1433
+ >
1434
+ <path d="M12 2 16 12H8Z" fill="currentColor" />
1435
+ <path d="M12 22 8 12h8Z" fill="currentColor" opacity="0.35" />
1436
+ </svg>`,()=>this.view?.resetNorth())}
1437
+ ${t(this.threeD?e.view2d:e.view3d,this.threeD?"2D":"3D",()=>this.toggle3d())}
1438
+ ${t(e.frame,Ke`<svg
1439
+ width="18"
1440
+ height="18"
1441
+ viewBox="0 0 24 24"
1442
+ aria-hidden="true"
1443
+ fill="none"
1444
+ stroke="currentColor"
1445
+ stroke-width="2"
1446
+ stroke-linecap="round"
1447
+ >
1448
+ <path d="M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5" />
1449
+ </svg>`,()=>this.view?.frame(1200))}
1450
+ ${t(this.fullscreen?e.exitFullscreen:e.fullscreen,Ke`<svg
1451
+ width="18"
1452
+ height="18"
1453
+ viewBox="0 0 24 24"
1454
+ aria-hidden="true"
1455
+ fill="none"
1456
+ stroke="currentColor"
1457
+ stroke-width="2"
1458
+ stroke-linecap="round"
1459
+ >
1460
+ ${this.fullscreen?Qa`<path d="M9 4v5H4M15 4v5h5M9 20v-5H4M15 20v-5h5" />`:Qa`<path d="M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5M9 9l-5-5M15 9l5-5M9 15l-5 5M15 15l5 5" />`}
1461
+ </svg>`,()=>void this.toggleFullscreen(),this.fullscreen)}
1462
+ </div>`}renderProfile(e,t){let i=this.text,r=Ag(e.points,t);if(r.length<2||t.minEleM===null||t.maxEleM===null)return Ie;let a=Math.max(50,t.maxEleM-t.minEleM),o=t.minEleM-a*0.15,n=t.maxEleM+a*0.12,s=(x)=>x/t.distanceM*gc,l=(x)=>Er-(x-o)/(n-o)*Er,u=r.map((x,b)=>`${b?"L":"M"}${s(x.distance).toFixed(1)},${l(x.ele).toFixed(1)}`).join(""),c=`${u}L${gc},${Er}L0,${Er}Z`,h=qs(t.distanceM,6),d=[];for(let x=h;x*1000<t.distanceM-h*400;x+=h)d.push(x);let p=[o+(n-o)*0.2,o+(n-o)*0.55,o+(n-o)*0.9],f=this.flightDistance??this.hoverDistance,m=f!==null?Ci(e.points,t,f):null,g=(()=>{if(f===null)return null;let x=Ci(e.points,t,f-100),b=Ci(e.points,t,f+100);if(x?.ele==null||b?.ele==null)return null;let w=Math.min(t.distanceM,f+100)-Math.max(0,f-100);return w>0?(b.ele-x.ele)/w*100:null})(),_=this.profileCache.waypointMarks,y="wr-profile-fill",v=(x)=>`${x/t.distanceM*100}%`;return Ke`<figure
1463
+ part="profile"
1464
+ class="glass"
1465
+ tabindex="0"
1466
+ role="slider"
1467
+ aria-label=${i.profile}
1468
+ aria-valuemin="0"
1469
+ aria-valuemax=${Math.round(t.distanceM)}
1470
+ aria-valuenow=${Math.round(f??0)}
1471
+ aria-valuetext=${m?`${this.formatKm(f??0,2)} km, ${m.ele===null?"":`${this.formatMetres(m.ele)} m`}`:"0 km"}
1472
+ @pointermove=${this.onProfilePointer}
1473
+ @pointerdown=${this.onProfilePointer}
1474
+ @pointerleave=${this.onProfileLeave}
1475
+ @keydown=${this.onProfileKey}
1476
+ >
1477
+ <div style="position:relative;height:100%">
1478
+ <svg
1479
+ viewBox="0 0 ${gc} ${Er}"
1480
+ preserveAspectRatio="none"
1481
+ aria-hidden="true"
1482
+ >
1483
+ <defs>
1484
+ <linearGradient id=${y} x1="0" y1="0" x2="0" y2="1">
1485
+ <stop offset="0" stop-color="var(--_route)" stop-opacity="0.75"></stop>
1486
+ <stop offset="1" stop-color="var(--_route)" stop-opacity="0.05"></stop>
1487
+ </linearGradient>
1488
+ </defs>
1489
+ ${p.map((x)=>Qa`<line x1="0" x2=${gc} y1=${l(x)} y2=${l(x)} stroke="currentColor" stroke-opacity="0.12" stroke-dasharray="4 6" vector-effect="non-scaling-stroke"></line>`)}
1490
+ <path d=${c} fill="url(#${y})"></path>
1491
+ <path
1492
+ d=${u}
1493
+ fill="none"
1494
+ stroke="var(--_route)"
1495
+ stroke-width="2.5"
1496
+ vector-effect="non-scaling-stroke"
1497
+ style="filter: drop-shadow(0 0 6px var(--_route))"
1498
+ ></path>
1499
+ ${_.map((x)=>Qa`<line x1=${s(x)} x2=${s(x)} y1=${Er-8} y2=${Er} stroke="#fff" stroke-width="2" vector-effect="non-scaling-stroke"></line>`)}
1500
+ ${m&&m.ele!==null?Qa`<line x1=${s(f)} x2=${s(f)} y1="0" y2=${Er} stroke="#fff" stroke-opacity="0.7" vector-effect="non-scaling-stroke"></line>`:Ie}
1501
+ </svg>
1502
+ ${m&&m.ele!==null?Ke`<span
1503
+ style=${`position:absolute;left:${v(f)};top:${l(m.ele)/Er*100}%;width:0.75rem;height:0.75rem;margin:-0.375rem 0 0 -0.375rem;border-radius:999px;background:#fff;border:3px solid var(--_route);pointer-events:none`}
1504
+ ></span>
1505
+ <span
1506
+ part="profile-tooltip"
1507
+ style=${`left:${v(f)};${f/t.distanceM<0.1?"transform:translate(0,-100%)":f/t.distanceM>0.9?"transform:translate(-100%,-100%)":""}`}
1508
+ >
1509
+ ${this.formatKm(f,1)} km · ${this.formatMetres(m.ele)}
1510
+ m${g===null?"":` · ${g>=0?"+":""}${Math.round(g)} %`}
1511
+ </span>`:Ie}
1512
+ </div>
1513
+ ${p.map((x)=>Ke`<span
1514
+ class="axis axis-y"
1515
+ style=${`top:calc(0.6rem + (100% - 2.1rem) * ${l(x)/Er})`}
1516
+ >${this.formatMetres(Math.round(x/10)*10)} m</span
1517
+ >`)}
1518
+ <span class="axis axis-x first" style="left:2.6rem">0 km</span>
1519
+ ${d.map((x)=>Ke`<span
1520
+ class="axis axis-x"
1521
+ style=${`left:calc(2.6rem + (100% - 3.5rem) * ${x*1000/t.distanceM})`}
1522
+ >${x}</span
1523
+ >`)}
1524
+ <span class="axis axis-x last" style="left:calc(100% - 0.9rem)"
1525
+ >${this.formatKm(t.distanceM)} km</span
1526
+ >
1527
+ </figure>`}}function _w(){if(!globalThis.customElements)throw Error("WODira route elements require a browser.");if(!customElements.get("wodira-route-3d"))customElements.define("wodira-route-3d",pm)}_w();