@graphhopper/graphhopper-maps-bundle 0.0.0-dafe37c1 → 0.0.0-db2c83c

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 (46) hide show
  1. package/README.md +7 -3
  2. package/dist/assets/android-chrome-144x144.png +0 -0
  3. package/dist/assets/android-chrome-192x192.png +0 -0
  4. package/dist/assets/android-chrome-256x256.png +0 -0
  5. package/dist/assets/android-chrome-36x36.png +0 -0
  6. package/dist/assets/android-chrome-384x384.png +0 -0
  7. package/dist/assets/android-chrome-48x48.png +0 -0
  8. package/dist/assets/android-chrome-512x512.png +0 -0
  9. package/dist/assets/android-chrome-96x96.png +0 -0
  10. package/dist/assets/apple-touch-icon-1024x1024.png +0 -0
  11. package/dist/assets/apple-touch-icon-114x114.png +0 -0
  12. package/dist/assets/apple-touch-icon-120x120.png +0 -0
  13. package/dist/assets/apple-touch-icon-144x144.png +0 -0
  14. package/dist/assets/apple-touch-icon-152x152.png +0 -0
  15. package/dist/assets/apple-touch-icon-167x167.png +0 -0
  16. package/dist/assets/apple-touch-icon-180x180.png +0 -0
  17. package/dist/assets/apple-touch-icon-57x57.png +0 -0
  18. package/dist/assets/apple-touch-icon-60x60.png +0 -0
  19. package/dist/assets/apple-touch-icon-precomposed.png +0 -0
  20. package/dist/assets/apple-touch-icon.png +0 -0
  21. package/dist/assets/favicon-16x16.png +0 -0
  22. package/dist/assets/favicon-32x32.png +0 -0
  23. package/dist/assets/favicon-48x48.png +0 -0
  24. package/dist/assets/mstile-144x144.png +0 -0
  25. package/dist/assets/mstile-150x150.png +0 -0
  26. package/dist/assets/mstile-310x150.png +0 -0
  27. package/dist/assets/mstile-310x310.png +0 -0
  28. package/dist/assets/mstile-70x70.png +0 -0
  29. package/dist/bundle.31d9465dfaf7ec6b2a49.js +2 -0
  30. package/dist/bundle.31d9465dfaf7ec6b2a49.js.LICENSE.txt +4 -0
  31. package/dist/bundle.efd3cfd1da0be0deb202.js +2 -0
  32. package/dist/bundle.f8145f093c653b051d7f.js +1 -0
  33. package/dist/config.js +1 -1
  34. package/dist/index.html +2 -2
  35. package/dist/manifest.json +1 -1
  36. package/dist/maplibre-gl-shared.mjs +2 -0
  37. package/dist/maplibre-gl-shared.mjs.LICENSE.txt +4 -0
  38. package/dist/maplibre-gl-worker.mjs +2 -0
  39. package/dist/maplibre-gl-worker.mjs.LICENSE.txt +4 -0
  40. package/package.json +10 -1
  41. package/dist/bundle.8944531bcbbc36cf4c39.js +0 -2
  42. package/dist/ceb05254cedfa895b512.ttf +0 -0
  43. package/dist/eae34fa8f1e0c4c6d797.ttf +0 -0
  44. package/dist/fc2b5060f7accec5cf74.ttf +0 -0
  45. package/dist/fc3d2f2e3a203d0037c1.ttf +0 -0
  46. /package/dist/{bundle.8944531bcbbc36cf4c39.js.LICENSE.txt → bundle.efd3cfd1da0be0deb202.js.LICENSE.txt} +0 -0
@@ -0,0 +1,2 @@
1
+ /*! For license information please see maplibre-gl-shared.mjs.LICENSE.txt */
2
+ var e=Object.create,t=Object.defineProperty,r=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,s=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),o=(e,i,s,o)=>{if(i&&"object"==typeof i||"function"==typeof i)for(var l,u=n(i),h=0,c=u.length;h<c;h++)l=u[h],!a.call(e,l)&&l!==s&&t(e,l,{get:(e=>i[e]).bind(null,l),enumerable:!(o=r(i,l))||o.enumerable});return e};function l(e,t){this.x=e,this.y=t}let u,h;function c(){return u??=typeof OffscreenCanvas<"u"&&!!new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof createImageBitmap,u}function p(){if(null==h&&(h=!1,c())){let e=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(e){for(let t=0;t<25;t++){let r=4*t;e.fillStyle=`rgb(${r},${r+1},${r+2})`,e.fillRect(t%5,Math.floor(t/5),1,1)}let t=e.getImageData(0,0,5,5).data;for(let e=0;e<100;e++)if(e%4!=3&&t[e]!==e){h=!0;break}}}return h||!1}l.prototype={clone(){return new l(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,r=e.y-this.y;return t*t+r*r},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,r=e[2]*this.x+e[3]*this.y;return this.x=t,this.y=r,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),r=Math.sin(e),n=t*this.x-r*this.y,i=r*this.x+t*this.y;return this.x=n,this.y=i,this},_rotateAround(e,t){let r=Math.cos(e),n=Math.sin(e),i=t.x+r*(this.x-t.x)-n*(this.y-t.y),a=t.y+n*(this.x-t.x)+r*(this.y-t.y);return this.x=i,this.y=a,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:l},l.convert=function(e){if(e instanceof l)return e;if(Array.isArray(e))return new l(+e[0],+e[1]);if(void 0!==e.x&&void 0!==e.y)return new l(+e.x,+e.y);throw Error("Expected [x, y] or {x, y} point format")};var f=typeof Float32Array<"u"?Float32Array:Array;function d(){var e=new f(9);return f!=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 y(e,t){var r=Math.sin(t),n=Math.cos(t);return e[0]=n,e[1]=r,e[2]=0,e[3]=-r,e[4]=n,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function m(){var e=new f(16);return f!=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 g(e){var t=new f(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 x(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 v(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 b(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],s=t[4],o=t[5],l=t[6],u=t[7],h=t[8],c=t[9],p=t[10],f=t[11],d=t[12],y=t[13],m=t[14],g=t[15],x=r*o-n*s,v=r*l-i*s,b=r*u-a*s,w=n*l-i*o,D=n*u-a*o,_=i*u-a*l,A=h*y-c*d,E=h*m-p*d,S=h*g-f*d,F=c*m-p*y,k=c*g-f*y,I=p*g-f*m,T=x*I-v*k+b*F+w*S-D*E+_*A;return T?(T=1/T,e[0]=(o*I-l*k+u*F)*T,e[1]=(i*k-n*I-a*F)*T,e[2]=(y*_-m*D+g*w)*T,e[3]=(p*D-c*_-f*w)*T,e[4]=(l*S-s*I-u*E)*T,e[5]=(r*I-i*S+a*E)*T,e[6]=(m*b-d*_-g*v)*T,e[7]=(h*_-p*b+f*v)*T,e[8]=(s*k-o*S+u*A)*T,e[9]=(n*S-r*k-a*A)*T,e[10]=(d*D-y*b+g*x)*T,e[11]=(c*b-h*D-f*x)*T,e[12]=(o*E-s*F-l*A)*T,e[13]=(r*F-n*E+i*A)*T,e[14]=(y*v-d*w-m*x)*T,e[15]=(h*w-c*v+p*x)*T,e):null}function w(e,t,r){var n=t[0],i=t[1],a=t[2],s=t[3],o=t[4],l=t[5],u=t[6],h=t[7],c=t[8],p=t[9],f=t[10],d=t[11],y=t[12],m=t[13],g=t[14],x=t[15],v=r[0],b=r[1],w=r[2],D=r[3];return e[0]=v*n+b*o+w*c+D*y,e[1]=v*i+b*l+w*p+D*m,e[2]=v*a+b*u+w*f+D*g,e[3]=v*s+b*h+w*d+D*x,v=r[4],b=r[5],w=r[6],D=r[7],e[4]=v*n+b*o+w*c+D*y,e[5]=v*i+b*l+w*p+D*m,e[6]=v*a+b*u+w*f+D*g,e[7]=v*s+b*h+w*d+D*x,v=r[8],b=r[9],w=r[10],D=r[11],e[8]=v*n+b*o+w*c+D*y,e[9]=v*i+b*l+w*p+D*m,e[10]=v*a+b*u+w*f+D*g,e[11]=v*s+b*h+w*d+D*x,v=r[12],b=r[13],w=r[14],D=r[15],e[12]=v*n+b*o+w*c+D*y,e[13]=v*i+b*l+w*p+D*m,e[14]=v*a+b*u+w*f+D*g,e[15]=v*s+b*h+w*d+D*x,e}function D(e,t,r){var n,i,a,s,o,l,u,h,c,p,f,d,y=r[0],m=r[1],g=r[2];return t===e?(e[12]=t[0]*y+t[4]*m+t[8]*g+t[12],e[13]=t[1]*y+t[5]*m+t[9]*g+t[13],e[14]=t[2]*y+t[6]*m+t[10]*g+t[14],e[15]=t[3]*y+t[7]*m+t[11]*g+t[15]):(n=t[0],i=t[1],a=t[2],s=t[3],o=t[4],l=t[5],u=t[6],h=t[7],c=t[8],p=t[9],f=t[10],d=t[11],e[0]=n,e[1]=i,e[2]=a,e[3]=s,e[4]=o,e[5]=l,e[6]=u,e[7]=h,e[8]=c,e[9]=p,e[10]=f,e[11]=d,e[12]=n*y+o*m+c*g+t[12],e[13]=i*y+l*m+p*g+t[13],e[14]=a*y+u*m+f*g+t[14],e[15]=s*y+h*m+d*g+t[15]),e}function _(e,t,r){var n=r[0],i=r[1],a=r[2];return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*a,e[9]=t[9]*a,e[10]=t[10]*a,e[11]=t[11]*a,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function A(e,t,r){var n=Math.sin(r),i=Math.cos(r),a=t[4],s=t[5],o=t[6],l=t[7],u=t[8],h=t[9],c=t[10],p=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=a*i+u*n,e[5]=s*i+h*n,e[6]=o*i+c*n,e[7]=l*i+p*n,e[8]=u*i-a*n,e[9]=h*i-s*n,e[10]=c*i-o*n,e[11]=p*i-l*n,e}function E(e,t,r){var n=Math.sin(r),i=Math.cos(r),a=t[0],s=t[1],o=t[2],l=t[3],u=t[8],h=t[9],c=t[10],p=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=a*i-u*n,e[1]=s*i-h*n,e[2]=o*i-c*n,e[3]=l*i-p*n,e[8]=a*n+u*i,e[9]=s*n+h*i,e[10]=o*n+c*i,e[11]=l*n+p*i,e}function S(e,t,r){var n=Math.sin(r),i=Math.cos(r),a=t[0],s=t[1],o=t[2],l=t[3],u=t[4],h=t[5],c=t[6],p=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=a*i+u*n,e[1]=s*i+h*n,e[2]=o*i+c*n,e[3]=l*i+p*n,e[4]=u*i-a*n,e[5]=h*i-s*n,e[6]=c*i-o*n,e[7]=p*i-l*n,e}function F(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}Math.PI,Math.PI;var k=function(e,t,r,n,i){var a=1/Math.tan(t/2);if(e[0]=a/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=i&&i!==1/0){var s=1/(n-i);e[10]=(i+n)*s,e[14]=2*i*n*s}else e[10]=-1,e[14]=-2*n;return e},I=function(e,t,r,n,i,a,s){var o=1/(t-r),l=1/(n-i),u=1/(a-s);return e[0]=-2*o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*u,e[11]=0,e[12]=(t+r)*o,e[13]=(i+n)*l,e[14]=(s+a)*u,e[15]=1,e};function T(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 M(e,t){var r=e[0],n=e[1],i=e[2],a=e[3],s=e[4],o=e[5],l=e[6],u=e[7],h=e[8],c=e[9],p=e[10],f=e[11],d=e[12],y=e[13],m=e[14],g=e[15],x=t[0],v=t[1],b=t[2],w=t[3],D=t[4],_=t[5],A=t[6],E=t[7],S=t[8],F=t[9],k=t[10],I=t[11],T=t[12],M=t[13],C=t[14],B=t[15];return Math.abs(r-x)<=1e-6*Math.max(1,Math.abs(r),Math.abs(x))&&Math.abs(n-v)<=1e-6*Math.max(1,Math.abs(n),Math.abs(v))&&Math.abs(i-b)<=1e-6*Math.max(1,Math.abs(i),Math.abs(b))&&Math.abs(a-w)<=1e-6*Math.max(1,Math.abs(a),Math.abs(w))&&Math.abs(s-D)<=1e-6*Math.max(1,Math.abs(s),Math.abs(D))&&Math.abs(o-_)<=1e-6*Math.max(1,Math.abs(o),Math.abs(_))&&Math.abs(l-A)<=1e-6*Math.max(1,Math.abs(l),Math.abs(A))&&Math.abs(u-E)<=1e-6*Math.max(1,Math.abs(u),Math.abs(E))&&Math.abs(h-S)<=1e-6*Math.max(1,Math.abs(h),Math.abs(S))&&Math.abs(c-F)<=1e-6*Math.max(1,Math.abs(c),Math.abs(F))&&Math.abs(p-k)<=1e-6*Math.max(1,Math.abs(p),Math.abs(k))&&Math.abs(f-I)<=1e-6*Math.max(1,Math.abs(f),Math.abs(I))&&Math.abs(d-T)<=1e-6*Math.max(1,Math.abs(d),Math.abs(T))&&Math.abs(y-M)<=1e-6*Math.max(1,Math.abs(y),Math.abs(M))&&Math.abs(m-C)<=1e-6*Math.max(1,Math.abs(m),Math.abs(C))&&Math.abs(g-B)<=1e-6*Math.max(1,Math.abs(g),Math.abs(B))}function C(){var e=new f(3);return f!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function B(e){var t=new f(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function P(e){var t=e[0],r=e[1],n=e[2];return Math.sqrt(t*t+r*r+n*n)}function z(e,t,r){var n=new f(3);return n[0]=e,n[1]=t,n[2]=r,n}function V(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e}function L(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e}function O(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e}function R(e,t,r,n){return e[0]=t[0]+r[0]*n,e[1]=t[1]+r[1]*n,e[2]=t[2]+r[2]*n,e}function $(e,t){var r=t[0]-e[0],n=t[1]-e[1],i=t[2]-e[2];return Math.sqrt(r*r+n*n+i*i)}function N(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function U(e,t){var r=t[0],n=t[1],i=t[2],a=r*r+n*n+i*i;return a>0&&(a=1/Math.sqrt(a)),e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a,e}function q(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function j(e,t,r){var n=t[0],i=t[1],a=t[2],s=r[0],o=r[1],l=r[2];return e[0]=i*l-a*o,e[1]=a*s-n*l,e[2]=n*o-i*s,e}function G(e,t,r){var n=t[0],i=t[1],a=t[2],s=r[3]*n+r[7]*i+r[11]*a+r[15];return s||=1,e[0]=(r[0]*n+r[4]*i+r[8]*a+r[12])/s,e[1]=(r[1]*n+r[5]*i+r[9]*a+r[13])/s,e[2]=(r[2]*n+r[6]*i+r[10]*a+r[14])/s,e}function X(e,t,r){var n=t[0],i=t[1],a=t[2];return e[0]=n*r[0]+i*r[3]+a*r[6],e[1]=n*r[1]+i*r[4]+a*r[7],e[2]=n*r[2]+i*r[5]+a*r[8],e}function Y(e,t,r){var n=r[0],i=r[1],a=r[2],s=r[3],o=t[0],l=t[1],u=t[2],h=i*u-a*l,c=a*o-n*u,p=n*l-i*o;return h+=h,c+=c,p+=p,e[0]=o+s*h+i*p-a*c,e[1]=l+s*c+a*h-n*p,e[2]=u+s*p+n*c-i*h,e}function Z(e,t,r,n){var i=[],a=[];return i[0]=t[0]-r[0],i[1]=t[1]-r[1],i[2]=t[2]-r[2],a[0]=i[0],a[1]=i[1]*Math.cos(n)-i[2]*Math.sin(n),a[2]=i[1]*Math.sin(n)+i[2]*Math.cos(n),e[0]=a[0]+r[0],e[1]=a[1]+r[1],e[2]=a[2]+r[2],e}function W(e,t,r,n){var i=[],a=[];return i[0]=t[0]-r[0],i[1]=t[1]-r[1],i[2]=t[2]-r[2],a[0]=i[2]*Math.sin(n)+i[0]*Math.cos(n),a[1]=i[1],a[2]=i[2]*Math.cos(n)-i[0]*Math.sin(n),e[0]=a[0]+r[0],e[1]=a[1]+r[1],e[2]=a[2]+r[2],e}function H(e,t,r,n){var i=[],a=[];return i[0]=t[0]-r[0],i[1]=t[1]-r[1],i[2]=t[2]-r[2],a[0]=i[0]*Math.cos(n)-i[1]*Math.sin(n),a[1]=i[0]*Math.sin(n)+i[1]*Math.cos(n),a[2]=i[2],e[0]=a[0]+r[0],e[1]=a[1]+r[1],e[2]=a[2]+r[2],e}function K(e){return e[0]=0,e[1]=0,e[2]=0,e}var J=L,Q=P;function ee(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e}function te(e,t,r){var n=t[0],i=t[1],a=t[2],s=t[3];return e[0]=r[0]*n+r[4]*i+r[8]*a+r[12]*s,e[1]=r[1]*n+r[5]*i+r[9]*a+r[13]*s,e[2]=r[2]*n+r[6]*i+r[10]*a+r[14]*s,e[3]=r[3]*n+r[7]*i+r[11]*a+r[15]*s,e}C();var re=function(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e[2]=t[2]*r[2],e[3]=t[3]*r[3],e};function ne(){var e=new f(4);return f!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function ie(e,t,r){var n=t[0],i=t[1],a=t[2],s=t[3],o=r[0],l=r[1],u=r[2],h=r[3];return e[0]=n*h+s*o+i*u-a*l,e[1]=i*h+s*l+a*o-n*u,e[2]=a*h+s*u+n*l-i*o,e[3]=s*h-n*o-i*l-a*u,e}function ae(e,t,r,n){var i,a,s,o,l=t[0],u=t[1],h=t[2],c=t[3],p=r[0],f=r[1],d=r[2],y=r[3],m=l*p+u*f+h*d+c*y;return m<0&&(m=-m,p=-p,f=-f,d=-d,y=-y),1-m>1e-6?(i=Math.acos(m),a=Math.sin(i),s=Math.sin((1-n)*i)/a,o=Math.sin(n*i)/a):(s=1-n,o=n),e[0]=s*l+o*p,e[1]=s*u+o*f,e[2]=s*h+o*d,e[3]=s*c+o*y,e}function se(e,t,r,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"zyx",a=Math.PI/360;t*=a,n*=a,r*=a;var s=Math.sin(t),o=Math.cos(t),l=Math.sin(r),u=Math.cos(r),h=Math.sin(n),c=Math.cos(n);switch(i){case"xyz":e[0]=s*u*c+o*l*h,e[1]=o*l*c-s*u*h,e[2]=o*u*h+s*l*c,e[3]=o*u*c-s*l*h;break;case"xzy":e[0]=s*u*c-o*l*h,e[1]=o*l*c-s*u*h,e[2]=o*u*h+s*l*c,e[3]=o*u*c+s*l*h;break;case"yxz":e[0]=s*u*c+o*l*h,e[1]=o*l*c-s*u*h,e[2]=o*u*h-s*l*c,e[3]=o*u*c+s*l*h;break;case"yzx":e[0]=s*u*c+o*l*h,e[1]=o*l*c+s*u*h,e[2]=o*u*h-s*l*c,e[3]=o*u*c-s*l*h;break;case"zxy":e[0]=s*u*c-o*l*h,e[1]=o*l*c+s*u*h,e[2]=o*u*h+s*l*c,e[3]=o*u*c-s*l*h;break;case"zyx":e[0]=s*u*c-o*l*h,e[1]=o*l*c+s*u*h,e[2]=o*u*h-s*l*c,e[3]=o*u*c+s*l*h;break;default:throw Error("Unknown angle order "+i)}return e}!function(){var e=new f(4);f!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0)}();var oe=function(e,t,r,n){var i=new f(4);return i[0]=e,i[1]=t,i[2]=r,i[3]=n,i};function le(){var e=new f(2);return f!=Float32Array&&(e[0]=0,e[1]=0),e}function ue(e,t){var r=new f(2);return r[0]=e,r[1]=t,r}function he(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e}function ce(e){var t=e[0],r=e[1];return Math.sqrt(t*t+r*r)}function pe(e){return e[0]=0,e[1]=0,e}C(),z(1,0,0),z(0,1,0),ne(),ne(),d();var fe=function(e){var t=e[0],r=e[1];return t*t+r*r};le();const de=8192;function ye(e,t,r){return t*(de/(e.tileSize*2**(r-e.tileID.overscaledZ)))}const me="__$json__:";function ge(e){return e instanceof Error?e:Error("string"==typeof e?e:String(e))}function xe(){return new Float64Array(4)}function ve(){return new Float64Array(3)}function be(){return new Float64Array(16)}function we(){let e=new Float64Array(16);return v(e),e}function De(){let e=new Float32Array(16);return v(e),e}function _e(e,t,r,n,i=!1){if(!r[0]&&!r[1])return[0,0];let a=i?"map"===n?-e.bearingInRadians:0:"viewport"===n?e.bearingInRadians:0;if(a){let e=Math.sin(a),t=Math.cos(a);r=[r[0]*t-r[1]*e,r[0]*e+r[1]*t]}return[i?r[0]:ye(t,r[0],e.zoom),i?r[1]:ye(t,r[1],e.zoom)]}function Ae(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]}function Ee(e,t,r){let n=function(e){var t=e[3],r=e[4],n=e[5],i=e[6],a=e[7],s=e[8];return e[0]*(s*r-n*a)+e[1]*(-s*t+n*i)+e[2]*(a*t-r*i)}([e[0],e[1],e[2],t[0],t[1],t[2],r[0],r[1],r[2]]);if(0===n)return null;let i=j([],[t[0],t[1],t[2]],[r[0],r[1],r[2]]),a=j([],[r[0],r[1],r[2]],[e[0],e[1],e[2]]),s=j([],[e[0],e[1],e[2]],[t[0],t[1],t[2]]),o=O([],i,-e[3]);return V(o,o,O([],a,-t[3])),V(o,o,O([],s,-r[3])),O(o,o,1/n),o}function Se(e,t,r){let n=e[0]*r[0]+e[1]*r[1]+e[2]*r[2],i=t[0]*r[0]+t[1]*r[1]+t[2]*r[2];return 0===i?null:(-n-r[3])/i}function Fe(e,t,r,n){let i=Math.sqrt(e*e+t*t),a=Math.sqrt(r*r+n*n),s=(e/=i)*(r/=a)+(t/=i)*(n/=a),o=Math.acos(s);return-t*r+e*n>0?o:-o}function ke(e,t){let r=Te(e,360),n=Te(t,360),i=n-r,a=n>r?i-360:i+360;return Math.abs(i)<Math.abs(a)?i:a}function Ie(e,t){let r=Te(e,2*Math.PI),n=Te(t,2*Math.PI);return Math.min(Math.abs(r-n),Math.abs(r-n+2*Math.PI),Math.abs(r-n-2*Math.PI))}function Te(e,t){return(e%t+t)%t}function Me(e,t,r,n,i){return Ce(n,i,Le((e-t)/(r-t),0,1))}function Ce(e,t,r){return e*(1-r)+t*r}function Be(e){let t=1/0,r=1/0,n=-1/0,i=-1/0;for(let a of e)t=Math.min(t,a.x),r=Math.min(r,a.y),n=Math.max(n,a.x),i=Math.max(i,a.y);return[t,r,n,i]}function Pe(e){if(!e.length)return new Set;let t=Math.max(...e.map(e=>e.canonical.z)),r=1/0,n=-1/0,i=1/0,a=-1/0,s=[];for(let o of e){let{x:e,y:l,z:u}=o.canonical,h=2**(t-u),c=e*h,p=l*h;s.push({id:o,x:c,y:p}),c<r&&(r=c),c>n&&(n=c),p<i&&(i=p),p>a&&(a=p)}let o=new Set;for(let e of s)(e.x===r||e.x===n||e.y===i||e.y===a)&&o.add(e.id);return o}function ze(e,t,r,n){return function(e,t,r,n){let i=3*e,a=3*(r-e)-i,s=1-i-a,o=3*t,l=3*(n-t)-o,u=1-o-l;return function(e,t=1e-6){if(e<=0)return 0;if(e>=1)return 1;let r=e;for(let n=0;n<8;n++){let n=((s*r+a)*r+i)*r-e;if(Math.abs(n)<t)return((u*r+l)*r+o)*r;let h=(3*s*r+2*a)*r+i;if(Math.abs(h)<1e-6)break;r-=n/h}let n=0,h=1;r=e;for(let o=0;o<20;o++){let o=((s*r+a)*r+i)*r;if(Math.abs(o-e)<t)break;e>o?n=r:h=r,r=.5*(n+h)}return((u*r+l)*r+o)*r}}(e,t,r,n)}const Ve=ze(.25,.1,.25,1);function Le(e,t,r){return Math.min(r,Math.max(t,e))}function Oe(e,t,r){let n=r-t,i=((e-t)%n+n)%n+t;return i===t?r:i}function Re(e,...t){for(let r of t)for(let t in r)e[t]=r[t];return e}function $e(e,t){let r={};for(let n of t)n in e&&(r[n]=e[n]);return r}let Ne=1;function Ue(){return Ne++}function qe(e){return e<=1?1:2**Math.ceil(Math.log(e)/Math.LN2)}function je(e){return 2**e}function Ge(e){return Math.log(e)/Math.LN2}function Xe(e,t,r){if(t<=0)return e;let n=1/t;return void 0===r||Math.abs(r)<1e-10?Math.round(e*n)/n:(r>0?Math.ceil(e*n-1e-9):Math.floor(e*n+1e-10))/n}function Ye(e,t,r){let n={};for(let i in e)n[i]=t.call(r||this,e[i],i,e);return n}function Ze(e,t,r){let n={};for(let i in e)t.call(r||this,e[i],i,e)&&(n[i]=e[i]);return n}function We(e,t){if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!We(e[r],t[r]))return!1;return!0}if("object"==typeof e&&e&&null!==t){if("object"!=typeof t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let r in e)if(!We(e[r],t[r]))return!1;return!0}return e===t}function He(e){return Array.isArray(e)?e.map(He):"object"==typeof e&&e?Ye(e,He):e}const Ke={};function Je(e){Ke[e]||(typeof console<"u"&&console.warn(e),Ke[e]=!0)}function Qe(e,t,r){return(r.y-e.y)*(t.x-e.x)>(t.y-e.y)*(r.x-e.x)}function et(e,t,r,n){let i=t.y-e.y,a=t.x-e.x,s=n.y-r.y,o=n.x-r.x,u=s*a-o*i;if(0===u)return null;let h=(o*(e.y-r.y)-s*(e.x-r.x))/u;return new l(e.x+h*a,e.y+h*i)}function tt([e,t,r]){return t+=90,t*=Math.PI/180,r*=Math.PI/180,[e*Math.cos(t)*Math.sin(r),e*Math.sin(t)*Math.sin(r),e*Math.cos(r)]}function rt(e){return typeof WorkerGlobalScope<"u"&&void 0!==e&&e instanceof WorkerGlobalScope}function nt(e){let t={};if(e.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(e,r,n,i)=>{let a=n||i;return t[r]=!a||a.toLowerCase(),""}),t["max-age"]){let e=parseInt(t["max-age"],10);isNaN(e)?delete t["max-age"]:t["max-age"]=e}return t}let it=null;function at(e){if(null==it){let t=e.navigator?e.navigator.userAgent:null;it=!!e.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return it}function st(e){return typeof ImageBitmap<"u"&&e instanceof ImageBitmap}const ot=async(e,t)=>{let r=new Blob([new Uint8Array(e)],{type:"image/png"});try{return createImageBitmap(r,t)}catch(e){throw Error(`Could not load image because of ${ge(e).message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}},lt=e=>new Promise((t,r)=>{let n=new Image;n.onload=()=>{t(n),URL.revokeObjectURL(n.src),n.onload=null,window.requestAnimationFrame(()=>n.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=")},n.onerror=()=>r(Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));let i=new Blob([new Uint8Array(e)],{type:"image/png"});n.src=URL.createObjectURL(i)});async function ut(e,t,r,n,i){if(typeof VideoFrame>"u")throw Error("VideoFrame not supported");let a=new VideoFrame(e,{timestamp:0});try{let s=a?.format;if(!s||!s.startsWith("BGR")&&!s.startsWith("RGB"))throw Error(`Unrecognized format ${s}`);let o=s.startsWith("BGR"),l=new Uint8ClampedArray(n*i*4);if(await a.copyTo(l,function(e,t,r,n,i){let a=4*Math.max(-t,0),s=(Math.max(0,r)-r)*n*4+a,o=4*n,l=Math.max(0,t),u=Math.max(0,r);return{rect:{x:l,y:u,width:Math.min(e.width,t+n)-l,height:Math.min(e.height,r+i)-u},layout:[{offset:s,stride:o}]}}(e,t,r,n,i)),o)for(let e=0;e<l.length;e+=4){let t=l[e];l[e]=l[e+2],l[e+2]=t}return l}finally{a.close()}}let ht,ct;async function pt(e,t,r,n,i){if(p())try{return await ut(e,t,r,n,i)}catch{}return function(e,t,r,n,i){let a=e.width,s=e.height;(!ht||!ct)&&(ht=new OffscreenCanvas(a,s),ct=ht.getContext("2d",{willReadFrequently:!0})),ht.width=a,ht.height=s,ct.drawImage(e,0,0,a,s);let o=ct.getImageData(t,r,n,i);return ct.clearRect(0,0,a,s),o.data}(e,t,r,n,i)}function ft(e,t,r,n){return e.addEventListener(t,r,n),{unsubscribe:()=>{e.removeEventListener(t,r,n)}}}function dt(e){return e*Math.PI/180}function yt(e){return e/Math.PI*180}function mt(e,t){return e.roll==t.roll&&e.pitch==t.pitch&&e.bearing==t.bearing}function gt(e){let t=new Float64Array(9);!function(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],s=r+r,o=n+n,l=i+i,u=r*s,h=n*s,c=n*o,p=i*s,f=i*o,d=i*l,y=a*s,m=a*o,g=a*l;e[0]=1-c-d,e[3]=h-g,e[6]=p+m,e[1]=h+g,e[4]=1-u-d,e[7]=f-y,e[2]=p-m,e[5]=f+y,e[8]=1-u-c}(t,e);let r,n,i=yt(-Math.asin(Le(t[2],-1,1)));return Math.hypot(t[5],t[8])<.001?(r=0,n=-yt(Math.atan2(t[3],t[4]))):(r=yt(0===t[5]&&0===t[8]?0:Math.atan2(t[5],t[8])),n=yt(0===t[1]&&0===t[0]?0:Math.atan2(t[1],t[0]))),{roll:r,pitch:i+90,bearing:n}}function xt(e,t,r){let n=ue(t.x-r.x,t.y-r.y),i=ue(e.x-r.x,e.y-r.y),a=n[0]*i[1]-n[1]*i[0];return yt(Math.atan2(a,function(e,t){return e[0]*t[0]+e[1]*t[1]}(n,i)))}function vt(e,t,r){let n=new Float64Array(4);return se(n,e,t-90,r),n}const bt=85.051129,wt={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},Dt={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0};function _t(e,t){return wt[t]&&"touches"in e}function At(e,t){if(!Dt[t])return!1;let r=e,n=(r?.target)?.ownerDocument?.defaultView||window;return r instanceof n.MouseEvent||r instanceof n.WheelEvent}function Et(e){return wt[e]||Dt[e]}const St="AbortError";var Ft=class extends Error{constructor(e=St){super(e instanceof Error?e.message:e),this.name=St,e instanceof Error&&e.stack&&(this.stack=e.stack)}};function kt(e){return e instanceof Error&&"AbortError"===e.name}function It(e){if(e.aborted)throw new Ft(e.reason)}const Tt={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function Mt(e){return Tt.REGISTERED_PROTOCOLS[e.substring(0,e.indexOf("://"))]}function Ct(e,t){Tt.REGISTERED_PROTOCOLS[e]=t}function Bt(e){delete Tt.REGISTERED_PROTOCOLS[e]}const Pt="global-dispatcher";var zt=class extends Error{constructor(e,t,r,n){super(`AJAXError: ${t} (${e}): ${r}`),this.status=e,this.statusText=t,this.url=r,this.body=n}};function Vt(){if(rt(self))return self.worker?.referrer;if("blob:"===window.location.protocol)try{return window.parent.location.href}catch{}return window.location.href}const Lt=async function(e,t){if(e.url.includes("://")&&!/^https?:|^file:/.test(e.url)){let r=Mt(e.url);if(r){let n=await r(e,t);return n.data||"arrayBuffer"!==e.type?n:Re(n,{data:new ArrayBuffer(0)})}if(rt(self)&&self.worker?.actor)return self.worker.actor.sendAsync({type:"GR",data:e,targetMapId:Pt},t)}if(!(e=>e.startsWith("file:")||Vt()?.startsWith("file:")&&!/^\w+:/.test(e))(e.url)){if(fetch&&Request&&AbortController&&Object.hasOwn(Request.prototype,"signal"))return async function(e,t){let r,n,i=new Request(e.url,{method:e.method||"GET",body:e.body,credentials:e.credentials,headers:e.headers,cache:e.cache,referrer:Vt(),referrerPolicy:e.referrerPolicy,signal:t.signal});"json"===e.type&&!i.headers.has("Accept")&&i.headers.set("Accept","application/json");try{r=await fetch(i)}catch(t){throw kt(t)?t:new zt(0,ge(t).message,e.url,new Blob)}if(!r.ok){let t=await r.blob();throw new zt(r.status,r.statusText,e.url,t)}n="arrayBuffer"===e.type||"image"===e.type?r.arrayBuffer():"json"===e.type?r.json():r.text();let a=await n;return It(t.signal),{data:a,cacheControl:r.headers.get("Cache-Control"),expires:r.headers.get("Expires"),etag:r.headers.get("ETag")}}(e,t);if(rt(self)&&self.worker?.actor)return self.worker.actor.sendAsync({type:"GR",data:e,mustQueue:!0,targetMapId:Pt},t)}return function(e,t){return new Promise((r,n)=>{let i=new XMLHttpRequest;i.open(e.method||"GET",e.url,!0),("arrayBuffer"===e.type||"image"===e.type)&&(i.responseType="arraybuffer");for(let t in e.headers)i.setRequestHeader(t,e.headers[t]);"json"===e.type&&(i.responseType="text",e.headers?.Accept||i.setRequestHeader("Accept","application/json")),i.withCredentials="include"===e.credentials,i.onerror=()=>{n(Error(i.statusText))},i.onload=()=>{if(!t.signal.aborted)if((i.status>=200&&i.status<300||0===i.status)&&null!==i.response){let t=i.response;if("json"===e.type)try{t=JSON.parse(i.response)}catch(e){return void n(e)}r({data:t,cacheControl:i.getResponseHeader("Cache-Control"),expires:i.getResponseHeader("Expires"),etag:i.getResponseHeader("ETag")})}else{let t=new Blob([i.response],{type:i.getResponseHeader("Content-Type")});n(new zt(i.status,i.statusText,e.url,t))}},t.signal.addEventListener("abort",()=>{i.abort(),n(new Ft(t.signal.reason))}),i.send(e.body)})}(e,t)},Ot=(e,t)=>Lt(Re(e,{type:"json"}),t),Rt=(e,t)=>Lt(Re(e,{type:"arrayBuffer"}),t);function $t(e){if(!e||e.startsWith("data:image/"))return!0;if(e.startsWith("blob:")&&(e=e.slice(5)).startsWith("null"))return!1;if(e.indexOf("://")<=0)return!0;let t=new URL(e),r=window.location;return t.protocol===r.protocol&&t.host===r.host}const Nt=e=>{let t=window.document.createElement("video");return t.muted=!0,new Promise(r=>{t.onloadstart=()=>{r(t)};for(let r of e){let e=window.document.createElement("source");$t(r)||(t.crossOrigin="Anonymous"),e.src=r,t.appendChild(e)}})};function Ut(e,t,r){r[e]?.includes(t)||(r[e]||=[],r[e].push(t))}function qt(e,t,r){if(r?.[e]){let n=r[e].indexOf(t);-1!==n&&r[e].splice(n,1)}}var jt=class{constructor(e,t={}){Re(this,t),this.type=e}},Gt=class extends jt{constructor(e,t={}){super("error",Re({error:e},t))}},Xt=class{on(e,t){return this._listeners||={},Ut(e,t,this._listeners),{unsubscribe:()=>{this.off(e,t)}}}off(e,t){return qt(e,t,this._listeners),qt(e,t,this._oneTimeListeners),this}once(e,t){return t?(this._oneTimeListeners||={},Ut(e,t,this._oneTimeListeners),this):new Promise(t=>this.once(e,t))}fire(e,t){let r="string"==typeof e?new jt(e,t||{}):e,n=r.type;if(this.listens(n)){r.target=this;let e=this._listeners?.[n]?.slice()??[];for(let t of e)t.call(this,r);let t=this._oneTimeListeners?.[n]?.slice()??[];for(let e of t)qt(n,e,this._oneTimeListeners),e.call(this,r);let i=this._eventedParent;i&&(Re(r,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),i.fire(r))}else r instanceof Gt&&console.error(r.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}},Yt={$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"},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:.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:{}},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:.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:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},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-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"]},"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-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)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},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-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:.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"}]}}}}};const Zt=Yt,Wt=["type","source","source-layer","minzoom","maxzoom","filter","layout"];var Ht=class{constructor(e,t,r,n,i="error"){this.message=(e?`${e}: `:"")+r,n&&(this.identifier=n),this.severity=i,null!=t&&t.__line__&&(this.line=t.__line__)}};const Kt={kind:"null"},Jt={kind:"number"},Qt={kind:"string"},er={kind:"boolean"},tr={kind:"color"},rr={kind:"projectionDefinition"},nr={kind:"object"},ir={kind:"value"},ar={kind:"collator"},sr={kind:"formatted"},or={kind:"padding"},lr={kind:"colorArray"},ur={kind:"numberArray"},hr={kind:"resolvedImage"},cr={kind:"variableAnchorOffsetCollection"};function pr(e,t){return{kind:"array",itemType:e,N:t}}function fr(e){if("array"===e.kind){let t=fr(e.itemType);return"number"==typeof e.N?`array<${t}, ${e.N}>`:"value"===e.itemType.kind?"array":`array<${t}>`}return e.kind}const dr=[Kt,Jt,Qt,er,tr,rr,sr,nr,pr(ir),or,ur,lr,hr,cr];function yr(e,t){if("error"===t.kind)return null;if("array"===e.kind){if("array"===t.kind&&(0===t.N&&"value"===t.itemType.kind||!yr(e.itemType,t.itemType))&&("number"!=typeof e.N||e.N===t.N))return null}else{if(e.kind===t.kind)return null;if("value"===e.kind)for(let e of dr)if(!yr(e,t))return null}return`Expected ${fr(e)} but found ${fr(t)} instead.`}function mr(e,t){return t.some(t=>t.kind===e.kind)}function gr(e,t){return t.some(t=>"null"===t?null===e:"array"===t?Array.isArray(e):"object"===t?e&&!Array.isArray(e)&&"object"==typeof e:t===typeof e)}function xr(e,t){return"array"===e.kind&&"array"===t.kind?e.itemType.kind===t.itemType.kind&&"number"==typeof e.N:e.kind===t.kind}const vr=.96422,br=.82521,wr=4/29,Dr=6/29,_r=3*Dr*Dr,Ar=Math.PI/180,Er=180/Math.PI;function Sr(e){return(e%=360)<0&&(e+=360),e}function Fr([e,t,r,n]){let i,a,s=Ir((.2225045*(e=kr(e))+.7168786*(t=kr(t))+.0606169*(r=kr(r)))/1);e===t&&t===r?i=a=s:(i=Ir((.4360747*e+.3850649*t+.1430804*r)/vr),a=Ir((.0139322*e+.0971045*t+.7141733*r)/br));let o=116*s-16;return[o<0?0:o,500*(i-s),200*(s-a),n]}function kr(e){return e<=.04045?e/12.92:((e+.055)/1.055)**2.4}function Ir(e){return e>.008856451679035631?e**(1/3):e/_r+wr}function Tr([e,t,r,n]){let i=(e+16)/116,a=isNaN(t)?i:i+t/500,s=isNaN(r)?i:i-r/200;return i=1*Cr(i),a=vr*Cr(a),s=br*Cr(s),[Mr(3.1338561*a-1.6168667*i-.4906146*s),Mr(-.9787684*a+1.9161415*i+.033454*s),Mr(.0719453*a-.2289914*i+1.4052427*s),n]}function Mr(e){return(e=e<=.00304?12.92*e:1.055*e**(1/2.4)-.055)<0?0:e>1?1:e}function Cr(e){return e>Dr?e*e*e:_r*(e-wr)}const Br=Object.hasOwn||function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};function Pr(e,t){return Br(e,t)?e[t]:void 0}function zr(e){return parseInt(e.padEnd(2,e),16)/255}function Vr(e,t){return Lr(t?e/100:e,0,1)}function Lr(e,t,r){return Math.min(Math.max(t,e),r)}function Or(e){return!e.some(Number.isNaN)}const Rr={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function $r(e,t,r){return e+r*(t-e)}function Nr(e,t,r){return e.map((e,n)=>$r(e,t[n],r))}var Ur=class e{constructor(e,t,r,n=1,i=!0){this.r=e,this.g=t,this.b=r,this.a=n,i||(this.r*=n,this.g*=n,this.b*=n,n||this.overwriteGetter("rgb",[e,t,r,n]))}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("string"!=typeof t)return;let r=function(e){if("transparent"===(e=e.toLowerCase().trim()))return[0,0,0,0];let t=Pr(Rr,e);if(t){let[e,r,n]=t;return[e/255,r/255,n/255,1]}if(e.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(e)){let t=e.length<6?1:2,r=1;return[zr(e.slice(r,r+=t)),zr(e.slice(r,r+=t)),zr(e.slice(r,r+=t)),zr(e.slice(r,r+t)||"ff")]}if(e.startsWith("rgb")){let t=e.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(t){let[e,r,n,i,a,s,o,l,u,h,c,p]=t,f=[i||" ",o||" ",h].join("");if(" "===f||" /"===f||",,"===f||",,,"===f){let e=[n,s,u].join(""),t="%%%"===e?100:""===e?255:0;if(t){let e=[Lr(+r/t,0,1),Lr(+a/t,0,1),Lr(+l/t,0,1),c?Vr(+c,p):1];if(Or(e))return e}}return}}let r=e.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(r){let[e,t,n,i,a,s,o,l,u]=r,h=[n||" ",a||" ",o].join("");if(" "===h||" /"===h||",,"===h||",,,"===h){let e=[+t,Lr(+i,0,100),Lr(+s,0,100),l?Vr(+l,u):1];if(Or(e))return function([e,t,r,n]){function i(n){let i=(n+e/30)%12,a=t*Math.min(r,1-r);return r-a*Math.max(-1,Math.min(i-3,9-i,1))}return e=Sr(e),t/=100,r/=100,[i(0),i(8),i(4),n]}(e)}}}(t);return r?new e(...r,!1):void 0}get rgb(){let{r:e,g:t,b:r,a:n}=this,i=n||1/0;return this.overwriteGetter("rgb",[e/i,t/i,r/i,n])}get hcl(){return this.overwriteGetter("hcl",function(e){let[t,r,n,i]=Fr(e),a=Math.sqrt(r*r+n*n);return[Math.round(1e4*a)?Sr(Math.atan2(n,r)*Er):NaN,a,t,i]}(this.rgb))}get lab(){return this.overwriteGetter("lab",Fr(this.rgb))}overwriteGetter(e,t){return Object.defineProperty(this,e,{value:t}),t}toString(){let[e,t,r,n]=this.rgb;return`rgba(${[e,t,r].map(e=>Math.round(255*e)).join(",")},${n})`}static interpolate(t,r,n,i="rgb"){switch(i){case"rgb":{let[i,a,s,o]=Nr(t.rgb,r.rgb,n);return new e(i,a,s,o,!1)}case"hcl":{let i,a,[s,o,l,u]=t.hcl,[h,c,p,f]=r.hcl;if(isNaN(s)||isNaN(h))isNaN(s)?isNaN(h)?i=NaN:(i=h,(1===l||0===l)&&(a=c)):(i=s,(1===p||0===p)&&(a=o));else{let e=h-s;h>s&&e>180?e-=360:h<s&&s-h>180&&(e+=360),i=s+n*e}let[d,y,m,g]=function([e,t,r,n]){return e=isNaN(e)?0:e*Ar,Tr([r,Math.cos(e)*t,Math.sin(e)*t,n])}([i,a??$r(o,c,n),$r(l,p,n),$r(u,f,n)]);return new e(d,y,m,g,!1)}case"lab":{let[i,a,s,o]=Tr(Nr(t.lab,r.lab,n));return new e(i,a,s,o,!1)}}}};const qr=["bottom","center","top"];var jr=class{constructor(e,t,r,n,i,a){this.text=e,this.image=t,this.scale=r,this.fontStack=n,this.textColor=i,this.verticalAlign=a}},Gr=class e{constructor(e){this.sections=e}static fromString(t){return new e([new jr(t,null,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some(e=>0!==e.text.length||e.image&&0!==e.image.name.length)}static factory(t){return t instanceof e?t:e.fromString(t)}toString(){return 0===this.sections.length?"":this.sections.map(e=>e.text).join("")}},Xr=class e{constructor(e){this.values=e.slice()}static parse(t){if(t instanceof e)return t;if("number"==typeof t)return new e([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(let e of t)if("number"!=typeof e)return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]]}return new e(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,r,n){return new e(Nr(t.values,r.values,n))}},Yr=class e{constructor(e){this.values=e.slice()}static parse(t){if(t instanceof e)return t;if("number"==typeof t)return new e([t]);if(Array.isArray(t)){for(let e of t)if("number"!=typeof e)return;return new e(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,r,n){return new e(Nr(t.values,r.values,n))}},Zr=class e{constructor(e){this.values=e.slice()}static parse(t){if(t instanceof e)return t;if("string"==typeof t){let r=Ur.parse(t);return r?new e([r]):void 0}if(!Array.isArray(t))return;let r=[];for(let e of t){if("string"!=typeof e)return;let t=Ur.parse(e);if(!t)return;r.push(t)}return new e(r)}toString(){return JSON.stringify(this.values)}static interpolate(t,r,n,i="rgb"){let a=[];if(t.values.length!=r.values.length)throw Error(`colorArray: Arrays have mismatched length (${t.values.length} vs. ${r.values.length}), cannot interpolate.`);for(let e=0;e<t.values.length;e++)a.push(Ur.interpolate(t.values[e],r.values[e],n,i));return new e(a)}},Wr=class extends Error{constructor(e,t){super(e),this.name="RuntimeError",this.path=t}toJSON(){return this.message}};const Hr=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);var Kr=class e{constructor(e){this.values=e.slice()}static parse(t){if(t instanceof e)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let e=0;e<t.length;e+=2){let r=t[e],n=t[e+1];if("string"!=typeof r||!Hr.has(r)||!Array.isArray(n)||2!==n.length||"number"!=typeof n[0]||"number"!=typeof n[1])return}return new e(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,r,n,i){let a=t.values,s=r.values;if(a.length!==s.length)throw new Wr(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${r.toString()}`,i);let o=[];for(let e=0;e<a.length;e+=2){if(a[e]!==s[e])throw new Wr(`Cannot interpolate values containing mismatched anchors. from[${e}]: ${a[e]}, to[${e}]: ${s[e]}`,i);o.push(a[e]);let[t,r]=a[e+1],[l,u]=s[e+1];o.push([$r(t,l,n),$r(r,u,n)])}return new e(o)}},Jr=class e{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(t){return t?new e({name:t,available:!1}):null}},Qr=class e{constructor(e,t,r){this.from=e,this.to=t,this.transition=r}toString(){return this.from===this.to&&1===this.transition?this.from:JSON.stringify([this.from,this.to,this.transition])}static interpolate(t,r,n){return new e(t,r,n)}static parse(t){return t instanceof e?t:Array.isArray(t)&&3===t.length&&"string"==typeof t[0]&&"string"==typeof t[1]&&"number"==typeof t[2]?new e(t[0],t[1],t[2]):"object"==typeof t&&"string"==typeof t.from&&"string"==typeof t.to&&"number"==typeof t.transition?new e(t.from,t.to,t.transition):"string"==typeof t?new e(t,t,1):void 0}},en=class{constructor(e,t,r){this.sensitivity=e?t?"variant":"case":t?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,t){return this.collator.compare(e,t)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}};function tn(e,t,r,n){return"number"==typeof e&&e>=0&&e<=255&&"number"==typeof t&&t>=0&&t<=255&&"number"==typeof r&&r>=0&&r<=255?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:`Invalid rgba value [${[e,t,r,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof n?[e,t,r,n]:[e,t,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function rn(e){if(null===e||"string"==typeof e||"boolean"==typeof e||"number"==typeof e||e instanceof Qr||e instanceof Ur||e instanceof en||e instanceof Gr||e instanceof Xr||e instanceof Yr||e instanceof Zr||e instanceof Kr||e instanceof Jr)return!0;if(Array.isArray(e)){for(let t of e)if(!rn(t))return!1;return!0}if("object"==typeof e){for(let t in e)if(!rn(e[t]))return!1;return!0}return!1}function nn(e){if(null===e)return Kt;if("string"==typeof e)return Qt;if("boolean"==typeof e)return er;if("number"==typeof e)return Jt;if(e instanceof Ur)return tr;if(e instanceof Qr)return rr;if(e instanceof en)return ar;if(e instanceof Gr)return sr;if(e instanceof Xr)return or;if(e instanceof Yr)return ur;if(e instanceof Zr)return lr;if(e instanceof Kr)return cr;if(e instanceof Jr)return hr;if(Array.isArray(e)){let t,r=e.length;for(let r of e){let e=nn(r);if(t){if(t===e)continue;t=ir;break}t=e}return pr(t||ir,r)}return nr}function an(e){let t=typeof e;return null===e?"":"string"===t||"number"===t||"boolean"===t?String(e):e instanceof Ur||e instanceof Qr||e instanceof Gr||e instanceof Xr||e instanceof Yr||e instanceof Zr||e instanceof Kr||e instanceof Jr?e.toString():JSON.stringify(e)}var sn=class e{constructor(e,t){this.type=e,this.value=t}static parse(t,r){if(2!==t.length)return r.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!rn(t[1]))return r.error(`invalid value of type "${typeof t[1]}"`);let n=t[1],i=nn(n),a=r.expectedType;return"array"===i.kind&&0===i.N&&a&&"array"===a.kind&&("number"!=typeof a.N||0===a.N)&&(i=a),new e(i,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}};const on=["Unknown","Point","LineString","Polygon"];var ln=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?"number"==typeof this.feature.type?on[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=Ur.parse(e),this._parseColorCache.set(e,t)),t}};function un(e,t,r){let n,i,a=e.length-1,s=0,o=a,l=0;for(;s<=o;)if(l=Math.floor((s+o)/2),n=e[l],i=e[l+1],n<=t){if(l===a||t<i)return l;s=l+1}else{if(!(n>t))throw new Wr("Input is not a number.",r);o=l-1}return 0}var hn=class e{constructor(e,t,r,n){this.type=e,this.input=t,this.key=n,this.labels=[],this.outputs=[];for(let[e,t]of r)this.labels.push(e),this.outputs.push(t)}static parse(t,r){if(t.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return r.error("Expected an even number of arguments.");let n=r.parse(t[1],1,Jt);if(!n)return null;let i=[],a=null;r.expectedType&&"value"!==r.expectedType.kind&&(a=r.expectedType);for(let e=1;e<t.length;e+=2){let n=1===e?-1/0:t[e],s=t[e+1],o=e,l=e+1;if("number"!=typeof n)return r.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',o);if(i.length&&i[i.length-1][0]>=n)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',o);let u=r.parse(s,l,a);if(!u)return null;a||=u.type,i.push([n,u])}return new e(a,n,i,r.key)}evaluate(e){let t=this.labels,r=this.outputs;if(1===t.length)return r[0].evaluate(e);let n=this.input.evaluate(e);if(n<=t[0])return r[0].evaluate(e);let i=t.length;return n>=t[i-1]?r[i-1].evaluate(e):r[un(t,n,this.key)].evaluate(e)}eachChild(e){e(this.input);for(let t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}},cn=class e{constructor(e,t,r,n,i,a){this.type=e,this.operator=t,this.interpolation=r,this.input=n,this.key=a,this.labels=[],this.outputs=[];for(let[e,t]of i)this.labels.push(e),this.outputs.push(t)}static interpolationFactor(e,t,r,n){let i=0;if("exponential"===e.name)i=pn(t,e.base,r,n);else if("linear"===e.name)i=pn(t,1,r,n);else if("cubic-bezier"===e.name){let a=e.controlPoints;i=function(e,t,r,n){let i=3*e,a=3*(r-e)-i,s=1-i-a,o=3*t,l=3*(n-t)-o,u=1-o-l;return function(e,t=1e-6){if(e<=0)return 0;if(e>=1)return 1;let r=e;for(let n=0;n<8;n++){let n=((s*r+a)*r+i)*r-e;if(Math.abs(n)<t)return((u*r+l)*r+o)*r;let h=(3*s*r+2*a)*r+i;if(Math.abs(h)<1e-6)break;r-=n/h}let n=0,h=1;r=e;for(let o=0;o<20;o++){let o=((s*r+a)*r+i)*r;if(Math.abs(o-e)<t)break;e>o?n=r:h=r,r=.5*(n+h)}return((u*r+l)*r+o)*r}}(a[0],a[1],a[2],a[3])(pn(t,1,r,n))}return i}static parse(t,r){let[n,i,a,...s]=t;if(!Array.isArray(i)||0===i.length)return r.error("Expected an interpolation type expression.",1);if("linear"===i[0])i={name:"linear"};else if("exponential"===i[0]){let e=i[1];if("number"!=typeof e)return r.error("Exponential interpolation requires a numeric base.",1,1);i={name:"exponential",base:e}}else{if("cubic-bezier"!==i[0])return r.error(`Unknown interpolation type ${String(i[0])}`,1,0);{let e=i.slice(1);if(4!==e.length||e.some(e=>"number"!=typeof e||e<0||e>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);i={name:"cubic-bezier",controlPoints:e}}}if(t.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(a=r.parse(a,2,Jt),!a)return null;let o=[],l=null;"interpolate-hcl"!==n&&"interpolate-lab"!==n||r.expectedType==lr?r.expectedType&&"value"!==r.expectedType.kind&&(l=r.expectedType):l=tr;for(let e=0;e<s.length;e+=2){let t=s[e],n=s[e+1],i=e+3,a=e+4;if("number"!=typeof t)return r.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',i);if(o.length&&o[o.length-1][0]>=t)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',i);let u=r.parse(n,a,l);if(!u)return null;l||=u.type,o.push([t,u])}return xr(l,Jt)||xr(l,rr)||xr(l,tr)||xr(l,or)||xr(l,ur)||xr(l,lr)||xr(l,cr)||xr(l,pr(Jt))?new e(l,n,i,a,o,r.key):r.error(`Type ${fr(l)} is not interpolatable.`)}evaluate(t){let r=this.labels,n=this.outputs;if(1===r.length)return n[0].evaluate(t);let i=this.input.evaluate(t);if(i<=r[0])return n[0].evaluate(t);let a=r.length;if(i>=r[a-1])return n[a-1].evaluate(t);let s=un(r,i,this.key),o=r[s],l=r[s+1],u=e.interpolationFactor(this.interpolation,i,o,l),h=n[s].evaluate(t),c=n[s+1].evaluate(t);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return $r(h,c,u);case"color":return Ur.interpolate(h,c,u);case"padding":return Xr.interpolate(h,c,u);case"colorArray":return Zr.interpolate(h,c,u);case"numberArray":return Yr.interpolate(h,c,u);case"variableAnchorOffsetCollection":return Kr.interpolate(h,c,u,this.key);case"array":return Nr(h,c,u);case"projectionDefinition":return Qr.interpolate(h,c,u)}case"interpolate-hcl":switch(this.type.kind){case"color":return Ur.interpolate(h,c,u,"hcl");case"colorArray":return Zr.interpolate(h,c,u,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return Ur.interpolate(h,c,u,"lab");case"colorArray":return Zr.interpolate(h,c,u,"lab")}}}eachChild(e){e(this.input);for(let t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}};function pn(e,t,r,n){let i=n-r,a=e-r;return 0===i?0:1===t?a/i:(t**+a-1)/(t**+i-1)}const fn={color:Ur.interpolate,number:$r,padding:Xr.interpolate,numberArray:Yr.interpolate,colorArray:Zr.interpolate,variableAnchorOffsetCollection:Kr.interpolate,array:Nr};var dn=class e{constructor(e){this.type=sr,this.sections=e}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let n=t[1];if(!Array.isArray(n)&&"object"==typeof n)return r.error("First argument must be an image or text section.");let i=[],a=!1;for(let e=1;e<=t.length-1;++e){let n=t[e];if(a&&"object"==typeof n&&!Array.isArray(n)){a=!1;let e=null;if(n["font-scale"]&&(e=r.parse(n["font-scale"],1,Jt),!e))return null;let t=null;if(n["text-font"]&&(t=r.parse(n["text-font"],1,pr(Qt)),!t))return null;let s=null;if(n["text-color"]&&(s=r.parse(n["text-color"],1,tr),!s))return null;let o=null;if(n["vertical-align"]){if("string"==typeof n["vertical-align"]&&!qr.includes(n["vertical-align"]))return r.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${n["vertical-align"]}' instead.`);if(o=r.parse(n["vertical-align"],1,Qt),!o)return null}let l=i[i.length-1];l.scale=e,l.font=t,l.textColor=s,l.verticalAlign=o}else{let n=r.parse(t[e],1,ir);if(!n)return null;let s=n.type.kind;if("string"!==s&&"value"!==s&&"null"!==s&&"resolvedImage"!==s)return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");a=!0,i.push({content:n,scale:null,font:null,textColor:null,verticalAlign:null})}}return new e(i)}evaluate(e){return new Gr(this.sections.map(t=>{let r=t.content.evaluate(e);return nn(r)===hr?new jr("",r,null,null,null,t.verticalAlign?t.verticalAlign.evaluate(e):null):new jr(an(r),null,t.scale?t.scale.evaluate(e):null,t.font?t.font.evaluate(e).join(","):null,t.textColor?t.textColor.evaluate(e):null,t.verticalAlign?t.verticalAlign.evaluate(e):null)}))}eachChild(e){for(let t of this.sections)e(t.content),t.scale&&e(t.scale),t.font&&e(t.font),t.textColor&&e(t.textColor),t.verticalAlign&&e(t.verticalAlign)}outputDefined(){return!1}};function yn(e,t,r=0,n=e.length-1,i=gn){for(;n>r;){if(n-r>600){let a=n-r+1,s=t-r+1,o=Math.log(a),l=.5*Math.exp(2*o/3),u=.5*Math.sqrt(o*l*(a-l)/a)*(s-a/2<0?-1:1);yn(e,t,Math.max(r,Math.floor(t-s*l/a+u)),Math.min(n,Math.floor(t+(a-s)*l/a+u)),i)}let a=e[t],s=r,o=n;for(mn(e,r,t),i(e[n],a)>0&&mn(e,r,n);s<o;){for(mn(e,s,o),s++,o--;i(e[s],a)<0;)s++;for(;i(e[o],a)>0;)o--}0===i(e[r],a)?mn(e,r,o):(o++,mn(e,o,n)),o<=t&&(r=o+1),t<=o&&(n=o-1)}}function mn(e,t,r){let n=e[t];e[t]=e[r],e[r]=n}function gn(e,t){return e<t?-1:+(e>t)}function xn(e,t){if(e.length<=1)return[e];let r,n,i=[];for(let t of e){let e=bn(t);0!==e&&(t.area=Math.abs(e),void 0===n&&(n=e<0),n===e<0?(r&&i.push(r),r=[t]):r.push(t))}if(r&&i.push(r),t>1)for(let e=0;e<i.length;e++)i[e].length<=t||(yn(i[e],t,1,i[e].length-1,vn),i[e]=i[e].slice(0,t));return i}function vn(e,t){return t.area-e.area}function bn(e){let t=0;for(let r,n,i=0,a=e.length,s=a-1;i<a;s=i++)r=e[i],n=e[s],t+=(n.x-r.x)*(r.y+n.y);return t}const wn={string:Qt,number:Jt,boolean:er,object:nr};var Dn=class e{constructor(e,t,r){this.type=e,this.args=t,this.key=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let n,i=1,a=t[0];if("array"===a){let e,a;if(t.length>2){let n=t[1];if("string"!=typeof n||!(n in wn)||"object"===n)return r.error('The item type argument of "array" must be one of string, number, boolean',1);e=wn[n],i++}else e=ir;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return r.error('The length argument to "array" must be a positive integer literal',2);a=t[2],i++}n=pr(e,a)}else{if(!wn[a])throw Error(`Types doesn't contain name = ${a}`);n=wn[a]}let s=[];for(;i<t.length;i++){let e=r.parse(t[i],i,ir);if(!e)return null;s.push(e)}return new e(n,s,r.key)}evaluate(e){for(let t=0;t<this.args.length;t++){let r=this.args[t].evaluate(e);if(!yr(this.type,nn(r)))return r;if(t===this.args.length-1)throw new Wr(`Expected value to be of type ${fr(this.type)}, but found ${fr(nn(r))} instead.`,this.key)}throw Error()}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}};const _n={"to-boolean":er,"to-color":tr,"to-number":Jt,"to-string":Qt};var An=class e{constructor(e,t,r){this.type=e,this.args=t,this.key=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let n=t[0];if(!_n[n])throw Error(`Can't parse ${n} as it is not part of the known types`);if(("to-boolean"===n||"to-string"===n)&&2!==t.length)return r.error("Expected one argument.");let i=_n[n],a=[];for(let e=1;e<t.length;e++){let n=r.parse(t[e],e,ir);if(!n)return null;a.push(n)}return new e(i,a,r.key)}evaluate(e){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(e);case"color":{let t,r;for(let n of this.args){if(t=n.evaluate(e),r=null,t instanceof Ur)return t;if("string"==typeof t){let r=e.parseColor(t);if(r)return r}else if(Array.isArray(t)&&(r=t.length<3||t.length>4?`Invalid rgba value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:tn(t[0],t[1],t[2],t[3]),!r))return new Ur(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new Wr(r||`Could not parse color from value '${"string"==typeof t?t:JSON.stringify(t)}'`,this.key)}case"padding":{let t;for(let r of this.args){t=r.evaluate(e);let n=Xr.parse(t);if(n)return n}throw new Wr(`Could not parse padding from value '${"string"==typeof t?t:JSON.stringify(t)}'`,this.key)}case"numberArray":{let t;for(let r of this.args){t=r.evaluate(e);let n=Yr.parse(t);if(n)return n}throw new Wr(`Could not parse numberArray from value '${"string"==typeof t?t:JSON.stringify(t)}'`,this.key)}case"colorArray":{let t;for(let r of this.args){t=r.evaluate(e);let n=Zr.parse(t);if(n)return n}throw new Wr(`Could not parse colorArray from value '${"string"==typeof t?t:JSON.stringify(t)}'`,this.key)}case"variableAnchorOffsetCollection":{let t;for(let r of this.args){t=r.evaluate(e);let n=Kr.parse(t);if(n)return n}throw new Wr(`Could not parse variableAnchorOffsetCollection from value '${"string"==typeof t?t:JSON.stringify(t)}'`,this.key)}case"number":{let t=null;for(let r of this.args){if(t=r.evaluate(e),null===t)return 0;let n=Number(t);if(!isNaN(n))return n}throw new Wr(`Could not convert ${JSON.stringify(t)} to number.`,this.key)}case"formatted":return Gr.fromString(an(this.args[0].evaluate(e)));case"resolvedImage":return Jr.fromString(an(this.args[0].evaluate(e)));case"projectionDefinition":{let t=this.args[0].evaluate(e);if(Qr.parse(t))return t;throw new Wr(`Could not parse projectionDefinition from value '${"string"==typeof t?t:JSON.stringify(t)}'`,this.key)}default:return an(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},En=class e{constructor(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(let t of this.bindings)e(t[1]);e(this.result)}static parse(t,r){if(t.length<4)return r.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);let n=[];for(let e=1;e<t.length-1;e+=2){let i=t[e];if("string"!=typeof i)return r.error(`Expected string, but found ${typeof i} instead.`,e);if(/[^a-zA-Z0-9_]/.test(i))return r.error("Variable names must contain only alphanumeric characters or '_'.",e);let a=r.parse(t[e+1],e+1);if(!a)return null;n.push([i,a])}let i=r.parse(t[t.length-1],t.length-1,r.expectedType,n);return i?new e(n,i):null}outputDefined(){return this.result.outputDefined()}},Sn=class e{constructor(e,t){this.type=t.type,this.name=e,this.boundExpression=t}static parse(t,r){if(2!==t.length||"string"!=typeof t[1])return r.error("'var' expression requires exactly one string literal argument.");let n=t[1];return r.scope.has(n)?new e(n,r.scope.get(n)):r.error(`Unknown variable "${n}". Make sure "${n}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}},Fn=class e{constructor(e,t){this.type=e,this.args=t}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let n=null,i=r.expectedType;i&&"value"!==i.kind&&(n=i);let a=[];for(let e of t.slice(1)){let t=r.parse(e,1+a.length,n,void 0,{typeAnnotation:"omit"});if(!t)return null;n||=t.type,a.push(t)}if(!n)throw Error("No output type");return i&&a.some(e=>yr(i,e.type))?new e(ir,a):new e(n,a)}evaluate(e){let t,r=null,n=0;for(let i of this.args)if(n++,r=i.evaluate(e),r&&r instanceof Jr&&!r.available&&(t||=r.name,r=null,n===this.args.length&&(r=t)),null!==r)break;return r}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}};function kn(e,t){return"=="===e||"!="===e?"boolean"===t.kind||"string"===t.kind||"number"===t.kind||"null"===t.kind||"value"===t.kind:"string"===t.kind||"number"===t.kind||"value"===t.kind}function In(e,t,r,n){return 0===n.compare(t,r)}function Tn(e,t,r){let n="=="!==e&&"!="!==e;return class i{constructor(e,t,r,n){this.lhs=e,this.rhs=t,this.key=r,this.collator=n,this.type=er,this.hasUntypedArgument="value"===e.type.kind||"value"===t.type.kind}static parse(e,t){if(3!==e.length&&4!==e.length)return t.error("Expected two or three arguments.");let r=e[0],a=t.parse(e[1],1,ir);if(!a)return null;if(!kn(r,a.type))return t.concat(1).error(`"${r}" comparisons are not supported for type '${fr(a.type)}'.`);let s=t.parse(e[2],2,ir);if(!s)return null;if(!kn(r,s.type))return t.concat(2).error(`"${r}" comparisons are not supported for type '${fr(s.type)}'.`);if(a.type.kind!==s.type.kind&&"value"!==a.type.kind&&"value"!==s.type.kind)return t.error(`Cannot compare types '${fr(a.type)}' and '${fr(s.type)}'.`);n&&("value"===a.type.kind&&"value"!==s.type.kind?a=new Dn(s.type,[a],t.key):"value"!==a.type.kind&&"value"===s.type.kind&&(s=new Dn(a.type,[s],t.key)));let o=null;if(4===e.length){if("string"!==a.type.kind&&"string"!==s.type.kind&&"value"!==a.type.kind&&"value"!==s.type.kind)return t.error("Cannot use collator to compare non-string types.");if(o=t.parse(e[3],3,ar),!o)return null}return new i(a,s,t.key,o)}evaluate(i){let a=this.lhs.evaluate(i),s=this.rhs.evaluate(i);if(n&&this.hasUntypedArgument){let t=nn(a),r=nn(s);if(t.kind!==r.kind||"string"!==t.kind&&"number"!==t.kind)throw new Wr(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${t.kind}, ${r.kind}) instead.`,this.key)}if(this.collator&&!n&&this.hasUntypedArgument){let e=nn(a),r=nn(s);if("string"!==e.kind||"string"!==r.kind)return t(i,a,s)}return this.collator?r(i,a,s,this.collator.evaluate(i)):t(i,a,s)}eachChild(e){e(this.lhs),e(this.rhs),this.collator&&e(this.collator)}outputDefined(){return!0}}}const Mn=Tn("==",function(e,t,r){return t===r},In),Cn=Tn("!=",function(e,t,r){return t!==r},function(e,t,r,n){return!In(0,t,r,n)}),Bn=Tn("<",function(e,t,r){return t<r},function(e,t,r,n){return n.compare(t,r)<0}),Pn=Tn(">",function(e,t,r){return t>r},function(e,t,r,n){return n.compare(t,r)>0}),zn=Tn("<=",function(e,t,r){return t<=r},function(e,t,r,n){return n.compare(t,r)<=0}),Vn=Tn(">=",function(e,t,r){return t>=r},function(e,t,r,n){return n.compare(t,r)>=0});var Ln=class e{constructor(e,t,r){this.type=ar,this.locale=r,this.caseSensitive=e,this.diacriticSensitive=t}static parse(t,r){if(2!==t.length)return r.error("Expected one argument.");let n=t[1];if("object"!=typeof n||Array.isArray(n))return r.error("Collator options argument must be an object.");let i=r.parse(void 0!==n["case-sensitive"]&&n["case-sensitive"],1,er);if(!i)return null;let a=r.parse(void 0!==n["diacritic-sensitive"]&&n["diacritic-sensitive"],1,er);if(!a)return null;let s=null;return n.locale&&(s=r.parse(n.locale,1,Qt),!s)?null:new e(i,a,s)}evaluate(e){return new en(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}};const On=8192;function Rn(e,t){let r=function(e){return(180+e)/360}(e[0]),n=function(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}(e[1]),i=2**t.z;return[Math.round(r*i*On),Math.round(n*i*On)]}function $n(e,t){let r=2**t.z,n=(e[0]/On+t.x)/r,i=(e[1]/On+t.y)/r;return[Nn(n),Un(i)]}function Nn(e){return 360*e-180}function Un(e){return 360/Math.PI*Math.atan(Math.exp((180-360*e)*Math.PI/180))-90}function qn(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 Gn(e,t,r){return t[1]>e[1]!=r[1]>e[1]&&e[0]<(r[0]-t[0])*(e[1]-t[1])/(r[1]-t[1])+t[0]}function Xn(e,t,r){let n=e[0]-t[0],i=e[1]-t[1],a=e[0]-r[0],s=e[1]-r[1];return n*s-a*i===0&&n*a<=0&&i*s<=0}function Yn(e,t,r,n){let i=[t[0]-e[0],t[1]-e[1]];return 0!==function(e,t){return e[0]*t[1]-e[1]*t[0]}([n[0]-r[0],n[1]-r[1]],i)&&!(!Qn(e,t,r,n)||!Qn(r,n,e,t))}function Zn(e,t,r){for(let n of r)for(let r=0;r<n.length-1;++r)if(Yn(e,t,n[r],n[r+1]))return!0;return!1}function Wn(e,t,r=!1){let n=!1;for(let i of t)for(let t=0;t<i.length-1;t++){if(Xn(e,i[t],i[t+1]))return r;Gn(e,i[t],i[t+1])&&(n=!n)}return n}function Hn(e,t){for(let r of t)if(Wn(e,r))return!0;return!1}function Kn(e,t){for(let r of e)if(!Wn(r,t))return!1;for(let r=0;r<e.length-1;++r)if(Zn(e[r],e[r+1],t))return!1;return!0}function Jn(e,t){for(let r of t)if(Kn(e,r))return!0;return!1}function Qn(e,t,r,n){let i=e[0]-r[0],a=e[1]-r[1],s=t[0]-r[0],o=t[1]-r[1],l=n[0]-r[0],u=n[1]-r[1],h=i*u-l*a,c=s*u-l*o;return h>0&&c<0||h<0&&c>0}function ei(e,t,r){let n=[];for(let i=0;i<e.length;i++){let a=[];for(let n=0;n<e[i].length;n++){let s=Rn(e[i][n],r);qn(t,s),a.push(s)}n.push(a)}return n}function ti(e,t,r){let n=[];for(let i=0;i<e.length;i++){let a=ei(e[i],t,r);n.push(a)}return n}function ri(e,t,r,n){if(e[0]<r[0]||e[0]>r[2]){let t=.5*n,i=e[0]-r[0]>t?-n:r[0]-e[0]>t?n:0;0===i&&(i=e[0]-r[2]>t?-n:r[2]-e[0]>t?n:0),e[0]+=i}qn(t,e)}function ni(e,t,r,n){let i=2**n.z*On,a=[n.x*On,n.y*On],s=[];for(let n of e)for(let e of n){let n=[e.x+a[0],e.y+a[1]];ri(n,t,r,i),s.push(n)}return s}function ii(e,t,r,n){let i=2**n.z*On,a=[n.x*On,n.y*On],s=[];for(let r of e){let e=[];for(let n of r){let r=[n.x+a[0],n.y+a[1]];qn(t,r),e.push(r)}s.push(e)}if(t[2]-t[0]<=i/2){!function(e){e[0]=e[1]=1/0,e[2]=e[3]=-1/0}(t);for(let e of s)for(let n of e)ri(n,t,r,i)}return s}var ai=class e{constructor(e,t){this.type=er,this.geojson=e,this.geometries=t}static parse(t,r){if(2!==t.length)return r.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(rn(t[1])){let r=t[1];if("FeatureCollection"===r.type){let t=[];for(let e of r.features){let{type:r,coordinates:n}=e.geometry;"Polygon"===r&&t.push(n),"MultiPolygon"===r&&t.push(...n)}if(t.length)return new e(r,{type:"MultiPolygon",coordinates:t})}else if("Feature"===r.type){let t=r.geometry.type;if("Polygon"===t||"MultiPolygon"===t)return new e(r,r.geometry)}else if("Polygon"===r.type||"MultiPolygon"===r.type)return new e(r,r)}return r.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(null!=e.geometry()&&null!=e.canonicalID()){if("Point"===e.geometryType())return function(e,t){let r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=e.canonicalID();if("Polygon"===t.type){let a=ei(t.coordinates,n,i),s=ni(e.geometry(),r,n,i);if(!jn(r,n))return!1;for(let e of s)if(!Wn(e,a))return!1}if("MultiPolygon"===t.type){let a=ti(t.coordinates,n,i),s=ni(e.geometry(),r,n,i);if(!jn(r,n))return!1;for(let e of s)if(!Hn(e,a))return!1}return!0}(e,this.geometries);if("LineString"===e.geometryType())return function(e,t){let r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=e.canonicalID();if("Polygon"===t.type){let a=ei(t.coordinates,n,i),s=ii(e.geometry(),r,n,i);if(!jn(r,n))return!1;for(let e of s)if(!Kn(e,a))return!1}if("MultiPolygon"===t.type){let a=ti(t.coordinates,n,i),s=ii(e.geometry(),r,n,i);if(!jn(r,n))return!1;for(let e of s)if(!Jn(e,a))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}},si=class{constructor(e=[],t=(e,t)=>e<t?-1:+(e>t)){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(0===this.length)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:r}=this,n=t[e];for(;e>0;){let i=e-1>>1,a=t[i];if(r(n,a)>=0)break;t[e]=a,e=i}t[e]=n}_down(e){let{data:t,compare:r}=this,n=this.length>>1,i=t[e];for(;e<n;){let n=1+(e<<1),a=n+1;if(a<this.length&&r(t[a],t[n])<0&&(n=a),r(t[n],i)>=0)break;t[e]=t[n],e=n}t[e]=i}};const oi=Math.PI/180;var li=class{constructor(e){let t=6378.137*oi*1e3,r=Math.cos(e*oi),n=1/(1-.0066943799901413165*(1-r*r)),i=Math.sqrt(n);this.kx=t*i*r,this.ky=t*i*n*.9933056200098587}distance(e,t){let r=this.wrap(e[0]-t[0])*this.kx,n=(e[1]-t[1])*this.ky;return Math.sqrt(r*r+n*n)}pointOnLine(e,t){let r,n,i,a,s=1/0;for(let o=0;o<e.length-1;o++){let l=e[o][0],u=e[o][1],h=this.wrap(e[o+1][0]-l)*this.kx,c=(e[o+1][1]-u)*this.ky,p=0;(0!==h||0!==c)&&(p=(this.wrap(t[0]-l)*this.kx*h+(t[1]-u)*this.ky*c)/(h*h+c*c),p>1?(l=e[o+1][0],u=e[o+1][1]):p>0&&(l+=h/this.kx*p,u+=c/this.ky*p)),h=this.wrap(t[0]-l)*this.kx,c=(t[1]-u)*this.ky;let f=h*h+c*c;f<s&&(s=f,r=l,n=u,i=o,a=p)}return{point:[r,n],index:i,t:Math.max(0,Math.min(1,a))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}};function ui(e,t){return t[0]-e[0]}function hi(e){return e[1]-e[0]+1}function ci(e,t){return e[1]>=e[0]&&e[1]<t}function pi(e,t){if(e[0]>e[1])return[null,null];let r=hi(e);if(t){if(2===r)return[e,null];let t=Math.floor(r/2);return[[e[0],e[0]+t],[e[0]+t,e[1]]]}if(1===r)return[e,null];let n=Math.floor(r/2)-1;return[[e[0],e[0]+n],[e[0]+n+1,e[1]]]}function fi(e,t){if(!ci(t,e.length))return[1/0,1/0,-1/0,-1/0];let r=[1/0,1/0,-1/0,-1/0];for(let n=t[0];n<=t[1];++n)qn(r,e[n]);return r}function di(e){let t=[1/0,1/0,-1/0,-1/0];for(let r of e)for(let e of r)qn(t,e);return t}function yi(e){return e[0]!==-1/0&&e[1]!==-1/0&&e[2]!==1/0&&e[3]!==1/0}function mi(e,t,r){if(!yi(e)||!yi(t))return NaN;let n=0,i=0;return e[2]<t[0]&&(n=t[0]-e[2]),e[0]>t[2]&&(n=e[0]-t[2]),e[1]>t[3]&&(i=e[1]-t[3]),e[3]<t[1]&&(i=t[1]-e[3]),r.distance([0,0],[n,i])}function gi(e,t,r){let n=r.pointOnLine(t,e);return r.distance(e,n.point)}function xi(e,t,r,n,i){let a=Math.min(gi(e,[r,n],i),gi(t,[r,n],i)),s=Math.min(gi(r,[e,t],i),gi(n,[e,t],i));return Math.min(a,s)}function vi(e,t,r,n,i){if(!ci(t,e.length)||!ci(n,r.length))return 1/0;let a=1/0;for(let s=t[0];s<t[1];++s){let t=e[s],o=e[s+1];for(let e=n[0];e<n[1];++e){let n=r[e],s=r[e+1];if(Yn(t,o,n,s))return 0;a=Math.min(a,xi(t,o,n,s,i))}}return a}function bi(e,t,r,n,i){if(!ci(t,e.length)||!ci(n,r.length))return NaN;let a=1/0;for(let s=t[0];s<=t[1];++s)for(let t=n[0];t<=n[1];++t)if(a=Math.min(a,i.distance(e[s],r[t])),0===a)return a;return a}function wi(e,t,r){if(Wn(e,t,!0))return 0;let n=1/0;for(let i of t){let t=i[0],a=i[i.length-1];if(t!==a&&(n=Math.min(n,gi(e,[a,t],r)),0===n))return n;let s=r.pointOnLine(i,e);if(n=Math.min(n,r.distance(e,s.point)),0===n)return n}return n}function Di(e,t,r,n){if(!ci(t,e.length))return NaN;for(let n=t[0];n<=t[1];++n)if(Wn(e[n],r,!0))return 0;let i=1/0;for(let a=t[0];a<t[1];++a){let t=e[a],s=e[a+1];for(let e of r)for(let r=0,a=e.length,o=a-1;r<a;o=r++){let a=e[o],l=e[r];if(Yn(t,s,a,l))return 0;i=Math.min(i,xi(t,s,a,l,n))}}return i}function _i(e,t){for(let r of e)for(let e of r)if(Wn(e,t,!0))return!0;return!1}function Ai(e,t,r,n=1/0){let i=di(e),a=di(t);if(n!==1/0&&mi(i,a,r)>=n)return n;if(jn(i,a)){if(_i(e,t))return 0}else if(_i(t,e))return 0;let s=1/0;for(let n of e)for(let e=0,i=n.length,a=i-1;e<i;a=e++){let i=n[a],o=n[e];for(let e of t)for(let t=0,n=e.length,a=n-1;t<n;a=t++){let n=e[a],l=e[t];if(Yn(i,o,n,l))return 0;s=Math.min(s,xi(i,o,n,l,r))}}return s}function Ei(e,t,r,n,i,a){if(!a)return;let s=mi(fi(n,a),i,r);s<t&&e.push([s,a,[0,0]])}function Si(e,t,r,n,i,a,s){if(!a||!s)return;let o=mi(fi(n,a),fi(i,s),r);o<t&&e.push([o,a,s])}function Fi(e,t,r,n,i=1/0){let a=Math.min(n.distance(e[0],r[0][0]),i);if(0===a)return a;let s=new si([[0,[0,e.length-1],[0,0]]],ui),o=di(r);for(;s.length>0;){let i=s.pop();if(i[0]>=a)continue;let l=i[1],u=t?50:100;if(hi(l)<=u){if(!ci(l,e.length))return NaN;if(t){let t=Di(e,l,r,n);if(isNaN(t)||0===t)return t;a=Math.min(a,t)}else for(let t=l[0];t<=l[1];++t){let i=wi(e[t],r,n);if(a=Math.min(a,i),0===a)return 0}}else{let r=pi(l,t);Ei(s,a,n,e,o,r[0]),Ei(s,a,n,e,o,r[1])}}return a}function ki(e,t,r,n,i,a=1/0){let s=Math.min(a,i.distance(e[0],r[0]));if(0===s)return s;let o=new si([[0,[0,e.length-1],[0,r.length-1]]],ui);for(;o.length>0;){let a=o.pop();if(a[0]>=s)continue;let l=a[1],u=a[2],h=t?50:100,c=n?50:100;if(hi(l)<=h&&hi(u)<=c){if(!ci(l,e.length)&&ci(u,r.length))return NaN;let a;if(t&&n)a=vi(e,l,r,u,i),s=Math.min(s,a);else if(t&&!n){let t=e.slice(l[0],l[1]+1);for(let e=u[0];e<=u[1];++e)if(a=gi(r[e],t,i),s=Math.min(s,a),0===s)return s}else if(!t&&n){let t=r.slice(u[0],u[1]+1);for(let r=l[0];r<=l[1];++r)if(a=gi(e[r],t,i),s=Math.min(s,a),0===s)return s}else a=bi(e,l,r,u,i),s=Math.min(s,a)}else{let a=pi(l,t),h=pi(u,n);Si(o,s,i,e,r,a[0],h[0]),Si(o,s,i,e,r,a[0],h[1]),Si(o,s,i,e,r,a[1],h[0]),Si(o,s,i,e,r,a[1],h[1])}}return s}function Ii(e){return"MultiPolygon"===e.type?e.coordinates.map(e=>({type:"Polygon",coordinates:e})):"MultiLineString"===e.type?e.coordinates.map(e=>({type:"LineString",coordinates:e})):"MultiPoint"===e.type?e.coordinates.map(e=>({type:"Point",coordinates:e})):[e]}var Ti=class e{constructor(e,t){this.type=Jt,this.geojson=e,this.geometries=t}static parse(t,r){if(2!==t.length)return r.error(`'distance' expression requires exactly one argument, but found ${t.length-1} instead.`);if(rn(t[1])){let r=t[1];if("FeatureCollection"===r.type)return new e(r,r.features.map(e=>Ii(e.geometry)).flat());if("Feature"===r.type)return new e(r,Ii(r.geometry));if("type"in r&&"coordinates"in r)return new e(r,Ii(r))}return r.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(null!=e.geometry()&&null!=e.canonicalID()){if("Point"===e.geometryType())return function(e,t){let r=e.geometry(),n=r.flat().map(t=>$n([t.x,t.y],e.canonical));if(0===r.length)return NaN;let i=new li(n[0][1]),a=1/0;for(let e of t){switch(e.type){case"Point":a=Math.min(a,ki(n,!1,[e.coordinates],!1,i,a));break;case"LineString":a=Math.min(a,ki(n,!1,e.coordinates,!0,i,a));break;case"Polygon":a=Math.min(a,Fi(n,!1,e.coordinates,i,a))}if(0===a)return a}return a}(e,this.geometries);if("LineString"===e.geometryType())return function(e,t){let r=e.geometry(),n=r.flat().map(t=>$n([t.x,t.y],e.canonical));if(0===r.length)return NaN;let i=new li(n[0][1]),a=1/0;for(let e of t){switch(e.type){case"Point":a=Math.min(a,ki(n,!0,[e.coordinates],!1,i,a));break;case"LineString":a=Math.min(a,ki(n,!0,e.coordinates,!0,i,a));break;case"Polygon":a=Math.min(a,Fi(n,!0,e.coordinates,i,a))}if(0===a)return a}return a}(e,this.geometries);if("Polygon"===e.geometryType())return function(e,t){let r=e.geometry();if(0===r.length||0===r[0].length)return NaN;let n=xn(r,0).map(t=>t.map(t=>t.map(t=>$n([t.x,t.y],e.canonical)))),i=new li(n[0][0][0][1]),a=1/0;for(let e of t)for(let t of n){switch(e.type){case"Point":a=Math.min(a,Fi([e.coordinates],!1,t,i,a));break;case"LineString":a=Math.min(a,Fi(e.coordinates,!0,t,i,a));break;case"Polygon":a=Math.min(a,Ai(t,e.coordinates,i,a))}if(0===a)return a}return a}(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}},Mi=class e{constructor(e){this.key=e,this.type=ir}static parse(t,r){if(2!==t.length)return r.error(`Expected 1 argument, but found ${t.length-1} instead.`);let n=t[1];return null==n?r.error("Global state property must be defined."):"string"==typeof n?new e(n):r.error(`Global state property must be string, but found ${typeof t[1]} instead.`)}evaluate(e){let t=e.globals?.globalState;return t&&0!==Object.keys(t).length?Pr(t,this.key)??null:null}eachChild(){}outputDefined(){return!1}};const Ci={"==":Mn,"!=":Cn,">":Pn,"<":Bn,">=":Vn,"<=":zn,array:Dn,at:class e{constructor(e,t,r,n){this.type=e,this.index=t,this.input=r,this.key=n}static parse(t,r){if(3!==t.length)return r.error(`Expected 2 arguments, but found ${t.length-1} instead.`);let n=r.parse(t[1],1,Jt),i=r.parse(t[2],2,pr(r.expectedType||ir));if(!n||!i)return null;let a=i.type;return new e(a.itemType,n,i,r.key)}evaluate(e){let t=this.index.evaluate(e),r=this.input.evaluate(e);if(t<0)throw new Wr(`Array index out of bounds: ${t} < 0.`,this.key);if(t>=r.length)throw new Wr(`Array index out of bounds: ${t} > ${r.length-1}.`,this.key);if(t!==Math.floor(t))throw new Wr(`Array index must be an integer, but found ${t} instead.`,this.key);return r[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}},boolean:Dn,case:class e{constructor(e,t,r){this.type=e,this.branches=t,this.otherwise=r}static parse(t,r){if(t.length<4)return r.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return r.error("Expected an odd number of arguments.");let n;r.expectedType&&"value"!==r.expectedType.kind&&(n=r.expectedType);let i=[];for(let e=1;e<t.length-1;e+=2){let a=r.parse(t[e],e,er);if(!a)return null;let s=r.parse(t[e+1],e+1,n);if(!s)return null;i.push([a,s]),n||=s.type}let a=r.parse(t[t.length-1],t.length-1,n);if(!a)return null;if(!n)throw Error("Can't infer output type");return new e(n,i,a)}evaluate(e){for(let[t,r]of this.branches)if(t.evaluate(e))return r.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(let[t,r]of this.branches)e(t),e(r);e(this.otherwise)}outputDefined(){return this.branches.every(([e,t])=>t.outputDefined())&&this.otherwise.outputDefined()}},coalesce:Fn,collator:Ln,format:dn,image:class e{constructor(e){this.type=hr,this.input=e}static parse(t,r){if(2!==t.length)return r.error("Expected two arguments.");let n=r.parse(t[1],1,Qt);return n?new e(n):r.error("No image name provided.")}evaluate(e){let t=this.input.evaluate(e),r=Jr.fromString(t);return r&&e.availableImages&&(r.available=e.availableImages.indexOf(t)>-1),r}eachChild(e){e(this.input)}outputDefined(){return!1}},in:class e{constructor(e,t,r){this.needle=e,this.haystack=t,this.key=r,this.type=er}static parse(t,r){if(3!==t.length)return r.error(`Expected 2 arguments, but found ${t.length-1} instead.`);let n=r.parse(t[1],1,ir),i=r.parse(t[2],2,ir);return n&&i?mr(n.type,[er,Qt,Jt,Kt,ir])?new e(n,i,r.key):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${fr(n.type)} instead`):null}evaluate(e){let t=this.needle.evaluate(e),r=this.haystack.evaluate(e);if(!r)return!1;if(!gr(t,["boolean","string","number","null"]))throw new Wr(`Expected first argument to be of type boolean, string, number or null, but found ${fr(nn(t))} instead.`,this.key);if(!gr(r,["string","array"]))throw new Wr(`Expected second argument to be of type array or string, but found ${fr(nn(r))} instead.`,this.key);return r.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}},"index-of":class e{constructor(e,t,r,n){this.needle=e,this.haystack=t,this.key=r,this.fromIndex=n,this.type=Jt}static parse(t,r){if(t.length<=2||t.length>=5)return r.error(`Expected 2 or 3 arguments, but found ${t.length-1} instead.`);let n=r.parse(t[1],1,ir),i=r.parse(t[2],2,ir);if(!n||!i)return null;if(!mr(n.type,[er,Qt,Jt,Kt,ir]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${fr(n.type)} instead`);if(4===t.length){let a=r.parse(t[3],3,Jt);return a?new e(n,i,r.key,a):null}return new e(n,i,r.key)}evaluate(e){let t,r=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!gr(r,["boolean","string","number","null"]))throw new Wr(`Expected first argument to be of type boolean, string, number or null, but found ${fr(nn(r))} instead.`,this.key);if(this.fromIndex&&(t=this.fromIndex.evaluate(e)),gr(n,["string"])){let e=n.indexOf(r,t);return-1===e?-1:[...n.slice(0,e)].length}if(gr(n,["array"]))return n.indexOf(r,t);throw new Wr(`Expected second argument to be of type array or string, but found ${fr(nn(n))} instead.`,this.key)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}},interpolate:cn,"interpolate-hcl":cn,"interpolate-lab":cn,length:class e{constructor(e,t){this.input=e,this.key=t,this.type=Jt}static parse(t,r){if(2!==t.length)return r.error(`Expected 1 argument, but found ${t.length-1} instead.`);let n=r.parse(t[1],1);return n?"array"!==n.type.kind&&"string"!==n.type.kind&&"value"!==n.type.kind?r.error(`Expected argument of type string or array, but found ${fr(n.type)} instead.`):new e(n,r.key):null}evaluate(e){let t=this.input.evaluate(e);if("string"==typeof t)return[...t].length;if(Array.isArray(t))return t.length;throw new Wr(`Expected value to be of type string or array, but found ${fr(nn(t))} instead.`,this.key)}eachChild(e){e(this.input)}outputDefined(){return!1}},let:En,literal:sn,match:class e{constructor(e,t,r,n,i,a){this.inputType=e,this.type=t,this.input=r,this.cases=n,this.outputs=i,this.otherwise=a}static parse(t,r){if(t.length<5)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return r.error("Expected an even number of arguments.");let n,i;r.expectedType&&"value"!==r.expectedType.kind&&(i=r.expectedType);let a={},s=[];for(let e=2;e<t.length-1;e+=2){let o=t[e],l=t[e+1];Array.isArray(o)||(o=[o]);let u=r.concat(e);if(0===o.length)return u.error("Expected at least one branch label.");for(let e of o){if("number"!=typeof e&&"string"!=typeof e)return u.error("Branch labels must be numbers or strings.");if("number"==typeof e&&Math.abs(e)>2**53-1)return u.error(`Branch labels must be integers no larger than ${2**53-1}.`);if("number"==typeof e&&Math.floor(e)!==e)return u.error("Numeric branch labels must be integer values.");if(n){if(u.checkSubtype(n,nn(e)))return null}else n=nn(e);if(void 0!==a[String(e)])return u.error("Branch labels must be unique.");a[String(e)]=s.length}let h=r.parse(l,e,i);if(!h)return null;i||=h.type,s.push(h)}let o=r.parse(t[1],1,ir);if(!o)return null;let l=r.parse(t[t.length-1],t.length-1,i);return!l||"value"!==o.type.kind&&r.concat(1).checkSubtype(n,o.type)?null:new e(n,i,o,a,s,l)}evaluate(e){let t=this.input.evaluate(e);return(nn(t)===this.inputType&&this.outputs[this.cases[t]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}},number:Dn,"number-format":class e{constructor(e,t,r,n,i,a){this.type=Qt,this.number=e,this.locale=t,this.currency=r,this.unit=n,this.minFractionDigits=i,this.maxFractionDigits=a}static parse(t,r){if(3!==t.length)return r.error("Expected two arguments.");let n=r.parse(t[1],1,Jt);if(!n)return null;let i=t[2];if("object"!=typeof i||Array.isArray(i))return r.error("NumberFormat options argument must be an object.");let a=null;if(i.locale&&(a=r.parse(i.locale,1,Qt),!a))return null;let s=null;if(i.currency&&(s=r.parse(i.currency,1,Qt),!s))return null;let o=null;if(i.unit&&(o=r.parse(i.unit,1,Qt),!o))return null;if(s&&o)return r.error("NumberFormat options `currency` and `unit` are mutually exclusive");let l=null;if(i["min-fraction-digits"]&&(l=r.parse(i["min-fraction-digits"],1,Jt),!l))return null;let u=null;return i["max-fraction-digits"]&&(u=r.parse(i["max-fraction-digits"],1,Jt),!u)?null:new e(n,a,s,o,l,u)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":this.unit?"unit":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}},object:Dn,semiliteral:class e{constructor(e){let t=null;for(let r of e){if(t){if(t===r.type)continue;t=ir;break}t=r.type}this.type=pr(t??ir,e.length),this.arr=e}static parse(t,r){if(2!==t.length)return r.error(`'semiliteral' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!rn(t[1]))return r.error(`invalid value of type "${typeof t[1]}"`);let n=t[1],i=nn(n);if("array"===i.kind){let t=n.map(e=>r.parse(e,null,ir));return new e(t)}return new sn(i,n)}evaluate(e){return this.arr.map(t=>t.evaluate(e))}eachChild(e){this.arr.forEach(e)}outputDefined(){return this.arr.every(e=>e.outputDefined())}},slice:class e{constructor(e,t,r,n,i){this.type=e,this.input=t,this.beginIndex=r,this.key=n,this.endIndex=i}static parse(t,r){if(t.length<=2||t.length>=5)return r.error(`Expected 2 or 3 arguments, but found ${t.length-1} instead.`);let n=r.parse(t[1],1,ir),i=r.parse(t[2],2,Jt);if(!n||!i)return null;if(!mr(n.type,[pr(ir),Qt,ir]))return r.error(`Expected first argument to be of type array or string, but found ${fr(n.type)} instead`);if(4===t.length){let a=r.parse(t[3],3,Jt);return a?new e(n.type,n,i,r.key,a):null}return new e(n.type,n,i,r.key)}evaluate(e){let t,r=this.input.evaluate(e),n=this.beginIndex.evaluate(e);if(this.endIndex&&(t=this.endIndex.evaluate(e)),gr(r,["string"]))return[...r].slice(n,t).join("");if(gr(r,["array"]))return r.slice(n,t);throw new Wr(`Expected first argument to be of type array or string, but found ${fr(nn(r))} instead.`,this.key)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}},step:hn,string:Dn,"to-boolean":An,"to-color":An,"to-number":An,"to-string":An,var:Sn,within:ai,distance:Ti,"global-state":Mi};var Bi=class extends Error{constructor(e,t){super(t),this.message=t,this.key=e}},Pi=class e{constructor(e,t=[]){this.parent=e,this.bindings={};for(let[e,r]of t)this.bindings[e]=r}concat(t){return new e(this,t)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}},zi=class e{constructor(e,t,r=[],n,i=new Pi,a=[]){this.registry=e,this.path=r,this.key=r.map(e=>`[${e}]`).join(""),this.scope=i,this.errors=a,this.expectedType=n,this._isConstant=t}parse(e,t,r,n,i={}){return t?this.concat(t,r,n)._parse(e,i):this._parse(e,i)}_parse(e,t){(null===e||"string"==typeof e||"boolean"==typeof e||"number"==typeof e)&&(e=["literal",e]);let r=this.key;function n(e,t,n){return"assert"===n?new Dn(t,[e],r):"coerce"===n?new An(t,[e],r):e}if(Array.isArray(e)){if(0===e.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');let r=e[0];if("string"!=typeof r)return this.error(`Expression name must be a string, but found ${typeof r} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let i=this.registry[r];if(i){let r=i.parse(e,this);if(!r)return null;if(this.expectedType){let e=this.expectedType,i=r.type;if("string"!==e.kind&&"number"!==e.kind&&"boolean"!==e.kind&&"object"!==e.kind&&"array"!==e.kind||"value"!==i.kind){if("projectionDefinition"===e.kind&&["string","array","value"].includes(i.kind)||["color","formatted","resolvedImage"].includes(e.kind)&&["value","string"].includes(i.kind)||["padding","numberArray"].includes(e.kind)&&["value","number","array"].includes(i.kind)||"colorArray"===e.kind&&["value","string","array"].includes(i.kind)||"variableAnchorOffsetCollection"===e.kind&&["value","array"].includes(i.kind))r=n(r,e,t.typeAnnotation||"coerce");else if(this.checkSubtype(e,i))return null}else r=n(r,e,t.typeAnnotation||"assert")}if(!(r instanceof sn)&&"resolvedImage"!==r.type.kind&&this._isConstant(r)){let t=new ln;try{r=new sn(r.type,r.evaluate(t))}catch(e){return this.error(e.message),null}}return r}return this.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0)}return void 0===e?this.error("'undefined' value invalid. Use null instead."):"object"==typeof e?this.error('Bare objects invalid. Use ["literal", {...}] instead.'):this.error(`Expected an array, but found ${typeof e} instead.`)}concat(t,r,n){let i="number"==typeof t?this.path.concat(t):this.path,a=n?this.scope.concat(n):this.scope;return new e(this.registry,this._isConstant,i,r||null,a,this.errors)}error(e,...t){let r=`${this.key}${t.map(e=>`[${e}]`).join("")}`;this.errors.push(new Bi(r,e))}checkSubtype(e,t){let r=yr(e,t);return r&&this.error(r),r}},Vi=class e{constructor(e,t,r,n,i){this.name=e,this.type=t,this._evaluate=r,this.args=n,this.key=i}evaluate(e){return this._evaluate(e,this.args,this.key)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(t,r){let n=t[0],i=e.definitions[n];if(!i)return r.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0);let a=Array.isArray(i)?i[0]:i.type,s=Array.isArray(i)?[[i[1],i[2]]]:i.overloads,o=s.filter(([e])=>!Array.isArray(e)||e.length===t.length-1),l=null;for(let[i,s]of o){l=new zi(r.registry,Ni,r.path,null,r.scope);let o=[],u=!1;for(let e=1;e<t.length;e++){let r=t[e],n=Array.isArray(i)?i[e-1]:i.type,a=l.parse(r,1+o.length,n);if(!a){u=!0;break}o.push(a)}if(!u){if(Array.isArray(i)&&i.length!==o.length){l.error(`Expected ${i.length} arguments, but found ${o.length} instead.`);continue}for(let e=0;e<o.length;e++){let t=Array.isArray(i)?i[e]:i.type,r=o[e];l.concat(e+1).checkSubtype(t,r.type)}if(0===l.errors.length)return new e(n,a,s,o,r.key)}}if(1===o.length)r.errors.push(...l.errors);else{let e=(o.length?o:s).map(([e])=>function(e){return Array.isArray(e)?`(${e.map(fr).join(", ")})`:`(${fr(e.type)}...)`}(e)).join(" | "),n=[];for(let e=1;e<t.length;e++){let i=r.parse(t[e],1+n.length);if(!i)return null;n.push(fr(i.type))}r.error(`Expected arguments of type ${e}, but found (${n.join(", ")}) instead.`)}return null}static register(t,r){e.definitions=r;for(let n in r)t[n]=e}};function Li(e,[t,r,n,i],a){t=t.evaluate(e),r=r.evaluate(e),n=n.evaluate(e);let s=i?i.evaluate(e):1,o=tn(t,r,n,s);if(o)throw new Wr(o,a);return new Ur(t/255,r/255,n/255,s,!1)}function Oi(e,t){return e in t&&void 0!==t[e]}function Ri(e,t){let r=t[e];return void 0===r?null:r}function $i(e){return{type:e}}function Ni(e){if(e instanceof Sn)return Ni(e.boundExpression);if(e instanceof Vi&&"error"===e.name||e instanceof Ln||e instanceof ai||e instanceof Ti||e instanceof Mi)return!1;let t=e instanceof An||e instanceof Dn,r=!0;return e.eachChild(e=>{r&&=t?Ni(e):e instanceof sn}),!!r&&Ui(e)&&ji(e,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"])}function Ui(e){if(e instanceof Vi&&("get"===e.name&&1===e.args.length||"feature-state"===e.name||"has"===e.name&&1===e.args.length||"properties"===e.name||"geometry-type"===e.name||"id"===e.name||/^filter-/.test(e.name))||e instanceof ai||e instanceof Ti)return!1;let t=!0;return e.eachChild(e=>{t&&!Ui(e)&&(t=!1)}),t}function qi(e){if(e instanceof Vi&&"feature-state"===e.name)return!1;let t=!0;return e.eachChild(e=>{t&&!qi(e)&&(t=!1)}),t}function ji(e,t){if(e instanceof Vi&&t.indexOf(e.name)>=0)return!1;let r=!0;return e.eachChild(e=>{r&&!ji(e,t)&&(r=!1)}),r}function Gi(e){return"data-driven"===e["property-type"]||"cross-faded-data-driven"===e["property-type"]}function Xi(e){return!!e.expression&&e.expression.parameters.indexOf("zoom")>-1}function Yi(e){return!!e.expression&&e.expression.interpolated}Vi.register(Ci,{error:[{kind:"error"},[Qt],(e,[t],r)=>{throw new Wr(t.evaluate(e),r)}],typeof:[Qt,[ir],(e,[t])=>fr(nn(t.evaluate(e)))],"to-rgba":[pr(Jt,4),[tr],(e,[t])=>{let[r,n,i,a]=t.evaluate(e).rgb;return[255*r,255*n,255*i,a]}],rgb:[tr,[Jt,Jt,Jt],Li],rgba:[tr,[Jt,Jt,Jt,Jt],Li],has:{type:er,overloads:[[[Qt],(e,[t])=>Oi(t.evaluate(e),e.properties())],[[Qt,nr],(e,[t,r])=>Oi(t.evaluate(e),r.evaluate(e))]]},get:{type:ir,overloads:[[[Qt],(e,[t])=>Ri(t.evaluate(e),e.properties())],[[Qt,nr],(e,[t,r])=>Ri(t.evaluate(e),r.evaluate(e))]]},"feature-state":[ir,[Qt],(e,[t])=>Ri(t.evaluate(e),e.featureState||{})],properties:[nr,[],e=>e.properties()],"geometry-type":[Qt,[],e=>e.geometryType()],id:[ir,[],e=>e.id()],zoom:[Jt,[],e=>e.globals.zoom],"heatmap-density":[Jt,[],e=>e.globals.heatmapDensity||0],elevation:[Jt,[],e=>e.globals.elevation||0],"line-progress":[Jt,[],e=>e.globals.lineProgress||0],accumulated:[ir,[],e=>void 0===e.globals.accumulated?null:e.globals.accumulated],"+":[Jt,$i(Jt),(e,t)=>{let r=0;for(let n of t)r+=n.evaluate(e);return r}],"*":[Jt,$i(Jt),(e,t)=>{let r=1;for(let n of t)r*=n.evaluate(e);return r}],"-":{type:Jt,overloads:[[[Jt,Jt],(e,[t,r])=>t.evaluate(e)-r.evaluate(e)],[[Jt],(e,[t])=>-t.evaluate(e)]]},"/":[Jt,[Jt,Jt],(e,[t,r])=>t.evaluate(e)/r.evaluate(e)],"%":[Jt,[Jt,Jt],(e,[t,r])=>t.evaluate(e)%r.evaluate(e)],ln2:[Jt,[],()=>Math.LN2],pi:[Jt,[],()=>Math.PI],e:[Jt,[],()=>Math.E],"^":[Jt,[Jt,Jt],(e,[t,r])=>t.evaluate(e)**+r.evaluate(e)],sqrt:[Jt,[Jt],(e,[t])=>Math.sqrt(t.evaluate(e))],log10:[Jt,[Jt],(e,[t])=>Math.log(t.evaluate(e))/Math.LN10],ln:[Jt,[Jt],(e,[t])=>Math.log(t.evaluate(e))],log2:[Jt,[Jt],(e,[t])=>Math.log(t.evaluate(e))/Math.LN2],sin:[Jt,[Jt],(e,[t])=>Math.sin(t.evaluate(e))],cos:[Jt,[Jt],(e,[t])=>Math.cos(t.evaluate(e))],tan:[Jt,[Jt],(e,[t])=>Math.tan(t.evaluate(e))],asin:[Jt,[Jt],(e,[t])=>Math.asin(t.evaluate(e))],acos:[Jt,[Jt],(e,[t])=>Math.acos(t.evaluate(e))],atan:[Jt,[Jt],(e,[t])=>Math.atan(t.evaluate(e))],min:[Jt,$i(Jt),(e,t)=>Math.min(...t.map(t=>t.evaluate(e)))],max:[Jt,$i(Jt),(e,t)=>Math.max(...t.map(t=>t.evaluate(e)))],abs:[Jt,[Jt],(e,[t])=>Math.abs(t.evaluate(e))],round:[Jt,[Jt],(e,[t])=>{let r=t.evaluate(e);return r<0?-Math.round(-r):Math.round(r)}],floor:[Jt,[Jt],(e,[t])=>Math.floor(t.evaluate(e))],ceil:[Jt,[Jt],(e,[t])=>Math.ceil(t.evaluate(e))],"filter-==":[er,[Qt,ir],(e,[t,r])=>e.properties()[t.value]===r.value],"filter-id-==":[er,[ir],(e,[t])=>e.id()===t.value],"filter-type-==":[er,[Qt],(e,[t])=>e.geometryType()===t.value],"filter-<":[er,[Qt,ir],(e,[t,r])=>{let n=e.properties()[t.value],i=r.value;return typeof n==typeof i&&n<i}],"filter-id-<":[er,[ir],(e,[t])=>{let r=e.id(),n=t.value;return typeof r==typeof n&&r<n}],"filter->":[er,[Qt,ir],(e,[t,r])=>{let n=e.properties()[t.value],i=r.value;return typeof n==typeof i&&n>i}],"filter-id->":[er,[ir],(e,[t])=>{let r=e.id(),n=t.value;return typeof r==typeof n&&r>n}],"filter-<=":[er,[Qt,ir],(e,[t,r])=>{let n=e.properties()[t.value],i=r.value;return typeof n==typeof i&&n<=i}],"filter-id-<=":[er,[ir],(e,[t])=>{let r=e.id(),n=t.value;return typeof r==typeof n&&r<=n}],"filter->=":[er,[Qt,ir],(e,[t,r])=>{let n=e.properties()[t.value],i=r.value;return typeof n==typeof i&&n>=i}],"filter-id->=":[er,[ir],(e,[t])=>{let r=e.id(),n=t.value;return typeof r==typeof n&&r>=n}],"filter-has":[er,[ir],(e,[t])=>{let r=t.value,n=e.properties();return r in n&&void 0!==n[r]}],"filter-has-id":[er,[],e=>null!==e.id()&&void 0!==e.id()],"filter-type-in":[er,[pr(Qt)],(e,[t])=>t.value.indexOf(e.geometryType())>=0],"filter-id-in":[er,[pr(ir)],(e,[t])=>t.value.indexOf(e.id())>=0],"filter-in-small":[er,[Qt,pr(ir)],(e,[t,r])=>r.value.indexOf(e.properties()[t.value])>=0],"filter-in-large":[er,[Qt,pr(ir)],(e,[t,r])=>function(e,t,r,n){for(;r<=n;){let i=r+n>>1;if(t[i]===e)return!0;t[i]>e?n=i-1:r=i+1}return!1}(e.properties()[t.value],r.value,0,r.value.length-1)],all:{type:er,overloads:[[[er,er],(e,[t,r])=>t.evaluate(e)&&r.evaluate(e)],[$i(er),(e,t)=>{for(let r of t)if(!r.evaluate(e))return!1;return!0}]]},any:{type:er,overloads:[[[er,er],(e,[t,r])=>t.evaluate(e)||r.evaluate(e)],[$i(er),(e,t)=>{for(let r of t)if(r.evaluate(e))return!0;return!1}]]},"!":[er,[er],(e,[t])=>!t.evaluate(e)],"is-supported-script":[er,[Qt],(e,[t])=>{let r=e.globals&&e.globals.isSupportedScript;return!r||r(t.evaluate(e))}],upcase:[Qt,[Qt],(e,[t])=>t.evaluate(e).toUpperCase()],downcase:[Qt,[Qt],(e,[t])=>t.evaluate(e).toLowerCase()],concat:[Qt,$i(ir),(e,t)=>t.map(t=>an(t.evaluate(e))).join("")],split:[pr(Qt),[Qt,Qt],(e,[t,r])=>t.evaluate(e).split(r.evaluate(e))],join:[Qt,[pr(Qt),Qt],(e,[t,r])=>t.evaluate(e).join(r.evaluate(e))],"resolved-locale":[Qt,[ar],(e,[t])=>t.evaluate(e).resolvedLocale()]});const Zi=/^(.*)-transition$/;function Wi(e,...t){for(let r of t)for(let t in r)e[t]=r[t];return e}function Hi(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":null===e?"null":typeof e}function Ki(e){return"object"==typeof e&&!!e&&!Array.isArray(e)&&nn(e)===nr}function Ji(e){return e}function Qi(e,t){let r=e.stops&&"object"==typeof e.stops[0][0],n=r||void 0!==e.property,i=r||!n,a=e.type||(Yi(t)?"exponential":"interval"),s=function(e){switch(e.type){case"color":return Ur.parse;case"padding":return Xr.parse;case"numberArray":return Yr.parse;case"colorArray":return Zr.parse;default:return null}}(t);if(s&&((e=Wi({},e)).stops&&(e.stops=e.stops.map(e=>[e[0],s(e[1])])),e.default?e.default=s(e.default):e.default=s(t.default)),e.colorSpace&&!function(e){return"rgb"===e||"hcl"===e||"lab"===e}(e.colorSpace))throw Error(`Unknown color space: "${e.colorSpace}"`);let o,l,u=function(e){switch(e){case"exponential":return na;case"interval":return ra;case"categorical":return ta;case"identity":return ia;default:throw Error(`Unknown function type "${e}"`)}}(a);if("categorical"===a){o=Object.create(null);for(let t of e.stops)o[t[0]]=t[1];l=typeof e.stops[0][0]}if(r){let r={},n=[];for(let t=0;t<e.stops.length;t++){let i=e.stops[t],a=i[0].zoom;void 0===r[a]&&(r[a]={zoom:a,type:e.type,property:e.property,default:e.default,stops:[]},n.push(a)),r[a].stops.push([i[0].value,i[1]])}let i=[];for(let e of n)i.push([r[e].zoom,Qi(r[e],t)]);let a={name:"linear"};return{kind:"composite",interpolationType:a,interpolationFactor:cn.interpolationFactor.bind(void 0,a),zoomStops:i.map(e=>e[0]),evaluate:({zoom:r},n)=>na({stops:i,base:e.base},t,r).evaluate(r,n)}}if(i){let r="exponential"===a?{name:"exponential",base:void 0===e.base?1:e.base}:null;return{kind:"camera",interpolationType:r,interpolationFactor:cn.interpolationFactor.bind(void 0,r),zoomStops:e.stops.map(e=>e[0]),evaluate:({zoom:r})=>u(e,t,r,o,l)}}return{kind:"source",evaluate(r,n){let i=n&&n.properties?n.properties[e.property]:void 0;return void 0===i?ea(e.default,t.default):u(e,t,i,o,l)}}}function ea(e,t,r){return void 0!==e?e:void 0!==t?t:void 0!==r?r:void 0}function ta(e,t,r,n,i){return ea(typeof r===i?n[r]:void 0,e.default,t.default)}function ra(e,t,r){if("number"!==Hi(r))return ea(e.default,t.default);let n=e.stops.length;if(1===n||r<=e.stops[0][0])return e.stops[0][1];if(r>=e.stops[n-1][0])return e.stops[n-1][1];let i=un(e.stops.map(e=>e[0]),r,"");return e.stops[i][1]}function na(e,t,r){let n=void 0===e.base?1:e.base;if("number"!==Hi(r))return ea(e.default,t.default);let i=e.stops.length;if(1===i||r<=e.stops[0][0])return e.stops[0][1];if(r>=e.stops[i-1][0])return e.stops[i-1][1];let a=un(e.stops.map(e=>e[0]),r,""),s=function(e,t,r,n){let i=n-r,a=e-r;return 0===i?0:1===t?a/i:(t**+a-1)/(t**+i-1)}(r,n,e.stops[a][0],e.stops[a+1][0]),o=e.stops[a][1],l=e.stops[a+1][1],u=fn[t.type]||Ji;return"function"==typeof o.evaluate?{evaluate(...t){let r=o.evaluate.apply(void 0,t),n=l.evaluate.apply(void 0,t);if(void 0!==r&&void 0!==n)return u(r,n,s,e.colorSpace)}}:u(o,l,s,e.colorSpace)}function ia(e,t,r){switch(t.type){case"color":r=Ur.parse(r);break;case"formatted":r=Gr.fromString(r.toString());break;case"resolvedImage":r=Jr.fromString(r.toString());break;case"padding":r=Xr.parse(r);break;case"colorArray":r=Zr.parse(r);break;case"numberArray":r=Yr.parse(r);break;default:Hi(r)!==t.type&&("enum"!==t.type||!t.values[r])&&(r=void 0)}return ea(r,e.default,t.default)}function aa(e){return{result:"success",value:e}}function sa(e){return{result:"error",value:e}}var oa=class{constructor(e,t,r,n){this.expression=e,this._warningHistory={},this._evaluator=new ln,this._defaultValue=r?xa(r):null,this._enumValues=r&&"enum"===r.type?r.values:null,this._globalState=n,this._rootKey=t}evaluateWithoutErrorHandling(e,t,r,n,i,a){return this._globalState&&(e=va(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=r,this._evaluator.canonical=n,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=a,this.expression.evaluate(this._evaluator)}evaluate(e,t,r,n,i,a){this._globalState&&(e=va(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=r||null,this._evaluator.canonical=n,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=a||null;try{let e=this.expression.evaluate(this._evaluator);if(null==e||"number"==typeof e&&e!=e)return this._defaultValue;if(this._enumValues&&!(e in this._enumValues))throw new Wr(`Expected value to be one of ${Object.keys(this._enumValues).map(e=>JSON.stringify(e)).join(", ")}, but found ${JSON.stringify(e)} instead.`,"");return e}catch(e){let t=e instanceof Wr?e.path:"",r=`${t}|${e.message}`;return this._warningHistory[r]||(this._warningHistory[r]=!0,typeof console<"u"&&console.warn(la(this._rootKey,t,e.message,this._defaultValue))),this._defaultValue}}};function la(e,t,r,n){return`${e}${t}: ${r}${null==n?"":` Falling back to ${String(n)}.`}`}function ua(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 ha(e){return Array.isArray(e)&&e.length>0&&"string"==typeof e[0]&&e[0]in Ci}function ca(e,t,r,n){ua(t);let i=new zi(Ci,Ni,[],r?function(e){let t={color:tr,string:Qt,number:Jt,enum:Qt,boolean:er,formatted:sr,padding:or,numberArray:ur,colorArray:lr,projectionDefinition:rr,resolvedImage:hr,variableAnchorOffsetCollection:cr};return"array"===e.type?pr(t[e.value]||ir,e.length):t[e.type]}(r):void 0),a=i.parse(e,void 0,void 0,void 0,r&&"string"===r.type?{typeAnnotation:"coerce"}:void 0);return a?aa(new oa(a,t,r,n)):sa(i.errors)}var pa=class{constructor(e,t,r){this.kind=e,this._styleExpression=t,this.isStateDependent="constant"!==e&&!qi(t.expression),this.globalStateRefs=ga(t.expression),this._globalState=r}evaluateWithoutErrorHandling(e,t,r,n,i,a){return this._globalState&&(e=va(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,t,r,n,i,a)}evaluate(e,t,r,n,i,a){return this._globalState&&(e=va(e,this._globalState)),this._styleExpression.evaluate(e,t,r,n,i,a)}},fa=class{constructor(e,t,r,n,i){this.kind=e,this.zoomStops=r,this._styleExpression=t,this.isStateDependent="camera"!==e&&!qi(t.expression),this.globalStateRefs=ga(t.expression),this.interpolationType=n,this._globalState=i}evaluateWithoutErrorHandling(e,t,r,n,i,a){return this._globalState&&(e=va(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,t,r,n,i,a)}evaluate(e,t,r,n,i,a){return this._globalState&&(e=va(e,this._globalState)),this._styleExpression.evaluate(e,t,r,n,i,a)}interpolationFactor(e,t,r){return this.interpolationType?cn.interpolationFactor(this.interpolationType,e,t,r):0}};function da(e,t,r,n){let i=ca(e,t,r,n);if("error"===i.result)return i;let a=i.value.expression,s=Ui(a);if(!s&&!Gi(r))return sa([new Bi("","data expressions not supported")]);let o=ji(a,["zoom"]);if(!o&&!Xi(r))return sa([new Bi("","zoom expressions not supported")]);let l=ma(a);if(!l&&!o)return sa([new Bi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]);if(l instanceof Bi)return sa([l]);if(l instanceof cn&&!Yi(r))return sa([new Bi("",'"interpolate" expressions cannot be used with this property')]);if(!l)return aa(new pa(s?"constant":"source",i.value,n));let u=l instanceof cn?l.interpolation:void 0;return aa(new fa(s?"camera":"composite",i.value,l.labels,u,n))}var ya=class e{constructor(e,t,r){this.isStateDependent=!1,this.globalStateRefs=new Set,this._globalState=null,ua(t),this._parameters=e,this._specification=r,this._rootKey=t,this._defaultValue=xa(r),this._warningHistory={};let n=Qi(this._parameters,this._specification);this.kind=n.kind,this.interpolationFactor=n.interpolationFactor,this.zoomStops=n.zoomStops,this.interpolationType=n.interpolationType,this._innerEvaluate=n.evaluate}evaluate(e,t){try{return this._innerEvaluate(e,t)}catch(e){let t=e instanceof Error?e.message:String(e),r=`|${t}`;return this._warningHistory[r]||(this._warningHistory[r]=!0,typeof console<"u"&&console.warn(la(this._rootKey,"",t,this._defaultValue))),this._defaultValue}}static deserialize(t){return new e(t._parameters,t._rootKey,t._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification,_rootKey:e._rootKey}}};function ma(e){let t=null;if(e instanceof En)t=ma(e.result);else if(e instanceof Fn){for(let r of e.args)if(t=ma(r),t)break}else(e instanceof hn||e instanceof cn)&&e.input instanceof Vi&&"zoom"===e.input.name&&(t=e);return t instanceof Bi||e.eachChild(e=>{let r=ma(e);r instanceof Bi?t=r:!t&&r?t=new Bi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&r&&t!==r&&(t=new Bi("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t}function ga(e,t=new Set){return e instanceof Mi&&t.add(e.key),e.eachChild(e=>{ga(e,t)}),t}function xa(e){if("color"===e.type&&Ki(e.default))return new Ur(0,0,0,0);switch(e.type){case"color":return Ur.parse(e.default)||null;case"padding":return Xr.parse(e.default)||null;case"numberArray":return Yr.parse(e.default)||null;case"colorArray":return Zr.parse(e.default)||null;case"variableAnchorOffsetCollection":return Kr.parse(e.default)||null;case"projectionDefinition":return Qr.parse(e.default)||null;default:return void 0===e.default?null:e.default}}function va(e,t){let{zoom:r,heatmapDensity:n,elevation:i,lineProgress:a,isSupportedScript:s,accumulated:o}=e??{};return{zoom:r,heatmapDensity:n,elevation:i,lineProgress:a,isSupportedScript:s,accumulated:o,globalState:t}}function ba(e){if("boolean"==typeof e)return"neutral";if(!Array.isArray(e)||0===e.length)return"legacy";switch(e[0]){case"has":return e.length<2||"$id"===e[1]||"$type"===e[1]?"legacy":2===e.length?"neutral":"expression";case"in":return e.length>=3&&("string"!=typeof e[1]||Array.isArray(e[2]))?"expression":"legacy";case"!in":case"!has":case"none":return"legacy";case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==e.length||Array.isArray(e[1])||Array.isArray(e[2])?"expression":"legacy";case"any":case"all":return function(e){let t=!1;for(let r of e){let e=ba(r);if("expression"===e)return"expression";"legacy"===e&&(t=!0)}return t?"legacy":"neutral"}(e.slice(1));default:return"expression"}}function wa(e){return"legacy"!==ba(e)}function Da(e){return"$type"===e?["geometry-type"]:"$id"===e?["id"]:["get",e]}function _a(e){if(("<"===e[0]||"<="===e[0]||">"===e[0]||">="===e[0])&&"$type"===e[1])return`"$type" cannot be use with operator "${e[0]}"`;let t=function(e){switch(e[0]){case"==":case"!=":case"<":case"<=":case">":case">=":return 3!==e.length||"string"!=typeof e[1]?null:[e[0],Da(e[1]),e[2]];case"in":case"!in":{if(e.length<2||"string"!=typeof e[1])return null;let t=["in",Da(e[1]),["literal",e.slice(2)]];return"!in"===e[0]?["!",t]:t}case"has":case"!has":{if(2!==e.length||"string"!=typeof e[1]||"$type"===e[1]||"$id"===e[1])return null;let t=["has",e[1]];return"!has"===e[0]?["!",t]:t}default:return null}}(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 Aa(e,t,r){let n=r[e];return Array.isArray(n)?wa(n)?Ea(n,t.concat(e)):{path:t.concat(e),legacyFilter:n}:null}function Ea(e,t=[]){if(!Array.isArray(e)||e.length<1)return null;switch(e[0]){case"all":case"any":case"none":for(let r=1;r<e.length;r++){let n=Aa(r,t,e);if(n)return n}break;case"!":{let r=Aa(1,t,e);if(r)return r;break}case"case":for(let r=1;r<e.length-1;r+=2){let n=Aa(r,t,e);if(n)return n}}return null}const Sa={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Fa(e,t,r){if(null==e)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};wa(e)?function(e,t){let r=Ea(e);if(!r||typeof console>"u")return;let n=r.path.map(e=>`[${e}]`).join("");console.warn(`${t}${n}: ${_a(r.legacyFilter)}`)}(e,t):e=Ta(e);let n=ca(e,t,Sa,r);if("error"===n.result)throw Error(n.value.map(e=>`${e.key}: ${e.message}`).join(", "));return{filter:(e,t,r)=>n.value.evaluate(e,t,{},r),needGeometry:Ia(e),getGlobalStateRefs:()=>ga(n.value.expression)}}function ka(e,t){return e<t?-1:+(e>t)}function Ia(e){if(!Array.isArray(e))return!1;if("within"===e[0]||"distance"===e[0])return!0;for(let t=1;t<e.length;t++)if(Ia(e[t]))return!0;return!1}function Ta(e){if(!e)return!0;let t=e[0];return e.length<=1?"any"!==t:"=="===t?Ma(e[1],e[2],"=="):"!="===t?Pa(Ma(e[1],e[2],"==")):"<"===t||">"===t||"<="===t||">="===t?Ma(e[1],e[2],t):"any"===t?function(e){return["any"].concat(e.map(Ta))}(e.slice(1)):"all"===t?["all"].concat(e.slice(1).map(Ta)):"none"===t?["all"].concat(e.slice(1).map(Ta).map(Pa)):"in"===t?Ca(e[1],e.slice(2)):"!in"===t?Pa(Ca(e[1],e.slice(2))):"has"===t?Ba(e[1]):"!has"!==t||Pa(Ba(e[1]))}function Ma(e,t,r){switch(e){case"$type":return[`filter-type-${r}`,t];case"$id":return[`filter-id-${r}`,t];default:return[`filter-${r}`,e,t]}}function Ca(e,t){if(0===t.length)return!1;switch(e){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some(e=>typeof e!=typeof t[0])?["filter-in-large",e,["literal",t.sort(ka)]]:["filter-in-small",e,["literal",t]]}}function Ba(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function Pa(e){return["!",e]}function za(e){let t=e.key,r=e.value;return r?[new Ht(t,r,"constants have been deprecated as of v8")]:[]}function Va(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function La(e){if(Array.isArray(e))return e.map(La);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){let t={};for(let r in e)t[r]=La(e[r]);return t}return Va(e)}function Oa(e){let t=e.key,r=e.value,n=e.valueSpec||{},i=e.objectElementValidators||{},a=e.style,s=e.styleSpec,o=e.validateSpec,l=[],u=Hi(r);if("object"!==u)return[new Ht(t,r,`object expected, ${u} found`)];for(let e in r){let u,h=e.split(".")[0],c=Pr(n,h)||n["*"];if(Pr(i,h))u=i[h];else if(Pr(n,h)){if(void 0===r[e])continue;u=o}else if(i["*"])u=i["*"];else{if(!n["*"]){l.push(new Ht(t,r[e],`unknown property "${e}"`));continue}u=o}l=l.concat(u({key:(t&&`${t}.`)+e,value:r[e],valueSpec:c,style:a,styleSpec:s,object:r,objectKey:e,validateSpec:o},r))}for(let e in n)i[e]||n[e].required&&void 0===n[e].default&&void 0===r[e]&&l.push(new Ht(t,r,`missing required property "${e}"`));return l}function Ra(e){let t=e.value,r=e.valueSpec,n=e.validateSpec,i=e.style,a=e.styleSpec,s=e.key,o=e.arrayElementValidator||n;if("array"!==Hi(t))return[new Ht(s,t,`array expected, ${Hi(t)} found`)];if(r.length&&t.length!==r.length)return[new Ht(s,t,`array length ${r.length} expected, length ${t.length} found`)];let l={type:r.value,values:r.values};a.$version<7&&(l.function=r.function),"object"===Hi(r.value)&&(l=r.value);let u=[];for(let r=0;r<t.length;r++)u=u.concat(o({array:t,arrayIndex:r,value:t[r],valueSpec:l,validateSpec:e.validateSpec,style:i,styleSpec:a,key:`${s}[${r}]`}));return u}function $a(e){let t=e.key,r=e.value,n=e.valueSpec,i=Hi(r);return"number"===i&&r!=r&&(i="NaN"),"number"===i?"minimum"in n&&r<n.minimum?[new Ht(t,r,`${r} is less than the minimum value ${n.minimum}`)]:"maximum"in n&&r>n.maximum?[new Ht(t,r,`${r} is greater than the maximum value ${n.maximum}`)]:[]:[new Ht(t,r,`number expected, ${i} found`)]}function Na(e){let t,r,n,i=e.valueSpec,a=Va(e.value.type),s={},o="categorical"!==a&&void 0===e.value.property,l=!o,u="array"===Hi(e.value.stops)&&"array"===Hi(e.value.stops[0])&&"object"===Hi(e.value.stops[0][0]),h=Oa({key:e.key,value:e.value,valueSpec:e.styleSpec.function,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{stops:function(e){if("identity"===a)return[new Ht(e.key,e.value,'identity function may not have a "stops" property')];let t=[],r=e.value;return t=t.concat(Ra({key:e.key,value:r,valueSpec:e.valueSpec,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,arrayElementValidator:c})),"array"===Hi(r)&&0===r.length&&t.push(new Ht(e.key,r,"array must have at least one stop")),t},default:function(e){return e.validateSpec({key:e.key,value:e.value,valueSpec:i,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec})}}});return"identity"===a&&o&&h.push(new Ht(e.key,e.value,'missing required property "property"')),"identity"!==a&&!e.value.stops&&h.push(new Ht(e.key,e.value,'missing required property "stops"')),"exponential"===a&&e.valueSpec.expression&&!Yi(e.valueSpec)&&h.push(new Ht(e.key,e.value,"exponential functions not supported")),e.styleSpec.$version>=8&&(l&&!Gi(e.valueSpec)?h.push(new Ht(e.key,e.value,"property functions not supported")):o&&!Xi(e.valueSpec)&&h.push(new Ht(e.key,e.value,"zoom functions not supported"))),("categorical"===a||u)&&void 0===e.value.property&&h.push(new Ht(e.key,e.value,'"property" property is required')),h;function c(e){let t=[],a=e.value,o=e.key;if("array"!==Hi(a))return[new Ht(o,a,`array expected, ${Hi(a)} found`)];if(2!==a.length)return[new Ht(o,a,`array length 2 expected, length ${a.length} found`)];if(u){if("object"!==Hi(a[0]))return[new Ht(o,a,`object expected, ${Hi(a[0])} found`)];if(void 0===a[0].zoom)return[new Ht(o,a,"object stop key must have zoom")];if(void 0===a[0].value)return[new Ht(o,a,"object stop key must have value")];if(n&&n>Va(a[0].zoom))return[new Ht(o,a[0].zoom,"stop zoom values must appear in ascending order")];Va(a[0].zoom)!==n&&(n=Va(a[0].zoom),r=void 0,s={}),t=t.concat(Oa({key:`${o}[0]`,value:a[0],valueSpec:{zoom:{}},validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{zoom:$a,value:p}}))}else t=t.concat(p({key:`${o}[0]`,value:a[0],valueSpec:{},validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec},a));return ha(La(a[1]))?t.concat([new Ht(`${o}[1]`,a[1],"expressions are not allowed in function stops.")]):t.concat(e.validateSpec({key:`${o}[1]`,value:a[1],valueSpec:i,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec}))}function p(e,n){let o=Hi(e.value),l=Va(e.value),u=null===e.value?n:e.value;if(t){if(o!==t)return[new Ht(e.key,u,`${o} stop domain type must match previous stop domain type ${t}`)]}else t=o;if("number"!==o&&"string"!==o&&"boolean"!==o)return[new Ht(e.key,u,"stop domain value must be a number, string, or boolean")];if("number"!==o&&"categorical"!==a){let t=`number expected, ${o} found`;return Gi(i)&&void 0===a&&(t+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Ht(e.key,u,t)]}return"categorical"!==a||"number"!==o||isFinite(l)&&Math.floor(l)===l?"categorical"!==a&&"number"===o&&void 0!==r&&l<r?[new Ht(e.key,u,"stop domain values must appear in ascending order")]:(r=l,"categorical"===a&&l in s?[new Ht(e.key,u,"stop domain values must be unique")]:(s[l]=!0,[])):[new Ht(e.key,u,`integer expected, found ${l}`)]}}function Ua(e){let t=("property"===e.expressionContext?da:ca)(La(e.value),e.key,e.valueSpec);if("error"===t.result)return t.value.map(t=>new Ht(`${e.key}${t.key}`,e.value,t.message));let r=t.value.expression||t.value._styleExpression.expression;if("property"===e.expressionContext&&"text-font"===e.propertyKey&&!r.outputDefined())return[new Ht(e.key,e.value,`Invalid data expression for "${e.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===e.expressionContext&&"layout"===e.propertyType&&!qi(r))return[new Ht(e.key,e.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===e.expressionContext&&!qi(r))return[new Ht(e.key,e.value,'"feature-state" data expressions are not supported with filters.')];if(e.expressionContext&&0===e.expressionContext.indexOf("cluster")){if(!ji(r,["zoom","feature-state"]))return[new Ht(e.key,e.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===e.expressionContext&&!Ui(r))return[new Ht(e.key,e.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function qa(e){let t=e.key,r=e.value,n=Hi(r);return"string"===n?Ur.parse(String(r))?[]:[new Ht(t,r,`color expected, "${r}" found`)]:[new Ht(t,r,`color expected, ${n} found`)]}function ja(e){let t=e.key,r=e.value,n=e.valueSpec,i=[];return Array.isArray(n.values)?-1===n.values.indexOf(Va(r))&&i.push(new Ht(t,r,`expected one of [${n.values.join(", ")}], ${JSON.stringify(r)} found`)):-1===Object.keys(n.values).indexOf(Va(r))&&i.push(new Ht(t,r,`expected one of [${Object.keys(n.values).join(", ")}], ${JSON.stringify(r)} found`)),i}function Ga(e,t){let r=e;for(let e of t)r=r[e];return r}function Xa(e,t){let r=Ea(t);return r?[new Ht(`${e.key}${r.path.map(e=>`[${e}]`).join("")}`,Ga(e.value,r.path),_a(r.legacyFilter),null,"warning")]:[]}function Ya(e){let t=La(e.value);return wa(t)?[...Xa(e,t),...Ua(Wi({},e,{expressionContext:"filter",valueSpec:{value:"boolean"}}))]:Za(e)}function Za(e){let t=e.value,r=e.key;if("array"!==Hi(t))return[new Ht(r,t,`array expected, ${Hi(t)} found`)];let n,i=e.styleSpec,a=[];if(t.length<1)return[new Ht(r,t,"filter array must have at least 1 element")];switch(a=a.concat(ja({key:`${r}[0]`,value:t[0],valueSpec:i.filter_operator,style:e.style,styleSpec:e.styleSpec})),Va(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&"$type"===Va(t[1])&&a.push(new Ht(r,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":3!==t.length&&a.push(new Ht(r,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(n=Hi(t[1]),"string"!==n&&a.push(new Ht(`${r}[1]`,t[1],`string expected, ${n} found`)));for(let s=2;s<t.length;s++)n=Hi(t[s]),"$type"===Va(t[1])?a=a.concat(ja({key:`${r}[${s}]`,value:t[s],valueSpec:i.geometry_type,style:e.style,styleSpec:e.styleSpec})):"string"!==n&&"number"!==n&&"boolean"!==n&&a.push(new Ht(`${r}[${s}]`,t[s],`string, number, or boolean expected, ${n} found`));break;case"any":case"all":case"none":for(let n=1;n<t.length;n++)a=a.concat(Za({key:`${r}[${n}]`,value:t[n],style:e.style,styleSpec:e.styleSpec}));break;case"has":case"!has":n=Hi(t[1]),2===t.length?"string"!==n&&a.push(new Ht(`${r}[1]`,t[1],`string expected, ${n} found`)):a.push(new Ht(r,t,`filter array for "${t[0]}" operator must have 2 elements`))}return a}function Wa(e,t){let r=e.key,n=e.validateSpec,i=e.style,a=e.styleSpec,s=e.value,o=e.objectKey,l=a[`${t}_${e.layerType}`];if(!l)return[];let u=o.match(Zi);if("paint"===t&&u&&l[u[1]]&&l[u[1]].transition)return n({key:r,value:s,valueSpec:a.transition,style:i,styleSpec:a});let h,c=e.valueSpec||l[o];if(!c)return[new Ht(r,s,`unknown property "${o}"`)];if("string"===Hi(s)&&Gi(c)&&!c.tokens&&(h=/^{([^}]+)}$/.exec(s)))return[new Ht(r,s,`"${o}" does not support interpolation syntax\nUse an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(h[1])} }\`.`)];let p=[];return"symbol"===e.layerType&&"text-font"===o&&Ki(La(s))&&"identity"===Va(s.type)&&p.push(new Ht(r,s,'"text-font" does not support identity functions')),p.concat(n({key:e.key,value:s,valueSpec:c,style:i,styleSpec:a,expressionContext:"property",propertyType:t,propertyKey:o}))}function Ha(e){return Wa(e,"paint")}function Ka(e){return Wa(e,"layout")}function Ja(e){let t=[],r=e.value,n=e.key,i=e.style,a=e.styleSpec;if("object"!==Hi(r))return[new Ht(n,r,`object expected, ${Hi(r)} found`)];!r.type&&!r.ref&&t.push(new Ht(n,r,'either "type" or "ref" is required'));let s=Va(r.type),o=Va(r.ref);if(r.id){let a=Va(r.id);for(let s=0;s<e.arrayIndex;s++){let e=i.layers[s];Va(e.id)===a&&t.push(new Ht(n,r.id,`duplicate layer id "${r.id}", previously used at line ${e.id.__line__}`))}}if("ref"in r){let e;["type","source","source-layer","filter","layout"].forEach(e=>{e in r&&t.push(new Ht(n,r[e],`"${e}" is prohibited for ref layers`))}),i.layers.forEach(t=>{Va(t.id)===o&&(e=t)}),e?e.ref?t.push(new Ht(n,r.ref,"ref cannot reference another ref layer")):s=Va(e.type):t.push(new Ht(n,r.ref,`ref layer "${o}" not found`))}else if("background"!==s)if(r.source){let e=i.sources&&i.sources[r.source],a=e&&Va(e.type);e?"vector"===a&&"raster"===s?t.push(new Ht(n,r.source,`layer "${r.id}" requires a raster source`)):"raster-dem"!==a&&"hillshade"===s||"raster-dem"!==a&&"color-relief"===s?t.push(new Ht(n,r.source,`layer "${r.id}" requires a raster-dem source`)):"raster"===a&&"raster"!==s?t.push(new Ht(n,r.source,`layer "${r.id}" requires a vector source`)):"vector"!==a||r["source-layer"]?"raster-dem"===a&&"hillshade"!==s&&"color-relief"!==s?t.push(new Ht(n,r.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):"line"===s&&r.paint&&r.paint["line-gradient"]&&("geojson"!==a||!e.lineMetrics)&&t.push(new Ht(n,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new Ht(n,r,`layer "${r.id}" must specify a "source-layer"`)):t.push(new Ht(n,r.source,`source "${r.source}" not found`))}else t.push(new Ht(n,r,'missing required property "source"'));return"raster"===s&&r.paint?.resampling&&r.paint?.["raster-resampling"]&&t.push(new Ht(n,r.paint,`layer "${r.id}" redundantly specifies "resampling" and "raster-resampling" paint properties, but only one is allowed. It is advised to use "resampling".`)),t=t.concat(Oa({key:n,value:r,valueSpec:a.layer,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":()=>[],type:()=>e.validateSpec({key:`${n}.type`,value:r.type,valueSpec:a.layer.type,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,object:r,objectKey:"type"}),filter:Ya,layout:e=>Oa({layer:r,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":e=>Ka(Wi({layerType:s},e))}}),paint:e=>Oa({layer:r,key:e.key,value:e.value,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*":e=>Ha(Wi({layerType:s},e))}})}})),t}function Qa(e){let t=e.value,r=e.key,n=Hi(t);return"string"===n?[]:[new Ht(r,t,`string expected, ${n} found`)]}const es={promoteId:function({key:e,value:t}){if("string"===Hi(t))return Qa({key:e,value:t});{let r=[];for(let n in t)r.push(...Qa({key:`${e}.${n}`,value:t[n]}));return r}}};function ts(e){let t=e.value,r=e.key,n=e.styleSpec,i=e.style,a=e.validateSpec;if(!t.type)return[new Ht(r,t,'"type" is required')];let s,o=Va(t.type);switch(o){case"vector":case"raster":return s=Oa({key:r,value:t,valueSpec:n[`source_${o.replace("-","_")}`],style:e.style,styleSpec:n,objectElementValidators:es,validateSpec:a}),s;case"raster-dem":return s=function(e){let t=e.sourceName??"",r=e.value,n=e.styleSpec,i=n.source_raster_dem,a=e.style,s=[],o=Hi(r);if(void 0===r)return s;if("object"!==o)return s.push(new Ht("source_raster_dem",r,`object expected, ${o} found`)),s;let l="custom"===Va(r.encoding),u=["redFactor","greenFactor","blueFactor","baseShift"],h=e.value.encoding?`"${e.value.encoding}"`:"Default";for(let o in r)!l&&u.includes(o)?s.push(new Ht(o,r[o],`In "${t}": "${o}" is only valid when "encoding" is set to "custom". ${h} encoding found`)):i[o]?s=s.concat(e.validateSpec({key:o,value:r[o],valueSpec:i[o],validateSpec:e.validateSpec,style:a,styleSpec:n})):s.push(new Ht(o,r[o],`unknown property "${o}"`));return s}({sourceName:r,value:t,style:e.style,styleSpec:n,validateSpec:a}),s;case"geojson":if(s=Oa({key:r,value:t,valueSpec:n.source_geojson,style:i,styleSpec:n,validateSpec:a,objectElementValidators:es}),t.cluster)for(let e in t.clusterProperties){let[n,i]=t.clusterProperties[e],o="string"==typeof n?[n,["accumulated"],["get",e]]:n;s.push(...Ua({key:`${r}.${e}.map`,value:i,validateSpec:a,expressionContext:"cluster-map"})),s.push(...Ua({key:`${r}.${e}.reduce`,value:o,validateSpec:a,expressionContext:"cluster-reduce"}))}return s;case"video":return Oa({key:r,value:t,valueSpec:n.source_video,style:i,validateSpec:a,styleSpec:n});case"image":return Oa({key:r,value:t,valueSpec:n.source_image,style:i,validateSpec:a,styleSpec:n});case"canvas":return[new Ht(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return ja({key:`${r}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:i,validateSpec:a,styleSpec:n})}}function rs(e){let t=e.value,r=e.styleSpec,n=r.light,i=e.style,a=[],s=Hi(t);if(void 0===t)return a;if("object"!==s)return a=a.concat([new Ht("light",t,`object expected, ${s} found`)]),a;for(let s in t){let o=s.match(Zi);a=o&&n[o[1]]&&n[o[1]].transition?a.concat(e.validateSpec({key:s,value:t[s],valueSpec:r.transition,validateSpec:e.validateSpec,style:i,styleSpec:r})):n[s]?a.concat(e.validateSpec({key:s,value:t[s],valueSpec:n[s],validateSpec:e.validateSpec,style:i,styleSpec:r})):a.concat([new Ht(s,t[s],`unknown property "${s}"`)])}return a}function ns(e){let t=e.value,r=e.styleSpec,n=r.sky,i=e.style,a=Hi(t);if(void 0===t)return[];if("object"!==a)return[new Ht("sky",t,`object expected, ${a} found`)];let s=[];for(let a in t){let o=a.match(Zi);s=o&&n[o[1]]&&n[o[1]].transition?s.concat(e.validateSpec({key:a,value:t[a],valueSpec:r.transition,style:i,styleSpec:r})):n[a]?s.concat(e.validateSpec({key:a,value:t[a],valueSpec:n[a],style:i,styleSpec:r})):s.concat([new Ht(a,t[a],`unknown property "${a}"`)])}return s}function is(e){let t=e.value,r=e.styleSpec,n=r.terrain,i=e.style,a=[],s=Hi(t);if(void 0===t)return a;if("object"!==s)return a=a.concat([new Ht("terrain",t,`object expected, ${s} found`)]),a;for(let s in t)a=n[s]?a.concat(e.validateSpec({key:s,value:t[s],valueSpec:n[s],validateSpec:e.validateSpec,style:i,styleSpec:r})):a.concat([new Ht(s,t[s],`unknown property "${s}"`)]);return a}function as(e){let t=[],r=e.value,n=e.key;if(Array.isArray(r)){let i=[],a=[];for(let s in r)r[s].id&&i.includes(r[s].id)&&t.push(new Ht(n,r,`all the sprites' ids must be unique, but ${r[s].id} is duplicated`)),i.push(r[s].id),r[s].url&&a.includes(r[s].url)&&t.push(new Ht(n,r,`all the sprites' URLs must be unique, but ${r[s].url} is duplicated`)),a.push(r[s].url),t=t.concat(Oa({key:`${n}[${s}]`,value:r[s],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:e.validateSpec}));return t}return Qa({key:n,value:r})}function ss(e){return!!e&&e.constructor===Object}function os(e){return ss(e.value)?[]:[new Ht(e.key,e.value,`object expected, ${Hi(e.value)} found`)]}const ls=1114111,us=/^u\+(?:([0-9a-f]{1,6})(?:-([0-9a-f]{1,6}))?|([0-9a-f]{0,5}\?{1,6}))$/i;function hs(e,t){if("string"!==Hi(t))return[];let r=`${t}`,n=()=>[new Ht(e,t,'invalid unicode range, expected a value such as "U+26", "U+0-10FFFF" or "U+4??"')],i=r.match(us);if(!i)return n();let[,a,s,o]=i;if(void 0!==o)return o.length>6?n():[];let l=parseInt(a,16),u=void 0===s?l:parseInt(s,16);return l>ls||u>ls?[new Ht(e,t,"unicode range is out of bounds, the maximum code point is U+10FFFF")]:l>u?[new Ht(e,t,`unicode range start must not be greater than its end, but ${r} is`)]:[]}function cs(e){let t=e.key??"font-faces",r=e.value,n=e.validateSpec,i=e.styleSpec??Yt,a=e.style;if(!ss(r))return[new Ht(t,r,`object expected, ${Hi(r)} found`)];let s=[];for(let e in r){let o=r[e],l=Hi(o);if("string"===l)s.push(...Qa({key:`${t}.${e}`,value:o}));else if("array"===l){let r={url:{type:"string",required:!0},"unicode-range":{type:"array",value:"string"}};for(let[l,u]of o.entries()){let o=`${t}.${e}[${l}]`;s.push(...Oa({key:o,value:u,valueSpec:r,styleSpec:i,style:a,validateSpec:n}));let h=ss(u)?u["unicode-range"]:void 0;if("array"===Hi(h))for(let[e,t]of h.entries())s.push(...hs(`${o}.unicode-range[${e}]`,t))}}else s.push(new Ht(`${t}.${e}`,o,`string or array expected, ${l} found`))}return s}const ps={"*":()=>[],array:Ra,boolean:function(e){let t=e.value,r=e.key,n=Hi(t);return"boolean"===n?[]:[new Ht(r,t,`boolean expected, ${n} found`)]},number:$a,color:qa,constants:za,enum:ja,filter:Ya,function:Na,layer:Ja,object:Oa,source:ts,light:rs,sky:ns,terrain:is,projection:function(e){let t=e.value,r=e.styleSpec,n=r.projection,i=e.style,a=Hi(t);if(void 0===t)return[];if("object"!==a)return[new Ht("projection",t,`object expected, ${a} found`)];let s=[];for(let a in t)s=n[a]?s.concat(e.validateSpec({key:a,value:t[a],valueSpec:n[a],style:i,styleSpec:r})):s.concat([new Ht(a,t[a],`unknown property "${a}"`)]);return s},projectionDefinition:function(e){let t=e.key,r=e.value;r=r instanceof String?r.valueOf():r;let n=Hi(r);return"array"!==n||function(e){return Array.isArray(e)&&3===e.length&&"string"==typeof e[0]&&"string"==typeof e[1]&&"number"==typeof e[2]}(r)||function(e){return!!["interpolate","step","literal"].includes(e[0])}(r)?["array","string"].includes(n)?[]:[new Ht(t,r,`projection expected, invalid type "${n}" found`)]:[new Ht(t,r,`projection expected, invalid array ${JSON.stringify(r)} found`)]},string:Qa,formatted:function(e){return 0===Qa(e).length?[]:Ua(e)},resolvedImage:function(e){return 0===Qa(e).length?[]:Ua(e)},padding:function(e){let t=e.key,r=e.value;if("array"===Hi(r)){if(r.length<1||r.length>4)return[new Ht(t,r,`padding requires 1 to 4 values; ${r.length} values found`)];let n={type:"number"},i=[];for(let a=0;a<r.length;a++)i=i.concat(e.validateSpec({key:`${t}[${a}]`,value:r[a],validateSpec:e.validateSpec,valueSpec:n}));return i}return $a({key:t,value:r,valueSpec:{}})},numberArray:function(e){let t=e.key,r=e.value;if("array"===Hi(r)){let n={type:"number"};if(r.length<1)return[new Ht(t,r,"array length at least 1 expected, length 0 found")];let i=[];for(let a=0;a<r.length;a++)i=i.concat(e.validateSpec({key:`${t}[${a}]`,value:r[a],validateSpec:e.validateSpec,valueSpec:n}));return i}return $a({key:t,value:r,valueSpec:{}})},colorArray:function(e){let t=e.key,r=e.value;if("array"===Hi(r)){if(r.length<1)return[new Ht(t,r,"array length at least 1 expected, length 0 found")];let e=[];for(let n=0;n<r.length;n++)e=e.concat(qa({key:`${t}[${n}]`,value:r[n],valueSpec:{}}));return e}return qa({key:t,value:r,valueSpec:{}})},variableAnchorOffsetCollection:function(e){let t=e.key,r=e.value,n=Hi(r),i=e.styleSpec;if("array"!==n||r.length<1||r.length%2!=0)return[new Ht(t,r,"variableAnchorOffsetCollection requires a non-empty array of even length")];let a=[];for(let n=0;n<r.length;n+=2)a=a.concat(ja({key:`${t}[${n}]`,value:r[n],valueSpec:i.layout_symbol["text-anchor"]})),a=a.concat(Ra({key:`${t}[${n+1}]`,value:r[n+1],valueSpec:{length:2,value:"number"},validateSpec:e.validateSpec,style:e.style,styleSpec:i}));return a},sprite:as,state:os,fontFaces:cs};function fs(e){let t=e.value,r=e.valueSpec,n=e.styleSpec;return e.validateSpec=fs,r.expression&&Ki(Va(t))?Na(e):r.expression&&ha(La(t))?Ua(e):r.type&&ps[r.type]?ps[r.type](e):Oa(Wi({},e,{valueSpec:r.type?n[r.type]:r}))}function ds(e){let t=e.value,r=e.key,n=Qa(e);return n.length||(-1===t.indexOf("{fontstack}")&&n.push(new Ht(r,t,'"glyphs" url must include a "{fontstack}" token')),-1===t.indexOf("{range}")&&n.push(new Ht(r,t,'"glyphs" url must include a "{range}" token'))),n}function ys(e,t=Zt){let r=[];return r=r.concat(fs({key:"",value:e,valueSpec:t.$root,styleSpec:t,style:e,validateSpec:fs,objectElementValidators:{glyphs:ds,"*":()=>[]}})),e.constants&&(r=r.concat(za({key:"constants",value:e.constants,style:e,styleSpec:t,validateSpec:fs}))),gs(r)}function ms(e){return function(t){return e(Object.assign({},t,{validateSpec:fs}))}}function gs(e){return[].concat(e).sort((e,t)=>e.line-t.line)}function xs(e){return function(...t){return gs(e.apply(this,t))}}ys.source=xs(ms(ts)),ys.sprite=xs(ms(as)),ys.glyphs=xs(ms(ds)),ys.fontFaces=xs(ms(cs)),ys.light=xs(ms(rs)),ys.sky=xs(ms(ns)),ys.terrain=xs(ms(is)),ys.state=xs(ms(os)),ys.layer=xs(ms(Ja)),ys.filter=xs(ms(Ya)),ys.paintProperty=xs(ms(Ha)),ys.layoutProperty=xs(ms(Ka));const vs={type:"enum","property-type":"data-constant",expression:{interpolated:!1,parameters:["global-state"]},values:{visible:{},none:{}},transition:!1,default:"visible"};var bs=class{constructor(e,t,r){this._rootKey=t,this._globalState=r,this.setValue(e)}evaluate(){return this._literalValue??this._compiledValue.evaluate({})}setValue(e){if(null==e||"visible"===e||"none"===e)return this._literalValue="none"===e?"none":"visible",this._compiledValue=void 0,void(this._globalStateRefs=new Set);let t=ca(e,this._rootKey,vs,this._globalState);if("error"===t.result)throw this._literalValue="visible",this._compiledValue=void 0,Error(t.value.map(e=>`${e.key}: ${e.message}`).join(", "));this._literalValue=void 0,this._compiledValue=t.value,this._globalStateRefs=ga(t.value.expression)}getGlobalStateRefs(){return this._globalStateRefs}};const ws=ys,Ds=new Set(Object.keys(Zt).filter(e=>e.startsWith("source_")).map(e=>e.slice(7).replaceAll("_","-")));function _s(e,t){let r=function(e){return Object.entries(e.sources??{}).filter(([,e])=>!Ds.has(e.type)).map(([e])=>`sources.${e}`)}(t);return As(e,ws(t).filter(({message:e})=>!r.some(t=>e.startsWith(`${t}:`)||e.startsWith(`${t}.`))))}function As(e,t){let r=!1;for(let n of t)"warning"!==n.severity?(e.fire(new Gt(Error(n.message))),r=!0):Je(n.message);return r}function Es(e,t,r,n){return!1!==n?.validate&&As(e,t({styleSpec:Zt,...r}))}var Ss=class e{constructor(e,t,r){let n=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;let i=new Int32Array(this.arrayBuffer);e=i[0],t=i[1],r=i[2],this.d=t+2*r;for(let e=0;e<this.d*this.d;e++){let t=i[3+e],r=i[3+e+1];n.push(t===r?null:i.subarray(t,r))}let a=i[3+n.length],s=i[3+n.length+1];this.keys=i.subarray(a,s),this.bboxes=i.subarray(s),this.insert=this._insertReadonly}else{this.d=t+2*r;for(let e=0;e<this.d*this.d;e++)n.push([]);this.keys=[],this.bboxes=[]}this.n=t,this.extent=e,this.padding=r,this.scale=t/e,this.uid=0;let i=r/t*e;this.min=-i,this.max=e+i}insert(e,t,r,n,i){this._forEachCell(t,r,n,i,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(t),this.bboxes.push(r),this.bboxes.push(n),this.bboxes.push(i)}_insertReadonly(){throw Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,t,r,n,i,a){this.cells[i].push(a)}query(e,t,r,n,i){let a=this.min,s=this.max;if(e<=a&&t<=a&&s<=r&&s<=n&&!i)return[...this.keys];{let a=[];return this._forEachCell(e,t,r,n,this._queryCell,a,{},i),a}}_queryCell(e,t,r,n,i,a,s,o){let l=this.cells[i];if(null!==l){let i=this.keys,u=this.bboxes;for(let h of l)if(void 0===s[h]){let l=4*h;(o?o(u[l+0],u[l+1],u[l+2],u[l+3]):e<=u[l+2]&&t<=u[l+3]&&r>=u[l+0]&&n>=u[l+1])?(s[h]=!0,a.push(i[h])):s[h]=!1}}}_forEachCell(e,t,r,n,i,a,s,o){let l=this._convertToCellCoord(e),u=this._convertToCellCoord(t),h=this._convertToCellCoord(r),c=this._convertToCellCoord(n);for(let p=l;p<=h;p++)for(let l=u;l<=c;l++){let u=this.d*l+p;if((!o||o(this._convertFromCellCoord(p),this._convertFromCellCoord(l),this._convertFromCellCoord(p+1),this._convertFromCellCoord(l+1)))&&i.call(this,e,t,r,n,u,a,s,o))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let e=this.cells,t=3+this.cells.length+1+1,r=0;for(let e of this.cells)r+=e.length;let n=new Int32Array(t+r+this.keys.length+this.bboxes.length);n[0]=this.extent,n[1]=this.n,n[2]=this.padding;let i=t;for(let t=0;t<e.length;t++){let r=e[t];n[3+t]=i,n.set(r,i),i+=r.length}return n[3+e.length]=i,n.set(this.keys,i),i+=this.keys.length,n[3+e.length+1]=i,n.set(this.bboxes,i),i+=this.bboxes.length,n.buffer}static serialize(e,t){let r=e.toArrayBuffer();return t&&t.push(r),{buffer:r}}static deserialize(t){return new e(t.buffer)}};const Fs={};function ks(e,t,r={}){if(Fs[e])throw Error(`${e} is already registered.`);Object.defineProperty(t,"_classRegistryKey",{value:e,writeable:!1}),Fs[e]={klass:t,omit:r.omit||[],shallow:r.shallow||[]}}ks("Object",Object),ks("Set",Set),ks("TransferableGridIndex",Ss),ks("Color",Ur),ks("Error",Error),ks("AJAXError",zt),ks("ResolvedImage",Jr),ks("StylePropertyFunction",ya),ks("StyleExpression",oa,{omit:["_evaluator"]}),ks("ZoomDependentExpression",fa),ks("ZoomConstantExpression",pa),ks("CompoundExpression",Vi,{omit:["_evaluate"]});for(let e in Ci)Ci[e]._classRegistryKey||ks(`Expression_${e}`,Ci[e]);function Is(e){return e&&typeof ArrayBuffer<"u"&&(e instanceof ArrayBuffer||"ArrayBuffer"===e.constructor?.name)}function Ts(e){let t=e.constructor;return e.$name||t._classRegistryKey}function Ms(e){return!function(e){if("object"!=typeof e||!e)return!1;let t=Ts(e);return t&&"Object"!==t}(e)&&(null==e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||e instanceof Blob||e instanceof Error||Is(e)||st(e)||ArrayBuffer.isView(e)||e instanceof ImageData)}function Cs(e,t){if(Ms(e))return(Is(e)||st(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 r=[];for(let n of e)r.push(Cs(n,t));return r}if("object"!=typeof e)throw Error("can't serialize object of type "+typeof e);let r=Ts(e);if(!r)throw Error(`can't serialize object of unregistered class ${e.constructor.name}`);if(!Fs[r])throw Error(`${r} is not registered.`);let{klass:n}=Fs[r],i=n.serialize?n.serialize(e,t):{};if(n.serialize){if(i===t?.[t.length-1])throw Error("statically serialized object won't survive transfer of $name property")}else{for(let n in e){if(!e.hasOwnProperty(n)||Fs[r].omit.includes(n))continue;let a=e[n];void 0!==a&&(i[n]=Fs[r].shallow.includes(n)?a:Cs(a,t))}e instanceof Error&&(i.message=e.message)}if(i.$name)throw Error("$name property is reserved for worker serialization logic.");return"Object"!==r&&(i.$name=r),i}function Bs(e){if(Ms(e))return e;if(Array.isArray(e))return e.map(Bs);if("object"!=typeof e)throw Error("can't deserialize object of type "+typeof e);let t=Ts(e)||"Object";if(!Fs[t])throw Error(`can't deserialize unregistered class ${t}`);let{klass:r}=Fs[t];if(!r)throw Error(`can't deserialize unregistered class ${t}`);if(r.deserialize)return r.deserialize(e);let n=Object.create(r.prototype);for(let r of Object.keys(e)){if("$name"===r)continue;let i=e[r];n[r]=Fs[t].shallow.includes(r)?i:Bs(i)}return n}var Ps=class{constructor(){this.first=!0}update(e,t){let r=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=r,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=r,!0):(this.lastFloorZoom>r?(this.lastIntegerZoom=r+1,this.lastIntegerZoomTime=t):this.lastFloorZoom<r&&(this.lastIntegerZoom=r,this.lastIntegerZoomTime=t),e!==this.lastZoom&&(this.lastZoom=e,this.lastFloorZoom=r,!0))}},zs=class{constructor(e,t){this.zoom=e,t?(this.now=t.now||0,this.fadeDuration=t.fadeDuration||0,this.zoomHistory=t.zoomHistory||new Ps,this.transition=t.transition||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Ps,this.transition={})}crossFadingFactor(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let e=this.zoom,t=e-Math.floor(e),r=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:t+(1-t)*r}:{fromScale:.5,toScale:1,t:1-(1-r)*t}}};const Vs="-transition";var Ls=class{constructor(e,t,r,n){this.property=e,this.value=t,this.expression=function(e,t,r,n){if(Ki(e))return new ya(e,t,r);if(ha(e)){let i=da(e,t,r,n);if("error"===i.result)throw Error(i.value.map(e=>`${e.key}: ${e.message}`).join(", "));return i.value}{let t=e;return"color"===r.type&&"string"==typeof e?t=Ur.parse(e):"padding"!==r.type||"number"!=typeof e&&!Array.isArray(e)?"numberArray"!==r.type||"number"!=typeof e&&!Array.isArray(e)?"colorArray"!==r.type||"string"!=typeof e&&!Array.isArray(e)?"variableAnchorOffsetCollection"===r.type&&Array.isArray(e)?t=Kr.parse(e):"projectionDefinition"===r.type&&"string"==typeof e&&(t=Qr.parse(e)):t=Zr.parse(e):t=Yr.parse(e):t=Xr.parse(e),{globalStateRefs:new Set,_globalState:null,kind:"constant",evaluate:()=>t}}}(void 0===t?e.specification.default:t,r,e.specification,n)}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(e,t,r){return this.property.possiblyEvaluate(this,e,t,r)}},Os=class{constructor(e,t,r){this.property=e,this.value=new Ls(e,void 0,t,r)}transitioned(e,t){return new $s(this.property,this.value,t,Re({},e.transition,this.transition),e.now)}untransitioned(){return new $s(this.property,this.value,null,{},0)}},Rs=class{constructor(e,t,r){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._globalState=r,this._rootKey=t}_propertyRootKey(e){return`${this._rootKey}.${String(e)}`}hasProperty(e){return e in this._properties.defaultTransitionablePropertyValues}getValue(e){return He(this._values[e].value.value)}setValue(e,t){Object.hasOwn(this._values,e)||(this._values[e]=new Os(this._values[e].property,this._propertyRootKey(e),this._globalState)),this._values[e].value=new Ls(this._values[e].property,null===t?void 0:He(t),this._propertyRootKey(e),this._globalState)}getTransition(e){return He(this._values[e].transition)}setTransition(e,t){Object.hasOwn(this._values,e)||(this._values[e]=new Os(this._values[e].property,this._propertyRootKey(e),this._globalState)),this._values[e].transition=He(t)||void 0}serialize(){let e={};for(let t of Object.keys(this._values)){let r=this.getValue(t);void 0!==r&&(e[t]=r);let n=this.getTransition(t);void 0!==n&&(e[`${t}${Vs}`]=n)}return e}transitioned(e,t){let r=new Ns(this._properties);for(let n of Object.keys(this._values))r._values[n]=this._values[n].transitioned(e,t._values[n]);return r}untransitioned(){let e=new Ns(this._properties);for(let t of Object.keys(this._values))e._values[t]=this._values[t].untransitioned();return e}},$s=class{constructor(e,t,r,n,i){this.property=e,this.value=t,this.begin=i+n.delay||0,this.end=this.begin+n.duration||0,e.specification.transition&&(n.delay||n.duration)&&(this.prior=r)}possiblyEvaluate(e,t,r){let n=e.now||0,i=this.value.possiblyEvaluate(e,t,r),a=this.prior;if(!a)return i;if(n>this.end||this.value.isDataDriven())return this.prior=null,i;if(n<this.begin)return a.possiblyEvaluate(e,t,r);{let s=(n-this.begin)/(this.end-this.begin);return this.property.interpolate(a.possiblyEvaluate(e,t,r),i,function(e){if(e<=0)return 0;if(e>=1)return 1;let t=e*e,r=t*e;return 4*(e<.5?r:3*(e-t)+r-.75)}(s))}}},Ns=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,t,r){let n=new js(this._properties);for(let i of Object.keys(this._values))n._values[i]=this._values[i].possiblyEvaluate(e,t,r);return n}hasTransition(){for(let e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}},Us=class{constructor(e,t,r){this._properties=e,this._values=Object.create(e.defaultPropertyValues),this._globalState=r,this._rootKey=t}_propertyRootKey(e){return`${this._rootKey}.${String(e)}`}hasValue(e){return void 0!==this._values[e].value}hasProperty(e){return e in this._properties.defaultPropertyValues}getValue(e){return He(this._values[e].value)}setValue(e,t){this._values[e]=new Ls(this._values[e].property,null===t?void 0:He(t),this._propertyRootKey(e),this._globalState)}serialize(){let e={};for(let t of Object.keys(this._values)){let r=this.getValue(t);void 0!==r&&(e[t]=r)}return e}possiblyEvaluate(e,t,r){let n=new js(this._properties);for(let i of Object.keys(this._values))n._values[i]=this._values[i].possiblyEvaluate(e,t,r);return n}},qs=class{constructor(e,t,r){this.property=e,this.value=t,this.parameters=r}isConstant(){return"constant"===this.value.kind}constantOr(e){return"constant"===this.value.kind?this.value.value:e}evaluate(e,t,r,n){return this.property.evaluate(this.value,this.parameters,e,t,r,n)}},js=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}};function Gs(e){if(Array.isArray(e))return e.length;let t=e?.values;return Array.isArray(t)?t.length:void 0}function Xs(e,t){let r=Gs(e),n=Gs(t);return void 0!==r&&void 0!==n&&r!==n}var Ys=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,r){if(Xs(e,t))return Je(`Property "${this.name}" is trying to interpolate arrays of different lengths. Rendering may 'jump'.`),t;let n=this.specification.type,i=fn[n];return i?i(e,t,r):e}},Zs=class{constructor(e,t,r){this.specification=e,this.name=t,this.overrides=r}possiblyEvaluate(e,t,r,n){return"constant"===e.expression.kind||"camera"===e.expression.kind?new qs(this,{kind:"constant",value:e.expression.evaluate(t,null,{},r,n)},t):new qs(this,e.expression,t)}interpolate(e,t,r){if("constant"!==e.value.kind||"constant"!==t.value.kind)return e;if(void 0===e.value.value||void 0===t.value.value)return new qs(this,{kind:"constant",value:void 0},e.parameters);if(Xs(e.value.value,t.value.value))return Je(`Property "${this.name}" is trying to interpolate arrays of different lengths. Rendering may 'jump'.`),t;let n=this.specification.type,i=fn[n];if(i){let n=i(e.value.value,t.value.value,r);return new qs(this,{kind:"constant",value:n},e.parameters)}return e}evaluate(e,t,r,n,i,a){return"constant"===e.kind?e.value:e.evaluate(t,r,n,i,a)}},Ws=class extends Zs{possiblyEvaluate(e,t,r,n){if(void 0===e.value)return new qs(this,{kind:"constant",value:void 0},t);if("constant"===e.expression.kind){let i=e.expression.evaluate(t,null,{},r,n),a="resolvedImage"===e.property.specification.type&&"string"!=typeof i?i.name:i,s=this._calculate(a,a,a,t);return new qs(this,{kind:"constant",value:s},t)}if("camera"===e.expression.kind){let r=this._calculate(e.expression.evaluate({zoom:t.zoom-1}),e.expression.evaluate({zoom:t.zoom}),e.expression.evaluate({zoom:t.zoom+1}),t);return new qs(this,{kind:"constant",value:r},t)}return new qs(this,e.expression,t)}evaluate(e,t,r,n,i,a){if("source"===e.kind){let s=e.evaluate(t,r,n,i,a);return this._calculate(s,s,s,t)}return"composite"===e.kind?this._calculate(e.evaluate({zoom:Math.floor(t.zoom)-1},r,n),e.evaluate({zoom:Math.floor(t.zoom)},r,n),e.evaluate({zoom:Math.floor(t.zoom)+1},r,n),t):e.value}_calculate(e,t,r,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:r,to:t}}interpolate(e){return e}},Hs=class{constructor(e,t){this.specification=e,this.name=t}possiblyEvaluate(e,t,r,n){if(void 0!==e.value){if("constant"===e.expression.kind){let i=e.expression.evaluate(t,null,{},r,n);return this._calculate(i,i,i,t)}return this._calculate(e.expression.evaluate(new zs(Math.floor(t.zoom-1),t)),e.expression.evaluate(new zs(Math.floor(t.zoom),t)),e.expression.evaluate(new zs(Math.floor(t.zoom+1),t)),t)}}_calculate(e,t,r,n){return n.zoom>n.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:r,to:t}}interpolate(e){return e}},Ks=class{constructor(e,t){this.specification=e,this.name=t}possiblyEvaluate(e,t,r,n){return!!e.expression.evaluate(t,null,{},r,n)}interpolate(){return!1}},Js=class{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let t in e){let r=e[t];r.specification.overridable&&this.overridableProperties.push(t);let n=this.defaultPropertyValues[t]=new Ls(r,void 0,r.name,void 0),i=this.defaultTransitionablePropertyValues[t]=new Os(r,r.name,void 0);this.defaultTransitioningPropertyValues[t]=i.untransitioned(),this.defaultPossiblyEvaluatedValues[t]=n.possiblyEvaluate({})}}};ks("DataDrivenProperty",Zs),ks("DataConstantProperty",Ys),ks("CrossFadedDataDrivenProperty",Ws),ks("CrossFadedProperty",Hs),ks("ColorRampProperty",Ks);const Qs=" is a PAINT property not a LAYOUT property. Use get/setPaintProperty instead?",eo=" is a LAYOUT property not a PAINT property. Use get/setLayoutProperty instead?";var to=class extends Xt{constructor(e,t,r){if(super(),this.id=e.id,this.type=e.type,this._globalState=r,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},this._visibilityExpression=function(e,t,r){return new bs(e,t,r)}(this.visibility,`layers[${this.id}].layout.visibility`,r),"custom"!==e.type&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,"background"!==e.type&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter,this._featureFilter=Fa(e.filter,`layers[${this.id}].filter`,r)),t.layout&&(this._unevaluatedLayout=new Us(t.layout,`layers[${this.id}].layout`,r)),t.paint)){this._transitionablePaint=new Rs(t.paint,`layers[${this.id}].paint`,r);for(let t in e.paint)this.setPaintProperty(t,e.paint[t],{validate:!1});for(let t in e.layout)this.setLayoutProperty(t,e.layout[t],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new js(t.paint)}}setFilter(e){this.filter=e,this._featureFilter=Fa(e,`layers[${this.id}].filter`,this._globalState)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){if("visibility"===e)return this.visibility;if(this._transitionablePaint?.hasProperty(e))throw Error(e+Qs);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 r=this._unevaluatedLayout._values[t];for(let t of r.getGlobalStateRefs())e.add(t)}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 r=this._transitionablePaint._values[t].value;for(let n of r.getGlobalStateRefs()){let i=e.get(n)??[];i.push({name:t,value:r.value}),e.set(n,i)}}return e}getVisibilityAffectingGlobalStateRefs(){return this._visibilityExpression.getGlobalStateRefs()}setLayoutProperty(e,t,r={}){if("visibility"===e)return this.visibility=t,this._visibilityExpression.setValue(t),void this.recalculateVisibility();this._transitionablePaint?.hasProperty(e)?this.fire(new Gt(Error(e+Qs))):null!=t&&this._validate(ws.layoutProperty,`layers.${this.id}.layout.${e}`,e,t,r)||this._unevaluatedLayout.setValue(e,t)}getPaintProperty(e){if(e.endsWith("-transition")){let t=e.slice(0,-11);if("visibility"===t||this._unevaluatedLayout?.hasProperty(t))throw Error(e+eo);return this._transitionablePaint.getTransition(t)}if("visibility"===e||this._unevaluatedLayout?.hasProperty(e))throw Error(e+eo);return this._transitionablePaint.getValue(e)}setPaintProperty(e,t,r={}){if("visibility"===e||this._unevaluatedLayout?.hasProperty(e))return this.fire(new Gt(Error(e+eo))),!1;if(null!=t&&this._validate(ws.paintProperty,`layers.${this.id}.paint.${e}`,e,t,r))return!1;if(e.endsWith("-transition"))return this._transitionablePaint.setTransition(e.slice(0,-11),t||void 0),!1;{let r=this._transitionablePaint._values[e],n="cross-faded-data-driven"===r.property.specification["property-type"],i=r.value.isDataDriven(),a=r.value;this._transitionablePaint.setValue(e,t),this._handleSpecialPaintPropertyUpdate(e);let s=this._transitionablePaint._values[e].value;return s.isDataDriven()||i||n||this._handleOverridablePaintPropertyUpdate(e,a,s)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,t,r){return!1}isHidden(e=this.minzoom,t=!1){return!!(this.minzoom&&e<(t?Math.floor(this.minzoom):this.minzoom)||this.maxzoom&&e>=this.maxzoom)||"none"===this._evaluatedVisibility}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,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),Ze(e,(e,t)=>!(void 0===e||"layout"===t&&!Object.keys(e).length||"paint"===t&&!Object.keys(e).length))}_validate(e,t,r,n,i={}){return Es(this,e,{key:t,layerType:this.type,objectKey:r,value:n},i)}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 qs&&Gi(t.property.specification)&&("source"===t.value.kind||"composite"===t.value.kind)&&t.value.isStateDependent)return!0}return!1}};let ro;var no={get paint(){return ro||=new Js({"raster-opacity":new Ys(Zt.paint_raster["raster-opacity"],"raster-opacity"),"raster-hue-rotate":new Ys(Zt.paint_raster["raster-hue-rotate"],"raster-hue-rotate"),"raster-brightness-min":new Ys(Zt.paint_raster["raster-brightness-min"],"raster-brightness-min"),"raster-brightness-max":new Ys(Zt.paint_raster["raster-brightness-max"],"raster-brightness-max"),"raster-saturation":new Ys(Zt.paint_raster["raster-saturation"],"raster-saturation"),"raster-contrast":new Ys(Zt.paint_raster["raster-contrast"],"raster-contrast"),resampling:new Ys(Zt.paint_raster.resampling,"resampling"),"raster-resampling":new Ys(Zt.paint_raster["raster-resampling"],"raster-resampling"),"raster-fade-duration":new Ys(Zt.paint_raster["raster-fade-duration"],"raster-fade-duration")})}};const io=e=>"raster"===e.type;var ao=class extends to{constructor(e,t){super(e,no,t)}};const so={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};var oo=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}},lo=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(5*this.capacity),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()}};function uo(e,t=1){let r=0,n=0;return{members:e.map(e=>{let i=function(e){return so[e].BYTES_PER_ELEMENT}(e.type),a=r=ho(r,Math.max(t,i)),s=e.components||1;return n=Math.max(n,i),r+=i*s,{name:e.name,type:e.type,components:s,offset:a}}),size:ho(r,Math.max(n,t)),alignment:t}}function ho(e,t){return Math.ceil(e/t)*t}var co=class extends lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t){let r=this.length;return this.resize(r+1),this.emplace(r,e,t)}emplace(e,t,r){let n=2*e;return this.int16[n+0]=t,this.int16[n+1]=r,e}};co.prototype.bytesPerElement=4,ks("StructArrayLayout2i4",co);var po=class extends lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r){let n=this.length;return this.resize(n+1),this.emplace(n,e,t,r)}emplace(e,t,r,n){let i=3*e;return this.int16[i+0]=t,this.int16[i+1]=r,this.int16[i+2]=n,e}};po.prototype.bytesPerElement=6,ks("StructArrayLayout3i6",po);var fo=class extends lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,n){let i=this.length;return this.resize(i+1),this.emplace(i,e,t,r,n)}emplace(e,t,r,n,i){let a=4*e;return this.int16[a+0]=t,this.int16[a+1]=r,this.int16[a+2]=n,this.int16[a+3]=i,e}};fo.prototype.bytesPerElement=8,ks("StructArrayLayout4i8",fo);var yo=class extends lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,n,i,a){let s=this.length;return this.resize(s+1),this.emplace(s,e,t,r,n,i,a)}emplace(e,t,r,n,i,a,s){let o=6*e;return this.int16[o+0]=t,this.int16[o+1]=r,this.int16[o+2]=n,this.int16[o+3]=i,this.int16[o+4]=a,this.int16[o+5]=s,e}};yo.prototype.bytesPerElement=12,ks("StructArrayLayout2i4i12",yo);var mo=class extends lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,n,i,a){let s=this.length;return this.resize(s+1),this.emplace(s,e,t,r,n,i,a)}emplace(e,t,r,n,i,a,s){let o=4*e,l=8*e;return this.int16[o+0]=t,this.int16[o+1]=r,this.uint8[l+4]=n,this.uint8[l+5]=i,this.uint8[l+6]=a,this.uint8[l+7]=s,e}};mo.prototype.bytesPerElement=8,ks("StructArrayLayout2i4ub8",mo);var go=class extends lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t){let r=this.length;return this.resize(r+1),this.emplace(r,e,t)}emplace(e,t,r){let n=2*e;return this.float32[n+0]=t,this.float32[n+1]=r,e}};go.prototype.bytesPerElement=8,ks("StructArrayLayout2f8",go);var xo=class extends lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,r,n,i,a,s,o,l,u){let h=this.length;return this.resize(h+1),this.emplace(h,e,t,r,n,i,a,s,o,l,u)}emplace(e,t,r,n,i,a,s,o,l,u,h){let c=10*e;return this.uint16[c+0]=t,this.uint16[c+1]=r,this.uint16[c+2]=n,this.uint16[c+3]=i,this.uint16[c+4]=a,this.uint16[c+5]=s,this.uint16[c+6]=o,this.uint16[c+7]=l,this.uint16[c+8]=u,this.uint16[c+9]=h,e}};xo.prototype.bytesPerElement=20,ks("StructArrayLayout10ui20",xo);var vo=class extends lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,r,n,i,a,s,o){let l=this.length;return this.resize(l+1),this.emplace(l,e,t,r,n,i,a,s,o)}emplace(e,t,r,n,i,a,s,o,l){let u=8*e;return this.uint16[u+0]=t,this.uint16[u+1]=r,this.uint16[u+2]=n,this.uint16[u+3]=i,this.uint16[u+4]=a,this.uint16[u+5]=s,this.uint16[u+6]=o,this.uint16[u+7]=l,e}};vo.prototype.bytesPerElement=16,ks("StructArrayLayout8ui16",vo);var bo=class extends lo{_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,r,n,i,a,s,o,l,u,h,c,p){let f=this.length;return this.resize(f+1),this.emplace(f,e,t,r,n,i,a,s,o,l,u,h,c,p)}emplace(e,t,r,n,i,a,s,o,l,u,h,c,p,f){let d=14*e,y=7*e;return this.int16[d+0]=t,this.int16[d+1]=r,this.int16[d+2]=n,this.int16[d+3]=i,this.uint16[d+4]=a,this.uint16[d+5]=s,this.uint16[d+6]=o,this.uint16[d+7]=l,this.int16[d+8]=u,this.int16[d+9]=h,this.int16[d+10]=c,this.int16[d+11]=p,this.float32[y+6]=f,e}};bo.prototype.bytesPerElement=28,ks("StructArrayLayout4i4ui4i1f28",bo);var wo=class extends lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r){let n=this.length;return this.resize(n+1),this.emplace(n,e,t,r)}emplace(e,t,r,n){let i=3*e;return this.float32[i+0]=t,this.float32[i+1]=r,this.float32[i+2]=n,e}};wo.prototype.bytesPerElement=12,ks("StructArrayLayout3f12",wo);var Do=class extends lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){let t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){let r=1*e;return this.uint32[r+0]=t,e}};Do.prototype.bytesPerElement=4,ks("StructArrayLayout1ul4",Do);var _o=class extends lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,r,n,i,a,s,o,l){let u=this.length;return this.resize(u+1),this.emplace(u,e,t,r,n,i,a,s,o,l)}emplace(e,t,r,n,i,a,s,o,l,u){let h=10*e,c=5*e;return this.int16[h+0]=t,this.int16[h+1]=r,this.int16[h+2]=n,this.int16[h+3]=i,this.int16[h+4]=a,this.int16[h+5]=s,this.uint32[c+3]=o,this.uint16[h+8]=l,this.uint16[h+9]=u,e}};_o.prototype.bytesPerElement=20,ks("StructArrayLayout6i1ul2ui20",_o);var Ao=class extends lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,n,i,a){let s=this.length;return this.resize(s+1),this.emplace(s,e,t,r,n,i,a)}emplace(e,t,r,n,i,a,s){let o=6*e;return this.int16[o+0]=t,this.int16[o+1]=r,this.int16[o+2]=n,this.int16[o+3]=i,this.int16[o+4]=a,this.int16[o+5]=s,e}};Ao.prototype.bytesPerElement=12,ks("StructArrayLayout2i2i2i12",Ao);var Eo=class extends lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,n,i){let a=this.length;return this.resize(a+1),this.emplace(a,e,t,r,n,i)}emplace(e,t,r,n,i,a){let s=4*e,o=8*e;return this.float32[s+0]=t,this.float32[s+1]=r,this.float32[s+2]=n,this.int16[o+6]=i,this.int16[o+7]=a,e}};Eo.prototype.bytesPerElement=16,ks("StructArrayLayout2f1f2i16",Eo);var So=class extends lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,n,i,a){let s=this.length;return this.resize(s+1),this.emplace(s,e,t,r,n,i,a)}emplace(e,t,r,n,i,a,s){let o=16*e,l=4*e,u=8*e;return this.uint8[o+0]=t,this.uint8[o+1]=r,this.float32[l+1]=n,this.float32[l+2]=i,this.int16[u+6]=a,this.int16[u+7]=s,e}};So.prototype.bytesPerElement=16,ks("StructArrayLayout2ub2f2i16",So);var Fo=class extends lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,r){let n=this.length;return this.resize(n+1),this.emplace(n,e,t,r)}emplace(e,t,r,n){let i=3*e;return this.uint16[i+0]=t,this.uint16[i+1]=r,this.uint16[i+2]=n,e}};Fo.prototype.bytesPerElement=6,ks("StructArrayLayout3ui6",Fo);var ko=class extends lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r,n,i,a,s,o,l,u,h,c,p,f,d,y,m,g){let x=this.length;return this.resize(x+1),this.emplace(x,e,t,r,n,i,a,s,o,l,u,h,c,p,f,d,y,m,g)}emplace(e,t,r,n,i,a,s,o,l,u,h,c,p,f,d,y,m,g,x){let v=26*e,b=13*e,w=52*e;return this.int16[v+0]=t,this.int16[v+1]=r,this.uint16[v+2]=n,this.uint16[v+3]=i,this.uint32[b+2]=a,this.uint32[b+3]=s,this.uint32[b+4]=o,this.uint16[v+10]=l,this.uint16[v+11]=u,this.uint16[v+12]=h,this.float32[b+7]=c,this.float32[b+8]=p,this.uint8[w+36]=f,this.uint8[w+37]=d,this.uint8[w+38]=y,this.uint32[b+10]=m,this.int16[v+22]=g,this.float32[b+12]=x,e}};ko.prototype.bytesPerElement=52,ks("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i1f52",ko);var Io=class extends lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r,n,i,a,s,o,l,u,h,c,p,f,d,y,m,g,x,v,b,w,D,_,A,E,S,F,k){let I=this.length;return this.resize(I+1),this.emplace(I,e,t,r,n,i,a,s,o,l,u,h,c,p,f,d,y,m,g,x,v,b,w,D,_,A,E,S,F,k)}emplace(e,t,r,n,i,a,s,o,l,u,h,c,p,f,d,y,m,g,x,v,b,w,D,_,A,E,S,F,k,I){let T=34*e,M=17*e;return this.int16[T+0]=t,this.int16[T+1]=r,this.int16[T+2]=n,this.int16[T+3]=i,this.int16[T+4]=a,this.int16[T+5]=s,this.int16[T+6]=o,this.int16[T+7]=l,this.uint16[T+8]=u,this.uint16[T+9]=h,this.uint16[T+10]=c,this.uint16[T+11]=p,this.uint16[T+12]=f,this.uint16[T+13]=d,this.uint16[T+14]=y,this.uint16[T+15]=m,this.uint16[T+16]=g,this.uint16[T+17]=x,this.uint16[T+18]=v,this.uint16[T+19]=b,this.uint16[T+20]=w,this.uint16[T+21]=D,this.uint16[T+22]=_,this.uint32[M+12]=A,this.float32[M+13]=E,this.float32[M+14]=S,this.uint16[T+30]=F,this.uint16[T+31]=k,this.float32[M+16]=I,e}};Io.prototype.bytesPerElement=68,ks("StructArrayLayout8i15ui1ul2f2ui1f68",Io);var To=class extends lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){let t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){let r=1*e;return this.float32[r+0]=t,e}};To.prototype.bytesPerElement=4,ks("StructArrayLayout1f4",To);var Mo=class extends lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r){let n=this.length;return this.resize(n+1),this.emplace(n,e,t,r)}emplace(e,t,r,n){let i=6*e,a=3*e;return this.uint16[i+0]=t,this.float32[a+1]=r,this.float32[a+2]=n,e}};Mo.prototype.bytesPerElement=12,ks("StructArrayLayout1ui2f12",Mo);var Co=class extends lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,r){let n=this.length;return this.resize(n+1),this.emplace(n,e,t,r)}emplace(e,t,r,n){let i=2*e,a=4*e;return this.uint32[i+0]=t,this.uint16[a+2]=r,this.uint16[a+3]=n,e}};Co.prototype.bytesPerElement=8,ks("StructArrayLayout1ul2ui8",Co);var Bo=class extends lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t){let r=this.length;return this.resize(r+1),this.emplace(r,e,t)}emplace(e,t,r){let n=2*e;return this.uint16[n+0]=t,this.uint16[n+1]=r,e}};Bo.prototype.bytesPerElement=4,ks("StructArrayLayout2ui4",Bo);var Po=class extends lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){let t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){let r=1*e;return this.uint16[r+0]=t,e}};Po.prototype.bytesPerElement=2,ks("StructArrayLayout1ui2",Po);var zo=class extends lo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r,n){let i=this.length;return this.resize(i+1),this.emplace(i,e,t,r,n)}emplace(e,t,r,n,i){let a=4*e;return this.float32[a+0]=t,this.float32[a+1]=r,this.float32[a+2]=n,this.float32[a+3]=i,e}};zo.prototype.bytesPerElement=16,ks("StructArrayLayout4f16",zo);var Vo=class extends oo{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 l(this.anchorPointX,this.anchorPointY)}};Vo.prototype.size=20;var Lo=class extends _o{get(e){return new Vo(this,e)}};ks("CollisionBoxArray",Lo);var Oo=class extends oo{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]}};Oo.prototype.size=52;var Ro=class extends ko{get(e){return new Oo(this,e)}};ks("PlacedSymbolArray",Ro);var $o=class extends oo{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]}};$o.prototype.size=68;var No=class extends Io{get(e){return new $o(this,e)}};ks("SymbolInstanceArray",No);var Uo=class extends To{getoffsetX(e){return this.float32[1*e+0]}};ks("GlyphOffsetArray",Uo);var qo=class extends po{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}};ks("SymbolLineVertexArray",qo);var jo=class extends oo{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]}};jo.prototype.size=12;var Go=class extends Mo{get(e){return new jo(this,e)}};ks("TextAnchorOffsetArray",Go);var Xo=class extends oo{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}};Xo.prototype.size=8;var Yo=class extends Co{get(e){return new Xo(this,e)}};ks("FeatureIndexArray",Yo);var Zo=class extends co{},Wo=class extends po{},Ho=class extends fo{},Ko=class extends co{},Jo=class extends co{},Qo=class extends yo{},el=class extends mo{},tl=class extends go{},rl=class extends xo{},nl=class extends vo{},il=class extends bo{},al=class extends wo{},sl=class extends Do{},ol=class extends Ao{},ll=class extends Eo{},ul=class extends So{},hl=class extends Fo{},cl=class extends Fo{},pl=class extends Bo{},fl=class extends Po{};const dl=uo([{name:"a_pos",components:2,type:"Int16"}],4),yl=dl.members;dl.size,dl.alignment;var ml=class e{constructor(e=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=e}prepareSegment(t,r,n,i){let a=this.segments[this.segments.length-1];return t>e.MAX_VERTEX_ARRAY_LENGTH&&Je(`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||!a||a.vertexLength+t>e.MAX_VERTEX_ARRAY_LENGTH||a.sortKey!==i?this.createNewSegment(r,n,i):a}createNewSegment(e,t,r){let n={vertexOffset:e.length,primitiveOffset:t.length,vertexLength:0,primitiveLength:0,vaos:{}};return void 0!==r&&(n.sortKey=r),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(n),n}getOrCreateLatestSegment(e,t,r){return this.prepareSegment(0,e,t,r)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(let e of this.segments)for(let t in e.vaos)e.vaos[t].destroy()}static simpleSegment(t,r,n,i){return new e([{vertexOffset:t,primitiveOffset:r,vertexLength:n,primitiveLength:i,vaos:{},sortKey:0}])}};function gl(e,t){return 256*(e=Le(Math.floor(e),0,255))+Le(Math.floor(t),0,255)}ml.MAX_VERTEX_ARRAY_LENGTH=65535,ks("SegmentVector",ml);const xl=uo([{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"}]),vl=uo([{name:"a_dasharray_from",components:4,type:"Uint16"},{name:"a_dasharray_to",components:4,type:"Uint16"}]);var bl=s((e,t)=>{void 0!==t&&(t.exports=function(e,t){for(var r,n,i=3&e.length,a=e.length-i,s=t,o=3432918353,l=461845907,u=0;u<a;)n=255&e.charCodeAt(u)|(255&e.charCodeAt(++u))<<8|(255&e.charCodeAt(++u))<<16|(255&e.charCodeAt(++u))<<24,++u,s=27492+(65535&(r=5*(65535&(s=(s^=n=(65535&(n=(n=(65535&n)*o+(((n>>>16)*o&65535)<<16)&4294967295)<<15|n>>>17))*l+(((n>>>16)*l&65535)<<16)&4294967295)<<13|s>>>19))+((5*(s>>>16)&65535)<<16)&4294967295))+(((r>>>16)+58964&65535)<<16);switch(n=0,i){case 3:n^=(255&e.charCodeAt(u+2))<<16;case 2:n^=(255&e.charCodeAt(u+1))<<8;case 1:s^=n=(65535&(n=(n=(65535&(n^=255&e.charCodeAt(u)))*o+(((n>>>16)*o&65535)<<16)&4294967295)<<15|n>>>17))*l+(((n>>>16)*l&65535)<<16)&4294967295}return s^=e.length,s=2246822507*(65535&(s^=s>>>16))+((2246822507*(s>>>16)&65535)<<16)&4294967295,s=3266489909*(65535&(s^=s>>>13))+((3266489909*(s>>>16)&65535)<<16)&4294967295,(s^=s>>>16)>>>0})}),wl=s((e,t)=>{t.exports=function(e,t){for(var r,n=e.length,i=t^n,a=0;n>=4;)r=1540483477*(65535&(r=255&e.charCodeAt(a)|(255&e.charCodeAt(++a))<<8|(255&e.charCodeAt(++a))<<16|(255&e.charCodeAt(++a))<<24))+((1540483477*(r>>>16)&65535)<<16),i=1540483477*(65535&i)+((1540483477*(i>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),n-=4,++a;switch(n){case 3:i^=(255&e.charCodeAt(a+2))<<16;case 2:i^=(255&e.charCodeAt(a+1))<<8;case 1:i=1540483477*(65535&(i^=255&e.charCodeAt(a)))+((1540483477*(i>>>16)&65535)<<16)}return i=1540483477*(65535&(i^=i>>>13))+((1540483477*(i>>>16)&65535)<<16),(i^=i>>>15)>>>0}}),Dl=((r,n,a)=>(a=null==r?{}:e(i(r)),o(t(a,"default",{value:r,enumerable:!0}),r)))(s((e,t)=>{var r=bl(),n=wl();t.exports=r,t.exports.murmur3=r,t.exports.murmur2=n})()),_l=class e{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,t,r,n){this.ids.push(Al(e)),this.positions.push(t,r,n)}getPositions(e){if(!this.indexed)throw Error("Trying to get index, but feature positions are not indexed");let t=Al(e),r=0,n=this.ids.length-1;for(;r<n;){let e=r+n>>1;this.ids[e]>=t?n=e:r=e+1}let i=[];for(;this.ids[r]===t;){let e=this.positions[3*r],t=this.positions[3*r+1],n=this.positions[3*r+2];i.push({index:e,start:t,end:n}),r++}return i}static serialize(e,t){let r=new Float64Array(e.ids),n=new Uint32Array(e.positions);return El(r,n,0,r.length-1),t&&t.push(r.buffer,n.buffer),{ids:r,positions:n}}static deserialize(t){let r=new e;return r.ids=t.ids,r.positions=t.positions,r.indexed=!0,r}};function Al(e){let t=+e;return!isNaN(t)&&t<=2**53-1?t:(0,Dl.default)(String(e))}function El(e,t,r,n){for(;r<n;){let i=e[r+n>>1],a=r-1,s=n+1;for(;;){do{a++}while(e[a]<i);do{s--}while(e[s]>i);if(a>=s)break;Sl(e,a,s),Sl(t,3*a,3*s),Sl(t,3*a+1,3*s+1),Sl(t,3*a+2,3*s+2)}s-r<n-s?(El(e,t,r,s),r=s+1):(El(e,t,s+1,n),n=s)}}function Sl(e,t,r){let n=e[t];e[t]=e[r],e[r]=n}ks("FeaturePositionMap",_l);var Fl=class{constructor(e,t){this.gl=e.gl,this.location=t}},kl=class extends Fl{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1i(this.location,e))}},Il=class extends Fl{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}},Tl=class extends Fl{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]))}},Ml=class extends Fl{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]))}},Cl=class extends Fl{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]))}},Bl=class extends Fl{constructor(e,t){super(e,t),this.current=Ur.transparent}set(e){(e.r!==this.current.r||e.g!==this.current.g||e.b!==this.current.b||e.a!==this.current.a)&&(this.current=e,this.gl.uniform4f(this.location,e.r,e.g,e.b,e.a))}},Pl=class extends Fl{constructor(e,t){super(e,t),this.current=[]}set(e){if(e!=this.current){this.current=e;let t=new Float32Array(4*e.length);for(let r=0;r<e.length;r++)t[4*r]=e[r].r,t[4*r+1]=e[r].g,t[4*r+2]=e[r].b,t[4*r+3]=e[r].a;this.gl.uniform4fv(this.location,t)}}},zl=class extends Fl{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)}}};const Vl=new Float32Array(16);var Ll=class extends Fl{constructor(e,t){super(e,t),this.current=Vl}set(e){if(e[12]!==this.current[12]||e[0]!==this.current[0])return this.current=e,void this.gl.uniformMatrix4fv(this.location,!1,e);for(let t=1;t<16;t++)if(e[t]!==this.current[t]){this.current=e,this.gl.uniformMatrix4fv(this.location,!1,e);break}}};function Ol(e){return[gl(255*e.r,255*e.g),gl(255*e.b,255*e.a)]}var Rl=class{constructor(e,t,r){this.value=e,this.uniformNames=t.map(e=>`u_${e}`),this.type=r}setUniform(e,t,r){e.set(r.constantOr(this.value))}getBinding(e,t,r){return"color"===this.type?new Bl(e,t):new Il(e,t)}},$l=class{constructor(e,t){this.uniformNames=t.map(e=>`u_${e}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,t){this.pixelRatioFrom=t.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=t.tlbr,this.patternTo=e.tlbr}setConstantDashPositions(e,t){this.dashTo=[0,e.y,e.height,e.width],this.dashFrom=[0,t.y,t.height,t.width]}setUniform(e,t,r,n){let i=null;"u_pattern_to"===n?i=this.patternTo:"u_pattern_from"===n?i=this.patternFrom:"u_dasharray_to"===n?i=this.dashTo:"u_dasharray_from"===n?i=this.dashFrom:"u_pixel_ratio_to"===n?i=this.pixelRatioTo:"u_pixel_ratio_from"===n&&(i=this.pixelRatioFrom),null!==i&&e.set(i)}getBinding(e,t,r){return r.startsWith("u_pattern")||r.startsWith("u_dasharray_")?new Cl(e,t):new Il(e,t)}},Nl=class{constructor(e,t,r,n){this.expression=e,this.type=r,this.maxValue=0,this.paintVertexAttributes=t.map(e=>({name:`a_${e}`,type:"Float32",components:"color"===r?2:1,offset:0})),this.paintVertexArray=new n}populatePaintArray(e,t,r){let n=this.paintVertexArray.length,i=this.expression.evaluate(new zs(0,r),t,{},r.canonical,[],r.formattedSection);this.paintVertexArray.resize(e),this._setPaintValue(n,e,i)}updatePaintArray(e,t,r,n,i){let a=this.expression.evaluate(new zs(0,i),r,n);this._setPaintValue(e,t,a)}_setPaintValue(e,t,r){if("color"===this.type){let n=Ol(r);for(let r=e;r<t;r++)this.paintVertexArray.emplace(r,n[0],n[1])}else{for(let n=e;n<t;n++)this.paintVertexArray.emplace(n,r);this.maxValue=Math.max(this.maxValue,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()}},Ul=class{constructor(e,t,r,n,i,a){this.expression=e,this.uniformNames=t.map(e=>`u_${e}_t`),this.type=r,this.useIntegerZoom=n,this.zoom=i,this.maxValue=0,this.paintVertexAttributes=t.map(e=>({name:`a_${e}`,type:"Float32",components:"color"===r?4:2,offset:0})),this.paintVertexArray=new a}populatePaintArray(e,t,r){let n=this.expression.evaluate(new zs(this.zoom,r),t,{},r.canonical,[],r.formattedSection),i=this.expression.evaluate(new zs(this.zoom+1,r),t,{},r.canonical,[],r.formattedSection),a=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(a,e,n,i)}updatePaintArray(e,t,r,n,i){let a=this.expression.evaluate(new zs(this.zoom,i),r,n),s=this.expression.evaluate(new zs(this.zoom+1,i),r,n);this._setPaintValue(e,t,a,s)}_setPaintValue(e,t,r,n){if("color"===this.type){let i=Ol(r),a=Ol(n);for(let r=e;r<t;r++)this.paintVertexArray.emplace(r,i[0],i[1],a[0],a[1])}else{for(let i=e;i<t;i++)this.paintVertexArray.emplace(i,r,n);this.maxValue=Math.max(this.maxValue,Math.abs(r),Math.abs(n))}}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 r=this.useIntegerZoom?Math.floor(t.zoom):t.zoom,n=Le(this.expression.interpolationFactor(r,this.zoom,this.zoom+1),0,1);e.set(n)}getBinding(e,t,r){return new Il(e,t)}},ql=class{constructor(e,t,r,n,i,a){this.expression=e,this.type=t,this.useIntegerZoom=r,this.zoom=n,this.layerId=a,this.zoomInPaintVertexArray=new i,this.zoomOutPaintVertexArray=new i}populatePaintArray(e,t,r){let n=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(n,e,this.getPositionIds(t),r)}updatePaintArray(e,t,r,n,i){this._setPaintValues(e,t,this.getPositionIds(r),i)}_setPaintValues(e,t,r,n){let i=this.getPositions(n);if(!i||!r)return;let a=i[r.min],s=i[r.mid],o=i[r.max];if(a&&s&&o)for(let r=e;r<t;r++)this.emplace(this.zoomInPaintVertexArray,r,a,s),this.emplace(this.zoomOutPaintVertexArray,r,o,s)}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()}},jl=class extends ql{getPositions(e){return e.imagePositions}getPositionIds(e){return e.patterns?.[this.layerId]}getVertexAttributes(){return xl.members}emplace(e,t,r,n){e.emplace(t,r.tlbr[0],r.tlbr[1],r.tlbr[2],r.tlbr[3],n.tlbr[0],n.tlbr[1],n.tlbr[2],n.tlbr[3],r.pixelRatio,n.pixelRatio)}},Gl=class extends ql{getPositions(e){return e.dashPositions}getPositionIds(e){return e.dashes?.[this.layerId]}getVertexAttributes(){return vl.members}emplace(e,t,r,n){e.emplace(t,0,r.y,r.height,r.width,0,n.y,n.height,n.width)}},Xl=class{constructor(e,t,r){this.binders={},this._buffers=[];let n=[];for(let i in e.paint._values){if(!r(i))continue;let a=e.paint.get(i);if(!(a instanceof qs&&Gi(a.property.specification)))continue;let s=Zl(i,e.type),o=a.value,l=a.property.specification.type,u=a.property.useIntegerZoom,h=a.property.specification["property-type"],c="cross-faded"===h||"cross-faded-data-driven"===h;if("constant"===o.kind)this.binders[i]=c?new $l(o.value,s):new Rl(o.value,s,l),n.push(`/u_${i}`);else if("source"===o.kind||c){let r=Wl(i,l,"source");this.binders[i]=c?"line-dasharray"===i?new Gl(o,l,u,t,r,e.id):new jl(o,l,u,t,r,e.id):new Nl(o,s,l,r),n.push(`/a_${i}`)}else{let e=Wl(i,l,"composite");this.binders[i]=new Ul(o,s,l,u,t,e),n.push(`/z_${i}`)}}this.cacheKey=n.sort().join("")}getMaxValue(e){let t=this.binders[e];return t instanceof Nl||t instanceof Ul?t.maxValue:0}populatePaintArrays(e,t,r){for(let n in this.binders){let i=this.binders[n];(i instanceof Nl||i instanceof Ul||i instanceof ql)&&i.populatePaintArray(e,t,r)}}setConstantPatternPositions(e,t){for(let r in this.binders){let n=this.binders[r];n instanceof $l&&n.setConstantPatternPositions(e,t)}}setConstantDashPositions(e,t){for(let r in this.binders){let n=this.binders[r];n instanceof $l&&n.setConstantDashPositions(e,t)}}updatePaintArrays(e,t,r,n,i){let a=!1;for(let s of e){let e=t.getPositions(s.id);for(let t of e){let e=r.feature(t.index);for(let r in this.binders){let o=this.binders[r];(o instanceof Nl||o instanceof Ul||o instanceof ql)&&!0===o.expression.isStateDependent&&(o.expression=n.paint.get(r).value,o.updatePaintArray(t.start,t.end,e,s.state,i),a=!0)}}}return a}defines(){let e=[];for(let t in this.binders){let r=this.binders[t];(r instanceof Rl||r instanceof $l)&&e.push(...r.uniformNames.map(e=>`#define HAS_UNIFORM_${e}`))}return e}getBinderAttributes(){let e=[];for(let t in this.binders){let r=this.binders[t];if(r instanceof Nl||r instanceof Ul)for(let t of r.paintVertexAttributes)e.push(t.name);else if(r instanceof ql){let t=r.getVertexAttributes();for(let r of t)e.push(r.name)}}return e}getBinderUniforms(){let e=[];for(let t in this.binders){let r=this.binders[t];if(r instanceof Rl||r instanceof $l||r instanceof Ul)for(let t of r.uniformNames)e.push(t)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,t){let r=[];for(let n in this.binders){let i=this.binders[n];if(i instanceof Rl||i instanceof $l||i instanceof Ul)for(let a of i.uniformNames)if(t[a]){let s=i.getBinding(e,t[a],a);r.push({name:a,property:n,binding:s})}}return r}setUniforms(e,t,r,n){for(let{name:e,property:i,binding:a}of t)this.binders[i].setUniform(a,n,r.get(i),e)}updatePaintBuffers(e){this._buffers=[];for(let t in this.binders){let r=this.binders[t];if(e&&r instanceof ql){let t=2===e.fromScale?r.zoomInPaintVertexBuffer:r.zoomOutPaintVertexBuffer;t&&this._buffers.push(t)}else(r instanceof Nl||r instanceof Ul)&&r.paintVertexBuffer&&this._buffers.push(r.paintVertexBuffer)}}upload(e){for(let t in this.binders){let r=this.binders[t];(r instanceof Nl||r instanceof Ul||r instanceof ql)&&r.upload(e)}this.updatePaintBuffers()}destroy(){for(let e in this.binders){let t=this.binders[e];(t instanceof Nl||t instanceof Ul||t instanceof ql)&&t.destroy()}}},Yl=class{constructor(e,t,r=()=>!0){this.programConfigurations={};for(let n of e)this.programConfigurations[n.id]=new Xl(n,t,r);this.needsUpload=!1,this._featureMap=new _l,this._bufferOffset=0}populatePaintArrays(e,t,r,n){for(let r in this.programConfigurations)this.programConfigurations[r].populatePaintArrays(e,t,n);void 0!==t.id&&this._featureMap.add(t.id,r,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,t,r,n){for(let i of r)this.needsUpload=this.programConfigurations[i.id].updatePaintArrays(e,this._featureMap,t,i,n)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(let t in this.programConfigurations)this.programConfigurations[t].upload(e);this.needsUpload=!1}}destroy(){for(let e in this.programConfigurations)this.programConfigurations[e].destroy()}};function Zl(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 Wl(e,t,r){let n={color:{source:go,composite:zo},number:{source:To,composite:go}};return function(e){return{"line-pattern":{source:rl,composite:rl},"fill-pattern":{source:rl,composite:rl},"fill-extrusion-pattern":{source:rl,composite:rl},"line-dasharray":{source:nl,composite:nl}}[e]}(e)?.[r]||n[t][r]}ks("ConstantBinder",Rl),ks("CrossFadedConstantBinder",$l),ks("SourceExpressionBinder",Nl),ks("CrossFadedPatternBinder",jl),ks("CrossFadedDasharrayBinder",Gl),ks("CompositeExpressionBinder",Ul),ks("ProgramConfiguration",Xl,{omit:["_buffers"]}),ks("ProgramConfigurationSet",Yl);const Hl=16383,Kl=-Hl-1;function Jl(e){let t=de/e.extent,r=e.loadGeometry();for(let e of r)for(let r of e){let e=Math.round(r.x*t),n=Math.round(r.y*t);r.x=Le(e,Kl,Hl),r.y=Le(n,Kl,Hl),(e<r.x||e>r.x+1||n<r.y||n>r.y+1)&&Je("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return r}function Ql(e,t){return{type:e.type,id:e.id,properties:e.properties,geometry:t?Jl(e):[]}}const eu=-32768;function tu(e,t,r,n,i){e.emplaceBack(eu+8*t+n,eu+8*r+i)}var ru=class{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.id),this.index=e.index,this.hasDependencies=!1,this.layoutVertexArray=new Ko,this.indexArray=new cl,this.segments=new ml,this.programConfigurations=new Yl(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(e,t,r){let n=this.layers[0],i=[],a=null,s=!1,o="heatmap"===n.type;if("circle"===n.type){let e=n;a=e.layout.get("circle-sort-key"),s=!a.isConstant(),o||="map"===e.paint.get("circle-pitch-alignment")}let l=o?t.subdivisionGranularity.circle:1,u=new zs(this.zoom),h=this.layers[0]._featureFilter.needGeometry;for(let{feature:t,id:n,index:o,sourceLayerIndex:l}of e){let e=Ql(t,h);if(!this.layers[0]._featureFilter.filter(u,e,r))continue;let c=s?a.evaluate(e,{},r):void 0,p={id:n,properties:t.properties,type:t.type,sourceLayerIndex:l,index:o,geometry:h?e.geometry:Jl(t),patterns:{},sortKey:c};i.push(p)}s&&i.sort((e,t)=>e.sortKey-t.sortKey);for(let n of i){let{geometry:i,index:a,sourceLayerIndex:s}=n,o=e[a].feature;this.addFeature(n,i,a,r,l),t.featureIndex.insert(o,i,a,s,this.index)}}update(e,t,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,{imagePositions:r})}addFeatures(e){}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,yl),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,t,r,n,i=1){let a;switch(i){case 1:a=[0,7];break;case 3:a=[0,2,5,7];break;case 5:a=[0,1,3,4,6,7];break;case 7:a=[0,1,2,3,4,5,6,7];break;default:throw Error(`Invalid circle bucket granularity: ${i}; valid values are 1, 3, 5, 7.`)}let s=a.length;for(let r of t)for(let t of r){let r=t.x,n=t.y;if(r<0||r>=8192||n<0||n>=8192)continue;let i=this.segments.prepareSegment(s*s,this.layoutVertexArray,this.indexArray,e.sortKey),o=i.vertexLength;for(let e=0;e<s;e++)for(let t=0;t<s;t++)tu(this.layoutVertexArray,r,n,a[t],a[e]);for(let e=0;e<s-1;e++)for(let t=0;t<s-1;t++){let r=o+e*s+t,n=o+(e+1)*s+t;this.indexArray.emplaceBack(r,n+1,r+1),this.indexArray.emplaceBack(r,n,n+1)}i.vertexLength+=s*s,i.primitiveLength+=(s-1)*(s-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,{imagePositions:{},canonical:n})}};function nu(e,t){for(let r of e)if(pu(t,r))return!0;for(let r of t)if(pu(e,r))return!0;return ou(e,t)}function iu(e,t,r){return!!pu(e,t)||uu(t,e,r)}function au(e,t){if(1===e.length)return cu(t,e[0]);for(let r of t)for(let t of r)if(pu(e,t))return!0;for(let r of e)if(cu(t,r))return!0;for(let r of t)if(ou(e,r))return!0;return!1}function su(e,t,r){if(e.length>1){if(ou(e,t))return!0;for(let n of t)if(uu(n,e,r))return!0}for(let n of e)if(uu(n,t,r))return!0;return!1}function ou(e,t){if(0===e.length||0===t.length)return!1;for(let r=0;r<e.length-1;r++){let n=e[r],i=e[r+1];for(let e=0;e<t.length-1;e++)if(lu(n,i,t[e],t[e+1]))return!0}return!1}function lu(e,t,r,n){return Qe(e,r,n)!==Qe(t,r,n)&&Qe(e,t,r)!==Qe(e,t,n)}function uu(e,t,r){let n=r*r;if(1===t.length)return e.distSqr(t[0])<n;for(let r=1;r<t.length;r++)if(hu(e,t[r-1],t[r])<n)return!0;return!1}function hu(e,t,r){let n=t.distSqr(r);if(0===n)return e.distSqr(t);let i=((e.x-t.x)*(r.x-t.x)+(e.y-t.y)*(r.y-t.y))/n;return i<0?e.distSqr(t):i>1?e.distSqr(r):e.distSqr(r.sub(t)._mult(i)._add(t))}function cu(e,t){let r,n,i,a=!1;for(let s of e){r=s;for(let e=0,s=r.length-1;e<r.length;s=e++)n=r[e],i=r[s],n.y>t.y!=i.y>t.y&&t.x<(i.x-n.x)*(t.y-n.y)/(i.y-n.y)+n.x&&(a=!a)}return a}function pu(e,t){let r=!1;for(let n=0,i=e.length-1;n<e.length;i=n++){let a=e[n],s=e[i];a.y>t.y!=s.y>t.y&&t.x<(s.x-a.x)*(t.y-a.y)/(s.y-a.y)+a.x&&(r=!r)}return r}function fu(e,t,r,n,i){for(let a of e)if(t<=a.x&&r<=a.y&&n>=a.x&&i>=a.y)return!0;let a=[new l(t,r),new l(t,i),new l(n,i),new l(n,r)];if(e.length>2)for(let t of a)if(pu(e,t))return!0;for(let t=0;t<e.length-1;t++)if(du(e[t],e[t+1],a))return!0;return!1}function du(e,t,r){let n=r[0],i=r[2];if(e.x<n.x&&t.x<n.x||e.x>i.x&&t.x>i.x||e.y<n.y&&t.y<n.y||e.y>i.y&&t.y>i.y)return!1;let a=Qe(e,t,r[0]);return a!==Qe(e,t,r[1])||a!==Qe(e,t,r[2])||a!==Qe(e,t,r[3])}function yu(e,t,r){let n=t.paint.get(e).value;return"constant"===n.kind?n.value:r.programConfigurations.get(t.id).getMaxValue(e)}function mu(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function gu(e,t,r,n,i){if(!t[0]&&!t[1])return e;let a=l.convert(t)._mult(i);"viewport"===r&&a._rotate(-n);let s=[];for(let t of e)s.push(t.sub(a));return s}function xu(e){let t=[];for(let r=0;r<e.length;r++){let n=e[r],i=t.at(-1);(0===r||i&&!n.equals(i))&&t.push(n)}return t}function vu({queryGeometry:e,size:t},r){return iu(e,r,t)}function bu({queryGeometry:e,size:t,transform:r,unwrappedTileID:n,getElevation:i},a){return iu(e,a,t*(r.projectTileCoordinates(a.x,a.y,n,i?.(a.x,a.y)).signedDistanceFromCamera/r.cameraToCenterDistance))}function wu({queryGeometry:e,size:t,transform:r,unwrappedTileID:n,getElevation:i},a){let s=r.projectTileCoordinates(a.x,a.y,n,i?.(a.x,a.y)).signedDistanceFromCamera,o=t*(r.cameraToCenterDistance/s);return iu(e,Au(a,r,n,i),o)}function Du({queryGeometry:e,size:t,transform:r,unwrappedTileID:n,getElevation:i},a){return iu(e,Au(a,r,n,i),t)}function _u({queryGeometry:e,size:t,transform:r,unwrappedTileID:n,getElevation:i,pitchAlignment:a="map",pitchScale:s="map"},o){let l="map"===a?"map"===s?vu:bu:"map"===s?wu:Du,u={queryGeometry:e,size:t,transform:r,unwrappedTileID:n,getElevation:i};for(let e of o)for(let t of e)if(l(u,t))return!0;return!1}function Au(e,t,r,n){let i=t.projectTileCoordinates(e.x,e.y,r,n?.(e.x,e.y)).point;return new l((.5*i.x+.5)*t.width,(.5*-i.y+.5)*t.height)}let Eu,Su;ks("CircleBucket",ru,{omit:["layers"]});var Fu={get paint(){return Su||=new Js({"circle-radius":new Zs(Zt.paint_circle["circle-radius"],"circle-radius"),"circle-color":new Zs(Zt.paint_circle["circle-color"],"circle-color"),"circle-blur":new Zs(Zt.paint_circle["circle-blur"],"circle-blur"),"circle-opacity":new Zs(Zt.paint_circle["circle-opacity"],"circle-opacity"),"circle-translate":new Ys(Zt.paint_circle["circle-translate"],"circle-translate"),"circle-translate-anchor":new Ys(Zt.paint_circle["circle-translate-anchor"],"circle-translate-anchor"),"circle-pitch-scale":new Ys(Zt.paint_circle["circle-pitch-scale"],"circle-pitch-scale"),"circle-pitch-alignment":new Ys(Zt.paint_circle["circle-pitch-alignment"],"circle-pitch-alignment"),"circle-stroke-width":new Zs(Zt.paint_circle["circle-stroke-width"],"circle-stroke-width"),"circle-stroke-color":new Zs(Zt.paint_circle["circle-stroke-color"],"circle-stroke-color"),"circle-stroke-opacity":new Zs(Zt.paint_circle["circle-stroke-opacity"],"circle-stroke-opacity")})},get layout(){return Eu||=new Js({"circle-sort-key":new Zs(Zt.layout_circle["circle-sort-key"],"circle-sort-key")})}};const ku=e=>"circle"===e.type;var Iu=class extends to{constructor(e,t){super(e,Fu,t)}createBucket(e){return new ru(e)}queryRadius(e){let t=e;return yu("circle-radius",this,t)+yu("circle-stroke-width",this,t)+mu(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:r,geometry:n,transform:i,pixelsToTileUnits:a,unwrappedTileID:s,getElevation:o}){let l,u,h=gu(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-i.bearingInRadians,a),c=this.paint.get("circle-radius").evaluate(t,r)+this.paint.get("circle-stroke-width").evaluate(t,r),p=this.paint.get("circle-pitch-scale"),f=this.paint.get("circle-pitch-alignment");return"map"===f?(l=h,u=c*a):(l=function(e,t,r,n){return e.map(e=>Au(e,t,r,n))}(h,i,s,o),u=c),_u({queryGeometry:l,size:u,transform:i,unwrappedTileID:s,getElevation:o,pitchAlignment:f,pitchScale:p},n)}},Tu=class extends ru{};let Mu;ks("HeatmapBucket",Tu,{omit:["layers"]});var Cu={get paint(){return Mu||=new Js({"heatmap-radius":new Zs(Zt.paint_heatmap["heatmap-radius"],"heatmap-radius"),"heatmap-weight":new Zs(Zt.paint_heatmap["heatmap-weight"],"heatmap-weight"),"heatmap-intensity":new Ys(Zt.paint_heatmap["heatmap-intensity"],"heatmap-intensity"),"heatmap-color":new Ks(Zt.paint_heatmap["heatmap-color"],"heatmap-color"),"heatmap-opacity":new Ys(Zt.paint_heatmap["heatmap-opacity"],"heatmap-opacity")})}};function Bu(e,{width:t,height:r},n,i){if(i){if(i instanceof Uint8ClampedArray)i=new Uint8Array(i.buffer);else if(i.length!==t*r*n)throw RangeError(`mismatched image size. expected: ${i.length} but got: ${t*r*n}`)}else i=new Uint8Array(t*r*n);return e.width=t,e.height=r,e.data=i,e}function Pu(e,{width:t,height:r},n){if(t===e.width&&r===e.height)return;let i=Bu({},{width:t,height:r},n);zu(e,i,{x:0,y:0},{x:0,y:0},{width:Math.min(e.width,t),height:Math.min(e.height,r)},n),e.width=t,e.height=r,e.data=i.data}function zu(e,t,r,n,i,a){if(0===i.width||0===i.height)return t;if(i.width>e.width||i.height>e.height||r.x>e.width-i.width||r.y>e.height-i.height)throw RangeError("out of range source coordinates for image copy");if(i.width>t.width||i.height>t.height||n.x>t.width-i.width||n.y>t.height-i.height)throw RangeError("out of range destination coordinates for image copy");let s=e.data,o=t.data;if(s===o)throw Error("srcData equals dstData, so image is already copied");for(let l=0;l<i.height;l++){let u=((r.y+l)*e.width+r.x)*a,h=((n.y+l)*t.width+n.x)*a;for(let e=0;e<i.width*a;e++)o[h+e]=s[u+e]}return t}var Vu=class e{constructor(e,t){Bu(this,e,1,t)}resize(e){Pu(this,e,1)}clone(){return new e({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,r,n,i){zu(e,t,r,n,i,1)}},Lu=class e{constructor(e,t){Bu(this,e,4,t)}resize(e){Pu(this,e,4)}replace(e,t){t?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new e({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,r,n,i){zu(e,t,r,n,i,4)}setPixel(e,t,r){let n=4*(e*this.width+t);this.data[n+0]=Math.round(255*r.r/r.a),this.data[n+1]=Math.round(255*r.g/r.a),this.data[n+2]=Math.round(255*r.b/r.a),this.data[n+3]=Math.round(255*r.a)}};function Ou(e){let t=new Uint8Array(e.length);for(let r=0;r<e.length;r+=4){let n=e[r+3];t[r+0]=Math.round(e[r+0]*n/255),t[r+1]=Math.round(e[r+1]*n/255),t[r+2]=Math.round(e[r+2]*n/255),t[r+3]=n}return t}function Ru(e){let t={},r=e.resolution||256,n=e.clips?e.clips.length:1,i=e.image||new Lu({width:r,height:n});if(!function(e){return Math.log(e)/Math.LN2%1==0}(r))throw Error(`width is not a power of 2 - ${r}`);let a=(n,a,s)=>{t[e.evaluationKey]=s;let o=e.expression.evaluate(t);i.setPixel(n/4/r,a/4,o)};if(e.clips)for(let t=0,i=0;t<n;++t,i+=4*r)for(let n=0,s=0;n<r;n++,s+=4){let o=n/(r-1),{start:l,end:u}=e.clips[t];a(i,s,l*(1-o)+u*o)}else for(let e=0,t=0;e<r;e++,t+=4)a(0,t,e/(r-1));return i}ks("AlphaImage",Vu),ks("RGBAImage",Lu);const $u="big-fb",Nu=e=>"heatmap"===e.type;var Uu=class extends to{createBucket(e){return new Tu(e)}constructor(e,t){super(e,Cu,t),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){"heatmap-color"===e&&this._updateColorRamp()}_updateColorRamp(){let e=this._transitionablePaint._values["heatmap-color"].value.expression;this.colorRamp=Ru({expression:e,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has("big-fb")&&this.heatmapFbos.delete($u)}queryRadius(e){return yu("heatmap-radius",this,e)}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:r,geometry:n,transform:i,pixelsToTileUnits:a,unwrappedTileID:s,getElevation:o}){return _u({queryGeometry:e,size:this.paint.get("heatmap-radius").evaluate(t,r)*a,transform:i,unwrappedTileID:s,getElevation:o},n)}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&!this.isHidden()}};let qu;var ju={get paint(){return qu||=new Js({"hillshade-illumination-direction":new Ys(Zt.paint_hillshade["hillshade-illumination-direction"],"hillshade-illumination-direction"),"hillshade-illumination-altitude":new Ys(Zt.paint_hillshade["hillshade-illumination-altitude"],"hillshade-illumination-altitude"),"hillshade-illumination-anchor":new Ys(Zt.paint_hillshade["hillshade-illumination-anchor"],"hillshade-illumination-anchor"),"hillshade-exaggeration":new Ys(Zt.paint_hillshade["hillshade-exaggeration"],"hillshade-exaggeration"),"hillshade-shadow-color":new Ys(Zt.paint_hillshade["hillshade-shadow-color"],"hillshade-shadow-color"),"hillshade-highlight-color":new Ys(Zt.paint_hillshade["hillshade-highlight-color"],"hillshade-highlight-color"),"hillshade-accent-color":new Ys(Zt.paint_hillshade["hillshade-accent-color"],"hillshade-accent-color"),"hillshade-method":new Ys(Zt.paint_hillshade["hillshade-method"],"hillshade-method"),resampling:new Ys(Zt.paint_hillshade.resampling,"resampling")})}};const Gu=e=>"hillshade"===e.type;var Xu=class extends to{constructor(e,t){super(e,ju,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,r=this.paint.get("hillshade-highlight-color").values,n=this.paint.get("hillshade-shadow-color").values,i=Math.max(e.length,t.length,r.length,n.length);e=e.concat(Array(i-e.length).fill(e.at(-1))),t=t.concat(Array(i-t.length).fill(t.at(-1))),r=r.concat(Array(i-r.length).fill(r.at(-1))),n=n.concat(Array(i-n.length).fill(n.at(-1)));let a=t.map(dt);return{directionRadians:e.map(dt),altitudeRadians:a,shadowColor:n,highlightColor:r}}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&!this.isHidden()}};let Yu;var Zu={get paint(){return Yu||=new Js({"color-relief-opacity":new Ys(Zt["paint_color-relief"]["color-relief-opacity"],"color-relief-opacity"),"color-relief-color":new Ks(Zt["paint_color-relief"]["color-relief-color"],"color-relief-color"),resampling:new Ys(Zt["paint_color-relief"].resampling,"resampling")})}};function Wu(e){return"data"in e}var Hu=class{constructor(e,t,r,n){this.context=e,this.format=r,this.texture=e.gl.createTexture(),this._ownedHandle=this.texture,this.update(t,n)}update(e,t,r){let{width:n,height:i}=e,a=(this.size?.[0]!==n||this.size[1]!==i)&&!r,{context:s}=this,{gl:o}=s;this.useMipmap=!!t?.useMipmap,a&&this.size&&this.format===o.RGBA&&(o.deleteTexture(this.texture),this.texture=o.createTexture(),this._ownedHandle=this.texture,this.magFilter=void 0,this.minFilter=void 0,this.wrap=void 0),o.bindTexture(o.TEXTURE_2D,this.texture),s.pixelStoreUnpackFlipY.set(!1),s.pixelStoreUnpack.set(1);let l=this.format===o.RGBA&&!1!==t?.premultiply;if(a)if(this.size=[n,i],this.format===o.RGBA&&n>0&&i>0){let t=this.useMipmap?Math.floor(Math.log2(Math.max(n,i)))+1:1;if(o.texStorage2D(o.TEXTURE_2D,t,o.RGBA8,n,i),Wu(e)){s.pixelStoreUnpackPremultiplyAlpha.set(!1);let{data:t}=e;l&&t&&(t=Ou(t)),t&&o.texSubImage2D(o.TEXTURE_2D,0,0,0,n,i,o.RGBA,o.UNSIGNED_BYTE,t)}else s.pixelStoreUnpackPremultiplyAlpha.set(l),o.texSubImage2D(o.TEXTURE_2D,0,0,0,o.RGBA,o.UNSIGNED_BYTE,e)}else Wu(e)?(s.pixelStoreUnpackPremultiplyAlpha.set(!1),this._uploadRawData(e,l,n,i,o)):(s.pixelStoreUnpackPremultiplyAlpha.set(l),this._uploadDomImage(e,o));else{let{x:t,y:a}=r||{x:0,y:0};Wu(e)?(s.pixelStoreUnpackPremultiplyAlpha.set(!1),this._updateRawData(e,l,t,a,n,i,o)):(s.pixelStoreUnpackPremultiplyAlpha.set(l),this._updateDomImage(e,t,a,o))}this.useMipmap&&!(Wu(e)&&null===e.data)&&o.generateMipmap(o.TEXTURE_2D),s.pixelStoreUnpackFlipY.setDefault(),s.pixelStoreUnpack.setDefault(),s.pixelStoreUnpackPremultiplyAlpha.setDefault()}_uploadDomImage(e,t){t.texImage2D(t.TEXTURE_2D,0,this.format,this.format,t.UNSIGNED_BYTE,e)}_uploadRawData(e,t,r,n,i){let{data:a}=e;t&&a&&(a=Ou(a)),i.texImage2D(i.TEXTURE_2D,0,this.format,r,n,0,this.format,i.UNSIGNED_BYTE,a)}_updateDomImage(e,t,r,n){n.texSubImage2D(n.TEXTURE_2D,0,t,r,n.RGBA,n.UNSIGNED_BYTE,e)}_updateRawData(e,t,r,n,i,a,s){let{data:o}=e;t&&o&&(o=Ou(o)),s.texSubImage2D(s.TEXTURE_2D,0,r,n,i,a,s.RGBA,s.UNSIGNED_BYTE,o)}bind(e,t,r){let{context:n}=this,{gl:i}=n;this.texture!==this._ownedHandle&&(this.texture=this._ownedHandle),i.bindTexture(i.TEXTURE_2D,this.texture),(r===i.LINEAR_MIPMAP_NEAREST||r===i.LINEAR_MIPMAP_LINEAR)&&!this.useMipmap&&(r=i.LINEAR);let a=r||e;e!==this.magFilter&&(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,e),this.magFilter=e),a!==this.minFilter&&(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,a),this.minFilter=a),t!==this.wrap&&(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,t),i.texParameteri(i.TEXTURE_2D,i.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}},Ku=class e{static{this.byteViewCache=new WeakMap}constructor(t,r,n,i=1,a=1,s=1,o=0){if(this.uid=t,r.height!==r.width)throw RangeError("DEM tiles must be square");if(n&&!["mapbox","terrarium","custom"].includes(n))return void Je(`"${n}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=r.height;let l=this.dim=r.height-4;switch(this.data=new Uint32Array(r.data.buffer),e.byteViewCache.set(this,new Uint8Array(this.data.buffer)),n){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=i,this.greenFactor=a,this.blueFactor=s,this.baseShift=o;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let e=-2;e<l+2;e++){let t=this._idx(0,Math.max(0,Math.min(l-1,e)));(e<0||e>=l)&&this.data.copyWithin(this._idx(0,e),t,t+l),this.data.fill(this.data[t],this._idx(-2,e),this._idx(0,e)),this.data.fill(this.data[t+l-1],this._idx(l,e),this._idx(l+1,e)+1)}let u=this._getByteView();this.min=2**53-1,this.max=-(2**53-1);for(let e=0;e<l;e++)for(let t=0;t<l;t++){let r=4*this._idx(e,t),n=this._unpackAtIndex(u,r);n>this.max&&(this.max=n),n<this.min&&(this.min=n)}}get(e,t){let r=this._getByteView(),n=4*this._idx(e,t);return this._unpackAtIndex(r,n)}sampleBilinear(e,t){let r=Math.floor(e),n=Math.floor(t);if(r<-1||r>=this.dim||n<-1||n>=this.dim)throw RangeError(`Out of range source coordinates for DEM data. x: ${e}, y: ${t}, dim: ${this.dim}`);let i=this._getByteView(),a=4*((n+2)*this.stride+r+2),s=4*this.stride,o=e-r,l=t-n;return this._unpackAtIndex(i,a)*(1-o)*(1-l)+this._unpackAtIndex(i,a+4)*o*(1-l)+this._unpackAtIndex(i,a+s)*(1-o)*l+this._unpackAtIndex(i,a+s+4)*o*l}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(e,t){if(e<-2||e>=this.dim+2||t<-2||t>=this.dim+2)throw RangeError(`Out of range source coordinates for DEM data. x: ${e}, y: ${t}, dim: ${this.dim}`);return(t+2)*this.stride+(e+2)}unpack(e,t,r){return e*this.redFactor+t*this.greenFactor+r*this.blueFactor-this.baseShift}pack(e){return Ju(e,this.getUnpackVector())}getPixels(){return new Lu({width:this.stride,height:this.stride},this._getByteView())}backfillBorder(e,t,r){if(this.dim!==e.dim)throw Error("dem dimension mismatch");let n=t*this.dim,i=t*this.dim+this.dim,a=r*this.dim,s=r*this.dim+this.dim;switch(t){case-1:n=i-2;break;case 1:i=n+2}switch(r){case-1:a=s-2;break;case 1:s=a+2}let o=-t*this.dim,l=-r*this.dim;for(let t=a;t<s;t++)for(let r=n;r<i;r++)this.data[this._idx(r,t)]=e.data[this._idx(r+o,t+l)]}_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(e,t){return this.unpack(e[t],e[t+1],e[t+2])}};function Ju(e,t){let r=t[0],n=t[1],i=t[2],a=t[3],s=Math.min(r,n,i),o=Math.round((e+a)/s);return{r:Math.floor(o*s/r)%256,g:Math.floor(o*s/n)%256,b:Math.floor(o*s/i)%256}}ks("DEMData",Ku);const Qu=e=>"color-relief"===e.type;var eh=class extends to{constructor(e,t){super(e,Zu,t)}_createColorRamp(e){let t={elevationStops:[],colorStops:[]},r=this._transitionablePaint._values["color-relief-color"].value.expression;if(r instanceof pa&&r._styleExpression.expression instanceof cn){this.colorRampExpression=r;let e=r._styleExpression.expression;t.elevationStops=e.labels,t.colorStops=[];for(let r of t.elevationStops)t.colorStops.push(e.evaluate({globals:{elevation:r}}))}if(t.elevationStops.length<1&&(t.elevationStops=[0],t.colorStops=[Ur.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 n={elevationStops:[],colorStops:[]},i=(t.elevationStops.length-1)/(e-1);for(let e=0;e<t.elevationStops.length-.5;e+=i)n.elevationStops.push(t.elevationStops[Math.round(e)]),n.colorStops.push(t.colorStops[Math.round(e)]);return Je(`Too many colors in specification of ${this.id} color-relief layer, may not render properly. Max possible colors: ${e}, provided: ${t.elevationStops.length}`),n}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values["color-relief-color"].value.expression}getColorRampTextures(e,t,r){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;let n=this._createColorRamp(t),i=new Lu({width:n.colorStops.length,height:1}),a=new Lu({width:n.colorStops.length,height:1});for(let e=0;e<n.elevationStops.length;e++){let t=Ju(n.elevationStops[e],r);a.setPixel(0,e,new Ur(t.r/255,t.g/255,t.b/255,1)),i.setPixel(0,e,n.colorStops[e])}return this.colorRampTextures={elevationTexture:new Hu(e,a,e.gl.RGBA),colorTexture:new Hu(e,i,e.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return!this.isHidden()&&!!this.colorRampTextures}};const th=uo([{name:"a_pos",components:2,type:"Int16"}],4),rh=th.members;function nh(e,t,r){let n=r.patternDependencies,i=!1;for(let r of t){let t=r.paint.get(`${e}-pattern`);t.isConstant()||(i=!0);let a=t.constantOr(null);a&&(i=!0,n[a.to]=!0,n[a.from]=!0)}return i}function ih(e,t,r,n,i){let{zoom:a}=n,s=i.patternDependencies;for(let n of t){let t=n.paint.get(`${e}-pattern`).value;if("constant"!==t.kind){let e=t.evaluate({zoom:a-1},r,{},i.availableImages),o=t.evaluate({zoom:a},r,{},i.availableImages),l=t.evaluate({zoom:a+1},r,{},i.availableImages);e=e?.name?e.name:e,o=o?.name?o.name:o,l=l?.name?l.name:l,s[e]=!0,s[o]=!0,s[l]=!0,r.patterns[n.id]={min:e,mid:o,max:l}}}return r}th.size,th.alignment;const ah=new Set;let sh=!1;function oh(e,t,r,n,i){let a=null;if(i===function(e,t,r,n){let i=0;for(let a=t,s=r-n;a<r;a+=n)i+=(e[s]-e[a])*(e[a+1]+e[s+1]),s=a;return i}(e,t,r,n)>0)for(let i=t;i<r;i+=n)a=Nh(i/n|0,e[i],e[i+1],a);else for(let i=r-n;i>=t;i-=n)a=Nh(i/n|0,e[i],e[i+1],a);return a&&Vh(a,a.next)&&(Uh(a),a=a.next),a}function lh(e,t=e){let r,n=t===e,i=e;do{r=!1,i===i.next||0!==ah.size&&ah.has(i)||!Vh(i,i.next)&&0!==zh(i.prev,i,i.next)?(n||i!==t)&&(i=i.next,r=!n):((n||i===t)&&(t=i.prev),sh=!0,Uh(i),i=i.prev,r=!0)}while(r||i!==t);return t}function uh(e,t,r,n,i){i&&function(e,t,r,n){let i=e,a=0;do{i.z=Mh(i.x,i.y,t,r,n),Eh[a++]=i,i=i.next}while(i!==e);!function(e){if(e<=32)for(let t=1;t<e;t++){let e=Eh[t],r=e.z,n=t-1;for(;n>=0&&Eh[n].z>r;)Eh[n+1]=Eh[n],n--;Eh[n+1]=e}else{Fh.length<e&&(Fh=new Uint32Array(e),kh=new Uint32Array(e),Sh=Array(e));for(let t=0;t<e;t++)Fh[t]=Eh[t].z;Th(e,Eh,Fh,Sh,kh,0),Th(e,Sh,kh,Eh,Fh,8),Th(e,Eh,Fh,Sh,kh,16),Th(e,Sh,kh,Eh,Fh,24)}}(a);let s=null;for(let e=0;e<a;e++){let t=Eh[e];t.prevZ=s,s&&(s.nextZ=t),s=t}s.nextZ=null}(e,r,n,i);let a=e,s=!1;for(;e.prev!==e.next;){let o=e.prev,l=e.next;if(zh(o,e,l)<0&&(i?ch(e,r,n,i):hh(e)))t.push(o.i,e.i,l.i),Uh(e),e=l,a=l;else if((e=l)===a){if(sh=!1,e=lh(e),sh){a=e;continue}if(!s){a=e=ph(e,t),s=!0;continue}fh(e,t,r,n,i);break}}}function hh(e){let t=e.prev,r=e,n=e.next,i=t.x,a=r.x,s=n.x,o=t.y,l=r.y,u=n.y,h=Math.min(i,a,s),c=Math.min(o,l,u),p=Math.max(i,a,s),f=Math.max(o,l,u),d=n.next;for(;d!==t;){if(d.x>=h&&d.x<=p&&d.y>=c&&d.y<=f&&(i!==d.x||o!==d.y)&&Bh(i,o,a,l,s,u,d.x,d.y)&&zh(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function ch(e,t,r,n){let i=e.prev,a=e,s=e.next,o=i.x,l=a.x,u=s.x,h=i.y,c=a.y,p=s.y,f=Math.min(o,l,u),d=Math.min(h,c,p),y=Math.max(o,l,u),m=Math.max(h,c,p),g=Mh(f,d,t,r,n),x=Mh(y,m,t,r,n),v=e.prevZ;for(;v&&v.z>=g;){if(v.x>=f&&v.x<=y&&v.y>=d&&v.y<=m&&v!==s&&(o!==v.x||h!==v.y)&&Bh(o,h,l,c,u,p,v.x,v.y)&&zh(v.prev,v,v.next)>=0)return!1;v=v.prevZ}let b=e.nextZ;for(;b&&b.z<=x;){if(b.x>=f&&b.x<=y&&b.y>=d&&b.y<=m&&b!==s&&(o!==b.x||h!==b.y)&&Bh(o,h,l,c,u,p,b.x,b.y)&&zh(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function ph(e,t){let r=e,n=!1;do{let i=r.prev,a=r.next.next;Lh(i,r,r.next,a,!1)&&Rh(i,a)&&Rh(a,i)&&(t.push(i.i,r.i,a.i),Uh(r),Uh(r.next),r=e=a,n=!0),r=r.next}while(r!==e);return n?lh(r):r}function fh(e,t,r,n,i){let a=e;do{let e=a.next.next;for(;e!==a.prev;){if(a.i!==e.i&&Ph(a,e)){let s=$h(a,e);return a=lh(a,a.next),s=lh(s,s.next),uh(a,t,r,n,i),void uh(s,t,r,n,i)}e=e.next}a=a.next}while(a!==e)}let dh=!1;function yh(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 mh(e,t){let r=function(e,t){let r,n=t,i=e.x,a=e.y,s=-1/0;if(Vh(e,n))return n;for(let t=0,o=0;t<xh;t++,o+=4){if(a<gh[o+1]||a>gh[o+3]||gh[o]>i||gh[o+2]<=s)continue;let l=Dh(t);n=_h(t);do{if(n.prev.next===n){if(Vh(e,n.next))return n.next;if(a<=n.y&&a>=n.next.y&&n.next.y!==n.y){let e=n.x+(a-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(e<=i&&e>s&&(s=e,r=n.x<n.next.x?n:n.next,e===i))return r}}n=n.next}while(n!==l)}if(!r)return null;let o=r.x,l=r.y,u=Math.min(a,l),h=Math.max(a,l),c=1/0;for(let t=0,p=0;t<xh;t++,p+=4){if(gh[p+2]<o||gh[p]>i||gh[p+3]<u||gh[p+1]>h)continue;let f=Dh(t);n=_h(t);do{if(n.prev.next===n&&i>=n.x&&n.x>=o&&i!==n.x&&Bh(a<l?i:s,a,o,l,a<l?s:i,a,n.x,n.y)){let t=Math.abs(a-n.y)/(i-n.x);(Rh(n,e)||n.y===a&&n.next.y===a&&n.next.x>i)&&(t<c||t===c&&(n.x>r.x||n.x===r.x&&Ah(r,n)))&&(r=n,c=t)}n=n.next}while(n!==f)}return r}(e,t);if(!r)return t;let n=$h(r,e);return wh(r,n.next.next),lh(n,n.next),lh(r,r.next)}let gh=new Float64Array,xh=0;const vh=[],bh=[];function wh(e,t){let r=e;do{let e=xh++;vh[e]=r;let n=1/0,i=1/0,a=-1/0,s=-1/0,o=0;do{let t=r.next;r.z=e,r.x<n&&(n=r.x),r.x>a&&(a=r.x),r.y<i&&(i=r.y),r.y>s&&(s=r.y),t.x<n&&(n=t.x),t.x>a&&(a=t.x),t.y<i&&(i=t.y),t.y>s&&(s=t.y),r=t}while(++o<16&&r!==t);bh[e]=r;let l=4*e;gh[l]=n,gh[l+1]=i,gh[l+2]=a,gh[l+3]=s}while(r!==t)}function Dh(e){let t=bh[e];for(;t.prev.next!==t;)t=t.next;return bh[e]=t,t}function _h(e){let t=vh[e];for(;t.prev.next!==t;)t=t.next;return vh[e]=t,t}function Ah(e,t){return zh(e.prev,e,t.prev)<0&&zh(t.next,e,e.next)<0}const Eh=[];let Sh=[],Fh=new Uint32Array,kh=new Uint32Array;const Ih=new Uint32Array(256);function Th(e,t,r,n,i,a){Ih.fill(0);for(let t=0;t<e;t++)Ih[r[t]>>>a&255]++;let s=0;for(let e=0;e<256;e++){let t=Ih[e];Ih[e]=s,s+=t}for(let s=0;s<e;s++){let e=r[s],o=Ih[e>>>a&255]++;n[o]=t[s],i[o]=e}}function Mh(e,t,r,n,i){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Ch(e){let t=e,r=e;do{(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next}while(t!==e);return r}function Bh(e,t,r,n,i,a,s,o){return(i-s)*(t-o)>=(e-s)*(a-o)&&(e-s)*(n-o)>=(r-s)*(t-o)&&(r-s)*(a-o)>=(i-s)*(n-o)}function Ph(e,t){let r=Vh(e,t)&&zh(e.prev,e,e.next)>0&&zh(t.prev,t,t.next)>0;return e.next.i!==t.i&&(r||Rh(e,t)&&Rh(t,e)&&(0!==zh(e.prev,e,t.prev)||0!==zh(e,t.prev,t)))&&!function(e,t){let r=Math.min(e.x,t.x),n=Math.max(e.x,t.x),i=Math.min(e.y,t.y),a=Math.max(e.y,t.y),s=e;do{let o=s.next;if(s.x>n&&o.x>n||s.x<r&&o.x<r||s.y>a&&o.y>a||s.y<i&&o.y<i)s=o;else{if(s.i!==e.i&&o.i!==e.i&&s.i!==t.i&&o.i!==t.i&&Lh(s,o,e,t))return!0;s=o}}while(s!==e);return!1}(e,t)&&(r||function(e,t){let r=e,n=!1,i=(e.x+t.x)/2,a=(e.y+t.y)/2;do{let e=r.next;r.y>a!=e.y>a&&i<(e.x-r.x)*(a-r.y)/(e.y-r.y)+r.x&&(n=!n),r=e}while(r!==e);return n}(e,t))}function zh(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function Vh(e,t){return e.x===t.x&&e.y===t.y}function Lh(e,t,r,n,i=!0){let a=zh(e,t,r),s=zh(e,t,n),o=zh(r,n,e),l=zh(r,n,t);return(a>0&&s<0||a<0&&s>0)&&(o>0&&l<0||o<0&&l>0)||!!i&&!!(0===a&&Oh(e,r,t)||0===s&&Oh(e,n,t)||0===o&&Oh(r,e,n)||0===l&&Oh(r,t,n))}function Oh(e,t,r){return t.x<=Math.max(e.x,r.x)&&t.x>=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function Rh(e,t){return zh(e.prev,e,e.next)<0?zh(e,t,e.next)>=0&&zh(e,e.prev,t)>=0:zh(e,t,e.prev)<0||zh(e,e.next,t)<0}function $h(e,t){let r=qh(e.i,e.x,e.y),n=qh(t.i,t.x,t.y),i=e.next,a=t.prev;return e.next=t,t.prev=e,r.next=i,i.prev=r,n.next=r,r.prev=n,a.next=n,n.prev=a,n}function Nh(e,t,r,n){let i=qh(e,t,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Uh(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),dh&&function(e,t){let r=4*e.z;t.x<gh[r]&&(gh[r]=t.x),t.y<gh[r+1]&&(gh[r+1]=t.y),t.x>gh[r+2]&&(gh[r+2]=t.x),t.y>gh[r+3]&&(gh[r+3]=t.y)}(e.prev,e.next)}function qh(e,t,r){return{i:e,x:t,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null}}var jh=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)}},Gh=class e{constructor(e){this.fill=e.fill,this.line=e.line,this.tile=e.tile,this.stencil=e.stencil,this.circle=e.circle}static{this.noSubdivision=new e({fill:new jh(0,0),line:new jh(0,0),tile:new jh(0,0),stencil:new jh(0,0),circle:1})}};ks("SubdivisionGranularityExpression",jh),ks("SubdivisionGranularitySetting",Gh);const Xh=-32768,Yh=32767;var Zh=class{constructor(e,t){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=e,this._granularityCellSize=de/e,this._canonical=t}_getKey(e,t){return(e+=32768)<<16|t+32768}_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 r=0|Math.round(e),n=0|Math.round(t),i=this._getKey(r,n);if(this._vertexDictionary.has(i))return this._vertexDictionary.get(i);let a=this._vertexBuffer.length/2;return this._vertexDictionary.set(i,a),this._vertexBuffer.push(r,n),a}_subdivideTrianglesScanline(e){if(this._granularity<2)return function(e,t){let r=[];for(let n=0;n<t.length;n+=3){let i=t[n],a=t[n+1],s=t[n+2],o=e[2*i],l=e[2*i+1],u=e[2*a],h=e[2*a+1],c=e[2*s];(u-o)*(e[2*s+1]-l)-(h-l)*(c-o)>0?(r.push(i),r.push(s),r.push(a)):(r.push(i),r.push(a),r.push(s))}return r}(this._vertexBuffer,e);let t=[],r=e.length;for(let n=0;n<r;n+=3){let r=[e[n+0],e[n+1],e[n+2]],i=[this._vertexBuffer[2*e[n+0]+0],this._vertexBuffer[2*e[n+0]+1],this._vertexBuffer[2*e[n+1]+0],this._vertexBuffer[2*e[n+1]+1],this._vertexBuffer[2*e[n+2]+0],this._vertexBuffer[2*e[n+2]+1]],a=1/0,s=1/0,o=-1/0,l=-1/0;for(let e=0;e<3;e++){let t=i[2*e],r=i[2*e+1];a=Math.min(a,t),o=Math.max(o,t),s=Math.min(s,r),l=Math.max(l,r)}if(a===o||s===l)continue;let u=Math.floor(a/this._granularityCellSize),h=Math.ceil(o/this._granularityCellSize),c=Math.floor(s/this._granularityCellSize),p=Math.ceil(l/this._granularityCellSize);if(u!==h||c!==p)for(let e=c;e<p;e++){let n=this._scanlineGenerateVertexRingForCellRow(e,i,r);Kh(this._vertexBuffer,n,t)}else t.push(...r)}return t}_scanlineGenerateVertexRingForCellRow(e,t,r){let n=e*this._granularityCellSize,i=n+this._granularityCellSize,a=[];for(let e=0;e<3;e++){let s=t[2*e],o=t[2*e+1],l=t[2*(e+1)%6],u=t[(2*(e+1)+1)%6],h=t[2*(e+2)%6],c=t[(2*(e+2)+1)%6],p=l-s,f=u-o,d=0===p,y=0===f,m=(n-o)/f,g=(i-o)/f,x=Math.min(m,g),v=Math.max(m,g);if(!y&&(x>=1||v<=0)||y&&(o<n||o>i)){u>=n&&u<=i&&a.push(r[(e+1)%3]);continue}if(!y&&x>0){let e=s+p*x,t=o+f*x;a.push(this._vertexToIndex(e,t))}let b=s+p*Math.max(x,0),w=s+p*Math.min(v,1);if(d||this._generateIntraEdgeVertices(a,s,o,l,u,b,w),!y&&v<1){let e=s+p*v,t=o+f*v;a.push(this._vertexToIndex(e,t))}(y||u>=n&&u<=i)&&a.push(r[(e+1)%3]),!y&&(u<=n||u>=i)&&this._generateInterEdgeVertices(a,s,o,l,u,h,c,w,n,i)}return a}_generateIntraEdgeVertices(e,t,r,n,i,a,s){let o=n-t,l=i-r,u=0===l,h=u?Math.min(t,n):Math.min(a,s),c=u?Math.max(t,n):Math.max(a,s),p=Math.floor(h/this._granularityCellSize)+1,f=Math.ceil(c/this._granularityCellSize)-1;if(u?t<n:a<s)for(let n=p;n<=f;n++){let i=n*this._granularityCellSize,a=r+l*(i-t)/o;e.push(this._vertexToIndex(i,a))}else for(let n=f;n>=p;n--){let i=n*this._granularityCellSize,a=r+l*(i-t)/o;e.push(this._vertexToIndex(i,a))}}_generateInterEdgeVertices(e,t,r,n,i,a,s,o,l,u){let h=i-r,c=a-n,p=s-i,f=(l-i)/p,d=(u-i)/p,y=Math.min(f,d),m=Math.max(f,d),g=n+c*y,x=Math.floor(Math.min(g,o)/this._granularityCellSize)+1,v=Math.ceil(Math.max(g,o)/this._granularityCellSize)-1,b=o<g,w=0===p;if(w&&(s===l||s===u))return;if(w||y>=1||m<=0){let e=r-s,n=(l-s)/e,i=(u-s)/e,h=a+(t-a)*Math.min(n,i);x=Math.floor(Math.min(h,o)/this._granularityCellSize)+1,v=Math.ceil(Math.max(h,o)/this._granularityCellSize)-1,b=o<h}let D=h>0?u:l;if(b)for(let t=x;t<=v;t++){let r=t*this._granularityCellSize;e.push(this._vertexToIndex(r,D))}else for(let t=v;t>=x;t--){let r=t*this._granularityCellSize;e.push(this._vertexToIndex(r,D))}}_generateOutline(e){let t=[];for(let r of e){let e=Hh(r,this._granularity,!0),n=this._pointArrayToIndices(e),i=[];for(let e=1;e<n.length;e++)i.push(n[e-1]),i.push(n[e]);t.push(i)}return t}_handlePoles(e){let t=!1,r=!1;this._canonical&&(0===this._canonical.y&&(t=!0),this._canonical.y===(1<<this._canonical.z)-1&&(r=!0)),(t||r)&&this._fillPoles(e,t,r)}_ensureNoPoleVertices(){let e=this._vertexBuffer;for(let t=0;t<e.length;t+=2){let r=e[t+1];-32768===r&&(e[t+1]=-32767),32767===r&&(e[t+1]=32766)}}_generatePoleQuad(e,t,r,n,i,a){n>i==(-32768===a)?(e.push(r),e.push(t),e.push(this._vertexToIndex(n,a)),e.push(this._vertexToIndex(i,a)),e.push(r),e.push(this._vertexToIndex(n,a))):(e.push(t),e.push(r),e.push(this._vertexToIndex(n,a)),e.push(r),e.push(this._vertexToIndex(i,a)),e.push(this._vertexToIndex(n,a)))}_fillPoles(e,t,r){let n=this._vertexBuffer,i=de,a=e.length;for(let s=2;s<a;s+=3){let a=e[s-2],o=e[s-1],l=e[s],u=n[2*a],h=n[2*a+1],c=n[2*o],p=n[2*o+1],f=n[2*l],d=n[2*l+1];t&&(0===h&&0===p&&this._generatePoleQuad(e,a,o,u,c,Xh),0===p&&0===d&&this._generatePoleQuad(e,o,l,c,f,Xh),0===d&&0===h&&this._generatePoleQuad(e,l,a,f,u,Xh)),r&&(h===i&&p===i&&this._generatePoleQuad(e,a,o,u,c,Yh),p===i&&d===i&&this._generatePoleQuad(e,o,l,c,f,Yh),d===i&&h===i&&this._generatePoleQuad(e,l,a,f,u,Yh))}}_initializeVertices(e){for(let t=0;t<e.length;t+=2)this._vertexToIndex(e[t],e[t+1])}subdividePolygonInternal(e,t){if(this._used)throw Error("Subdivision: multiple use not allowed.");this._used=!0;let r,{flattened:n,holeIndices:i}=function(e){let t=[],r=[];for(let n of e)if(0!==n.length){n!==e[0]&&t.push(r.length/2);for(let e of n)r.push(e.x),r.push(e.y)}return{flattened:r,holeIndices:t}}(e);this._initializeVertices(n);try{let e=function(e,t,r=2){let n=t&&t.length,i=n?t[0]*r:e.length;ah.size&&ah.clear();let a=oh(e,0,i,r,!0),s=[];if(!a||a.next===a.prev)return s;let o=0,l=0,u=0;if(n&&(a=function(e,t,r,n){let i=[];for(let r=0,a=t.length;r<a;r++){let s=oh(e,t[r]*n,r<a-1?t[r+1]*n:e.length,n,!1);s===s.next&&ah.add(s),i.push(Ch(s))}i.sort(yh),function(e,t){let r=Math.ceil((e+2*t)/16)+t+2;gh.length<4*r&&(gh=new Float64Array(4*r)),xh=0}(e.length/n,t.length),wh(r,r),dh=!0;for(let e=0;e<i.length;e++)r=mh(i[e],r);return dh=!1,lh(r)}(e,t,a,r)),e.length>80*r){o=e[0],l=e[1];let t=o,n=l;for(let a=r;a<i;a+=r){let r=e[a],i=e[a+1];r<o&&(o=r),i<l&&(l=i),r>t&&(t=r),i>n&&(n=i)}u=Math.max(t-o,n-l),u=0===u?0:32767/u}return uh(a,s,o,l,u),s}(n,i),t=this._convertIndices(n,e);r=this._subdivideTrianglesScanline(t)}catch(e){console.error(e)}let a=[];return t&&(a=this._generateOutline(e)),this._ensureNoPoleVertices(),this._handlePoles(r),this._granularity>=2&&0===this._canonical?.z&&(r=this._removeTrianglesOutsideTileX(r),a=a.map(e=>this._removeLinesOutsideTileX(e))),{verticesFlattened:this._vertexBuffer,indicesTriangles:r,indicesLineList:a}}_vertexOutsideTileX(e){let t=this._vertexBuffer[2*e];return t<0||t>8192}_removeTrianglesOutsideTileX(e){let t=[];for(let r=0;r<e.length;r+=3)this._vertexOutsideTileX(e[r])||this._vertexOutsideTileX(e[r+1])||this._vertexOutsideTileX(e[r+2])||t.push(e[r],e[r+1],e[r+2]);return t}_removeLinesOutsideTileX(e){let t=[];for(let r=0;r<e.length;r+=2)this._vertexOutsideTileX(e[r])||this._vertexOutsideTileX(e[r+1])||t.push(e[r],e[r+1]);return t}_convertIndices(e,t){let r=[];for(let n of t){let t=e[2*n],i=e[2*n+1];r.push(this._vertexToIndex(t,i))}return r}_pointArrayToIndices(e){let t=[];for(let r of e)t.push(this._vertexToIndex(r.x,r.y));return t}};function Wh(e,t,r,n=!0){return new Zh(r,t).subdividePolygonInternal(e,n)}function Hh(e,t,r=!1){if(!e||e.length<1||e.length<2)return[];let n=e[0],i=e[e.length-1],a=r&&(n.x!==i.x||n.y!==i.y);if(t<2)return a?[...e,e[0]]:[...e];let s=Math.floor(de/t),o=[];o.push(new l(e[0].x,e[0].y));let u=e.length,h=a?u:u-1;for(let t=0;t<h;t++){let r=e[t],n=t<u-1?e[t+1]:e[0],i=r.x,a=r.y,h=n.x,c=n.y,p=i!==h,f=a!==c;if(!p&&!f)continue;let d=h-i,y=c-a,m=Math.abs(d),g=Math.abs(y),x=i,v=a;for(;;){let e=d>0?(Math.floor(x/s)+1)*s:(Math.ceil(x/s)-1)*s,t=y>0?(Math.floor(v/s)+1)*s:(Math.ceil(v/s)-1)*s,r=Math.abs(x-e),n=Math.abs(v-t),i=Math.abs(x-h),a=Math.abs(v-c),u=p?r/m:1/0,b=f?n/g:1/0;if((i<=r||!p)&&(a<=n||!f))break;if(u<b&&p||!f){x=e,v+=y*u;let t=new l(x,Math.round(v));(o[o.length-1].x!==t.x||o[o.length-1].y!==t.y)&&o.push(t)}else{x+=d*b,v=t;let e=new l(Math.round(x),v);(o[o.length-1].x!==e.x||o[o.length-1].y!==e.y)&&o.push(e)}}let b=new l(h,c);(o[o.length-1].x!==b.x||o[o.length-1].y!==b.y)&&o.push(b)}return o}function Kh(e,t,r){if(0===t.length)throw Error("Subdivision vertex ring is empty.");let n=0,i=e[2*t[0]];for(let r=1;r<t.length;r++){let a=e[2*t[r]];a<i&&(i=a,n=r)}let a=t.length,s=n,o=(s+1)%a;for(;;){let n=s-1>=0?s-1:a-1,i=(o+1)%a,l=e[2*t[n]],u=e[2*t[n]+1],h=e[2*t[i]],c=e[2*t[i]+1],p=e[2*t[s]],f=e[2*t[s]+1],d=e[2*t[o]],y=e[2*t[o]+1],m=!1;if(l<h)m=!0;else if(l>h)m=!1;else{let e=y-f,t=-(d-p),r=f<y?1:-1;((l-p)*e+(u-f)*t)*r>((h-p)*e+(c-f)*t)*r&&(m=!0)}if(m){let e=t[n],i=t[s],l=t[o];e!==i&&e!==l&&i!==l&&r.push(l,i,e),s--,s<0&&(s=a-1)}else{let e=t[i],n=t[s],l=t[o];e!==n&&e!==l&&n!==l&&r.push(l,n,e),o++,o>=a&&(o=0)}if(n===i)break}}function Jh(e,t,r,n,i,a,s,o,l){let u=i.length/2,h=s&&o&&l;if(u<ml.MAX_VERTEX_ARRAY_LENGTH){let c,p,f=t.prepareSegment(u,r,n),d=f.vertexLength;for(let e=0;e<a.length;e+=3)n.emplaceBack(d+a[e],d+a[e+1],d+a[e+2]);f.vertexLength+=u,f.primitiveLength+=a.length/3,h&&(p=s.prepareSegment(u,r,o),c=p.vertexLength,p.vertexLength+=u);for(let t=0;t<i.length;t+=2)e(i[t],i[t+1]);if(h)for(let e of l){for(let t=1;t<e.length;t+=2)o.emplaceBack(c+e[t-1],c+e[t]);p.primitiveLength+=e.length/2}}else(function(e,t,r,n,i,a){let s=[];for(let e=0;e<n.length/2;e++)s.push(-1);let o={count:0},l=0,u=e.getOrCreateLatestSegment(t,r),h=u.vertexLength;for(let c=2;c<i.length;c+=3){let p=i[c-2],f=i[c-1],d=i[c],y=s[p]<l,m=s[f]<l,g=s[d]<l,x=+!!y+ +!!m+ +!!g;u.vertexLength+x>ml.MAX_VERTEX_ARRAY_LENGTH&&(u=e.createNewSegment(t,r),l=o.count,y=!0,m=!0,g=!0,h=0);let v=Qh(s,n,a,o,p,y,u),b=Qh(s,n,a,o,f,m,u),w=Qh(s,n,a,o,d,g,u);r.emplaceBack(h+v-l,h+b-l,h+w-l),u.primitiveLength++}})(t,r,n,i,a,e),h&&function(e,t,r,n,i,a){let s=[];for(let e=0;e<n.length/2;e++)s.push(-1);let o={count:0},l=0,u=e.getOrCreateLatestSegment(t,r),h=u.vertexLength;for(let c of i)for(let i=1;i<c.length;i+=2){let p=c[i-1],f=c[i],d=s[p]<l,y=s[f]<l,m=+!!d+ +!!y;u.vertexLength+m>ml.MAX_VERTEX_ARRAY_LENGTH&&(u=e.createNewSegment(t,r),l=o.count,d=!0,y=!0,h=0);let g=Qh(s,n,a,o,p,d,u),x=Qh(s,n,a,o,f,y,u);r.emplaceBack(h+g-l,h+x-l),u.primitiveLength++}}(s,r,o,i,l,e),t.forceNewSegmentOnNextPrepare(),s?.forceNewSegmentOnNextPrepare()}function Qh(e,t,r,n,i,a,s){if(a){let a=n.count;return r(t[2*i],t[2*i+1]),e[i]=n.count,n.count++,s.vertexLength++,a}return e[i]}var ec=class{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.id),this.index=e.index,this.hasDependencies=!1,this.sdfPatterns={},this.patternFeatures=[],this.layoutVertexArray=new Jo,this.indexArray=new cl,this.indexArray2=new pl,this.programConfigurations=new Yl(e.layers,e.zoom),this.segments=new ml,this.segments2=new ml,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(e,t,r){this.hasDependencies=nh("fill",this.layers,t);let n=this.layers[0].layout.get("fill-sort-key"),i=!n.isConstant(),a=[],s=new zs(this.zoom),o=this.layers[0]._featureFilter.needGeometry;for(let{feature:l,id:u,index:h,sourceLayerIndex:c}of e){let e=Ql(l,o);if(!this.layers[0]._featureFilter.filter(s,e,r))continue;let p=i?n.evaluate(e,{},r,t.availableImages):void 0,f={id:u,properties:l.properties,type:l.type,sourceLayerIndex:c,index:h,geometry:o?e.geometry:Jl(l),patterns:{},sortKey:p};a.push(f)}i&&a.sort((e,t)=>e.sortKey-t.sortKey);for(let n of a){let{geometry:i,index:a,sourceLayerIndex:s}=n;if(this.hasDependencies){let e=ih("fill",this.layers,n,{zoom:this.zoom},t);this.patternFeatures.push(e)}else this.addFeature(n,i,a,r,{},t.subdivisionGranularity);let o=e[a].feature;t.featureIndex.insert(o,i,a,s,this.index)}}update(e,t,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,{imagePositions:r})}addFeatures({options:e,canonical:t,patternPositions:r,patternMap:n}){this.detectSdfPatterns(n);for(let n of this.patternFeatures)this.addFeature(n,n.geometry,n.index,t,r,e.subdivisionGranularity)}detectSdfPatterns(e){for(let t of this.patternFeatures)for(let r in t.patterns){let n=t.patterns[r];this.recordSdfPattern(r,e[n.min]),this.recordSdfPattern(r,e[n.mid]),this.recordSdfPattern(r,e[n.max])}for(let t of this.layers){let r=t.paint.get("fill-pattern").constantOr(null);r&&(this.recordSdfPattern(t.id,e[r.from.toString()]),this.recordSdfPattern(t.id,e[r.to.toString()]))}}recordSdfPattern(e,t){if(!t)return;let r=!0===t.sdf,n=this.sdfPatterns[e];void 0===n?this.sdfPatterns[e]=r:n!==r&&Je(`Style sheet warning: Cannot mix SDF and non-SDF fill patterns in layer "${e}"`)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,rh),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(e,t,r,n,i,a){for(let e of xn(t,500)){let t=Wh(e,n,a.fill.getGranularityForZoomLevel(n.z)),r=this.layoutVertexArray;Jh((e,t)=>{r.emplaceBack(e,t)},this.segments,this.layoutVertexArray,this.indexArray,t.verticesFlattened,t.indicesTriangles,this.segments2,this.indexArray2,t.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,{imagePositions:i,canonical:n})}};let tc,rc;ks("FillBucket",ec,{omit:["layers","patternFeatures"]});var nc={get paint(){return rc||=new Js({"fill-antialias":new Ys(Zt.paint_fill["fill-antialias"],"fill-antialias"),"fill-opacity":new Zs(Zt.paint_fill["fill-opacity"],"fill-opacity"),"fill-layer-opacity":new Ys(Zt.paint_fill["fill-layer-opacity"],"fill-layer-opacity"),"fill-color":new Zs(Zt.paint_fill["fill-color"],"fill-color"),"fill-outline-color":new Zs(Zt.paint_fill["fill-outline-color"],"fill-outline-color"),"fill-translate":new Ys(Zt.paint_fill["fill-translate"],"fill-translate"),"fill-translate-anchor":new Ys(Zt.paint_fill["fill-translate-anchor"],"fill-translate-anchor"),"fill-pattern":new Ws(Zt.paint_fill["fill-pattern"],"fill-pattern")})},get layout(){return tc||=new Js({"fill-sort-key":new Zs(Zt.layout_fill["fill-sort-key"],"fill-sort-key")})}};const ic=e=>"fill"===e.type;var ac=class extends to{constructor(e,t){super(e,nc,t)}recalculate(e,t){super.recalculate(e,t);let r=this.paint._values["fill-outline-color"];"constant"===r.value.kind&&void 0===r.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new ec(e)}queryRadius(){return mu(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:e,geometry:t,transform:r,pixelsToTileUnits:n}){return au(gu(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-r.bearingInRadians,n),t)}isTileClipped(){return!0}};const sc=uo([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),oc=uo([{name:"a_centroid",components:2,type:"Int16"}],4),lc=sc.members;sc.size,sc.alignment;var uc=class e{constructor(){this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0}extend(e){return this.minX=Math.min(this.minX,e.x),this.minY=Math.min(this.minY,e.y),this.maxX=Math.max(this.maxX,e.x),this.maxY=Math.max(this.maxY,e.y),this}expandBy(e){return this.minX-=e,this.minY-=e,this.maxX+=e,this.maxY+=e,(this.minX>this.maxX||this.minY>this.maxY)&&(this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0),this}shrinkBy(e){return this.expandBy(-e)}map(t){let r=new e;return r.extend(t(new l(this.minX,this.minY))),r.extend(t(new l(this.maxX,this.minY))),r.extend(t(new l(this.minX,this.maxY))),r.extend(t(new l(this.maxX,this.maxY))),r}static fromPoints(t){let r=new e;for(let e of t)r.extend(e);return r}contains(e){return e.x>=this.minX&&e.x<=this.maxX&&e.y>=this.minY&&e.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(e){return!this.empty()&&!e.empty()&&e.minX>=this.minX&&e.maxX<=this.maxX&&e.minY>=this.minY&&e.maxY<=this.maxY}intersects(e){return!this.empty()&&!e.empty()&&e.minX<=this.maxX&&e.maxX>=this.minX&&e.minY<=this.maxY&&e.maxY>=this.minY}};const hc=uc.fromPoints([new l(0,0),new l(de,de)]);function cc(e,t){return e.x===t.x&&(e.x<0||e.x>8192)||e.y===t.y&&(e.y<0||e.y>8192)}function pc(e){return e.every(e=>e.x<0)||e.every(e=>e.x>8192)||e.every(e=>e.y<0)||e.every(e=>e.y>8192)}var fc=class{constructor(e,t,r,n,i){for(this.properties=Object.create(null),this.extent=r,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=n,this._values=i;e.pos<t;){let t=e.readVarint();if(8===t)this.id=e.readVarint();else if(18===t){let t=e.readVarint()+e.pos;for(;e.pos<t;){let t=n[e.readVarint()],r=i[e.readVarint()];this.properties[t]=r}}else 24===t?this.type=e.readVarint():(34===t&&(this._geometry=e.pos),e.skip(t))}}loadGeometry(){if(this._geometry<0)throw Error("feature has no geometry");let e=this._pbf;e.pos=this._geometry;let t,r=e.readVarint()+e.pos,n=[],i=1,a=0,s=0,o=0;for(;e.pos<r;){if(a<=0){let t=e.readVarint();if(i=7&t,a=t>>3,0===a)continue}if(a--,1===i)s+=e.readSVarint(),o+=e.readSVarint(),t&&n.push(t),t=[new l(s,o)];else if(2===i)s+=e.readSVarint(),o+=e.readSVarint(),t&&t.push(new l(s,o));else{if(7!==i)throw Error(`unknown command ${i}`);t&&t.push(t[0].clone())}}return t&&n.push(t),n}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,r=1,n=0,i=0,a=0,s=1/0,o=-1/0,l=1/0,u=-1/0;for(;e.pos<t;){if(n<=0){let t=e.readVarint();if(r=7&t,n=t>>3,0===n)continue}if(n--,1===r||2===r)i+=e.readSVarint(),a+=e.readSVarint(),i<s&&(s=i),i>o&&(o=i),a<l&&(l=a),a>u&&(u=a);else if(7!==r)throw Error(`unknown command ${r}`)}return[s,l,o,u]}toGeoJSON(e,t,r){let n,i=this.extent*2**r,a=this.extent*e,s=this.extent*t,o=this.loadGeometry();function l(e){return[360*(e.x+a)/i-180,360/Math.PI*Math.atan(Math.exp((1-2*(e.y+s)/i)*Math.PI))-90]}function u(e){return e.map(l)}if(1===this.type){let e=[];for(let t of o)e.push(t[0]);let t=u(e);n=1===e.length?{type:"Point",coordinates:t[0]}:{type:"MultiPoint",coordinates:t}}else if(2===this.type){let e=o.map(u);n=1===e.length?{type:"LineString",coordinates:e[0]}:{type:"MultiLineString",coordinates:e}}else{if(3!==this.type)throw Error("unknown feature type");{let e=dc(o),t=[];for(let r of e)t.push(r.map(u));n=1===t.length?{type:"Polygon",coordinates:t[0]}:{type:"MultiPolygon",coordinates:t}}}let h={type:"Feature",geometry:n,properties:this.properties};return null!=this.id&&(h.id=this.id),h}};function dc(e){let t=e.length;if(t<=1)return[e];let r,n,i=[];for(let a=0;a<t;a++){let t=yc(e[a]);0!==t&&(void 0===n&&(n=t<0),n===t<0?(r&&i.push(r),r=[e[a]]):r&&r.push(e[a]))}return r&&i.push(r),i}function yc(e){let t=0;for(let r,n,i=0,a=e.length,s=a-1;i<a;s=i++)r=e[i],n=e[s],t+=(n.x-r.x)*(r.y+n.y);return t}fc.types=["Unknown","Point","LineString","Polygon"];var mc=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=[],void 0===t&&(t=e.length);e.pos<t;){let t=e.readVarint();10===t?this.name=e.readString():18===t?(this._features.push(e.pos),e.skip(t)):26===t?this._keys.push(e.readString()):34===t?this._values.push(gc(e)):40===t?this.extent=e.readVarint():120===t?this.version=e.readVarint():e.skip(t)}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 fc(this._pbf,t,this.extent,this._keys,this._values)}};function gc(e){let t=null,r=e.readVarint()+e.pos;for(;e.pos<r;){let r=e.readVarint();t=10===r?e.readString():21===r?e.readFloat():25===r?e.readDouble():32===r?e.readVarint(!0):40===r?e.readVarint():48===r?e.readSVarint():56===r?e.readBoolean():(e.skip(r),null)}if(null==t)throw Error("unknown feature value");return t}var xc=class{constructor(e,t=e.length){let r=Object.create(null);for(;e.pos<t;){let t=e.readVarint();if(26===t){let t=new mc(e,e.readVarint()+e.pos);t.length&&(r[t.name]=t)}else e.skip(t)}this.layers=r}};const vc=6371008.8;var bc=class e{constructor(e,t){if(isNaN(e)||isNaN(t))throw Error(`Invalid LngLat object: (${e}, ${t})`);if(this.lng=+e,this.lat=+t,this.lat>90||this.lat<-90)throw Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new e(Oe(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){let t=Math.PI/180,r=this.lat*t,n=e.lat*t,i=Math.sin(r)*Math.sin(n)+Math.cos(r)*Math.cos(n)*Math.cos((e.lng-this.lng)*t);return vc*Math.acos(Math.min(i,1))}static convert(t){if(t instanceof e)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new e(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&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>]")}};const wc=2*Math.PI*vc;function Dc(e){return wc*Math.cos(e*Math.PI/180)}function _c(e){return(180+e)/360}function Ac(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function Ec(e,t){return e/Dc(t)}function Sc(e){return 360*e-180}function Fc(e){let t=180-360*e;return 360/Math.PI*Math.atan(Math.exp(t*Math.PI/180))-90}function kc(e,t){return e*Dc(Fc(t))}var Ic=class e{constructor(e,t,r=0){this.x=+e,this.y=+t,this.z=+r}static fromLngLat(t,r=0){let n=bc.convert(t);return new e(_c(n.lng),Ac(n.lat),Ec(r,n.lat))}toLngLat(){return new bc(Sc(this.x),Fc(this.y))}toAltitude(){return kc(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/wc*function(e){return 1/Math.cos(e*Math.PI/180)}(Fc(this.y))}};const Tc=89.25;function Mc(e,t,r){let n=1/(1<<r.z);return new Ic(e/de*n+r.x*n,t/de*n+r.y*n)}function Cc(e,t){let r=Le(t.lat,-85.051129,bt);return new l(_c(t.lng)*e,Ac(r)*e)}function Bc(e,t){return new Ic(t.x/e,t.y/e).toLngLat()}function Pc(e){return e.cameraToCenterDistance*Math.min(.85*Math.tan(dt(90-e.pitch)),Math.tan(dt(89.25-e.pitch)))}function zc(e,t){let r=e.canonical,n=t/je(r.z),i=r.x+2**r.z*e.wrap,a=new Float64Array(16);return v(a),D(a,a,[i*n,r.y*n,0]),_(a,a,[n/de,n/de,1]),a}function Vc(e,t,r,n,i){let a=Ic.fromLngLat(e,t),s=i*Ec(1,e.lat),{x:o,y:l,z:u}=Oc(r,n),h=s*-o,c=s*-l,p=s*u;return new Ic(a.x+h,a.y+c,a.z+p)}function Lc(e){let t=Ec(1,e.center.lat)*e.worldSize;return Vc(e.center,e.elevation,e.pitch,e.bearing,e.cameraToCenterDistance/t)}function Oc(e,t){let r=dt(e),n=dt(t),i=Math.cos(-r),a=Math.sin(r);return{x:a*Math.sin(n),y:-a*Math.cos(n),z:i}}function Rc(e,t,r){if(t<=0||!e||0===e.length)return e;let n=function(e,t){let r=function(e,t,r){return Mc(4096,4096,r).toLngLat()}(0,0,t);return e*Ic.fromLngLat(r).meterInMercatorCoordinateUnits()*((1<<t.z)*de)}(t,r);return e.map(e=>function(e,t){if(!e||e.length<3)return e;let r=e[0].x===e[e.length-1].x&&e[0].y===e[e.length-1].y,n=r?e.length-1:e.length;if(n<3)return e;let i=[];for(let r=0;r<n;r++){let a=e[(r-1+n)%n],s=e[r],o=e[(r+1)%n];cc(a,s)||cc(s,o)?i.push(s.clone()):$c(i,a,s,o,t)}let a=function(e){let t=[];for(let r of e){let e=r.round(),n=t[t.length-1];(n?.x!==e.x||n?.y!==e.y)&&t.push(e)}for(;t.length>1&&t[0].x===t[t.length-1].x&&t[0].y===t[t.length-1].y;)t.pop();return t}(i);return a.length<3?e:(r&&a.push(a[0].clone()),a)}(e,n))}function $c(e,t,r,n,i){let a=t.sub(r),s=n.sub(r),o=a.mag(),l=s.mag();if(o<1e-6||l<1e-6)return void e.push(r.clone());a._div(o),s._div(l);let u=a.x*s.x+a.y*s.y;if(Math.abs(u)>Math.cos(5*Math.PI/180))return void e.push(r.clone());let h=Math.min(i,.2*o,.2*l),c=r.add(a.mult(h)),p=r.add(s.mult(h)),f=Math.sqrt((1+u)/2),d=r.add(a.add(s)._unit()._mult(h/f)),y=c.sub(d).angleWith(p.sub(d)),m=Math.max(2,Math.ceil(Math.abs(y)/(Math.PI/6)-1e-6));for(let t=0;t<=m;t++)e.push(c.rotateAround(t/m*y,d))}const Nc=8192;function Uc(e,t,r,n,i,a,s,o){e.emplaceBack(t,r,2*Math.floor(n*Nc)+s,i*Nc*2,a*Nc*2,Math.round(o))}var qc=class{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.id),this.index=e.index,this.hasDependencies=!1,this.layoutVertexArray=new Qo,this.centroidVertexArray=new Zo,this.indexArray=new cl,this.programConfigurations=new Yl(e.layers,e.zoom),this.segments=new ml,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(e,t,r){this.features=[],this.hasDependencies=nh("fill-extrusion",this.layers,t);let n=new zs(this.zoom),i=this.layers[0],a=i.layout.get("fill-extrusion-rounded-corner-distance"),s=i._featureFilter.needGeometry;for(let{feature:o,id:l,index:u,sourceLayerIndex:h}of e){let e=Ql(o,s);if(!i._featureFilter.filter(n,e,r))continue;let c=s?e.geometry:Jl(o),p={id:l,sourceLayerIndex:h,index:u,geometry:a>0?Rc(c,a,r):c,properties:o.properties,type:o.type,patterns:{}};this.hasDependencies?this.features.push(ih("fill-extrusion",this.layers,p,{zoom:this.zoom},t)):this.addFeature(p,p.geometry,u,r,{},t.subdivisionGranularity),t.featureIndex.insert(o,p.geometry,u,h,this.index,!0)}}addFeatures({options:e,canonical:t,patternPositions:r}){for(let n of this.features){let{geometry:i}=n;this.addFeature(n,i,n.index,t,r,e.subdivisionGranularity)}}update(e,t,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,{imagePositions:r})}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.centroidVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,lc),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,oc.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,t,r,n,i,a){let s=this.layers[0],o=s.layout?s.layout.get("fill-extrusion-rounded-corner-distance"):0,l=o>0?Rc(t,o,n):t;for(let t of xn(l,500)){let r={x:0,y:0,sampleCount:0},i=this.layoutVertexArray.length;this.processPolygon(r,n,e,t,a);let s=this.layoutVertexArray.length-i,o=Math.floor(r.x/r.sampleCount),l=Math.floor(r.y/r.sampleCount);for(let e=0;e<s;e++)this.centroidVertexArray.emplaceBack(o,l)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,{imagePositions:i,canonical:n})}processPolygon(e,t,r,n,i){if(n.length<1||pc(n[0]))return;for(let t of n)0!==t.length&&jc(e,t);let a={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},s=i.fill.getGranularityForZoomLevel(t.z),o="Polygon"===fc.types[r.type];for(let e of n){if(0===e.length||pc(e))continue;let t=Hh(e,s,o);this._generateSideFaces(t,a)}if(!o)return;let l=Wh(n,t,s,!1),u=this.layoutVertexArray;Jh((e,t)=>{Uc(u,e,t,0,0,1,1,0)},this.segments,this.layoutVertexArray,this.indexArray,l.verticesFlattened,l.indicesTriangles)}_generateSideFaces(e,t){let r=0;for(let n=1;n<e.length;n++){let i=e[n],a=e[n-1];if(cc(i,a))continue;t.segment.vertexLength+4>ml.MAX_VERTEX_ARRAY_LENGTH&&(t.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let s=i.sub(a)._perp()._unit(),o=a.dist(i);r+o>32768&&(r=0),Uc(this.layoutVertexArray,i.x,i.y,s.x,s.y,0,0,r),Uc(this.layoutVertexArray,i.x,i.y,s.x,s.y,0,1,r),r+=o,Uc(this.layoutVertexArray,a.x,a.y,s.x,s.y,0,0,r),Uc(this.layoutVertexArray,a.x,a.y,s.x,s.y,0,1,r);let l=t.segment.vertexLength;this.indexArray.emplaceBack(l,l+2,l+1),this.indexArray.emplaceBack(l+1,l+2,l+3),t.segment.vertexLength+=4,t.segment.primitiveLength+=2}}};function jc(e,t){for(let r=0;r<t.length;r++){let n=t[r];(r!==t.length-1||t[0].x!==n.x||t[0].y!==n.y)&&(e.x+=n.x,e.y+=n.y,e.sampleCount++)}}let Gc,Xc;ks("FillExtrusionBucket",qc,{omit:["layers","features"]});var Yc={get paint(){return Xc||=new Js({"fill-extrusion-opacity":new Ys(Zt["paint_fill-extrusion"]["fill-extrusion-opacity"],"fill-extrusion-opacity"),"fill-extrusion-color":new Zs(Zt["paint_fill-extrusion"]["fill-extrusion-color"],"fill-extrusion-color"),"fill-extrusion-translate":new Ys(Zt["paint_fill-extrusion"]["fill-extrusion-translate"],"fill-extrusion-translate"),"fill-extrusion-translate-anchor":new Ys(Zt["paint_fill-extrusion"]["fill-extrusion-translate-anchor"],"fill-extrusion-translate-anchor"),"fill-extrusion-pattern":new Ws(Zt["paint_fill-extrusion"]["fill-extrusion-pattern"],"fill-extrusion-pattern"),"fill-extrusion-height":new Zs(Zt["paint_fill-extrusion"]["fill-extrusion-height"],"fill-extrusion-height"),"fill-extrusion-base":new Zs(Zt["paint_fill-extrusion"]["fill-extrusion-base"],"fill-extrusion-base"),"fill-extrusion-vertical-gradient":new Ys(Zt["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"],"fill-extrusion-vertical-gradient")})},get layout(){return Gc||=new Js({"fill-extrusion-rounded-corner-distance":new Ys(Zt["layout_fill-extrusion"]["fill-extrusion-rounded-corner-distance"],"fill-extrusion-rounded-corner-distance")})}};const Zc=e=>"fill-extrusion"===e.type;var Wc=class extends to{constructor(e,t){super(e,Yc,t)}createBucket(e){return new qc(e)}queryRadius(){return mu(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:r,geometry:n,transform:i,pixelsToTileUnits:a,pixelPosMatrix:s}){let o=gu(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-i.bearingInRadians,a),l=this.paint.get("fill-extrusion-height").evaluate(t,r),u=this.paint.get("fill-extrusion-base").evaluate(t,r),h=Qc(o,s,0),c=Jc(n,u,l,s);return function(e,t,r){let n=1/0;au(r,t)&&(n=Kc(r,t[0]));for(let i=0;i<t.length;i++){let a=t[i],s=e[i];for(let e=0;e<a.length-1;e++){let t=a[e],i=a[e+1],o=s[e],l=[t,i,s[e+1],o,t];nu(r,l)&&(n=Math.min(n,Kc(r,l)))}}return n!==1/0&&n}(c[0],c[1],h)}};function Hc(e,t){return e.x*t.x+e.y*t.y}function Kc(e,t){if(1===e.length){let r,n=0,i=t[n++];for(;!r||i.equals(r);)if(r=t[n++],!r)return 1/0;for(;n<t.length;n++){let a=t[n],s=e[0],o=r.sub(i),l=a.sub(i),u=s.sub(i),h=Hc(o,o),c=Hc(o,l),p=Hc(l,l),f=Hc(u,o),d=Hc(u,l),y=h*p-c*c,m=(p*f-c*d)/y,g=(h*d-c*f)/y,x=1-m-g,v=i.z*x+r.z*m+a.z*g;if(isFinite(v))return v}return 1/0}{let e=1/0;for(let r of t)e=Math.min(e,r.z);return e}}function Jc(e,t,r,n){let i=[],a=[],s=n[8]*t,o=n[9]*t,u=n[10]*t,h=n[11]*t,c=n[8]*r,p=n[9]*r,f=n[10]*r,d=n[11]*r;for(let t of e){let e=[],r=[];for(let i of t){let t=i.x,a=i.y,y=n[0]*t+n[4]*a+n[12],m=n[1]*t+n[5]*a+n[13],g=n[2]*t+n[6]*a+n[14],x=n[3]*t+n[7]*a+n[15],v=g+u,b=x+h,w=y+c,D=m+p,_=g+f,A=x+d,E=new l((y+s)/b,(m+o)/b);E.z=v/b,e.push(E);let S=new l(w/A,D/A);S.z=_/A,r.push(S)}i.push(e),a.push(r)}return[i,a]}function Qc(e,t,r){let n=[];for(let i of e){let e=[i.x,i.y,r,1];te(e,e,t),n.push(new l(e[0]/e[3],e[1]/e[3]))}return n}function ep(e,t,r,n){let i,a=n,s=t+(r-t>>1),o=r-t,l=e[t],u=e[t+1],h=e[r],c=e[r+1];for(let n=t+3;n<r;n+=3){let t=tp(e[n],e[n+1],l,u,h,c);if(t>a)i=n,a=t;else if(t===a){let e=Math.abs(n-s);e<o&&(i=n,o=e)}}a>n&&(i-t>3&&ep(e,t,i,n),e[i+2]=a,r-i>3&&ep(e,i,r,n))}function tp(e,t,r,n,i,a){let s=i-r,o=a-n;if(0!==s||0!==o){let l=((e-r)*s+(t-n)*o)/(s*s+o*o);l>1?(r=i,n=a):l>0&&(r+=s*l,n+=o*l)}return s=e-r,o=t-n,s*s+o*o}function rp(e,t,r,n){let i={type:t,geom:r},a={id:e??null,type:i.type,geometry:i.geom,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};switch(i.type){case"Point":case"MultiPoint":ip(a,i.geom);break;case"LineString":ip(a,i.geom.points);break;case"Polygon":ip(a,i.geom[0].points);break;case"MultiLineString":for(let e of i.geom)ip(a,e.points);break;case"MultiPolygon":for(let e of i.geom)ip(a,e[0].points)}return a}function np(e){let t=e;e.points.length>64&&(t.points=new Float64Array(e.points))}function ip(e,t){for(let r=0;r<t.length;r+=3)e.minX=Math.min(e.minX,t[r]),e.minY=Math.min(e.minY,t[r+1]),e.maxX=Math.max(e.maxX,t[r]),e.maxY=Math.max(e.maxY,t[r+1])}function ap(e,t){let r=[];switch(e.type){case"FeatureCollection":for(let n=0;n<e.features.length;n++)sp(r,e.features[n],t,n);break;case"Feature":sp(r,e,t);break;default:sp(r,{type:"Feature",geometry:e,properties:void 0},t)}return r}function sp(e,t,r,n,i=0){if(!t.geometry)return;if(i>1024)throw Error("GeometryCollection nesting exceeds supported depth: 1024");if("GeometryCollection"===t.geometry.type)return void function(e,t,r,n,i,a=0){for(let s of r.geometries)sp(e,{id:t.id,type:"Feature",geometry:s,properties:t.properties},n,i,a)}(e,t,t.geometry,r,n,i+1);if(!t.geometry.coordinates?.length)return;let a=function(e,t,r){return t.promoteId?e.properties?.[t.promoteId]:t.generateId?r||0:e.id}(t,r,n),s=(r.tolerance/((1<<r.maxZoom)*r.extent))**2;switch(t.geometry.type){case"Point":return void function(e,t,r,n){let i=[];i.push(up(r.coordinates[0]),hp(r.coordinates[1]),0),e.push(rp(t,"Point",i,n))}(e,a,t.geometry,t.properties);case"MultiPoint":return void function(e,t,r,n){let i=[];for(let e of r.coordinates)i.push(up(e[0]),hp(e[1]),0);e.push(rp(t,"MultiPoint",i,n))}(e,a,t.geometry,t.properties);case"LineString":return void function(e,t,r,n,i){let a={points:[]};op(r.coordinates,a,n,!1),e.push(rp(t,"LineString",a,i))}(e,a,t.geometry,s,t.properties);case"MultiLineString":return void function(e,t,r,n,i,a){if(i.lineMetrics)for(let i of r.coordinates){let r={points:[]};op(i,r,n,!1),e.push(rp(t,"LineString",r,a))}else{let i=[];lp(r.coordinates,i,n,!1),e.push(rp(t,"MultiLineString",i,a))}}(e,a,t.geometry,s,r,t.properties);case"Polygon":return void function(e,t,r,n,i){let a=[];lp(r.coordinates,a,n,!0),e.push(rp(t,"Polygon",a,i))}(e,a,t.geometry,s,t.properties);case"MultiPolygon":return void function(e,t,r,n,i){let a=[];for(let e of r.coordinates){let t=[];lp(e,t,n,!0),a.push(t)}e.push(rp(t,"MultiPolygon",a,i))}(e,a,t.geometry,s,t.properties);default:throw Error("Input data is not a valid GeoJSON object.")}}function op(e,t,r,n){let i,a,s=0;for(let r=0;r<e.length;r++){let o=up(e[r][0]),l=hp(e[r][1]);t.points.push(o,l,0),r>0&&(s+=n?(i*l-o*a)/2:Math.sqrt((o-i)**2+(l-a)**2)),i=o,a=l}let o=t.points.length-3;t.points[2]=1,r>0&&ep(t.points,0,o,r),t.points[o+2]=1,np(t),t.size=Math.abs(s),t.start=0,t.end=t.size}function lp(e,t,r,n){for(let i=0;i<e.length;i++){let a={points:[]};op(e[i],a,r,n),t.push(a)}}function up(e){return e/360+.5}function hp(e){let t=Math.sin(e*Math.PI/180),r=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return r<0?0:r>1?1:r}function cp(e){let t={type:"Feature",geometry:pp(e),properties:e.tags};return null!=e.id&&(t.id=e.id),t}function pp(e){let{type:t,geometry:r}=e;switch(t){case"Point":return{type:t,coordinates:dp(r[0],r[1])};case"MultiPoint":return{type:t,coordinates:fp(r)};case"LineString":return{type:t,coordinates:fp(r.points)};case"MultiLineString":case"Polygon":return{type:t,coordinates:r.map(e=>fp(e.points))};case"MultiPolygon":return{type:t,coordinates:r.map(e=>e.map(e=>fp(e.points)))}}}function fp(e){let t=[];for(let r=0;r<e.length;r+=3)t.push(dp(e[r],e[r+1]));return t}function dp(e,t){return[yp(e),mp(t)]}function yp(e){return 360*(e-.5)}function mp(e){let t=(180-360*e)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}function gp(e,t,r,n,i,a,s,o){if(n/=t,a>=(r/=t)&&s<n)return e;if(s<r||a>=n)return null;let l=[];for(let t of e){let e=0===i?t.minX:t.minY,a=0===i?t.maxX:t.maxY;if(e>=r&&a<n)l.push(t);else if(!(a<r||e>=n))switch(t.type){case"Point":case"MultiPoint":xp(t,l,r,n,i);continue;case"LineString":vp(t,l,r,n,i,o);continue;case"MultiLineString":bp(t,l,r,n,i);continue;case"Polygon":wp(t,l,r,n,i);continue;case"MultiPolygon":Dp(t,l,r,n,i);continue}}return l.length?l:null}function xp(e,t,r,n,i){let a=[];if(function(e,t,r,n,i){for(let a=0;a<e.length;a+=3){let s=e[a+i];s>=r&&s<=n&&Sp(t,e[a],e[a+1],e[a+2])}}(e.geometry,a,r,n,i),!a.length)return;let s=3===a.length?"Point":"MultiPoint";t.push(rp(e.id,s,a,e.tags))}function vp(e,t,r,n,i,a){let s=[];if(_p(e.geometry,s,r,n,i,!1,a.lineMetrics),s.length){if(a.lineMetrics){for(let r of s)t.push(rp(e.id,"LineString",r,e.tags));return}if(s.length>1)return void t.push(rp(e.id,"MultiLineString",s,e.tags));t.push(rp(e.id,"LineString",s[0],e.tags))}}function bp(e,t,r,n,i){let a=[];if(Ep(e.geometry,a,r,n,i,!1),a.length){if(1===a.length)return void t.push(rp(e.id,"LineString",a[0],e.tags));t.push(rp(e.id,"MultiLineString",a,e.tags))}}function wp(e,t,r,n,i){let a=[];Ep(e.geometry,a,r,n,i,!0),a.length&&t.push(rp(e.id,"Polygon",a,e.tags))}function Dp(e,t,r,n,i){let a=[];for(let t of e.geometry){let e=[];Ep(t,e,r,n,i,!0),e.length&&a.push(e)}a.length&&t.push(rp(e.id,"MultiPolygon",a,e.tags))}function _p(e,t,r,n,i,a,s){let o,l,u=Ap(e),h=0===i?Fp:kp,c=e.start;for(let p=0;p<e.points.length-3;p+=3){let f=e.points[p],d=e.points[p+1],y=e.points[p+2],m=e.points[p+3],g=e.points[p+4],x=0===i?f:d,v=0===i?m:g,b=!1;s&&(o=Math.sqrt((f-m)**2+(d-g)**2)),x<r?v>r&&(l=h(u,f,d,m,g,r),s&&(u.start=c+o*l)):x>n?v<n&&(l=h(u,f,d,m,g,n),s&&(u.start=c+o*l)):Sp(u.points,f,d,y),v<r&&x>=r&&(l=h(u,f,d,m,g,r),b=!0),v>n&&x<=n&&(l=h(u,f,d,m,g,n),b=!0),!a&&b&&(s&&(u.end=c+o*l),t.push(u),u=Ap(e)),s&&(c+=o)}let p=e.points.length-3,f=e.points[p],d=e.points[p+1],y=e.points[p+2],m=0===i?f:d;m>=r&&m<=n&&Sp(u.points,f,d,y),p=u.points.length-3,a&&p>=3&&(u.points[p]!==u.points[0]||u.points[p+1]!==u.points[1])&&Sp(u.points,u.points[0],u.points[1],u.points[2]),u.points.length&&(np(u),t.push(u))}function Ap(e){return{points:[],size:e.size,start:e.start,end:e.end}}function Ep(e,t,r,n,i,a){for(let s of e)_p(s,t,r,n,i,a,!1)}function Sp(e,t,r,n){e.push(t,r,n)}function Fp(e,t,r,n,i,a){let s=(a-t)/(n-t);return Sp(e.points,a,r+(i-r)*s,1),s}function kp(e,t,r,n,i,a){let s=(a-r)/(i-r);return Sp(e.points,t+(n-t)*s,a,1),s}function Ip(e,t){let r=t.buffer/t.extent,n=e,i=gp(e,1,-1-r,r,0,-1,2,t),a=gp(e,1,1-r,2+r,0,-1,2,t);return i||a?(n=gp(e,1,-r,1+r,0,-1,2,t)||[],i&&(n=Tp(i,1).concat(n)),a&&(n=n.concat(Tp(a,-1))),n):n}function Tp(e,t){let r=[];for(let n of e)switch(n.type){case"Point":case"MultiPoint":{let e=Mp(n.geometry,t);r.push(rp(n.id,n.type,e,n.tags));continue}case"LineString":{let e=Cp(n.geometry,t);r.push(rp(n.id,n.type,e,n.tags));continue}case"MultiLineString":case"Polygon":{let e=[];for(let r of n.geometry)e.push(Cp(r,t));r.push(rp(n.id,n.type,e,n.tags));continue}case"MultiPolygon":{let e=[];for(let r of n.geometry){let n=[];for(let e of r)n.push(Cp(e,t));e.push(n)}r.push(rp(n.id,n.type,e,n.tags));continue}}return r}function Mp(e,t){let r=[];for(let n=0;n<e.length;n+=3)r.push(e[n]+t,e[n+1],e[n+2]);return r}function Cp(e,t){let r={points:[],size:e.size};void 0!==e.start&&(r.start=e.start,r.end=e.end);for(let n=0;n<e.points.length;n+=3)r.points.push(e.points[n]+t,e.points[n+1],e.points[n+2]);return np(r),r}function Bp(e,t,r){let n=!!t.newGeometry,i=t.removeAllProperties||t.removeProperties?.length>0||t.addOrUpdateProperties?.length>0;if(n){let n=e[0],a=ap({type:"FeatureCollection",features:[{type:"Feature",id:n.id,geometry:t.newGeometry,properties:i?Pp(n.tags,t):n.tags}]},r);return a=Ip(a,r),a}if(i){let r=[];for(let n of e){let e={...n};e.tags=Pp(e.tags,t),r.push(e)}return r}return e}function Pp(e,t){if(t.removeAllProperties)return{};let r={...e||{}};if(t.removeProperties)for(let e of t.removeProperties)delete r[e];if(t.addOrUpdateProperties)for(let{key:e,value:n}of t.addOrUpdateProperties)r[e]=n;return r}const zp=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],Vp=new Uint32Array(96);var Lp=class e{static from(t){if(!t||void 0===t.byteLength||t.buffer)throw Error("Data must be an instance of ArrayBuffer or SharedArrayBuffer.");let[r,n]=new Uint8Array(t,0,2);if(219!==r)throw Error("Data does not appear to be in a KDBush format.");let i=n>>4;if(1!==i)throw Error(`Got v${i} data when expected v1.`);let a=zp[15&n];if(!a)throw Error("Unrecognized array type.");let[s]=new Uint16Array(t,2,1),[o]=new Uint32Array(t,4,1);return new e(o,s,a,void 0,t)}constructor(e,t=64,r=Float64Array,n=ArrayBuffer,i){if(isNaN(e)||e<0)throw Error(`Unexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=r,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;let a=zp.indexOf(this.ArrayType),s=2*e*this.ArrayType.BYTES_PER_ELEMENT,o=e*this.IndexArrayType.BYTES_PER_ELEMENT,l=(8-o%8)%8;if(a<0)throw Error(`Unexpected typed array class: ${r}.`);if(i)this.data=i,this.ids=new this.IndexArrayType(i,8,e),this.coords=new r(i,8+o+l,2*e),this._pos=2*e,this._finished=!0;else{let i=this.data=new n(8+s+o+l);this.ids=new this.IndexArrayType(i,8,e),this.coords=new r(i,8+o+l,2*e),this._pos=0,this._finished=!1,new Uint8Array(i,0,2).set([219,16+a]),new Uint16Array(i,2,1)[0]=t,new Uint32Array(i,4,1)[0]=e}}add(e,t){let r=this._pos>>1;return this.ids[r]=r,this.coords[this._pos++]=e,this.coords[this._pos++]=t,r}finish(){let e=this._pos>>1;if(e!==this.numItems)throw Error(`Added ${e} items when expected ${this.numItems}.`);return Op(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,r,n){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:i,coords:a,nodeSize:s}=this;Vp[0]=0,Vp[1]=i.length-1,Vp[2]=0;let o=3,l=[];for(;o>0;){let u=Vp[--o],h=Vp[--o],c=Vp[--o];if(h-c<=s){for(let s=c;s<=h;s++){let o=a[2*s],u=a[2*s+1];o>=e&&o<=r&&u>=t&&u<=n&&l.push(i[s])}continue}let p=c+h>>1,f=a[2*p],d=a[2*p+1];f>=e&&f<=r&&d>=t&&d<=n&&l.push(i[p]),(0===u?e<=f:t<=d)&&(Vp[o++]=c,Vp[o++]=p-1,Vp[o++]=1-u),(0===u?r>=f:n>=d)&&(Vp[o++]=p+1,Vp[o++]=h,Vp[o++]=1-u)}return l}within(e,t,r){let n=[];return this.withinInto(e,t,r,n),n}withinInto(e,t,r,n){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:i,coords:a,nodeSize:s}=this;Vp[0]=0,Vp[1]=i.length-1,Vp[2]=0;let o=3,l=0,u=r*r;for(;o>0;){let h=Vp[--o],c=Vp[--o],p=Vp[--o];if(c-p<=s){for(let r=p;r<=c;r++)Up(a[2*r],a[2*r+1],e,t)<=u&&(n[l++]=i[r]);continue}let f=p+c>>1,d=a[2*f],y=a[2*f+1];Up(d,y,e,t)<=u&&(n[l++]=i[f]),(0===h?e-r<=d:t-r<=y)&&(Vp[o++]=p,Vp[o++]=f-1,Vp[o++]=1-h),(0===h?e+r>=d:t+r>=y)&&(Vp[o++]=f+1,Vp[o++]=c,Vp[o++]=1-h)}return l}};function Op(e,t,r,n,i,a){if(i-n<=r)return;let s=n+i>>1;Rp(e,t,s,n,i,a),Op(e,t,r,n,s-1,1-a),Op(e,t,r,s+1,i,1-a)}function Rp(e,t,r,n,i,a){for(;i>n;){if(i-n>600){let s=i-n+1,o=r-n+1,l=Math.log(s),u=.5*Math.exp(2*l/3),h=.5*Math.sqrt(l*u*(s-u)/s)*(o-s/2<0?-1:1);Rp(e,t,r,Math.max(n,Math.floor(r-o*u/s+h)),Math.min(i,Math.floor(r+(s-o)*u/s+h)),a)}let s=t[2*r+a],o=n,l=i;for($p(e,t,n,r),t[2*i+a]>s&&$p(e,t,n,i);o<l;){for($p(e,t,o,l),o++,l--;t[2*o+a]<s;)o++;for(;t[2*l+a]>s;)l--}t[2*n+a]===s?$p(e,t,n,l):(l++,$p(e,t,l,i)),l<=r&&(n=l+1),r<=l&&(i=l-1)}}function $p(e,t,r,n){Np(e,r,n),Np(t,2*r,2*n),Np(t,2*r+1,2*n+1)}function Np(e,t,r){let n=e[t];e[t]=e[r],e[r]=n}function Up(e,t,r,n){let i=e-r,a=t-n;return i*i+a*a}const qp={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:e=>e};var jp=class{constructor(e){this.options=Object.assign(Object.create(qp),e),this.trees=Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[],this.points=[]}load(e){let t=[];for(let r of e){if(!r.geometry)continue;let[e,n]=r.geometry.coordinates,[i,a]=[up(e),hp(n)],s={id:r.id,type:"Point",geometry:[i,a],tags:r.properties};t.push(s)}this.createIndex(t)}initialize(e){let t=[];for(let r of e)"Point"===r.type&&t.push(r);this.createIndex(t)}updateIndex(e,t,r){this.options=Object.assign(Object.create(qp),r.clusterOptions),this.initialize(e)}createIndex(e){let{log:t,minZoom:r,maxZoom:n}=this.options;t&&console.time("total time");let i=`prepare ${e.length} points`;t&&console.time(i),this.points=e;let a=[];for(let t=0;t<e.length;t++){let r=e[t];if(!r?.geometry)continue;let[n,i]=r.geometry;n=Math.fround(n),i=Math.fround(i),a.push(n,i,1/0,t,-1,1),this.options.reduce&&a.push(0)}let s=this.trees[n+1]=this.createTree(a);t&&console.timeEnd(i);for(let e=n;e>=r;e--){let r=Date.now();s=this.trees[e]=this.createTree(this.cluster(s,e)),t&&console.log("z%d: %d clusters in %dms",e,s.numItems,Date.now()-r)}t&&console.timeEnd("total time")}getClusters(e,t){return this.getClustersInternal(e,t).map(e=>cp(e))}getClustersInternal(e,t){let r=((e[0]+180)%360+360)%360-180,n=Math.max(-90,Math.min(90,e[1])),i=180===e[2]?180:((e[2]+180)%360+360)%360-180,a=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)r=-180,i=180;else if(r>i){let e=this.getClustersInternal([r,n,180,a],t),s=this.getClustersInternal([-180,n,i,a],t);return e.concat(s)}let s=this.trees[this.limitZoom(t)],o=s.range(up(r),hp(a),up(i),hp(n)),l=s.flatData,u=[];for(let e of o){let t=this.stride*e;u.push(l[t+5]>1?Gp(l,t,this.clusterProps):this.points[l[t+3]])}return u}getChildren(e){let t=this.getOriginId(e),r=this.getOriginZoom(e),n=Error("No cluster with the specified id: "+e),i=this.trees[r];if(!i)throw n;let a=i.flatData;if(t*this.stride>=a.length)throw n;let s=this.options.radius/(this.options.extent*2**(r-1)),o=a[t*this.stride],l=a[t*this.stride+1],u=i.within(o,l,s),h=[];for(let t of u){let r=t*this.stride;a[r+4]===e&&h.push(a[r+5]>1?Xp(a,r,this.clusterProps):cp(this.points[a[r+3]]))}if(0===h.length)throw n;return h}getLeaves(e,t,r){t||=10,r||=0;let n=[];return this.appendLeaves(n,e,t,r,0),n}getTile(e,t,r){let n=this.trees[this.limitZoom(e)];if(!n)return null;let i=2**e,{extent:a,radius:s}=this.options,o=s/a,l=(r-o)/i,u=(r+1+o)/i,h={transformed:!0,features:[],source:null,x:t,y:r,z:e};return this.addTileFeatures(n.range((t-o)/i,l,(t+1+o)/i,u),n.flatData,t,r,i,h),0===t&&this.addTileFeatures(n.range(1-o/i,l,1,u),n.flatData,i,r,i,h),t===i-1&&this.addTileFeatures(n.range(0,l,o/i,u),n.flatData,-1,r,i,h),h}getClusterExpansionZoom(e){return this.getOriginZoom(e)}appendLeaves(e,t,r,n,i){let a=this.getChildren(t);for(let t of a){let a=t.properties;if(a?.cluster?i+a.point_count<=n?i+=a.point_count:i=this.appendLeaves(e,a.cluster_id,r,n,i):i<n?i++:e.push(t),e.length===r)break}return i}createTree(e){let t=new Lp(e.length/this.stride|0,this.options.nodeSize,Float32Array);for(let r=0;r<e.length;r+=this.stride)t.add(e[r],e[r+1]);return t.finish(),t.flatData=e,t.data=null,t}addTileFeatures(e,t,r,n,i,a){for(let s of e){let e,o,l,u=s*this.stride,h=t[u+5]>1;if(h)e=Yp(t,u,this.clusterProps),o=t[u],l=t[u+1];else{let r=this.points[t[u+3]];e=r.tags,[o,l]=r.geometry}let c,p={type:1,geometry:[[Math.round(this.options.extent*(o*i-r)),Math.round(this.options.extent*(l*i-n))]],tags:e};c=h||this.options.generateId?t[u+3]:this.points[t[u+3]].id,void 0!==c&&(p.id=c),a.features.push(p)}}limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}cluster(e,t){let{radius:r,extent:n,reduce:i,minPoints:a}=this.options,s=r/(n*2**t),o=e.flatData,l=[],u=this.stride;for(let r=0;r<o.length;r+=u){if(o[r+2]<=t)continue;o[r+2]=t;let n=o[r],h=o[r+1],c=e.within(o[r],o[r+1],s),p=o[r+5],f=p;for(let e of c){let r=e*u;o[r+2]>t&&(f+=o[r+5])}if(f>p&&f>=a){let e,a=n*p,s=h*p,d=-1,y=(r/u<<5)+(t+1)+this.points.length;for(let n of c){let l=n*u;if(o[l+2]<=t)continue;o[l+2]=t;let h=o[l+5];a+=o[l]*h,s+=o[l+1]*h,o[l+4]=y,i&&(e||(e=this.map(o,r,!0),d=this.clusterProps.length,this.clusterProps.push(e)),i(e,this.map(o,l)))}o[r+4]=y,l.push(a/f,s/f,1/0,y,-1,f),i&&l.push(d)}else{for(let e=0;e<u;e++)l.push(o[r+e]);if(f>1)for(let e of c){let r=e*u;if(!(o[r+2]<=t)){o[r+2]=t;for(let e=0;e<u;e++)l.push(o[r+e])}}}}return l}getOriginId(e){return e-this.points.length>>5}getOriginZoom(e){return(e-this.points.length)%32}map(e,t,r){if(e[t+5]>1){let n=this.clusterProps[e[t+6]];return r?Object.assign({},n):n}let n=this.points[e[t+3]].tags,i=this.options.map(n);return r&&i===n?Object.assign({},i):i}};function Gp(e,t,r){return{id:e[t+3],type:"Point",tags:Yp(e,t,r),geometry:[e[t],e[t+1]]}}function Xp(e,t,r){return{type:"Feature",id:e[t+3],properties:Yp(e,t,r),geometry:{type:"Point",coordinates:[yp(e[t]),mp(e[t+1])]}}}function Yp(e,t,r){let n=e[t+5],i=n>=1e4?`${Math.round(n/1e3)}k`:n>=1e3?Math.round(n/100)/10+"k":n,a=e[t+6],s=-1===a?{}:Object.assign({},r[a]);return Object.assign(s,{cluster:!0,cluster_id:e[t+3],point_count:n,point_count_abbreviated:i})}const Zp="geojsonvt_clip_start",Wp="geojsonvt_clip_end";function Hp(e,t,r,n,i){let a=t===i.maxZoom?0:i.tolerance/((1<<t)*i.extent),s={transformed:!1,features:[],source:null,x:r,y:n,z:t,minX:2,minY:1,maxX:-1,maxY:0,numPoints:0,numSimplified:0,numFeatures:e.length};for(let t of e)Kp(s,t,a,i);return s}function Kp(e,t,r,n){switch(e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),t.type){case"Point":case"MultiPoint":return void function(e,t){let r=[];for(let n=0;n<t.geometry.length;n+=3)r.push(t.geometry[n],t.geometry[n+1]),e.numPoints++,e.numSimplified++;if(!r.length)return;let n={type:1,tags:t.tags||null,geometry:r};null!==t.id&&(n.id=t.id),e.features.push(n)}(e,t);case"LineString":return void function(e,t,r,n){let i=[];if(Jp(i,t.geometry,e,r,!1,!1),!i.length)return;let a=t.tags||null;if(n.lineMetrics){a={};for(let e in t.tags)a[e]=t.tags[e];a[Zp]=t.geometry.start/t.geometry.size,a[Wp]=t.geometry.end/t.geometry.size}let s={type:2,tags:a,geometry:i};null!==t.id&&(s.id=t.id),e.features.push(s)}(e,t,r,n);case"MultiLineString":case"Polygon":return void function(e,t,r){let n=[];for(let i=0;i<t.geometry.length;i++)Jp(n,t.geometry[i],e,r,"Polygon"===t.type,0===i);if(!n.length)return;let i={type:"Polygon"===t.type?3:2,tags:t.tags||null,geometry:n};null!==t.id&&(i.id=t.id),e.features.push(i)}(e,t,r);case"MultiPolygon":return void function(e,t,r){let n=[];for(let i=0;i<t.geometry.length;i++){let a=t.geometry[i];for(let t=0;t<a.length;t++)Jp(n,a[t],e,r,!0,0===t)}if(!n.length)return;let i={type:3,tags:t.tags||null,geometry:n};null!==t.id&&(i.id=t.id),e.features.push(i)}(e,t,r)}}function Jp(e,t,r,n,i,a){let s=n*n;if(n>0&&t.size<(i?s:n))return void(r.numPoints+=t.points.length/3);let o=[];for(let e=0;e<t.points.length;e+=3)(0===n||t.points[e+2]>s)&&(r.numSimplified++,o.push(t.points[e],t.points[e+1])),r.numPoints++;i&&function(e,t){let r=0;for(let t=0,n=e.length,i=n-2;t<n;i=t,t+=2)r+=(e[t]-e[i])*(e[t+1]+e[i+1]);if(r>0===t)for(let t=0,r=e.length;t<r/2;t+=2){let n=e[t],i=e[t+1];e[t]=e[r-2-t],e[t+1]=e[r-1-t],e[r-2-t]=n,e[r-1-t]=i}}(o,a),e.push(o)}function Qp(e,t){if(e.transformed)return e;let r=1<<e.z,n=e.x,i=e.y;for(let a of e.features)1===a.type?ef(a,t,r,n,i):tf(a,t,r,n,i);return e.transformed=!0,e}function ef(e,t,r,n,i){let a=e,s=e.geometry,o=[];for(let e=0;e<s.length;e+=2)o.push(rf(s[e],s[e+1],t,r,n,i));return a.geometry=o,a}function tf(e,t,r,n,i){let a=e,s=e.geometry,o=[];for(let e of s){let a=[];for(let s=0;s<e.length;s+=2)a.push(rf(e[s],e[s+1],t,r,n,i));o.push(a)}return a.geometry=o,a}function rf(e,t,r,n,i,a){return[Math.round(r*(e*n-i)),Math.round(r*(t*n-a))]}var nf=class{constructor(e){this.options=e,this.total=0,this.stats={},this.tiles={},this.tileCoords=[],this.stats={},this.total=0}initialize(e){this.splitTile(e,0,0,0),this.options.debug&&(e.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}updateIndex(e,t,r){r.debug>1&&(console.log("invalidating tiles"),console.time("invalidating")),this.invalidateTiles(t),r.debug>1&&console.timeEnd("invalidating");let[n,i,a]=[0,0,0],s=Hp(e,n,i,a,r);s.source=e;let o=af(n,i,a);if(this.tiles[o]=s,this.tileCoords.push({z:n,x:i,y:a,id:o}),r.debug){let e=`z${n}`;this.stats[e]=(this.stats[e]||0)+1,this.total++}}getClusterExpansionZoom(e){return null}getChildren(e){return null}getLeaves(e,t,r){return null}getTile(e,t,r){let{extent:n,debug:i}=this.options,a=1<<e,s=af(e,t=t+a&a-1,r);if(this.tiles[s])return Qp(this.tiles[s],n);i>1&&console.log("drilling down to z%d-%d-%d",e,t,r);let o,l=e,u=t,h=r;for(;!o&&l>0;)l--,u>>=1,h>>=1,o=this.tiles[af(l,u,h)];return o?.source&&(i>1&&(console.log("found parent tile z%d-%d-%d",l,u,h),console.time("drilling down")),this.splitTile(o.source,l,u,h,e,t,r),i>1&&console.timeEnd("drilling down"),this.tiles[s])?Qp(this.tiles[s],n):null}splitTile(e,t,r,n,i,a,s){let o=[e,t,r,n],l=this.options,u=l.debug;for(;o.length;){n=o.pop(),r=o.pop(),t=o.pop(),e=o.pop();let h=1<<t,c=af(t,r,n),p=this.tiles[c];if(!p&&(u>1&&console.time("creation"),p=this.tiles[c]=Hp(e,t,r,n,l),this.tileCoords.push({z:t,x:r,y:n,id:c}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,r,n,p.numFeatures,p.numPoints,p.numSimplified),console.timeEnd("creation"));let e=`z${t}`;this.stats[e]=(this.stats[e]||0)+1,this.total++}if(p.source=e,null==i){if(t===l.indexMaxZoom||p.numPoints<=l.indexMaxPoints)continue}else{if(t===l.maxZoom||t===i)continue;if(null!=i){let e=i-t;if(r!==a>>e||n!==s>>e)continue}}if(p.source=null,!e.length)continue;u>1&&console.time("clipping");let f=.5*l.buffer/l.extent,d=.5-f,y=.5+f,m=1+f,g=null,x=null,v=null,b=null,w=gp(e,h,r-f,r+y,0,p.minX,p.maxX,l),D=gp(e,h,r+d,r+m,0,p.minX,p.maxX,l);w&&(g=gp(w,h,n-f,n+y,1,p.minY,p.maxY,l),x=gp(w,h,n+d,n+m,1,p.minY,p.maxY,l)),D&&(v=gp(D,h,n-f,n+y,1,p.minY,p.maxY,l),b=gp(D,h,n+d,n+m,1,p.minY,p.maxY,l)),u>1&&console.timeEnd("clipping"),o.push(g||[],t+1,2*r,2*n),o.push(x||[],t+1,2*r,2*n+1),o.push(v||[],t+1,2*r+1,2*n),o.push(b||[],t+1,2*r+1,2*n+1)}}invalidateTiles(e){if(!e.length)return;let t=this.options,{debug:r}=t,n=1/0,i=-1/0,a=1/0,s=-1/0;for(let t of e)n=Math.min(n,t.minX),i=Math.max(i,t.maxX),a=Math.min(a,t.minY),s=Math.max(s,t.maxY);let o=t.buffer/t.extent,l=new Set;for(let t in this.tiles){let u=this.tiles[t],h=1<<u.z,c=(u.x-o)/h,p=(u.x+1+o)/h,f=(u.y-o)/h,d=(u.y+1+o)/h;if(i<c||n>=p||s<f||a>=d)continue;let y=!1;for(let t of e)if(t.maxX>=c&&t.minX<p&&t.maxY>=f&&t.minY<d){y=!0;break}if(y){if(r){r>1&&console.log("invalidate tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",u.z,u.x,u.y,u.numFeatures,u.numPoints,u.numSimplified);let e=`z${u.z}`;this.stats[e]=(this.stats[e]||0)-1,this.total--}delete this.tiles[t],l.add(t)}}l.size&&(this.tileCoords=this.tileCoords.filter(e=>!l.has(e.id)))}};function af(e,t,r){return 32*((1<<e)*r+t)+e}const sf={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,updateable:!1,cluster:!1,clusterOptions:qp,debug:0};var of=class{constructor(e,t){let r=(t=this.options=Object.assign({},sf,t)).debug;if(r&&console.time("preprocess data"),t.maxZoom<0||t.maxZoom>24)throw Error("maxZoom should be in the 0-24 range");if(t.promoteId&&t.generateId)throw Error("promoteId and generateId cannot be used together.");let n=ap(e,t);r&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",t.indexMaxZoom,t.indexMaxPoints),console.time("generate tiles")),n=Ip(n,t),t.updateable&&(this.source=n),this.initializeIndex(n,t)}initializeIndex(e,t){this.tileIndex=t.cluster?new jp(t.clusterOptions):new nf(t),e.length&&this.tileIndex.initialize(e)}getTile(e,t,r){return t=+t,r=+r,(e=+e)<0||e>24?null:this.tileIndex.getTile(e,t,r)}updateData(e,t){let r=this.options;if(!r.updateable)throw Error("to update tile geojson `updateable` option must be set to true");let{affected:n,source:i}=function(e,t,r){let n=function(e,t){return e?{removeAll:e.removeAll,remove:new Set(e.remove||[]),add:new Map(e.add?.map(e=>[t.promoteId?e.properties[t.promoteId]:e.id,e])),update:new Map(e.update?.map(e=>[e.id,e]))}:{remove:new Set,add:new Map,update:new Map}}(t,r),i=[];if(n.removeAll&&(i=e,e=[]),n.remove.size||n.add.size){let t=[];for(let r of e)(n.remove.has(r.id)||n.add.has(r.id))&&t.push(r);if(t.length){i=i.concat(t);let r=new Set(t.map(e=>e.id));e=e.filter(e=>!r.has(e.id))}if(n.add.size){let t=ap({type:"FeatureCollection",features:Array.from(n.add.values())},r);t=Ip(t,r),i=i.concat(t),e=e.concat(t)}}if(n.update.size){let t=new Map,a=[];for(let r of e)n.update.has(r.id)?t.set(r.id,[...t.get(r.id)||[],r]):a.push(r);for(let[e,s]of n.update){let n=t.get(e);if(!n||0===n.length)continue;let o=Bp(n,s,r);i=i.concat(n,o),a=a.concat(o)}e=a}return{affected:i,source:e}}(this.source,e,r);t&&({affected:n,source:i}=this.filterUpdate(i,n,t)),n.length&&(this.source=i,this.tileIndex.updateIndex(i,n,r))}filterUpdate(e,t,r){let n=new Set;for(let i of e)null!=i.id&&(r(cp(i))||(t.push(i),n.add(i.id)));return{affected:t,source:e=e.filter(e=>!n.has(e.id))}}getData(){if(!this.options.updateable)throw Error("to retrieve data the `updateable` option must be set to true");return function(e){return{type:"FeatureCollection",features:e.map(e=>cp(e))}}(this.source)}updateClusterOptions(e,t){let r=this.options.cluster;this.options.cluster=e,this.options.clusterOptions=t,r!=e?this.initializeIndex(this.source,this.options):this.tileIndex.updateIndex(this.source,[],this.options)}getClusterExpansionZoom(e){return this.tileIndex.getClusterExpansionZoom(e)}getClusterChildren(e){return this.tileIndex.getChildren(e)}getClusterLeaves(e,t,r){return this.tileIndex.getLeaves(e,t,r)}};const lf=uo([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),uf=lf.members;lf.size,lf.alignment;const hf=uo([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),cf=hf.members;hf.size,hf.alignment;const pf=Math.cos(Math.PI/180*37.5);var ff=class{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.id),this.index=e.index,this.hasDependencies=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={};for(let e of this.layers)this.gradients[e.id]={};this.layoutVertexArray=new el,this.layoutVertexArray2=new tl,this.indexArray=new cl,this.programConfigurations=new Yl(e.layers,e.zoom),this.segments=new ml,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(e,t,r){this.hasDependencies=nh("line",this.layers,t)||this.hasLineDasharray(this.layers);let n=this.layers[0].layout.get("line-sort-key"),i=!n.isConstant(),a=[],s=new zs(this.zoom),o=this.layers[0]._featureFilter.needGeometry;for(let{feature:t,id:l,index:u,sourceLayerIndex:h}of e){let e=Ql(t,o);if(!this.layers[0]._featureFilter.filter(s,e,r))continue;let c=i?n.evaluate(e,{},r):void 0,p={id:l,properties:t.properties,type:t.type,sourceLayerIndex:h,index:u,geometry:o?e.geometry:Jl(t),patterns:{},dashes:{},sortKey:c};a.push(p)}i&&a.sort((e,t)=>e.sortKey-t.sortKey);for(let n of a){let{geometry:i,index:a,sourceLayerIndex:s}=n;this.hasDependencies?(nh("line",this.layers,t)?ih("line",this.layers,n,{zoom:this.zoom},t):this.hasLineDasharray(this.layers)&&this.addLineDashDependencies(this.layers,n,this.zoom,t),this.patternFeatures.push(n)):this.addFeature(n,i,a,r,{},{},t.subdivisionGranularity);let o=e[a].feature;t.featureIndex.insert(o,i,a,s,this.index)}}update(e,t,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,{imagePositions:r,dashPositions:n})}addFeatures({options:e,canonical:t,patternPositions:r,dashPositions:n}){for(let i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,t,r,n,e.subdivisionGranularity)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,cf)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,uf),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[Zp],end:+e.properties[Wp]}}addFeature(e,t,r,n,i,a,s){let o=this.layers[0].layout,l=o.get("line-join").evaluate(e,{}),u=o.get("line-cap").evaluate(e,{}),h=o.get("line-miter-limit").evaluate(e,{}),c=o.get("line-round-limit").evaluate(e,{});this.lineClips=this.lineFeatureClips(e);for(let r of t)this.addLine(r,e,l,u,h,c,n,s);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,{imagePositions:i,dashPositions:a,canonical:n})}addLine(e,t,r,n,i,a,s,o){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,e=Hh(e,s?o.line.getGranularityForZoomLevel(s.z):1),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let t=0;t<e.length-1;t++)this.totalDistance+=e[t].dist(e[t+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let l="Polygon"===fc.types[t.type],u=e.length;for(;u>=2&&e[u-1].equals(e[u-2]);)u--;let h=0;for(;h<u-1&&e[h].equals(e[h+1]);)h++;if(u-h<(l?3:2))return;"bevel"===r&&(i=1.05);let c,p,f,d,y,m=this.overscaling<=16?15*de/(512*this.overscaling):0,g=this.segments.prepareSegment(10*u,this.layoutVertexArray,this.indexArray);this.e1=this.e2=-1,l&&(c=e[u-2],y=e[h].sub(c)._unit()._perp());for(let t=h;t<u;t++){if(f=t===u-1?l?e[h+1]:void 0:e[t+1],f&&e[t].equals(f))continue;y&&(d=y),c&&(p=c),c=e[t],y=f?f.sub(c)._unit()._perp():d,d||=y;let s=d.add(y);(0!==s.x||0!==s.y)&&s._unit();let o=d.x*y.x+d.y*y.y,x=s.x*y.x+s.y*y.y,v=0===x?1/0:1/x,b=2*Math.sqrt(2-2*x),w=x<pf&&p&&f,D=d.x*y.y-d.y*y.x>0;if(w&&t>h){let e=c.dist(p);if(e>2*m){let t=c.sub(c.sub(p)._mult(m/e)._round());this.updateDistance(p,t),this.addCurrentVertex(t,d,0,0,g),p=t}}let _=p&&f,A=_?r:l?"butt":n;if(_&&"round"===A&&(v<a?A="miter":v<=2&&(A="fakeround")),"miter"===A&&v>i&&(A="bevel"),"bevel"===A&&(v>2&&(A="flipbevel"),v<i&&(A="miter")),p&&this.updateDistance(p,c),"miter"===A)s._mult(v),this.addCurrentVertex(c,s,0,0,g);else if("flipbevel"===A){if(v>100)s=y.mult(-1);else{let e=v*d.add(y).mag()/d.sub(y).mag();s._perp()._mult(e*(D?-1:1))}this.addCurrentVertex(c,s,0,0,g),this.addCurrentVertex(c,s.mult(-1),0,0,g)}else if("bevel"===A||"fakeround"===A){let e=-Math.sqrt(v*v-1),t=D?e:0,r=D?0:e;if(p&&this.addCurrentVertex(c,d,t,r,g),"fakeround"===A){let e=Math.round(180*b/Math.PI/20);for(let t=1;t<e;t++){let r=t/e;if(.5!==r){let e=r-.5;r+=r*e*(r-1)*((1.0904+o*(o*(3.55645-1.43519*o)-3.2452))*e*e+(.848013+o*(.215638*o-1.06021)))}let n=y.sub(d)._mult(r)._add(d)._unit()._mult(D?-1:1);this.addHalfVertex(c,n.x,n.y,!1,D,0,g)}}f&&this.addCurrentVertex(c,y,-t,-r,g)}else if("butt"===A)this.addCurrentVertex(c,s,0,0,g);else if("square"===A){let e=p?1:-1;this.addCurrentVertex(c,s,e,e,g)}else"round"===A&&(p&&(this.addCurrentVertex(c,d,0,0,g),this.addCurrentVertex(c,d,1,1,g,!0)),f&&(this.addCurrentVertex(c,y,-1,-1,g,!0),this.addCurrentVertex(c,y,0,0,g)));if(w&&t<u-1){let e=c.dist(f);if(e>2*m){let t=c.add(f.sub(c)._mult(m/e)._round());this.updateDistance(c,t),this.addCurrentVertex(t,y,0,0,g),c=t}}}}addCurrentVertex(e,t,r,n,i,a=!1){let s=t.x+t.y*r,o=t.y-t.x*r,l=-t.x+t.y*n,u=-t.y-t.x*n;this.addHalfVertex(e,s,o,a,!1,r,i),this.addHalfVertex(e,l,u,a,!0,-n,i),this.distance>16384&&0===this.totalDistance&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,t,r,n,i,a))}addHalfVertex({x:e,y:t},r,n,i,a,s,o){let l=.5*(this.lineClips?32767*this.scaledDistance:this.scaledDistance);if(this.layoutVertexArray.emplaceBack(+!!i+(e<<1),+!!a+(t<<1),Math.round(63*r)+128,Math.round(63*n)+128,1+(0===s?0:s<0?-1:1)|(63&l)<<2,l>>6),this.lineClips){let e=(this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start);this.layoutVertexArray2.emplaceBack(e,this.lineClipsArray.length)}let u=o.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,u,this.e2),o.primitiveLength++),a?this.e2=u:this.e1=u}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,t){this.distance+=e.dist(t),this.updateScaledDistance()}hasLineDasharray(e){for(let t of e){let e=t.paint.get("line-dasharray");if(e&&!e.isConstant())return!0}return!1}addLineDashDependencies(e,t,r,n){for(let i of e){let e=i.paint.get("line-dasharray");if(!e||"constant"===e.value.kind)continue;let a="round"===i.layout.get("line-cap").evaluate(t,{}),s={dasharray:e.value.evaluate({zoom:r-1},t,{}),round:a},o={dasharray:e.value.evaluate({zoom:r},t,{}),round:a},l={dasharray:e.value.evaluate({zoom:r+1},t,{}),round:a},u=`${s.dasharray.join(",")},${s.round}`,h=`${o.dasharray.join(",")},${o.round}`,c=`${l.dasharray.join(",")},${l.round}`;n.dashDependencies[u]=s,n.dashDependencies[h]=o,n.dashDependencies[c]=l,t.dashes[i.id]={min:u,mid:h,max:c}}}};let df,yf;ks("LineBucket",ff,{omit:["layers","patternFeatures"]});var mf={get paint(){return yf||=new Js({"line-opacity":new Zs(Zt.paint_line["line-opacity"],"line-opacity"),"line-layer-opacity":new Ys(Zt.paint_line["line-layer-opacity"],"line-layer-opacity"),"line-color":new Zs(Zt.paint_line["line-color"],"line-color"),"line-translate":new Ys(Zt.paint_line["line-translate"],"line-translate"),"line-translate-anchor":new Ys(Zt.paint_line["line-translate-anchor"],"line-translate-anchor"),"line-width":new Zs(Zt.paint_line["line-width"],"line-width"),"line-gap-width":new Zs(Zt.paint_line["line-gap-width"],"line-gap-width"),"line-offset":new Zs(Zt.paint_line["line-offset"],"line-offset"),"line-blur":new Zs(Zt.paint_line["line-blur"],"line-blur"),"line-dasharray":new Ws(Zt.paint_line["line-dasharray"],"line-dasharray"),"line-pattern":new Ws(Zt.paint_line["line-pattern"],"line-pattern"),"line-gradient":new Ks(Zt.paint_line["line-gradient"],"line-gradient")})},get layout(){return df||=new Js({"line-cap":new Zs(Zt.layout_line["line-cap"],"line-cap"),"line-join":new Zs(Zt.layout_line["line-join"],"line-join"),"line-miter-limit":new Zs(Zt.layout_line["line-miter-limit"],"line-miter-limit"),"line-round-limit":new Zs(Zt.layout_line["line-round-limit"],"line-round-limit"),"line-sort-key":new Zs(Zt.layout_line["line-sort-key"],"line-sort-key")})}},gf=class extends Zs{possiblyEvaluate(e,t){return t=new zs(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,zoomHistory:t.zoomHistory,transition:t.transition}),super.possiblyEvaluate(e,t)}evaluate(e,t,r,n){return t=Re({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(e,t,r,n)}};let xf;const vf=e=>"line"===e.type;var bf=class extends to{constructor(e,t){super(e,mf,t),this.gradientVersion=0,xf||(xf=new gf(mf.paint.properties["line-width"].specification,"line-floorwidth"),xf.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if("line-gradient"===e){let e=this.gradientExpression();this.stepInterpolant=!!function(e){return void 0!==e._styleExpression}(e)&&e._styleExpression.expression instanceof hn,this.gradientVersion=(this.gradientVersion+1)%(2**53-1)}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,t){super.recalculate(e,t),this.paint._values["line-floorwidth"]=xf.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new ff(e)}queryRadius(e){let t=e,r=wf(yu("line-width",this,t),yu("line-gap-width",this,t)),n=yu("line-offset",this,t);return r/2+Math.abs(n)+mu(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:r,geometry:n,transform:i,pixelsToTileUnits:a}){let s=gu(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-i.bearingInRadians,a),o=a/2*wf(this.paint.get("line-width").evaluate(t,r),this.paint.get("line-gap-width").evaluate(t,r)),u=this.paint.get("line-offset").evaluate(t,r);return u&&(n=function(e,t){let r=[];for(let n of e){let e=xu(n),i=[];for(let r=0;r<e.length;r++){let n=e[r],a=e[r-1],s=e[r+1],o=0===r?new l(0,0):n.sub(a)._unit()._perp(),u=r===e.length-1?new l(0,0):s.sub(n)._unit()._perp(),h=o._add(u)._unit(),c=h.x*u.x+h.y*u.y;0!==c&&h._mult(1/c),i.push(h._mult(t)._add(n))}r.push(i)}return r}(n,u*a)),function(e,t,r){for(let n of t){if(e.length>=3)for(let t of n)if(pu(e,t))return!0;if(su(e,n,r))return!0}return!1}(s,n,o)}isTileClipped(){return!0}};function wf(e,t){return t>0?t+2*e:e}const Df=uo([{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),_f=uo([{name:"a_projected_pos",components:3,type:"Float32"}],4);uo([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Af=uo([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);uo([{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"}]);const Ef=uo([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Sf=uo([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);uo([{name:"triangle",components:3,type:"Uint16"}]),uo([{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"}]),uo([{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"}]),uo([{type:"Float32",name:"offsetX"}]),uo([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),uo([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Ff=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(e){this.pluginStatus=e.pluginStatus,this.pluginURL=e.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(e){if(Ff.isParsed())throw Error("RTL text plugin already registered.");this.applyArabicShaping=e.applyArabicShaping,this.processBidirectionalText=e.processBidirectionalText,this.processStyledBidirectionalText=e.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return null!=this.applyArabicShaping&&null!=this.processBidirectionalText&&null!=this.processStyledBidirectionalText}getRTLTextPluginStatus(){return this.pluginStatus}async syncState(e,t){if(this.isParsed())return this.getState();if("loading"!==e.pluginStatus)return this.setState(e),e;let r=e.pluginURL,n=new Promise(e=>{this.loadScriptResolve=e}),i=new Promise(e=>setTimeout(()=>e(),this.TIMEOUT));if(await t(r),await Promise.race([n,i]),this.isParsed()){let e={pluginStatus:"loaded",pluginURL:r};return this.setState(e),e}throw this.setState({pluginStatus:"error",pluginURL:""}),Error(`RTL Text Plugin failed to import scripts from ${r}`)}};function kf(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 If(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 Tf(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 Mf(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 Cf(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)}const Bf={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"},Pf={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]},zf={لآ:[65269,65270],لأ:[65271,65272],لإ:[65273,65274],لا:[65275,65276]},Vf=/[\u0600-\u06ff\u0750-\u077f\u0870-\u089f\u08a0-\u08ff\ufb50-\ufdff\ufe70-\ufeff]/;function Lf(e,t,r){let n=0;for(let i of e.split(";")){let[e,a]=i.split(",").map(e=>parseInt(e,36)),s=n+e;for(let e=s;e<s+a;e++)r.set(e,t);n=s+a}}const Of=new Map;for(let[e,t]of Object.entries(Bf))Lf(t,e,Of);function Rf(e){return Of.get(e)??"U"}function $f(e){return"D"===e||"L"===e||"C"===e}function Nf(e){return"D"===e||"R"===e||"C"===e}function Uf(e,t,r){return"D"===e?t&&r?3:t?1:r?2:0:"R"===e?+!!t:"L"===e?r?2:0:null}function qf(e){if(!Vf.test(e))return e;let t=function(e){return[...e].map(e=>{let t=e.codePointAt(0);return{codePoint:t,type:Rf(t),form:null}})}(e);return function(e){let t=e.filter(e=>"T"!==e.type);for(let e=0;e<t.length;e++){let r=t[e],n=e>0&&$f(t[e-1].type),i=e+1<t.length&&Nf(t[e+1].type);r.form=Uf(r.type,n,i)}}(t),function(e){let t=!1;for(let r of e)"T"===r.type?r.form=t?3:0:t=2===r.form||3===r.form}(t),function(e){let t=[];for(let r=0;r<e.length;r++){let n=e[r];if(1604!==n.codePoint){t.push(n);continue}let i=r+1;for(;i<e.length&&"T"===e[i].type;)i++;let a=e[i],s=a&&zf[String.fromCodePoint(1604,a.codePoint)];if(!s){t.push(n);continue}let o=3===n.form||1===n.form;t.push({codePoint:s[+!!o],type:"R",form:0}),t.push(...e.slice(r+1,i)),r=i}return t}(t).map(e=>String.fromCodePoint(function(e){if(null===e.form)return e.codePoint;let t=Pf[e.codePoint];return t&&(t[e.form]||t[0])||e.codePoint}(e))).join("")}function jf(e,t,r){let n=t.layout.get("text-transform").evaluate(r,{});return"uppercase"===n?e=e.toLocaleUpperCase():"lowercase"===n&&(e=e.toLocaleLowerCase()),(Ff.applyArabicShaping??qf)(e)}function Gf(e,t,r){for(let n of e.sections)n.text=jf(n.text,t,r);return e}const Xf=typeof Intl<"u"&&"Segmenter"in Intl;let Yf,Zf;function Wf(e){if(!Xf||!function(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)}(e))return[...e];Yf??=new Intl.Segmenter(void 0,{granularity:"grapheme"});let t=[];for(let{segment:r}of Yf.segment(e)){let e=t.length-1;e>=0&&Cf(t[e],r)?t[e]+=r:t.push(r)}return t}function Hf(e){let t=new Set;if(Xf){Zf??=new Intl.Segmenter(void 0,{granularity:"word"});for(let{index:r}of Zf.segment(e))t.add(r);return t}let r=0;for(let n of e.split(/\b|(?=\p{Ideo})/u))t.add(r),r+=n.length;return t}function Kf(e){let t=e.codePointAt(0);return e.length>(t>65535?2:1)}function Jf(e){return/\s/u.test(String.fromCodePoint(e))}function Qf(e){for(let t of e)if(Tf(t.codePointAt(0)))return!0;return!1}function ed(e){for(let t of e)if(!td(t.codePointAt(0)))return!1;return!0}function td(e){return!function(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))}(e)}function rd(e){return!(Tf(e)||function(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))}(e))}function nd(e){return/\p{sc=Arab}/u.test(String.fromCodePoint(e))}function id(e){return function(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))}(e)}function ad(e){for(let t of e)if(id(t.codePointAt(0)))return!0;return!1}const sd={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","⋯":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"},od={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},ld={40:!0};function ud(e,t,r,n,i,a){if("fontStack"in t){let n=r[t.fontStack],a=n?.[e];if(a)return a.metrics.advance*t.scale+i;let s=0;for(let r of e){let e=n?.[r];e&&(s+=e.metrics.advance*t.scale+i)}return s}{let e=n[t.imageName];return e?e.displaySize[0]*t.scale*24/a+i:0}}function hd(e,t,r,n){let i=(e-t)**2;return n?e<t?i/2:2*i:i+Math.abs(r)*r}function cd(e){return/^\s+$/u.test(e)}function pd(e,t,r){let n=0;return(10===e||13===e)&&(n-=1e4),r&&(n+=150),(40===e||65288===e)&&(n+=50),(41===t||65289===t)&&(n+=50),n}function fd(e,t,r,n,i,a){let s=null,o=hd(t,r,i,a);for(let e of n){let n=hd(t-e.x,r,i,a)+e.badness;n<=o&&(s=e,o=n)}return{index:e,x:t,priorBreak:s,badness:o}}function dd(e){return e?dd(e.priorBreak).concat(e.index):[]}var yd=class e{constructor(e="",t=[],r=[]){this.text=e,this.sections=t,this.sectionIndex=r,this.imageSectionID=null,this._graphemes=null}graphemes(){return this._graphemes??=Wf(this.text),this._graphemes}static fromFeature(t,r){let n=new e;for(let e of t.sections)e.image?n.addImageSection(e):n.addTextSection(e,r);return n}length(){return this.graphemes().length}getSection(e){return this.sections[this.sectionIndex[e]]}getSectionIndex(e){return this.sectionIndex[e]}verticalizePunctuation(){this.text=function(e){let t="",r={premature:!0,value:void 0},n=e[Symbol.iterator](),i=n.next(),a=e[Symbol.iterator]();a.next();let s=a.next();for(;!i.done;)!s.done&&rd(s.value.codePointAt(0))&&!sd[s.value]||!r.premature&&rd(r.value.codePointAt(0))&&!sd[r.value]||!sd[i.value]?t+=i.value:t+=sd[i.value],r={value:i.value,premature:!1},i=n.next(),s=a.next();return t}(this.text),this._graphemes=null}hasZeroWidthSpaces(){return this.text.includes("​")}trim(){let e=this.graphemes(),t=0;for(;t<e.length&&cd(e[t]);)t++;let r=e.length;for(;r>t&&cd(e[r-1]);)r--;this.text=e.slice(t,r).join(""),this.sectionIndex=this.sectionIndex.slice(t,r),this._graphemes=null}substring(t,r){let n=this.graphemes().slice(t,r).join(""),i=this.sectionIndex.slice(t,r);return new e(n,this.sections,i)}toCodeUnitIndex(e){return this.graphemes().slice(0,e).join("").length}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,t)=>Math.max(e,this.sections[t].scale),0)}getMaxImageSize(e){let t=0,r=0;for(let n=0;n<this.length();n++){let i=this.getSection(n);if("imageName"in i){let n=e[i.imageName];if(!n)continue;let a=n.displaySize;t=Math.max(t,a[0]),r=Math.max(r,a[1])}}return{maxImageWidth:t,maxImageHeight:r}}_appendSection(e,t){let r=this.graphemes(),n=r.length>0?r[r.length-1]:"",i=Wf(n+e);this.text+=e,this._graphemes=r.slice(0,n?-1:void 0).concat(i);let a=i.length-+!!n;for(let e=0;e<a;e++)this.sectionIndex.push(t)}addTextSection(e,t){this.sections.push({scale:e.scale||1,verticalAlign:e.verticalAlign||"bottom",fontStack:e.fontStack||t}),this._appendSection(e.text,this.sections.length-1)}addImageSection(e){let t=e.image?e.image.name:"";if(0===t.length)return void Je("Can't add FormattedSection with an empty image.");let r=this.getNextImageSectionCharCode();r?(this.sections.push({scale:1,verticalAlign:e.verticalAlign||"bottom",imageName:t}),this._appendSection(String.fromCharCode(r),this.sections.length-1)):Je("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}determineLineBreaks(e,t,r,n,i){let a=[],s=this.determineAverageLineWidth(e,t,r,n,i),o=this.hasZeroWidthSpaces(),l=this.graphemes(),u=null,h=0,c=0;for(let t=0;t<l.length;t++){let p=l[t];if(t>0){let e=l[t-1].codePointAt(0),r=p.codePointAt(0),n=If(e),i=Mf(e)&&Mf(r);(od[e]||n||"imageName"in this.getSection(t-1)||void 0!==l[t+1]&&ld[r]||i&&(u??=Hf(this.text)).has(c))&&a.push(fd(t,h,s,a,pd(e,r,n&&o),!1))}Jf(p.codePointAt(0))||(h+=ud(p,this.getSection(t),r,n,e,i)),c+=p.length}return dd(fd(this.length(),h,s,a,0,!0))}determineAverageLineWidth(e,t,r,n,i){let a=0,s=0;for(let t of this.graphemes())a+=ud(t,this.getSection(s),r,n,e,i),s++;return a/Math.max(1,Math.ceil(a/t))}};const md=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"},r={},n={};r.L=1,n[1]="L",Object.keys(t).forEach(function(e,t){r[e]=1<<t+1,n[r[e]]=e}),Object.freeze(r);var i=r.LRI|r.RLI|r.FSI,a=r.L|r.R|r.AL,s=r.B|r.S|r.WS|r.ON|r.FSI|r.LRI|r.RLI|r.PDI,o=r.BN|r.RLE|r.LRE|r.RLO|r.LRO|r.PDF,l=r.S|r.WS|r.B|i|r.PDI|o,u=null;function h(e){return function(){if(!u){u=new Map;var e=0;for(var n in t)if(t.hasOwnProperty(n))for(var i=t[n],a="",s=void 0,o=!1,l=0,h=0;h<=i.length+1;h+=1){var c=i[h];if(","!==c&&h!==i.length)"+"===c?(o=!0,l=e=l+parseInt(a,36),a=""):a+=c;else{o?s=e+parseInt(a,36):(l=e=l+parseInt(a,36),s=e),o=!1,a="",l=s;for(var p=e;p<s+1;p+=1)u.set(p,r[n])}}}}(),u.get(e.codePointAt(0))||r.L}var c,p,f,d="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",y="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 m(e,t){var r,n=0,i=new Map,a=t&&new Map;return e.split(",").forEach(function e(s){if(-1!==s.indexOf("+"))for(var o=+s;o--;)e(r);else{r=s;var l=s.split(">"),u=l[0],h=l[1];u=String.fromCodePoint(n+=parseInt(u,36)),h=String.fromCodePoint(n+=parseInt(h,36)),i.set(u,h),t&&a.set(h,u)}}),{map:i,reverseMap:a}}function g(){if(!c){var e=m(d,!0),t=e.map,r=e.reverseMap;c=t,p=r,f=m(y,!1).map}}function x(e){return g(),c.get(e)||null}function v(e){return g(),p.get(e)||null}function b(e){return g(),f.get(e)||null}var w,D=r.L,_=r.R,A=r.EN,E=r.ES,S=r.ET,F=r.AN,k=r.CS,I=r.B,T=r.S,M=r.ON,C=r.BN,B=r.NSM,P=r.AL,z=r.LRO,V=r.RLO,L=r.LRE,O=r.RLE,R=r.PDF,$=r.LRI,N=r.RLI,U=r.FSI,q=r.PDI;function j(e){return function(){if(!w){var e=m("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",!0),t=e.map;e.reverseMap.forEach(function(e,r){t.set(r,e)}),w=t}}(),w.get(e)||null}function G(e,t,r,n){var i=e.length;r=Math.max(0,null==r?0:+r),n=Math.min(i-1,null==n?i-1:+n);var a=[];return t.paragraphs.forEach(function(i){var s=Math.max(r,i.start),o=Math.min(n,i.end);if(s<o){for(var u=t.levels.slice(s,o+1),c=o;c>=s&&h(e[c])&l;c--)u[c]=i.level;for(var p=i.level,f=1/0,d=0;d<u.length;d++){var y=u[d];y>p&&(p=y),y<f&&(f=1|y)}for(var m=p;m>=f;m--)for(var g=0;g<u.length;g++)if(u[g]>=m){for(var x=g;g+1<u.length&&u[g+1]>=m;)g++;g>x&&a.push([x+s,g+s])}}}),a}function X(e,t,r,n){for(var i=G(e,t,r,n),a=[],s=0;s<e.length;s++)a[s]=s;return i.forEach(function(e){for(var t=e[0],r=e[1],n=a.slice(t,r+1),i=n.length;i--;)a[r-i]=n[i]}),a}return e.closingToOpeningBracket=v,e.getBidiCharType=h,e.getBidiCharTypeName=function(e){return n[h(e)]},e.getCanonicalBracket=b,e.getEmbeddingLevels=function(e,t){for(var r=new Uint32Array(e.length),n=0;n<e.length;n++)r[n]=h(e[n]);var u=new Map;function c(e,t){var n=r[e];r[e]=t,u.set(n,u.get(n)-1),n&s&&u.set(s,u.get(s)-1),u.set(t,(u.get(t)||0)+1),t&s&&u.set(s,(u.get(s)||0)+1)}for(var p=new Uint8Array(e.length),f=new Map,d=[],y=null,m=0;m<e.length;m++)y||d.push(y={start:m,end:e.length-1,level:"rtl"===t?1:"ltr"===t?0:$t(m,!1)}),r[m]&I&&(y.end=m,y=null);for(var g=O|L|V|z|i|q|R|I,w=function(e){return e+(1&e?1:2)},j=function(e){return e+(1&e?2:1)},G=0;G<d.length;G++){var X=[{_level:(y=d[G]).level,_override:0,_isolate:0}],Y=void 0,Z=0,W=0,H=0;u.clear();for(var K=y.start;K<=y.end;K++){var J=r[K];if(Y=X[X.length-1],u.set(J,(u.get(J)||0)+1),J&s&&u.set(s,(u.get(s)||0)+1),J&g)if(J&(O|L)){p[K]=Y._level;var Q=(J===O?j:w)(Y._level);Q<=125&&!Z&&!W?X.push({_level:Q,_override:0,_isolate:0}):Z||W++}else if(J&(V|z)){p[K]=Y._level;var ee=(J===V?j:w)(Y._level);ee<=125&&!Z&&!W?X.push({_level:ee,_override:J&V?_:D,_isolate:0}):Z||W++}else if(J&i){J&U&&(J=1===$t(K+1,!0)?N:$),p[K]=Y._level,Y._override&&c(K,Y._override);var te=(J===N?j:w)(Y._level);te<=125&&0===Z&&0===W?(H++,X.push({_level:te,_override:0,_isolate:1,_isolInitIndex:K})):Z++}else if(J&q){if(Z>0)Z--;else if(H>0){for(W=0;!X[X.length-1]._isolate;)X.pop();var re=X[X.length-1]._isolInitIndex;null!=re&&(f.set(re,K),f.set(K,re)),X.pop(),H--}Y=X[X.length-1],p[K]=Y._level,Y._override&&c(K,Y._override)}else J&R?(0===Z&&(W>0?W--:!Y._isolate&&X.length>1&&(X.pop(),Y=X[X.length-1])),p[K]=Y._level):J&I&&(p[K]=y.level);else p[K]=Y._level,Y._override&&J!==C&&c(K,Y._override)}for(var ne=[],ie=null,ae=y.start;ae<=y.end;ae++){var se=r[ae];if(!(se&o)){var oe=p[ae],le=se&i,ue=se===q;ie&&oe===ie._level?(ie._end=ae,ie._endsWithIsolInit=le):ne.push(ie={_start:ae,_end:ae,_level:oe,_startsWithPDI:ue,_endsWithIsolInit:le})}}for(var he=[],ce=0;ce<ne.length;ce++){var pe=ne[ce];if(!pe._startsWithPDI||pe._startsWithPDI&&!f.has(pe._start)){for(var fe=[ie=pe],de=void 0;ie&&ie._endsWithIsolInit&&null!=(de=f.get(ie._end));)for(var ye=ce+1;ye<ne.length;ye++)if(ne[ye]._start===de){fe.push(ie=ne[ye]);break}for(var me=[],ge=0;ge<fe.length;ge++)for(var xe=fe[ge],ve=xe._start;ve<=xe._end;ve++)me.push(ve);for(var be=p[me[0]],we=y.level,De=me[0]-1;De>=0;De--)if(!(r[De]&o)){we=p[De];break}var _e=me[me.length-1],Ae=p[_e],Ee=y.level;if(!(r[_e]&i))for(var Se=_e+1;Se<=y.end;Se++)if(!(r[Se]&o)){Ee=p[Se];break}he.push({_seqIndices:me,_sosType:Math.max(we,be)%2?_:D,_eosType:Math.max(Ee,Ae)%2?_:D})}}for(var Fe=0;Fe<he.length;Fe++){var ke=he[Fe],Ie=ke._seqIndices,Te=ke._sosType,Me=ke._eosType,Ce=1&p[Ie[0]]?_:D;if(u.get(B))for(var Be=0;Be<Ie.length;Be++){var Pe=Ie[Be];if(r[Pe]&B){for(var ze=Te,Ve=Be-1;Ve>=0;Ve--)if(!(r[Ie[Ve]]&o)){ze=r[Ie[Ve]];break}c(Pe,ze&(i|q)?M:ze)}}if(u.get(A))for(var Le=0;Le<Ie.length;Le++){var Oe=Ie[Le];if(r[Oe]&A)for(var Re=Le-1;Re>=-1;Re--){var $e=-1===Re?Te:r[Ie[Re]];if($e&a){$e===P&&c(Oe,F);break}}}if(u.get(P))for(var Ne=0;Ne<Ie.length;Ne++){var Ue=Ie[Ne];r[Ue]&P&&c(Ue,_)}if(u.get(E)||u.get(k))for(var qe=1;qe<Ie.length-1;qe++){var je=Ie[qe];if(r[je]&(E|k)){for(var Ge=0,Xe=0,Ye=qe-1;Ye>=0&&(Ge=r[Ie[Ye]])&o;Ye--);for(var Ze=qe+1;Ze<Ie.length&&(Xe=r[Ie[Ze]])&o;Ze++);Ge===Xe&&(r[je]===E?Ge===A:Ge&(A|F))&&c(je,Ge)}}if(u.get(A))for(var We=0;We<Ie.length;We++)if(r[Ie[We]]&A){for(var He=We-1;He>=0&&r[Ie[He]]&(S|o);He--)c(Ie[He],A);for(We++;We<Ie.length&&r[Ie[We]]&(S|o|A);We++)r[Ie[We]]!==A&&c(Ie[We],A)}if(u.get(S)||u.get(E)||u.get(k))for(var Ke=0;Ke<Ie.length;Ke++){var Je=Ie[Ke];if(r[Je]&(S|E|k)){c(Je,M);for(var Qe=Ke-1;Qe>=0&&r[Ie[Qe]]&o;Qe--)c(Ie[Qe],M);for(var et=Ke+1;et<Ie.length&&r[Ie[et]]&o;et++)c(Ie[et],M)}}if(u.get(A))for(var tt=0,rt=Te;tt<Ie.length;tt++){var nt=Ie[tt],it=r[nt];it&A?rt===D&&c(nt,D):it&a&&(rt=it)}if(u.get(s)){for(var at=_|A|F,st=at|D,ot=[],lt=[],ut=0;ut<Ie.length;ut++)if(r[Ie[ut]]&s){var ht=e[Ie[ut]],ct=void 0;if(null!==x(ht)){if(!(lt.length<63))break;lt.push({char:ht,seqIndex:ut})}else if(null!==(ct=v(ht)))for(var pt=lt.length-1;pt>=0;pt--){var ft=lt[pt].char;if(ft===ct||ft===v(b(ht))||x(b(ft))===ht){ot.push([lt[pt].seqIndex,ut]),lt.length=pt;break}}}ot.sort(function(e,t){return e[0]-t[0]});for(var dt=0;dt<ot.length;dt++){for(var yt=ot[dt],mt=yt[0],gt=yt[1],xt=!1,vt=0,bt=mt+1;bt<gt;bt++){var wt=Ie[bt];if(r[wt]&st){xt=!0;var Dt=r[wt]&at?_:D;if(Dt===Ce){vt=Dt;break}}}if(xt&&!vt){vt=Te;for(var _t=mt-1;_t>=0;_t--){var At=Ie[_t];if(r[At]&st){var Et=r[At]&at?_:D;vt=Et===Ce?Ce:Et;break}}}if(vt){if(r[Ie[mt]]=r[Ie[gt]]=vt,vt!==Ce)for(var St=mt+1;St<Ie.length;St++)if(!(r[Ie[St]]&o)){h(e[Ie[St]])&B&&(r[Ie[St]]=vt);break}if(vt!==Ce)for(var Ft=gt+1;Ft<Ie.length;Ft++)if(!(r[Ie[Ft]]&o)){h(e[Ie[Ft]])&B&&(r[Ie[Ft]]=vt);break}}}for(var kt=0;kt<Ie.length;kt++)if(r[Ie[kt]]&s){for(var It=kt,Tt=kt,Mt=Te,Ct=kt-1;Ct>=0;Ct--){if(!(r[Ie[Ct]]&o)){Mt=r[Ie[Ct]]&at?_:D;break}It=Ct}for(var Bt=Me,Pt=kt+1;Pt<Ie.length;Pt++){if(!(r[Ie[Pt]]&(s|o))){Bt=r[Ie[Pt]]&at?_:D;break}Tt=Pt}for(var zt=It;zt<=Tt;zt++)r[Ie[zt]]=Mt===Bt?Mt:Ce;kt=Tt}}}for(var Vt=y.start;Vt<=y.end;Vt++){var Lt=p[Vt],Ot=r[Vt];if(1&Lt?Ot&(D|A|F)&&p[Vt]++:Ot&_?p[Vt]++:Ot&(F|A)&&(p[Vt]+=2),Ot&o&&(p[Vt]=0===Vt?y.level:p[Vt-1]),Vt===y.end||h(e[Vt])&(T|I))for(var Rt=Vt;Rt>=0&&h(e[Rt])&l;Rt--)p[Rt]=y.level}}return{levels:p,paragraphs:d};function $t(t,n){for(var a=t;a<e.length;a++){var s=r[a];if(s&(_|P))return 1;if(s&(I|D)||n&&s===q)return 0;if(s&i){var o=Nt(a);a=-1===o?e.length:o}}return 0}function Nt(t){for(var n=1,a=t+1;a<e.length;a++){var s=r[a];if(s&I)break;if(s&q){if(0===--n)return a}else s&i&&n++}return-1}},e.getMirroredCharacter=j,e.getMirroredCharactersMap=function(e,t,r,n){var i=e.length;r=Math.max(0,null==r?0:+r),n=Math.min(i-1,null==n?i-1:+n);for(var a=new Map,s=r;s<=n;s++)if(1&t[s]){var o=j(e[s]);null!==o&&a.set(s,o)}return a},e.getReorderSegments=G,e.getReorderedIndices=X,e.getReorderedString=function(e,t,r,n){var i=X(e,t,r,n),a=[].concat(e);return i.forEach(function(r,n){a[n]=(1&t.levels[r]?j(e[r]):null)||e[r]}),a.join("")},e.openingToClosingBracket=x,Object.defineProperty(e,"__esModule",{value:!0}),e}({}),gd=/[\u061c\u200e\u200f\u202a-\u202e\u2066-\u2069]/,xd=new Set(["WS","FSI","LRI","RLI","PDI"]),vd=new Set(["S","B"]);function bd(e){return e.level%2==0?e.text:md.getMirroredCharacter(e.text)??e.text}function wd(e,t){let{levels:r,paragraphs:n}=md.getEmbeddingLevels(e);return function(e,t){let r=t.filter(t=>t>0&&t<e.length),n=[...new Set([0,...r,e.length])].sort((e,t)=>e-t),i=[];for(let e=0;e+1<n.length;e++)i.push([n[e],n[e+1]]);return i}(e,t.concat(n.map(e=>e.start))).map(([t,i])=>function(e,t,r,n,i){let a=function(e,t,r,n){let i=[],a=r;for(let s of Wf(e.slice(r,n)))i.push({index:a,text:s,level:t[a]}),a+=s.length;return i}(e,t,n,i);!function(e,t){let r=!0;for(let n=e.length-1;n>=0;n--){let i=md.getBidiCharTypeName(e[n].text[0]);vd.has(i)?(e[n].level=t,r=!0):r&&xd.has(i)?e[n].level=t:r=!1}}(a,r);let s="",o=[];for(let e of function(e,t){let r=t,n=1/0;for(let{level:t}of e)t>r&&(r=t),(1|t)<n&&(n=1|t);let i=e.slice();for(let e=r;e>=n;e--)for(let t=0;t<i.length;t++){if(i[t].level<e)continue;let r=t;for(;r+1<i.length&&i[r+1].level>=e;)r++;for(let e=t,n=r;e<n;e++,n--)[i[e],i[n]]=[i[n],i[e]];t=r}return i}(a,r)){if(gd.test(e.text))continue;let t=bd(e);s+=t,o.push(...Array(t.length).fill(e.index))}return{text:s,sourceIndices:o}}(e,r,function(e,t){return e.find(e=>t>=e.start&&t<=e.end)?.level??0}(n,t),t,i))}const Dd=4294967296,_d=1/Dd,Ad=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");var Ed=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,r=this.length){let n;for(;n=this.nextField(r);)e(n,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)*Dd;return this.pos+=8,e}readSFixed64(){let e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*Dd;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,r=t[this.pos++];if(r<128)return r;let n,i=127&r;return n=t[this.pos++],i|=(127&n)<<7,n<128||(n=t[this.pos++],i|=(127&n)<<14,n<128)||(n=t[this.pos++],i|=(127&n)<<21,n<128)?i:(n=t[this.pos],i|=(15&n)<<28,function(e,t,r){let n,i,a=r.buf;if(i=a[r.pos++],n=(112&i)>>4,i<128||(i=a[r.pos++],n|=(127&i)<<3,i<128)||(i=a[r.pos++],n|=(127&i)<<10,i<128)||(i=a[r.pos++],n|=(127&i)<<17,i<128)||(i=a[r.pos++],n|=(127&i)<<24,i<128)||(i=a[r.pos++],n|=(1&i)<<31,i<128))return function(e,t,r){return r?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}(e,n,t);throw Error("Expected varint not more than 10 bytes")}(i,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&&Ad?Ad.decode(this.buf.subarray(t,e)):function(e,t,r){let n="",i=t;for(;i<r;){let t,a,s,o=e[i],l=null,u=o>239?4:o>223?3:o>191?2:1;if(i+u>r)break;1===u?o<128&&(l=o):2===u?(t=e[i+1],128==(192&t)&&(l=(31&o)<<6|63&t,l<=127&&(l=null))):3===u?(t=e[i+1],a=e[i+2],128==(192&t)&&128==(192&a)&&(l=(15&o)<<12|(63&t)<<6|63&a,(l<=2047||l>=55296&&l<=57343)&&(l=null))):4===u&&(t=e[i+1],a=e[i+2],s=e[i+3],128==(192&t)&&128==(192&a)&&128==(192&s)&&(l=(15&o)<<18|(63&t)<<12|(63&a)<<6|63&s,(l<=65535||l>=1114112)&&(l=null))),null===l?(l=65533,u=1):l>65535&&(l-=65536,n+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),n+=String.fromCharCode(l),i+=u}return n}(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 r=this.readPackedEnd();for(;this.pos<r;)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 2===this.type?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=7&t,this._valueStart=this.pos,t>>>3}skip(e){let t=7&e;if(0===t)for(;this.buf[this.pos++]>127;);else if(2===t)this.pos=this.readVarint()+this.pos;else if(5===t)this.pos+=4;else{if(1!==t)throw Error(`Unimplemented type: ${t}`);this.pos+=8}}},Sd=class{constructor(e=new Uint8Array(16)){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.length=this.buf.length}writeTag(e,t){this.writeVarint(e<<3|t)}realloc(e){let t=this.length||16;for(;t<this.pos+e;)t*=2;if(t!==this.length){let e=new Uint8Array(t);e.set(this.buf),this.buf=e,this.dataView=new DataView(e.buffer),this.length=t}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeSFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,-1&e,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*_d),!0),this.pos+=8}writeSFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,-1&e,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*_d),!0),this.pos+=8}writeVarint(e){if((e=+e||0)>=0&&e<128)return this.pos>=this.length&&this.realloc(1),void(this.buf[this.pos++]=e);e>268435455||e<0?function(e,t){let r,n;if(e>=0?(r=e%4294967296|0,n=e/4294967296|0):(r=~(-e%4294967296),n=~(-e/4294967296),4294967295^r?r=r+1|0:(r=0,n=n+1|0)),e>=0x10000000000000000||e<-0x10000000000000000)throw Error("Given varint doesn't fit into 10 bytes");t.realloc(10),function(e,t,r){r.buf[r.pos++]=127&e|128,e>>>=7,r.buf[r.pos++]=127&e|128,e>>>=7,r.buf[r.pos++]=127&e|128,e>>>=7,r.buf[r.pos++]=127&e|128,e>>>=7,r.buf[r.pos]=127&e}(r,0,t),function(e,t){let r=(7&e)<<4;t.buf[t.pos++]|=r|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e)))))}(n,t)}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=e>>>7&127))))}writeSVarint(e){this.writeVarint(e<0?2*-e-1:2*e)}writeBoolean(e){this.writeVarint(+e)}writeString(e){e=String(e),this.realloc(4*e.length),this.pos++;let t=this.pos;this.pos=function(e,t,r){for(let n,i,a=0;a<t.length;a++){if(n=t.charCodeAt(a),n>55295&&n<57344){if(!i){n>56319||a+1===t.length?(e[r++]=239,e[r++]=191,e[r++]=189):i=n;continue}if(n<56320){e[r++]=239,e[r++]=191,e[r++]=189,i=n;continue}n=i-55296<<10|n-56320|65536,i=null}else i&&=(e[r++]=239,e[r++]=191,e[r++]=189,null);n<128?e[r++]=n:(n<2048?e[r++]=n>>6|192:(n<65536?e[r++]=n>>12|224:(e[r++]=n>>18|240,e[r++]=n>>12&63|128),e[r++]=n>>6&63|128),e[r++]=63&n|128)}return r}(this.buf,e,this.pos);let r=this.pos-t;r>=128&&Fd(t,r,this),this.pos=t-1,this.writeVarint(r),this.pos+=r}writeFloat(e){this.realloc(4),this.dataView.setFloat32(this.pos,e,!0),this.pos+=4}writeDouble(e){this.realloc(8),this.dataView.setFloat64(this.pos,e,!0),this.pos+=8}writeBytes(e){let t=e.length;this.writeVarint(t),this.realloc(t),this.buf.set(e,this.pos),this.pos+=t}writeRawMessage(e,t){this.pos++;let r=this.pos;e(t,this);let n=this.pos-r;n>=128&&Fd(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n}writeMessage(e,t,r){this.writeTag(e,2),this.writeRawMessage(t,r)}writePackedVarint(e,t){t.length&&this.writeMessage(e,kd,t)}writePackedSVarint(e,t){t.length&&this.writeMessage(e,Id,t)}writePackedBoolean(e,t){t.length&&this.writeMessage(e,Cd,t)}writePackedFloat(e,t){t.length&&this.writeMessage(e,Td,t)}writePackedDouble(e,t){t.length&&this.writeMessage(e,Md,t)}writePackedFixed32(e,t){t.length&&this.writeMessage(e,Bd,t)}writePackedSFixed32(e,t){t.length&&this.writeMessage(e,Pd,t)}writePackedFixed64(e,t){t.length&&this.writeMessage(e,zd,t)}writePackedSFixed64(e,t){t.length&&this.writeMessage(e,Vd,t)}writeBytesField(e,t){this.writeTag(e,2),this.writeBytes(t)}writeFixed32Field(e,t){this.writeTag(e,5),this.writeFixed32(t)}writeSFixed32Field(e,t){this.writeTag(e,5),this.writeSFixed32(t)}writeFixed64Field(e,t){this.writeTag(e,1),this.writeFixed64(t)}writeSFixed64Field(e,t){this.writeTag(e,1),this.writeSFixed64(t)}writeVarintField(e,t){this.writeTag(e,0),this.writeVarint(t)}writeSVarintField(e,t){this.writeTag(e,0),this.writeSVarint(t)}writeStringField(e,t){this.writeTag(e,2),this.writeString(t)}writeFloatField(e,t){this.writeTag(e,5),this.writeFloat(t)}writeDoubleField(e,t){this.writeTag(e,1),this.writeDouble(t)}writeBooleanField(e,t){this.writeVarintField(e,+t)}};function Fd(e,t,r){let n=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));r.realloc(n),r.buf.copyWithin(e+n,e,r.pos)}function kd(e,t){let r=e.length,n=t.buf,i=t.pos,a=t.length;for(let s=0;s<r;s++){let r=e[s];if(r<0||i+10>a)t.pos=i,t.writeVarint(r),n=t.buf,i=t.pos,a=t.length;else{for(;r>127;)n[i++]=r%128|128,r=Math.floor(r/128);n[i++]=r}}t.pos=i}function Id(e,t){for(let r=0;r<e.length;r++)t.writeSVarint(e[r])}function Td(e,t){for(let r=0;r<e.length;r++)t.writeFloat(e[r])}function Md(e,t){for(let r=0;r<e.length;r++)t.writeDouble(e[r])}function Cd(e,t){for(let r=0;r<e.length;r++)t.writeBoolean(e[r])}function Bd(e,t){for(let r=0;r<e.length;r++)t.writeFixed32(e[r])}function Pd(e,t){for(let r=0;r<e.length;r++)t.writeSFixed32(e[r])}function zd(e,t){for(let r=0;r<e.length;r++)t.writeFixed64(e[r])}function Vd(e,t){for(let r=0;r<e.length;r++)t.writeSFixed64(e[r])}function Ld(e,t,r){1===e&&r.readMessage(Od,t)}function Od(e,t,r){if(3===e){let{id:e,bitmap:n,width:i,height:a,left:s,top:o,advance:l}=r.readMessage(Rd,{});t.push({id:e,bitmap:new Vu({width:i+6,height:a+6},n),metrics:{width:i,height:a,left:s,top:o,advance:l}})}}function Rd(e,t,r){1===e?t.id=r.readVarint():2===e?t.bitmap=r.readBytes():3===e?t.width=r.readVarint():4===e?t.height=r.readVarint():5===e?t.left=r.readSVarint():6===e?t.top=r.readSVarint():7===e&&(t.advance=r.readVarint())}function $d(e){return new Ed(e).readFields(Ld,[])}function Nd(e){return"function"==typeof e?.renderWithWebGL}function Ud(e){let{userImage:t}=e;return!(!t?.render||!t.render()||(Nd(t.data)||e.data.replace(new Uint8Array(t.data.buffer)),0))}function qd(e){let t=0,r=0;for(let n of e)t+=n.w*n.h,r=Math.max(r,n.w);e.sort((e,t)=>t.h-e.h);let n=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),r),h:1/0}],i=0,a=0;for(let t of e)for(let e=n.length-1;e>=0;e--){let r=n[e];if(!(t.w>r.w||t.h>r.h)){if(t.x=r.x,t.y=r.y,a=Math.max(a,t.y+t.h),i=Math.max(i,t.x+t.w),t.w===r.w&&t.h===r.h){let t=n.pop();t&&e<n.length&&(n[e]=t)}else t.h===r.h?(r.x+=t.w,r.w-=t.w):t.w===r.w?(r.y+=t.h,r.h-=t.h):(n.push({x:r.x+t.w,y:r.y,w:r.w-t.w,h:t.h}),r.y+=t.h,r.h-=t.h);break}}return{w:i,h:a,fill:t/(i*a)||0}}var jd=class{constructor(e,{pixelRatio:t,version:r,isWebGLImage:n=!1,stretchX:i,stretchY:a,content:s,textFitWidth:o,textFitHeight:l}){this.paddedRect=e,this.pixelRatio=t,this.stretchX=i,this.stretchY=a,this.content=s,this.version=r,this.needsFirstWebGLRender=n,this.textFitWidth=o,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]}},Gd=class{constructor(e,t){let r={},n={};this.haveRenderCallbacks=[],this.patchedUpdateVersion=-1;let i=[];this.addImages(e,r,i),this.addImages(t,n,i);let{w:a,h:s}=qd(i),o=new Lu({width:a||1,height:s||1});for(let t in e){let n=e[t];if(n.isWebGLImage)continue;let i=r[t].paddedRect;Lu.copy(n.data,o,{x:0,y:0},{x:i.x+1,y:i.y+1},n.data)}for(let e in t){let r=t[e],i=n[e].paddedRect,a=i.x+1,s=i.y+1,l=r.data.width,u=r.data.height;Lu.copy(r.data,o,{x:0,y:0},{x:a,y:s},r.data),Lu.copy(r.data,o,{x:0,y:u-1},{x:a,y:s-1},{width:l,height:1}),Lu.copy(r.data,o,{x:0,y:0},{x:a,y:s+u},{width:l,height:1}),Lu.copy(r.data,o,{x:l-1,y:0},{x:a-1,y:s},{width:1,height:u}),Lu.copy(r.data,o,{x:0,y:0},{x:a+l,y:s},{width:1,height:u})}this.image=o,this.iconPositions=r,this.patternPositions=n}addImages(e,t,r){for(let n in e){let i=e[n],a={x:0,y:0,w:i.data.width+2,h:i.data.height+2};r.push(a),t[n]=new jd(a,i),i.hasRenderCallback&&this.haveRenderCallbacks.push(n)}}patchUpdatedImages(e,t){if(e.dispatchRenderCallbacks(this.haveRenderCallbacks),this.patchedUpdateVersion!==e.updateVersion){this.patchedUpdateVersion=e.updateVersion;for(let r in this.iconPositions)this.patchUpdatedImage(this.iconPositions[r],e.getImage(r),t);for(let r in this.patternPositions)this.patchUpdatedImage(this.patternPositions[r],e.getImage(r),t)}}patchUpdatedImage(e,t,r){if(!e||!t||!e.needsFirstWebGLRender&&e.version===t.version)return;e.needsFirstWebGLRender=!1,e.version=t.version;let[n,i]=e.tl,a=t.userImage?.data;if(!Nd(a))return void r.update(t.data,void 0,{x:n,y:i});let{width:s,height:o}=t.data;r.context.setCustomLayerDefaults(),a.renderWithWebGL({gl:r.context.gl,texture:r.texture,x:n,y:i,width:s,height:o}),r.context.setDirty()}};ks("ImagePosition",jd),ks("ImageAtlas",Gd);var Xd=function(e){return e[e.none=0]="none",e[e.horizontal=1]="horizontal",e[e.vertical=2]="vertical",e[e.horizontalOnly=3]="horizontalOnly",e}(Xd||{});const Yd=/^\p{gc=M}$/u;function Zd(e,t,r){let n=new yd(e.join(""),t,[]),i=0;for(let e of n.graphemes())n.sectionIndex.push(r[i]??0),i+=[...e].length;return n}function Wd(e){let t=[],r=0;for(let n of e)t.push(r),r+=n.length;return t}function Hd(e,t,r){let n=[...e],i=Wd(n),a=function(e){let t=[],r=0;for(;r<e.length;){if(!Yd.test(e[r])){t.push(r),r++;continue}let n=r;for(;n<e.length&&Yd.test(e[n]);)n++;let i=e[n];if(void 0!==i&&id(i.codePointAt(0))){t.push(n);for(let e=n-1;e>=r;e--)t.push(e);r=n+1}else{for(let e=r;e<n;e++)t.push(e);r=n}}return t}(n);return Zd(a.map(e=>n[e]),t,a.map(e=>r[i[e]]??0))}function Kd(e,t,r,n,i,a,s,o,l,u,h,c,p,f,d){let y=yd.fromFeature(e,i);2===c&&y.verticalizePunctuation();let m=y.determineLineBreaks(u,a,t,n,f),g=ad(y.text)?function(e,t){let r=t.map(t=>e.toCodeUnitIndex(t)),n=Ff.isParsed()?Ff:null;if(1===e.sections.length)return n?n.processBidirectionalText(e.toString(),r).map(t=>Hd(t,e.sections,[...t].map(()=>0))):function(e,t){return wd(e,t).map(e=>e.text)}(e.toString(),r).map(t=>Zd([...t],e.sections,[...t].map(()=>0)));let i=function(e){let t=[],r=0;for(let n of e.graphemes())t.push(...Array(n.length).fill(e.sectionIndex[r])),r++;return t}(e);return n?n.processStyledBidirectionalText(e.text,i,r).map(([t,r])=>Hd(t,e.sections,r)):function(e,t,r){return wd(e,r).map(e=>[e.text,e.sourceIndices.map(e=>t[e]??0)])}(e.text,i,r).map(([t,r])=>{let n=[...t];return Zd(n,e.sections,Wd(n).map(e=>r[e]??0))})}(y,m):function(e,t){let r=[],n=0;for(let i of t)r.push(e.substring(n,i)),n=i;return n<e.length()&&r.push(e.substring(n,e.length())),r}(y,m),x=[],v={positionedLines:x,text:y.toString(),top:h[1],bottom:h[1],left:h[0],right:h[0],writingMode:c,iconsInText:!1,verticalizable:!1};return function(e,t,r,n,i,a,s,o,l,u,h,c){let p=0,f=0,d=0,y=0,m="right"===o?1:"left"===o?0:.5,g=24/c,x=0;for(let s of i){s.trim();let i=s.getMaxScale(),o={positionedGlyphs:[],lineOffset:0};e.positionedLines[x]=o;let c=o.positionedGlyphs,v=0;if(!s.length()){f+=a,++x;continue}let b=Qd(n,s,g),w=2!==l||h?null:sy(s),D=s.graphemes();for(let a=0;a<D.length;a++){let o=s.getSection(a),d=D[a],y=d.codePointAt(0),m=w?w[a]:ty(l,h,y),x="fontStack"in o&&Kf(d)&&!t[o.fontStack]?.[d]?[...d]:[d];for(let l of x){let h,d={glyph:l.codePointAt(0),grapheme:l,imageName:null,x:p,y:f+-17,vertical:m,scale:1,fontStack:"",sectionIndex:s.getSectionIndex(a),metrics:null,rect:null};if("fontStack"in o){if(h=oy(o,l,m,b,t,r),!h)continue;d.fontStack=o.fontStack}else{if(e.iconsInText=!0,o.scale*=g,h=ly(o,m,i,b,n),!h)continue;v=Math.max(v,h.imageOffset),d.imageName=o.imageName}let{rect:y,metrics:x,baselineOffset:w}=h;d.y+=w,d.scale=o.scale,d.metrics=x,d.rect=y,c.push(d),m?(e.verticalizable=!0,p+=("imageName"in o?x.advance:24)*o.scale+u):p+=x.advance*o.scale+u}}if(0!==c.length){let e=p-u;d=Math.max(e,d),uy(c,0,c.length-1,m)}p=0;let _=24*(i-1);o.lineOffset=Math.max(v,_);let A=a*i+v;f+=A,y=Math.max(A,y),++x}let{horizontalAlign:v,verticalAlign:b}=Jd(s);(function(e,t,r,n,i,a,s,o,l){let u=(t-r)*i,h=0;h=a===s?-n*l*s+.5*s:-o*n- -17;for(let t of e)for(let e of t.positionedGlyphs)e.x+=u,e.y+=h})(e.positionedLines,m,v,b,d,y,a,f,i.length),e.top+=-b*f,e.bottom=e.top+f,e.left+=-v*d,e.right=e.left+d}(v,t,r,n,g,s,o,l,c,u,p,d),!function(e){for(let t of e)if(0!==t.positionedGlyphs.length)return!1;return!0}(x)&&v}function Jd(e){let t=.5,r=.5;switch(e){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0}switch(e){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:t,verticalAlign:r}}function Qd(e,t,r){let n=24*t.getMaxScale(),{maxImageWidth:i,maxImageHeight:a}=t.getMaxImageSize(e),s=Math.max(n,a*r);return{verticalLineContentWidth:Math.max(n,i*r),horizontalLineContentHeight:s}}function ey(e){switch(e){case"top":return 0;case"center":return.5;default:return 1}}function ty(e,t,r){return!(1===e||!t&&!Tf(r)||t&&(Jf(r)||nd(r)))}function ry(e){return/\p{Nd}/u.test(String.fromCodePoint(e))}function ny(e){return/\p{Lu}/u.test(String.fromCodePoint(e))}function iy(e){let t=e.some(ry)&&e.every(e=>ry(e)||function(e){return/[\p{P}\p{S}]/u.test(String.fromCodePoint(e))}(e)),r=e.length<=3&&e.every(e=>ny(e)||ry(e));return t||r}function ay(e){return(ry(e)||ny(e))&&!nd(e)}function sy(e){let t=e.graphemes().slice(),r=t.map(e=>e.codePointAt(0)),n=r.map(Tf),i=t=>!n[t]&&!Jf(r[t])&&!("imageName"in e.getSection(t));for(let e=0;e<r.length;e++){if(!i(e))continue;let t=e;for(;t+1<r.length&&i(t+1);)t++;if(iy(r.slice(e,t+1)))for(let i=e;i<=t;i++)n[i]=ay(r[i]);e=t}return function(e,t){let r=!1;for(let n=0;n<e.length;n++){if(t[n])continue;let i=sd[e[n]];i&&(0===n||t[n-1])&&(n===e.length-1||t[n+1])&&(e[n]=i,t[n]=!0,r=!0)}return r}(t,n)&&(e.text=t.join(""),e._graphemes=null),n}function oy(e,t,r,n,i,a){let s,o=a[e.fontStack]?.[t],l=function(e,t,r,n){if(e?.rect)return e;let i=t[r.fontStack]?.[n];return i?{rect:null,metrics:i.metrics}:null}(o,i,e,t);if(null===l)return null;if(r)s=n.verticalLineContentWidth-24*e.scale;else{let t=ey(e.verticalAlign);s=(n.horizontalLineContentHeight-24*e.scale)*t}return{rect:l.rect,metrics:l.metrics,baselineOffset:s}}function ly(e,t,r,n,i){let a=i[e.imageName];if(!a)return null;let s,o=a.paddedRect,l=a.displaySize,u={width:l[0],height:l[1],left:1,top:-3,advance:t?l[1]:l[0]};if(t)s=n.verticalLineContentWidth-l[1]*e.scale;else{let t=ey(e.verticalAlign);s=(n.horizontalLineContentHeight-l[1]*e.scale)*t}return{rect:o,metrics:u,baselineOffset:s,imageOffset:(t?l[0]:l[1])*e.scale-24*r}}function uy(e,t,r,n){if(0===n)return;let i=e[r],a=i.metrics.advance*i.scale,s=(e[r].x+a)*n;for(let n=t;n<=r;n++)e[n].x-=s}function hy(e,t,r){let{horizontalAlign:n,verticalAlign:i}=Jd(r),a=t[0],s=t[1],o=a-e.displaySize[0]*n,l=o+e.displaySize[0],u=s-e.displaySize[1]*i;return{image:e,top:u,bottom:u+e.displaySize[1],left:o,right:l}}function cy(e){let t=e.left,r=e.top,n=e.right-t,i=e.bottom-r,a=e.image.content[2]-e.image.content[0],s=e.image.content[3]-e.image.content[1],o=e.image.textFitWidth??"stretchOrShrink",l=e.image.textFitHeight??"stretchOrShrink",u=a/s;if("proportional"===l){if("stretchOnly"===o&&n/i<u||"proportional"===o){let e=Math.ceil(i*u);t*=e/n,n=e}}else if("proportional"===o&&"stretchOnly"===l&&0!==u&&n/i>u){let e=Math.ceil(n/u);r*=e/i,i=e}return{x1:t,y1:r,x2:t+n,y2:r+i}}function py(e,t,r,n,i,a){let s,o=e.image;if(o.content){let e=o.content,t=o.pixelRatio||1;s=[e[0]/t,e[1]/t,o.displaySize[0]-e[2]/t,o.displaySize[1]-e[3]/t]}let l,u,h,c,p=t.left*a,f=t.right*a;"width"===r||"both"===r?(c=i[0]+p-n[3],u=i[0]+f+n[1]):(c=i[0]+(p+f-o.displaySize[0])/2,u=c+o.displaySize[0]);let d=t.top*a,y=t.bottom*a;return"height"===r||"both"===r?(l=i[1]+d-n[0],h=i[1]+y+n[2]):(l=i[1]+(d+y-o.displaySize[1])/2,h=l+o.displaySize[1]),{image:o,top:l,right:u,bottom:h,left:c,collisionPadding:s}}function fy(e,t){let{expression:r}=t;if("constant"===r.kind)return{kind:"constant",layoutSize:r.evaluate(new zs(e+1))};if("source"===r.kind)return{kind:"source"};if("composite"===r.kind){let{minZoom:t,maxZoom:n}=function(e,t){let r=0;for(;r<e.length&&e[r]<=t;)r++;r=Math.max(0,r-1);let n=r;for(;n<e.length&&e[n]<t+1;)n++;return n=Math.min(e.length-1,n),{minZoom:e[r],maxZoom:e[n]}}(r.zoomStops,e);return{kind:"composite",minZoom:t,maxZoom:n,interpolationType:r.interpolationType}}{let t=function(e){return e.zoomStops.map(t=>e.evaluate(new zs(t===-1/0?e.zoomStops[1]-1:t)))}(r),n=r.evaluate(new zs(e+1));return{kind:"camera",zoomStops:r.zoomStops,sizes:t,layoutSize:n,interpolationType:r.interpolationType}}}function dy(e,{uSize:t,uSizeT:r},{lowerSize:n,upperSize:i}){return"source"===e.kind?n/128:"composite"===e.kind?fn.number(n/128,i/128,r):t}function yy(e,t){let r=0,n=0;return"constant"===e.kind?n=e.layoutSize:"camera"===e.kind?n=function({zoomStops:e,sizes:t,layoutSize:r,interpolationType:n},i){let a=e.length-1;for(;a>0&&e[a]>i;)a--;let s=Math.min(a+1,e.length-1),o=n?Le(cn.interpolationFactor(n,i,e[a],e[s]),0,1):0;return Math.min(fn.number(t[a],t[s],o),r)}(e,t):"composite"===e.kind&&(r=function({interpolationType:e,minZoom:t,maxZoom:r},n){return e?Le(cn.interpolationFactor(e,n,t,r),0,1):0}(e,t)),{uSizeT:r,uSize:n}}var my=class e extends l{constructor(e,t,r,n){super(e,t),this.angle=r,void 0!==n&&(this.segment=n)}clone(){return new e(this.x,this.y,this.angle,this.segment)}};function gy(e,t,r,n,i){if(void 0===t.segment||0===r)return!0;let a=t,s=t.segment+1,o=0;for(;o>-r/2;){if(s--,s<0)return!1;o-=e[s].dist(a),a=e[s]}o+=e[s].dist(e[s+1]),s++;let l=[],u=0;for(;o<r/2;){let t=e[s-1],r=e[s],a=e[s+1];if(!a)return!1;let h=t.angleTo(r)-r.angleTo(a);for(h=Math.abs((h+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:o,angleDelta:h}),u+=h;o-l[0].distance>n;)u-=l.shift().angleDelta;if(u>i)return!1;s++,o+=r.dist(a)}return!0}function xy(e){let t=0;for(let r=0;r<e.length-1;r++)t+=e[r].dist(e[r+1]);return t}function vy(e,t,r){return e?.6*t*r:0}function by(e,t){return Math.max(e?e.right-e.left:0,t?t.right-t.left:0)}function wy(e,t,r,n,i,a){let s=vy(r,i,a),o=by(r,n)*a,l=0,u=xy(e)/2;for(let r=0;r<e.length-1;r++){let n=e[r],i=e[r+1],a=n.dist(i);if(l+a>u){let h=(u-l)/a,c=new my(fn.number(n.x,i.x,h),fn.number(n.y,i.y,h),i.angleTo(n),r);return c._round(),!s||gy(e,c,o,s,t)?c:void 0}l+=a}}function Dy(e,t,r,n,i,a,s,o,l){let u=vy(n,a,s),h=by(n,i),c=h*s,p=0===e[0].x||e[0].x===l||0===e[0].y||e[0].y===l;return t-c<t/4&&(t=c+t/4),_y(e,p?t/2*o%t:(h/2+2*a)*s*o%t,t,u,r,c,p,!1,l)}function _y(e,t,r,n,i,a,s,o,l){let u=a/2,h=xy(e),c=0,p=t-r,f=[];for(let t=0;t<e.length-1;t++){let s=e[t],o=e[t+1],d=s.dist(o),y=o.angleTo(s);for(;p+r<c+d;){p+=r;let m=(p-c)/d,g=fn.number(s.x,o.x,m),x=fn.number(s.y,o.y,m);if(g>=0&&g<l&&x>=0&&x<l&&p-u>=0&&p+u<=h){let r=new my(g,x,y,t);r._round(),(!n||gy(e,r,a,n,i))&&f.push(r)}}c+=d}return!o&&!f.length&&!s&&(f=_y(e,c/2,r,n,i,a,s,!0,l)),f}function Ay(e,t,r,n,i){let a=[];for(let s of e){let e;for(let o=0;o<s.length-1;o++){let u=s[o],h=s[o+1];u.x<t&&h.x<t||(u.x<t?u=new l(t,u.y+(h.y-u.y)*((t-u.x)/(h.x-u.x)))._round():h.x<t&&(h=new l(t,u.y+(h.y-u.y)*((t-u.x)/(h.x-u.x)))._round()),!(u.y<r&&h.y<r)&&(u.y<r?u=new l(u.x+(h.x-u.x)*((r-u.y)/(h.y-u.y)),r)._round():h.y<r&&(h=new l(u.x+(h.x-u.x)*((r-u.y)/(h.y-u.y)),r)._round()),!(u.x>=n&&h.x>=n)&&(u.x>=n?u=new l(n,u.y+(h.y-u.y)*((n-u.x)/(h.x-u.x)))._round():h.x>=n&&(h=new l(n,u.y+(h.y-u.y)*((n-u.x)/(h.x-u.x)))._round()),!(u.y>=i&&h.y>=i)&&(u.y>=i?u=new l(u.x+(h.x-u.x)*((i-u.y)/(h.y-u.y)),i)._round():h.y>=i&&(h=new l(u.x+(h.x-u.x)*((i-u.y)/(h.y-u.y)),i)._round()),(!e||!u.equals(e[e.length-1]))&&(e=[u],a.push(e)),e.push(h)))))}}return a}function Ey(e,t,r,n,i,a){let s=Sy(e,t,r,i,0);return s=Sy(s,t,n,a,1),s}function Sy(e,t,r,n,i){switch(t){case 1:return function(e,t,r,n){let i=[];for(let a of e)for(let e of a){let a=0===n?e.x:e.y;a>=t&&a<=r&&i.push([e])}return i}(e,r,n,i);case 2:return ky(e,r,n,i,!1);case 3:return ky(e,r,n,i,!0)}return[]}function Fy(e,t,r,n,i){let a=0===n?Iy:Ty,s=[],o=[];for(let l=0;l<e.length-1;l++){let u=e[l],h=e[l+1],c=0===n?u.x:u.y,p=0===n?h.x:h.y,f=!1;c<t?p>t&&s.push(a(u,h,t)):c>r?p<r&&s.push(a(u,h,r)):s.push(u),p<t&&c>=t&&(s.push(a(u,h,t)),f=!0),p>r&&c<=r&&(s.push(a(u,h,r)),f=!0),!i&&f&&(o.push(s),s=[])}let u=e.length-1,h=0===n?e[u].x:e[u].y;return h>=t&&h<=r&&s.push(e[u]),i&&s.length>0&&!s[0].equals(s[s.length-1])&&s.push(new l(s[0].x,s[0].y)),s.length>0&&o.push(s),o}function ky(e,t,r,n,i){let a=[];for(let s of e){let e=Fy(s,t,r,n,i);e.length>0&&a.push(...e)}return a}function Iy(e,t,r){let n=(r-e.x)/(t.x-e.x);return new l(r,e.y+(t.y-e.y)*n)}function Ty(e,t,r){let n=(r-e.y)/(t.y-e.y);return new l(e.x+(t.x-e.x)*n,r)}function My(e,t,r,n){let i=[],a=e.image,s=a.pixelRatio,o=a.paddedRect.w-2,u=a.paddedRect.h-2,h={x1:e.left,y1:e.top,x2:e.right,y2:e.bottom},c=a.stretchX||[[0,o]],p=a.stretchY||[[0,u]],f=(e,t)=>e+t[1]-t[0],d=c.reduce(f,0),y=p.reduce(f,0),m=o-d,g=u-y,x=0,v=d,b=0,w=y,D=0,_=m,A=0,E=g;if(a.content&&n){let t=a.content,r=t[2]-t[0],n=t[3]-t[1];(a.textFitWidth||a.textFitHeight)&&(h=cy(e)),x=Cy(c,0,t[0]),b=Cy(p,0,t[1]),v=Cy(c,t[0],t[2]),w=Cy(p,t[1],t[3]),D=t[0]-x,A=t[1]-b,_=r-v,E=n-w}let S=h.x1,F=h.y1,k=h.x2-S,I=h.y2-F,T=(e,n,i,o)=>{let u=Py(e.stretch-x,v,k,S),h=zy(e.fixed-D,_,e.stretch,d),c=Py(n.stretch-b,w,I,F),p=zy(n.fixed-A,E,n.stretch,y),f=Py(i.stretch-x,v,k,S),m=zy(i.fixed-D,_,i.stretch,d),g=Py(o.stretch-b,w,I,F),T=zy(o.fixed-A,E,o.stretch,y),M=new l(u,c),C=new l(f,c),B=new l(f,g),P=new l(u,g),z=new l(h/s,p/s),V=new l(m/s,T/s),L=t*Math.PI/180;if(L){let e=Math.sin(L),t=Math.cos(L),r=[t,-e,e,t];M._matMult(r),C._matMult(r),P._matMult(r),B._matMult(r)}let O=e.stretch+e.fixed,R=i.stretch+i.fixed,$=n.stretch+n.fixed,N=o.stretch+o.fixed;return{tl:M,tr:C,bl:P,br:B,tex:{x:a.paddedRect.x+1+O,y:a.paddedRect.y+1+$,w:R-O,h:N-$},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:z,pixelOffsetBR:V,minFontScaleX:_/s/k,minFontScaleY:E/s/I,isSDF:r}};if(n&&(a.stretchX||a.stretchY)){let e=By(c,m,d),t=By(p,g,y);for(let r=0;r<e.length-1;r++){let n=e[r],a=e[r+1];for(let e=0;e<t.length-1;e++){let r=t[e],s=t[e+1];i.push(T(n,r,a,s))}}}else i.push(T({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:o+1},{fixed:0,stretch:u+1}));return i}function Cy(e,t,r){let n=0;for(let i of e)n+=Math.max(t,Math.min(r,i[1]))-Math.max(t,Math.min(r,i[0]));return n}function By(e,t,r){let n=[{fixed:-1,stretch:0}];for(let[t,r]of e){let e=n[n.length-1];n.push({fixed:t-e.stretch,stretch:e.stretch}),n.push({fixed:t-e.stretch,stretch:e.stretch+(r-t)})}return n.push({fixed:t+1,stretch:r}),n}function Py(e,t,r,n){return e/t*r+n}function zy(e,t,r,n){return e-t*r/n}function Vy(e,t,r,n,i,a,s,o){let u=n.layout.get("text-rotate").evaluate(a,{})*Math.PI/180,h=[];for(let e of t.positionedLines)for(let n of e.positionedGlyphs){if(!n.rect)continue;let a=n.rect||{},c=4,p=!0,f=1,d=0,y=(i||o)&&n.vertical,m=n.metrics.advance*n.scale/2;if(o&&t.verticalizable){let t=24*(n.scale-1),r=(24-n.metrics.width*n.scale)/2;d=e.lineOffset/2-(n.imageName?-r:t)}if(n.imageName){let e=s[n.imageName];p=e.sdf,f=e.pixelRatio,c=1/f}let g=i?[n.x+m,n.y]:[0,0],x=i?[0,0]:[n.x+m+r[0],n.y+r[1]-d],v=[0,0];y&&(v=x,x=[0,0]);let b=n.metrics.isDoubleResolution?2:1,w=(n.metrics.left-c)*n.scale-m+x[0],D=(-n.metrics.top-c)*n.scale+x[1],_=w+a.w/b*n.scale/f,A=D+a.h/b*n.scale/f,E=new l(w,D),S=new l(_,D),F=new l(w,A),k=new l(_,A);if(y){let e=new l(-m,m- -17),t=-Math.PI/2,r=12-m,i=new l(22-r,-(n.imageName?r:0)),a=new l(...v);E._rotateAround(t,e)._add(i)._add(a),S._rotateAround(t,e)._add(i)._add(a),F._rotateAround(t,e)._add(i)._add(a),k._rotateAround(t,e)._add(i)._add(a)}if(u){let e=Math.sin(u),t=Math.cos(u),r=[t,-e,e,t];E._matMult(r),S._matMult(r),F._matMult(r),k._matMult(r)}let I=new l(0,0),T=new l(0,0);h.push({tl:E,tr:S,bl:F,br:k,tex:a,writingMode:t.writingMode,glyphOffset:g,sectionIndex:n.sectionIndex,isSDF:p,pixelOffsetTL:I,pixelOffsetBR:T,minFontScaleX:0,minFontScaleY:0})}return h}ks("Anchor",my);var Ly=class{constructor(e,t,r,n,i,a,s,o,u,h){if(this.boxStartIndex=e.length,u){let e=a.top,t=a.bottom,r=a.collisionPadding;r&&(e-=r[1],t+=r[3]);let n=t-e;n>0&&(n=Math.max(10,n),this.circleDiameter=n)}else{let u=a.image?.content&&(a.image.textFitWidth||a.image.textFitHeight)?cy(a):{x1:a.left,y1:a.top,x2:a.right,y2:a.bottom};u.y1=u.y1*s-o[0],u.y2=u.y2*s+o[2],u.x1=u.x1*s-o[3],u.x2=u.x2*s+o[1];let c=a.collisionPadding;if(c&&(u.x1-=c[0]*s,u.y1-=c[1]*s,u.x2+=c[2]*s,u.y2+=c[3]*s),h){let e=new l(u.x1,u.y1),t=new l(u.x2,u.y1),r=new l(u.x1,u.y2),n=new l(u.x2,u.y2),i=h*Math.PI/180;e._rotate(i),t._rotate(i),r._rotate(i),n._rotate(i),u.x1=Math.min(e.x,t.x,r.x,n.x),u.x2=Math.max(e.x,t.x,r.x,n.x),u.y1=Math.min(e.y,t.y,r.y,n.y),u.y2=Math.max(e.y,t.y,r.y,n.y)}e.emplaceBack(t.x,t.y,u.x1,u.y1,u.x2,u.y2,r,n,i)}this.boxEndIndex=e.length}},Oy=class{constructor(e=[],t=(e,t)=>e<t?-1:+(e>t)){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(0===this.length)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:r}=this,n=t[e];for(;e>0;){let i=e-1>>1,a=t[i];if(r(n,a)>=0)break;t[e]=a,e=i}t[e]=n}_down(e){let{data:t,compare:r}=this,n=this.length>>1,i=t[e];for(;e<n;){let n=1+(e<<1),a=n+1;if(a<this.length&&r(t[a],t[n])<0&&(n=a),r(t[n],i)>=0)break;t[e]=t[n],e=n}t[e]=i}};function Ry(e,t=1){let r=uc.fromPoints(e[0]),n=Math.min(r.width(),r.height()),i=n/2,a=new Oy([],$y),{minX:s,minY:o,maxX:u,maxY:h}=r;if(0===n)return new l(s,o);for(let t=s;t<u;t+=n)for(let r=o;r<h;r+=n)a.push(new Ny(t+i,r+i,i,e));let c=function(e){let t=0,r=0,n=0,i=e[0];for(let e=0,a=i.length,s=a-1;e<a;s=e++){let a=i[e],o=i[s],l=a.x*o.y-o.x*a.y;r+=(a.x+o.x)*l,n+=(a.y+o.y)*l,t+=3*l}return new Ny(r/t,n/t,0,e)}(e),p=c;for(;a.length;){let r=a.pop();(r.d>p.d||!p.d)&&(p=r),!(r.max-p.d<=t)&&(i=r.h/2,a.push(new Ny(r.p.x-i,r.p.y-i,i,e)),a.push(new Ny(r.p.x+i,r.p.y-i,i,e)),a.push(new Ny(r.p.x-i,r.p.y+i,i,e)),a.push(new Ny(r.p.x+i,r.p.y+i,i,e)))}return c.d>0&&p.d-c.d<=t?c.p:p.p}function $y(e,t){return t.max-e.max}var Ny=class{constructor(e,t,r,n){this.p=new l(e,t),this.h=r,this.d=function(e,t){let r=!1,n=1/0;for(let i of t)for(let t=0,a=i.length,s=a-1;t<a;s=t++){let a=i[t],o=i[s];a.y>e.y!=o.y>e.y&&e.x<(o.x-a.x)*(e.y-a.y)/(o.y-a.y)+a.x&&(r=!r),n=Math.min(n,hu(e,a,o))}return(r?1:-1)*Math.sqrt(n)}(this.p,n),this.max=this.d+this.h*Math.SQRT2}};let Uy=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}({});const qy=1/0;function jy(e,t){return t[1]===qy?function(e,t){let r=0,n=0;t<0&&(t=0);let i=t/Math.SQRT2;switch(e){case"top-right":case"top-left":n=i-7;break;case"bottom-right":case"bottom-left":n=7-i;break;case"bottom":n=7-t;break;case"top":n=t-7}switch(e){case"top-right":case"bottom-right":r=-i;break;case"top-left":case"bottom-left":r=i;break;case"left":r=t;break;case"right":r=-t}return[r,n]}(e,t[0]):function(e,t,r){let n=0,i=0;switch(t=Math.abs(t),r=Math.abs(r),e){case"top-right":case"top-left":case"top":i=r-7;break;case"bottom-right":case"bottom-left":case"bottom":i=7-r}switch(e){case"top-right":case"bottom-right":case"right":n=-t;break;case"top-left":case"bottom-left":case"left":n=t}return[n,i]}(e,t[0],t[1])}function Gy(e,t,r){let n=e.layout,i=n.get("text-variable-anchor-offset")?.evaluate(t,{},r);if(i){let e=i.values,t=[];for(let r=0;r<e.length;r+=2){let n=t[r]=e[r],i=e[r+1].map(e=>24*e);n.startsWith("top")?i[1]-=7:n.startsWith("bottom")&&(i[1]+=7),t[r+1]=i}return new Kr(t)}let a=n.get("text-variable-anchor");if(a){let i;i=void 0===e._unevaluatedLayout.getValue("text-radial-offset")?n.get("text-offset").evaluate(t,{},r).map(e=>24*e):[24*n.get("text-radial-offset").evaluate(t,{},r),qy];let s=[];for(let e of a)s.push(e,jy(e,i));return new Kr(s)}return null}function Xy(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 Yy(e,t,r,n,i,a,s,o,l,u,h,c){let p=a.textMaxSize.evaluate(t,{});void 0===p&&(p=s);let f,d=e.layers[0].layout,y=d.get("icon-offset").evaluate(t,{},h),m=Wy(r.horizontal),g=s/24,x=e.tilePixelRatio*g,v=e.tilePixelRatio*p/24,b=e.tilePixelRatio*o,w=e.tilePixelRatio*d.get("symbol-spacing"),D=d.get("text-padding")*e.tilePixelRatio,_=function(e,t,r,n=1){let i=e.get("icon-padding").evaluate(t,{},r)?.values;return[i[0]*n,i[1]*n,i[2]*n,i[3]*n]}(d,t,h,e.tilePixelRatio),A=d.get("text-max-angle")/180*Math.PI,E="viewport"!==d.get("text-rotation-alignment")&&"point"!==d.get("symbol-placement"),S="map"===d.get("icon-rotation-alignment").constantOr("viewport")&&"point"!==d.get("symbol-placement"),F=d.get("symbol-placement"),k=w/2,I=d.get("icon-text-fit");n&&"none"!==I&&(e.allowVerticalPlacement&&r.vertical&&(f=py(n,r.vertical,I,d.get("icon-text-fit-padding"),y,g)),m&&(n=py(n,m,I,d.get("icon-text-fit-padding"),y,g)));let T=h?c.line.getGranularityForZoomLevel(h.z):1,M=(o,c)=>{c.x<0||c.x>=8192||c.y<0||c.y>=8192||function(e,t,r,n,i,a,s,o,l,u,h,c,p,f,d,y,m,g,x,v,b,w,D,_,A){let E=e.addToLineVertexArray(t,r),S=o.layout.get("symbol-height-offset").evaluate(b,{},_);S>e.maxHeightOffset&&(e.maxHeightOffset=S);let F,k,I,T,M=0,C=0,B=0,P=0,z=-1,V=-1,L={},O=(0,Dl.default)("");if(e.allowVerticalPlacement&&n.vertical){let e=o.layout.get("text-rotate").evaluate(b,{},_)+90,r=n.vertical;I=new Ly(l,t,u,h,c,r,p,f,d,e),s&&(T=new Ly(l,t,u,h,c,s,m,g,d,e))}if(i){let r=o.layout.get("icon-rotate").evaluate(b,{}),n="none"!==o.layout.get("icon-text-fit"),a=My(i,r,D,n),p=s?My(s,r,D,n):void 0;k=new Ly(l,t,u,h,c,i,m,g,!1,r),M=4*a.length;let f=e.iconSizeData,d=null;"source"===f.kind?(d=[128*o.layout.get("icon-size").evaluate(b,{})],d[0]>32640&&Je(`${e.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):"composite"===f.kind&&(d=[128*w.compositeIconSizes[0].evaluate(b,{},_),128*w.compositeIconSizes[1].evaluate(b,{},_)],(d[0]>32640||d[1]>32640)&&Je(`${e.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),e.addSymbols(e.icon,a,d,v,x,b,0,t,E.lineStartIndex,E.lineLength,-1,_,S),z=e.icon.placedSymbolArray.length-1,p&&(C=4*p.length,e.addSymbols(e.icon,p,d,v,x,b,2,t,E.lineStartIndex,E.lineLength,-1,_,S),V=e.icon.placedSymbolArray.length-1)}let R=Object.keys(n.horizontal);for(let r of R){let i=n.horizontal[r];F||=(O=(0,Dl.default)(i.text),new Ly(l,t,u,h,c,i,p,f,d,o.layout.get("text-rotate").evaluate(b,{},_)));let s=1===i.positionedLines.length;if(B+=Zy(e,t,i,a,o,d,b,y,S,E,n.vertical?1:3,s?R:[r],L,z,w,_),s)break}n.vertical&&(P+=Zy(e,t,n.vertical,a,o,d,b,y,S,E,2,["vertical"],L,V,w,_));let $=F?F.boxStartIndex:e.collisionBoxArray.length,N=F?F.boxEndIndex:e.collisionBoxArray.length,U=I?I.boxStartIndex:e.collisionBoxArray.length,q=I?I.boxEndIndex:e.collisionBoxArray.length,j=k?k.boxStartIndex:e.collisionBoxArray.length,G=k?k.boxEndIndex:e.collisionBoxArray.length,X=T?T.boxStartIndex:e.collisionBoxArray.length,Y=T?T.boxEndIndex:e.collisionBoxArray.length,Z=-1,W=(e,t)=>e?.circleDiameter?Math.max(e.circleDiameter,t):t;Z=W(F,Z),Z=W(I,Z),Z=W(k,Z),Z=W(T,Z);let H=+(Z>-1);H&&(Z*=A/24),e.glyphOffsetArray.length>=e.maxGlyphs&&Je("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==b.sortKey&&e.addToSortKeyRanges(e.symbolInstances.length,b.sortKey);let K=Gy(o,b,_),[J,Q]=function(e,t){let r=e.length,n=t?.values;if(n?.length>0)for(let t=0;t<n.length;t+=2){let r=Uy[n[t]],i=n[t+1];e.emplaceBack(r,i[0],i[1])}return[r,e.length]}(e.textAnchorOffsets,K);e.symbolInstances.emplaceBack(t.x,t.y,L.right>=0?L.right:-1,L.center>=0?L.center:-1,L.left>=0?L.left:-1,L.vertical||-1,z,V,O,$,N,U,q,j,G,X,Y,u,B,P,M,C,H,0,p,Z,J,Q,S)}(e,c,o,r,n,i,f,e.layers[0],e.collisionBoxArray,t.index,t.sourceLayerIndex,e.index,x,[D,D,D,D],E,l,b,_,S,y,t,a,u,h,s)};if("line"===F)for(let i of Ay(t.geometry,0,0,de,de)){let t=Hh(i,T),a=Dy(t,w,A,r.vertical||m,n,24,v,e.overscaling,de);for(let r of a)(!m||!Hy(e,m.text,k,r))&&M(t,r)}else if("line-center"===F){for(let e of t.geometry)if(e.length>1){let t=Hh(e,T),i=wy(t,A,r.vertical||m,n,24,v);i&&M(t,i)}}else if("Polygon"===t.type)for(let e of xn(t.geometry,0)){let t=Ry(e,16);M(Hh(e[0],T,!0),new my(t.x,t.y,0))}else if("LineString"===t.type)for(let e of t.geometry){let t=Hh(e,T);M(t,new my(t[0].x,t[0].y,0))}else if("Point"===t.type)for(let e of t.geometry)for(let t of e)M([t],new my(t.x,t.y,0))}function Zy(e,t,r,n,i,a,s,o,l,u,h,c,p,f,d,y){let m=Vy(0,r,o,i,a,s,n,e.allowVerticalPlacement),g=e.textSizeData,x=null;"source"===g.kind?(x=[128*i.layout.get("text-size").evaluate(s,{})],x[0]>32640&&Je(`${e.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):"composite"===g.kind&&(x=[128*d.compositeTextSizes[0].evaluate(s,{},y),128*d.compositeTextSizes[1].evaluate(s,{},y)],(x[0]>32640||x[1]>32640)&&Je(`${e.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),e.addSymbols(e.text,m,x,o,a,s,h,t,u.lineStartIndex,u.lineLength,f,y,l);for(let t of c)p[t]=e.text.placedSymbolArray.length-1;return 4*m.length}function Wy(e){for(let t in e)return e[t];return null}function Hy(e,t,r,n){let i=e.compareText;if(t in i){let e=i[t];for(let t=e.length-1;t>=0;t--)if(n.dist(e[t])<r)return!0}else i[t]=[];return i[t].push(n),!1}function Ky(e,t,r){let n="never",i=e.get(t);return i?n=i:e.get(r)&&(n="always"),n}const Jy=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Qy(e,t,r,n,i,a,s,o,l,u,h,c,p,f){let d=o?Math.min(32640,Math.round(o[0])):0,y=o?Math.min(32640,Math.round(o[1])):0;e.emplaceBack(t,r,Math.round(32*n),Math.round(32*i),a,s,+!!l+(d<<1),y,16*u,16*h,256*c,256*p,f)}function em(e,t,r){e.emplaceBack(t.x,t.y,r),e.emplaceBack(t.x,t.y,r),e.emplaceBack(t.x,t.y,r),e.emplaceBack(t.x,t.y,r)}function tm(e){for(let t of e.sections)if(ad(t.text))return!0;return!1}var rm=class{constructor(e){this.layoutVertexArray=new il,this.indexArray=new cl,this.programConfigurations=e,this.segments=new ml,this.dynamicLayoutVertexArray=new al,this.opacityVertexArray=new sl,this.hasVisibleVertices=!1,this.placedSymbolArray=new Ro}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length}upload(e,t,r,n){this.isEmpty()||(r&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Df.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,t),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,_f.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,Jy,!0),this.opacityVertexBuffer.itemSize=1),(r||n)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}};ks("SymbolBuffers",rm);var nm=class{constructor(e,t,r){this.layoutVertexArray=new e,this.layoutAttributes=t,this.indexArray=new r,this.segments=new ml,this.collisionVertexArray=new ul}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,Af.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}};ks("CollisionBuffers",nm);var im=class{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.id),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasDependencies=!0,this.hasRTLText=!1,this.maxHeightOffset=0,this.sortKeyRanges=[],this.collisionCircleArray=[],this.maxGlyphs=65535;let t=this.layers[0]._unevaluatedLayout._values;this.textSizeData=fy(this.zoom,t["text-size"]),this.iconSizeData=fy(this.zoom,t["icon-size"]);let r=this.layers[0].layout,n=r.get("symbol-sort-key"),i=r.get("symbol-z-order");this.canOverlap="never"!==Ky(r,"text-overlap","text-allow-overlap")||"never"!==Ky(r,"icon-overlap","icon-allow-overlap")||r.get("text-ignore-placement")||r.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==i&&!n.isConstant();let a="viewport-y"===i||"auto"===i&&!this.sortFeaturesByKey;this.sortFeaturesByY=a&&this.canOverlap,"point"===r.get("symbol-placement")&&(this.writingModes=r.get("text-writing-mode").map(e=>Xd[e])),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.sourceID=e.sourceID}createArrays(){this.text=new rm(new Yl(this.layers,this.zoom,e=>e.startsWith("text"))),this.icon=new rm(new Yl(this.layers,this.zoom,e=>e.startsWith("icon"))),this.glyphOffsetArray=new Uo,this.lineVertexArray=new qo,this.symbolInstances=new No,this.textAnchorOffsets=new Go}calculateGlyphDependencies(e,t,r,n,i){let a=(n||this.allowVerticalPlacement)&&i,s=yd.fromFeature(e,r),o=s.graphemes();for(let e=0;e<o.length;e++){let r=s.getSection(e);if("imageName"in r)continue;let n=t[r.fontStack]||={},i=o[e];Kf(i)&&(n[i]=!0);for(let e of i){if(n[e]=!0,!a)continue;let t=sd[e];t&&(n[t]=!0)}}}populate(e,t,r){let n=this.layers[0],i=n.layout,a=i.get("text-font"),s=i.get("text-field"),o=i.get("icon-image"),l=("constant"!==s.value.kind||s.value.value instanceof Gr&&!s.value.value.isEmpty()||s.value.value.toString().length>0)&&("constant"!==a.value.kind||a.value.value.length>0),u="constant"!==o.value.kind||!!o.value.value||Object.keys(o.parameters).length>0,h=i.get("symbol-sort-key");if(this.features=[],!l&&!u)return;let c=t.iconDependencies,p=t.glyphDependencies,f=t.availableImages,d=new zs(this.zoom);for(let{feature:t,id:s,index:o,sourceLayerIndex:y}of e){let e,m,g=n._featureFilter.needGeometry,x=Ql(t,g);if(!n._featureFilter.filter(d,x,r))continue;if(g||(x.geometry=Jl(t)),l){let t=n.getValueAndResolveTokens("text-field",x,r,f),i=Gr.factory(t);this.hasRTLText||=tm(i),e=Gf(i,n,x)}if(u){let e=n.getValueAndResolveTokens("icon-image",x,r,f);m=e instanceof Jr?e:Jr.fromString(e)}if(!e&&!m)continue;let v=this.sortFeaturesByKey?h.evaluate(x,{},r):void 0,b={id:s,text:e,icon:m,index:o,sourceLayerIndex:y,geometry:x.geometry,properties:t.properties,type:fc.types[t.type],sortKey:v};if(this.features.push(b),m&&(c[m.name]=!0),e){let t=a.evaluate(x,{},r).join(","),n="viewport"!==i.get("text-rotation-alignment")&&"point"!==i.get("symbol-placement");this.allowVerticalPlacement=this.writingModes?.includes(2);let s=Qf(e.toString());this.calculateGlyphDependencies(e,p,t,n,s);for(let t of e.sections)t.image&&(c[t.image.name]=!0)}}"line"===i.get("symbol-placement")&&(this.features=function(e){let t={},r={},n=[],i=0;function a(t){n.push(e[t]),i++}function s(e,t,i){let a=r[e];return delete r[e],r[t]=a,n[a].geometry[0].pop(),n[a].geometry[0]=n[a].geometry[0].concat(i[0]),a}function o(e,r,i){let a=t[r];return delete t[r],t[e]=a,n[a].geometry[0].shift(),n[a].geometry[0]=i[0].concat(n[a].geometry[0]),a}function l(e,t,r){let n=r?t[0][t[0].length-1]:t[0][0];return`${e}:${n.x}:${n.y}`}for(let u=0;u<e.length;u++){let h=e[u],c=h.geometry,p=h.text?h.text.toString():null;if(!p){a(u);continue}let f=l(p,c),d=l(p,c,!0);if(f in r&&d in t&&r[f]!==t[d]){let e=o(f,d,c),i=s(f,d,n[e].geometry);delete t[f],delete r[d],r[l(p,n[i].geometry,!0)]=i,n[e].geometry=null}else f in r?s(f,d,c):d in t?o(f,d,c):(a(u),t[f]=i-1,r[d]=i-1)}return n.filter(e=>e.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((e,t)=>e.sortKey-t.sortKey)}update(e,t,r){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,t,this.layers,{imagePositions:r}),this.icon.programConfigurations.updatePaintArrays(e,t,this.layers,{imagePositions:r}))}addFeatures({options:e,canonical:t,glyphMap:r,glyphPositions:n,iconMap:i,iconPositions:a,showCollisionBoxes:s}){!function(e){e.bucket.createArrays();let t=512*e.bucket.overscaling;e.bucket.tilePixelRatio=de/t,e.bucket.compareText={},e.bucket.iconsNeedLinear=!1;let r=e.bucket.layers[0],n=r.layout,i=r._unevaluatedLayout._values,a={layoutIconSize:i["icon-size"].possiblyEvaluate(new zs(e.bucket.zoom+1),e.canonical),layoutTextSize:i["text-size"].possiblyEvaluate(new zs(e.bucket.zoom+1),e.canonical),textMaxSize:i["text-size"].possiblyEvaluate(new zs(18))};if("composite"===e.bucket.textSizeData.kind){let{minZoom:t,maxZoom:r}=e.bucket.textSizeData;a.compositeTextSizes=[i["text-size"].possiblyEvaluate(new zs(t),e.canonical),i["text-size"].possiblyEvaluate(new zs(r),e.canonical)]}if("composite"===e.bucket.iconSizeData.kind){let{minZoom:t,maxZoom:r}=e.bucket.iconSizeData;a.compositeIconSizes=[i["icon-size"].possiblyEvaluate(new zs(t),e.canonical),i["icon-size"].possiblyEvaluate(new zs(r),e.canonical)]}let s=24*n.get("text-line-height"),o="viewport"!==n.get("text-rotation-alignment")&&"point"!==n.get("symbol-placement"),l=n.get("text-keep-upright"),u=n.get("text-size");for(let t of e.bucket.features){let i=n.get("text-font").evaluate(t,{},e.canonical).join(","),h=u.evaluate(t,{},e.canonical),c=a.layoutTextSize.evaluate(t,{},e.canonical),p=a.layoutIconSize.evaluate(t,{},e.canonical),f={horizontal:{},vertical:void 0},d=t.text,y=[0,0];if(d){let a=d.toString(),u=24*n.get("text-letter-spacing").evaluate(t,{},e.canonical),p=ed(a)?u:0,m=n.get("text-anchor").evaluate(t,{},e.canonical),g=Gy(r,t,e.canonical);if(!g){let r=n.get("text-radial-offset").evaluate(t,{},e.canonical);y=r?jy(m,[24*r,qy]):n.get("text-offset").evaluate(t,{},e.canonical).map(e=>24*e)}let x=o?"center":n.get("text-justify").evaluate(t,{},e.canonical),v="point"===n.get("symbol-placement")?24*n.get("text-max-width").evaluate(t,{},e.canonical):1/0,b=()=>{e.bucket.allowVerticalPlacement&&Qf(a)&&(f.vertical=Kd(d,e.glyphMap,e.glyphPositions,e.imagePositions,i,v,s,m,"left",p,y,2,!0,c,h))};if(!o&&g){let t=new Set;if("auto"===x)for(let e=0;e<g.values.length;e+=2)t.add(Xy(g.values[e]));else t.add(x);let r=!1;for(let n of t)if(!f.horizontal[n])if(r)f.horizontal[n]=f.horizontal[0];else{let t=Kd(d,e.glyphMap,e.glyphPositions,e.imagePositions,i,v,s,"center",n,p,y,1,!1,c,h);t&&(f.horizontal[n]=t,r=1===t.positionedLines.length)}b()}else{"auto"===x&&(x=Xy(m));let t=Kd(d,e.glyphMap,e.glyphPositions,e.imagePositions,i,v,s,m,x,p,y,1,!1,c,h);t&&(f.horizontal[x]=t),b(),Qf(a)&&o&&l&&(f.vertical=Kd(d,e.glyphMap,e.glyphPositions,e.imagePositions,i,v,s,m,x,p,y,2,!1,c,h))}}let m,g=!1;if(t.icon?.name){let r=e.imageMap[t.icon.name];r&&(m=hy(e.imagePositions[t.icon.name],n.get("icon-offset").evaluate(t,{},e.canonical),n.get("icon-anchor").evaluate(t,{},e.canonical)),g=!!r.sdf,void 0===e.bucket.sdfIcons?e.bucket.sdfIcons=g:e.bucket.sdfIcons!==g&&Je("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),r.pixelRatio===e.bucket.pixelRatio?0!==n.get("icon-rotate").constantOr(1)&&(e.bucket.iconsNeedLinear=!0):e.bucket.iconsNeedLinear=!0)}let x=Wy(f.horizontal)||f.vertical;e.bucket.iconsInText||=!!x&&x.iconsInText,(x||m)&&Yy(e.bucket,t,f,m,e.imageMap,a,c,p,y,g,e.canonical,e.subdivisionGranularity)}e.showCollisionBoxes&&e.bucket.generateCollisionDebugBuffers()}({bucket:this,glyphMap:r,glyphPositions:n,imageMap:i,imagePositions:a,showCollisionBoxes:s,canonical:t,subdivisionGranularity:e.subdivisionGranularity})}isEmpty(){return 0===this.symbolInstances.length}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,t){let r=this.lineVertexArray.length;if(void 0!==e.segment){let r=e.dist(t[e.segment+1]),n=e.dist(t[e.segment]),i={};for(let n=e.segment+1;n<t.length;n++)i[n]={x:t[n].x,y:t[n].y,tileUnitDistanceFromAnchor:r},n<t.length-1&&(r+=t[n+1].dist(t[n]));for(let r=e.segment||0;r>=0;r--)i[r]={x:t[r].x,y:t[r].y,tileUnitDistanceFromAnchor:n},r>0&&(n+=t[r-1].dist(t[r]));for(let e=0;e<t.length;e++){let t=i[e];this.lineVertexArray.emplaceBack(t.x,t.y,t.tileUnitDistanceFromAnchor)}}return{lineStartIndex:r,lineLength:this.lineVertexArray.length-r}}addSymbols(e,t,r,n,i,a,s,o,l,u,h,c,p){let f=e.indexArray,d=e.layoutVertexArray,y=e.segments.prepareSegment(4*t.length,d,f,this.canOverlap?a.sortKey:void 0),m=this.glyphOffsetArray.length,g=y.vertexLength,x=this.allowVerticalPlacement&&2===s?Math.PI/2:0,v=a.text&&a.text.sections;for(let n=0;n<t.length;n++){let{tl:i,tr:s,bl:l,br:u,tex:h,pixelOffsetTL:m,pixelOffsetBR:g,minFontScaleX:b,minFontScaleY:w,glyphOffset:D,isSDF:_,sectionIndex:A}=t[n],E=y.vertexLength,S=D[1];Qy(d,o.x,o.y,i.x,S+i.y,h.x,h.y,r,_,m.x,m.y,b,w,p),Qy(d,o.x,o.y,s.x,S+s.y,h.x+h.w,h.y,r,_,g.x,m.y,b,w,p),Qy(d,o.x,o.y,l.x,S+l.y,h.x,h.y+h.h,r,_,m.x,g.y,b,w,p),Qy(d,o.x,o.y,u.x,S+u.y,h.x+h.w,h.y+h.h,r,_,g.x,g.y,b,w,p),em(e.dynamicLayoutVertexArray,o,x),f.emplaceBack(E,E+2,E+1),f.emplaceBack(E+1,E+2,E+3),y.vertexLength+=4,y.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(D[0]),(n===t.length-1||A!==t[n+1].sectionIndex)&&e.programConfigurations.populatePaintArrays(d.length,a,a.index,{imagePositions:{},canonical:c,formattedSection:v?.[A]})}e.placedSymbolArray.emplaceBack(o.x,o.y,m,this.glyphOffsetArray.length-m,g,l,u,o.segment,r?r[0]:0,r?r[1]:0,n[0],n[1],s,0,!1,0,h,p)}_addCollisionDebugVertex(e,t,r,n,i,a){return t.emplaceBack(0,0),e.emplaceBack(r.x,r.y,n,i,Math.round(a.x),Math.round(a.y))}addCollisionDebugVertices(e,t,r,n,i,a,s){let o=i.segments.prepareSegment(4,i.layoutVertexArray,i.indexArray),u=o.vertexLength,h=i.layoutVertexArray,c=i.collisionVertexArray,p=s.anchorX,f=s.anchorY;this._addCollisionDebugVertex(h,c,a,p,f,new l(e,t)),this._addCollisionDebugVertex(h,c,a,p,f,new l(r,t)),this._addCollisionDebugVertex(h,c,a,p,f,new l(r,n)),this._addCollisionDebugVertex(h,c,a,p,f,new l(e,n)),o.vertexLength+=4;let d=i.indexArray;d.emplaceBack(u,u+1),d.emplaceBack(u+1,u+2),d.emplaceBack(u+2,u+3),d.emplaceBack(u+3,u),o.primitiveLength+=4}addDebugCollisionBoxes(e,t,r,n){for(let i=e;i<t;i++){let e=this.collisionBoxArray.get(i),t=e.x1,a=e.y1,s=e.x2,o=e.y2;this.addCollisionDebugVertices(t,a,s,o,n?this.textCollisionBox:this.iconCollisionBox,e.anchorPoint,r)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new nm(ol,Ef.members,pl),this.iconCollisionBox=new nm(ol,Ef.members,pl);for(let e=0;e<this.symbolInstances.length;e++){let t=this.symbolInstances.get(e);this.addDebugCollisionBoxes(t.textBoxStartIndex,t.textBoxEndIndex,t,!0),this.addDebugCollisionBoxes(t.verticalTextBoxStartIndex,t.verticalTextBoxEndIndex,t,!0),this.addDebugCollisionBoxes(t.iconBoxStartIndex,t.iconBoxEndIndex,t,!1),this.addDebugCollisionBoxes(t.verticalIconBoxStartIndex,t.verticalIconBoxEndIndex,t,!1)}}_deserializeCollisionBoxesForSymbol(e,t,r,n,i,a,s,o,l){let u={};for(let n=t;n<r;n++){let t=e.get(n);u.textBox={x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,anchorPointX:t.anchorPointX,anchorPointY:t.anchorPointY},u.textFeatureIndex=t.featureIndex;break}for(let t=n;t<i;t++){let r=e.get(t);u.verticalTextBox={x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2,anchorPointX:r.anchorPointX,anchorPointY:r.anchorPointY},u.verticalTextFeatureIndex=r.featureIndex;break}for(let t=a;t<s;t++){let r=e.get(t);u.iconBox={x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2,anchorPointX:r.anchorPointX,anchorPointY:r.anchorPointY},u.iconFeatureIndex=r.featureIndex;break}for(let t=o;t<l;t++){let r=e.get(t);u.verticalIconBox={x1:r.x1,y1:r.y1,x2:r.x2,y2:r.y2,anchorPointX:r.anchorPointX,anchorPointY:r.anchorPointY},u.verticalIconFeatureIndex=r.featureIndex;break}return u}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let t=0;t<this.symbolInstances.length;t++){let r=this.symbolInstances.get(t);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,r.textBoxStartIndex,r.textBoxEndIndex,r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r.iconBoxStartIndex,r.iconBoxEndIndex,r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(e,t){let r=e.placedSymbolArray.get(t),n=r.vertexStartIndex+4*r.numGlyphs;for(let t=r.vertexStartIndex;t<n;t+=4)e.indexArray.emplaceBack(t,t+2,t+1),e.indexArray.emplaceBack(t+1,t+2,t+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;let t=Math.sin(e),r=Math.cos(e),n=[],i=[],a=[];for(let e=0;e<this.symbolInstances.length;++e){a.push(e);let s=this.symbolInstances.get(e);n.push(0|Math.round(t*s.anchorX+r*s.anchorY)),i.push(s.featureIndex)}return a.sort((e,t)=>n[e]-n[t]||i[t]-i[e]),a}addToSortKeyRanges(e,t){let r=this.sortKeyRanges[this.sortKeyRanges.length-1];r?.sortKey===t?r.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:t,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let e of this.symbolInstanceIndexes){let t=this.symbolInstances.get(e);this.featureSortOrder.push(t.featureIndex);let r=[t.rightJustifiedTextSymbolIndex,t.centerJustifiedTextSymbolIndex,t.leftJustifiedTextSymbolIndex];for(let e=0;e<r.length;e++){let t=r[e];t>=0&&r.indexOf(t)===e&&this.addIndicesForPlacedSymbol(this.text,t)}t.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,t.verticalPlacedTextSymbolIndex),t.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,t.placedIconSymbolIndex),t.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,t.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}};let am,sm;ks("SymbolBucket",im,{omit:["layers","collisionBoxArray","features","compareText"]});var om={get paint(){return sm||=new Js({"icon-opacity":new Zs(Zt.paint_symbol["icon-opacity"],"icon-opacity"),"icon-color":new Zs(Zt.paint_symbol["icon-color"],"icon-color"),"icon-halo-color":new Zs(Zt.paint_symbol["icon-halo-color"],"icon-halo-color"),"icon-halo-width":new Zs(Zt.paint_symbol["icon-halo-width"],"icon-halo-width"),"icon-halo-blur":new Zs(Zt.paint_symbol["icon-halo-blur"],"icon-halo-blur"),"icon-translate":new Ys(Zt.paint_symbol["icon-translate"],"icon-translate"),"icon-translate-anchor":new Ys(Zt.paint_symbol["icon-translate-anchor"],"icon-translate-anchor"),"text-opacity":new Zs(Zt.paint_symbol["text-opacity"],"text-opacity"),"text-color":new Zs(Zt.paint_symbol["text-color"],"text-color",{runtimeType:tr,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new Zs(Zt.paint_symbol["text-halo-color"],"text-halo-color"),"text-halo-width":new Zs(Zt.paint_symbol["text-halo-width"],"text-halo-width"),"text-halo-blur":new Zs(Zt.paint_symbol["text-halo-blur"],"text-halo-blur"),"text-translate":new Ys(Zt.paint_symbol["text-translate"],"text-translate"),"text-translate-anchor":new Ys(Zt.paint_symbol["text-translate-anchor"],"text-translate-anchor")})},get layout(){return am||=new Js({"symbol-placement":new Ys(Zt.layout_symbol["symbol-placement"],"symbol-placement"),"symbol-spacing":new Ys(Zt.layout_symbol["symbol-spacing"],"symbol-spacing"),"symbol-avoid-edges":new Ys(Zt.layout_symbol["symbol-avoid-edges"],"symbol-avoid-edges"),"symbol-sort-key":new Zs(Zt.layout_symbol["symbol-sort-key"],"symbol-sort-key"),"symbol-z-order":new Ys(Zt.layout_symbol["symbol-z-order"],"symbol-z-order"),"icon-allow-overlap":new Ys(Zt.layout_symbol["icon-allow-overlap"],"icon-allow-overlap"),"icon-overlap":new Ys(Zt.layout_symbol["icon-overlap"],"icon-overlap"),"icon-ignore-placement":new Ys(Zt.layout_symbol["icon-ignore-placement"],"icon-ignore-placement"),"icon-optional":new Ys(Zt.layout_symbol["icon-optional"],"icon-optional"),"icon-rotation-alignment":new Zs(Zt.layout_symbol["icon-rotation-alignment"],"icon-rotation-alignment"),"icon-size":new Zs(Zt.layout_symbol["icon-size"],"icon-size"),"icon-text-fit":new Ys(Zt.layout_symbol["icon-text-fit"],"icon-text-fit"),"icon-text-fit-padding":new Ys(Zt.layout_symbol["icon-text-fit-padding"],"icon-text-fit-padding"),"icon-image":new Zs(Zt.layout_symbol["icon-image"],"icon-image"),"icon-rotate":new Zs(Zt.layout_symbol["icon-rotate"],"icon-rotate"),"icon-padding":new Zs(Zt.layout_symbol["icon-padding"],"icon-padding"),"icon-keep-upright":new Ys(Zt.layout_symbol["icon-keep-upright"],"icon-keep-upright"),"icon-offset":new Zs(Zt.layout_symbol["icon-offset"],"icon-offset"),"icon-anchor":new Zs(Zt.layout_symbol["icon-anchor"],"icon-anchor"),"icon-pitch-alignment":new Ys(Zt.layout_symbol["icon-pitch-alignment"],"icon-pitch-alignment"),"text-pitch-alignment":new Ys(Zt.layout_symbol["text-pitch-alignment"],"text-pitch-alignment"),"text-rotation-alignment":new Ys(Zt.layout_symbol["text-rotation-alignment"],"text-rotation-alignment"),"text-field":new Zs(Zt.layout_symbol["text-field"],"text-field"),"text-font":new Zs(Zt.layout_symbol["text-font"],"text-font"),"text-size":new Zs(Zt.layout_symbol["text-size"],"text-size"),"text-max-width":new Zs(Zt.layout_symbol["text-max-width"],"text-max-width"),"text-line-height":new Ys(Zt.layout_symbol["text-line-height"],"text-line-height"),"text-letter-spacing":new Zs(Zt.layout_symbol["text-letter-spacing"],"text-letter-spacing"),"text-justify":new Zs(Zt.layout_symbol["text-justify"],"text-justify"),"text-radial-offset":new Zs(Zt.layout_symbol["text-radial-offset"],"text-radial-offset"),"text-variable-anchor":new Ys(Zt.layout_symbol["text-variable-anchor"],"text-variable-anchor"),"text-variable-anchor-offset":new Zs(Zt.layout_symbol["text-variable-anchor-offset"],"text-variable-anchor-offset"),"text-anchor":new Zs(Zt.layout_symbol["text-anchor"],"text-anchor"),"text-max-angle":new Ys(Zt.layout_symbol["text-max-angle"],"text-max-angle"),"text-writing-mode":new Ys(Zt.layout_symbol["text-writing-mode"],"text-writing-mode"),"text-rotate":new Zs(Zt.layout_symbol["text-rotate"],"text-rotate"),"text-padding":new Ys(Zt.layout_symbol["text-padding"],"text-padding"),"text-keep-upright":new Ys(Zt.layout_symbol["text-keep-upright"],"text-keep-upright"),"text-transform":new Zs(Zt.layout_symbol["text-transform"],"text-transform"),"text-offset":new Zs(Zt.layout_symbol["text-offset"],"text-offset"),"text-allow-overlap":new Ys(Zt.layout_symbol["text-allow-overlap"],"text-allow-overlap"),"text-overlap":new Ys(Zt.layout_symbol["text-overlap"],"text-overlap"),"text-ignore-placement":new Ys(Zt.layout_symbol["text-ignore-placement"],"text-ignore-placement"),"text-optional":new Ys(Zt.layout_symbol["text-optional"],"text-optional"),"symbol-height-offset":new Zs(Zt.layout_symbol["symbol-height-offset"],"symbol-height-offset"),"symbol-height-anchor":new Ys(Zt.layout_symbol["symbol-height-anchor"],"symbol-height-anchor")})}},lm=class{constructor(e){if(void 0===e.property.overrides)throw Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:Kt,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){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}};ks("FormatSectionOverride",lm,{omit:["defaultValue"]});const um=e=>"symbol"===e.type;var hm=class e extends to{constructor(e,t){super(e,om,t)}recalculate(e,t){super.recalculate(e,t);let r=this.layout.get("icon-rotation-alignment");if(("constant"!==r.value.kind||"auto"===r.value.value)&&(this.layout._values["icon-rotation-alignment"]=new qs(r.property,{kind:"constant",value:"point"===this.layout.get("symbol-placement")?"viewport":"map"},r.parameters)),"auto"===this.layout.get("text-rotation-alignment")&&("point"===this.layout.get("symbol-placement")?this.layout._values["text-rotation-alignment"]="viewport":this.layout._values["text-rotation-alignment"]="map"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]="map"===this.layout.get("text-rotation-alignment")?"map":"viewport"),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment").constantOr("viewport")),"point"===this.layout.get("symbol-placement")){let e=this.layout.get("text-writing-mode");if(e){let t=[];for(let r of e)t.includes(r)||t.push(r);this.layout._values["text-writing-mode"]=t}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,t,r,n){let i=this.layout.get(e).evaluate(t,{},r,n),a=this._unevaluatedLayout._values[e];return a.isDataDriven()||ha(a.value)||!i?i:function(e,t){return t.replace(/{([^{}]+)}/g,(t,r)=>e&&r in e?String(e[r]):"")}(t.properties,i)}createBucket(e){return new im(e)}queryRadius(){return 0}queryIntersectsFeature(){throw Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let t of om.paint.overridableProperties){if(!e.hasPaintOverride(this.layout,t))continue;let r=this.paint.get(t),n=new oa(new lm(r),`layers[${this.id}].paint.${r.property.name}`,r.property.specification),i=null;i="constant"===r.value.kind||"source"===r.value.kind?new pa("source",n):new fa("composite",n,r.value.zoomStops),this.paint._values[t]=new qs(r.property,i,r.parameters)}}_handleOverridablePaintPropertyUpdate(t,r,n){return!(!this.layout||r.isDataDriven()||n.isDataDriven())&&e.hasPaintOverride(this.layout,t)}static hasPaintOverride(e,t){let r=e.get("text-field"),n=om.paint.properties[t],i=!1,a=e=>{for(let t of e)if(n.overrides?.hasOverride(t))return void(i=!0)};if("constant"===r.value.kind&&r.value.value instanceof Gr)a(r.value.value.sections);else if("source"===r.value.kind||"composite"===r.value.kind){let e=t=>{if(!i)if(t instanceof sn&&nn(t.value)===sr){let e=t.value;a(e.sections)}else t instanceof dn?a(t.sections):t.eachChild(e)},t=r.value;t._styleExpression&&e(t._styleExpression.expression)}return i}};let cm;var pm={get paint(){return cm||=new Js({"background-color":new Ys(Zt.paint_background["background-color"],"background-color"),"background-pattern":new Hs(Zt.paint_background["background-pattern"],"background-pattern"),"background-opacity":new Ys(Zt.paint_background["background-opacity"],"background-opacity")})}};const fm=e=>"background"===e.type;var dm=class extends to{constructor(e,t){super(e,pm,t)}};function ym(e){let t=[],r=e.id;return void 0===r&&t.push(new Ht(`layers.${r}`,null,'missing required property "id"')),void 0===e.render&&t.push(new Ht(`layers.${r}`,null,'missing required method "render"')),e.renderingMode&&"2d"!==e.renderingMode&&"3d"!==e.renderingMode&&t.push(new Ht(`layers.${r}`,null,'property "renderingMode" must be either "2d" or "3d"')),t}const mm=e=>"custom"===e.type;var gm=class extends to{constructor(e,t){super(e,{},t),this.onAdd=e=>{this.implementation.onAdd&&this.implementation.onAdd(e,e.painter.context.gl)},this.onRemove=e=>{this.implementation.onRemove&&this.implementation.onRemove(e,e.painter.context.gl)},this.implementation=e}is3D(){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw Error("Custom layers cannot be serialized")}};function xm(e,t){if("custom"===e.type)return new gm(e,t);switch(e.type){case"background":return new dm(e,t);case"circle":return new Iu(e,t);case"color-relief":return new eh(e,t);case"fill":return new ac(e,t);case"fill-extrusion":return new Wc(e,t);case"heatmap":return new Uu(e,t);case"hillshade":return new Xu(e,t);case"line":return new bf(e,t);case"raster":return new ao(e,t);case"symbol":return new hm(e,t)}}var vm=class{constructor(e){this._methodToThrottle=e,this._triggered=!1,this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()}}trigger(){this._triggered||(this._triggered=!0,this._channel?.port1.postMessage(!0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}};const bm={once:!0};var wm=class{constructor(e,t){this.target=e,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new vm(()=>this.process()),this.subscription=ft(this.target,"message",e=>this.receive(e),!1),this.globalScope=rt(self)?e:window}registerMessageHandler(e,t){this.messageHandlers[e]=t}unregisterMessageHandler(e){delete this.messageHandlers[e]}sendAsync(e,t){return new Promise((r,n)=>{let i=Math.round(1e18*Math.random()).toString(36).substring(0,10),a=t?ft(t.signal,"abort",()=>{a?.unsubscribe(),delete this.resolveRejects[i];let r={id:i,type:"<cancel>",origin:location.origin,targetMapId:e.targetMapId,sourceMapId:this.mapId};this.target.postMessage(r),n(new Ft(t.signal.reason))},bm):null;this.resolveRejects[i]={resolve:e=>{a?.unsubscribe(),r(e)},reject:e=>{a?.unsubscribe(),n(e)}};let s=[],o={...e,id:i,sourceMapId:this.mapId,origin:location.origin,data:Cs(e.data,s)};this.target.postMessage(o,{transfer:s})})}receive(e){let t=e.data,r=t.id,n=["file://","resource://android","null"],i=[t.origin,location.origin],a=t.origin===location.origin,s=i.some(e=>n.includes(e));if((a||s)&&(!t.targetMapId||this.mapId===t.targetMapId)){if("<cancel>"===t.type){delete this.tasks[r];let e=this.abortControllers[r];return delete this.abortControllers[r],void(e&&e.abort())}if(rt(self)||t.mustQueue)return this.tasks[r]=t,this.taskQueue.push(r),void this.invoker.trigger();this.processTask(r,t)}}process(){if(0===this.taskQueue.length)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("<response>"===t.type){let r=this.resolveRejects[e];if(delete this.resolveRejects[e],!r)return;return void(t.error?r.reject(ge(Bs(t.error))):r.resolve(Bs(t.data)))}if(!this.messageHandlers[t.type])return void this.completeTask(e,null,null);let r=Bs(t.data),n=new AbortController;this.abortControllers[e]=n;try{let i=await this.messageHandlers[t.type](t.sourceMapId,r,n);this.completeTask(e,null,i)}catch(t){this.completeTask(e,ge(t))}}completeTask(e,t,r){let n=[];delete this.abortControllers[e];let i={id:e,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:t?Cs(t):null,data:Cs(r,n)};this.target.postMessage(i,{transfer:n})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}};function Dm(e,t){let{x:r,y:n}=Ic.fromLngLat(t);return!(e<0||e>25||n<0||n>=1||r<0||r>=1)}var _m=class{constructor(e,t,r){if(!function(e,t,r){return!(e<0||e>25||r<0||r>=2**e||t<0||t>=2**e)}(e,t,r))throw Error(`x=${t}, y=${r}, z=${e} outside of bounds. 0<=x<${2**e}, 0<=y<${2**e} 0<=z<=25 `);this.z=e,this.x=t,this.y=r,this.key=Sm(0,e,e,t,r)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,t,r){let n=function(e,t,r){let n=km(256*e,256*(t=2**r-t-1),r),i=km(256*(e+1),256*(t+1),r);return`${n[0]},${n[1]},${i[0]},${i[1]}`}(this.x,this.y,this.z),i=function(e,t,r){let n="";for(let i=e;i>0;i--){let e=1<<i-1;n+=(t&e?1:0)+(r&e?2:0)}return n}(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String("tms"===r?2**this.z-this.y-1:this.y)).replace(/{ratio}/g,t>1?"@2x":"").replace(/{quadkey}/g,i).replace(/{bbox-epsg-3857}/g,n)}isChildOf(e){let t=this.z-e.z;return t>0&&e.x===this.x>>t&&e.y===this.y>>t}getTilePoint(e){let t=2**this.z;return new l((e.x*t-this.x)*de,(e.y*t-this.y)*de)}toString(){return`${this.z}/${this.x}/${this.y}`}},Am=class{constructor(e,t){this.wrap=e,this.canonical=t,this.key=Sm(e,t.z,t.z,t.x,t.y)}},Em=class e{constructor(e,t,r,n,i){if(this.terrainRttPosMatrix32f=null,e<r)throw Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${r}`);this.overscaledZ=e,this.wrap=t,this.canonical=new _m(r,+n,+i),this.key=Sm(t,e,r,n,i)}clone(){return new e(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(t){if(t>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);let r=this.canonical.z-t;return t>this.canonical.z?new e(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new e(t,this.wrap,t,this.canonical.x>>r,this.canonical.y>>r)}isOverscaled(){return this.overscaledZ>this.canonical.z}calculateScaledKey(e,t){if(e>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);let r=this.canonical.z-e;return e>this.canonical.z?Sm(this.wrap*+t,e,this.canonical.z,this.canonical.x,this.canonical.y):Sm(this.wrap*+t,e,e,this.canonical.x>>r,this.canonical.y>>r)}isChildOf(e){if(e.wrap!==this.wrap||this.overscaledZ-e.overscaledZ<=0)return!1;if(0===e.overscaledZ)return this.overscaledZ>0;let t=this.canonical.z-e.canonical.z;return!(t<0)&&e.canonical.x===this.canonical.x>>t&&e.canonical.y===this.canonical.y>>t}children(t){if(this.overscaledZ>=t)return[new e(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let r=this.canonical.z+1,n=2*this.canonical.x,i=2*this.canonical.y;return[new e(r,this.wrap,r,n,i),new e(r,this.wrap,r,n+1,i),new e(r,this.wrap,r,n,i+1),new e(r,this.wrap,r,n+1,i+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new e(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new e(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return 2**(this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Am(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new Ic(e.x-this.wrap,e.y))}normalizeCoordinates(t,r,n=de){if(t>=0&&t<n&&r>=0&&r<n)return{tileID:this,x:t,y:r};let i=Math.floor(t/n),a=Math.floor(r/n),s=t-i*n,o=r-a*n,l=this.canonical.z,u=1<<l,h=this.canonical.y+a;if(h<0||h>=u)return null;let c=this.canonical.x+i,p=this.wrap;return c<0?(p-=Math.ceil(-c/u),c=(c%u+u)%u):c>=u&&(p+=Math.floor(c/u),c%=u),{tileID:new e(this.overscaledZ,p,l,c,h),x:s,y:o}}};function Sm(e,t,r,n,i){(e*=2)<0&&(e=-1*e-1);let a=1<<r;return(a*a*e+a*i+n).toString(36)+r.toString(36)+t.toString(36)}const Fm=6378137*Math.PI;function km(e,t,r){let n=2*Fm/256/2**r;return[e*n-Fm,t*n-Fm]}function Im(e,t){let r=Math.abs(2*e.wrap)-+(e.wrap<0),n=Math.abs(2*t.wrap)-+(t.wrap<0);return e.overscaledZ-t.overscaledZ||n-r||t.canonical.y-e.canonical.y||t.canonical.x-e.canonical.x}ks("CanonicalTileID",_m),ks("OverscaledTileID",Em,{omit:["terrainRttPosMatrix32f"]});var Tm=class{constructor(e,t){this.feature=e,this.type=e.type,this.properties=e.tags?e.tags:{},this.extent=t,"id"in e&&("string"==typeof e.id?this.id=parseInt(e.id,10):"number"==typeof e.id&&!isNaN(e.id)&&(this.id=e.id))}loadGeometry(){let e=[],t=1===this.feature.type?[this.feature.geometry]:this.feature.geometry;for(let r of t){let t=[];for(let e of r)t.push(new l(e[0],e[1]));e.push(t)}return e}};const Mm="_geojsonTileLayer";var Cm=class{constructor(e,t){this.layers={[Mm]:this},this.name=Mm,this.version=t?t.version:1,this.extent=t?t.extent:4096,this.length=e.length,this.features=e}feature(e){return new Tm(this.features[e],this.extent)}};function Bm(e,t=""){let r=new Sd;return function(e,t,r=""){for(let n in e.layers)t.writeMessage(3,(e,t)=>Pm(e,t,r),e.layers[n])}(e,r,t),r.finish()}function Pm(e,t,r=""){t.writeVarintField(15,e.version||1),t.writeStringField(1,e.name||""),t.writeVarintField(5,e.extent||4096);let n={jsonPrefix:r,keys:[],values:[],keycache:{},valuecache:{}};for(let r=0;r<e.length;r++)n.feature=e.feature(r),t.writeMessage(2,zm,n);let i=n.keys;for(let e of i)t.writeStringField(3,e);let a=n.values;for(let e of a)t.writeMessage(4,$m,e)}function zm(e,t){if(!e.feature)return;let r=e.feature;void 0!==r.id&&t.writeVarintField(1,r.id),t.writeMessage(2,Vm,e),t.writeVarintField(3,r.type),t.writeMessage(4,Rm,r)}function Vm(e,t){for(let r in e.feature?.properties){let n=e.feature.properties[r],i=e.keycache[r];if(null==n)continue;void 0===i&&(e.keys.push(r),i=e.keys.length-1,e.keycache[r]=i),t.writeVarint(i),"string"!=typeof n&&"boolean"!=typeof n&&"number"!=typeof n&&(n=e.jsonPrefix+JSON.stringify(n));let a=typeof n+":"+n,s=e.valuecache[a];void 0===s&&(e.values.push(n),s=e.values.length-1,e.valuecache[a]=s),t.writeVarint(s)}}function Lm(e,t){return(t<<3)+(7&e)}function Om(e){return e<<1^e>>31}function Rm(e,t){let r=e.loadGeometry(),n=e.type,i=0,a=0;for(let s of r){let r=1;1===n&&(r=s.length),t.writeVarint(Lm(1,r));let o=3===n?s.length-1:s.length;for(let e=0;e<o;e++){1===e&&1!==n&&t.writeVarint(Lm(2,o-1));let r=s[e].x-i,l=s[e].y-a;t.writeVarint(Om(r)),t.writeVarint(Om(l)),i+=r,a+=l}3===e.type&&t.writeVarint(Lm(7,1))}}function $m(e,t){let r=typeof e;"string"===r?t.writeStringField(1,e):"boolean"===r?t.writeBooleanField(7,e):"number"===r&&(e%1==0?e<0?t.writeSVarintField(6,e):t.writeVarintField(5,e):t.writeDoubleField(3,e))}var Nm=class{constructor(e){this._stringToNumber={},this._numberToString=[];for(let t=0;t<e.length;t++){let r=e[t];this._stringToNumber[r]=t,this._numberToString[t]=r}}encode(e){return this._stringToNumber[e]}decode(e){if(e>=this._numberToString.length)throw Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}},Um=class{constructor(e,t,r,n,i){this.type="Feature",this._vectorTileFeature=e,this._x=r,this._y=n,this._z=t;for(let t in e.properties)"string"==typeof e.properties[t]&&e.properties[t].startsWith("__$json__:")&&(e.properties[t]=JSON.parse(e.properties[t].slice(10)));this.properties=e.properties,this.id=i}projectPoint(e,t,r,n){return[360*(e.x+t)/n-180,360/Math.PI*Math.atan(Math.exp((1-2*(e.y+r)/n)*Math.PI))-90]}projectLine(e,t,r,n){return e.map(e=>this.projectPoint(e,t,r,n))}get geometry(){if(this._geometry)return this._geometry;let e=this._vectorTileFeature,t=e.extent*2**this._z,r=e.extent*this._x,n=e.extent*this._y,i=e.loadGeometry();switch(e.type){case 1:{let e=[];for(let t of i)e.push(t[0]);let a=this.projectLine(e,r,n,t);this._geometry=1===e.length?{type:"Point",coordinates:a[0]}:{type:"MultiPoint",coordinates:a};break}case 2:{let e=i.map(e=>this.projectLine(e,r,n,t));this._geometry=1===e.length?{type:"LineString",coordinates:e[0]}:{type:"MultiLineString",coordinates:e};break}case 3:{let e=dc(i),a=[];for(let i of e)a.push(i.map(e=>this.projectLine(e,r,n,t)));this._geometry=1===a.length?{type:"Polygon",coordinates:a[0]}:{type:"MultiPolygon",coordinates:a};break}default:throw Error(`unknown feature type: ${e.type}`)}return this._geometry}set geometry(e){this._geometry=e}toJSON(){let e={geometry:this.geometry};for(let t in this)"_geometry"!==t&&"_vectorTileFeature"!==t&&"_x"!==t&&"_y"!==t&&"_z"!==t&&(e[t]=this[t]);return e}},qm=class{constructor(e,t,r){this._name=e,this.dataBuffer=t,"number"==typeof r?this._size=r:(this.nullabilityBuffer=r,this._size=r.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}},jm=class extends qm{},Gm=class extends jm{getValueFromBuffer(e){return this.dataBuffer[e]}},Xm=class extends jm{getValueFromBuffer(e){return this.dataBuffer[e]}},Ym=class extends qm{constructor(e,t,r,n){super(e,t,n),this.delta=r}},Zm=class extends Ym{constructor(e,t,r,n,i){super(e,i?Int32Array.of(t):Uint32Array.of(t),r,n)}getValueFromBuffer(e){return this.dataBuffer[0]+e*this.delta}},Wm=class extends qm{constructor(e,t,r,n){super(e,n?Int32Array.of(t):Uint32Array.of(t),r)}getValueFromBuffer(e){return this.dataBuffer[0]}},Hm=class{constructor(e,t,r,n,i=4096){if(this._name=e,this._geometryVector=t,this._idVector=r,this._propertyVectors=n,this._extent=i,0===e.length)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(e=>[e.name,e])),this.propertyVectorsMap.get(e)}get numFeatures(){return this.geometryVector.numGeometries}get extent(){return this._extent}getFeatures(){let e=[],t=this.geometryVector.getGeometries();for(let r=0;r<this.numFeatures;r++){let n;if(this.idVector){let e=this.idVector.getValue(r);null!==e&&(n=this.containsMaxSafeIntegerValues(this.idVector)?Number(e):e)}let i={coordinates:t[r],type:this.geometryVector.geometryType(r)},a={};for(let e of this.propertyVectors){if(!e)continue;let t=e.name,n=e.getValue(r);null!==n&&(a[t]=n)}e.push({id:n,geometry:i,properties:a})}return e}containsMaxSafeIntegerValues(e){return e instanceof Gm||e instanceof Wm||e instanceof Zm||e instanceof Xm}};var Km,Jm,Qm=class{constructor(e){this.value=e}get(){return this.value}set(e){this.value=e}increment(){return this.value++}add(e){this.value+=e}};!function(e){e.NONE="NONE",e.DELTA="DELTA",e.COMPONENTWISE_DELTA="COMPONENTWISE_DELTA",e.RLE="RLE",e.MORTON="MORTON"}(Km||={}),function(e){e.NONE="NONE",e.FAST_PFOR="FAST_PFOR",e.VARINT="VARINT"}(Jm||={});const eg=new Uint32Array(33);eg[0]=0;for(let e=1;e<=32;e++)eg[e]=32===e?4294967295:4294967295>>>32-e;const tg=eg;function rg(e,t){return e-e%t}function ng(e){return rg(e+31,32)}function ig(e){let t=e>>>0;return((255&t)<<24|(65280&t)<<8|t>>>8&65280|t>>>24&255)>>>0}const ag=function(e){if(!Number.isFinite(e))return 65536;let t=rg(Math.floor(e),256);return 0===t?256:t}(65536),sg=3*ag/256+ag|0;function og(){let e=new Uint8Array(sg);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 lg(e,t,r,n,i){switch(i){case 1:!function(e,t,r,n){let i=n,a=t;for(let t=0;t<8;t++){let t=e[a++]>>>0;r[i++]=t>>>0&1,r[i++]=t>>>1&1,r[i++]=t>>>2&1,r[i++]=t>>>3&1,r[i++]=t>>>4&1,r[i++]=t>>>5&1,r[i++]=t>>>6&1,r[i++]=t>>>7&1,r[i++]=t>>>8&1,r[i++]=t>>>9&1,r[i++]=t>>>10&1,r[i++]=t>>>11&1,r[i++]=t>>>12&1,r[i++]=t>>>13&1,r[i++]=t>>>14&1,r[i++]=t>>>15&1,r[i++]=t>>>16&1,r[i++]=t>>>17&1,r[i++]=t>>>18&1,r[i++]=t>>>19&1,r[i++]=t>>>20&1,r[i++]=t>>>21&1,r[i++]=t>>>22&1,r[i++]=t>>>23&1,r[i++]=t>>>24&1,r[i++]=t>>>25&1,r[i++]=t>>>26&1,r[i++]=t>>>27&1,r[i++]=t>>>28&1,r[i++]=t>>>29&1,r[i++]=t>>>30&1,r[i++]=t>>>31&1}}(e,t,r,n);break;case 2:!function(e,t,r,n){let i=n,a=t;for(let t=0;t<8;t++){let t=e[a++]>>>0,n=e[a++]>>>0;r[i++]=t>>>0&3,r[i++]=t>>>2&3,r[i++]=t>>>4&3,r[i++]=t>>>6&3,r[i++]=t>>>8&3,r[i++]=t>>>10&3,r[i++]=t>>>12&3,r[i++]=t>>>14&3,r[i++]=t>>>16&3,r[i++]=t>>>18&3,r[i++]=t>>>20&3,r[i++]=t>>>22&3,r[i++]=t>>>24&3,r[i++]=t>>>26&3,r[i++]=t>>>28&3,r[i++]=t>>>30&3,r[i++]=n>>>0&3,r[i++]=n>>>2&3,r[i++]=n>>>4&3,r[i++]=n>>>6&3,r[i++]=n>>>8&3,r[i++]=n>>>10&3,r[i++]=n>>>12&3,r[i++]=n>>>14&3,r[i++]=n>>>16&3,r[i++]=n>>>18&3,r[i++]=n>>>20&3,r[i++]=n>>>22&3,r[i++]=n>>>24&3,r[i++]=n>>>26&3,r[i++]=n>>>28&3,r[i++]=n>>>30&3}}(e,t,r,n);break;case 3:!function(e,t,r,n){let i=n,a=t;for(let t=0;t<8;t++){let t=e[a++]>>>0,n=e[a++]>>>0,s=e[a++]>>>0;r[i++]=t>>>0&7,r[i++]=t>>>3&7,r[i++]=t>>>6&7,r[i++]=t>>>9&7,r[i++]=t>>>12&7,r[i++]=t>>>15&7,r[i++]=t>>>18&7,r[i++]=t>>>21&7,r[i++]=t>>>24&7,r[i++]=t>>>27&7,r[i++]=7&(t>>>30|(1&n)<<2),r[i++]=n>>>1&7,r[i++]=n>>>4&7,r[i++]=n>>>7&7,r[i++]=n>>>10&7,r[i++]=n>>>13&7,r[i++]=n>>>16&7,r[i++]=n>>>19&7,r[i++]=n>>>22&7,r[i++]=n>>>25&7,r[i++]=n>>>28&7,r[i++]=7&(n>>>31|(3&s)<<1),r[i++]=s>>>2&7,r[i++]=s>>>5&7,r[i++]=s>>>8&7,r[i++]=s>>>11&7,r[i++]=s>>>14&7,r[i++]=s>>>17&7,r[i++]=s>>>20&7,r[i++]=s>>>23&7,r[i++]=s>>>26&7,r[i++]=s>>>29&7}}(e,t,r,n);break;case 4:!function(e,t,r,n){let i=n,a=t;for(let t=0;t<8;t++){let t=e[a++]>>>0,n=e[a++]>>>0,s=e[a++]>>>0,o=e[a++]>>>0;r[i++]=t>>>0&15,r[i++]=t>>>4&15,r[i++]=t>>>8&15,r[i++]=t>>>12&15,r[i++]=t>>>16&15,r[i++]=t>>>20&15,r[i++]=t>>>24&15,r[i++]=t>>>28&15,r[i++]=n>>>0&15,r[i++]=n>>>4&15,r[i++]=n>>>8&15,r[i++]=n>>>12&15,r[i++]=n>>>16&15,r[i++]=n>>>20&15,r[i++]=n>>>24&15,r[i++]=n>>>28&15,r[i++]=s>>>0&15,r[i++]=s>>>4&15,r[i++]=s>>>8&15,r[i++]=s>>>12&15,r[i++]=s>>>16&15,r[i++]=s>>>20&15,r[i++]=s>>>24&15,r[i++]=s>>>28&15,r[i++]=o>>>0&15,r[i++]=o>>>4&15,r[i++]=o>>>8&15,r[i++]=o>>>12&15,r[i++]=o>>>16&15,r[i++]=o>>>20&15,r[i++]=o>>>24&15,r[i++]=o>>>28&15}}(e,t,r,n);break;case 5:!function(e,t,r,n){let i=n,a=t;for(let t=0;t<8;t++){let t=e[a++]>>>0,n=e[a++]>>>0,s=e[a++]>>>0,o=e[a++]>>>0,l=e[a++]>>>0;r[i++]=t>>>0&31,r[i++]=t>>>5&31,r[i++]=t>>>10&31,r[i++]=t>>>15&31,r[i++]=t>>>20&31,r[i++]=t>>>25&31,r[i++]=31&(t>>>30|(7&n)<<2),r[i++]=n>>>3&31,r[i++]=n>>>8&31,r[i++]=n>>>13&31,r[i++]=n>>>18&31,r[i++]=n>>>23&31,r[i++]=31&(n>>>28|(1&s)<<4),r[i++]=s>>>1&31,r[i++]=s>>>6&31,r[i++]=s>>>11&31,r[i++]=s>>>16&31,r[i++]=s>>>21&31,r[i++]=s>>>26&31,r[i++]=31&(s>>>31|(15&o)<<1),r[i++]=o>>>4&31,r[i++]=o>>>9&31,r[i++]=o>>>14&31,r[i++]=o>>>19&31,r[i++]=o>>>24&31,r[i++]=31&(o>>>29|(3&l)<<3),r[i++]=l>>>2&31,r[i++]=l>>>7&31,r[i++]=l>>>12&31,r[i++]=l>>>17&31,r[i++]=l>>>22&31,r[i++]=l>>>27&31}}(e,t,r,n);break;case 6:!function(e,t,r,n){let i=n,a=t;for(let t=0;t<8;t++){let t=e[a++]>>>0,n=e[a++]>>>0,s=e[a++]>>>0,o=e[a++]>>>0,l=e[a++]>>>0,u=e[a++]>>>0;r[i++]=t>>>0&63,r[i++]=t>>>6&63,r[i++]=t>>>12&63,r[i++]=t>>>18&63,r[i++]=t>>>24&63,r[i++]=63&(t>>>30|(15&n)<<2),r[i++]=n>>>4&63,r[i++]=n>>>10&63,r[i++]=n>>>16&63,r[i++]=n>>>22&63,r[i++]=63&(n>>>28|(3&s)<<4),r[i++]=s>>>2&63,r[i++]=s>>>8&63,r[i++]=s>>>14&63,r[i++]=s>>>20&63,r[i++]=s>>>26&63,r[i++]=o>>>0&63,r[i++]=o>>>6&63,r[i++]=o>>>12&63,r[i++]=o>>>18&63,r[i++]=o>>>24&63,r[i++]=63&(o>>>30|(15&l)<<2),r[i++]=l>>>4&63,r[i++]=l>>>10&63,r[i++]=l>>>16&63,r[i++]=l>>>22&63,r[i++]=63&(l>>>28|(3&u)<<4),r[i++]=u>>>2&63,r[i++]=u>>>8&63,r[i++]=u>>>14&63,r[i++]=u>>>20&63,r[i++]=u>>>26&63}}(e,t,r,n);break;case 7:!function(e,t,r,n){let i=n,a=t;for(let t=0;t<8;t++){let t=e[a++]>>>0,n=e[a++]>>>0,s=e[a++]>>>0,o=e[a++]>>>0,l=e[a++]>>>0,u=e[a++]>>>0,h=e[a++]>>>0;r[i++]=t>>>0&127,r[i++]=t>>>7&127,r[i++]=t>>>14&127,r[i++]=t>>>21&127,r[i++]=127&(t>>>28|(7&n)<<4),r[i++]=n>>>3&127,r[i++]=n>>>10&127,r[i++]=n>>>17&127,r[i++]=n>>>24&127,r[i++]=127&(n>>>31|(63&s)<<1),r[i++]=s>>>6&127,r[i++]=s>>>13&127,r[i++]=s>>>20&127,r[i++]=127&(s>>>27|(3&o)<<5),r[i++]=o>>>2&127,r[i++]=o>>>9&127,r[i++]=o>>>16&127,r[i++]=o>>>23&127,r[i++]=127&(o>>>30|(31&l)<<2),r[i++]=l>>>5&127,r[i++]=l>>>12&127,r[i++]=l>>>19&127,r[i++]=127&(l>>>26|(1&u)<<6),r[i++]=u>>>1&127,r[i++]=u>>>8&127,r[i++]=u>>>15&127,r[i++]=u>>>22&127,r[i++]=127&(u>>>29|(15&h)<<3),r[i++]=h>>>4&127,r[i++]=h>>>11&127,r[i++]=h>>>18&127,r[i++]=h>>>25&127}}(e,t,r,n);break;case 8:!function(e,t,r,n){let i=n,a=t;for(let t=0;t<8;t++){let t=e[a++]>>>0,n=e[a++]>>>0,s=e[a++]>>>0,o=e[a++]>>>0,l=e[a++]>>>0,u=e[a++]>>>0,h=e[a++]>>>0,c=e[a++]>>>0;r[i++]=t>>>0&255,r[i++]=t>>>8&255,r[i++]=t>>>16&255,r[i++]=t>>>24&255,r[i++]=n>>>0&255,r[i++]=n>>>8&255,r[i++]=n>>>16&255,r[i++]=n>>>24&255,r[i++]=s>>>0&255,r[i++]=s>>>8&255,r[i++]=s>>>16&255,r[i++]=s>>>24&255,r[i++]=o>>>0&255,r[i++]=o>>>8&255,r[i++]=o>>>16&255,r[i++]=o>>>24&255,r[i++]=l>>>0&255,r[i++]=l>>>8&255,r[i++]=l>>>16&255,r[i++]=l>>>24&255,r[i++]=u>>>0&255,r[i++]=u>>>8&255,r[i++]=u>>>16&255,r[i++]=u>>>24&255,r[i++]=h>>>0&255,r[i++]=h>>>8&255,r[i++]=h>>>16&255,r[i++]=h>>>24&255,r[i++]=c>>>0&255,r[i++]=c>>>8&255,r[i++]=c>>>16&255,r[i++]=c>>>24&255}}(e,t,r,n);break;case 16:!function(e,t,r,n){let i=n,a=t;for(let t=0;t<128;t++){let t=e[a++]>>>0;r[i++]=65535&t,r[i++]=t>>>16&65535}}(e,t,r,n);break;default:!function(e,t,r,n,i){let a=tg[i]>>>0,s=t,o=0,l=e[s]>>>0,u=n;for(let t=0;t<8;t++){for(let t=0;t<32;t++)if(o+i<=32){let n=l>>>o&a;r[u+t]=0|n,o+=i,32===o&&(o=0,s++,31!==t&&(l=e[s]>>>0))}else{let n=32-o,h=l>>>o;s++,l=e[s]>>>0;let c=i-n,p=(h|(l&-1>>>32-c>>>0)<<n)&a;r[u+t]=0|p,o=c}u+=32,o=0,t<7&&(l=e[s]>>>0)}}(e,t,r,n,i)}return t+(i<<3)|0}function ug(e,t,r,n){if(r+2>t)throw Error(`FastPFOR decode: byteContainer underflow at block=${n} (need 2 bytes for [bitWidth, exceptionCount], bytePos=${r}, byteSize=${t})`);let i=e[r++],a=e[r++];if(i>32)throw Error(`FastPFOR decode: invalid bitWidth=${i} at block=${n} (expected 0..32). This likely indicates corrupted or truncated input.`);return{bitWidth:i,exceptionCount:a,bytePosIn:r}}function hg(e,t,r,n,i,a,s,o,l){let{maxBits:u,exceptionBitWidth:h,bytePosIn:c}=function(e,t,r,n,i,a){if(r+1>t)throw Error(`FastPFOR decode: exception header underflow at block=${a} (need 1 byte for maxBits, bytePos=${r}, byteSize=${t})`);let s=e[r++];if(s<n||s>32)throw Error(`FastPFOR decode: invalid maxBits=${s} at block=${a} (bitWidth=${n}, expected ${n}..32)`);let o=s-n|0;if(o<1||o>32)throw Error(`FastPFOR decode: invalid exceptionBitWidth=${o} at block=${a} (bitWidth=${n}, maxBits=${s})`);if(r+i>t)throw Error(`FastPFOR decode: exception positions underflow at block=${a} (need=${i}, have=${t-r})`);return{maxBits:s,exceptionBitWidth:o,bytePosIn:r}}(i,a,s,r,n,l);if(s=c,1===h){let a=1<<r;for(let r=0;r<n;r=r+1|0)e[i[s++]+t|0]|=a;return s}let p=o.dataToBePacked[h];if(!p)throw Error(`FastPFOR decode: missing exception stream for exceptionBitWidth=${h} (bitWidth=${r}, maxBits=${u}) at block ${l}`);let f=o.dataPointers,d=0|f[h],y=0|o.exceptionSizes[h];if(d+n>y)throw Error(`FastPFOR decode: exception stream overflow for exceptionBitWidth=${h} (ptr=${d}, need ${n}, size=${y}) at block ${l}`);for(let a=0;a<n;a=a+1|0){let n=i[s++],a=0|p[d++];e[n+t|0]|=a<<r}return f[h]=d,s}function cg(e,t,r,n,i,a){let s=0|r,o=0|e[s];if(o<=0||s+o>e.length-1)throw Error(`FastPFOR decode: invalid whereMeta=${o} at pageStart=${s} (expected > 0 and pageStart+whereMeta < encoded.length=${e.length})`);let l=s+1|0,u=s+o|0,h=e[u]>>>0,c=h+3>>>2,p=u+1,f=p+c;if(f>=e.length)throw Error(`FastPFOR decode: invalid byteSize=${h} (metaInts=${c}, pageStart=${s}, packedEnd=${u}, byteContainerStart=${p}) causes bitmapPos=${f} out of bounds (encoded.length=${e.length})`);let d=function(e,t,r,n){n.byteContainer.length<r&&(n.byteContainer=new Uint8Array(2*r),n.byteContainerI32=void 0);let i=n.byteContainer,a=r>>>2;if(3&i.byteOffset)for(let r=0;r<a;r=r+1|0){let n=0|e[t+r|0],a=r<<2;i[a]=255&n,i[a+1|0]=n>>>8&255,i[a+2|0]=n>>>16&255,i[a+3|0]=n>>>24&255}else{let r=n.byteContainerI32;(!r||r.buffer!==i.buffer||r.byteOffset!==i.byteOffset||r.length<a)&&(r=n.byteContainerI32=new Int32Array(i.buffer,i.byteOffset,i.byteLength>>>2)),r.set(e.subarray(t,t+a))}let s=3&r;if(s>0){let r=0|e[t+a|0],n=a<<2;for(let e=0;e<s;e=e+1|0)i[n+e|0]=r>>>(e<<3)&255}return i}(e,p,h,a),y=h,m=function(e,t,r){let n=0|e[t++],i=r.dataToBePacked;for(let a=2;a<=32;a=a+1|0){if(!(n>>>a-1&1))continue;if(t>=e.length)throw Error(`FastPFOR decode: truncated exception stream header (bitWidth=${a}, streamWordIndex=${t}, needWords=1, availableWords=${e.length-t}, encodedWords=${e.length})`);let s=e[t++]>>>0,o=ng(s),l=s*a+31>>>5;if(t+l>e.length)throw Error(`FastPFOR decode: truncated exception stream (bitWidth=${a}, size=${s}, streamWordIndex=${t}, needWords=${l}, availableWords=${e.length-t}, encodedWords=${e.length})`);let u=i[a];(!u||u.length<o)&&(u=i[a]=new Uint32Array(o));let h=0;for(;h<s;h=h+32|0)pg(e,t,u,h,a),t=t+a|0;t=t-((h-s|0)*a>>>5)|0,r.exceptionSizes[a]=s}return t}(e,f,a);return a.dataPointers.fill(0),function(e,t,r,n,i,a,s,o,l,u){let h=0|r,c=0;for(let t=0;t<s;t=t+1|0){let r=ug(o,l,c,t);c=r.bytePosIn;let n=r.bitWidth,s=r.exceptionCount,p=a+256*t|0;switch(n){case 0:i.fill(0,p,p+256);break;case 32:for(let t=0;t<256;t=t+1|0)i[p+t|0]=0|e[h+t|0];h=h+256|0;break;default:h=lg(e,h,i,p,n)}s>0&&(c=hg(i,p,n,s,o,l,c,u,t))}if(h!==n)throw Error(`FastPFOR decode: packed region mismatch (pageStart=${t}, packedStart=${r}, consumedPackedEnd=${h}, expectedPackedEnd=${n}, packedWords=${n-r}, encoded.length=${e.length})`)}(e,s,l,u,t,0|n,i/256|0,d,y,a),m}function pg(e,t,r,n,i){switch(i){case 2:return void function(e,t,r,n){let i=n,a=e[t]>>>0,s=e[t+1]>>>0;r[i++]=a>>>0&3,r[i++]=a>>>2&3,r[i++]=a>>>4&3,r[i++]=a>>>6&3,r[i++]=a>>>8&3,r[i++]=a>>>10&3,r[i++]=a>>>12&3,r[i++]=a>>>14&3,r[i++]=a>>>16&3,r[i++]=a>>>18&3,r[i++]=a>>>20&3,r[i++]=a>>>22&3,r[i++]=a>>>24&3,r[i++]=a>>>26&3,r[i++]=a>>>28&3,r[i++]=a>>>30&3,r[i++]=s>>>0&3,r[i++]=s>>>2&3,r[i++]=s>>>4&3,r[i++]=s>>>6&3,r[i++]=s>>>8&3,r[i++]=s>>>10&3,r[i++]=s>>>12&3,r[i++]=s>>>14&3,r[i++]=s>>>16&3,r[i++]=s>>>18&3,r[i++]=s>>>20&3,r[i++]=s>>>22&3,r[i++]=s>>>24&3,r[i++]=s>>>26&3,r[i++]=s>>>28&3,r[i]=s>>>30&3}(e,t,r,n);case 3:return void function(e,t,r,n){let i=n,a=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0;r[i++]=a>>>0&7,r[i++]=a>>>3&7,r[i++]=a>>>6&7,r[i++]=a>>>9&7,r[i++]=a>>>12&7,r[i++]=a>>>15&7,r[i++]=a>>>18&7,r[i++]=a>>>21&7,r[i++]=a>>>24&7,r[i++]=a>>>27&7,r[i++]=7&(a>>>30|(1&s)<<2),r[i++]=s>>>1&7,r[i++]=s>>>4&7,r[i++]=s>>>7&7,r[i++]=s>>>10&7,r[i++]=s>>>13&7,r[i++]=s>>>16&7,r[i++]=s>>>19&7,r[i++]=s>>>22&7,r[i++]=s>>>25&7,r[i++]=s>>>28&7,r[i++]=7&(s>>>31|(3&o)<<1),r[i++]=o>>>2&7,r[i++]=o>>>5&7,r[i++]=o>>>8&7,r[i++]=o>>>11&7,r[i++]=o>>>14&7,r[i++]=o>>>17&7,r[i++]=o>>>20&7,r[i++]=o>>>23&7,r[i++]=o>>>26&7,r[i]=o>>>29&7}(e,t,r,n);case 4:return void function(e,t,r,n){let i=n,a=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0;r[i++]=a>>>0&15,r[i++]=a>>>4&15,r[i++]=a>>>8&15,r[i++]=a>>>12&15,r[i++]=a>>>16&15,r[i++]=a>>>20&15,r[i++]=a>>>24&15,r[i++]=a>>>28&15,r[i++]=s>>>0&15,r[i++]=s>>>4&15,r[i++]=s>>>8&15,r[i++]=s>>>12&15,r[i++]=s>>>16&15,r[i++]=s>>>20&15,r[i++]=s>>>24&15,r[i++]=s>>>28&15,r[i++]=o>>>0&15,r[i++]=o>>>4&15,r[i++]=o>>>8&15,r[i++]=o>>>12&15,r[i++]=o>>>16&15,r[i++]=o>>>20&15,r[i++]=o>>>24&15,r[i++]=o>>>28&15,r[i++]=l>>>0&15,r[i++]=l>>>4&15,r[i++]=l>>>8&15,r[i++]=l>>>12&15,r[i++]=l>>>16&15,r[i++]=l>>>20&15,r[i++]=l>>>24&15,r[i]=l>>>28&15}(e,t,r,n);case 5:return void function(e,t,r,n){let i=n,a=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0;r[i++]=a>>>0&31,r[i++]=a>>>5&31,r[i++]=a>>>10&31,r[i++]=a>>>15&31,r[i++]=a>>>20&31,r[i++]=a>>>25&31,r[i++]=31&(a>>>30|(7&s)<<2),r[i++]=s>>>3&31,r[i++]=s>>>8&31,r[i++]=s>>>13&31,r[i++]=s>>>18&31,r[i++]=s>>>23&31,r[i++]=31&(s>>>28|(1&o)<<4),r[i++]=o>>>1&31,r[i++]=o>>>6&31,r[i++]=o>>>11&31,r[i++]=o>>>16&31,r[i++]=o>>>21&31,r[i++]=o>>>26&31,r[i++]=31&(o>>>31|(15&l)<<1),r[i++]=l>>>4&31,r[i++]=l>>>9&31,r[i++]=l>>>14&31,r[i++]=l>>>19&31,r[i++]=l>>>24&31,r[i++]=31&(l>>>29|(3&u)<<3),r[i++]=u>>>2&31,r[i++]=u>>>7&31,r[i++]=u>>>12&31,r[i++]=u>>>17&31,r[i++]=u>>>22&31,r[i]=u>>>27&31}(e,t,r,n);case 6:return void function(e,t,r,n){let i=n,a=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,h=e[t+5]>>>0;r[i++]=a>>>0&63,r[i++]=a>>>6&63,r[i++]=a>>>12&63,r[i++]=a>>>18&63,r[i++]=a>>>24&63,r[i++]=63&(a>>>30|(15&s)<<2),r[i++]=s>>>4&63,r[i++]=s>>>10&63,r[i++]=s>>>16&63,r[i++]=s>>>22&63,r[i++]=63&(s>>>28|(3&o)<<4),r[i++]=o>>>2&63,r[i++]=o>>>8&63,r[i++]=o>>>14&63,r[i++]=o>>>20&63,r[i++]=o>>>26&63,r[i++]=l>>>0&63,r[i++]=l>>>6&63,r[i++]=l>>>12&63,r[i++]=l>>>18&63,r[i++]=l>>>24&63,r[i++]=63&(l>>>30|(15&u)<<2),r[i++]=u>>>4&63,r[i++]=u>>>10&63,r[i++]=u>>>16&63,r[i++]=u>>>22&63,r[i++]=63&(u>>>28|(3&h)<<4),r[i++]=h>>>2&63,r[i++]=h>>>8&63,r[i++]=h>>>14&63,r[i++]=h>>>20&63,r[i]=h>>>26&63}(e,t,r,n);case 7:return void function(e,t,r,n){let i=n,a=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,h=e[t+5]>>>0,c=e[t+6]>>>0;r[i++]=a>>>0&127,r[i++]=a>>>7&127,r[i++]=a>>>14&127,r[i++]=a>>>21&127,r[i++]=127&(a>>>28|(7&s)<<4),r[i++]=s>>>3&127,r[i++]=s>>>10&127,r[i++]=s>>>17&127,r[i++]=s>>>24&127,r[i++]=127&(s>>>31|(63&o)<<1),r[i++]=o>>>6&127,r[i++]=o>>>13&127,r[i++]=o>>>20&127,r[i++]=127&(o>>>27|(3&l)<<5),r[i++]=l>>>2&127,r[i++]=l>>>9&127,r[i++]=l>>>16&127,r[i++]=l>>>23&127,r[i++]=127&(l>>>30|(31&u)<<2),r[i++]=u>>>5&127,r[i++]=u>>>12&127,r[i++]=u>>>19&127,r[i++]=127&(u>>>26|(1&h)<<6),r[i++]=h>>>1&127,r[i++]=h>>>8&127,r[i++]=h>>>15&127,r[i++]=h>>>22&127,r[i++]=127&(h>>>29|(15&c)<<3),r[i++]=c>>>4&127,r[i++]=c>>>11&127,r[i++]=c>>>18&127,r[i]=c>>>25&127}(e,t,r,n);case 8:return void function(e,t,r,n){let i=n,a=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,h=e[t+5]>>>0,c=e[t+6]>>>0,p=e[t+7]>>>0;r[i++]=a>>>0&255,r[i++]=a>>>8&255,r[i++]=a>>>16&255,r[i++]=a>>>24&255,r[i++]=s>>>0&255,r[i++]=s>>>8&255,r[i++]=s>>>16&255,r[i++]=s>>>24&255,r[i++]=o>>>0&255,r[i++]=o>>>8&255,r[i++]=o>>>16&255,r[i++]=o>>>24&255,r[i++]=l>>>0&255,r[i++]=l>>>8&255,r[i++]=l>>>16&255,r[i++]=l>>>24&255,r[i++]=u>>>0&255,r[i++]=u>>>8&255,r[i++]=u>>>16&255,r[i++]=u>>>24&255,r[i++]=h>>>0&255,r[i++]=h>>>8&255,r[i++]=h>>>16&255,r[i++]=h>>>24&255,r[i++]=c>>>0&255,r[i++]=c>>>8&255,r[i++]=c>>>16&255,r[i++]=c>>>24&255,r[i++]=p>>>0&255,r[i++]=p>>>8&255,r[i++]=p>>>16&255,r[i]=p>>>24&255}(e,t,r,n);case 9:return void function(e,t,r,n){let i=n,a=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,h=e[t+5]>>>0,c=e[t+6]>>>0,p=e[t+7]>>>0,f=e[t+8]>>>0;r[i++]=a>>>0&511,r[i++]=a>>>9&511,r[i++]=a>>>18&511,r[i++]=511&(a>>>27|(15&s)<<5),r[i++]=s>>>4&511,r[i++]=s>>>13&511,r[i++]=s>>>22&511,r[i++]=511&(s>>>31|(255&o)<<1),r[i++]=o>>>8&511,r[i++]=o>>>17&511,r[i++]=511&(o>>>26|(7&l)<<6),r[i++]=l>>>3&511,r[i++]=l>>>12&511,r[i++]=l>>>21&511,r[i++]=511&(l>>>30|(127&u)<<2),r[i++]=u>>>7&511,r[i++]=u>>>16&511,r[i++]=511&(u>>>25|(3&h)<<7),r[i++]=h>>>2&511,r[i++]=h>>>11&511,r[i++]=h>>>20&511,r[i++]=511&(h>>>29|(63&c)<<3),r[i++]=c>>>6&511,r[i++]=c>>>15&511,r[i++]=511&(c>>>24|(1&p)<<8),r[i++]=p>>>1&511,r[i++]=p>>>10&511,r[i++]=p>>>19&511,r[i++]=511&(p>>>28|(31&f)<<4),r[i++]=f>>>5&511,r[i++]=f>>>14&511,r[i]=f>>>23&511}(e,t,r,n);case 10:return void function(e,t,r,n){let i=n,a=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,h=e[t+5]>>>0,c=e[t+6]>>>0,p=e[t+7]>>>0,f=e[t+8]>>>0,d=e[t+9]>>>0;r[i++]=a>>>0&1023,r[i++]=a>>>10&1023,r[i++]=a>>>20&1023,r[i++]=1023&(a>>>30|(255&s)<<2),r[i++]=s>>>8&1023,r[i++]=s>>>18&1023,r[i++]=1023&(s>>>28|(63&o)<<4),r[i++]=o>>>6&1023,r[i++]=o>>>16&1023,r[i++]=1023&(o>>>26|(15&l)<<6),r[i++]=l>>>4&1023,r[i++]=l>>>14&1023,r[i++]=1023&(l>>>24|(3&u)<<8),r[i++]=u>>>2&1023,r[i++]=u>>>12&1023,r[i++]=u>>>22&1023,r[i++]=h>>>0&1023,r[i++]=h>>>10&1023,r[i++]=h>>>20&1023,r[i++]=1023&(h>>>30|(255&c)<<2),r[i++]=c>>>8&1023,r[i++]=c>>>18&1023,r[i++]=1023&(c>>>28|(63&p)<<4),r[i++]=p>>>6&1023,r[i++]=p>>>16&1023,r[i++]=1023&(p>>>26|(15&f)<<6),r[i++]=f>>>4&1023,r[i++]=f>>>14&1023,r[i++]=1023&(f>>>24|(3&d)<<8),r[i++]=d>>>2&1023,r[i++]=d>>>12&1023,r[i]=d>>>22&1023}(e,t,r,n);case 11:return void function(e,t,r,n){let i=n,a=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,h=e[t+5]>>>0,c=e[t+6]>>>0,p=e[t+7]>>>0,f=e[t+8]>>>0,d=e[t+9]>>>0,y=e[t+10]>>>0;r[i++]=a>>>0&2047,r[i++]=a>>>11&2047,r[i++]=2047&(a>>>22|(1&s)<<10),r[i++]=s>>>1&2047,r[i++]=s>>>12&2047,r[i++]=2047&(s>>>23|(3&o)<<9),r[i++]=o>>>2&2047,r[i++]=o>>>13&2047,r[i++]=2047&(o>>>24|(7&l)<<8),r[i++]=l>>>3&2047,r[i++]=l>>>14&2047,r[i++]=2047&(l>>>25|(15&u)<<7),r[i++]=u>>>4&2047,r[i++]=u>>>15&2047,r[i++]=2047&(u>>>26|(31&h)<<6),r[i++]=h>>>5&2047,r[i++]=h>>>16&2047,r[i++]=2047&(h>>>27|(63&c)<<5),r[i++]=c>>>6&2047,r[i++]=c>>>17&2047,r[i++]=2047&(c>>>28|(127&p)<<4),r[i++]=p>>>7&2047,r[i++]=p>>>18&2047,r[i++]=2047&(p>>>29|(255&f)<<3),r[i++]=f>>>8&2047,r[i++]=f>>>19&2047,r[i++]=2047&(f>>>30|(511&d)<<2),r[i++]=d>>>9&2047,r[i++]=d>>>20&2047,r[i++]=2047&(d>>>31|(1023&y)<<1),r[i++]=y>>>10&2047,r[i]=y>>>21&2047}(e,t,r,n);case 12:return void function(e,t,r,n){let i=n,a=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,h=e[t+5]>>>0,c=e[t+6]>>>0,p=e[t+7]>>>0,f=e[t+8]>>>0,d=e[t+9]>>>0,y=e[t+10]>>>0,m=e[t+11]>>>0;r[i++]=a>>>0&4095,r[i++]=a>>>12&4095,r[i++]=4095&(a>>>24|(15&s)<<8),r[i++]=s>>>4&4095,r[i++]=s>>>16&4095,r[i++]=4095&(s>>>28|(255&o)<<4),r[i++]=o>>>8&4095,r[i++]=o>>>20&4095,r[i++]=l>>>0&4095,r[i++]=l>>>12&4095,r[i++]=4095&(l>>>24|(15&u)<<8),r[i++]=u>>>4&4095,r[i++]=u>>>16&4095,r[i++]=4095&(u>>>28|(255&h)<<4),r[i++]=h>>>8&4095,r[i++]=h>>>20&4095,r[i++]=c>>>0&4095,r[i++]=c>>>12&4095,r[i++]=4095&(c>>>24|(15&p)<<8),r[i++]=p>>>4&4095,r[i++]=p>>>16&4095,r[i++]=4095&(p>>>28|(255&f)<<4),r[i++]=f>>>8&4095,r[i++]=f>>>20&4095,r[i++]=d>>>0&4095,r[i++]=d>>>12&4095,r[i++]=4095&(d>>>24|(15&y)<<8),r[i++]=y>>>4&4095,r[i++]=y>>>16&4095,r[i++]=4095&(y>>>28|(255&m)<<4),r[i++]=m>>>8&4095,r[i]=m>>>20&4095}(e,t,r,n);case 16:return void function(e,t,r,n){let i=n,a=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,h=e[t+5]>>>0,c=e[t+6]>>>0,p=e[t+7]>>>0,f=e[t+8]>>>0,d=e[t+9]>>>0,y=e[t+10]>>>0,m=e[t+11]>>>0,g=e[t+12]>>>0,x=e[t+13]>>>0,v=e[t+14]>>>0,b=e[t+15]>>>0;r[i++]=a>>>0&65535,r[i++]=a>>>16&65535,r[i++]=s>>>0&65535,r[i++]=s>>>16&65535,r[i++]=o>>>0&65535,r[i++]=o>>>16&65535,r[i++]=l>>>0&65535,r[i++]=l>>>16&65535,r[i++]=u>>>0&65535,r[i++]=u>>>16&65535,r[i++]=h>>>0&65535,r[i++]=h>>>16&65535,r[i++]=c>>>0&65535,r[i++]=c>>>16&65535,r[i++]=p>>>0&65535,r[i++]=p>>>16&65535,r[i++]=f>>>0&65535,r[i++]=f>>>16&65535,r[i++]=d>>>0&65535,r[i++]=d>>>16&65535,r[i++]=y>>>0&65535,r[i++]=y>>>16&65535,r[i++]=m>>>0&65535,r[i++]=m>>>16&65535,r[i++]=g>>>0&65535,r[i++]=g>>>16&65535,r[i++]=x>>>0&65535,r[i++]=x>>>16&65535,r[i++]=v>>>0&65535,r[i++]=v>>>16&65535,r[i++]=b>>>0&65535,r[i]=b>>>16&65535}(e,t,r,n);case 32:for(let i=0;i<32;i=i+1|0)r[n+i|0]=0|e[t+i|0];return}let a=tg[i]>>>0,s=t,o=0,l=e[s]>>>0;for(let t=0;t<32;t++)if(o+i<=32){let u=l>>>o&a;r[n+t]=0|u,o+=i,32===o&&(o=0,s++,31!==t&&(l=e[s]>>>0))}else{let u=32-o,h=l>>>o;s++,l=e[s]>>>0;let c=(h|(l&tg[i-u]>>>0)<<u)&a;r[n+t]=0|c,o=i-u}}function fg(e,t,r){let n=new Uint32Array(r),i=0,a=t.get();for(let t=0;t<n.length;t++){let t=e[a++],r=127&t;t<128||(t=e[a++],r|=(127&t)<<7,t<128||(t=e[a++],r|=(127&t)<<14,t<128||(t=e[a++],r|=(127&t)<<21,t<128||(t=e[a++],r|=(15&t)<<28)))),n[i++]=r}return t.set(a),n}function dg(e,t,r){let n=new BigUint64Array(r);for(let r=0;r<n.length;r++)n[r]=yg(e,t);return n}function yg(e,t){let r=0n,n=0,i=t.get();for(;i<e.length;){let t=e[i++];if(r|=BigInt(127&t)<<BigInt(n),!(128&t))break;if(n+=7,n>=64)throw Error("Varint too long")}return t.set(i),r}function mg(e,t){let r,n;return n=e[t.get()],t.increment(),r=127&n,n<128||(n=e[t.get()],t.increment(),r|=(127&n)<<7,n<128)||(n=e[t.get()],t.increment(),r|=(127&n)<<14,n<128)||(n=e[t.get()],t.increment(),r|=(127&n)<<21,n<128)?r:(n=e[t.get()],r|=(15&n)<<28,function(e,t,r){let n,i;if(i=t[r.get()],r.increment(),n=(112&i)>>4,i<128||(i=t[r.get()],r.increment(),n|=(127&i)<<3,i<128)||(i=t[r.get()],r.increment(),n|=(127&i)<<10,i<128)||(i=t[r.get()],r.increment(),n|=(127&i)<<17,i<128)||(i=t[r.get()],r.increment(),n|=(127&i)<<24,i<128)||(i=t[r.get()],r.increment(),n|=(1&i)<<31,i<128))return 4294967296*n+(e>>>0);throw Error("Expected varint not more than 10 bytes")}(r,e,t))}function gg(e,t,r,n){return function(e,t,r,n,i){let a=n.get();if(3&r)throw Error(`FastPFOR: invalid encodedByteLength=${r} at offset=${a} (encodedBytes.length=${e.length}; expected a multiple of 4 bytes for an int32 big-endian word stream)`);let s=r>>>2,o=function(e,t){if(t<=e.encodedWords.length)return e.encodedWords;let r=new Uint32Array(Math.max(16,2*t));return e.encodedWords=r,r}(i,s);!function(e,t,r,n){if(t<0||r<0||t+r>e.length)throw RangeError(`decodeBigEndianInt32sInto: out of bounds (offset=${t}, byteLength=${r}, bytes.length=${e.length})`);let i=Math.floor(r/4),a=r%4!=0,s=a?i+1:i;if(n.length<s)throw RangeError(`decodeBigEndianInt32sInto: out.length=${n.length} < ${s}`);if(i>0){let r=e.byteOffset+t;if(3&r)for(let r=0;r<i;r++){let i=t+4*r;n[r]=e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3]}else{let t=new Uint32Array(e.buffer,r,i);for(let e=0;e<i;e++)n[e]=0|ig(t[e])}}if(a){let a=t+4*i,s=r-4*i,o=0;for(let t=0;t<s;t++)o|=e[a+t]<<24-8*t;n[i]=0|o}}(e,a,r,o);let l=function(e,t,r){let n=0,i=0,a=new Uint32Array(t),s=r??og();if(e.length>0){let t=0|e[n];if(n=n+1|0,255&t)throw Error(`FastPFOR decode: invalid alignedLength=${t} (expected multiple of 256)`);if(i+t>a.length)throw Error(`FastPFOR decode: output buffer too small (outPos=${i}, alignedLength=${t}, out.length=${a.length})`);n=function(e,t,r,n,i,a){let s=n+rg(i,256),o=n,l=r;for(;o!==s;){let r=Math.min(ag,s-o);l=cg(e,t,l,o,r,a),o=o+r|0}return l}(e,a,n,i,t,s),i=i+t|0}return function(e,t,r,n,i,a){if(0===a)return t;let s=0,o=t,l=t+r,u=i,h=i,c=i+a,p=0,f=0;for(;o<l&&h<c;){let t=e[o]>>>s&255;if(s+=8,o+=s>>>5,s&=31,p|=(127&t)<<f,128&t)n[h++]=0|p,p=0,f=0;else if(f+=7,f>28)throw Error(`FastPFOR VByte: unterminated value (expected MSB=1 terminator within 5 bytes; shift=${f}, partial=${p}, decoded=${h-u}/${a}, inPos=${o}, inEnd=${l})`)}if(h!==c)throw Error(`FastPFOR VByte: truncated stream (decoded=${h-u}, expected=${a}, consumedWords=${o-t}/${r}, vbyteStart=${t}, vbyteEnd=${l})`)}(e,n,e.length-n|0,a,i,t-i|0),a}(o.subarray(0,s),t,i.decoderWorkspace);return n.add(r),l}(e,t,r,n,function(e=16){if(e<0)throw RangeError(`initialEncodedWordCapacity must be >= 0, got ${e}`);let t=Math.max(16,0|e);return{encodedWords:new Uint32Array(t),decoderWorkspace:og()}}(r>>>2))}function xg(e){return e>>>1^-(1&e)}function vg(e){return e>>1n^-(1n&e)}function bg(e){return e%2==1?(e+1)/-2:e/2}function wg(e,t,r){if(void 0===r){r=0;for(let n=0;n<t;n++)r+=e[n]}let n=new Uint32Array(r),i=0;for(let r=0;r<t;r++){let a=e[r],s=e[r+t];n.fill(s,i,i+a),i+=a}return n}function Dg(e,t,r){if(void 0===r){r=0;for(let n=0;n<t;n++)r+=Number(e[n])}let n=new BigUint64Array(r),i=0;for(let r=0;r<t;r++){let a=Number(e[r]),s=e[r+t];n.fill(s,i,i+a),i+=a}return n}function _g(e,t,r){let n=new Float64Array(r),i=0;for(let r=0;r<t;r++){let a=e[r],s=e[r+t];n.fill(s,i,i+a),i+=a}return n}function Ag(e){let t=new Int32Array(e.length);t[0]=xg(e[0]);let r=e.length/4*4,n=1;if(r>=4)for(;n<r-4;n+=4){let r=e[n],i=e[n+1],a=e[n+2],s=e[n+3];t[n]=xg(r)+t[n-1],t[n+1]=xg(i)+t[n],t[n+2]=xg(a)+t[n+1],t[n+3]=xg(s)+t[n+2]}for(;n!==e.length;++n)t[n]=xg(e[n])+t[n-1];return t}function Eg(e){let t=new BigInt64Array(e.length);t[0]=vg(e[0]);let r=e.length/4*4,n=1;if(r>=4)for(;n<r-4;n+=4){let r=e[n],i=e[n+1],a=e[n+2],s=e[n+3];t[n]=vg(r)+t[n-1],t[n+1]=vg(i)+t[n],t[n+2]=vg(a)+t[n+1],t[n+3]=vg(s)+t[n+2]}for(;n!==t.length;++n)t[n]=vg(e[n])+t[n-1];return t}function Sg(e){let t=e.length/4*4,r=1;if(t>=4)for(let n=e[0];r<t-4;r+=4)n=e[r]+=n,n=e[r+1]+=n,n=e[r+2]+=n,n=e[r+3]+=n;for(;r!==e.length;)e[r]+=e[r-1],++r}function Fg(e,t,r,n){if(e.length<2)return new Int32Array(e);let i=new Int32Array(e.length),a=xg(e[0]),s=xg(e[1]);i[0]=kg(Math.round(a*t),r,n),i[1]=kg(Math.round(s*t),r,n);let o=e.length/16,l=2;if(o>=4)for(;l<o-4;l+=4){let o=e[l],u=e[l+1],h=xg(o)+a,c=xg(u)+s;i[l]=kg(Math.round(h*t),r,n),i[l+1]=kg(Math.round(c*t),r,n);let p=e[l+2],f=e[l+3];a=xg(p)+h,s=xg(f)+c,i[l+2]=kg(Math.round(a*t),r,n),i[l+3]=kg(Math.round(s*t),r,n)}for(;l!==e.length;l+=2)a+=xg(e[l]),s+=xg(e[l+1]),i[l]=kg(Math.round(a*t),r,n),i[l+1]=kg(Math.round(s*t),r,n);return i}function kg(e,t,r){return Math.min(r,Math.max(t,e))}function Ig(e){let t=new Uint32Array(e.length);t[0]=xg(e[0])>>>0;for(let r=1;r<e.length;r++)t[r]=t[r-1]+xg(e[r])>>>0;return t}function Tg(e){let t=new BigUint64Array(e.length);t[0]=BigInt.asUintN(64,vg(e[0]));for(let r=1;r<e.length;r++)t[r]=BigInt.asUintN(64,t[r-1]+vg(e[r]));return t}var Mg,Cg,Bg,Pg;!function(e){e.PRESENT="PRESENT",e.DATA="DATA",e.OFFSET="OFFSET",e.LENGTH="LENGTH"}(Mg||={}),function(e){e.NONE="NONE",e.SINGLE="SINGLE",e.SHARED="SHARED",e.VERTEX="VERTEX",e.MORTON="MORTON",e.FSST="FSST"}(Cg||={}),function(e){e.VERTEX="VERTEX",e.INDEX="INDEX",e.STRING="STRING",e.KEY="KEY"}(Bg||={}),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"}(Pg||={});const zg=[Mg.PRESENT,Mg.DATA,Mg.OFFSET,Mg.LENGTH],Vg=[Km.NONE,Km.DELTA,Km.COMPONENTWISE_DELTA,Km.RLE,Km.MORTON],Lg=[Jm.NONE,Jm.FAST_PFOR,Jm.VARINT],Og=[Cg.NONE,Cg.SINGLE,Cg.SHARED,Cg.VERTEX,Cg.MORTON,Cg.FSST],Rg=[Bg.VERTEX,Bg.INDEX,Bg.STRING,Bg.KEY],$g=[Pg.VAR_BINARY,Pg.GEOMETRIES,Pg.PARTS,Pg.RINGS,Pg.TRIANGLES,Pg.SYMBOL,Pg.DICTIONARY];function Ng(e,t){let r=function(e,t){let r=e[t.get()],n=zg[r>>4],i={};switch(n){case Mg.DATA:i={dictionaryType:Og[15&r]};break;case Mg.OFFSET:i={offsetType:Rg[15&r]};break;case Mg.LENGTH:i={lengthType:$g[15&r]}}t.increment();let a=e[t.get()],s=Vg[a>>5],o=Vg[a>>2&7],l=Lg[3&a];t.increment();let u=fg(e,t,2),h=u[0];return{physicalStreamType:n,logicalStreamType:i,logicalLevelTechnique1:s,logicalLevelTechnique2:o,physicalLevelTechnique:l,numValues:h,byteLength:u[1],decompressedCount:h}}(e,t);return r.logicalLevelTechnique1===Km.MORTON?function(e,t,r){let n=fg(t,r,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:n[0],coordinateShift:n[1]}}(r,e,t):Km.RLE!==r.logicalLevelTechnique1&&Km.RLE!==r.logicalLevelTechnique2||Jm.NONE===r.physicalLevelTechnique?r:function(e,t,r){let n=fg(t,r,2);return{physicalStreamType:e.physicalStreamType,logicalStreamType:e.logicalStreamType,logicalLevelTechnique1:e.logicalLevelTechnique1,logicalLevelTechnique2:e.logicalLevelTechnique2,physicalLevelTechnique:e.physicalLevelTechnique,numValues:e.numValues,byteLength:e.byteLength,decompressedCount:n[1],runs:n[0],numRleValues:n[1]}}(r,e,t)}var Ug;!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"}(Ug||={});var qg=class{constructor(e,t){this.values=e,this._size=t}get(e){let t=Math.floor(e/8),r=e%8;return 1==(this.values[t]>>r&1)}set(e,t){let r=Math.floor(e/8),n=e%8;this.values[r]=this.values[r]|+!!t<<n}getInt(e){let t=Math.floor(e/8),r=e%8;return this.values[t]>>r&1}size(){return this._size}getBuffer(){return this.values}};function jg(e,t,r){if(!t)return e;let n=t.size(),i=new(0,e.constructor)(n),a=0;for(let s=0;s<n;s++)i[s]=t.get(s)?e[a++]:r;return i}function Gg(e,t,r){for(let n=0;n<e;n++){let e=Ng(t,r);r.add(e.byteLength)}}function Xg(e,t,r,n,i){let a=function(e,t,r,n){let i=new Uint8Array(t),a=0,s=n.get()+r;for(;a<t&&!(n.get()>=s);){let r=e[n.increment()];if(r<=127){let s=r+3,o=e[n.increment()],l=Math.min(a+s,t);i.fill(o,a,l),a=l}else{let s=256-r;for(let r=0;r<s&&a<t;r++)i[a++]=e[n.increment()]}}return n.set(s),i}(e,Math.ceil(t/8),r,n);return i?function(e,t,r){if(!r)return e;let n=r.size(),i=new qg(e,t),a=new qg(new Uint8Array(Math.ceil(n/8)),n),s=0;for(let e=0;e<n;e++){let t=!!r.get(e)&&i.get(s++);a.set(e,t)}return a.getBuffer()}(a,t,i):a}function Yg(e,t,r,n){let i=t.get(),a=i+r*Float32Array.BYTES_PER_ELEMENT,s=new Uint8Array(e.subarray(i,a)).buffer,o=new Float32Array(s);return t.set(a),n?jg(o,n,0):o}function Zg(e,t,r,n){let i=t.get(),a=i+r*Float64Array.BYTES_PER_ELEMENT,s=new Uint8Array(e.subarray(i,a)).buffer,o=new Float64Array(s);return t.set(a),n?jg(o,n,0):o}const Wg=new TextDecoder;function Hg(e,t,r){return r-t>=12?Wg.decode(e.subarray(t,r)):function(e,t,r){let n="",i=t;for(;i<r;){let t,a,s,o=e[i],l=null,u=o>239?4:o>223?3:o>191?2:1;if(i+u>r)break;1===u?o<128&&(l=o):2===u?(t=e[i+1],128==(192&t)&&(l=(31&o)<<6|63&t,l<=127&&(l=null))):3===u?(t=e[i+1],a=e[i+2],128==(192&t)&&128==(192&a)&&(l=(15&o)<<12|(63&t)<<6|63&a,(l<=2047||l>=55296&&l<=57343)&&(l=null))):4===u&&(t=e[i+1],a=e[i+2],s=e[i+3],128==(192&t)&&128==(192&a)&&128==(192&s)&&(l=(15&o)<<18|(63&t)<<12|(63&a)<<6|63&s,(l<=65535||l>=1114112)&&(l=null))),null===l?(l=65533,u=1):l>65535&&(l-=65536,n+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),n+=String.fromCharCode(l),i+=u}return n}(e,t,r)}function Kg(e,t,r,n,i){return function(e,t,r,n){let i;switch(t.logicalLevelTechnique1){case Km.DELTA:if(t.logicalLevelTechnique2===Km.RLE){let r=t;if(!n)return function(e,t,r){let n=new Int32Array(r),i=0,a=0;for(let r=0;r<t;r++){let s=e[r],o=xg(e[r+t]);for(let e=0;e<s;e++)a+=o,n[i++]=a}return n}(e,r.runs,r.numRleValues);i=Ag(e=wg(e,r.runs,r.numRleValues))}else i=Ag(e);break;case Km.RLE:i=function(e,t,r){if(void 0===r){r=0;for(let n=0;n<t;n++)r+=e[n]}let n=new Int32Array(r),i=0;for(let r=0;r<t;r++){let a=e[r],s=e[r+t];s=xg(s),n.fill(s,i,i+a),i+=a}return n}(e,t.runs,t.numRleValues);break;case Km.MORTON:Sg(e),i=new Int32Array(e);break;case Km.COMPONENTWISE_DELTA:if(r&&!n)return Fg(e,r.scale,r.min,r.max);i=function(e){if(e.length<2)return new Int32Array(e);let t=new Int32Array(e.length);t[0]=xg(e[0]),t[1]=xg(e[1]);let r=e.length/4*4,n=2;if(r>=4)for(;n<r-4;n+=4){let r=e[n],i=e[n+1],a=e[n+2],s=e[n+3];t[n]=xg(r)+t[n-2],t[n+1]=xg(i)+t[n-1],t[n+2]=xg(a)+t[n],t[n+3]=xg(s)+t[n+1]}for(;n!==e.length;n+=2)t[n]=xg(e[n])+t[n-2],t[n+1]=xg(e[n+1])+t[n-1];return t}(e);break;case Km.NONE:i=function(e){let t=new Int32Array(e.length);for(let r=0;r<e.length;r++)t[r]=xg(e[r]);return t}(e);break;default:throw Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}return n?jg(i,n,0):i}(ex(e,t,r),r,n,i)}function Jg(e,t,r,n,i){return function(e,t,r,n){let i;switch(t.logicalLevelTechnique1){case Km.DELTA:if(t.logicalLevelTechnique2===Km.RLE){let r=t;i=Ig(wg(e,r.runs,r.numRleValues))}else i=Ig(e);break;case Km.RLE:i=wg(e,t.runs,t.numRleValues);break;case Km.MORTON:Sg(e),i=e;break;case Km.COMPONENTWISE_DELTA:i=r&&!n?function(e,t,r,n){let i=Fg(e,t,r,n);return new Uint32Array(i)}(e,r.scale,r.min,r.max):function(e){if(e.length<2)return new Uint32Array(e);let t=new Uint32Array(e.length);t[0]=xg(e[0])>>>0,t[1]=xg(e[1])>>>0;for(let r=2;r<e.length;r+=2)t[r]=t[r-2]+xg(e[r])>>>0,t[r+1]=t[r-1]+xg(e[r+1])>>>0;return t}(e);break;case Km.NONE:i=e;break;default:throw Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}return n?jg(i,n,0):i}(ex(e,t,r),r,n,i)}function Qg(e,t,r){return function(e,t){if(t.logicalLevelTechnique1===Km.DELTA&&t.logicalLevelTechnique2===Km.NONE)return function(e){let t=new Int32Array(e.length+1);t[0]=0,t[1]=xg(e[0]);let r=t[1];for(let n=2;n!==t.length;++n)r+=xg(e[n-1]),t[n]=t[n-1]+r;return new Uint32Array(t)}(e);if(t.logicalLevelTechnique1===Km.RLE&&t.logicalLevelTechnique2===Km.NONE){let r=t;return function(e,t,r){let n=new Uint32Array(r+1);n[0]=0;let i=1,a=n[0];for(let r=0;r<t;r++){let s=e[r],o=e[r+t];for(let e=i;e<i+s;e++)n[e]=o+a,a=n[e];i+=s}return n}(e,r.runs,r.numRleValues)}if(t.logicalLevelTechnique1===Km.NONE&&t.logicalLevelTechnique2===Km.NONE){!function(e){let t=0;for(let r=0;r<e.length;r++)e[r]+=t,t=e[r]}(e);let r=new Uint32Array(t.numValues+1);return r[0]=0,r.set(e,1),r}if(t.logicalLevelTechnique1===Km.DELTA&&t.logicalLevelTechnique2===Km.RLE){let r=t,n=function(e,t,r){let n=new Int32Array(r+1);n[0]=0;let i=1,a=n[0];for(let r=0;r<t;r++){let s=e[r],o=e[r+t];o=xg(o);for(let e=i;e<i+s;e++)n[e]=o+a,a=n[e];i+=s}return n}(e,r.runs,r.numRleValues);return Sg(n),new Uint32Array(n)}throw Error("Only delta encoding is supported for transforming length to offset streams yet.")}(ex(e,t,r),r)}function ex(e,t,r){let n=r.physicalLevelTechnique;switch(n){case Jm.FAST_PFOR:return gg(e,r.numValues,r.byteLength,t);case Jm.VARINT:return fg(e,t,r.numValues);case Jm.NONE:return function(e,t,r){let n=t.get(),i=r*Uint32Array.BYTES_PER_ELEMENT,a=new DataView(e.buffer,e.byteOffset,e.byteLength),s=new Uint32Array(r);for(let e=0;e<r;e++)s[e]=a.getUint32(n+e*Uint32Array.BYTES_PER_ELEMENT,!0);return t.add(i),s}(e,t,r.numValues);default:throw Error(`Specified physicalLevelTechnique ${n} is not supported (yet).`)}}function tx(e,t,r){let n=r.physicalLevelTechnique;switch(n){case Jm.VARINT:return dg(e,t,r.numValues);case Jm.NONE:return function(e,t,r){let n=t.get(),i=r*BigUint64Array.BYTES_PER_ELEMENT,a=new DataView(e.buffer,e.byteOffset,e.byteLength),s=new BigUint64Array(r);for(let e=0;e<r;e++)s[e]=a.getBigUint64(n+e*BigUint64Array.BYTES_PER_ELEMENT,!0);return t.add(i),s}(e,t,r.numValues);default:throw Error(`Specified physicalLevelTechnique ${n} is not supported (yet).`)}}function rx(e,t,r){let n=ex(e,t,r);return 1===n.length?r.logicalLevelTechnique1===Km.DELTA?xg(n[0]):n[0]:function(e){return e[1]}(n)}function nx(e,t,r){return function(e){if(2===e.length){let t=xg(e[1]);return[t,t]}return[xg(e[2]),xg(e[3])]}(ex(e,t,r))}function ix(e,t,r){return function(e){if(2===e.length){let t=vg(e[1]);return[t,t]}return[vg(e[2]),vg(e[3])]}(dg(e,t,r.numValues))}function ax(e,t,r,n){return lx(tx(e,t,r),r,n)}function sx(e,t,r,n){return ux(tx(e,t,r),r,n)}function ox(e,t,r){let n=tx(e,t,r);return 1===n.length?r.logicalLevelTechnique1===Km.DELTA?vg(n[0]):n[0]:function(e){return e[1]}(n)}function lx(e,t,r){let n;switch(t.logicalLevelTechnique1){case Km.DELTA:if(t.logicalLevelTechnique2===Km.RLE){let i=t;if(!r)return function(e,t,r){let n=new BigInt64Array(r),i=0,a=0n;for(let r=0;r<t;r++){let s=Number(e[r]),o=vg(e[r+t]);for(let e=0;e<s;e++)a+=o,n[i++]=a}return n}(e,i.runs,i.numRleValues);n=Eg(e=Dg(e,i.runs,i.numRleValues))}else n=Eg(e);break;case Km.RLE:n=function(e,t,r){if(void 0===r){r=0;for(let n=0;n<t;n++)r+=Number(e[n])}let n=new BigInt64Array(r),i=0;for(let r=0;r<t;r++){let a=Number(e[r]),s=e[r+t];s=vg(s),n.fill(s,i,i+a),i+=a}return n}(e,t.runs,t.numRleValues);break;case Km.NONE:n=function(e){let t=new BigInt64Array(e.length);for(let r=0;r<e.length;r++)t[r]=vg(e[r]);return t}(e);break;default:throw Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}return r?jg(n,r,0n):n}function ux(e,t,r){let n;switch(t.logicalLevelTechnique1){case Km.DELTA:if(t.logicalLevelTechnique2===Km.RLE){let r=t;n=Tg(Dg(e,r.runs,r.numRleValues))}else n=Tg(e);break;case Km.RLE:n=Dg(e,t.runs,t.numRleValues);break;case Km.NONE:n=e;break;default:throw Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}return r?jg(n,r,0n):n}function hx(e,t,r,n,i="int32"){let a=e.logicalLevelTechnique1;if(a===Km.RLE)return 1===e.runs?Ug.CONST:Ug.FLAT;if(a!==Km.DELTA||e.logicalLevelTechnique2!==Km.RLE)return 1===e.numValues?Ug.CONST:Ug.FLAT;let s=t instanceof qg?t.size():t,o=e;if(o.numRleValues!==s)return Ug.FLAT;if(1===o.runs)return Ug.SEQUENCE;if(2!==o.runs)return 1===e.numValues?Ug.CONST:Ug.FLAT;let l=n.get();if(e.physicalLevelTechnique===Jm.VARINT)return function(e,t,r){let n=new Qm(t.get());if("int64"===r){let t=dg(e,n,4);return 2n===t[2]&&2n===t[3]}let i=fg(e,n,4);return 2===i[2]&&2===i[3]}(r,n,i)?Ug.SEQUENCE:1===e.numValues?Ug.CONST:Ug.FLAT;let u=n.get(),h=new Int32Array(r.buffer,r.byteOffset+u,4);return n.set(l),2===h[2]&&2===h[3]?Ug.SEQUENCE:1===e.numValues?Ug.CONST:Ug.FLAT}var cx,px,fx,dx=class extends jm{getValueFromBuffer(e){return this.dataBuffer[e]}},yx=class extends Ym{constructor(e,t,r,n,i){super(e,i?BigInt64Array.of(t):BigUint64Array.of(t),r,n)}getValueFromBuffer(e){return this.dataBuffer[0]+BigInt(e)*this.delta}};function mx(e,t,r){return{x:gx(e,t)-r,y:gx(e>>1,t)-r}}function gx(e,t){let r=0;for(let n=0;n<t;n++)r|=(e&1<<2*n)>>n;return r}function xx(e,t,r,n,i,a,s){return e===fx.MORTON?function(e,t,r,n,i,a){let s=Array(i?n+1:n);for(let i=0;i<n;i++){let n=mx(e[t[r+i]],a.numBits,a.coordinateShift);s[i]=new l(n.x,n.y)}return i&&(s[s.length-1]=s[0]),s}(t,r,n,i,a,s):function(e,t,r,n,i){let a=Array(i?n+1:n);for(let i=0;i<2*n;i+=2){let n=2*t[r+i/2],s=e[n],o=e[n+1];a[i/2]=new l(s,o)}return i&&(a[a.length-1]=a[0]),a}(t,r,n,i,a)}function vx(e,t,r,n){let i=Array(n?r+1:r);for(let n=0;n<2*r;n+=2){let r=e[t+n],a=e[t+n+1];i[n/2]=new l(r,a)}return n&&(i[i.length-1]=i[0]),i}!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"}(cx||={}),function(e){e[e.POINT=0]="POINT",e[e.LINESTRING=1]="LINESTRING",e[e.POLYGON=2]="POLYGON"}(px||={}),function(e){e[e.MORTON=0]="MORTON",e[e.VEC_2=1]="VEC_2",e[e.VEC_3=2]="VEC_3"}(fx||={});var bx=class{constructor(e,t,r,n,i){this._vertexBufferType=e,this._topologyVector=t,this._vertexOffsets=r,this._vertexBuffer=n,this._mortonSettings=i}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?2*this.vertexOffsets[e]:2*e;return[this.vertexBuffer[t],this.vertexBuffer[t+1]]}getVertex(e){if(this.vertexOffsets&&this.mortonSettings){let t=this.vertexOffsets[e],r=mx(this.vertexBuffer[t],this.mortonSettings.numBits,this.mortonSettings.coordinateShift);return[r.x,r.y]}let t=this.vertexOffsets?2*this.vertexOffsets[e]:2*e;return[this.vertexBuffer[t],this.vertexBuffer[t+1]]}getGeometries(){return function(e){let t=Array(e.numGeometries),r=1,n=1,i=1,a=0,s=0,o=0,u=e.mortonSettings,h=e.topologyVector,c=h.geometryOffsets,p=h.partOffsets,f=h.ringOffsets,d=e.vertexOffsets,y=!d||0===d.length,m=e.containsPolygonGeometry(),g=e.vertexBuffer;for(let h=0;h<e.numGeometries;h++){let x=e.geometryType(h);switch(x){case cx.POINT:{let h,m;if(y)h=g[s++],m=g[s++];else if(e.vertexBufferType===fx.MORTON){let e=mx(g[d[o++]],u.numBits,u.coordinateShift);h=e.x,m=e.y}else{let e=2*d[o++];h=g[e],m=g[e+1]}t[a++]=[[new l(h,m)]],c&&i++,p&&r++,f&&n++}break;case cx.MULTIPOINT:{let h,p=c[i]-c[i-1];if(i++,y){h=Array(p);for(let e=0;e<p;e++){let t=g[s++],r=g[s++];h[e]=new l(t,r)}}else h=xx(e.vertexBufferType,g,d,o,p,!1,u),o+=p;t[a++]=h.map(e=>[e]),r+=p,n+=p}break;case cx.LINESTRING:{let l,h;m?(l=f[n]-f[n-1],n++):l=p[r]-p[r-1],r++,y?(h=vx(g,s,l,!1),s+=2*l):(h=xx(e.vertexBufferType,g,d,o,l,!1,u),o+=l),t[a++]=[h],c&&i++}break;case cx.POLYGON:{let l=p[r]-p[r-1];r++;let h,m=Array(l-1),x=f[n]-f[n-1];if(n++,y){h=vx(g,s,x,!0),s+=2*x;for(let e=0;e<m.length;e++)x=f[n]-f[n-1],n++,m[e]=vx(g,s,x,!0),s+=2*x}else{h=xx(e.vertexBufferType,g,d,o,x,!0,u),o+=x;for(let t=0;t<m.length;t++)x=f[n]-f[n-1],n++,m[t]=xx(e.vertexBufferType,g,d,o,x,!0,u),o+=x}t[a++]=[h].concat(m),c&&i++}break;case cx.MULTILINESTRING:{let l=c[i]-c[i-1];i++;let h=Array(l);for(let t=0;t<l;t++){let i;if(m?(i=f[n]-f[n-1],n++):i=p[r]-p[r-1],r++,y)h[t]=vx(g,s,i,!1),s+=2*i;else{let r=xx(e.vertexBufferType,g,d,o,i,!1,u);h[t]=r,o+=i}}t[a++]=h}break;case cx.MULTIPOLYGON:{let l=c[i]-c[i-1];i++;let h=Array(l);for(let t=0;t<l;t++){let i=p[r]-p[r-1];r++;let a,l=Array(i-1),c=f[n]-f[n-1];n++,y?(a=vx(g,s,c,!0),s+=2*c):(a=xx(e.vertexBufferType,g,d,o,c,!0,u),o+=c);for(let t=0;t<l.length;t++){let r=f[n]-f[n-1];n++,y?(l[t]=vx(g,s,r,!0),s+=2*r):(l[t]=xx(e.vertexBufferType,g,d,o,r,!0,u),o+=r)}h[t]=[a].concat(l)}t[a++]=h.flat()}break;default:throw Error(`The specified geometry type (${x}) is currently not supported.`)}}return t}(this)}get mortonSettings(){return this._mortonSettings}},wx=class extends bx{constructor(e,t,r,n,i,a,s){super(r,n,i,a,s),this._numGeometries=e,this._geometryType=t}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsPolygonGeometry(){return this._geometryType===cx.POLYGON||this._geometryType===cx.MULTIPOLYGON}containsSingleGeometryType(){return!0}};function Dx(e,t,r,n){return new _x(fx.VEC_2,e,t,r,n)}var _x=class extends bx{constructor(e,t,r,n,i,a){super(e,r,n,i,a),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)===cx.POLYGON||this.geometryType(e)===cx.MULTIPOLYGON)return!0;return!1}containsSingleGeometryType(){return!1}},Ax=class{constructor(e,t,r,n){this._triangleOffsets=e,this._indexBuffer=t,this._vertexBuffer=r,this._topologyVector=n}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 Dx(e,this._topologyVector,void 0,this._vertexBuffer).getGeometries()}[Symbol.iterator](){return null}};function Ex(e,t,r,n,i,a){return new Sx(e,t,r,n,i,a)}var Sx=class extends Ax{constructor(e,t,r,n,i,a){super(r,n,i,a),this._numGeometries=e,this._geometryType=t}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsSingleGeometryType(){return!0}};function Fx(e,t,r,n,i){return new kx(e,t,r,n,i)}var kx=class extends Ax{constructor(e,t,r,n,i){super(t,r,n,i),this._geometryTypes=e}geometryType(e){return this._geometryTypes[e]}get numGeometries(){return this._geometryTypes.length}containsSingleGeometryType(){return!1}};function Ix(e,t,r,n,i){let a,s,o,l,u=Ng(e,r);if(hx(u,n,e,r)===Ug.CONST){let h,c,p,f,d=rx(e,r,u);for(let n=0;n<t-1;n++){let t=Ng(e,r);switch(t.physicalStreamType){case Mg.LENGTH:switch(t.logicalStreamType.lengthType){case Pg.GEOMETRIES:h=Qg(e,r,t);break;case Pg.PARTS:c=Qg(e,r,t);break;case Pg.RINGS:p=Qg(e,r,t);break;case Pg.TRIANGLES:f=Qg(e,r,t)}break;case Mg.OFFSET:switch(t.logicalStreamType.offsetType){case Bg.VERTEX:a=Jg(e,r,t);break;case Bg.INDEX:l=Jg(e,r,t)}break;case Mg.DATA:if(Cg.VERTEX===t.logicalStreamType.dictionaryType)s=Kg(e,r,t,i);else{let n=t;o={numBits:n.numBits,coordinateShift:n.coordinateShift},s=Jg(e,r,t,i)}}}return l?void 0!==h||void 0!==c?Ex(n,d,f,l,s,{geometryOffsets:h,partOffsets:c,ringOffsets:p}):Ex(n,d,f,l,s):void 0===o?function(e,t,r,n,i){return new wx(e,t,fx.VEC_2,r,n,i)}(n,d,{geometryOffsets:h,partOffsets:c,ringOffsets:p},a,s):function(e,t,r,n,i,a){return new wx(e,t,fx.MORTON,r,n,i,a)}(n,d,{geometryOffsets:h,partOffsets:c,ringOffsets:p},a,s,o)}let h,c,p,f,d,y,m,g=Jg(e,r,u);for(let n=0;n<t-1;n++){let t=Ng(e,r);switch(t.physicalStreamType){case Mg.LENGTH:switch(t.logicalStreamType.lengthType){case Pg.GEOMETRIES:h=Jg(e,r,t);break;case Pg.PARTS:c=Jg(e,r,t);break;case Pg.RINGS:p=Jg(e,r,t);break;case Pg.TRIANGLES:f=Qg(e,r,t)}break;case Mg.OFFSET:switch(t.logicalStreamType.offsetType){case Bg.VERTEX:a=Jg(e,r,t);break;case Bg.INDEX:l=Jg(e,r,t)}break;case Mg.DATA:if(Cg.VERTEX===t.logicalStreamType.dictionaryType)s=Kg(e,r,t,i);else{let n=t;o={numBits:n.numBits,coordinateShift:n.coordinateShift},s=Jg(e,r,t,i)}}}return h?(d=Tx(g,h,2),c&&p?(y=Mx(g,d,c,!1),m=function(e,t,r,n){let i=new Uint32Array(r[r.length-1]+1),a=0;i[0]=a;let s=1,o=1,l=0;for(let u=0;u<e.length;u++){let h=e[u],c=t[u+1]-t[u];if(0!==h&&3!==h)for(let e=0;e<c;e++){let e=r[s]-r[s-1];s++;for(let t=0;t<e;t++)a=i[o++]=a+n[l++]}else for(let e=0;e<c;e++)i[o++]=++a,s++}return i}(g,d,y,p)):c&&(y=function(e,t,r){let n=new Uint32Array(t[t.length-1]+1),i=0;n[0]=i;let a=1,s=0;for(let o=0;o<e.length;o++){let l=e[o],u=t[o+1]-t[o];if(4===l||1===l)for(let e=0;e<u;e++)i=n[a++]=i+r[s++];else for(let e=0;e<u;e++)n[a++]=++i}return n}(g,d,c))):c&&p?(y=Tx(g,c,1),m=Mx(g,y,p,!0)):c&&(y=Tx(g,c,0)),l&&!y?Fx(g,f,l,s):l?Fx(g,f,l,s,{geometryOffsets:d,partOffsets:y,ringOffsets:m}):void 0===o?Dx(g,{geometryOffsets:d,partOffsets:y,ringOffsets:m},a,s):function(e,t,r,n,i){return new _x(fx.MORTON,e,t,r,n,i)}(g,{geometryOffsets:d,partOffsets:y,ringOffsets:m},a,s,o)}function Tx(e,t,r){let n=new Uint32Array(e.length+1),i=0;n[0]=i;let a=0;for(let s=0;s<e.length;s++)i=n[s+1]=i+(e[s]>r?t[a++]:1);return n}function Mx(e,t,r,n){let i=new Uint32Array(t[t.length-1]+1),a=0;i[0]=a;let s=1,o=0;for(let l=0;l<e.length;l++){let u=e[l],h=t[l+1]-t[l];if(5===u||2===u||n&&(4===u||1===u))for(let e=0;e<h;e++)a=i[s++]=a+r[o++];else for(let e=0;e<h;e++)i[s++]=++a}return i}var Cx=class extends qm{constructor(e,t,r){super(e,t.getBuffer(),r),this.dataVector=t}getValueFromBuffer(e){return this.dataVector.get(e)}},Bx=class extends jm{getValueFromBuffer(e){return this.dataBuffer[e]}},Px=class extends qm{constructor(e,t,r,n){super(e,n?BigInt64Array.of(t):BigUint64Array.of(t),r)}getValueFromBuffer(e){return this.dataBuffer[0]}},zx=class extends qm{constructor(e,t,r,n){super(e,r,n),this.offsetBuffer=t}},Vx=class extends zx{constructor(e,t,r,n){super(e,t,r,n??t.length-1)}getValueFromBuffer(e){let t=this.offsetBuffer[e],r=this.offsetBuffer[e+1];return Hg(this.dataBuffer,t,r)}},Lx=class extends zx{constructor(e,t,r,n,i){super(e,r,n,i??t.length),this.indexBuffer=t,this.indexBuffer=t}getValueFromBuffer(e){let t=this.indexBuffer[e],r=this.offsetBuffer[t],n=this.offsetBuffer[t+1];return Hg(this.dataBuffer,r,n)}},Ox=class extends zx{constructor(e,t,r,n,i,a,s,o){super(e,r,n,s??t.length),this.indexBuffer=t,this.symbolOffsetBuffer=i,this.symbolTableBuffer=a,this.sharedDictionaryCache=o}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],r=this.offsetBuffer[t],n=this.offsetBuffer[t+1];return Hg(this.decodedDictionary,r,n)}decodeDictionary(){return this.symbolLengthBuffer??=this.offsetToLengthBuffer(this.symbolOffsetBuffer),function(e,t,r){let n=new Uint32Array(t.length);for(let e=1;e<t.length;e++)n[e]=n[e-1]+t[e-1];let i=new Uint8Array(function(e,t){let r=0;for(let n=0;n<t.length;n++){let i=t[n];255===i?(r++,n++):r+=e[i]}return r}(t,r)),a=0;for(let s=0;s<r.length;s++){let o=r[s];if(255===o)s++,i[a++]=r[s];else{let r=t[o],s=n[o];for(;r-- >0;)i[a++]=e[s++]}}return i}(this.symbolTableBuffer,this.symbolLengthBuffer,this.dataBuffer)}offsetToLengthBuffer(e){let t=new Uint32Array(e.length-1),r=e[0];for(let n=1;n<e.length;n++){let i=e[n];t[n-1]=i-r,r=i}return t}};function Rx(e,t,r,n,i){let a,s,o,l,u,h,c,p=i;for(let e=0;e<n;e++){let e=Ng(t,r);switch(e.physicalStreamType){case Mg.PRESENT:{let n=new qg(Xg(t,e.numValues,e.byteLength,r),e.numValues);p=i??n;break}case Mg.OFFSET:s=Jg(t,r,e,void 0,p);break;case Mg.LENGTH:{let n=Qg(t,r,e);Pg.DICTIONARY===e.logicalStreamType.lengthType?a=n:Pg.SYMBOL===e.logicalStreamType.lengthType?l=n:h=n;break}case Mg.DATA:{let n=t.subarray(r.get(),r.get()+e.byteLength);r.add(e.byteLength);let i=e.logicalStreamType.dictionaryType;Cg.FSST===i?u=n:Cg.SINGLE===i||Cg.SHARED===i?o=n:Cg.NONE===i&&(c=n);break}}}return function(e,t,r,n,i,a,s){if(t){if(!(r&&n&&i&&a))throw Error(`Incomplete FSST dictionary string column "${e}"`);return new Ox(e,r,n,i,a,t,s)}}(e,u,s,a,o,l,p)??function(e,t,r,n,i){if(t){if(!r||!n)throw Error(`Incomplete dictionary string column "${e}"`);return i?new Lx(e,r,n,t,i):new Lx(e,r,n,t)}}(e,o,s,a,p)??function(e,t,r,n,i){if(t&&r){if(n)return i?new Lx(e,n,t,r,i):new Lx(e,n,t,r);if(i&&i.size()!==t.length-1){let n=new Uint32Array(i.size()),a=0;for(let e=0;e<i.size();e++)i.get(e)?n[e]=a++:n[e]=0;return new Lx(e,n,t,r,i)}return i?new Vx(e,t,r,i):new Vx(e,t,r)}}(e,h,c,s,p)}var $x,Nx,Ux=class extends qm{constructor(e,t,r){super(e,new Uint8Array,r??t.length),this.values=t}getValueFromBuffer(e){return this.values[e]}};function qx(e,t,r,n,i){let a,{lengthStream:s,flattenedValues:o,presentStream:l,dictionary:u}=e,h=t*r,c=r;if(l){a=new qg(new Uint8Array(Math.ceil(r/8)),r),c=0;for(let e=0;e<r;e++)l.get(h+e)&&(a.set(e,!0),c++)}let p=n+c;if(p>s.length)throw Error("Merged map counts underflow while decoding child streams");let f=Array(r),d=n,y=i;for(let e=0;e<r;e++){if(l&&!l.get(h+e)){f[e]=null;continue}let t=y+s[d++];if(t>o.length)throw Error("Map value stream underflow while decoding feature payload");let r=jx(o,y,t,u);f[e]=r.value,y=r.nextIndex}let m=0;for(let e=n;e<p;e++)m+=s[e];let g=i+m;if(y!==g)throw Error("Unused flattened map values remain after decode");return{value:f,nullabilityBuffer:a,countsEnd:p,valuesEnd:g}}function jx(e,t,r,n){return r-t===1||e[t]===Nx.START_LIST?Xx(e,t,r,n):Gx(e,t,r,n)}function Gx(e,t,r,n){let i=Object.create(null),a=t;for(;a<r;){let t=Zx(e[a++],n);if("string"!=typeof t)throw Error(`Map key dictionary index does not resolve to a string: ${t}`);let s=Xx(e,a,r,n);i[t]=s.value,a=s.nextIndex}return{value:i,nextIndex:a}}function Xx(e,t,r,n){if(t>=r)throw Error("Unexpected end of map value stream");let i=e[t];if(i===Nx.FALSE)return{value:!1,nextIndex:t+1};if(i===Nx.TRUE)return{value:!0,nextIndex:t+1};if(i===Nx.START_MAP){let i=Yx(e,t,r);return{value:Gx(e,t+2,i,n).value,nextIndex:i}}if(i===Nx.START_LIST){let i=Yx(e,t,r),a=[],s=t+2;for(;s<i;){let t=Xx(e,s,i,n);a.push(t.value),s=t.nextIndex}return{value:a,nextIndex:i}}return{value:Zx(i,n),nextIndex:t+1}}function Yx(e,t,r){if(t+1>=r)throw Error("Missing length for nested map/list payload");let n=e[t+1];if(n<2)throw Error(`Invalid nested payload length: ${n}`);let i=t+n;if(i>r)throw Error("Nested payload exceeds containing payload bounds");return i}function Zx(e,t){let r=e-Nx.COUNT;if(r<0||r>=t.length)throw Error(`Scalar dictionary index out of range: ${e}`);return t[r]}function Wx(e,t){for(let r of t)e.push(r)}function Hx(e,t,r,n,i,a){return"scalarType"===r.type?a&&!a.has(r.name)?(Gg(n,e,t),null):function(e,t,r,n,i,a){let s;if(0===e)return null;if(a.nullable){let e=Ng(t,r),n=e.numValues,i=r.get(),a=Xg(t,n,e.byteLength,r);r.set(i+e.byteLength),s=new qg(a,e.numValues)}let o=s??n;switch(i.physicalType){case 4:case 3:return function(e,t,r,n,i){let a=Ng(e,t),s=hx(a,i,e,t),o=3===n.physicalType;if(s===Ug.FLAT){let n=Kx(i)?i:void 0,s=o?Kg(e,t,a,void 0,n):Jg(e,t,a,void 0,n);return new Gm(r.name,s,i)}if(s===Ug.SEQUENCE){let n=nx(e,t,a);return new Zm(r.name,n[0],n[1],a.numRleValues,o)}let l=o?function(e,t,r){let n=ex(e,t,r);return 1===n.length?xg(n[0]):function(e){return xg(e[1])}(n)}(e,t,a):rx(e,t,a);return new Wm(r.name,l,i,o)}(t,r,a,i,o);case 9:{let n=a.nullable?e-1:e;return Rx(a.name,t,r,n,s)??null}case 0:return function(e,t,r,n,i){let a=Ng(e,t),s=a.numValues,o=t.get(),l=Kx(i)?i:void 0,u=Xg(e,s,a.byteLength,t,l);t.set(o+a.byteLength);let h=new qg(u,s);return new Cx(r.name,h,i)}(t,r,a,0,o);case 6:case 5:return function(e,t,r,n,i){let a=Ng(e,t),s=hx(a,n,e,t,"int64"),o=5===i.physicalType;if(s===Ug.FLAT){let i=Kx(n)?n:void 0,s=o?ax(e,t,a,i):sx(e,t,a,i);return new dx(r.name,s,n)}if(s===Ug.SEQUENCE){let n=ix(e,t,a);return new yx(r.name,n[0],n[1],a.numRleValues,o)}let l=o?function(e,t,r){let n=tx(e,t,r);return 1===n.length?vg(n[0]):function(e){return vg(e[1])}(n)}(e,t,a):ox(e,t,a);return new Px(r.name,l,n,o)}(t,r,a,o,i);case 7:return function(e,t,r,n){let i=Ng(e,t),a=Kx(n)?n:void 0,s=Yg(e,t,i.numValues,a);return new Bx(r.name,s,n)}(t,r,a,o);case 8:return function(e,t,r,n){let i=Ng(e,t),a=Kx(n)?n:void 0,s=Zg(e,t,i.numValues,a);return new Xm(r.name,s,n)}(t,r,a,o);default:throw Error(`The specified data type for the field is currently not supported: ${i}`)}}(n,e,t,i,r.scalarType,r):2===r.complexType?.physicalType?function(e,t,r,n){let i=function(e){let t="complexType"===e.type?e.complexType.children:void 0;return t&&0!==t.length?t.map(t=>e.name+(t.name??"")):[e.name]}(r);if(0===n)return i.map(e=>new Ux(e,[]));let a=function(e,t,r){let n=e[t.get()];t.add(1);let i=Jg(e,t,Ng(e,t)),a=r-1,s=[];n&$x.STRING&&(a-=function(e,t,r){let n=e[t.get()];t.add(1);let i=Rx("",e,t,n);if(i)for(let e=0;e<i.size;e++)r.push(i.getValue(e));return n}(e,t,s)),a-=function(e,t,r,n){let i=0;return r&$x.INT32?(Wx(n,Kg(e,t,Ng(e,t))),i++):r&$x.INT64&&(Wx(n,ax(e,t,Ng(e,t))),i++),r&$x.UINT32?(Wx(n,Jg(e,t,Ng(e,t))),i++):r&$x.UINT64&&(Wx(n,sx(e,t,Ng(e,t))),i++),i}(e,t,n,s),a-=function(e,t,r,n){let i=0;return r&$x.FLOAT&&(Wx(n,Yg(e,t,Ng(e,t).numValues)),i++),r&$x.DOUBLE&&(Wx(n,Zg(e,t,Ng(e,t).numValues)),i++),i}(e,t,n,s);let o,l=0;if(n&$x.PRESENCE){let r=function(e,t){let r=Ng(e,t);if(r.physicalStreamType!==Mg.PRESENT)throw Error(`Expected PRESENT stream for map column but found: ${r.physicalStreamType}`);let n=r.numValues,i=t.get(),a=new qg(Xg(e,n,r.byteLength,t),n);return t.set(i+r.byteLength),{value:a,count:n}}(e,t);o=r.value,l=r.count,a--}let u=new Uint32Array;if(a>0&&(u=Jg(e,t,Ng(e,t)),a--),0!==a)throw Error(`Unexpected number of remaining streams while decoding map column: ${a}`);return{lengthStream:i,dictionary:s,presentStream:o,presentCount:l,flattenedValues:u}}(e,t,n),s=(a.presentStream?a.presentCount:a.lengthStream.length)/i.length,o=[],l=0,u=0;for(let e=0;e<i.length;e++){let t=qx(a,e,s,l,u);o.push(new Ux(i[e],t.value,t.nullabilityBuffer)),l=t.countsEnd,u=t.valuesEnd}return o}(e,t,r,n):0===n?null:function(e,t,r,n){let i,a,s,o,l=!1;for(;!l;){let r=Ng(e,t);switch(r.physicalStreamType){case Mg.LENGTH:Pg.DICTIONARY===r.logicalStreamType.lengthType?i=Qg(e,t,r):s=Qg(e,t,r);break;case Mg.DATA:Cg.SINGLE===r.logicalStreamType.dictionaryType||Cg.SHARED===r.logicalStreamType.dictionaryType?(a=e.subarray(t.get(),t.get()+r.byteLength),l=!0):o=e.subarray(t.get(),t.get()+r.byteLength),t.add(r.byteLength)}}if("complexType"!==r.type)throw Error(`Shared dictionary column ${r.name} must be a complex (struct) column.`);if(!i||!a)throw Error(`Incomplete shared dictionary for column "${r.name}"`);let u=r.complexType.children,h=[],c=o?{}:void 0,p=0;for(let l of u){let u=fg(e,t,1)[0];if(0===u)continue;let f,d=l.name?`${r.name}${l.name}`:r.name;if(n&&!n.has(d)){Gg(u,e,t);continue}if("scalarField"!==l.type||9!==l.scalarField.physicalType)throw Error("Currently only scalar string fields are implemented for a struct.");if(u>1&&!l.nullable||1===u&&l.nullable)throw Error(`The number of streams for the child field ${l.name} does not match its nullability. nullibilty: ${l.nullable}, numStreams: ${u}`);if(l.nullable){let r=Ng(e,t);f=new qg(Xg(e,r.numValues,r.byteLength,t),r.numValues)}let y=Jg(e,t,Ng(e,t),void 0,f);if(o){if(!s)throw Error(`Incomplete shared FSST dictionary for column "${d}"`);h[p++]=new Ox(d,y,i,a,s,o,f,c)}else h[p++]=new Lx(d,y,i,a,f)}return h}(e,t,r,a)}function Kx(e){return e instanceof qg}!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"}($x||={}),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"}(Nx||={});function Jx(e){switch(e){case 0:case 1:case 2:case 3:return{nullable:!!(1&e),columnScope:0,type:"scalarType",scalarType:{longID:!!(2&e),type:"logicalType",logicalType:0}};case 4:return{nullable:!1,columnScope:0,type:"complexType",complexType:{type:"physicalType",physicalType:0,children:[]}};case 30:return{nullable:!1,columnScope:0,type:"complexType",complexType:{type:"physicalType",physicalType:1,children:[]}};case 31:return{nullable:!0,columnScope:0,type:"complexType",complexType:{type:"physicalType",physicalType:2,children:[]}};default:return function(e){let t;switch(e){case 10:case 11:t=0;break;case 12:case 13:t=1;break;case 14:case 15:t=2;break;case 16:case 17:t=3;break;case 18:case 19:t=4;break;case 20:case 21:t=5;break;case 22:case 23:t=6;break;case 24:case 25:t=7;break;case 26:case 27:t=8;break;case 28:case 29:t=9;break;default:return null}return{nullable:!!(1&e),columnScope:0,type:"scalarType",scalarType:{longID:!1,type:"physicalType",physicalType:t}}}(e)}}function Qx(e){return 30===e||31===e}function ev(e){if("scalarType"===e.type){let t=e.scalarType;if("physicalType"===t.type)switch(t.physicalType){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:default:return!1;case 9:return!0}if("logicalType"===t.type)return!1}else if("complexType"===e.type){let t=e.complexType;if("physicalType"===t.type)switch(t.physicalType){case 0:case 1:case 2:return!0;default:return!1}}return console.warn("Unexpected column type in hasStreamCount",e),!1}function tv(e){return"scalarType"===e.type&&"logicalType"===e.scalarType?.type&&0===e.scalarType.logicalType}function rv(e){return"complexType"===e.type&&"physicalType"===e.complexType?.type&&0===e.complexType.physicalType}const nv=new TextDecoder,iv="0-3(ID), 4(GEOMETRY), 10-29(scalars), 30(STRUCT), 31(MAP)";function av(e,t){let r=fg(e,t,1)[0];if(0===r)return"";let n=t.get(),i=n+r,a=e.subarray(n,i);return t.add(r),nv.decode(a)}function sv(e,t){let r=fg(e,t,1)[0]>>>0,n=r>=10?Jx(r):null;if(!n)throw Error(`Unsupported field type code ${r}. Supported: 10-29(scalars), 30(STRUCT), 31(MAP)`);let i={...n,name:av(e,t)};if("complexType"===i.type&&Qx(r)){let r=i.complexType,n=fg(e,t,1)[0]>>>0;r.children=Array(n);for(let i=0;i<n;i++)r.children[i]=sv(e,t)}return function(e){let t=e.name,r=e.nullable;return"scalarType"===e.type?{type:"scalarField",scalarField:e.scalarType,name:t,nullable:r}:{type:"complexField",complexField:e.complexType,name:t,nullable:r}}(i)}function ov(e,t){let r,n=fg(e,t,1)[0]>>>0,i=Jx(n);if(!i)throw Error(`Unsupported column type code ${n}. Supported: ${iv}`);if(function(e){return e>=10}(n))r=av(e,t);else if(n<4)r="id";else{if(4!==n)throw Error(`Unsupported column type code ${n}. Supported: ${iv}`);r="geometry"}let a={...i,name:r};if("complexType"===a.type&&Qx(n)){let r=fg(e,t,1)[0]>>>0,n=a.complexType;n.children=Array(r);for(let i=0;i<r;i++)n.children[i]=sv(e,t)}return a}function lv(e,t){let r={featureTables:[]},n={};if(n.name=av(e,t),0===n.name.length)throw Error("Missing layer name");let i=fg(e,t,1)[0]>>>0,a=fg(e,t,1)[0]>>>0;n.columns=Array(a);for(let r=0;r<a;r++)n.columns[r]=ov(e,t);return r.featureTables.push(n),[r,i]}function uv(e,t,r,n,i,a,s=!1){let o=t.scalarType?.longID?6:4,l="number"==typeof a?void 0:a,u=hx(i,a,e,r,6===o?"int64":"int32");if(4===o)switch(u){case Ug.FLAT:return new Gm(n,Jg(e,r,i,void 0,l),a);case Ug.SEQUENCE:{let t=nx(e,r,i);return new Zm(n,t[0],t[1],i.numRleValues,!1)}case Ug.CONST:return new Wm(n,rx(e,r,i),a,!1)}switch(u){case Ug.FLAT:return s?new Xm(n,function(e,t,r,n){let i=function(e,t,r){if(r.physicalLevelTechnique===Jm.VARINT)return function(e,t){switch(t.logicalLevelTechnique1){case Km.DELTA:if(t.logicalLevelTechnique2===Km.RLE){let r=t;e=_g(e,r.runs,r.numRleValues)}return function(e){e[0]=bg(e[0]);let t=e.length/4*4,r=1;if(t>=4)for(;r<t-4;r+=4){let t=e[r],n=e[r+1],i=e[r+2],a=e[r+3];e[r]=bg(t)+e[r-1],e[r+1]=bg(n)+e[r],e[r+2]=bg(i)+e[r+1],e[r+3]=bg(a)+e[r+2]}for(;r!==e.length;++r)e[r]=bg(e[r])+e[r-1]}(e),e;case Km.RLE:return function(e,t){return _g(e,t.runs,t.numRleValues)}(e,t);case Km.NONE:return e;default:throw Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}}(function(e,t,r){let n=new Float64Array(r);for(let i=0;i<r;i++)n[i]=mg(e,t);return n}(e,t,r.numValues),r);let n=ux(tx(e,t,r),r);return Float64Array.from(n,Number)}(e,t,r);return n?jg(i,n,0):i}(e,r,i,l),a):new dx(n,sx(e,r,i,l),a);case Ug.SEQUENCE:{let t=ix(e,r,i);return new yx(n,t[0],t[1],i.numRleValues,!1)}case Ug.CONST:return new Px(n,ox(e,r,i),a,!1)}throw Error("Vector type not supported for id column.")}var hv=class{constructor(e,t){switch(this._featureData=e,this.properties=this._featureData.properties||{},this._featureData.geometry?.type){case cx.POINT:case cx.MULTIPOINT:this.type=1;break;case cx.LINESTRING:case cx.MULTILINESTRING:this.type=2;break;case cx.POLYGON:case cx.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 r=[];for(let e of t)r.push(new l(e.x,e.y));e.push(r)}return e}},cv=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 hv(this.features[e],this.extent)}},pv=class{constructor(e){this.layers={};let t=function(e,t,r=!0){let n=new Qm(0),i=[];for(;n.get()<e.length;){let a=fg(e,n,1)[0]>>>0,s=n.get()+a;if(s>e.length)throw Error(`Block overruns tile: ${s} > ${e.length}`);let o=fg(e,n,1)[0]>>>0;if(1!==o&&2!==o){n.set(s);continue}let[l,u]=lv(e,n),h=l.featureTables[0],c=null,p=null,f=[],d=0;for(let i of h.columns){let a=i.name;if(tv(i)){let t=null;if(i.nullable){let r=Ng(e,n),i=n.get(),a=Xg(e,r.numValues,r.byteLength,n);n.set(i+r.byteLength),t=new qg(a,r.numValues)}let s=Ng(e,n);d=t?t.size():s.decompressedCount,c=uv(e,i,n,a,s,t??d,r)}else if(rv(i)){let r=fg(e,n,1)[0];if(0===d){let t=n.get();d=Ng(e,n).decompressedCount,n.set(t)}t&&(t.scale=t.extent/u),p=Ix(e,r,n,d,t)}else{let t=ev(i)?fg(e,n,1)[0]:1;if(0===t)continue;let r=Hx(e,n,i,t,d,void 0);if(r)if(Array.isArray(r))for(let e of r)f.push(e);else f.push(r)}}let y=new Hm(h.name,p,c,f,u);i.push(y),n.set(s)}return i}(new Uint8Array(e));this.layers=t.reduce((e,t)=>({...e,[t.name]:new cv(t)}),{})}},fv=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 Ss(de,16,0),this.grid3D=new Ss(de,16,0),this.featureIndexArray=new Yo,this.promoteId=t}insert(e,t,r,n,i,a){let s=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(r,n,i);let o=a?this.grid3D:this.grid;for(let e of t){let t=[1/0,1/0,-1/0,-1/0];for(let r of e)t[0]=Math.min(t[0],r.x),t[1]=Math.min(t[1],r.y),t[2]=Math.max(t[2],r.x),t[3]=Math.max(t[3],r.y);t[0]<8192&&t[1]<8192&&t[2]>=0&&t[3]>=0&&o.insert(s,t[0],t[1],t[2],t[3])}}loadVTLayers(){return this.vtLayers||("mlt"===this.encoding?this.vtLayers=new pv(this.rawTileData).layers:this.vtLayers=new xc(new Ed(this.rawTileData)).layers,this.sourceLayerCoder=new Nm(this.vtLayers?Object.keys(this.vtLayers).sort():[Mm])),this.vtLayers}query(e,t,r,n){this.loadVTLayers();let i=e.params,a=de/e.tileSize/e.scale,s=Fa(i.filter,"queryRenderedFeatures filter",i.globalState),o=e.queryGeometry,l=e.queryPadding*a,u=uc.fromPoints(o),h=this.grid.query(u.minX-l,u.minY-l,u.maxX+l,u.maxY+l),c=uc.fromPoints(e.cameraQueryGeometry).expandBy(l),p=this.grid3D.query(c.minX,c.minY,c.maxX,c.maxY,(t,r,n,i)=>fu(e.cameraQueryGeometry,t-l,r-l,n+l,i+l));for(let e of p)h.push(e);h.sort(yv);let f,d={};for(let l of h){if(l===f)continue;f=l;let u=this.featureIndexArray.get(l),h=null;this.loadMatchingFeature(d,u.bucketIndex,u.sourceLayerIndex,u.featureIndex,s,i.layers,i.availableImages,t,r,n,(t,r,n)=>(h||=Jl(t),r.queryIntersectsFeature({queryGeometry:o,feature:t,featureState:n,geometry:h,zoom:this.z,transform:e.transform,pixelsToTileUnits:a,pixelPosMatrix:e.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:e.getElevation})))}return d}loadMatchingFeature(e,t,r,n,i,a,s,o,l,u,h){let c=this.bucketLayerIDs[t];if(a&&!c.some(e=>a.has(e)))return;let p=this.sourceLayerCoder.decode(r),f=this.vtLayers[p].feature(n);if(i.needGeometry){let e=Ql(f,!0);if(!i.filter(new zs(this.tileID.overscaledZ),e,this.tileID.canonical))return}else if(!i.filter(new zs(this.tileID.overscaledZ),f))return;let d=this.getId(f,p);for(let t of c){if(a&&!a.has(t))continue;let r=o[t];if(!r)continue;let i={};d&&u&&(i=u.getState(r.sourceLayer||"_geojsonTileLayer",d));let c=Re({},l[t]);c.paint=dv(c.paint,r.paint,f,i,s),c.layout=dv(c.layout,r.layout,f,i,s);let p=!h||h(f,r,i);if(!p)continue;let y=new Um(f,this.z,this.x,this.y,d);y.layer=c;let m=e[t];void 0===m&&(m=e[t]=[]),m.push({featureIndex:n,feature:y,intersectionZ:p})}}lookupSymbolFeatures(e,t,r,n,i,a,s,o){let l={};this.loadVTLayers();let u=Fa(i.filterSpec,"queryRenderedFeatures symbol filter",i.globalState);for(let i of e)this.loadMatchingFeature(l,r,n,i,u,a,s,o,t);return l}hasLayer(e){for(let t of this.bucketLayerIDs)for(let r of t)if(e===r)return!0;return!1}getId(e,t){let r=e.id;if(this.promoteId){let n="string"==typeof this.promoteId?this.promoteId:this.promoteId[t];r=e.properties[n],"boolean"==typeof r&&(r=Number(r)),void 0===r&&e.properties?.cluster&&this.promoteId&&(r=Number(e.properties.cluster_id))}return r}};function dv(e,t,r,n,i){return Ye(e,(e,a)=>{let s=t instanceof js?t.get(a):null;return function(e){return"object"==typeof e&&!!e&&"evaluate"in e}(s)?s.evaluate(r,n,void 0,i):s})}function yv(e,t){return t-e}ks("FeatureIndex",fv,{omit:["rawTileData","sourceLayerCoder"]});var mv=class{constructor(e,t){this.max=e,this.onRemove=t,this.reset()}reset(){for(let e in this.data)for(let t of this.data[e])t.timeout&&clearTimeout(t.timeout),this.onRemove(t.value);return this.data={},this.order=[],this}add(e,t,r){let n=e.wrapped().key;void 0===this.data[n]&&(this.data[n]=[]);let i={value:t,timeout:void 0};if(void 0!==r&&(i.timeout=setTimeout(()=>{this.remove(e,i)},r)),this.data[n].push(i),this.order.push(n),this.order.length>this.max){let e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){let t=this.data[e].shift();return t.timeout&&clearTimeout(t.timeout),0===this.data[e].length&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),t.value}getByKey(e){let t=this.data[e];return t?t[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,t){if(!this.has(e))return this;let r=e.wrapped().key,n=void 0===t?0:this.data[r].indexOf(t),i=this.data[r][n];return this.data[r].splice(n,1),i.timeout&&clearTimeout(i.timeout),0===this.data[r].length&&delete this.data[r],this.onRemove(i.value),this.order.splice(this.order.indexOf(r),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){let e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}filter(e){let t=[];for(let r in this.data)for(let n of this.data[r])e(n.value)||t.push(n);for(let e of t)this.remove(e.value.tileID,e)}},gv=class{constructor(e){this.maxEntries=e,this.map=new Map}get(e){let t=this.map.get(e);return void 0!==t&&(this.map.delete(e),this.map.set(e,t)),t}set(e,t){if(this.map.has(e))this.map.delete(e);else if(this.map.size>=this.maxEntries){let e=this.map.keys().next().value;this.map.delete(e)}this.map.set(e,t)}clear(){this.map.clear()}};export{Cc as $,ge as $n,j as $r,Vs as $t,yy as A,S as Ai,Bt as An,ft as Ar,Ql as At,Kf as B,ze as Bn,ce as Br,ml as Bt,em as C,v as Ci,Ot as Cn,Se as Cr,$u as Ct,Ey as D,k as Di,$t as Dn,vt as Dr,Lu as Dt,Uy as E,I as Ei,Lt as En,mt as Er,Vu as Et,qd as F,f as Fi,me as Fn,Oe as Fr,Cl as Ft,of as G,be as Gn,oe as Gr,Zo as Gt,Ff as H,He as Hn,fe as Hr,ll as Ht,Nd as I,p as Ii,bt as In,je as Ir,Bl as It,Oc as J,We as Jn,re as Jr,cl as Jt,Zc as K,ve as Kn,ie as Kr,hl as Kt,Ud as L,c as Li,Fe as Ln,ye as Lr,Pl as Lt,Jd as M,D as Mi,Ft as Mn,_e as Mr,kl as Mt,Gd as N,d as Ni,kt as Nn,Ue as Nr,Tl as Nt,Ay as O,A as Oi,Ct as On,Ge as Or,ku as Ot,jd as P,y as Pi,It as Pn,Je as Pr,Ml as Pt,Tc as Q,Ie as Qn,B as Qr,Js as Qt,$d as R,l as Ri,lt as Rn,de as Rr,zl as Rt,im as S,F as Si,Rt as Sn,yt as Sr,Gu as St,Xy as T,w as Ti,Nt as Tn,Me as Tr,Ru as Tt,Sf as U,De as Un,pe as Ur,fl as Ut,kf as V,Le as Vn,he as Vr,Lo as Vt,vf as W,we as Wn,se as Wr,Wo as Wt,Vc as X,dt as Xn,te as Xr,io as Xt,Lc as Y,Ve as Yn,ee as Yr,uo as Yt,Pc as Z,ke as Zn,V as Zr,Ys as Zt,xm as _,g as _i,Gt as _n,Te as _r,jh as _t,Um as a,U as ai,As as an,xt as ar,Sc as at,fm as b,M as bi,zt as bn,$e as br,Ku as bt,Cm as c,H as ci,_s as cn,gt as cr,Ec as ct,Em as d,J as di,fn as dn,at as dr,xc as dt,$ as ei,Rs as en,Xe as er,Mc as et,Am as f,L as fi,Qr as fn,_t as fr,hc as ft,wm as g,K as gi,Zt as gn,Ye as gr,Yh as gt,Dm as h,Y as hi,Wt as hn,Ce as hr,Xh as ht,pv as i,N as ii,Ds as in,Be as ir,Fc as it,Xd as j,_ as ji,Tt as jn,Ee as jr,Il as jt,dy as k,E as ki,Mt as kn,tt as kr,nu as kt,Bm as l,O as li,Fa as ln,st as lr,bc as lt,Im as m,G as mi,Ht as mn,rt as mr,ic as mt,mv as n,Q as ni,Ps as nn,Ze as nr,Ic as nt,Nm as o,Z as oi,Es as on,Pe as or,_c as ot,Sm as p,X as pi,Ur as pn,Et as pr,uc as pt,zc as q,xe as qn,ae as qr,Ho as qt,fv as r,P as ri,ks as rn,et as rr,kc as rt,Mm as s,W as si,ws as sn,pt as sr,Ac as st,gv as t,q as ti,zs as tn,Re as tr,Bc as tt,_m as u,R as ui,ca as un,At as ur,vc as ut,mm as v,x as vi,jt as vn,qe as vr,Gh as vt,Ky as w,b as wi,Vt as wn,ut as wr,Nu as wt,um as x,T as xi,Pt as xn,Ae as xr,Hu as xt,ym as y,m as yi,Xt as yn,nt as yr,Qu as yt,Ed as z,ot as zn,le as zr,Ll as zt};