summit/frontend/node_modules/mapbox-gl/dist/esm-min/shared.js

10 lines
698 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

var t=1e-6,e="undefined"!=typeof Float32Array?Float32Array:Array;function r(){var t=new e(4);return e!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t}function n(t,e){var r=e[0],n=e[1],i=e[2],s=e[3],a=r*s-i*n;return a?(t[0]=s*(a=1/a),t[1]=-n*a,t[2]=-i*a,t[3]=r*a,t):null}function i(t,e,r){var n=e[0],i=e[1],s=e[2],a=e[3],o=Math.sin(r),l=Math.cos(r);return t[0]=n*l+s*o,t[1]=i*l+a*o,t[2]=n*-o+s*l,t[3]=i*-o+a*l,t}function s(){var t=new e(9);return e!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function a(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t}function o(t,e){var r=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],u=e[7],c=e[8],h=c*a-o*u,p=-c*s+o*l,d=u*s-a*l,f=r*h+n*p+i*d;return f?(t[0]=h*(f=1/f),t[1]=(-c*n+i*u)*f,t[2]=(o*n-i*a)*f,t[3]=p*f,t[4]=(c*r-i*l)*f,t[5]=(-o*r+i*s)*f,t[6]=d*f,t[7]=(-u*r+n*l)*f,t[8]=(a*r-n*s)*f,t):null}function l(t,e){var r=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],u=e[7],c=e[8];return t[0]=a*c-o*u,t[1]=i*u-n*c,t[2]=n*o-i*a,t[3]=o*l-s*c,t[4]=r*c-i*l,t[5]=i*s-r*o,t[6]=s*u-a*l,t[7]=n*l-r*u,t[8]=r*a-n*s,t}function u(t,e,r){var n=e[0],i=e[1],s=e[2],a=e[3],o=e[4],l=e[5],u=e[6],c=e[7],h=e[8],p=r[0],d=r[1],f=r[2],m=r[3],y=r[4],g=r[5],x=r[6],v=r[7],b=r[8];return t[0]=p*n+d*a+f*u,t[1]=p*i+d*o+f*c,t[2]=p*s+d*l+f*h,t[3]=m*n+y*a+g*u,t[4]=m*i+y*o+g*c,t[5]=m*s+y*l+g*h,t[6]=x*n+v*a+b*u,t[7]=x*i+v*o+b*c,t[8]=x*s+v*l+b*h,t}function c(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=r,t[2]=0,t[3]=-r,t[4]=n,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t}function h(){var t=new e(16);return e!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t}function p(t){var r=new e(16);return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[8]=t[8],r[9]=t[9],r[10]=t[10],r[11]=t[11],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15],r}function d(t,r,n,i,s,a,o,l,u,c,h,p,d,f,m,y){var g=new e(16);return g[0]=t,g[1]=r,g[2]=n,g[3]=i,g[4]=s,g[5]=a,g[6]=o,g[7]=l,g[8]=u,g[9]=c,g[10]=h,g[11]=p,g[12]=d,g[13]=f,g[14]=m,g[15]=y,g}function f(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function m(t,e){if(t===e){var r=e[1],n=e[2],i=e[3],s=e[6],a=e[7],o=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=r,t[6]=e[9],t[7]=e[13],t[8]=n,t[9]=s,t[11]=e[14],t[12]=i,t[13]=a,t[14]=o}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t}function y(t,e){var r=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],u=e[7],c=e[8],h=e[9],p=e[10],d=e[11],f=e[12],m=e[13],y=e[14],g=e[15],x=r*o-n*a,v=r*l-i*a,b=r*u-s*a,w=n*l-i*o,_=n*u-s*o,A=i*u-s*l,I=c*m-h*f,M=c*y-p*f,S=c*g-d*f,P=h*y-p*m,k=h*g-d*m,B=p*g-d*y,z=x*B-v*k+b*P+w*S-_*M+A*I;return z?(t[0]=(o*B-l*k+u*P)*(z=1/z),t[1]=(i*k-n*B-s*P)*z,t[2]=(m*A-y*_+g*w)*z,t[3]=(p*_-h*A-d*w)*z,t[4]=(l*S-a*B-u*M)*z,t[5]=(r*B-i*S+s*M)*z,t[6]=(y*b-f*A-g*v)*z,t[7]=(c*A-p*b+d*v)*z,t[8]=(a*k-o*S+u*I)*z,t[9]=(n*S-r*k-s*I)*z,t[10]=(f*_-m*b+g*x)*z,t[11]=(h*b-c*_-d*x)*z,t[12]=(o*M-a*P-l*I)*z,t[13]=(r*P-n*M+i*I)*z,t[14]=(m*v-f*w-y*x)*z,t[15]=(c*w-h*v+p*x)*z,t):null}function g(t,e,r){var n=e[0],i=e[1],s=e[2],a=e[3],o=e[4],l=e[5],u=e[6],c=e[7],h=e[8],p=e[9],d=e[10],f=e[11],m=e[12],y=e[13],g=e[14],x=e[15],v=r[0],b=r[1],w=r[2],_=r[3];return t[0]=v*n+b*o+w*h+_*m,t[1]=v*i+b*l+w*p+_*y,t[2]=v*s+b*u+w*d+_*g,t[3]=v*a+b*c+w*f+_*x,t[4]=(v=r[4])*n+(b=r[5])*o+(w=r[6])*h+(_=r[7])*m,t[5]=v*i+b*l+w*p+_*y,t[6]=v*s+b*u+w*d+_*g,t[7]=v*a+b*c+w*f+_*x,t[8]=(v=r[8])*n+(b=r[9])*o+(w=r[10])*h+(_=r[11])*m,t[9]=v*i+b*l+w*p+_*y,t[10]=v*s+b*u+w*d+_*g,t[11]=v*a+b*c+w*f+_*x,t[12]=(v=r[12])*n+(b=r[13])*o+(w=r[14])*h+(_=r[15])*m,t[13]=v*i+b*l+w*p+_*y,t[14]=v*s+b*u+w*d+_*g,t[15]=v*a+b*c+w*f+_*x,t}function x(t,e,r){var n,i,s,a,o,l,u,c,h,p,d,f,m=r[0],y=r[1],g=r[2];return e===t?(t[12]=e[0]*m+e[4]*y+e[8]*g+e[12],t[13]=e[1]*m+e[5]*y+e[9]*g+e[13],t[14]=e[2]*m+e[6]*y+e[10]*g+e[14],t[15]=e[3]*m+e[7]*y+e[11]*g+e[15]):(i=e[1],s=e[2],a=e[3],o=e[4],l=e[5],u=e[6],c=e[7],h=e[8],p=e[9],d=e[10],f=e[11],t[0]=n=e[0],t[1]=i,t[2]=s,t[3]=a,t[4]=o,t[5]=l,t[6]=u,t[7]=c,t[8]=h,t[9]=p,t[10]=d,t[11]=f,t[12]=n*m+o*y+h*g+e[12],t[13]=i*m+l*y+p*g+e[13],t[14]=s*m+u*y+d*g+e[14],t[15]=a*m+c*y+f*g+e[15]),t}function v(t,e,r){var n=r[0],i=r[1],s=r[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*s,t[9]=e[9]*s,t[10]=e[10]*s,t[11]=e[11]*s,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function b(t,e,r){var n=Math.sin(r),i=Math.cos(r),s=e[4],a=e[5],o=e[6],l=e[7],u=e[8],c=e[9],h=e[10],p=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=s*i+u*n,t[5]=a*i+c*n,t[6]=o*i+h*n,t[7]=l*i+p*n,t[8]=u*i-s*n,t[9]=c*i-a*n,t[10]=h*i-o*n,t[11]=p*i-l*n,t}function w(t,e,r){var n=Math.sin(r),i=Math.cos(r),s=e[0],a=e[1],o=e[2],l=e[3],u=e[8],c=e[9],h=e[10],p=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=s*i-u*n,t[1]=a*i-c*n,t[2]=o*i-h*n,t[3]=l*i-p*n,t[8]=s*n+u*i,t[9]=a*n+c*i,t[10]=o*n+h*i,t[11]=l*n+p*i,t}function _(t,e,r){var n=Math.sin(r),i=Math.cos(r),s=e[0],a=e[1],o=e[2],l=e[3],u=e[4],c=e[5],h=e[6],p=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=s*i+u*n,t[1]=a*i+c*n,t[2]=o*i+h*n,t[3]=l*i+p*n,t[4]=u*i-s*n,t[5]=c*i-a*n,t[6]=h*i-o*n,t[7]=p*i-l*n,t}function A(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function I(e,r,n){var i,s,a,o=n[0],l=n[1],u=n[2],c=Math.sqrt(o*o+l*l+u*u);return c<t?null:(o*=c=1/c,l*=c,u*=c,i=Math.sin(r),s=Math.cos(r),e[0]=o*o*(a=1-s)+s,e[1]=l*o*a+u*i,e[2]=u*o*a-l*i,e[3]=0,e[4]=o*l*a-u*i,e[5]=l*l*a+s,e[6]=u*l*a+o*i,e[7]=0,e[8]=o*u*a+l*i,e[9]=l*u*a-o*i,e[10]=u*u*a+s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e)}function M(t,e){var r=e[0],n=e[1],i=e[2],s=e[4],a=e[5],o=e[6],l=e[8],u=e[9],c=e[10];return t[0]=Math.sqrt(r*r+n*n+i*i),t[1]=Math.sqrt(s*s+a*a+o*o),t[2]=Math.sqrt(l*l+u*u+c*c),t}function S(t,r){var n=new e(3);M(n,r);var i=1/n[0],s=1/n[1],a=1/n[2],o=r[0]*i,l=r[1]*s,u=r[2]*a,c=r[4]*i,h=r[5]*s,p=r[6]*a,d=r[8]*i,f=r[9]*s,m=r[10]*a,y=o+h+m,g=0;return y>0?(g=2*Math.sqrt(y+1),t[3]=.25*g,t[0]=(p-f)/g,t[1]=(d-u)/g,t[2]=(l-c)/g):o>h&&o>m?(g=2*Math.sqrt(1+o-h-m),t[3]=(p-f)/g,t[0]=.25*g,t[1]=(l+c)/g,t[2]=(d+u)/g):h>m?(g=2*Math.sqrt(1+h-o-m),t[3]=(d-u)/g,t[0]=(l+c)/g,t[1]=.25*g,t[2]=(p+f)/g):(g=2*Math.sqrt(1+m-o-h),t[3]=(l-c)/g,t[0]=(d+u)/g,t[1]=(p+f)/g,t[2]=.25*g),t}function P(t,e){var r=e[0],n=e[1],i=e[2],s=e[3],a=r+r,o=n+n,l=i+i,u=r*a,c=n*a,h=n*o,p=i*a,d=i*o,f=i*l,m=s*a,y=s*o,g=s*l;return t[0]=1-h-f,t[1]=c+g,t[2]=p-y,t[3]=0,t[4]=c-g,t[5]=1-u-f,t[6]=d+m,t[7]=0,t[8]=p+y,t[9]=d-m,t[10]=1-u-h,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}var k=function(t,e,r,n,i){var s=1/Math.tan(e/2);if(t[0]=s/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=s,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=i&&i!==1/0){var a=1/(n-i);t[10]=(i+n)*a,t[14]=2*i*n*a}else t[10]=-1,t[14]=-2*n;return t},B=function(t,e,r,n,i,s,a){var o=1/(e-r),l=1/(n-i),u=1/(s-a);return t[0]=-2*o,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*u,t[11]=0,t[12]=(e+r)*o,t[13]=(i+n)*l,t[14]=(a+s)*u,t[15]=1,t},z=g;function T(){var t=new e(3);return e!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function E(t){var r=new e(3);return r[0]=t[0],r[1]=t[1],r[2]=t[2],r}function V(t){var e=t[0],r=t[1],n=t[2];return Math.sqrt(e*e+r*r+n*n)}function F(t,r,n){var i=new e(3);return i[0]=t,i[1]=r,i[2]=n,i}function C(t,e,r,n){return t[0]=e,t[1]=r,t[2]=n,t}function D(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t}function R(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t}function L(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t}function O(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t[2]=Math.min(e[2],r[2]),t}function U(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t[2]=Math.max(e[2],r[2]),t}function N(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t}function j(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t[2]=e[2]+r[2]*n,t}function $(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2];return Math.sqrt(r*r+n*n+i*i)}function G(t,e){var r=e[0]-t[0],n=e[1]-t[1],i=e[2]-t[2];return r*r+n*n+i*i}function q(t){var e=t[0],r=t[1],n=t[2];return e*e+r*r+n*n}function H(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t}function X(t,e){var r=e[0],n=e[1],i=e[2],s=r*r+n*n+i*i;return s>0&&(s=1/Math.sqrt(s)),t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t}function Z(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function W(t,e,r){var n=e[0],i=e[1],s=e[2],a=r[0],o=r[1],l=r[2];return t[0]=i*l-s*o,t[1]=s*a-n*l,t[2]=n*o-i*a,t}function Y(t,e,r,n){var i=e[0],s=e[1],a=e[2];return t[0]=i+n*(r[0]-i),t[1]=s+n*(r[1]-s),t[2]=a+n*(r[2]-a),t}function K(t,e,r){var n=e[0],i=e[1],s=e[2],a=r[3]*n+r[7]*i+r[11]*s+r[15];return t[0]=(r[0]*n+r[4]*i+r[8]*s+r[12])/(a=a||1),t[1]=(r[1]*n+r[5]*i+r[9]*s+r[13])/a,t[2]=(r[2]*n+r[6]*i+r[10]*s+r[14])/a,t}function J(t,e,r){var n=e[0],i=e[1],s=e[2];return t[0]=n*r[0]+i*r[3]+s*r[6],t[1]=n*r[1]+i*r[4]+s*r[7],t[2]=n*r[2]+i*r[5]+s*r[8],t}function Q(t,e,r){var n=r[0],i=r[1],s=r[2],a=r[3],o=e[0],l=e[1],u=e[2],c=i*u-s*l,h=s*o-n*u,p=n*l-i*o;return t[0]=o+a*(c+=c)+i*(p+=p)-s*(h+=h),t[1]=l+a*h+s*c-n*p,t[2]=u+a*p+n*h-i*c,t}function tt(t){return t[0]=0,t[1]=0,t[2]=0,t}function et(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]}var rt=R,nt=L,it=function(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t[2]=e[2]/r[2],t},st=V;function at(){var t=new e(4);return e!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function ot(t,r,n,i){var s=new e(4);return s[0]=t,s[1]=r,s[2]=n,s[3]=i,s}function lt(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t[2]=Math.min(e[2],r[2]),t[3]=Math.min(e[3],r[3]),t}function ut(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t[2]=Math.max(e[2],r[2]),t[3]=Math.max(e[3],r[3]),t}function ct(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t}function ht(t,e){var r=e[0],n=e[1],i=e[2],s=e[3],a=r*r+n*n+i*i+s*s;return a>0&&(a=1/Math.sqrt(a)),t[0]=r*a,t[1]=n*a,t[2]=i*a,t[3]=s*a,t}function pt(t,e,r,n){var i=e[0],s=e[1],a=e[2],o=e[3];return t[0]=i+n*(r[0]-i),t[1]=s+n*(r[1]-s),t[2]=a+n*(r[2]-a),t[3]=o+n*(r[3]-o),t}function dt(t,e,r){var n=e[0],i=e[1],s=e[2],a=e[3];return t[0]=r[0]*n+r[4]*i+r[8]*s+r[12]*a,t[1]=r[1]*n+r[5]*i+r[9]*s+r[13]*a,t[2]=r[2]*n+r[6]*i+r[10]*s+r[14]*a,t[3]=r[3]*n+r[7]*i+r[11]*s+r[15]*a,t}function ft(){var t=new e(4);return e!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function mt(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t}function yt(e,r){var n=2*Math.acos(r[3]),i=Math.sin(n/2);return i>t?(e[0]=r[0]/i,e[1]=r[1]/i,e[2]=r[2]/i):(e[0]=1,e[1]=0,e[2]=0),n}function gt(t,e,r){r*=.5;var n=e[0],i=e[1],s=e[2],a=e[3],o=Math.sin(r),l=Math.cos(r);return t[0]=n*l+a*o,t[1]=i*l+s*o,t[2]=s*l-i*o,t[3]=a*l-n*o,t}function xt(t,e,r){r*=.5;var n=e[0],i=e[1],s=e[2],a=e[3],o=Math.sin(r),l=Math.cos(r);return t[0]=n*l-s*o,t[1]=i*l+a*o,t[2]=s*l+n*o,t[3]=a*l-i*o,t}function vt(t,e,r){r*=.5;var n=e[0],i=e[1],s=e[2],a=e[3],o=Math.sin(r),l=Math.cos(r);return t[0]=n*l+i*o,t[1]=i*l-n*o,t[2]=s*l+a*o,t[3]=a*l-s*o,t}function bt(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t}T(),at();var wt,_t,At,It=function(t){var e=t[0],r=t[1],n=t[2],i=t[3];return Math.sqrt(e*e+r*r+n*n+i*i)},Mt=ht,St=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]},Pt=(wt=T(),_t=F(1,0,0),At=F(0,1,0),function(t,e,r){var n=Z(e,r);return n<-.999999?(W(wt,_t,e),st(wt)<1e-6&&W(wt,At,e),X(wt,wt),function(t,e,r){r*=.5;var n=Math.sin(r);t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=Math.cos(r)}(t,wt,Math.PI),t):n>.999999?(t[0]=0,t[1]=0,t[2]=0,t[3]=1,t):(W(wt,e,r),t[0]=wt[0],t[1]=wt[1],t[2]=wt[2],t[3]=1+n,Mt(t,t))});function kt(){var t=new e(2);return e!=Float32Array&&(t[0]=0,t[1]=0),t}function Bt(t,r){var n=new e(2);return n[0]=t,n[1]=r,n}function zt(t,e,r){return t[0]=e,t[1]=r,t}function Tt(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t}function Et(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t}function Vt(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t}function Ft(t){var e=t[0],r=t[1];return Math.sqrt(e*e+r*r)}function Ct(t,e){var r=e[0],n=e[1],i=r*r+n*n;return i>0&&(i=1/Math.sqrt(i)),t[0]=e[0]*i,t[1]=e[1]*i,t}function Dt(t,e){return t[0]*e[0]+t[1]*e[1]}ft(),ft(),s();var Rt,Lt,Ot=Et;function Ut(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}kt();var Nt=function(){if(Lt)return Rt;function t(t,e,r,n){this.cx=3*t,this.bx=3*(r-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=e,this.p2x=r,this.p2y=n}return Lt=1,Rt=t,t.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,e){if(void 0===e&&(e=1e-6),t<0)return 0;if(t>1)return 1;for(var r=t,n=0;n<8;n++){var i=this.sampleCurveX(r)-t;if(Math.abs(i)<e)return r;var s=this.sampleCurveDerivativeX(r);if(Math.abs(s)<1e-6)break;r-=i/s}var a=0,o=1;for(r=t,n=0;n<20&&(i=this.sampleCurveX(r),!(Math.abs(i-t)<e));n++)t>i?a=r:o=r,r=.5*(o-a)+a;return r},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}},Rt}();const jt=Ut(Nt);function $t(t,e){this.x=t,this.y=e}function Gt(t,e){if(Array.isArray(t)){if(!Array.isArray(e)||t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(!Gt(t[r],e[r]))return!1;return!0}if("object"==typeof t&&null!==t&&null!==e){if("object"!=typeof e)return!1;if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const r in t)if(!Gt(t[r],e[r]))return!1;return!0}return t===e}$t.prototype={clone(){return new $t(this.x,this.y)},add(t){return this.clone()._add(t)},sub(t){return this.clone()._sub(t)},multByPoint(t){return this.clone()._multByPoint(t)},divByPoint(t){return this.clone()._divByPoint(t)},mult(t){return this.clone()._mult(t)},div(t){return this.clone()._div(t)},rotate(t){return this.clone()._rotate(t)},rotateAround(t,e){return this.clone()._rotateAround(t,e)},matMult(t){return this.clone()._matMult(t)},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(t){return this.x===t.x&&this.y===t.y},dist(t){return Math.sqrt(this.distSqr(t))},distSqr(t){const e=t.x-this.x,r=t.y-this.y;return e*e+r*r},angle(){return Math.atan2(this.y,this.x)},angleTo(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith(t){return this.angleWithSep(t.x,t.y)},angleWithSep(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult(t){const e=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=e,this},_add(t){return this.x+=t.x,this.y+=t.y,this},_sub(t){return this.x-=t.x,this.y-=t.y,this},_mult(t){return this.x*=t,this.y*=t,this},_div(t){return this.x/=t,this.y/=t,this},_multByPoint(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint(t){return this.x/=t.x,this.y/=t.y,this},_unit(){return this._div(this.mag()),this},_perp(){const t=this.y;return this.y=this.x,this.x=-t,this},_rotate(t){const e=Math.cos(t),r=Math.sin(t),n=r*this.x+e*this.y;return this.x=e*this.x-r*this.y,this.y=n,this},_rotateAround(t,e){const r=Math.cos(t),n=Math.sin(t),i=e.y+n*(this.x-e.x)+r*(this.y-e.y);return this.x=e.x+r*(this.x-e.x)-n*(this.y-e.y),this.y=i,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:$t},$t.convert=function(t){if(t instanceof $t)return t;if(Array.isArray(t))return new $t(+t[0],+t[1]);if(void 0!==t.x&&void 0!==t.y)return new $t(+t.x,+t.y);throw new Error("Expected [x, y] or {x, y} point format")};const qt=Math.PI/180,Ht=180/Math.PI;function Xt(t){return t*qt}function Zt(t){return t*Ht}const Wt=[[0,0],[1,0],[1,1],[0,1]];function Yt(t){const e=Math.round((t+45+360)%360/90)%4;return Wt[e]}function Kt(t){if(t<=0)return 0;if(t>=1)return 1;const e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}function Jt(t){let e=1/0,r=1/0,n=-1/0,i=-1/0;for(const s of t)e=Math.min(e,s.x),r=Math.min(r,s.y),n=Math.max(n,s.x),i=Math.max(i,s.y);return{min:new $t(e,r),max:new $t(n,i)}}function Qt(t,e,r){let n=0;for(let r=0;r<2;++r){const i=0;t[r]>i&&(n+=(t[r]-i)*(t[r]-i)),e[r]<i&&(n+=(i-e[r])*(i-e[r]))}return n}function te(t,e,r=0,n=!0){const i=new $t(r,r),s=t.sub(i),a=e.add(i),o=[s,new $t(a.x,s.y),a,new $t(s.x,a.y)];return n&&o.push(s.clone()),o}function ee(t,e){const r=[];for(let n=0;n<t.length;n++){const i=ae(n-1,-1,t.length-1),s=ae(n+1,-1,t.length-1),a=t[n],o=t[s],l=t[i].sub(a).unit(),u=o.sub(a).unit(),c=u.angleWithSep(l.x,l.y),h=l.add(u).unit().mult(-1*e/Math.sin(c/2));r.push(a.add(h))}return r}function re(t,e,r,n){const i=new jt(t,e,r,n);return function(t){return i.solve(t)}}const ne=re(.25,.1,.25,1);function ie(t,e,r){return Math.min(r,Math.max(e,t))}function se(t,e,r){return(r=ie((r-t)/(e-t),0,1))*r*(3-2*r)}function ae(t,e,r){const n=r-e,i=((t-e)%n+n)%n+e;return i===e?r:i}function oe(t,e,r){if(!t.length)return r(null,[]);let n=t.length;const i=new Array(t.length);let s=null;t.forEach(((t,a)=>{e(t,((t,e)=>{t&&(s=t),i[a]=e,0==--n&&r(s,i)}))}))}function le(t,e){const r=[];for(const n in t)n in e||r.push(n);return r}function ue(t,e){const r={};for(let n=0;n<e.length;n++){const i=e[n];i in t&&(r[i]=t[i])}return r}let ce=1;function he(){return ce++}function pe(){return function t(e){return e?(e^Math.random()*(16>>e/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,t)}()}function de(t){return t<=1?1:Math.pow(2,Math.ceil(Math.log2(t)))}function fe(t){return t<=1?1:Math.pow(2,Math.floor(Math.log2(t)))}function me(t){return!!t&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(t)}function ye(t,e){t.forEach((t=>{e[t]&&(e[t]=e[t].bind(e))}))}function ge(t,e,r){const n={};for(const r in t)n[r]=e.call(this,t[r],r,t);return n}function xe(t,e,r){const n={};for(const r in t)e.call(this,t[r],r,t)&&(n[r]=t[r]);return n}function ve(t){return Array.isArray(t)?t.map(ve):"object"==typeof t&&t?ge(t,ve):t}function be(t,e,r,n,i){return ie((t-e)/(r-e)*(i-n)+n,n,i)}function we(t,e){for(let r=0;r<t.length;r++)if(e.indexOf(t[r])>=0)return!0;return!1}const _e={};function Ae(t){_e[t]||("undefined"!=typeof console&&console.warn(t),_e[t]=!0)}function Ie(t,e,r){return(r.y-t.y)*(e.x-t.x)>(e.y-t.y)*(r.x-t.x)}function Me(t){let e=0;for(let r,n,i=0,s=t.length,a=s-1;i<s;a=i++)r=t[i],n=t[a],e+=(n.x-r.x)*(r.y+n.y);return e}function Se([t,e,r]){const n=Xt(e+90),i=Xt(r);return{x:t*Math.cos(n)*Math.sin(i),y:t*Math.sin(n)*Math.sin(i),z:t*Math.cos(i),azimuthal:e,polar:r}}function Pe(t,e,r){const n=Math.sqrt(t*t+e*e+r*r),i=n>0?Math.acos(r/n)*Ht:0;let s=0!==t||0!==e?Math.atan2(-e,-t)*Ht+90:0;return s<0&&(s+=360),[n,s,i]}function ke(t){return("undefined"!=typeof self||void 0!==t)&&"undefined"!=typeof WorkerGlobalScope&&(void 0!==t?t:self)instanceof WorkerGlobalScope}function Be(t){const e={};if(t.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((t,r,n,i)=>{const s=n||i;return e[r]=!s||s.toLowerCase(),""})),e["max-age"]){const t=parseInt(e["max-age"],10);isNaN(t)?delete e["max-age"]:e["max-age"]=t}return e}function ze(t){return t?{cacheControl:t.get("Cache-Control"),expires:t.get("Expires")}:{cacheControl:void 0,expires:void 0}}let Te=null;function Ee(t){const e=t.navigator?t.navigator.userAgent:null;return!!function(t){if(null==Te){const e=t.navigator?t.navigator.userAgent:null;Te=!!t.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return Te}(t)&&!(!e||!(e.match("Version/15.4")||e.match("Version/15.5")||e.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/)))}function Ve(){return!!document.fullscreenElement||!!document.webkitFullscreenElement}function Fe(t){try{const e=self[t];return e.setItem("_mapbox_test_",1),e.removeItem("_mapbox_test_"),!0}catch(t){return!1}}function Ce(t){return btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,((t,e)=>String.fromCharCode(Number("0x"+e)))))}function De(t){return decodeURIComponent(atob(t).split("").map((t=>"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2))).join(""))}function Re(t,e){return[t[4*e],t[4*e+1],t[4*e+2],t[4*e+3]]}function Le(t,e,r){t[4*e+0]=r[0],t[4*e+1]=r[1],t[4*e+2]=r[2],t[4*e+3]=r[3]}function Oe(t,e){return[Math.pow(t[0],2.2)*e,Math.pow(t[1],2.2)*e,Math.pow(t[2],2.2)*e]}function Ue(t){return[Math.pow(t[0],1/2.2),Math.pow(t[1],1/2.2),Math.pow(t[2],1/2.2)]}function Ne(t,e,r,n){for(;e<r;){const i=e+r>>1;t[i]<n?e=i+1:r=i}return e}function je(t,e,r,n){for(;e<r;){const i=e+r>>1;t[i]<=n?e=i+1:r=i}return e}function $e(t){return t>0?1/(1.001-t):1+t}function Ge(t){return t>0?1-1/(1.001-t):-t}function qe(t,e,r){return(t-e.min)*(r.max-r.min)/(e.max-e.min)+r.min}function He(t){return t*t*t*t*t}const Xe={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i},get API_TILEJSON_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/v[0-9]*\/.*\.json.*$)/i},get API_SPRITE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*\/sprite.*\..*$)/i},get API_FONTS_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/fonts\/v[0-9]*\/)(.*\.pbf.*$)/i},get API_STYLE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*$)/i},get API_CDN_URL_REGEX(){return/^((https?:)?\/\/)?api\.mapbox\.c(n|om)(\/mapbox-gl-js\/)(.*$)/i},get EVENTS_URL(){if(!Xe.API_URL)return null;try{const t=new URL(Xe.API_URL);return"api.mapbox.cn"===t.hostname?"https://events.mapbox.cn/events/v2":"api.mapbox.com"===t.hostname?"https://events.mapbox.com/events/v2":null}catch(t){return null}},SESSION_PATH:"/map-sessions/v1",FEEDBACK_URL:"https://apps.mapbox.com/feedback",TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"raster/v1",RASTERARRAYS_URL_PREFIX:"rasterarrays/v1",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,DEFAULT_STYLE:"mapbox://styles/mapbox/standard",MAX_PARALLEL_IMAGE_REQUESTS:16,DRACO_URL:"https://api.mapbox.com/mapbox-gl-js/draco_decoder_gltf_v1.5.6.wasm",MESHOPT_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_base_v0.20.wasm",MESHOPT_SIMD_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_simd_v0.20.wasm",BUILDING_GEN_URL:"https://api.mapbox.com/mapbox-gl-js/building-gen/building_gen_v1.2.4.wasm",GLYPHS_URL:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf",TILES3D_URL_PREFIX:"3dtiles/v1"};function Ze(t){return Xe.API_URL_REGEX.test(t)}function We(t){return 0===t.indexOf("mapbox:")}function Ye(t){return Xe.API_CDN_URL_REGEX.test(t)}function Ke(t){return Xe.API_SPRITE_REGEX.test(t)}function Je(t){return Xe.API_STYLE_REGEX.test(t)&&!Ke(t)}function Qe(t){return Xe.API_TILEJSON_REGEX.test(t)}function tr(t){return Xe.API_FONTS_REGEX.test(t)}let er,rr,nr,ir,sr,ar;function or(){return null==er&&(er=self.OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof self.createImageBitmap),er}const lr={now:()=>void 0!==ir?ir:performance.now(),setNow(t){ir=t},restoreNow(){ir=void 0},frame(t){const e=requestAnimationFrame(t);return{cancel:()=>cancelAnimationFrame(e)}},getImageData(t,e=0){const{width:r,height:n}=t;sr||(sr=document.createElement("canvas"));const i=sr.getContext("2d",{willReadFrequently:!0});if(!i)throw new Error("failed to create canvas 2d context");return(r>sr.width||n>sr.height)&&(sr.width=r,sr.height=n),i.clearRect(-e,-e,r+2*e,n+2*e),i.drawImage(t,0,0,r,n),i.getImageData(-e,-e,r+2*e,n+2*e)},resolveURL:t=>(rr||(rr=document.createElement("a")),rr.href=t,rr.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(null==nr&&(nr=window.matchMedia("(prefers-reduced-motion: reduce)")),nr.matches)},hasCanvasFingerprintNoise(){if(void 0!==ar)return ar;if(!or())return ar=!1,!1;const t=new OffscreenCanvas(85,1),e=t.getContext("2d",{willReadFrequently:!0});let r=0;for(let n=0;n<t.width;++n)e.fillStyle=`rgba(${r++},${r++},${r++}, 255)`,e.fillRect(n,0,1,1);const n=e.getImageData(0,0,t.width,t.height);r=0;for(let t=0;t<n.data.length;++t)if(t%4!=3&&r++!==n.data[t])return ar=!0,!0;return ar=!1,!1}};function ur(t,e){const r=t.indexOf("?");if(r<0)return`${t}?${new URLSearchParams(e).toString()}`;const n=new URLSearchParams(t.slice(r));for(const t in e)n.set(t,e[t]);return`${t.slice(0,r)}?${n.toString()}`}function cr(t,e={persistentParams:[]}){const r=t.indexOf("?");if(r<0)return t;const n=new URLSearchParams,i=new URLSearchParams(t.slice(r));for(const t of e.persistentParams){const e=i.get(t);e&&n.set(t,e)}const s=n.toString();return`${t.slice(0,r)}${s.length>0?`?${s}`:""}`}const hr="mapbox-tiles";let pr=500,dr=50;const fr=["language","worldview","jobid"];let mr,yr;function gr(){try{return caches}catch(t){}}function xr(){const t=gr();t&&null==mr&&(mr=t.open(hr))}let vr=1/0;function br(t){vr++,vr>dr&&(t.getActor().send("enforceCacheSizeLimit",pr),vr=0)}function wr(t){xr(),null!=mr&&mr.then((e=>{e.keys().then((r=>{for(let n=0;n<r.length-t;n++)e.delete(r[n]).catch((t=>Ae(t.message)))})).catch((t=>Ae(t.message)))})).catch((t=>Ae(t.message)))}function _r(t){const e=gr();if(!e)return;const r=e.delete(hr);t&&r.then((()=>t())).catch(t)}function Ar(t,e){pr=t,dr=e}const Ir={supported:!1,testSupport:function(t){!Pr&&Sr&&(kr?zr(t):Mr=t)}};let Mr,Sr,Pr=!1,kr=!1;const Br="undefined"!=typeof self?self:{};function zr(t){const e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e);try{if(t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,Sr),t.isContextLost())return;Ir.supported=!0}catch(t){}t.deleteTexture(e),Pr=!0}Br.document&&(Sr=Br.document.createElement("img"),Sr.onload=function(){Mr&&zr(Mr),Mr=null,kr=!0},Sr.onerror=function(){Pr=!0,Mr=null},Sr.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const Tr={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Iconset:"Iconset",Image:"Image",Model:"Model"};"function"==typeof Object.freeze&&Object.freeze(Tr);class Er extends Error{constructor(t,e,r){401===e&&Ze(r)&&(t+=": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes"),super(t),this.status=e,this.url=r}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const Vr=ke()?()=>self.worker.referrer:()=>("blob:"===location.protocol?parent:self).location.href;const Fr=function(t,e){if(!(/^file:/.test(r=t.url)||/^file:/.test(Vr())&&!/^\w+:/.test(r))){if(self.fetch&&self.Request&&self.AbortController&&Request.prototype.hasOwnProperty("signal"))return function(t,e){const r=new AbortController,n=new Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,referrer:Vr(),referrerPolicy:t.referrerPolicy,signal:r.signal});let i=!1,s=!1;const a=(o=n.url).indexOf("sku=")>0&&Ze(o);var o;"json"===t.type&&n.headers.set("Accept","application/json");const l=(r,i,o)=>{if(s)return;if(r&&"SecurityError"!==r.message&&Ae(r.toString()),i&&o)return u(i);const l=Date.now();fetch(n).then((r=>{if(r.ok){const t=a?r.clone():null;return u(r,t,l)}return e(new Er(r.statusText,r.status,t.url))})).catch((r=>{"AbortError"!==r.name&&e(new Error(`${r.message} ${t.url}`))}))},u=(r,a,o)=>{("arrayBuffer"===t.type?r.arrayBuffer():"json"===t.type?r.json():r.text()).then((t=>{s||(a&&o&&function(t,e,r){if(xr(),null==mr)return;const n=Be(e.headers.get("Cache-Control")||"");if(n["no-store"])return;const i={status:e.status,statusText:e.statusText,headers:new Headers};e.headers.forEach(((t,e)=>i.headers.set(e,t))),n["max-age"]&&i.headers.set("Expires",new Date(r+1e3*n["max-age"]).toUTCString());const s=i.headers.get("Expires");if(!s)return;if(new Date(s).getTime()-r<42e4)return;let a=cr(t.url,{persistentParams:fr});if(206===e.status){const e=t.headers.get("Range");if(!e)return;i.status=200,a=ur(a,{range:e})}!function(t,e){if(void 0===yr)try{new Response(new ReadableStream),yr=!0}catch(t){yr=!1}yr?e(t.body):t.blob().then(e).catch((t=>Ae(t.message)))}(e,(t=>{const r=new Response(200!==(n=e.status)&&404!==n&&[101,103,204,205,304].includes(n)?null:t,i);var n;xr(),null!=mr&&mr.then((t=>t.put(a,r))).catch((t=>Ae(t.message)))}))}(n,a,o),i=!0,e(null,t,r.headers))})).catch((t=>{s||e(new Error(t.message))}))};return a?function(t,e){if(xr(),null==mr)return e(null);mr.then((r=>{let n=cr(t.url,{persistentParams:fr});const i=t.headers.get("Range");i&&(n=ur(n,{range:i})),r.match(n).then((t=>{const i=function(t){if(!t)return!1;const e=new Date(t.headers.get("Expires")||0),r=Be(t.headers.get("Cache-Control")||"");return Number(e)>Date.now()&&!r["no-cache"]}(t);r.delete(n).catch(e),i&&r.put(n,t.clone()).catch(e),e(null,t,i)})).catch(e)})).catch(e)}(n,l):l(null,null),{cancel:()=>{s=!0,i||r.abort()}}}(t,e);if(ke(self)&&self.worker.actor)return self.worker.actor.send("getResource",t,e,void 0,!0)}var r;return function(t,e){const r=new XMLHttpRequest;r.open(t.method||"GET",t.url,!0),"arrayBuffer"===t.type&&(r.responseType="arraybuffer");for(const e in t.headers)r.setRequestHeader(e,t.headers[e]);return"json"===t.type&&(r.responseType="text",r.setRequestHeader("Accept","application/json")),r.withCredentials="include"===t.credentials,r.onerror=()=>{e(new Error(r.statusText))},r.onload=()=>{if((r.status>=200&&r.status<300||0===r.status)&&null!==r.response){let n=r.response;if("json"===t.type)try{n=JSON.parse(r.response)}catch(t){return e(t)}const i=new Headers;r.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach((t=>{const e=t.split(": "),r=e.shift(),n=e.join(": ");i.append(r,n)})),e(null,n,i)}else e(new Er(r.statusText,r.status,t.url))},r.send(t.body),{cancel:()=>r.abort()}}(t,e)},Cr=function(t,e){return Fr(Object.assign(t,{type:"json"}),e)},Dr=function(t,e){return Fr(Object.assign(t,{type:"arrayBuffer"}),e)},Rr=function(t,e){return Fr(Object.assign(t,{method:"POST"}),e)},Lr=function(t,e){return Fr(Object.assign(t,{method:"GET"}),e)};function Or(t){const e=document.createElement("a");return e.href=t,e.protocol===location.protocol&&e.host===location.host}const Ur="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let Nr,jr;Nr=[],jr=0;const $r=function(t,e){if(Ir.supported&&(t.headers||(t.headers={}),t.headers.accept="image/webp,*/*"),jr>=Xe.MAX_PARALLEL_IMAGE_REQUESTS){const r={requestParameters:t,callback:e,cancelled:!1,cancel(){this.cancelled=!0}};return Nr.push(r),r}jr++;let r=!1;const n=()=>{if(!r)for(r=!0,jr--;Nr.length&&jr<Xe.MAX_PARALLEL_IMAGE_REQUESTS;){const t=Nr.shift(),{requestParameters:e,callback:r,cancelled:n}=t;n||(t.cancel=$r(e,r).cancel)}},i=Dr(t,((t,r,i)=>{n(),t?e(t):r&&(self.createImageBitmap?function(t,e){const r=new Blob([new Uint8Array(t)],{type:"image/png"});createImageBitmap(r).then((t=>{e(null,t)})).catch((t=>{e(new Error(`Could not load image because of ${t.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))}))}(r,((t,r)=>e(t,r,i))):function(t,e){const r=new Image;r.onload=()=>{e(null,r),URL.revokeObjectURL(r.src),r.onload=null,requestAnimationFrame((()=>{r.src=Ur}))},r.onerror=()=>e(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const n=new Blob([new Uint8Array(t)],{type:"image/png"});r.src=t.byteLength?URL.createObjectURL(n):Ur}(r,((t,r)=>e(t,r,i))))}));return{cancel:()=>{i.cancel(),n()}}},Gr=function(t,e){const r=document.createElement("video");r.muted=!0,r.onloadstart=function(){e(null,r)};for(let e=0;e<t.length;e++){const n=document.createElement("source");Or(t[e])||(r.crossOrigin="Anonymous"),n.src=t[e],r.appendChild(n)}return{cancel:()=>{}}};var qr,Hr,Xr,Zr={exports:{}},Wr={exports:{}},Yr={exports:{}},Kr=function(){if(Xr)return Zr.exports;Xr=1;var t=(qr||(qr=1,Wr.exports=function(t,e){var r,n,i,s,a,o,l,u;for(n=t.length-(r=3&t.length),i=e,a=3432918353,o=461845907,u=0;u<n;)l=255&t.charCodeAt(u)|(255&t.charCodeAt(++u))<<8|(255&t.charCodeAt(++u))<<16|(255&t.charCodeAt(++u))<<24,++u,i=27492+(65535&(s=5*(65535&(i=(i^=l=(65535&(l=(l=(65535&l)*a+(((l>>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*o+(((l>>>16)*o&65535)<<16)&4294967295)<<13|i>>>19))+((5*(i>>>16)&65535)<<16)&4294967295))+((58964+(s>>>16)&65535)<<16);switch(l=0,r){case 3:l^=(255&t.charCodeAt(u+2))<<16;case 2:l^=(255&t.charCodeAt(u+1))<<8;case 1:i^=l=(65535&(l=(l=(65535&(l^=255&t.charCodeAt(u)))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<15|l>>>17))*o+(((l>>>16)*o&65535)<<16)&4294967295}return i^=t.length,i=2246822507*(65535&(i^=i>>>16))+((2246822507*(i>>>16)&65535)<<16)&4294967295,i=3266489909*(65535&(i^=i>>>13))+((3266489909*(i>>>16)&65535)<<16)&4294967295,(i^=i>>>16)>>>0}),Wr.exports),e=(Hr||(Hr=1,Yr.exports=function(t,e){for(var r,n=t.length,i=e^n,s=0;n>=4;)r=1540483477*(65535&(r=255&t.charCodeAt(s)|(255&t.charCodeAt(++s))<<8|(255&t.charCodeAt(++s))<<16|(255&t.charCodeAt(++s))<<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,++s;switch(n){case 3:i^=(255&t.charCodeAt(s+2))<<16;case 2:i^=(255&t.charCodeAt(s+1))<<8;case 1:i=1540483477*(65535&(i^=255&t.charCodeAt(s)))+((1540483477*(i>>>16)&65535)<<16)}return i=1540483477*(65535&(i^=i>>>13))+((1540483477*(i>>>16)&65535)<<16),(i^=i>>>15)>>>0}),Yr.exports);return Zr.exports=t,Zr.exports.murmur3=t,Zr.exports.murmur2=e,Zr.exports}();const Jr=Ut(Kr);class Qr{constructor(t,...e){Object.assign(this,e[0]||{}),this.type=t}}class tn extends Qr{constructor(t,e={}){super("error",Object.assign({error:t},e))}}function en(t,e,r){r[t]&&-1!==r[t].indexOf(e)||(r[t]=r[t]||[],r[t].push(e))}function rn(t,e,r){if(r&&r[t]){const n=r[t].indexOf(e);-1!==n&&r[t].splice(n,1)}}class nn{on(t,e){return this._listeners=this._listeners||{},en(t,e,this._listeners),this}off(t,e){return rn(t,e,this._listeners),rn(t,e,this._oneTimeListeners),this}once(t,e){return e?(this._oneTimeListeners=this._oneTimeListeners||{},en(t,e,this._oneTimeListeners),this):new Promise((e=>{this.once(t,e)}))}fire(t,e){const r="string"==typeof t?new Qr(t,e):t,n=r.type;if(this.listens(n)){r.target=this;const t=this._listeners&&this._listeners[n]?this._listeners[n].slice():[];for(const e of t)e.call(this,r);const e=this._oneTimeListeners&&this._oneTimeListeners[n]?this._oneTimeListeners[n].slice():[];for(const t of e)rn(n,t,this._oneTimeListeners),t.call(this,r);const i=this._eventedParent;if(i){const t="function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData;Object.assign(r,t),i.fire(r)}}else r instanceof tn&&console.error(r.error);return this}listens(t){return!!(this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t))}setEventedParent(t,e){return this._eventedParent=t,this._eventedParentData=e,this}}class sn{constructor(t){"string"==typeof t?this.name=t:(this.name=t.name,this.iconsetId=t.iconsetId)}static from(t){return new sn(t)}static toString(t){return t.iconsetId?`${t.name}${t.iconsetId}`:t.name}static parse(t){const[e,r]=t.split("");return new sn({name:e,iconsetId:r})}static isEqual(t,e){return t.name===e.name&&t.iconsetId===e.iconsetId}toString(){return sn.toString(this)}serialize(){return{name:this.name,iconsetId:this.iconsetId}}}var an,on={},ln=function(){if(an)return on;an=1;var t={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function e(t){return(t=Math.round(t))<0?0:t>255?255:t}function r(t){return e("%"===t[t.length-1]?parseFloat(t)/100*255:parseInt(t))}function n(t){return(e="%"===t[t.length-1]?parseFloat(t)/100:parseFloat(t))<0?0:e>1?1:e;var e}function i(t,e,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?t+(e-t)*r*6:2*r<1?e:3*r<2?t+(e-t)*(2/3-r)*6:t}try{on.parseCSSColor=function(s){var a,o=s.replace(/ /g,"").toLowerCase();if(o in t)return t[o].slice();if("#"===o[0])return 4===o.length?(a=parseInt(o.substr(1),16))>=0&&a<=4095?[(3840&a)>>4|(3840&a)>>8,240&a|(240&a)>>4,15&a|(15&a)<<4,1]:null:7===o.length&&(a=parseInt(o.substr(1),16))>=0&&a<=16777215?[(16711680&a)>>16,(65280&a)>>8,255&a,1]:null;var l=o.indexOf("("),u=o.indexOf(")");if(-1!==l&&u+1===o.length){var c=o.substr(0,l),h=o.substr(l+1,u-(l+1)).split(","),p=1;switch(c){case"rgba":if(4!==h.length)return null;p=n(h.pop());case"rgb":return 3!==h.length?null:[r(h[0]),r(h[1]),r(h[2]),p];case"hsla":if(4!==h.length)return null;p=n(h.pop());case"hsl":if(3!==h.length)return null;var d=(parseFloat(h[0])%360+360)%360/360,f=n(h[1]),m=n(h[2]),y=m<=.5?m*(f+1):m+f-m*f,g=2*m-y;return[e(255*i(g,y,d+1/3)),e(255*i(g,y,d)),e(255*i(g,y,d-1/3)),p];default:return null}}return null}}catch(t){}return on}();class un{constructor(t,e,r,n=1){this.r=t,this.g=e,this.b=r,this.a=n}static parse(t){if(!t)return;if(t instanceof un)return t;if("string"!=typeof t)return;const e=ln.parseCSSColor(t);return e?new un(e[0]/255,e[1]/255,e[2]/255,e[3]):void 0}toString(){const[t,e,r,n]=[this.r,this.g,this.b,this.a];return`rgba(${Math.round(255*t)},${Math.round(255*e)},${Math.round(255*r)},${n})`}toNonPremultipliedRenderColor(t){const{r:e,g:r,b:n,a:i}=this;return new hn(t,e,r,n,i)}toPremultipliedRenderColor(t){const{r:e,g:r,b:n,a:i}=this;return new pn(t,e*i,r*i,n*i,i)}clone(){return new un(this.r,this.g,this.b,this.a)}}class cn{constructor(t,e,r,n,i,s=!1){if(this.premultiplied=!1,this.premultiplied=s,t){const s=t.image.height,a=s*s;this.premultiplied?(e=0===i?0:e/i*(s-1),r=0===i?0:r/i*(s-1),n=0===i?0:n/i*(s-1)):(e*=s-1,r*=s-1,n*=s-1);const o=Math.floor(e),l=Math.floor(r),u=Math.floor(n),c=Math.ceil(e),h=Math.ceil(r),p=Math.ceil(n),d=e-o,f=r-l,m=n-u,y=t.image.data,g=4*(o+l*a+u*s),x=4*(o+l*a+p*s),v=4*(o+h*a+u*s),b=4*(o+h*a+p*s),w=4*(c+l*a+u*s),_=4*(c+l*a+p*s),A=4*(c+h*a+u*s),I=4*(c+h*a+p*s);if(g<0||I>=y.length)throw new Error("out of range");this.r=dn(dn(dn(y[g],y[x],m),dn(y[v],y[b],m),f),dn(dn(y[w],y[_],m),dn(y[A],y[I],m),f),d)/255*(this.premultiplied?i:1),this.g=dn(dn(dn(y[g+1],y[x+1],m),dn(y[v+1],y[b+1],m),f),dn(dn(y[w+1],y[_+1],m),dn(y[A+1],y[I+1],m),f),d)/255*(this.premultiplied?i:1),this.b=dn(dn(dn(y[g+2],y[x+2],m),dn(y[v+2],y[b+2],m),f),dn(dn(y[w+2],y[_+2],m),dn(y[A+2],y[I+2],m),f),d)/255*(this.premultiplied?i:1),this.a=i}else this.r=e,this.g=r,this.b=n,this.a=i}toArray(){const{r:t,g:e,b:r,a:n}=this;return[255*t,255*e,255*r,n]}toHslaArray(){let{r:t,g:e,b:r,a:n}=this;if(this.premultiplied){if(0===n)return[0,0,0,0];const i=1/n;t*=i,e*=i,r*=i}const i=Math.min(Math.max(t,0),1),s=Math.min(Math.max(e,0),1),a=Math.min(Math.max(r,0),1),o=Math.min(i,s,a),l=Math.max(i,s,a),u=l-o,c=.5*(o+l);if(0===u)return[0,0,100*c,n];const h=c>.5?u/(2-l-o):u/(l+o);let p;switch(l){case i:p=60*((s-a)/u+(s<a?6:0));break;case s:p=60*((a-i)/u+2);break;default:p=60*((i-s)/u+4)}return[p,100*h,100*c,n]}toArray01(){const{r:t,g:e,b:r,a:n}=this;return[t,e,r,n]}toArray01Scaled(t){const{r:e,g:r,b:n}=this;return[e*t,r*t,n*t]}toArray01Linear(){const{r:t,g:e,b:r,a:n}=this;return[Math.pow(t,2.2),Math.pow(e,2.2),Math.pow(r,2.2),n]}}class hn extends cn{constructor(t,e,r,n,i){super(t,e,r,n,i,!1)}}class pn extends cn{constructor(t,e,r,n,i){super(t,e,r,n,i,!0)}}function dn(t,e,r){return t*(1-r)+e*r}function fn(t,e,r){return t.map(((t,n)=>dn(t,e[n],r)))}un.black=new un(0,0,0,1),un.white=new un(1,1,1,1),un.transparent=new un(0,0,0,0),un.red=new un(1,0,0,1),un.blue=new un(0,0,1,1);const mn=Object.freeze(Object.defineProperty({__proto__:null,array:fn,color:function(t,e,r){return new un(dn(t.r,e.r,r),dn(t.g,e.g,r),dn(t.b,e.b,r),dn(t.a,e.a,r))},number:dn},Symbol.toStringTag,{value:"Module"}));class yn extends Error{constructor(t,e){super(e),this.message=e,this.key=t}}class gn{constructor(t,e=[]){this.parent=t,this.bindings={};for(const[t,r]of e)this.bindings[t]=r}concat(t){return new gn(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(`${t} not found in scope.`)}has(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)}}const xn={kind:"null"},vn={kind:"number"},bn={kind:"string"},wn={kind:"boolean"},_n={kind:"color"},An={kind:"object"},In={kind:"value"},Mn={kind:"collator"},Sn={kind:"formatted"},Pn={kind:"resolvedImage"};function kn(t,e){return{kind:"array",itemType:t,N:e}}function Bn(t){if("array"===t.kind){const e=Bn(t.itemType);return"number"==typeof t.N?`array<${e}, ${t.N}>`:"value"===t.itemType.kind?"array":`array<${e}>`}return t.kind}const zn=[xn,vn,bn,wn,_n,Sn,An,kn(In),Pn];function Tn(t,e){if("error"===e.kind)return null;if("array"===t.kind){if("array"===e.kind&&(0===e.N&&"value"===e.itemType.kind||!Tn(t.itemType,e.itemType))&&("number"!=typeof t.N||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if("value"===t.kind)for(const t of zn)if(!Tn(t,e))return null}return`Expected ${Bn(t)} but found ${Bn(e)} instead.`}function En(t,e){return e.some((e=>e.kind===t.kind))}function Vn(t,e){return e.some((e=>"null"===e?null===t:"array"===e?Array.isArray(t):"object"===e?t&&!Array.isArray(t)&&"object"==typeof t:e===typeof t))}function Fn(t,e){return"array"===t.kind&&"array"===e.kind?t.N===e.N&&Fn(t.itemType,e.itemType):t.kind===e.kind}class Cn{constructor(t,e,r){this.sensitivity=t?e?"variant":"case":e?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,e){return this.collator.compare(t,e)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Dn{constructor(t,e,r,n,i){this.text=t.normalize?t.normalize():t,this.image=e,this.scale=r,this.fontStack=n,this.textColor=i}}class Rn{constructor(t){this.sections=t}static fromString(t){return new Rn([new Dn(t,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some((t=>0!==t.text.length||!!t.image&&t.image.hasPrimary()))}static factory(t){return t instanceof Rn?t:Rn.fromString(t)}toString(){return 0===this.sections.length?"":this.sections.map((t=>t.text)).join("")}serialize(){const t=["format"];for(const e of this.sections){if(e.image){const r=e.image.getPrimary().id.toString();t.push(["image",r]);continue}t.push(e.text);const r={};e.fontStack&&(r["text-font"]=["literal",e.fontStack.split(",")]),e.scale&&(r["font-scale"]=e.scale),e.textColor&&(r["text-color"]=["rgba"].concat(e.textColor.toNonPremultipliedRenderColor(null).toArray())),t.push(r)}return t}}class Ln{constructor(t,e={}){this.id=sn.from(t),this.params=e.params,this.sx=e.sx||1,this.sy=e.sy||1}toString(){return JSON.stringify(this)}static parse(t){let e,r,n,i;try{({id:e,params:r,sx:n,sy:i}=JSON.parse(t)||{})}catch(t){return null}return e?new Ln(e,{params:r,sx:n,sy:i}):null}scaleSelf(t,e=t){return this.sx*=t,this.sy*=e,this}}class On{constructor(t,e,r,n,i=!1){this.primaryId=sn.from(t),this.primaryOptions=e,r&&(this.secondaryId=sn.from(r)),this.secondaryOptions=n,this.available=i}toString(){return this.primaryId&&this.secondaryId?`[${this.primaryId.name},${this.secondaryId.name}]`:this.primaryId.name}hasPrimary(){return!!this.primaryId}getPrimary(){return new Ln(this.primaryId,this.primaryOptions)}hasSecondary(){return!!this.secondaryId}getSecondary(){return this.secondaryId?new Ln(this.secondaryId,this.secondaryOptions):null}static from(t){return"string"==typeof t?On.build({name:t}):t}static build(t,e,r,n){return!t||"object"==typeof t&&!("name"in t)?null:new On(t,r,e,n)}}function Un(t,e,r,n){return"number"==typeof t&&t>=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof r&&r>=0&&r<=255?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:`Invalid rgba value [${[t,e,r,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof n?[t,e,r,n]:[t,e,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Nn(t){if(null===t)return!0;if("string"==typeof t)return!0;if("boolean"==typeof t)return!0;if("number"==typeof t)return!0;if(t instanceof un)return!0;if(t instanceof Cn)return!0;if(t instanceof Rn)return!0;if(t instanceof On)return!0;if(Array.isArray(t)){for(const e of t)if(!Nn(e))return!1;return!0}if("object"==typeof t){for(const e in t)if(!Nn(t[e]))return!1;return!0}return!1}function jn(t){if(null===t)return xn;if("string"==typeof t)return bn;if("boolean"==typeof t)return wn;if("number"==typeof t)return vn;if(t instanceof un)return _n;if(t instanceof Cn)return Mn;if(t instanceof Rn)return Sn;if(t instanceof On)return Pn;if(Array.isArray(t)){const e=t.length;let r;for(const e of t){const t=jn(e);if(r){if(r===t)continue;r=In;break}r=t}return kn(r||In,e)}return An}function $n(t){const e=typeof t;return null===t?"":"string"===e||"number"===e||"boolean"===e?String(t):t instanceof Rn||t instanceof On||t instanceof un?t.toString():JSON.stringify(t)}class Gn{constructor(t,e){this.type=t,this.value=e}static parse(t,e){if(2!==t.length)return e.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!Nn(t[1]))return e.error("invalid value");const r=t[1];let n=jn(r);const i=e.expectedType;return"array"!==n.kind||0!==n.N||!i||"array"!==i.kind||"number"==typeof i.N&&0!==i.N||(n=i),new Gn(n,r)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof un?["rgba"].concat(this.value.toNonPremultipliedRenderColor(null).toArray()):this.value instanceof Rn?this.value.serialize():this.value}}class qn{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}}const Hn={string:bn,number:vn,boolean:wn,object:An};class Xn{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");let r,n=1;const i=t[0];if("array"===i){let i,s;if(t.length>2){const r=t[1];if("string"!=typeof r||!(r in Hn)||"object"===r)return e.error('The item type argument of "array" must be one of string, number, boolean',1);i=Hn[r],n++}else i=In;if(t.length>3){if(null!==t[2]&&("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2])))return e.error('The length argument to "array" must be a positive integer literal',2);s=t[2],n++}r=kn(i,s)}else r=Hn[i];const s=[];for(;n<t.length;n++){const r=e.parse(t[n],n,In);if(!r)return null;s.push(r)}return new Xn(r,s)}evaluate(t){for(let e=0;e<this.args.length;e++){const r=this.args[e].evaluate(t);if(!Tn(this.type,jn(r)))return r;if(e===this.args.length-1)throw new qn(`The expression ${JSON.stringify(this.args[e].serialize())} evaluated to ${Bn(jn(r))} but was expected to be of type ${Bn(this.type)}.`)}return null}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}serialize(){const t=this.type,e=[t.kind];if("array"===t.kind){const r=t.itemType;if("string"===r.kind||"number"===r.kind||"boolean"===r.kind){e.push(r.kind);const n=t.N;("number"==typeof n||this.args.length>1)&&e.push(n)}}return e.concat(this.args.map((t=>t.serialize())))}}class Zn{constructor(t){this.type=Sn,this.sections=t}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const r=t[1];if(!Array.isArray(r)&&"object"==typeof r)return e.error("First argument must be an image or text section.");const n=[];let i=!1;for(let r=1;r<=t.length-1;++r){const s=t[r];if(i&&"object"==typeof s&&!Array.isArray(s)){i=!1;let t=null;if(s["font-scale"]&&(t=e.parseObjectValue(s["font-scale"],r,"font-scale",vn),!t))return null;let a=null;if(s["text-font"]&&(a=e.parseObjectValue(s["text-font"],r,"text-font",kn(bn)),!a))return null;let o=null;if(s["text-color"]&&(o=e.parseObjectValue(s["text-color"],r,"text-color",_n),!o))return null;const l=n[n.length-1];l.scale=t,l.font=a,l.textColor=o}else{const s=e.parse(t[r],r,In);if(!s)return null;const a=s.type.kind;if("string"!==a&&"value"!==a&&"null"!==a&&"resolvedImage"!==a)return e.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");i=!0,n.push({content:s,scale:null,font:null,textColor:null})}}return new Zn(n)}evaluate(t){return new Rn(this.sections.map((e=>{const r=e.content.evaluate(t);return Fn(jn(r),Pn)?new Dn("",r,null,null,null):new Dn($n(r),null,e.scale?e.scale.evaluate(t):null,e.font?e.font.evaluate(t).join(","):null,e.textColor?e.textColor.evaluate(t):null)})))}eachChild(t){for(const e of this.sections)t(e.content),e.scale&&t(e.scale),e.font&&t(e.font),e.textColor&&t(e.textColor)}outputDefined(){return!1}serialize(){const t=["format"];for(const e of this.sections){t.push(e.content.serialize());const r={};e.scale&&(r["font-scale"]=e.scale.serialize()),e.font&&(r["text-font"]=e.font.serialize()),e.textColor&&(r["text-color"]=e.textColor.serialize()),t.push(r)}return t}}class Wn{constructor(t,e,r,n){this._imageWarnHistory={},this.type=Pn,this.namePrimary=t,this.nameSecondary=e,r&&(this.paramsPrimary=r.params,this.iconsetIdPrimary=r.iconset?r.iconset.id:void 0),n&&(this.paramsSecondary=n.params,this.iconsetIdSecondary=n.iconset?n.iconset.id:void 0)}static parse(t,e){if(t.length<2)return e.error("Expected two or more arguments.");let r=1;const n=[];function i(){if(r<t.length){const i=e.parse(t[r],r++,bn);return i?(n.push({image:i,options:{}}),!0):(e.error(n.length?"Secondary image variant is not a string.":"No image name provided."),!1)}return!0}function s(){if(r<t.length){const s=t[r];if(null===(i=s)||"object"!=typeof i||Array.isArray(i))return!0;const a=s.params,o=s.iconset,l=e.concat(r);if(!a&&!o)return r++,!0;if(a){if("object"!=typeof a||a.constructor!==Object)return l.error('Image options "params" should be an object'),!1;const t={},e=l.concat(void 0,"params");for(const r in a){if(!r)return e.error("Image parameter name should be non-empty"),!1;const n=e.concat(void 0,r).parse(a[r],void 0,_n,void 0,{typeAnnotation:"coerce"});if(!n)return!1;t[r]=n}n[n.length-1].options.params=t}if(o){if("object"!=typeof o||o.constructor!==Object)return l.error('Image options "iconset" should be an object'),!1;if(!o.id)return l.error('Image options "iconset" should have an "id" property'),!1;n[n.length-1].options.iconset=o}return r++,!0}var i;return!0}for(let t=0;t<2;t++)if(!i()||!s())return;return new Wn(n[0].image,n[1]?n[1].image:void 0,n[0].options,n[1]?n[1].options:void 0)}evaluateParams(t,e){const r={};if(e){for(const n in e)if(e[n])try{r[n]=e[n].evaluate(t)}catch(t){continue}if(0!==Object.keys(r).length)return{params:r}}}evaluate(t){const e={name:this.namePrimary.evaluate(t),iconsetId:this.iconsetIdPrimary},r=this.nameSecondary?{name:this.nameSecondary.evaluate(t),iconsetId:this.iconsetIdSecondary}:void 0,n=On.build(e,r,this.paramsPrimary?this.evaluateParams(t,this.paramsPrimary):void 0,this.paramsSecondary?this.evaluateParams(t,this.paramsSecondary):void 0);if(n&&t.availableImages){const e=n.getPrimary().id;if(n.available=t.availableImages.some((t=>sn.isEqual(t,e))),n.available){const e=n.getSecondary()?n.getSecondary().id:null;e&&(n.available=t.availableImages.some((t=>sn.isEqual(t,e))))}}return n}eachChild(t){if(t(this.namePrimary),this.paramsPrimary)for(const e in this.paramsPrimary)this.paramsPrimary[e]&&t(this.paramsPrimary[e]);if(this.nameSecondary&&(t(this.nameSecondary),this.paramsSecondary))for(const e in this.paramsSecondary)this.paramsSecondary[e]&&t(this.paramsSecondary[e])}outputDefined(){return!1}serializeOptions(t,e){const r={};if(e&&(r.iconset={id:e}),t){r.params={};for(const e in t)t[e]&&(r.params[e]=t[e].serialize())}return Object.keys(r).length>0?r:void 0}serialize(){const t=["image",this.namePrimary.serialize()];if(this.paramsPrimary||this.iconsetIdPrimary){const e=this.serializeOptions(this.paramsPrimary,this.iconsetIdPrimary);e&&t.push(e)}if(this.nameSecondary&&(t.push(this.nameSecondary.serialize()),this.paramsSecondary||this.iconsetIdSecondary)){const e=this.serializeOptions(this.paramsSecondary,this.iconsetIdSecondary);e&&t.push(e)}return t}}function Yn(t){return Jn(t)?"string":Qn(t)?"number":ti(t)?"boolean":Array.isArray(t)?"array":null===t?"null":Kn(t)?"object":typeof t}function Kn(t){return null!=t&&!Array.isArray(t)&&"function"!=typeof t&&!(t instanceof String||t instanceof Number||t instanceof Boolean)&&"object"==typeof t}function Jn(t){return"string"==typeof t||t instanceof String}function Qn(t){return"number"==typeof t||t instanceof Number}function ti(t){return"boolean"==typeof t||t instanceof Boolean}const ei={"to-boolean":wn,"to-color":_n,"to-number":vn,"to-string":bn};class ri{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expected at least one argument.");const r=t[0],n=[];let i=xn;if("to-array"===r){if(!Array.isArray(t[1]))return null;const r=t[1].length;if(e.expectedType){if("array"!==e.expectedType.kind)return e.error(`Expected ${e.expectedType.kind} but found array.`);i=kn(e.expectedType.itemType,r)}else{if(!(r>0&&Nn(t[1][0])))return null;i=kn(jn(t[1][0]),r)}for(let s=0;s<r;s++){const r=t[1][s];let a;if(Array.isArray(r))a=e.parse(r,void 0,i.itemType);else{const t=Yn(r);if(t!==i.itemType.kind)return e.error(`Expected ${i.itemType.kind} but found ${t}.`);a=e.registry.literal.parse(["literal",void 0===r?null:r],e)}if(!a)return null;n.push(a)}}else{if(("to-boolean"===r||"to-string"===r)&&2!==t.length)return e.error("Expected one argument.");i=ei[r];for(let r=1;r<t.length;r++){const i=e.parse(t[r],r,In);if(!i)return null;n.push(i)}}return new ri(i,n)}evaluate(t){if("boolean"===this.type.kind)return Boolean(this.args[0].evaluate(t));if("color"===this.type.kind){let e,r;for(const n of this.args){if(e=n.evaluate(t),r=null,e instanceof un)return e;if("string"==typeof e){const r=t.parseColor(e);if(r)return r}else if(Array.isArray(e)&&(r=e.length<3||e.length>4?`Invalid rbga value ${JSON.stringify(e)}: expected an array containing either three or four numeric values.`:Un(e[0],e[1],e[2],e[3]),!r))return new un(e[0]/255,e[1]/255,e[2]/255,e[3])}throw new qn(r||`Could not parse color from value '${"string"==typeof e?e:String(JSON.stringify(e))}'`)}if("number"===this.type.kind){let e=null;for(const r of this.args){if(e=r.evaluate(t),null===e)return 0;const n=Number(e);if(!isNaN(n))return n}throw new qn(`Could not convert ${JSON.stringify(e)} to number.`)}return"formatted"===this.type.kind?Rn.fromString($n(this.args[0].evaluate(t))):"resolvedImage"===this.type.kind?On.build($n(this.args[0].evaluate(t))):"array"===this.type.kind?this.args.map((e=>e.evaluate(t))):$n(this.args[0].evaluate(t))}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}serialize(){if("formatted"===this.type.kind)return new Zn([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new Wn(this.args[0]).serialize();const t="array"===this.type.kind?[]:[`to-${this.type.kind}`];return this.eachChild((e=>{t.push(e.serialize())})),t}}const ni=["Unknown","Point","LineString","Polygon"];class ii{constructor(t,e,r){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null,this.scope=t,this.options=e,this.iconImageUseTheme=r}id(){return this.feature&&void 0!==this.feature.id?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?ni[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||{}}measureLight(t){return this.globals.brightness||0}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const t=this.featureDistanceData.center,e=this.featureDistanceData.scale,{x:r,y:n}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(r*e-t[0])+this.featureDistanceData.bearing[1]*(n*e-t[1])}return 0}parseColor(t){let e=this._parseColorCache[t];return e||(e=this._parseColorCache[t]=un.parse(t)),e}getConfig(t){return this.options?this.options.get(t):null}}class si{constructor(t,e,r,n,i){this.name=t,this.type=e,this._evaluate=r,this.args=n,this._overloadIndex=i}evaluate(t){if(!this._evaluate){const t=si.definitions[this.name];this._evaluate=Array.isArray(t)?t[2]:t.overloads[this._overloadIndex][1]}return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map((t=>t.serialize())))}static parse(t,e){const r=t[0],n=si.definitions[r];if(!n)return e.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0);const i=Array.isArray(n)?n[0]:n.type,s=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,a=[];let o=null,l=-1;for(const[n,u]of s){if(Array.isArray(n)&&n.length!==t.length-1)continue;a.push(n),l++,o=new Ms(e.registry,e.path,null,e.scope,void 0,e._scope,e.options,e.iconImageUseTheme);const s=[];let c=!1;for(let e=1;e<t.length;e++){const r=t[e],i=Array.isArray(n)?n[e-1]:n.type,a=o.parse(r,1+s.length,i);if(!a){c=!0;break}s.push(a)}if(!c)if(Array.isArray(n)&&n.length!==s.length)o.error(`Expected ${n.length} arguments, but found ${s.length} instead.`);else{for(let t=0;t<s.length;t++){const e=Array.isArray(n)?n[t]:n.type,r=s[t];o.concat(t+1).checkSubtype(e,r.type)}if(0===o.errors.length)return new si(r,i,u,s,l)}}if(1===a.length)e.errors.push(...o.errors);else{const r=(a.length?a:s.map((([t])=>t))).map(ai).join(" | "),n=[];for(let r=1;r<t.length;r++){const i=e.parse(t[r],1+n.length);if(!i)return null;n.push(Bn(i.type))}e.error(`Expected arguments of type ${r}, but found (${n.join(", ")}) instead.`)}return null}static register(t,e){si.definitions=e;for(const r in e)t[r]=si}}function ai(t){return Array.isArray(t)?`(${t.map(Bn).join(", ")})`:`(${Bn(t.type)}...)`}class oi{constructor(t,e,r){this.type=Mn,this.locale=r,this.caseSensitive=t,this.diacriticSensitive=e}static parse(t,e){if(2!==t.length)return e.error("Expected one argument.");const r=t[1];if("object"!=typeof r||Array.isArray(r))return e.error("Collator options argument must be an object.");const n=void 0===r["case-sensitive"]?e.parse(!1,1,wn):e.parseObjectValue(r["case-sensitive"],1,"case-sensitive",wn);if(!n)return null;const i=void 0===r["diacritic-sensitive"]?e.parse(!1,1,wn):e.parseObjectValue(r["diacritic-sensitive"],1,"diacritic-sensitive",wn);if(!i)return null;let s=null;return r.locale&&(s=e.parseObjectValue(r.locale,1,"locale",bn),!s)?null:new oi(n,i,s)}evaluate(t){return new Cn(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}serialize(){const t={};return t["case-sensitive"]=this.caseSensitive.serialize(),t["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(t.locale=this.locale.serialize()),["collator",t]}}function li(t,e,r=0,n=t.length-1,i=ci){for(;n>r;){if(n-r>600){const s=n-r+1,a=e-r+1,o=Math.log(s),l=.5*Math.exp(2*o/3),u=.5*Math.sqrt(o*l*(s-l)/s)*(a-s/2<0?-1:1);li(t,e,Math.max(r,Math.floor(e-a*l/s+u)),Math.min(n,Math.floor(e+(s-a)*l/s+u)),i)}const s=t[e];let a=r,o=n;for(ui(t,r,e),i(t[n],s)>0&&ui(t,r,n);a<o;){for(ui(t,a,o),a++,o--;i(t[a],s)<0;)a++;for(;i(t[o],s)>0;)o--}0===i(t[r],s)?ui(t,r,o):(o++,ui(t,o,n)),o<=e&&(r=o+1),e<=o&&(n=o-1)}}function ui(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function ci(t,e){return t<e?-1:t>e?1:0}function hi(t){let e=0;for(let r,n,i=0,s=t.length,a=s-1;i<s;a=i++)r=t[i],n=t[a],e+=(n.x-r.x)*(r.y+n.y);return e}function pi(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function di(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function fi(t,e,r){const n=t[0]-e[0],i=t[1]-e[1],s=t[0]-r[0],a=t[1]-r[1];return n*a-s*i==0&&n*s<=0&&i*a<=0}function mi(t,e,r=!1){let n=!1;for(let o=0,l=e.length;o<l;o++){const l=e[o];for(let e=0,o=l.length,u=o-1;e<o;u=e++){const o=l[u],c=l[e];if(fi(t,o,c))return r;(s=o)[1]>(i=t)[1]!=(a=c)[1]>i[1]&&i[0]<(a[0]-s[0])*(i[1]-s[1])/(a[1]-s[1])+s[0]&&(n=!n)}}var i,s,a;return n}function yi(t,e,r,n){const i=n[0]-r[0],s=n[1]-r[1],a=(t[0]-r[0])*s-i*(t[1]-r[1]),o=(e[0]-r[0])*s-i*(e[1]-r[1]);return a>0&&o<0||a<0&&o>0}function gi(t,e,r,n){return 0!=(i=[n[0]-r[0],n[1]-r[1]])[0]*(s=[e[0]-t[0],e[1]-t[1]])[1]-i[1]*s[0]&&!(!yi(t,e,r,n)||!yi(r,n,t,e));var i,s}function xi(t){const e=new $t(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),r=new $t(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(const n of t[0])e.x>n.x&&(e.x=n.x),e.y>n.y&&(e.y=n.y),r.x<n.x&&(r.x=n.x),r.y<n.y&&(r.y=n.y);return{min:e,max:r}}const vi=8192;function bi(t,e){const r=(180+t[0])/360,n=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,i=Math.pow(2,e.z);return[Math.round(r*i*vi),Math.round(n*i*vi)]}function wi(t,e){for(let r=0;r<e.length;r++)if(mi(t,e[r]))return!0;return!1}function _i(t,e,r){for(const n of r)for(let r=0,i=n.length,s=i-1;r<i;s=r++)if(gi(t,e,n[s],n[r]))return!0;return!1}function Ai(t,e){for(let r=0;r<t.length;++r)if(!mi(t[r],e))return!1;for(let r=0;r<t.length-1;++r)if(_i(t[r],t[r+1],e))return!1;return!0}function Ii(t,e){for(let r=0;r<e.length;r++)if(Ai(t,e[r]))return!0;return!1}function Mi(t,e,r){const n=[];for(let i=0;i<t.length;i++){const s=[];for(let n=0;n<t[i].length;n++){const a=bi(t[i][n],r);pi(e,a),s.push(a)}n.push(s)}return n}function Si(t,e,r){const n=[];for(let i=0;i<t.length;i++){const s=Mi(t[i],e,r);n.push(s)}return n}function Pi(t,e,r,n){if(t[0]<r[0]||t[0]>r[2]){const e=.5*n;let i=t[0]-r[0]>e?-n:r[0]-t[0]>e?n:0;0===i&&(i=t[0]-r[2]>e?-n:r[2]-t[0]>e?n:0),t[0]+=i}pi(e,t)}function ki(t,e,r,n){const i=Math.pow(2,n.z)*vi,s=[n.x*vi,n.y*vi],a=[];if(!t)return a;for(const n of t)for(const t of n){const n=[t.x+s[0],t.y+s[1]];Pi(n,e,r,i),a.push(n)}return a}function Bi(t,e,r,n){const i=Math.pow(2,n.z)*vi,s=[n.x*vi,n.y*vi],a=[];if(!t)return a;for(const r of t){const t=[];for(const n of r){const r=[n.x+s[0],n.y+s[1]];pi(e,r),t.push(r)}a.push(t)}if(e[2]-e[0]<=i/2){(o=e)[0]=o[1]=1/0,o[2]=o[3]=-1/0;for(const t of a)for(const n of t)Pi(n,e,r,i)}var o;return a}class zi{constructor(t,e){this.type=wn,this.geojson=t,this.geometries=e}static parse(t,e){if(2!==t.length)return e.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Nn(t[1])){const e=t[1];if("FeatureCollection"===e.type)for(let t=0;t<e.features.length;++t){const r=e.features[t].geometry.type;if("Polygon"===r||"MultiPolygon"===r)return new zi(e,e.features[t].geometry)}else if("Feature"===e.type){const t=e.geometry.type;if("Polygon"===t||"MultiPolygon"===t)return new zi(e,e.geometry)}else if("Polygon"===e.type||"MultiPolygon"===e.type)return new zi(e,e)}return e.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(null!=t.geometry()&&null!=t.canonicalID()){if("Point"===t.geometryType())return function(t,e){const r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if(!i)return!1;if("Polygon"===e.type){const s=Mi(e.coordinates,n,i),a=ki(t.geometry(),r,n,i);if(!di(r,n))return!1;for(const t of a)if(!mi(t,s))return!1}if("MultiPolygon"===e.type){const s=Si(e.coordinates,n,i),a=ki(t.geometry(),r,n,i);if(!di(r,n))return!1;for(const t of a)if(!wi(t,s))return!1}return!0}(t,this.geometries);if("LineString"===t.geometryType())return function(t,e){const r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=t.canonicalID();if(!i)return!1;if("Polygon"===e.type){const s=Mi(e.coordinates,n,i),a=Bi(t.geometry(),r,n,i);if(!di(r,n))return!1;for(const t of a)if(!Ai(t,s))return!1}if("MultiPolygon"===e.type){const s=Si(e.coordinates,n,i),a=Bi(t.geometry(),r,n,i);if(!di(r,n))return!1;for(const t of a)if(!Ii(t,s))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}const Ti={kilometers:1,miles:1e3/1609.344,nauticalmiles:1e3/1852,meters:1e3,metres:1e3,yards:1e3/.9144,feet:1e3/.3048,inches:1e3/.0254},Ei=1/298.257223563,Vi=Ei*(2-Ei),Fi=Math.PI/180;class Ci{static fromTile(t,e,r){const n=Math.PI*(1-2*(t+.5)/Math.pow(2,e)),i=Math.atan(.5*(Math.exp(n)-Math.exp(-n)))/Fi;return new Ci(i,r)}static get units(){return Ti}constructor(t,e){if(void 0===t)throw new Error("No latitude given.");if(e&&!Ti[e])throw new Error(`Unknown unit ${e}. Use one of: ${Object.keys(Ti).join(", ")}`);const r=6378.137*Fi*(e?Ti[e]:1),n=Math.cos(t*Fi),i=1/(1-Vi*(1-n*n)),s=Math.sqrt(i);this.kx=r*s*n,this.ky=r*s*i*(1-Vi)}distance(t,e){const r=Li(t[0]-e[0])*this.kx,n=(t[1]-e[1])*this.ky;return Math.sqrt(r*r+n*n)}bearing(t,e){const r=Li(e[0]-t[0])*this.kx;return Math.atan2(r,(e[1]-t[1])*this.ky)/Fi}destination(t,e,r){const n=r*Fi;return this.offset(t,Math.sin(n)*e,Math.cos(n)*e)}offset(t,e,r){return[t[0]+e/this.kx,t[1]+r/this.ky]}lineDistance(t){let e=0;for(let r=0;r<t.length-1;r++)e+=this.distance(t[r],t[r+1]);return e}area(t){let e=0;for(let r=0;r<t.length;r++){const n=t[r];for(let t=0,i=n.length,s=i-1;t<i;s=t++)e+=Li(n[t][0]-n[s][0])*(n[t][1]+n[s][1])*(r?-1:1)}return Math.abs(e)/2*this.kx*this.ky}along(t,e){let r=0;if(e<=0)return t[0];for(let n=0;n<t.length-1;n++){const i=t[n],s=t[n+1],a=this.distance(i,s);if(r+=a,r>e)return Ri(i,s,(e-(r-a))/a)}return t[t.length-1]}pointToSegmentDistance(t,e,r){let[n,i]=e,s=Li(r[0]-n)*this.kx,a=(r[1]-i)*this.ky;if(0!==s||0!==a){const e=(Li(t[0]-n)*this.kx*s+(t[1]-i)*this.ky*a)/(s*s+a*a);e>1?(n=r[0],i=r[1]):e>0&&(n+=s/this.kx*e,i+=a/this.ky*e)}return s=Li(t[0]-n)*this.kx,a=(t[1]-i)*this.ky,Math.sqrt(s*s+a*a)}pointOnLine(t,e){let r=1/0,n=t[0][0],i=t[0][1],s=0,a=0;for(let o=0;o<t.length-1;o++){let l=t[o][0],u=t[o][1],c=Li(t[o+1][0]-l)*this.kx,h=(t[o+1][1]-u)*this.ky,p=0;0===c&&0===h||(p=(Li(e[0]-l)*this.kx*c+(e[1]-u)*this.ky*h)/(c*c+h*h),p>1?(l=t[o+1][0],u=t[o+1][1]):p>0&&(l+=c/this.kx*p,u+=h/this.ky*p)),c=Li(e[0]-l)*this.kx,h=(e[1]-u)*this.ky;const d=c*c+h*h;d<r&&(r=d,n=l,i=u,s=o,a=p)}return{point:[n,i],index:s,t:Math.max(0,Math.min(1,a))}}lineSlice(t,e,r){let n=this.pointOnLine(r,t),i=this.pointOnLine(r,e);if(n.index>i.index||n.index===i.index&&n.t>i.t){const t=n;n=i,i=t}const s=[n.point],a=n.index+1,o=i.index;!Di(r[a],s[0])&&a<=o&&s.push(r[a]);for(let t=a+1;t<=o;t++)s.push(r[t]);return Di(r[o],i.point)||s.push(i.point),s}lineSliceAlong(t,e,r){let n=0;const i=[];for(let s=0;s<r.length-1;s++){const a=r[s],o=r[s+1],l=this.distance(a,o);if(n+=l,n>t&&0===i.length&&i.push(Ri(a,o,(t-(n-l))/l)),n>=e)return i.push(Ri(a,o,(e-(n-l))/l)),i;n>t&&i.push(o)}return i}bufferPoint(t,e){const r=e/this.ky,n=e/this.kx;return[t[0]-n,t[1]-r,t[0]+n,t[1]+r]}bufferBBox(t,e){const r=e/this.ky,n=e/this.kx;return[t[0]-n,t[1]-r,t[2]+n,t[3]+r]}insideBBox(t,e){return Li(t[0]-e[0])>=0&&Li(t[0]-e[2])<=0&&t[1]>=e[1]&&t[1]<=e[3]}}function Di(t,e){return t[0]===e[0]&&t[1]===e[1]}function Ri(t,e,r){const n=Li(e[0]-t[0]);return[t[0]+n*r,t[1]+(e[1]-t[1])*r]}function Li(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}class Oi{constructor(t=[],e=((t,e)=>t<e?-1:t>e?1:0)){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(0===this.length)return;const t=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:e,compare:r}=this,n=e[t];for(;t>0;){const i=t-1>>1,s=e[i];if(r(n,s)>=0)break;e[t]=s,t=i}e[t]=n}_down(t){const{data:e,compare:r}=this,n=this.length>>1,i=e[t];for(;t<n;){let n=1+(t<<1);const s=n+1;if(s<this.length&&r(e[s],e[n])<0&&(n=s),r(e[n],i)>=0)break;e[t]=e[n],t=n}e[t]=i}}const Ui=8192;function Ni(t,e){return e.dist-t.dist}const ji=100,$i=50;function Gi(t){const e=[1/0,1/0,-1/0,-1/0];if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function qi(t){return t[1]-t[0]+1}function Hi(t,e){const r=t[1]>=t[0]&&t[1]<e;return r||console.warn("Distance Expression: Index is out of range"),r}function Xi(t,e){if(t[0]>t[1])return[null,null];const r=qi(t);if(e){if(2===r)return[t,null];const e=Math.floor(r/2);return[[t[0],t[0]+e],[t[0]+e,t[1]]]}{if(1===r)return[t,null];const e=Math.floor(r/2)-1;return[[t[0],t[0]+e],[t[0]+e+1,t[1]]]}}function Zi(t,e){const r=[1/0,1/0,-1/0,-1/0];if(!Hi(e,t.length))return r;for(let n=e[0];n<=e[1];++n)pi(r,t[n]);return r}function Wi(t){const e=[1/0,1/0,-1/0,-1/0];for(let r=0;r<t.length;++r)for(let n=0;n<t[r].length;++n)pi(e,t[r][n]);return e}function Yi(t,e,r){if(Gi(t)||Gi(e))return NaN;let n=0,i=0;return t[2]<e[0]&&(n=e[0]-t[2]),t[0]>e[2]&&(n=t[0]-e[2]),t[1]>e[3]&&(i=t[1]-e[3]),t[3]<e[1]&&(i=e[1]-t[3]),r.distance([0,0],[n,i])}function Ki(t){return 360*t-180}function Ji(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}function Qi(t,e){const r=Math.pow(2,e.z),n=(t.y/Ui+e.y)/r;return[Ki((t.x/Ui+e.x)/r),Ji(n)]}function ts(t,e){const r=[];for(let n=0;n<t.length;++n)r.push(Qi(t[n],e));return r}function es(t,e,r){const n=r.pointOnLine(e,t).point;return r.distance(t,n)}function rs(t,e,r,n,i){const s=r.slice(n[0],n[1]+1);let a=1/0;for(let r=e[0];r<=e[1];++r)if(0===(a=Math.min(a,es(t[r],s,i))))return 0;return a}function ns(t,e,r,n,i){const s=Math.min(i.pointToSegmentDistance(t,r,n),i.pointToSegmentDistance(e,r,n)),a=Math.min(i.pointToSegmentDistance(r,t,e),i.pointToSegmentDistance(n,t,e));return Math.min(s,a)}function is(t,e,r,n,i){if(!Hi(e,t.length)||!Hi(n,r.length))return NaN;let s=1/0;for(let a=e[0];a<e[1];++a)for(let e=n[0];e<n[1];++e){if(gi(t[a],t[a+1],r[e],r[e+1]))return 0;s=Math.min(s,ns(t[a],t[a+1],r[e],r[e+1],i))}return s}function ss(t,e,r,n,i){if(!Hi(e,t.length)||!Hi(n,r.length))return NaN;let s=1/0;for(let a=e[0];a<=e[1];++a)for(let e=n[0];e<=n[1];++e)if(0===(s=Math.min(s,i.distance(t[a],r[e]))))return s;return s}function as(t,e,r){if(mi(t,e,!0))return 0;let n=1/0;for(const i of e){const e=i.length;if(e<2)return console.warn("Distance Expression: Invalid polygon!"),NaN;if(i[0]!==i[e-1]&&0===(n=Math.min(n,r.pointToSegmentDistance(t,i[e-1],i[0]))))return n;if(0===(n=Math.min(n,es(t,i,r))))return n}return n}function os(t,e,r,n){if(!Hi(e,t.length))return NaN;for(let n=e[0];n<=e[1];++n)if(mi(t[n],r,!0))return 0;let i=1/0;for(let s=e[0];s<e[1];++s)for(const e of r)for(let r=0,a=e.length,o=a-1;r<a;o=r++){if(gi(t[s],t[s+1],e[o],e[r]))return 0;i=Math.min(i,ns(t[s],t[s+1],e[o],e[r],n))}return i}function ls(t,e){for(const r of t)for(let t=0;t<=r.length-1;++t)if(mi(r[t],e,!0))return!0;return!1}function us(t,e,r,n=1/0){const i=Wi(t),s=Wi(e);if(n!==1/0&&Yi(i,s,r)>=n)return n;if(di(i,s)){if(ls(t,e))return 0}else if(ls(e,t))return 0;let a=n;for(const n of t)for(let t=0,i=n.length,s=i-1;t<i;s=t++)for(const i of e)for(let e=0,o=i.length,l=o-1;e<o;l=e++){if(gi(n[s],n[t],i[l],i[e]))return 0;a=Math.min(a,ns(n[s],n[t],i[l],i[e],r))}return a}function cs(t,e,r,n,i,s,a){if(null===s||null===a)return;const o=Yi(Zi(n,s),Zi(i,a),r);o<e&&t.push({dist:o,range1:s,range2:a})}function hs(t,e,r,n,i=1/0){let s=Math.min(n.distance(t[0],r[0][0]),i);if(0===s)return s;const a=new Oi([{dist:0,range1:[0,t.length-1],range2:[0,0]}],Ni),o=e?$i:ji,l=Wi(r);for(;a.length;){const i=a.pop();if(i.dist>=s)continue;const u=i.range1;if(qi(u)<=o){if(!Hi(u,t.length))return NaN;if(e){const e=os(t,u,r,n);if(0===(s=Math.min(s,e)))return s}else for(let e=u[0];e<=u[1];++e){const i=as(t[e],r,n);if(0===(s=Math.min(s,i)))return s}}else{const r=Xi(u,e);if(null!==r[0]){const e=Yi(Zi(t,r[0]),l,n);e<s&&a.push({dist:e,range1:r[0],range2:[0,0]})}if(null!==r[1]){const e=Yi(Zi(t,r[1]),l,n);e<s&&a.push({dist:e,range1:r[1],range2:[0,0]})}}}return s}function ps(t,e,r,n,i,s=1/0){let a=Math.min(s,i.distance(t[0],r[0]));if(0===a)return a;const o=new Oi([{dist:0,range1:[0,t.length-1],range2:[0,r.length-1]}],Ni),l=e?$i:ji,u=n?$i:ji;for(;o.length;){const s=o.pop();if(s.dist>=a)continue;const c=s.range1,h=s.range2;if(qi(c)<=l&&qi(h)<=u){if(!Hi(c,t.length)||!Hi(h,r.length))return NaN;if(e&&n?a=Math.min(a,is(t,c,r,h,i)):e||n?e&&!n?a=Math.min(a,rs(r,h,t,c,i)):!e&&n&&(a=Math.min(a,rs(t,c,r,h,i))):a=Math.min(a,ss(t,c,r,h,i)),0===a)return a}else{const s=Xi(c,e),l=Xi(h,n);cs(o,a,i,t,r,s[0],l[0]),cs(o,a,i,t,r,s[0],l[1]),cs(o,a,i,t,r,s[1],l[0]),cs(o,a,i,t,r,s[1],l[1])}}return a}function ds(t,e,r,n,i=1/0){let s=i;const a=Zi(t,[0,t.length-1]);for(const i of r)if(!(s!==1/0&&Yi(a,Zi(i,[0,i.length-1]),n)>=s)&&(s=Math.min(s,ps(t,e,i,!0,n,s)),0===s))return s;return s}function fs(t,e,r,n,i=1/0){let s=i;const a=Zi(t,[0,t.length-1]);for(const i of r){if(s!==1/0&&Yi(a,Wi(i),n)>=s)continue;const r=hs(t,e,i,n,s);if(isNaN(r))return r;if(0===(s=Math.min(s,r)))return s}return s}function ms(t){return"Point"===t||"MultiPoint"===t||"LineString"===t||"MultiLineString"===t||"Polygon"===t||"MultiPolygon"===t}class ys{constructor(t,e){this.type=vn,this.geojson=t,this.geometries=e}static parse(t,e){if(2!==t.length)return e.error(`'distance' expression requires either one argument, but found ' ${t.length-1} instead.`);if(Nn(t[1])){const e=t[1];if("FeatureCollection"===e.type){for(let t=0;t<e.features.length;++t)if(ms(e.features[t].geometry.type))return new ys(e,e.features[t].geometry)}else if("Feature"===e.type){if(ms(e.geometry.type))return new ys(e,e.geometry)}else if(ms(e.type))return new ys(e,e)}return e.error("'distance' expression needs to be an array with format ['Distance', GeoJSONObj].")}evaluate(t){const e=t.geometry(),r=t.canonicalID();if(null!=e&&null!=r){if("Point"===t.geometryType())return function(t,e,r){const n=[];for(const r of t)for(const t of r)n.push(Qi(t,e));const i=new Ci(n[0][1],"meters");return"Point"===r.type||"MultiPoint"===r.type||"LineString"===r.type?ps(n,!1,"Point"===r.type?[r.coordinates]:r.coordinates,"LineString"===r.type,i):"MultiLineString"===r.type?ds(n,!1,r.coordinates,i):"Polygon"===r.type||"MultiPolygon"===r.type?fs(n,!1,"Polygon"===r.type?[r.coordinates]:r.coordinates,i):null}(e,r,this.geometries);if("LineString"===t.geometryType())return function(t,e,r){const n=[];for(const r of t){const t=[];for(const n of r)t.push(Qi(n,e));n.push(t)}const i=new Ci(n[0][0][1],"meters");if("Point"===r.type||"MultiPoint"===r.type||"LineString"===r.type)return ds("Point"===r.type?[r.coordinates]:r.coordinates,"LineString"===r.type,n,i);if("MultiLineString"===r.type){let t=1/0;for(let e=0;e<r.coordinates.length;e++){const s=ds(r.coordinates[e],!0,n,i,t);if(isNaN(s))return s;if(0===(t=Math.min(t,s)))return t}return t}if("Polygon"===r.type||"MultiPolygon"===r.type){let t=1/0;for(let e=0;e<n.length;e++){const s=fs(n[e],!0,"Polygon"===r.type?[r.coordinates]:r.coordinates,i,t);if(isNaN(s))return s;if(0===(t=Math.min(t,s)))return t}return t}return null}(e,r,this.geometries);if("Polygon"===t.geometryType())return function(t,e,r){const n=[];for(const r of function(t,e){const r=t.length;if(r<=1)return[t];const n=[];let i,s;for(let e=0;e<r;e++){const r=hi(t[e]);0!==r&&(t[e].area=Math.abs(r),void 0===s&&(s=r<0),s===r<0?(i&&n.push(i),i=[t[e]]):i.push(t[e]))}return i&&n.push(i),n}(t)){const t=[];for(let n=0;n<r.length;++n)t.push(ts(r[n],e));n.push(t)}const i=new Ci(n[0][0][0][1],"meters");if("Point"===r.type||"MultiPoint"===r.type||"LineString"===r.type)return fs("Point"===r.type?[r.coordinates]:r.coordinates,"LineString"===r.type,n,i);if("MultiLineString"===r.type){let t=1/0;for(let e=0;e<r.coordinates.length;e++){const s=fs(r.coordinates[e],!0,n,i,t);if(isNaN(s))return s;if(0===(t=Math.min(t,s)))return t}return t}return"Polygon"===r.type||"MultiPolygon"===r.type?function(t,e,r){let n=1/0;for(const i of t)for(const t of e){const e=us(i,t,r,n);if(isNaN(e))return e;if(0===(n=Math.min(n,e)))return n}return n}("Polygon"===r.type?[r.coordinates]:r.coordinates,n,i):null}(e,r,this.geometries);console.warn("Distance Expression: currently only evaluates valid Point/LineString/Polygon geometries.")}else console.warn("Distance Expression: requirs valid feature and canonical information.");return null}eachChild(){}outputDefined(){return!0}serialize(){return["distance",this.geojson]}}function gs(t){if(t instanceof si){if("get"===t.name&&1===t.args.length)return!1;if("feature-state"===t.name)return!1;if("has"===t.name&&1===t.args.length)return!1;if("properties"===t.name||"geometry-type"===t.name||"id"===t.name)return!1;if(/^filter-/.test(t.name))return!1}if(t instanceof zi)return!1;if(t instanceof ys)return!1;if(t instanceof As)return t.featureConstant;let e=!0;return t.eachChild((t=>{e&&!gs(t)&&(e=!1)})),e}function xs(t){if(t instanceof si&&"feature-state"===t.name)return!1;let e=!0;return t.eachChild((t=>{e&&!xs(t)&&(e=!1)})),e}function vs(t,e){if(t instanceof si&&e.indexOf(t.name)>=0)return!1;let r=!0;return t.eachChild((t=>{r&&!vs(t,e)&&(r=!1)})),r}function bs(t,e,r){return[t,e,r].filter(Boolean).join("")}function ws(t,e){switch(t){case"string":return $n(e);case"number":return+e;case"boolean":return!!e;case"color":return un.parse(e);case"formatted":return Rn.fromString($n(e));case"resolvedImage":return On.build($n(e))}return e}function _s(t,e,r,n){return void 0!==n&&(t=n*Math.round(t/n)),void 0!==e&&t<e&&(t=e),void 0!==r&&t>r&&(t=r),t}class As{constructor(t,e,r,n=!1){this.type=t,this.key=e,this.scope=r,this.featureConstant=n}static parse(t,e){let r=e.expectedType;if(null==r&&(r=In),t.length<2||t.length>3)return e.error("Invalid number of arguments for 'config' expression.");const n=e.parse(t[1],1);if(!(n instanceof Gn))return e.error("Key name of 'config' expression must be a string literal.");let i,s=!0;const a=$n(n.value);if(t.length>=3){const r=e.parse(t[2],2);if(!(r instanceof Gn))return e.error("Scope of 'config' expression must be a string literal.");i=$n(r.value)}if(e.options){const t=bs(a,i,e._scope),r=e.options.get(t);r&&(s=gs(r.value||r.default))}return new As(r,a,i,s)}evaluate(t){const e=bs(this.key,this.scope,t.scope),r=t.getConfig(e);if(!r)return null;const{type:n,value:i,values:s,minValue:a,maxValue:o,stepValue:l}=r,u=r.default.evaluate(t);let c=u;if(i){const e=t.scope;t.scope=(e||"").split("").slice(1).join(""),c=i.evaluate(t),t.scope=e}return n&&(c=ws(n,c)),void 0===c||void 0===a&&void 0===o&&void 0===l||("number"==typeof c?c=_s(c,a,o,l):Array.isArray(c)&&(c=c.map((t=>"number"==typeof t?_s(t,a,o,l):t)))),void 0!==i&&void 0!==c&&s&&!s.includes(c)&&(c=u,n&&(c=ws(n,c))),(n&&n!==this.type||void 0!==c&&!Fn(jn(c),this.type))&&(c=ws(this.type.kind,c)),c}eachChild(){}outputDefined(){return!1}serialize(){const t=["config",this.key];return this.scope&&t.concat(this.scope),t}}class Is{constructor(t,e){this.type=e.type,this.name=t,this.boundExpression=e}static parse(t,e){if(2!==t.length||"string"!=typeof t[1])return e.error("'var' expression requires exactly one string literal argument.");const r=t[1];return e.scope.has(r)?new Is(r,e.scope.get(r)):e.error(`Unknown variable "${r}". Make sure "${r}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class Ms{constructor(t,e=[],r,n=new gn,i=[],s,a,o){this.registry=t,this.path=e,this.key=e.map((t=>"string"==typeof t?`['${t}']`:`[${t}]`)).join(""),this.scope=n,this.errors=i,this.expectedType=r,this._scope=s,this.options=a,this.iconImageUseTheme=o}parse(t,e,r,n,i={}){return e||r?this.concat(e,null,r,n)._parse(t,i):this._parse(t,i)}parseObjectValue(t,e,r,n,i,s={}){return this.concat(e,r,n,i)._parse(t,s)}_parse(t,e){function r(t,e,r){return"assert"===r?new Xn(e,[t]):"coerce"===r?new ri(e,[t]):t}if(null!==t&&"string"!=typeof t&&"boolean"!=typeof t&&"number"!=typeof t||(t=["literal",t]),Array.isArray(t)){if(0===t.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const n="string"==typeof t[0]?this.registry[t[0]]:void 0;if(n){let i=n.parse(t,this);if(!i)return null;if(this.expectedType){const t=this.expectedType,n=i.type;if("string"!==t.kind&&"number"!==t.kind&&"boolean"!==t.kind&&"object"!==t.kind&&"array"!==t.kind||"value"!==n.kind)if("color"!==t.kind&&"formatted"!==t.kind&&"resolvedImage"!==t.kind||"value"!==n.kind&&"string"!==n.kind){if(this.checkSubtype(t,n))return null}else i=r(i,t,e.typeAnnotation||"coerce");else i=r(i,t,e.typeAnnotation||"assert")}if(!(i instanceof Gn)&&"resolvedImage"!==i.type.kind&&Ss(i)){const t=new ii(this._scope,this.options,this.iconImageUseTheme);try{i=new Gn(i.type,i.evaluate(t))}catch(t){return this.error(t.message),null}}return i}return ri.parse(["to-array",t],this)}return this.error(void 0===t?"'undefined' value invalid. Use null instead.":"object"==typeof t?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,e,r,n){let i="number"==typeof t?this.path.concat(t):this.path;i="string"==typeof e?i.concat(e):i;const s=n?this.scope.concat(n):this.scope;return new Ms(this.registry,i,r||null,s,this.errors,this._scope,this.options,this.iconImageUseTheme)}error(t,...e){const r=`${this.key}${e.map((t=>`[${t}]`)).join("")}`;this.errors.push(new yn(r,t))}checkSubtype(t,e){const r=Tn(t,e);return r&&this.error(r),r}}function Ss(t){if(t instanceof Is)return Ss(t.boundExpression);if(t instanceof si&&"error"===t.name)return!1;if(t instanceof oi)return!1;if(t instanceof zi)return!1;if(t instanceof ys)return!1;if(t instanceof As)return!1;const e=t instanceof ri||t instanceof Xn;let r=!0;return t.eachChild((t=>{r=e?r&&Ss(t):r&&t instanceof Gn})),!!r&&gs(t)&&vs(t,["zoom","heatmap-density","worldview","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed"])}function Ps(t,e){const r=t.length-1;let n,i,s=0,a=r,o=0;for(;s<=a;)if(o=Math.floor((s+a)/2),n=t[o],i=t[o+1],n<=e){if(o===r||e<i)return o;s=o+1}else{if(!(n>e))throw new qn("Input is not a number.");a=o-1}return 0}class ks{constructor(t,e,r){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(const[t,e]of r)this.labels.push(t),this.outputs.push(e)}static parse(t,e){if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");const r=e.parse(t[1],1,vn);if(!r)return null;const n=[];let i=null;e.expectedType&&"value"!==e.expectedType.kind&&(i=e.expectedType);for(let r=1;r<t.length;r+=2){const s=1===r?-1/0:t[r],a=t[r+1],o=r,l=r+1;if("number"!=typeof s)return e.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',o);if(n.length&&n[n.length-1][0]>=s)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',o);const u=e.parse(a,l,i);if(!u)return null;i=i||u.type,n.push([s,u])}return new ks(i,r,n)}evaluate(t){const e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);const i=e.length;return n>=e[i-1]?r[i-1].evaluate(t):r[Ps(e,n)].evaluate(t)}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}serialize(){const t=["step",this.input.serialize()];for(let e=0;e<this.labels.length;e++)e>0&&t.push(this.labels[e]),t.push(this.outputs[e].serialize());return t}}const Bs=.95047,zs=1.08883,Ts=4/29,Es=6/29,Vs=3*Es*Es,Fs=Es*Es*Es,Cs=Math.PI/180,Ds=180/Math.PI;function Rs(t){return t>Fs?Math.pow(t,1/3):t/Vs+Ts}function Ls(t){return t>Es?t*t*t:Vs*(t-Ts)}function Os(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Us(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Ns(t){const e=Us(t.r),r=Us(t.g),n=Us(t.b),i=Rs((.4124564*e+.3575761*r+.1804375*n)/Bs),s=Rs((.2126729*e+.7151522*r+.072175*n)/1);return{l:116*s-16,a:500*(i-s),b:200*(s-Rs((.0193339*e+.119192*r+.9503041*n)/zs)),alpha:t.a}}function js(t){let e=(t.l+16)/116,r=isNaN(t.a)?e:e+t.a/500,n=isNaN(t.b)?e:e-t.b/200;return e=1*Ls(e),r=Bs*Ls(r),n=zs*Ls(n),new un(Os(3.2404542*r-1.5371385*e-.4985314*n),Os(-.969266*r+1.8760108*e+.041556*n),Os(.0556434*r-.2040259*e+1.0572252*n),t.alpha)}function $s(t,e,r){const n=e-t;return t+r*(n>180||n<-180?n-360*Math.round(n/360):n)}const Gs={forward:Ns,reverse:js,interpolate:function(t,e,r){return{l:dn(t.l,e.l,r),a:dn(t.a,e.a,r),b:dn(t.b,e.b,r),alpha:dn(t.alpha,e.alpha,r)}}},qs={forward:function(t){const{l:e,a:r,b:n}=Ns(t),i=Math.atan2(n,r)*Ds;return{h:i<0?i+360:i,c:Math.sqrt(r*r+n*n),l:e,alpha:t.a}},reverse:function(t){const e=t.h*Cs,r=t.c;return js({l:t.l,a:Math.cos(e)*r,b:Math.sin(e)*r,alpha:t.alpha})},interpolate:function(t,e,r){return{h:$s(t.h,e.h,r),c:dn(t.c,e.c,r),l:dn(t.l,e.l,r),alpha:dn(t.alpha,e.alpha,r)}}},Hs=Object.freeze(Object.defineProperty({__proto__:null,hcl:qs,lab:Gs},Symbol.toStringTag,{value:"Module"}));class Xs{constructor(t,e,r,n,i){this.type=t,this.operator=e,this.interpolation=r,this.input=n,this.labels=[],this.outputs=[];for(const[t,e]of i)this.labels.push(t),this.outputs.push(e)}static interpolationFactor(t,e,r,n){let i=0;if("exponential"===t.name)i=Zs(e,t.base,r,n);else if("linear"===t.name)i=Zs(e,1,r,n);else if("cubic-bezier"===t.name){const s=t.controlPoints;i=new jt(s[0],s[1],s[2],s[3]).solve(Zs(e,1,r,n))}return i}static parse(t,e){let[r,n,i,...s]=t;if(!Array.isArray(n)||0===n.length)return e.error("Expected an interpolation type expression.",1);if("linear"===n[0])n={name:"linear"};else if("exponential"===n[0]){const t=n[1];if("number"!=typeof t)return e.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:t}}else{if("cubic-bezier"!==n[0])return e.error(`Unknown interpolation type ${String(n[0])}`,1,0);{const t=n.slice(1);if(4!==t.length||t.some((t=>"number"!=typeof t||t<0||t>1)))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:t}}}if(t.length-1<4)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length-1>3&&(t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(i=e.parse(i,2,vn),!i)return null;const a=[];let o=null;"interpolate-hcl"===r||"interpolate-lab"===r?o=_n:e.expectedType&&"value"!==e.expectedType.kind&&(o=e.expectedType);for(let t=0;t<s.length;t+=2){const r=s[t],n=s[t+1],i=t+3,l=t+4;if("number"!=typeof r)return e.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',i);if(a.length&&a[a.length-1][0]>=r)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',i);const u=e.parse(n,l,o);if(!u)return null;o=o||u.type,a.push([r,u])}return"number"===o.kind||"color"===o.kind||"array"===o.kind&&"number"===o.itemType.kind&&"number"==typeof o.N?new Xs(o,r,n,i,a):e.error(`Type ${Bn(o)} is not interpolatable.`)}evaluate(t){const e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);const n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);const i=e.length;if(n>=e[i-1])return r[i-1].evaluate(t);const s=Ps(e,n),a=Xs.interpolationFactor(this.interpolation,n,e[s],e[s+1]),o=r[s].evaluate(t),l=r[s+1].evaluate(t);return"interpolate"===this.operator?mn[this.type.kind.toLowerCase()](o,l,a):"interpolate-hcl"===this.operator?qs.reverse(qs.interpolate(qs.forward(o),qs.forward(l),a)):Gs.reverse(Gs.interpolate(Gs.forward(o),Gs.forward(l),a))}eachChild(t){t(this.input);for(const e of this.outputs)t(e)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))}serialize(){let t;t="linear"===this.interpolation.name?["linear"]:"exponential"===this.interpolation.name?1===this.interpolation.base?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier",...this.interpolation.controlPoints];const e=[this.operator,t,this.input.serialize()];for(let t=0;t<this.labels.length;t++)e.push(this.labels[t],this.outputs[t].serialize());return e}}function Zs(t,e,r,n){const i=n-r,s=t-r;return 0===i?0:1===e?s/i:(Math.pow(e,s)-1)/(Math.pow(e,i)-1)}class Ws{constructor(t,e){this.type=t,this.args=e}static parse(t,e){if(t.length<2)return e.error("Expectected at least one argument.");let r=null;const n=e.expectedType;n&&"value"!==n.kind&&(r=n);const i=[];for(const n of t.slice(1)){const t=e.parse(n,1+i.length,r,void 0,{typeAnnotation:"omit"});if(!t)return null;r=r||t.type,i.push(t)}const s=n&&i.some((t=>Tn(n,t.type)));return new Ws(s?In:r,i)}evaluate(t){let e,r=null,n=0;for(const i of this.args){if(n++,r=i.evaluate(t),r&&r instanceof On&&!r.available&&(e||(e=r),r=null,n===this.args.length))return e;if(null!==r)break}return r}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every((t=>t.outputDefined()))}serialize(){const t=["coalesce"];return this.eachChild((e=>{t.push(e.serialize())})),t}}class Ys{constructor(t,e){this.type=e.type,this.bindings=[].concat(t),this.result=e}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const e of this.bindings)t(e[1]);t(this.result)}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const r=[];for(let n=1;n<t.length-1;n+=2){const i=t[n];if("string"!=typeof i)return e.error(`Expected string, but found ${typeof i} instead.`,n);if(/[^a-zA-Z0-9_]/.test(i))return e.error("Variable names must contain only alphanumeric characters or '_'.",n);const s=e.parse(t[n+1],n+1);if(!s)return null;r.push([i,s])}const n=e.parse(t[t.length-1],t.length-1,e.expectedType,r);return n?new Ys(r,n):null}outputDefined(){return this.result.outputDefined()}serialize(){const t=["let"];for(const[e,r]of this.bindings)t.push(e,r.serialize());return t.push(this.result.serialize()),t}}class Ks{constructor(t,e,r){this.type=t,this.index=e,this.input=r}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,vn),n=e.parse(t[2],2,kn(e.expectedType||In));return r&&n?new Ks(n.type.itemType,r,n):null}evaluate(t){const e=this.index.evaluate(t),r=this.input.evaluate(t);if(e<0)throw new qn("Array index out of bounds: negative index");if(e>=r.length)throw new qn("Array index out of bounds: index exceeds array size");if(e!==Math.floor(e))throw new qn("Array index must be an integer. Use at-interpolated for fractional indices");return r[e]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class Js{constructor(t,e,r){this.type=t,this.index=e,this.input=r}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,vn),n=e.parse(t[2],2,kn(e.expectedType||In));return r&&n?new Js(n.type.itemType,r,n):null}evaluate(t){const e=this.index.evaluate(t),r=this.input.evaluate(t);if(e<0)throw new qn(`Array index out of bounds: ${e} < 0.`);if(e>r.length-1)throw new qn(`Array index out of bounds: ${e} > ${r.length-1}.`);if(e===Math.floor(e))return r[e];const n=Math.floor(e),i=Math.ceil(e),s=r[n],a=r[i];if("number"!=typeof s||"number"!=typeof a)throw new qn(`Cannot interpolate between non-number values at index ${e}.`);const o=e-n;return s*(1-o)+a*o}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}serialize(){return["at-interpolated",this.index.serialize(),this.input.serialize()]}}class Qs{constructor(t,e){this.type=wn,this.needle=t,this.haystack=e}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,In),n=e.parse(t[2],2,In);return r&&n?En(r.type,[wn,bn,vn,xn,In])?new Qs(r,n):e.error(`Expected first argument to be of type boolean, string, number or null, but found ${Bn(r.type)} instead`):null}evaluate(t){const e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(null==r)return!1;if(!Vn(e,["boolean","string","number","null"]))throw new qn(`Expected first argument to be of type boolean, string, number or null, but found ${Bn(jn(e))} instead.`);if(!Vn(r,["string","array"]))throw new qn(`Expected second argument to be of type array or string, but found ${Bn(jn(r))} instead.`);return r.indexOf(e)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class ta{constructor(t,e,r){this.type=vn,this.needle=t,this.haystack=e,this.fromIndex=r}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,In),n=e.parse(t[2],2,In);if(!r||!n)return null;if(!En(r.type,[wn,bn,vn,xn,In]))return e.error(`Expected first argument to be of type boolean, string, number or null, but found ${Bn(r.type)} instead`);if(4===t.length){const i=e.parse(t[3],3,vn);return i?new ta(r,n,i):null}return new ta(r,n)}evaluate(t){const e=this.needle.evaluate(t),r=this.haystack.evaluate(t);if(!Vn(e,["boolean","string","number","null"]))throw new qn(`Expected first argument to be of type boolean, string, number or null, but found ${Bn(jn(e))} instead.`);if(!Vn(r,["string","array"]))throw new qn(`Expected second argument to be of type array or string, but found ${Bn(jn(r))} instead.`);if(this.fromIndex){const n=this.fromIndex.evaluate(t);return r.indexOf(e,n)}return r.indexOf(e)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}serialize(){if(null!=this.fromIndex&&void 0!==this.fromIndex){const t=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),t]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class ea{constructor(t,e,r,n,i,s){this.inputType=t,this.type=e,this.input=r,this.cases=n,this.outputs=i,this.otherwise=s}static parse(t,e){if(t.length<5)return e.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return e.error("Expected an even number of arguments.");let r,n;e.expectedType&&"value"!==e.expectedType.kind&&(n=e.expectedType);const i={},s=[];for(let a=2;a<t.length-1;a+=2){let o=t[a];const l=t[a+1];Array.isArray(o)||(o=[o]);const u=e.concat(a);if(0===o.length)return u.error("Expected at least one branch label.");for(const t of o){if("number"!=typeof t&&"string"!=typeof t)return u.error("Branch labels must be numbers or strings.");if("number"==typeof t&&Math.abs(t)>Number.MAX_SAFE_INTEGER)return u.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof t&&Math.floor(t)!==t)return u.error("Numeric branch labels must be integer values.");if(r){if(u.checkSubtype(r,jn(t)))return null}else r=jn(t);if(void 0!==i[String(t)])return u.error("Branch labels must be unique.");i[String(t)]=s.length}const c=e.parse(l,a,n);if(!c)return null;n=n||c.type,s.push(c)}const a=e.parse(t[1],1,In);if(!a)return null;const o=e.parse(t[t.length-1],t.length-1,n);return o?"value"!==a.type.kind&&e.concat(1).checkSubtype(r,a.type)?null:new ea(r,n,a,i,s,o):null}evaluate(t){const e=this.input.evaluate(t);return(Fn(jn(e),this.inputType)&&this.outputs[this.cases[e]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every((t=>t.outputDefined()))&&this.otherwise.outputDefined()}serialize(){const t=["match",this.input.serialize()],e=Object.keys(this.cases).sort(),r=[],n={};for(const t of e){const e=n[this.cases[t]];void 0===e?(n[this.cases[t]]=r.length,r.push([this.cases[t],[t]])):r[e][1].push(t)}const i=t=>"number"===this.inputType.kind?Number(t):t;for(const[e,n]of r)t.push(1===n.length?i(n[0]):n.map(i)),t.push(this.outputs[e].serialize());return t.push(this.otherwise.serialize()),t}}class ra{constructor(t,e,r){this.type=t,this.branches=e,this.otherwise=r}static parse(t,e){if(t.length<4)return e.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return e.error("Expected an odd number of arguments.");let r;e.expectedType&&"value"!==e.expectedType.kind&&(r=e.expectedType);const n=[];for(let i=1;i<t.length-1;i+=2){const s=e.parse(t[i],i,wn);if(!s)return null;const a=e.parse(t[i+1],i+1,r);if(!a)return null;n.push([s,a]),r=r||a.type}const i=e.parse(t[t.length-1],t.length-1,r);return i?new ra(r,n,i):null}evaluate(t){for(const[e,r]of this.branches)if(e.evaluate(t))return r.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(const[e,r]of this.branches)t(e),t(r);t(this.otherwise)}outputDefined(){return this.branches.every((([t,e])=>e.outputDefined()))&&this.otherwise.outputDefined()}serialize(){const t=["case"];return this.eachChild((e=>{t.push(e.serialize())})),t}}class na{constructor(t,e,r,n){this.type=t,this.input=e,this.beginIndex=r,this.endIndex=n}static parse(t,e){if(t.length<=2||t.length>=5)return e.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,In),n=e.parse(t[2],2,vn);if(!r||!n)return null;if(!En(r.type,[kn(In),bn,In]))return e.error(`Expected first argument to be of type array or string, but found ${Bn(r.type)} instead`);if(4===t.length){const i=e.parse(t[3],3,vn);return i?new na(r.type,r,n,i):null}return new na(r.type,r,n)}evaluate(t){const e=this.input.evaluate(t),r=this.beginIndex.evaluate(t);if(!Vn(e,["string","array"]))throw new qn(`Expected first argument to be of type array or string, but found ${Bn(jn(e))} instead.`);if(this.endIndex){const n=this.endIndex.evaluate(t);return e.slice(r,n)}return e.slice(r)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}serialize(){if(null!=this.endIndex&&void 0!==this.endIndex){const t=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),t]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}class ia{constructor(t,e){this.type=kn(bn),this.str=t,this.delimiter=e}static parse(t,e){if(3!==t.length)return e.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const r=e.parse(t[1],1,bn),n=e.parse(t[2],2,bn);return r&&n?new ia(r,n):void 0}evaluate(t){const e=this.str.evaluate(t),r=this.delimiter.evaluate(t);return e.split(r)}eachChild(t){t(this.str),t(this.delimiter)}outputDefined(){return!1}serialize(){return["split",this.str.serialize(),this.delimiter.serialize()]}}function sa(t,e){return"=="===t||"!="===t?"boolean"===e.kind||"string"===e.kind||"number"===e.kind||"null"===e.kind||"value"===e.kind:"string"===e.kind||"number"===e.kind||"value"===e.kind}function aa(t,e,r,n){return 0===n.compare(e,r)}function oa(t,e,r){const n="=="!==t&&"!="!==t;return class i{constructor(t,e,r){this.type=wn,this.lhs=t,this.rhs=e,this.collator=r,this.hasUntypedArgument="value"===t.type.kind||"value"===e.type.kind}static parse(t,e){if(3!==t.length&&4!==t.length)return e.error("Expected two or three arguments.");const r=t[0];let s=e.parse(t[1],1,In);if(!s)return null;if(!sa(r,s.type))return e.concat(1).error(`"${r}" comparisons are not supported for type '${Bn(s.type)}'.`);let a=e.parse(t[2],2,In);if(!a)return null;if(!sa(r,a.type))return e.concat(2).error(`"${r}" comparisons are not supported for type '${Bn(a.type)}'.`);if(s.type.kind!==a.type.kind&&"value"!==s.type.kind&&"value"!==a.type.kind)return e.error(`Cannot compare types '${Bn(s.type)}' and '${Bn(a.type)}'.`);n&&("value"===s.type.kind&&"value"!==a.type.kind?s=new Xn(a.type,[s]):"value"!==s.type.kind&&"value"===a.type.kind&&(a=new Xn(s.type,[a])));let o=null;if(4===t.length){if("string"!==s.type.kind&&"string"!==a.type.kind&&"value"!==s.type.kind&&"value"!==a.type.kind)return e.error("Cannot use collator to compare non-string types.");if(o=e.parse(t[3],3,Mn),!o)return null}return new i(s,a,o)}evaluate(i){const s=this.lhs.evaluate(i),a=this.rhs.evaluate(i);if(n&&this.hasUntypedArgument){const e=jn(s),r=jn(a);if(e.kind!==r.kind||"string"!==e.kind&&"number"!==e.kind)throw new qn(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${e.kind}, ${r.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const t=jn(s),r=jn(a);if("string"!==t.kind||"string"!==r.kind)return e(i,s,a)}return this.collator?r(i,s,a,this.collator.evaluate(i)):e(i,s,a)}eachChild(t){t(this.lhs),t(this.rhs),this.collator&&t(this.collator)}outputDefined(){return!0}serialize(){const e=[t];return this.eachChild((t=>{e.push(t.serialize())})),e}}}const la=oa("==",(function(t,e,r){return e===r}),aa),ua=oa("!=",(function(t,e,r){return e!==r}),(function(t,e,r,n){return!aa(0,e,r,n)})),ca=oa("<",(function(t,e,r){return e<r}),(function(t,e,r,n){return n.compare(e,r)<0})),ha=oa(">",(function(t,e,r){return e>r}),(function(t,e,r,n){return n.compare(e,r)>0})),pa=oa("<=",(function(t,e,r){return e<=r}),(function(t,e,r,n){return n.compare(e,r)<=0})),da=oa(">=",(function(t,e,r){return e>=r}),(function(t,e,r,n){return n.compare(e,r)>=0}));class fa{constructor(t,e,r,n,i,s){this.type=bn,this.number=t,this.locale=e,this.currency=r,this.unit=n,this.minFractionDigits=i,this.maxFractionDigits=s}static parse(t,e){if(3!==t.length)return e.error("Expected two arguments.");const r=e.parse(t[1],1,vn);if(!r)return null;const n=t[2];if("object"!=typeof n||Array.isArray(n))return e.error("NumberFormat options argument must be an object.");let i=null;if(n.locale&&(i=e.parseObjectValue(n.locale,2,"locale",bn),!i))return null;let s=null;if(n.currency&&(s=e.parseObjectValue(n.currency,2,"currency",bn),!s))return null;let a=null;if(n.unit&&(a=e.parseObjectValue(n.unit,2,"unit",bn),!a))return null;let o=null;if(n["min-fraction-digits"]&&(o=e.parseObjectValue(n["min-fraction-digits"],2,"min-fraction-digits",vn),!o))return null;let l=null;return n["max-fraction-digits"]&&(l=e.parseObjectValue(n["max-fraction-digits"],2,"max-fraction-digits",vn),!l)?null:new fa(r,i,s,a,o,l)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(t):void 0,unit:this.unit?this.unit.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.unit&&t(this.unit),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const t={};return this.locale&&(t.locale=this.locale.serialize()),this.currency&&(t.currency=this.currency.serialize()),this.unit&&(t.unit=this.unit.serialize()),this.minFractionDigits&&(t["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(t["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),t]}}class ma{constructor(t){this.type=vn,this.input=t}static parse(t,e){if(2!==t.length)return e.error(`Expected 1 argument, but found ${t.length-1} instead.`);const r=e.parse(t[1],1);return r?"array"!==r.type.kind&&"string"!==r.type.kind&&"value"!==r.type.kind?e.error(`Expected argument of type string or array, but found ${Bn(r.type)} instead.`):new ma(r):null}evaluate(t){const e=this.input.evaluate(t);if("string"==typeof e)return e.length;if(Array.isArray(e))return e.length;throw new qn(`Expected value to be of type string or array, but found ${Bn(jn(e))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}serialize(){const t=["length"];return this.eachChild((e=>{t.push(e.serialize())})),t}}function ya(t){return function(){t=1831565813+(t|=0)|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}const ga={"==":la,"!=":ua,">":ha,"<":ca,">=":da,"<=":pa,array:Xn,at:Ks,"at-interpolated":Js,boolean:Xn,case:ra,coalesce:Ws,collator:oi,format:Zn,image:Wn,in:Qs,"index-of":ta,interpolate:Xs,"interpolate-hcl":Xs,"interpolate-lab":Xs,length:ma,let:Ys,literal:Gn,match:ea,number:Xn,"number-format":fa,object:Xn,slice:na,step:ks,string:Xn,"to-boolean":ri,"to-color":ri,"to-number":ri,"to-string":ri,var:Is,within:zi,distance:ys,config:As,split:ia};function xa(t,[e,r,n,i]){e=e.evaluate(t),r=r.evaluate(t),n=n.evaluate(t);const s=i?i.evaluate(t):1,a=Un(e,r,n,s);if(a)throw new qn(a);return new un(e/255,r/255,n/255,s)}function va(t,[e,r,n,i]){e=e.evaluate(t),r=r.evaluate(t),n=n.evaluate(t);const s=i?i.evaluate(t):1,a=function(t,e,r,n){return"number"==typeof t&&t>=0&&t<=360?"number"==typeof e&&e>=0&&e<=100&&"number"==typeof r&&r>=0&&r<=100?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:`Invalid hsla value [${[t,e,r,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${("number"==typeof n?[t,e,r,n]:[t,e,r]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${("number"==typeof n?[t,e,r,n]:[t,e,r]).join(", ")}]: 'h' must be between 0 and 360.`}(e,r,n,s);if(a)throw new qn(a);const o=`hsla(${e}, ${r}%, ${n}%, ${s})`,l=un.parse(o);if(!l)throw new qn(`Failed to parse HSLA color: ${o}`);return l}function ba(t,e){return t in e}function wa(t,e){const r=e[t];return void 0===r?null:r}function _a(t){return{type:t}}function Aa(t){if(t instanceof As)return new Set([t.key]);let e=new Set;return t.eachChild((t=>{e=new Set([...e,...Aa(t)])})),e}function Ia(t){if(t instanceof si&&"is-active-floor"===t.name)return!0;let e=!1;return t.eachChild((t=>{!e&&Ia(t)&&(e=!0)})),e}function Ma(t){return{result:"success",value:t}}function Sa(t){return{result:"error",value:t}}function Pa(t,e){return!!t&&!!t.parameters&&t.parameters.indexOf(e)>-1}function ka(t){return"data-driven"===t["property-type"]}function Ba(t){return Pa(t.expression,"measure-light")}function za(t){return Pa(t.expression,"zoom")}function Ta(t){return!!t.expression&&t.expression.interpolated}function Ea(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function Va(t){return t}function Fa(t,e){const r="color"===e.type,n=t.stops&&"object"==typeof t.stops[0][0],i=n||!(n||void 0!==t.property),s=t.type||(Ta(e)?"exponential":"interval");if(r&&((t=Object.assign({},t)).stops&&(t.stops=t.stops.map((t=>[t[0],un.parse(t[1])]))),t.default=un.parse(t.default?t.default:e.default)),t.colorSpace&&"rgb"!==t.colorSpace&&!Hs[t.colorSpace])throw new Error(`Unknown color space: ${t.colorSpace}`);let a,o,l;if("exponential"===s)a=La;else if("interval"===s)a=Ra;else if("categorical"===s){a=Da,o=Object.create(null);for(const e of t.stops)o[e[0]]=e[1];l=typeof t.stops[0][0]}else{if("identity"!==s)throw new Error(`Unknown function type "${s}"`);a=Oa}if(n){const r={},n=[];for(let e=0;e<t.stops.length;e++){const i=t.stops[e],s=i[0].zoom;void 0===r[s]&&(r[s]={zoom:s,type:t.type,property:t.property,default:t.default,stops:[]},n.push(s)),r[s].stops.push([i[0].value,i[1]])}const i=[];for(const t of n)i.push([r[t].zoom,Fa(r[t],e)]);const s={name:"linear"};return{kind:"composite",interpolationType:s,interpolationFactor:Xs.interpolationFactor.bind(void 0,s),zoomStops:i.map((t=>t[0])),evaluate:({zoom:r},n)=>La({stops:i,base:t.base},e,r).evaluate(r,n)}}if(i){const r="exponential"===s?{name:"exponential",base:void 0!==t.base?t.base:1}:null;return{kind:"camera",interpolationType:r,interpolationFactor:Xs.interpolationFactor.bind(void 0,r),zoomStops:t.stops.map((t=>t[0])),evaluate:({zoom:r})=>a(t,e,r,o,l)}}return{kind:"source",evaluate(r,n){const i=n&&n.properties?n.properties[t.property]:void 0;return void 0===i?Ca(t.default,e.default):a(t,e,i,o,l)}}}function Ca(t,e,r){return void 0!==t?t:void 0!==e?e:void 0!==r?r:void 0}function Da(t,e,r,n,i){return Ca(typeof r===i?n[r]:void 0,t.default,e.default)}function Ra(t,e,r){if(!Qn(r))return Ca(t.default,e.default);const n=t.stops.length;if(1===n)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[n-1][0])return t.stops[n-1][1];const i=Ps(t.stops.map((t=>t[0])),r);return t.stops[i][1]}function La(t,e,r){const n=void 0!==t.base?t.base:1;if(!Qn(r))return Ca(t.default,e.default);const i=t.stops.length;if(1===i)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[i-1][0])return t.stops[i-1][1];const s=Ps(t.stops.map((t=>t[0])),r),a=function(t,e,r,n){const i=n-r,s=t-r;return 0===i?0:1===e?s/i:(Math.pow(e,s)-1)/(Math.pow(e,i)-1)}(r,n,t.stops[s][0],t.stops[s+1][0]),o=t.stops[s][1],l=t.stops[s+1][1];let u=mn[e.type]||Va;if(t.colorSpace&&"rgb"!==t.colorSpace){const e=Hs[t.colorSpace];u=(t,r)=>e.reverse(e.interpolate(e.forward(t),e.forward(r),a))}return"function"==typeof o.evaluate?{evaluate(...t){const e=o.evaluate.apply(void 0,t),r=l.evaluate.apply(void 0,t);if(void 0!==e&&void 0!==r)return u(e,r,a)}}:u(o,l,a)}function Oa(t,e,r){return"color"===e.type?r=un.parse(r):"formatted"===e.type?r=Rn.fromString(r.toString()):"resolvedImage"===e.type?r=On.build(r.toString()):Yn(r)===e.type||"enum"===e.type&&e.values[r]||(r=void 0),Ca(r,t.default,e.default)}si.register(ga,{error:[{kind:"error"},[bn],(t,[e])=>{throw new qn(e.evaluate(t))}],typeof:[bn,[In],(t,[e])=>Bn(jn(e.evaluate(t)))],"to-rgba":[kn(vn,4),[_n],(t,[e])=>e.evaluate(t).toNonPremultipliedRenderColor(null).toArray()],"to-hsla":[kn(vn,4),[_n],(t,[e])=>e.evaluate(t).toNonPremultipliedRenderColor(null).toHslaArray()],rgb:[_n,[vn,vn,vn],xa],rgba:[_n,[vn,vn,vn,vn],xa],hsl:[_n,[vn,vn,vn],va],hsla:[_n,[vn,vn,vn,vn],va],has:{type:wn,overloads:[[[bn],(t,[e])=>ba(e.evaluate(t),t.properties())],[[bn,An],(t,[e,r])=>ba(e.evaluate(t),r.evaluate(t))]]},get:{type:In,overloads:[[[bn],(t,[e])=>wa(e.evaluate(t),t.properties())],[[bn,An],(t,[e,r])=>wa(e.evaluate(t),r.evaluate(t))]]},"feature-state":[In,[bn],(t,[e])=>wa(e.evaluate(t),t.featureState||{})],properties:[An,[],t=>t.properties()],"geometry-type":[bn,[],t=>t.geometryType()],worldview:[bn,[],t=>t.globals.worldview||""],"is-active-floor":[wn,_a(bn),(t,e)=>{if(!(t.globals.activeFloors&&t.globals.activeFloors.size>0))return!1;const r=t.globals.activeFloors;return e.some((e=>{const n=e.evaluate(t);return r.has(n)}))}],id:[In,[],t=>t.id()],zoom:[vn,[],t=>t.globals.zoom],pitch:[vn,[],t=>t.globals.pitch||0],"distance-from-center":[vn,[],t=>t.distanceFromCenter()],"measure-light":[vn,[bn],(t,[e])=>t.measureLight(e.evaluate(t))],"heatmap-density":[vn,[],t=>t.globals.heatmapDensity||0],"line-progress":[vn,[],t=>t.globals.lineProgress||0],"raster-value":[vn,[],t=>t.globals.rasterValue||0],"raster-particle-speed":[vn,[],t=>t.globals.rasterParticleSpeed||0],"sky-radial-progress":[vn,[],t=>t.globals.skyRadialProgress||0],accumulated:[In,[],t=>void 0===t.globals.accumulated?null:t.globals.accumulated],"+":[vn,_a(vn),(t,e)=>{let r=0;for(const n of e)r+=n.evaluate(t);return r}],"*":[vn,_a(vn),(t,e)=>{let r=1;for(const n of e)r*=n.evaluate(t);return r}],"-":{type:vn,overloads:[[[vn,vn],(t,[e,r])=>e.evaluate(t)-r.evaluate(t)],[[vn],(t,[e])=>-e.evaluate(t)]]},"/":[vn,[vn,vn],(t,[e,r])=>e.evaluate(t)/r.evaluate(t)],"%":[vn,[vn,vn],(t,[e,r])=>e.evaluate(t)%r.evaluate(t)],ln2:[vn,[],()=>Math.LN2],pi:[vn,[],()=>Math.PI],e:[vn,[],()=>Math.E],"^":[vn,[vn,vn],(t,[e,r])=>Math.pow(e.evaluate(t),r.evaluate(t))],sqrt:[vn,[vn],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[vn,[vn],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[vn,[vn],(t,[e])=>Math.log(e.evaluate(t))],log2:[vn,[vn],(t,[e])=>Math.log2(e.evaluate(t))],sin:[vn,[vn],(t,[e])=>Math.sin(e.evaluate(t))],cos:[vn,[vn],(t,[e])=>Math.cos(e.evaluate(t))],tan:[vn,[vn],(t,[e])=>Math.tan(e.evaluate(t))],asin:[vn,[vn],(t,[e])=>Math.asin(e.evaluate(t))],acos:[vn,[vn],(t,[e])=>Math.acos(e.evaluate(t))],atan:[vn,[vn],(t,[e])=>Math.atan(e.evaluate(t))],min:[vn,_a(vn),(t,e)=>Math.min(...e.map((e=>e.evaluate(t))))],max:[vn,_a(vn),(t,e)=>Math.max(...e.map((e=>e.evaluate(t))))],abs:[vn,[vn],(t,[e])=>Math.abs(e.evaluate(t))],round:[vn,[vn],(t,[e])=>{const r=e.evaluate(t);return r<0?-Math.round(-r):Math.round(r)}],floor:[vn,[vn],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[vn,[vn],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[wn,[bn,In],(t,[e,r])=>t.properties()[e.value]===r.value],"filter-id-==":[wn,[In],(t,[e])=>t.id()===e.value],"filter-type-==":[wn,[bn],(t,[e])=>t.geometryType()===e.value],"filter-<":[wn,[bn,In],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n<i}],"filter-id-<":[wn,[In],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r<n}],"filter->":[wn,[bn,In],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>i}],"filter-id->":[wn,[In],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r>n}],"filter-<=":[wn,[bn,In],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n<=i}],"filter-id-<=":[wn,[In],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r<=n}],"filter->=":[wn,[bn,In],(t,[e,r])=>{const n=t.properties()[e.value],i=r.value;return typeof n==typeof i&&n>=i}],"filter-id->=":[wn,[In],(t,[e])=>{const r=t.id(),n=e.value;return typeof r==typeof n&&r>=n}],"filter-has":[wn,[In],(t,[e])=>e.value in t.properties()],"filter-has-id":[wn,[],t=>null!==t.id()&&void 0!==t.id()],"filter-type-in":[wn,[kn(bn)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[wn,[kn(In)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[wn,[bn,kn(In)],(t,[e,r])=>r.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[wn,[bn,kn(In)],(t,[e,r])=>function(t,e,r,n){for(;r<=n;){const i=r+n>>1;if(e[i]===t)return!0;e[i]>t?n=i-1:r=i+1}return!1}(t.properties()[e.value],r.value,0,r.value.length-1)],all:{type:wn,overloads:[[[wn,wn],(t,[e,r])=>e.evaluate(t)&&r.evaluate(t)],[_a(wn),(t,e)=>{for(const r of e)if(!r.evaluate(t))return!1;return!0}]]},any:{type:wn,overloads:[[[wn,wn],(t,[e,r])=>e.evaluate(t)||r.evaluate(t)],[_a(wn),(t,e)=>{for(const r of e)if(r.evaluate(t))return!0;return!1}]]},"!":[wn,[wn],(t,[e])=>!e.evaluate(t)],"is-supported-script":[wn,[bn],(t,[e])=>{const r=t.globals&&t.globals.isSupportedScript;return!r||r(e.evaluate(t))}],upcase:[bn,[bn],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[bn,[bn],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[bn,_a(In),(t,e)=>e.map((e=>$n(e.evaluate(t)))).join("")],"resolved-locale":[bn,[Mn],(t,[e])=>e.evaluate(t).resolvedLocale()],random:[vn,[vn,vn,In],(t,e)=>{const[r,n,i]=e.map((e=>e.evaluate(t)));if(r>n)return r;if(r===n)return r;let s;if("string"==typeof i)s=function(t){let e=0;if(0===t.length)return e;for(let r=0;r<t.length;r++)e=(e<<5)-e+t.charCodeAt(r),e|=0;return e}(i);else{if("number"!=typeof i)throw new qn(`Invalid seed input: ${i}`);s=i}return r+ya(s)()*(n-r)}]});class Ua{constructor(t,e,r,n,i){this.expression=t,this._warningHistory={},this._scope=r,this._options=n,this._iconImageUseTheme=i,this._evaluator=new ii(r,n,i),this._defaultValue=e?function(t){return"color"===t.type&&(Ea(t.default)||Array.isArray(t.default))?new un(0,0,0,0):"color"===t.type?un.parse(t.default)||null:void 0===t.default?null:t.default}(e):null,this._enumValues=e&&"enum"===e.type?e.values:null,this.configDependencies=Aa(t),this.isIndoorDependent=Ia(t)}evaluateWithoutErrorHandling(t,e,r,n,i,s,a,o){return this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=r,this._evaluator.canonical=n||null,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=s,this._evaluator.featureTileCoord=a||null,this._evaluator.featureDistanceData=o||null,this.expression.evaluate(this._evaluator)}evaluate(t,e,r,n,i,s,a,o,l){this._evaluator||(this._evaluator=new ii(this._scope,this._options,this._iconImageUseTheme)),this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=r||null,this._evaluator.canonical=n||null,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=s||null,this._evaluator.featureTileCoord=a||null,this._evaluator.featureDistanceData=o||null,this._evaluator.iconImageUseTheme=l||null;try{const t=this.expression.evaluate(this._evaluator);if(null==t||"number"==typeof t&&t!=t)return this._defaultValue;if(this._enumValues&&!(t in this._enumValues))throw new qn(`Expected value to be one of ${Object.keys(this._enumValues).map((t=>JSON.stringify(t))).join(", ")}, but found ${JSON.stringify(t)} instead.`);return t}catch(t){const e=t;return this._warningHistory[e.message]||(this._warningHistory[e.message]=!0,"undefined"!=typeof console&&console.warn(`Failed to evaluate expression "${JSON.stringify(this.expression.serialize())}". ${e.message}`)),this._defaultValue}}}function Na(t){return Array.isArray(t)&&t.length>0&&"string"==typeof t[0]&&t[0]in ga}function ja(t,e,r,n,i){const s=new Ms(ga,[],e?function(t){const e={color:_n,string:bn,number:vn,enum:bn,boolean:wn,formatted:Sn,resolvedImage:Pn};return"array"===t.type?kn(e[t.value]||In,t.length):e[t.type]}(e):void 0,void 0,void 0,r,n,i),a=s.parse(t,void 0,void 0,void 0,e&&"string"===e.type?{typeAnnotation:"coerce"}:void 0);return a?Ma(new Ua(a,e,r,n,i)):Sa(s.errors)}class $a{constructor(t,e,r,n){this.kind=t,this._styleExpression=e,this.isLightConstant=r,this.isLineProgressConstant=n,this.isStateDependent="constant"!==t&&!xs(e.expression),this.configDependencies=Aa(e.expression),this.isIndoorDependent=Ia(e.expression)}evaluateWithoutErrorHandling(t,e,r,n,i,s){return this._styleExpression.evaluateWithoutErrorHandling(t,e,r,n,i,s)}evaluate(t,e,r,n,i,s,a){return this._styleExpression.evaluate(t,e,r,n,i,s,void 0,void 0,a)}}class Ga{constructor(t,e,r,n,i,s){this.kind=t,this.zoomStops=r,this._styleExpression=e,this.isStateDependent="camera"!==t&&!xs(e.expression),this.isIndoorDependent=Ia(e.expression),this.isLightConstant=i,this.isLineProgressConstant=s,this.configDependencies=Aa(e.expression),this.interpolationType=n}evaluateWithoutErrorHandling(t,e,r,n,i,s){return this._styleExpression.evaluateWithoutErrorHandling(t,e,r,n,i,s)}evaluate(t,e,r,n,i,s){return this._styleExpression.evaluate(t,e,r,n,i,s)}interpolationFactor(t,e,r){return this.interpolationType?Xs.interpolationFactor(this.interpolationType,t,e,r):0}}function qa(t,e,r,n,i){if("error"===(t=ja(t,e,r,n,i)).result)return t;const s=t.value.expression,a=gs(s);if(!a&&!ka(e))return Sa([new yn("","data expressions not supported")]);const o=vs(s,["zoom","pitch","distance-from-center"]);if(!o&&!za(e))return Sa([new yn("","zoom expressions not supported")]);const l=vs(s,["measure-light"]);if(!l&&!Ba(e))return Sa([new yn("","measure-light expression not supported")]);const u=vs(s,["line-progress"]);if(!u&&!function(t){return Pa(t.expression,"line-progress")}(e))return Sa([new yn("","line-progress expression not supported")]);const c=e.expression&&e.expression.relaxZoomRestriction,h=Xa(s);return h||o||c?h instanceof yn?Sa([h]):h instanceof Xs&&!Ta(e)?Sa([new yn("",'"interpolate" expressions cannot be used with this property')]):Ma(h?new Ga(a&&u?"camera":"composite",t.value,h.labels,h instanceof Xs?h.interpolation:void 0,l,u):new $a(a&&u?"constant":"source",t.value,l,u)):Sa([new yn("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class Ha{constructor(t,e){this._parameters=t,this._specification=e,Object.assign(this,Fa(this._parameters,this._specification))}static deserialize(t){return new Ha(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function Xa(t){let e=null;if(t instanceof Ys)e=Xa(t.result);else if(t instanceof Ws){for(const r of t.args)if(e=Xa(r),e)break}else(t instanceof ks||t instanceof Xs)&&t.input instanceof si&&"zoom"===t.input.name&&(e=t);return e instanceof yn||t.eachChild((t=>{const r=Xa(t);r instanceof yn?e=r:e&&r&&e!==r&&(e=new yn("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),e}var Za,Wa,Ya=function(){if(Wa)return Za;Wa=1,Za=e;var t=3;function e(e,r,n){var i=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;var s=new Int32Array(this.arrayBuffer);e=s[0],this.d=(r=s[1])+2*(n=s[2]);for(var a=0;a<this.d*this.d;a++){var o=s[t+a],l=s[t+a+1];i.push(o===l?null:s.subarray(o,l))}var u=s[t+i.length+1];this.keys=s.subarray(s[t+i.length],u),this.bboxes=s.subarray(u),this.insert=this._insertReadonly}else{this.d=r+2*n;for(var c=0;c<this.d*this.d;c++)i.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=e,this.padding=n,this.scale=r/e,this.uid=0;var h=n/r*e;this.min=-h,this.max=e+h}return e.prototype.insert=function(t,e,r,n,i){this._forEachCell(e,r,n,i,this._insertCell,this.uid++),this.keys.push(t),this.bboxes.push(e),this.bboxes.push(r),this.bboxes.push(n),this.bboxes.push(i)},e.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},e.prototype._insertCell=function(t,e,r,n,i,s){this.cells[i].push(s)},e.prototype.query=function(t,e,r,n,i){var s=this.min,a=this.max;if(t<=s&&e<=s&&a<=r&&a<=n&&!i)return Array.prototype.slice.call(this.keys);var o=[];return this._forEachCell(t,e,r,n,this._queryCell,o,{},i),o},e.prototype._queryCell=function(t,e,r,n,i,s,a,o){var l=this.cells[i];if(null!==l)for(var u=this.keys,c=this.bboxes,h=0;h<l.length;h++){var p=l[h];if(void 0===a[p]){var d=4*p;(o?o(c[d+0],c[d+1],c[d+2],c[d+3]):t<=c[d+2]&&e<=c[d+3]&&r>=c[d+0]&&n>=c[d+1])?(a[p]=!0,s.push(u[p])):a[p]=!1}}},e.prototype._forEachCell=function(t,e,r,n,i,s,a,o){for(var l=this._convertToCellCoord(t),u=this._convertToCellCoord(e),c=this._convertToCellCoord(r),h=this._convertToCellCoord(n),p=l;p<=c;p++)for(var d=u;d<=h;d++){var f=this.d*d+p;if((!o||o(this._convertFromCellCoord(p),this._convertFromCellCoord(d),this._convertFromCellCoord(p+1),this._convertFromCellCoord(d+1)))&&i.call(this,t,e,r,n,f,s,a,o))return}},e.prototype._convertFromCellCoord=function(t){return(t-this.padding)/this.scale},e.prototype._convertToCellCoord=function(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))},e.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var e=this.cells,r=t+this.cells.length+1+1,n=0,i=0;i<this.cells.length;i++)n+=this.cells[i].length;var s=new Int32Array(r+n+this.keys.length+this.bboxes.length);s[0]=this.extent,s[1]=this.n,s[2]=this.padding;for(var a=r,o=0;o<e.length;o++){var l=e[o];s[t+o]=a,s.set(l,a),a+=l.length}return s[t+e.length]=a,s.set(this.keys,a),s[t+e.length+1]=a+=this.keys.length,s.set(this.bboxes,a),a+=this.bboxes.length,s.buffer},Za}();const Ka=Ut(Ya),Ja={};function Qa(t,e,r={}){Object.defineProperty(t,"_classRegistryKey",{value:e,writable:!1}),Ja[e]={klass:t,omit:r.omit||[]}}Qa(Object,"Object"),Ka.serialize=function(t,e){const r=t.toArrayBuffer();return e&&e.add(r),{buffer:r}},Ka.deserialize=function(t){return new Ka(t.buffer)},Object.defineProperty(Ka,"name",{value:"Grid"}),Qa(Ka,"Grid"),delete $t.prototype.constructor,Qa(un,"Color"),Qa(Error,"Error"),Qa(Rn,"Formatted"),Qa(Dn,"FormattedSection"),Qa(Er,"AJAXError"),Qa(On,"ResolvedImage"),Qa(Ha,"StylePropertyFunction"),Qa(Ua,"StyleExpression",{omit:["_evaluator"]}),Qa(sn,"ImageId"),Qa(Ln,"ImageVariant"),Qa(Ga,"ZoomDependentExpression"),Qa($a,"ZoomConstantExpression"),Qa(si,"CompoundExpression",{omit:["_evaluate"]});for(const t in ga)Ja[ga[t]._classRegistryKey]||Qa(ga[t],`Expression${t}`);function to(t){return t&&(t instanceof ArrayBuffer||t.constructor&&"ArrayBuffer"===t.constructor.name)}function eo(t,e){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp)return t;if(to(t)||t instanceof ImageBitmap)return e&&e.add(t),t;if(ArrayBuffer.isView(t))return e&&e.add(t.buffer),t;if(t instanceof ImageData)return e&&e.add(t.data.buffer),t;if(Array.isArray(t)){const r=[];for(const n of t)r.push(eo(n,e));return r}if(t instanceof Map){const r={$name:"Map",entries:[]};for(const[n,i]of t.entries())r.entries.push(eo(n),eo(i,e));return r}if(t instanceof Set){const e={$name:"Set"};let r=0;for(const n of t.values())e[++r]=eo(n);return e}if("bigint"==typeof t)return{$name:"BigInt",value:t.toString()};if("object"==typeof t){const r=t.constructor,n=r._classRegistryKey;if(!n)throw new Error(`Can't serialize object of unregistered class "${r.name}".`);const i=r.serialize?r.serialize(t,e):{};if(!r.serialize){for(const r in t)t.hasOwnProperty(r)&&(Ja[n].omit.indexOf(r)>=0||(i[r]=eo(t[r],e)));t instanceof Error&&(i.message=t.message)}if(i.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==n&&(i.$name=n),i}throw new Error("can't serialize object of type "+typeof t)}function ro(t){if(null==t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||to(t)||t instanceof ImageBitmap||ArrayBuffer.isView(t)||t instanceof ImageData)return t;if(Array.isArray(t))return t.map(ro);if("object"==typeof t){const e=t.$name||"Object";if("Map"===e){const e=t.entries||[],r=new Map;for(let t=0;t<e.length;t+=2)r.set(ro(e[t]),ro(e[t+1]));return r}if("Set"===e){const e=new Set;for(const r of Object.keys(t))"$name"!==r&&e.add(ro(t[r]));return e}if("BigInt"===e)return BigInt(t.value);const{klass:r}=Ja[e];if(!r)throw new Error(`Can't deserialize unregistered class "${e}".`);if(r.deserialize)return r.deserialize(t);const n=Object.create(r.prototype);for(const e of Object.keys(t))"$name"!==e&&(n[e]=ro(t[e]));return n}throw new Error("can't deserialize object of type "+typeof t)}const no={"Latin-1 Supplement":t=>t>=128&&t<=255,Arabic:t=>t>=1536&&t<=1791,"Arabic Supplement":t=>t>=1872&&t<=1919,"Arabic Extended-A":t=>t>=2208&&t<=2303,"Hangul Jamo":t=>t>=4352&&t<=4607,"Unified Canadian Aboriginal Syllabics":t=>t>=5120&&t<=5759,Khmer:t=>t>=6016&&t<=6143,"Unified Canadian Aboriginal Syllabics Extended":t=>t>=6320&&t<=6399,"General Punctuation":t=>t>=8192&&t<=8303,"Letterlike Symbols":t=>t>=8448&&t<=8527,"Number Forms":t=>t>=8528&&t<=8591,"Miscellaneous Technical":t=>t>=8960&&t<=9215,"Control Pictures":t=>t>=9216&&t<=9279,"Optical Character Recognition":t=>t>=9280&&t<=9311,"Enclosed Alphanumerics":t=>t>=9312&&t<=9471,"Geometric Shapes":t=>t>=9632&&t<=9727,"Miscellaneous Symbols":t=>t>=9728&&t<=9983,"Miscellaneous Symbols and Arrows":t=>t>=11008&&t<=11263,"CJK Radicals Supplement":t=>t>=11904&&t<=12031,"Kangxi Radicals":t=>t>=12032&&t<=12255,"Ideographic Description Characters":t=>t>=12272&&t<=12287,"CJK Symbols and Punctuation":t=>t>=12288&&t<=12351,Hiragana:t=>t>=12352&&t<=12447,Katakana:t=>t>=12448&&t<=12543,Bopomofo:t=>t>=12544&&t<=12591,"Hangul Compatibility Jamo":t=>t>=12592&&t<=12687,Kanbun:t=>t>=12688&&t<=12703,"Bopomofo Extended":t=>t>=12704&&t<=12735,"CJK Strokes":t=>t>=12736&&t<=12783,"Katakana Phonetic Extensions":t=>t>=12784&&t<=12799,"Enclosed CJK Letters and Months":t=>t>=12800&&t<=13055,"CJK Compatibility":t=>t>=13056&&t<=13311,"CJK Unified Ideographs Extension A":t=>t>=13312&&t<=19903,"Yijing Hexagram Symbols":t=>t>=19904&&t<=19967,"CJK Unified Ideographs":t=>t>=19968&&t<=40959,"Yi Syllables":t=>t>=40960&&t<=42127,"Yi Radicals":t=>t>=42128&&t<=42191,"Hangul Jamo Extended-A":t=>t>=43360&&t<=43391,"Hangul Syllables":t=>t>=44032&&t<=55215,"Hangul Jamo Extended-B":t=>t>=55216&&t<=55295,"Private Use Area":t=>t>=57344&&t<=63743,"CJK Compatibility Ideographs":t=>t>=63744&&t<=64255,"Arabic Presentation Forms-A":t=>t>=64336&&t<=65023,"Vertical Forms":t=>t>=65040&&t<=65055,"CJK Compatibility Forms":t=>t>=65072&&t<=65103,"Small Form Variants":t=>t>=65104&&t<=65135,"Arabic Presentation Forms-B":t=>t>=65136&&t<=65279,"Halfwidth and Fullwidth Forms":t=>t>=65280&&t<=65519,Osage:t=>t>=66736&&t<=66815,"CJK Unified Ideographs Extension B":t=>t>=131072&&t<=173791};function io(t){for(const e of t)if(oo(e.charCodeAt(0)))return!0;return!1}function so(t){for(const e of t)if(!ao(e.charCodeAt(0)))return!1;return!0}function ao(t){return!(no.Arabic(t)||no["Arabic Supplement"](t)||no["Arabic Extended-A"](t)||no["Arabic Presentation Forms-A"](t)||no["Arabic Presentation Forms-B"](t))}function oo(t){return!(746!==t&&747!==t&&(t<4352||!(no["Bopomofo Extended"](t)||no.Bopomofo(t)||no["CJK Compatibility Forms"](t)&&!(t>=65097&&t<=65103)||no["CJK Compatibility Ideographs"](t)||no["CJK Compatibility"](t)||no["CJK Radicals Supplement"](t)||no["CJK Strokes"](t)||!(!no["CJK Symbols and Punctuation"](t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||no["CJK Unified Ideographs Extension A"](t)||no["CJK Unified Ideographs"](t)||no["Enclosed CJK Letters and Months"](t)||no["Hangul Compatibility Jamo"](t)||no["Hangul Jamo Extended-A"](t)||no["Hangul Jamo Extended-B"](t)||no["Hangul Jamo"](t)||no["Hangul Syllables"](t)||no.Hiragana(t)||no["Ideographic Description Characters"](t)||no.Kanbun(t)||no["Kangxi Radicals"](t)||no["Katakana Phonetic Extensions"](t)||no.Katakana(t)&&12540!==t||!(!no["Halfwidth and Fullwidth Forms"](t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||!(!no["Small Form Variants"](t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||no["Unified Canadian Aboriginal Syllabics"](t)||no["Unified Canadian Aboriginal Syllabics Extended"](t)||no["Vertical Forms"](t)||no["Yijing Hexagram Symbols"](t)||no["Yi Syllables"](t)||no["Yi Radicals"](t))))}function lo(t){return!(oo(t)||function(t){return!!(no["Latin-1 Supplement"](t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||no["General Punctuation"](t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||no["Letterlike Symbols"](t)||no["Number Forms"](t)||no["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||no["Control Pictures"](t)&&9251!==t||no["Optical Character Recognition"](t)||no["Enclosed Alphanumerics"](t)||no["Geometric Shapes"](t)||no["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||no["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||no["CJK Symbols and Punctuation"](t)||no.Katakana(t)||no["Private Use Area"](t)||no["CJK Compatibility Forms"](t)||no["Small Form Variants"](t)||no["Halfwidth and Fullwidth Forms"](t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)}(t))}function uo(t){return no.Arabic(t)||no["Arabic Supplement"](t)||no["Arabic Extended-A"](t)||no["Arabic Presentation Forms-A"](t)||no["Arabic Presentation Forms-B"](t)}function co(t){return t>=1424&&t<=2303||no["Arabic Presentation Forms-A"](t)||no["Arabic Presentation Forms-B"](t)}function ho(t,e){return!(!e&&co(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||no.Khmer(t))}function po(t){for(const e of t)if(co(e.charCodeAt(0)))return!0;return!1}const fo={unavailable:"unavailable",deferred:"deferred",loading:"loading",parsing:"parsing",parsed:"parsed",loaded:"loaded",error:"error"};let mo=null,yo=fo.unavailable,go=null;const xo=function(t){t&&"string"==typeof t&&t.indexOf("NetworkError")>-1&&(yo=fo.error),mo&&mo(t)};function vo(){bo.fire(new Qr("pluginStateChange",{pluginStatus:yo,pluginURL:go}))}const bo=new nn,wo=function(){return yo},_o=function(t){return t({pluginStatus:yo,pluginURL:go}),bo.on("pluginStateChange",t),t},Ao=function(t,e,r=!1){if(yo===fo.deferred||yo===fo.loading||yo===fo.loaded)throw new Error("setRTLTextPlugin cannot be called multiple times.");go=lr.resolveURL(t),yo=fo.deferred,mo=e,vo(),r||Io()},Io=function(){if(yo!==fo.deferred||!go)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");yo=fo.loading,vo(),go&&Dr({url:go},(t=>{t?xo(t):(yo=fo.loaded,vo())}))},Mo={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>yo===fo.loaded||null!=Mo.applyArabicShaping,isLoading:()=>yo===fo.loading,setState(t){yo=t.pluginStatus,go=t.pluginURL},isParsing:()=>yo===fo.parsing,isParsed:()=>yo===fo.parsed,getPluginURL:()=>go},So=function(){Mo.isLoading()||Mo.isLoaded()||"deferred"!==wo()||Io()};class Po{constructor(t,e){this.zoom=t,e?(this.now=e.now,this.fadeDuration=e.fadeDuration,this.transition=e.transition,this.pitch=e.pitch,this.brightness=e.brightness,this.worldview=e.worldview,this.activeFloors=e.activeFloors):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0,this.brightness=0)}isSupportedScript(t){return function(t,e){for(const r of t)if(!ho(r.charCodeAt(0),e))return!1;return!0}(t,Mo.isLoaded())}}class ko{constructor(t,e,r,n,i){this.property=t,this.value=e,this.expression=function(t,e,r,n,i){if(Ea(t))return new Ha(t,e);if(Na(t)||Array.isArray(t)&&t.length>0){const s=qa(t,e,r,n,i);if("error"===s.result)throw new Error(s.value.map((t=>`${t.key}: ${t.message}`)).join(", "));return s.value}{let r=t;return"string"==typeof t&&"color"===e.type&&(r=un.parse(t)),{kind:"constant",configDependencies:new Set,isIndoorDependent:!1,evaluate:()=>r}}}(void 0===e?t.specification.default:e,t.specification,r,n,i)}isIndoorDependent(){return this.expression.isIndoorDependent}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(t,e,r,n){return this.property.possiblyEvaluate(this,t,e,r,n)}}class Bo{constructor(t,e,r,n){this.property=t,this.value=new ko(t,void 0,e,r,n)}transitioned(t,e){return new To(this.property,this.value,e,Object.assign({},t.transition,this.transition),t.now)}untransitioned(){return new To(this.property,this.value,null,{},0)}}class zo{constructor(t,e,r,n){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues),this._scope=e,this._options=r,this._iconImageUseTheme=n,this._isIndoorDependent=!1,this.configDependencies=new Set}getValue(t){return ve(this._values[t].value.value)}setValue(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new Bo(this._values[t].property,this._scope,this._options,this._iconImageUseTheme)),this._values[t].value=new ko(this._values[t].property,null===e?void 0:ve(e),this._scope,this._options,this._iconImageUseTheme),this._values[t].value.expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[t].value.expression.configDependencies]),this._isIndoorDependent=this._isIndoorDependent||this._values[t].value.isIndoorDependent())}setTransitionOrValue(t,e){e&&(this._options=e);const r=this._properties.properties;if(t)for(const e in t){const n=t[e];if(e.endsWith("-transition")){const t=e.slice(0,-11);r[t]&&this.setTransition(t,n)}else r.hasOwnProperty(e)&&this.setValue(e,n)}}getTransition(t){return ve(this._values[t].transition)}setTransition(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new Bo(this._values[t].property)),this._values[t].transition=ve(e)||void 0}serialize(){const t={};for(const e of Object.keys(this._values)){const r=this.getValue(e);void 0!==r&&(t[e]=r);const n=this.getTransition(e);void 0!==n&&(t[`${e}-transition`]=n)}return t}transitioned(t,e){const r=new Eo(this._properties);for(const n of Object.keys(this._values))r._values[n]=this._values[n].transitioned(t,e._values[n]);return r}untransitioned(){const t=new Eo(this._properties);for(const e of Object.keys(this._values))t._values[e]=this._values[e].untransitioned();return t}isIndoorDependent(){return this._isIndoorDependent}}class To{constructor(t,e,r,n,i){const s=n.delay||0,a=n.duration||0;i=i||0,this.property=t,this.value=e,this.begin=i+s,this.end=this.begin+a,t.specification.transition&&(n.delay||n.duration)&&(this.prior=r)}possiblyEvaluate(t,e,r){const n=t.now||0,i=this.value.possiblyEvaluate(t,e,r),s=this.prior;if(s){if(n>this.end)return this.prior=null,i;if(this.value.isDataDriven())return this.prior=null,i;if(n<this.begin)return s.possiblyEvaluate(t,e,r);{const a=(n-this.begin)/(this.end-this.begin);return this.property.interpolate(s.possiblyEvaluate(t,e,r),i,Kt(a))}}return i}}class Eo{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,e,r){const n=new Co(this._properties);for(const i of Object.keys(this._values))n._values[i]=this._values[i].possiblyEvaluate(t,e,r);return n}hasTransition(){for(const t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class Vo{constructor(t,e,r,n){this._properties=t,this._values=Object.create(t.defaultPropertyValues),this._scope=e,this._options=r,this._iconImageUseTheme=n,this._isIndoorDependent=!1,this.configDependencies=new Set}getValue(t){return ve(this._values[t].value)}setValue(t,e){this._values[t]=new ko(this._values[t].property,null===e?void 0:ve(e),this._scope,this._options,this._iconImageUseTheme),this._values[t].expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[t].expression.configDependencies]),this._isIndoorDependent=this._isIndoorDependent||this._values[t].isIndoorDependent())}serialize(){const t={};for(const e of Object.keys(this._values)){const r=this.getValue(e);void 0!==r&&(t[e]=r)}return t}possiblyEvaluate(t,e,r,n){const i=new Co(this._properties);for(const s of Object.keys(this._values))i._values[s]=this._values[s].possiblyEvaluate(t,e,r,n);return i}isIndoorDependent(){return this._isIndoorDependent}}class Fo{constructor(t,e,r,n){this.property=t,this.value=e,this.parameters=r,this.iconImageUseTheme=n}isConstant(){return"constant"===this.value.kind}constantOr(t){return"constant"===this.value.kind?this.value.value:t}evaluate(t,e,r,n){return this.property.evaluate(this.value,this.parameters,t,e,r,n,this.iconImageUseTheme)}}class Co{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class Do{constructor(t){this.specification=t}possiblyEvaluate(t,e){return t.expression.evaluate(e)}interpolate(t,e,r){const n=mn[this.specification.type];return n?n(t,e,r):t}}class Ro{constructor(t,e){this.specification=t,this.overrides=e}possiblyEvaluate(t,e,r,n,i){return"constant"===t.expression.kind||"camera"===t.expression.kind?new Fo(this,{kind:"constant",value:t.expression.evaluate(e,null,{},r,n,void 0,i)},e):new Fo(this,t.expression,e,i)}interpolate(t,e,r){if("constant"!==t.value.kind||"constant"!==e.value.kind)return t;if(void 0===t.value.value||void 0===e.value.value)return new Fo(this,{kind:"constant",value:void 0},t.parameters);const n=mn[this.specification.type];return n?new Fo(this,{kind:"constant",value:n(t.value.value,e.value.value,r)},t.parameters):t}evaluate(t,e,r,n,i,s,a){return"constant"===t.kind?t.value:t.evaluate(e,r,n,i,s,void 0,a)}}class Lo{constructor(t){this.specification=t}possiblyEvaluate(t,e,r,n){return!!t.expression.evaluate(e,null,{},r,n)}interpolate(){return!1}}class Oo{constructor(t){this.specification=t}possiblyEvaluate(t,e){return function([t,e]){const r=Se([1,t,e]);return{x:r.x,y:r.y,z:r.z}}(t.expression.evaluate(e))}interpolate(t,e,r){return{x:dn(t.x,e.x,r),y:dn(t.y,e.y,r),z:dn(t.z,e.z,r)}}}class Uo{constructor(t){this.specification=t}possiblyEvaluate(t,e){return Se(t.expression.evaluate(e))}interpolate(t,e,r){return{x:dn(t.x,e.x,r),y:dn(t.y,e.y,r),z:dn(t.z,e.z,r),azimuthal:dn(t.azimuthal,e.azimuthal,r),polar:dn(t.polar,e.polar,r)}}}class No{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];const e=new Po(0,{});for(const r in t){const n=t[r];n.specification.overridable&&this.overridableProperties.push(r);const i=this.defaultPropertyValues[r]=new ko(n,void 0),s=this.defaultTransitionablePropertyValues[r]=new Bo(n);this.defaultTransitioningPropertyValues[r]=s.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=i.possiblyEvaluate(e)}}}Qa(Ro,"DataDrivenProperty"),Qa(Do,"DataConstantProperty"),Qa(Lo,"ColorRampProperty");const jo=JSON.parse('{"$version":8,"$root":{"version":{"type":"enum","values":[8]},"fragment":{"type":"boolean"},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360},"pitch":{"type":"number","default":0},"light":{"type":"light"},"lights":{"type":"array","value":"light-3d"},"terrain":{"type":"terrain","optional":true},"fog":{"type":"fog"},"snow":{"type":"snow"},"rain":{"type":"rain"},"camera":{"type":"camera"},"color-theme":{"type":"colorTheme"},"indoor":{"type":"indoor"},"imports":{"type":"array","value":"import"},"iconsets":{"type":"iconsets"},"schema":{"type":"schema"},"sources":{"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string","default":"mapbox://fonts/mapbox/{fontstack}/{range}.pbf"},"transition":{"type":"transition"},"projection":{"type":"projection"},"layers":{"type":"array","value":"layer"},"models":{"type":"models"},"featuresets":{"type":"featuresets"}},"featuresets":{"*":{"type":"featureset"}},"featureset":{"metadata":{"type":"*"},"selectors":{"type":"array","value":"selector"}},"selector":{"layer":{"type":"string"},"properties":{"type":"selectorProperty"},"featureNamespace":{"type":"string"},"_uniqueFeatureID":{"type":"boolean"}},"selectorProperty":{"*":{"type":"*"}},"model":{"type":"string"},"import":{"id":{"type":"string"},"url":{"type":"string"},"config":{"type":"config"},"data":{"type":"$root"},"color-theme":{"type":"colorTheme","optional":true}},"config":{"*":{"type":"*"}},"schema":{"*":{"type":"option"}},"option":{"default":{"type":"*","expression":{}},"type":{"type":"enum","values":{"string":1,"number":1,"boolean":1,"color":1}},"array":{"type":"boolean"},"minValue":{"type":"number"},"maxValue":{"type":"number"},"stepValue":{"type":"number"},"values":{"type":"array","value":"*"},"metadata":{"type":"*"}},"models":{"*":{"type":"model"}},"light-3d":{"id":{"type":"string"},"properties":{"type":"properties"},"type":{"type":"enum","values":{"ambient":{},"directional":{},"flat":{}}}},"properties":["properties_light_directional","properties_light_ambient","properties_light_flat"],"properties_light_directional":{"direction":{"type":"array","default":[210,30],"minimum":[0,0],"maximum":[360,90],"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"cast-shadows":{"type":"boolean","default":false},"shadow-quality":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"parameters":["zoom"]}},"shadow-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"properties_light_ambient":{"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"properties_light_flat":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"iconsets":{"*":{"type":"iconset"}},"iconset":["iconset_sprite","iconset_source"],"iconset_sprite":{"type":{"type":"enum","values":{"sprite":1}},"url":{"type":"string"}},"iconset_source":{"type":{"type":"enum","values":{"source":1}},"source":{"type":"string"}},"sources":{"*":{"type":"source"}},"source":["source_vector","source_raster","source_raster_dem","source_raster_array","source_geojson","source_video","source_image","source_model"],"source_vector":{"type":{"type":"enum","values":{"vector":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"attribution":{"type":"string"},"promoteId":{"type":"promoteId"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster":{"type":{"type":"enum","values":{"raster":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"attribution":{"type":"string"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"type":"enum","values":{"raster-dem":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"encoding":{"type":"enum","values":{"terrarium":1,"mapbox":1},"default":"mapbox"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_array":{"type":{"type":"enum","values":{"raster-array":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"rasterLayers":{"type":"*"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_geojson":{"type":{"type":"enum","values":{"geojson":1}},"data":{"type":"*"},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"attribution":{"type":"string"},"buffer":{"type":"number","default":128,"maximum":512,"minimum":0},"filter":{"type":"*"},"tolerance":{"type":"number","default":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0},"clusterMaxZoom":{"type":"number"},"clusterMinPoints":{"type":"number"},"clusterProperties":{"type":"*"},"lineMetrics":{"type":"boolean","default":false},"generateId":{"type":"boolean","default":false},"promoteId":{"type":"promoteId"},"dynamic":{"type":"boolean","default":false}},"source_video":{"type":{"type":"enum","values":{"video":1}},"urls":{"type":"array","value":"string"},"coordinates":{"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"type":"enum","values":{"image":1}},"url":{"type":"string"},"coordinates":{"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"modelNodeOverride":{"orientation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360}},"modelNodeOverrides":{"*":{"type":"modelNodeOverride"}},"modelMaterialOverride":{"model-color":{"type":"color"},"model-color-mix-intensity":{"type":"number"},"model-opacity":{"type":"number"},"model-emissive-strength":{"type":"number"}},"modelMaterialOverrides":{"*":{"type":"modelMaterialOverride"}},"modelSourceModel":{"uri":{"type":"string"},"position":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[-180,-90],"maximum":[180,90]},"orientation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360},"nodeOverrides":{"type":"modelNodeOverrides"},"materialOverrides":{"type":"modelMaterialOverrides"},"nodeOverrideNames":{"type":"array","value":"string"},"materialOverrideNames":{"type":"array","value":"string"},"featureProperties":{"type":"*"}},"modelSourceModels":{"*":{"type":"modelSourceModel"}},"source_model":{"type":{"type":"enum","values":{"model":1,"batched-model":1}},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"tiles":{"type":"array","value":"string"},"models":{"type":"modelSourceModels"}},"layer":{"id":{"type":"string"},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"building":{},"raster":{},"raster-particle":{},"hillshade":{},"model":{},"background":{},"sky":{},"slot":{},"clip":{}}},"metadata":{"type":"*"},"source":{"type":"string"},"source-layer":{"type":"string"},"slot":{"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"},"appearances":{"type":"array","value":"appearance","supported-layer-types":["symbol"]}},"appearance":{"condition":{"type":"boolean","expression":{"interpolated":true,"parameters":["zoom","pitch","feature","feature-state","measure-light","distance-from-center"]},"property-type":"data-driven"},"name":{"type":"string"},"properties":{"type":"*"}},"layout":["layout_clip","layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_building","layout_symbol","layout_raster","layout_raster-particle","layout_hillshade","layout_background","layout_sky","layout_model"],"layout_background":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_sky":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_model":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"model-id":{"type":"string","default":"","property-type":"data-driven","expression":{"parameters":["zoom","feature"]}}},"layout_clip":{"clip-layer-types":{"type":"array","value":"enum","values":{"model":1,"symbol":1},"default":[],"expression":{}},"clip-layer-scope":{"type":"array","value":"string","default":[],"expression":{}}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"fill-elevation-reference":{"type":"enum","values":{"none":1,"hd-road-base":1,"hd-road-markup":1},"default":"none","expression":{}},"fill-construct-bridge-guard-rail":{"type":"boolean","default":"true","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"}},"layout_circle":{"circle-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"circle-elevation-reference":{"type":"enum","values":{"none":1,"hd-road-markup":1},"default":"none","expression":{}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_heatmap":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_fill-extrusion":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"fill-extrusion-edge-radius":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}}},"layout_building":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"building-facade":{"type":"boolean","default":false,"expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-facade-floors":{"type":"number","minimum":1,"maximum":200,"default":3,"property-type":"data-driven","expression":{"parameters":["feature"]}},"building-facade-unit-width":{"type":"number","minimum":1,"maximum":20,"default":3.1,"property-type":"data-driven","expression":{"parameters":["feature"]}},"building-facade-window":{"type":"array","length":2,"value":"number","minimum":0.1,"maximum":1,"default":[0.9,0.9],"property-type":"data-driven","expression":{"parameters":["feature"]}},"building-roof-shape":{"type":"enum","values":{"flat":1,"hipped":1,"gabled":1,"parapet":1,"mansard":1,"skillion":1,"pyramidal":1},"default":"flat","expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{},"property-type":"data-driven"},"building-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{},"property-type":"data-driven"},"building-flood-light-wall-radius":{"property-type":"data-driven","type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"building-flood-light-ground-radius":{"property-type":"data-driven","type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"building-flip-roof-orientation":{"property-type":"data-driven","type":"boolean","default":false,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}}},"layout_line":{"line-cap":{"type":"enum","values":{"butt":1,"round":1,"square":1},"default":"butt","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-join":{"type":"enum","values":{"bevel":1,"round":1,"miter":1,"none":1},"default":"miter","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-round-limit":{"type":"number","default":1.05,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-z-offset":{"type":"number","default":0,"expression":{"parameters":["zoom","feature","line-progress"]},"property-type":"data-driven"},"line-elevation-reference":{"type":"enum","values":{"none":1,"sea":1,"ground":1,"hd-road-markup":1},"default":"none","expression":{}},"line-cross-slope":{"type":"number","expression":{}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"line-width-unit":{"type":"enum","values":{"pixels":1,"meters":1},"default":"pixels","expression":{"parameters":["zoom"]}}},"layout_symbol":{"symbol-placement":{"type":"enum","values":{"point":1,"line":1,"line-center":1},"default":"point","expression":{"parameters":["zoom"]}},"symbol-spacing":{"type":"number","default":250,"minimum":1,"expression":{"interpolated":true,"parameters":["zoom"]}},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"symbol-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","values":{"auto":1,"viewport-y":1,"source":1},"default":"auto","expression":{"parameters":["zoom"]}},"symbol-z-elevate":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"symbol-elevation-reference":{"type":"enum","values":{"sea":1,"ground":1,"hd-road-markup":1},"default":"ground","expression":{"parameters":["zoom"]}},"icon-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"icon-size":{"type":"number","default":1,"minimum":0,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-size-scale-range":{"type":"array","value":"number","length":2,"default":[0.8,2],"minimum":[0.1,0.1],"maximum":[10,10],"expression":{}},"icon-text-fit":{"type":"enum","values":{"none":1,"width":1,"height":1,"both":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit-padding":{"type":"array","value":"number","length":4,"default":[0,0,0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-image":{"type":"resolvedImage","tokens":true,"appearance":true,"use-theme":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{"type":"number","default":0,"period":360,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"icon-keep-upright":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-field":{"type":"formatted","default":"","tokens":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-font":{"type":"array","value":"string","default":["Open Sans Regular","Arial Unicode MS Regular"],"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size-scale-range":{"type":"array","value":"number","length":2,"default":[0.8,2],"minimum":[0.1,0.1],"maximum":[10,10],"expression":{}},"text-max-width":{"type":"number","default":10,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-justify":{"type":"enum","values":{"auto":1,"left":1,"center":1,"right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{"type":"number","default":0,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["zoom","feature"]}},"text-variable-anchor":{"type":"array","value":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"expression":{"parameters":["zoom"]}},"text-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{"type":"number","default":45,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":1,"vertical":1},"expression":{"parameters":["zoom"]}},"text-rotate":{"type":"number","default":0,"period":360,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-keep-upright":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"text-transform":{"type":"enum","values":{"none":1,"uppercase":1,"lowercase":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-offset":{"type":"array","value":"number","length":2,"default":[0,0],"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"text-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"text-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_raster":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_raster-particle":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_hillshade":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"filter":{"type":"array","value":"*"},"filter_symbol":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature","pitch","distance-from-center"]}},"filter_fill":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_hillshade":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_raster":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_raster-particle":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_clip":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_model":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_line":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_circle":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_fill-extrusion":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_building":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_heatmap":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_operator":{"type":"enum","values":{"==":1,"!=":1,">":1,">=":1,"<":1,"<=":1,"in":1,"!in":1,"all":1,"any":1,"none":1,"has":1,"!has":1}},"geometry_type":{"type":"enum","values":{"Point":1,"LineString":1,"Polygon":1}},"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":1,"exponential":1,"interval":1,"categorical":1},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":1,"lab":1,"hcl":1},"default":"rgb"},"default":{"type":"*"}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"high-color":{"type":"color","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"space-color":{"type":"color","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"horizon-blend":{"type":"number","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"star-intensity":{"type":"number","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vertical-range":{"type":"array","default":[0,0],"minimum":0,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}}},"snow":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.85],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.3],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"center-thinning":{"type":"number","default":0.4,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,50],"minimum":0,"maximum":360,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"flake-size":{"type":"number","default":0.71,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"rain":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.5],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#03113d",0.3,"#a8adbc"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"opacity":{"type":"number","default":["interpolate",["linear"],["measure-light","brightness"],0,0.88,1,0.7],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#001736",0.3,"#464646"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"center-thinning":{"type":"number","default":0.57,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,80],"minimum":0,"maximum":360,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"droplet-size":{"type":"array","default":[2.6,18.2],"minimum":0,"maximum":50,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"distortion-strength":{"type":"number","default":0.7,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"camera":{"camera-projection":{"type":"enum","values":{"perspective":1,"orthographic":1},"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"default":"perspective"}},"colorTheme":{"data":{"type":"string","expression":{}}},"indoor_source":{"sourceId":{"type":"string"},"sourceLayers":{"type":"array","value":"string"}},"indoor":{"*":{"type":"indoor_source"}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":1,"equalEarth":1,"equirectangular":1,"lambertConformalConic":1,"mercator":1,"naturalEarth":1,"winkelTripel":1,"globe":1},"default":"mercator"},"center":{"type":"array","length":2,"value":"number","minimum":[-180,-90],"maximum":[180,90]},"parallels":{"type":"array","length":2,"value":"number","minimum":[-90,-90],"maximum":[90,90]}},"terrain":{"source":{"type":"string"},"exaggeration":{"type":"number","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_building","paint_symbol","paint_raster","paint_raster-particle","paint_hillshade","paint_background","paint_sky","paint_model"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"fill-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-bridge-guard-rail-color":{"type":"color","default":"rgba(241, 236, 225, 255)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"},"fill-tunnel-structure-color":{"type":"color","default":"rgba(241, 236, 225, 255)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"fill-extrusion-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-height-alignment":{"type":"enum","values":{"terrain":1,"flat":1},"default":"flat"},"fill-extrusion-base-alignment":{"type":"enum","values":{"terrain":1,"flat":1},"default":"terrain"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-wall-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-flood-light-color":{"type":"color","default":"#ffffff","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-wall-radius":{"property-type":"data-driven","type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-radius":{"property-type":"data-driven","type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-vertical-scale":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-rounded-roof":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"fill-extrusion-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"fill-extrusion-line-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-cast-shadows":{"type":"boolean","default":true}},"paint_building":{"building-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"parameters":[]},"transition":true},"building-ambient-occlusion-ground-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"building-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"building-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-vertical-scale":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-cast-shadows":{"type":"boolean","default":true},"building-color":{"type":"color","default":"rgba(193, 154, 127, 1)","use-theme":true,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"property-type":"data-driven"},"building-emissive-strength":{"type":"number","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"property-type":"data-driven"},"building-facade-emissive-chance":{"type":"number","default":0.35,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["measure-light","zoom"]}},"building-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"building-flood-light-color":{"type":"color","default":"#ffffff","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"building-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"building-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light","line-progress"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-gradient":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["line-progress"]}},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1]},"line-trim-fade-range":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-trim-color":{"type":"color","default":"transparent","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-driven"},"line-border-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-border-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"circle-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"circle-pitch-scale":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"circle-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]}},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"use-theme":true,"expression":{"interpolated":true,"parameters":["heatmap-density"]}},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"text-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"icon-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"icon-image-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"overridable":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"icon-color-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{}},"icon-color-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{}},"icon-color-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"icon-color-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{}},"symbol-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["raster-value"]}},"raster-color-mix":{"type":"array","default":[0.2126,0.7152,0.0722,0],"length":4,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color-range":{"type":"array","length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-resampling":{"type":"enum","values":{"linear":1,"nearest":1},"default":"linear","expression":{"parameters":["zoom"]}},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"raster-array-band":{"type":"string"},"raster-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_raster-particle":{"raster-particle-array-band":{"type":"string"},"raster-particle-count":{"type":"number","default":512,"minimum":1},"raster-particle-color":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["raster-particle-speed"]}},"raster-particle-max-speed":{"type":"number","default":1,"minimum":1},"raster-particle-speed-factor":{"type":"number","default":0.2,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-particle-fade-opacity-factor":{"type":"number","default":0.98,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-particle-reset-rate-factor":{"type":"number","default":0.8,"minimum":0,"maximum":1},"raster-particle-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"expression":{"interpolated":true,"parameters":["zoom"]}},"hillshade-illumination-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]}},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"hillshade-shadow-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-accent-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_background":{"background-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":[]}},"background-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"background-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom"]}},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"background-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":1,"atmosphere":1},"default":"atmosphere","expression":{"parameters":["zoom"]}},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]}},"sky-atmosphere-sun-intensity":{"type":"number","default":10,"minimum":0,"maximum":100},"sky-gradient-center":{"type":"array","value":"number","default":[0,0],"length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]}},"sky-gradient-radius":{"type":"number","default":90,"minimum":0,"maximum":180,"expression":{"parameters":["zoom"]}},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"use-theme":true,"expression":{"interpolated":true,"parameters":["sky-radial-progress"]}},"sky-atmosphere-halo-color":{"type":"color","default":"white","use-theme":true},"sky-atmosphere-color":{"type":"color","default":"white","use-theme":true},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_model":{"model-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"property-type":"data-driven"},"model-rotation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-scale":{"type":"array","value":"number","length":3,"default":[1,1,1],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-translation":{"type":"array","value":"number","length":3,"default":[0,0,0],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-color":{"type":"color","default":"#ffffff","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light","zoom"]},"use-theme":true,"transition":true},"model-color-mix-intensity":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-type":{"type":"enum","values":{"common-3d":1,"location-indicator":1},"default":"common-3d"},"model-cast-shadows":{"type":"boolean","default":true},"model-receive-shadows":{"type":"boolean","default":true},"model-ambient-occlusion-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"model-emissive-strength":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-roughness":{"type":"number","default":1,"minimum":0,"maximum":1,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state"]},"transition":true},"model-height-based-emissive-strength-multiplier":{"type":"array","default":[1,1,1,1,0],"length":5,"value":"number","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"model-front-cutoff":{"type":"array","value":"number","expression":{"interpolated":true,"parameters":["zoom"]},"length":3,"default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1]},"model-elevation-reference":{"type":"enum","values":{"sea":1,"ground":1,"hd-road-markup":1},"default":"ground","expression":{}}},"transition":{"duration":{"type":"number","default":300,"minimum":0},"delay":{"type":"number","default":0,"minimum":0}},"promoteId":{"*":{"type":"*"}}}');function $o(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function Go(t){if(Array.isArray(t))return t.map(Go);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){const e={};for(const r in t)e[r]=Go(t[r]);return e}return $o(t)}function qo(t){if(!0===t||!1===t)return!0;if(!Array.isArray(t)||0===t.length)return!1;switch(t[0]){case"has":return t.length>=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":return t.length>=3&&("string"!=typeof t[1]||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==t.length||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(const e of t.slice(1))if(!qo(e)&&"boolean"!=typeof e)return!1;return!0;default:return!0}}function Ho(t,e="",r=null,n="fill"){if(null==t)return{filter:()=>!0,needGeometry:!1,needFeature:!1};qo(t)||(t=Qo(t));const i=t;let s=!0;try{s=function(t){if(!Wo(t))return t;let e=Go(t);return Zo(e),e=Xo(e),e}(i)}catch(t){console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate.\nThis is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md\nand paste the contents of this message in the report.\nThank you!\nFilter Expression:\n${JSON.stringify(i,null,2)}\n `)}let a=null,o=null;if("background"!==n&&"sky"!==n&&"slot"!==n){o=jo[`filter_${n}`];const t=ja(s,o,e,r);if("error"===t.result)throw new Error(t.value.map((t=>`${t.key}: ${t.message}`)).join(", "));a=(e,r,n)=>t.value.evaluate(e,r,{},n)}let l=null,u=null;if(s!==i){const t=ja(i,o,e,r);if("error"===t.result)throw new Error(t.value.map((t=>`${t.key}: ${t.message}`)).join(", "));l=(e,r,n,i,s)=>t.value.evaluate(e,r,{},n,void 0,void 0,i,s),u=!gs(t.value.expression)}return{filter:a,dynamicFilter:l||void 0,needGeometry:Jo(s),needFeature:!!u}}function Xo(t){if(!Array.isArray(t))return t;const e=function(t){if(Yo.has(t[0]))for(let e=1;e<t.length;e++)if(Wo(t[e]))return!0;return t}(t);return!0===e?e:e.map((t=>Xo(t)))}function Zo(t){let e=!1;const r=[];if("case"===t[0]){for(let n=1;n<t.length-1;n+=2)e=e||Wo(t[n]),r.push(t[n+1]);r.push(t[t.length-1])}else if("match"===t[0]){e=e||Wo(t[1]);for(let e=2;e<t.length-1;e+=2)r.push(t[e+1]);r.push(t[t.length-1])}else if("step"===t[0]){e=e||Wo(t[1]);for(let e=1;e<t.length-1;e+=2)r.push(t[e+1])}e&&(t.length=0,t.push("any",...r));for(let e=1;e<t.length;e++)Zo(t[e])}function Wo(t){if(!Array.isArray(t))return!1;if("pitch"===(e=t[0])||"distance-from-center"===e)return!0;var e;for(let e=1;e<t.length;e++)if(Wo(t[e]))return!0;return!1}const Yo=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function Ko(t,e){return t<e?-1:t>e?1:0}function Jo(t){if(!Array.isArray(t))return!1;if("within"===t[0]||"distance"===t[0])return!0;for(let e=1;e<t.length;e++)if(Jo(t[e]))return!0;return!1}function Qo(t){if(!t)return!0;const e=t[0];return t.length<=1?"any"!==e:"=="===e?tl(t[1],t[2],"=="):"!="===e?nl(tl(t[1],t[2],"==")):"<"===e||">"===e||"<="===e||">="===e?tl(t[1],t[2],e):"any"===e?(r=t.slice(1),["any"].concat(r.map(Qo))):"all"===e?["all"].concat(t.slice(1).map(Qo)):"none"===e?["all"].concat(t.slice(1).map(Qo).map(nl)):"in"===e?el(t[1],t.slice(2)):"!in"===e?nl(el(t[1],t.slice(2))):"has"===e?rl(t[1]):"!has"!==e||nl(rl(t[1]));var r}function tl(t,e,r){switch(t){case"$type":return[`filter-type-${r}`,e];case"$id":return[`filter-id-${r}`,e];default:return[`filter-${r}`,t,e]}}function el(t,e){if(0===e.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some((t=>typeof t!=typeof e[0]))?["filter-in-large",t,["literal",e.sort(Ko)]]:["filter-in-small",t,["literal",e]]}}function rl(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function nl(t){return["!",t]}const il="";function sl(t){return t.indexOf(il)>=0}function al(t,e){return e?`${t}${il}${e}`:t}function ol(t){const e=t.indexOf(il);return e>=0?t.slice(0,e):t}function ll(t){const e=t.lastIndexOf(il);return e>=0?t.slice(e+1):""}function ul(t){const e=t.indexOf(il);return e>=0?t.slice(e+1):""}let cl;const hl=()=>cl||(cl=new No({"icon-size":new Ro(jo.layout_symbol["icon-size"]),"icon-image":new Ro(jo.layout_symbol["icon-image"]),"icon-rotate":new Ro(jo.layout_symbol["icon-rotate"]),"icon-offset":new Ro(jo.layout_symbol["icon-offset"]),"text-size":new Ro(jo.layout_symbol["text-size"]),"text-rotate":new Ro(jo.layout_symbol["text-rotate"]),"text-offset":new Ro(jo.layout_symbol["text-offset"])}));class pl{constructor(t,e,r,n,i,s){const a=ja(t,jo.appearance.condition);if("success"===a.result&&(this.condition=a.value),this.name=e,r){this.properties=new Co(hl()),this.unevaluatedLayout=new Vo(hl(),n,i,s);for(const t in r)this.unevaluatedLayout.setValue(t,r[t])}}isActive(t){return!(this.condition||!t.isHidden||"hidden"!==this.name)||this.condition.evaluate(t.globals,t.feature,t.featureState,t.canonical)}getCondition(){return this.condition}getName(){return this.name}getProperty(t){return this.properties.get(t)}getUnevaluatedProperties(){return this.unevaluatedLayout}getUnevaluatedProperty(t){return this.unevaluatedLayout._values[t]}recalculate(t,e,r){this.unevaluatedLayout&&(this.properties=this.unevaluatedLayout.possiblyEvaluate(t,void 0,e,r))}serialize(){const t={};return t.condition=this.condition.expression.serialize(),this.name&&(t.name=this.name),this.unevaluatedLayout&&(t.properties=this.unevaluatedLayout.serialize()),t}hasIconProperties(){const t=this.hasProperty("icon-image"),e=this.hasProperty("icon-size"),r=this.hasProperty("icon-offset"),n=this.hasProperty("icon-rotate");return t||e||r||n}hasTextProperties(){const t=this.hasProperty("text-size"),e=this.hasProperty("text-offset"),r=this.hasProperty("text-rotate");return t||e||r}hasProperty(t){return void 0!==this.getUnevaluatedProperty(t).value}}const dl="-transition",fl=new Set(["fill","line","background","hillshade","raster"]);class ml extends nn{constructor(t,e,r,n,i,s){if(super(),this.id=t.id,this.fqid=al(this.id,r),this.type=t.type,this.scope=r,this.lut=n,this.options=i,this.iconImageUseTheme=s,this.appearances=new Array,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,this.expressionDependencies={isIndoorDependent:!1,configDependencies:new Set},"custom"!==t.type){if(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,t.type&&"background"!==t.type&&"sky"!==t.type&&"slot"!==t.type){this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter;const e=ja(this.filter,jo[`filter_${t.type}`]);"error"!==e.result&&(this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...e.value.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||e.value.isIndoorDependent)}if(t.slot&&(this.slot=t.slot),t.appearances&&this.setAppearances(t.appearances),e.layout&&(this._unevaluatedLayout=new Vo(e.layout,this.scope,i,this.iconImageUseTheme),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...this._unevaluatedLayout.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||this._unevaluatedLayout.isIndoorDependent()),e.paint){this._transitionablePaint=new zo(e.paint,this.scope,i);for(const e in t.paint)this.setPaintProperty(e,t.paint[e]);for(const e in t.layout)this.setLayoutProperty(e,t.layout[e]);this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...this._transitionablePaint.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||this._transitionablePaint.isIndoorDependent(),this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Co(e.paint)}}}onAdd(t){}onRemove(t){}isDraped(t){return!this.is3D(!0)&&fl.has(this.type)}getLayoutProperty(t){return"visibility"===t?this.visibility:this._unevaluatedLayout.getValue(t)}setLayoutProperty(t,e){if("custom"===this.type&&"visibility"===t)return void(this.visibility=e);const r=this._unevaluatedLayout;r._properties.properties[t]&&(r.setValue(t,e),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...r.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||r.isIndoorDependent(),"visibility"===t&&this.possiblyEvaluateVisibility())}setAppearances(t){this.appearances=[],t.forEach((t=>{this.appearances.push(new pl(t.condition,t.name,t.properties,this.scope,this.options,this.iconImageUseTheme))}))}possiblyEvaluateVisibility(){this._unevaluatedLayout._values.visibility&&(this.visibility=this._unevaluatedLayout._values.visibility.possiblyEvaluate({zoom:0}))}getPaintProperty(t){return t.endsWith(dl)?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)}isPaintProperty(t){return!!this._transitionablePaint._properties.properties[t]}setPaintProperty(t,e){const r=this._transitionablePaint,n=r._properties.properties;if(t.endsWith(dl)){const i=t.slice(0,-11);return n[i]&&r.setTransition(i,e||void 0),!1}if(!n[t])return!1;const i=r._values[t],s=i.value.isDataDriven(),a=i.value;r.setValue(t,e),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...r.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||r.isIndoorDependent(),this._handleSpecialPaintPropertyUpdate(t);const o=r._values[t].value,l=o.isDataDriven(),u=t.endsWith("pattern")||"line-dasharray"===t;return l||s||u||this._handleOverridablePaintPropertyUpdate(t,a,o)}_handleSpecialPaintPropertyUpdate(t){}getProgramIds(){return null}getDefaultProgramParams(t,e,r){return null}_handleOverridablePaintPropertyUpdate(t,e,r){return!1}isHidden(t){return!!(this.minzoom&&t<this.minzoom)||!!(this.maxzoom&&t>=this.maxzoom)||"none"===this.visibility}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,e){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,e,this.iconImageUseTheme)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,e)}serialize(){const t={id:this.id,type:this.type,slot:this.slot,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return 0!==this.appearances.length&&(t.appearances=this.appearances.map((t=>t.serialize()))),xe(t,((t,e)=>!(void 0===t||"layout"===e&&!Object.keys(t).length||"paint"===e&&!Object.keys(t).length)))}is3D(t){return!1}hasElevation(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}hasShadowPass(){return!1}canCastShadows(){return!1}hasLightBeamPass(){return!1}cutoffRange(){return 0}tileCoverLift(){return 0}resize(){}_clear(){}isStateDependent(){for(const t in this.paint._values){const e=this.paint.get(t);if(e instanceof Fo&&ka(e.property.specification)&&("source"===e.value.kind||"composite"===e.value.kind)&&e.value.isStateDependent)return!0}for(const t of this.appearances)if(!xs(t.condition.expression))return!0;return!1}compileFilter(t){this._filterCompiled||(this._featureFilter=Ho(this.filter,this.scope,t),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}getLayerRenderingStats(){return this._stats}resetLayerRenderingStats(t){this._stats&&("shadow"===t.renderPass?this._stats.numRenderedVerticesInShadowPass=0:this._stats.numRenderedVerticesInTransparentPass=0)}getAppearances(){return this.appearances}queryRenderedFeatures(t,e,r){return{}}queryRadius(t){}queryIntersectsFeature(t,e,r,n,i,s,a,o,l){}}const yl={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class gl{constructor(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}const xl=new ArrayBuffer(0);class vl{constructor(){this._reallocCount=0,this.capacity=0,this.length=0}static serialize(t,e){return t._trim(),e&&t.arrayBuffer&&e.add(t.arrayBuffer),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){const e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,t.arrayBuffer?e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement:(e.capacity=0,e.arrayBuffer=xl),e._refreshViews(),e}_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(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this._reallocCount++,this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}}reserveForAdditional(t){this.reserve(this.length+t)}_refreshViews(){throw new Error("StructArray#_refreshViews() must be implemented by each concrete StructArray layout")}emplace(...t){throw new Error("StructArray#emplace() must be implemented by each concrete StructArray layout")}emplaceBack(...t){throw new Error("StructArray#emplaceBack() must be implemented by each concrete StructArray layout")}destroy(){this.int8=this.uint8=this.int16=this.uint16=this.int32=this.uint32=this.float32=null,this.arrayBuffer=null}}function bl(t,e=1){let r=0,n=0;return{members:t.map((t=>{const i=yl[t.type].BYTES_PER_ELEMENT,s=r=wl(r,Math.max(e,i)),a=t.components||1;return n=Math.max(n,i),r+=i*a,{name:t.name,type:t.type,components:a,offset:s}})),size:wl(r,Math.max(n,e)),alignment:e}}function wl(t,e){return Math.ceil(t/e)*e}class _l extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e){const r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){const n=2*t;return this.int16[n+0]=e,this.int16[n+1]=r,t}}_l.prototype.bytesPerElement=4,Qa(_l,"StructArrayLayout2i4");class Al extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)}emplace(t,e,r,n){const i=3*t;return this.int16[i+0]=e,this.int16[i+1]=r,this.int16[i+2]=n,t}}Al.prototype.bytesPerElement=6,Qa(Al,"StructArrayLayout3i6");class Il extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,n){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)}emplace(t,e,r,n,i){const s=4*t;return this.int16[s+0]=e,this.int16[s+1]=r,this.int16[s+2]=n,this.int16[s+3]=i,t}}Il.prototype.bytesPerElement=8,Qa(Il,"StructArrayLayout4i8");class Ml extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.float32[1*t+0]=e,t}}Ml.prototype.bytesPerElement=4,Qa(Ml,"StructArrayLayout1f4");class Sl extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)}emplace(t,e,r,n){const i=4*t,s=2*t;return this.int16[i+0]=e,this.int16[i+1]=r,this.float32[s+1]=n,t}}Sl.prototype.bytesPerElement=8,Qa(Sl,"StructArrayLayout2i1f8");class Pl extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)}emplace(t,e,r,n){const i=4*t;return this.int16[i+0]=e,this.int16[i+1]=r,this.int16[i+2]=n,t}}Pl.prototype.bytesPerElement=8,Qa(Pl,"StructArrayLayout3i8");class kl extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i){const s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,n,i)}emplace(t,e,r,n,i,s){const a=5*t;return this.int16[a+0]=e,this.int16[a+1]=r,this.int16[a+2]=n,this.int16[a+3]=i,this.int16[a+4]=s,t}}kl.prototype.bytesPerElement=10,Qa(kl,"StructArrayLayout5i10");class Bl extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,a){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,r,n,i,s,a)}emplace(t,e,r,n,i,s,a,o){const l=6*t,u=12*t,c=3*t;return this.int16[l+0]=e,this.int16[l+1]=r,this.uint8[u+4]=n,this.uint8[u+5]=i,this.uint8[u+6]=s,this.uint8[u+7]=a,this.float32[c+2]=o,t}}Bl.prototype.bytesPerElement=12,Qa(Bl,"StructArrayLayout2i4ub1f12");class zl extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)}emplace(t,e,r,n){const i=3*t;return this.float32[i+0]=e,this.float32[i+1]=r,this.float32[i+2]=n,t}}zl.prototype.bytesPerElement=12,Qa(zl,"StructArrayLayout3f12");class Tl extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i){const s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,n,i)}emplace(t,e,r,n,i,s){const a=6*t,o=3*t;return this.uint16[a+0]=e,this.uint16[a+1]=r,this.uint16[a+2]=n,this.uint16[a+3]=i,this.float32[o+2]=s,t}}Tl.prototype.bytesPerElement=12,Qa(Tl,"StructArrayLayout4ui1f12");class El extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,n){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)}emplace(t,e,r,n,i){const s=4*t;return this.uint16[s+0]=e,this.uint16[s+1]=r,this.uint16[s+2]=n,this.uint16[s+3]=i,t}}El.prototype.bytesPerElement=8,Qa(El,"StructArrayLayout4ui8");class Vl extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i,s)}emplace(t,e,r,n,i,s,a){const o=6*t;return this.int16[o+0]=e,this.int16[o+1]=r,this.int16[o+2]=n,this.int16[o+3]=i,this.int16[o+4]=s,this.int16[o+5]=a,t}}Vl.prototype.bytesPerElement=12,Qa(Vl,"StructArrayLayout6i12");class Fl extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,a,o,l,u,c,h){const p=this.length;return this.resize(p+1),this.emplace(p,t,e,r,n,i,s,a,o,l,u,c,h)}emplace(t,e,r,n,i,s,a,o,l,u,c,h,p){const d=12*t;return this.int16[d+0]=e,this.int16[d+1]=r,this.int16[d+2]=n,this.int16[d+3]=i,this.uint16[d+4]=s,this.uint16[d+5]=a,this.uint16[d+6]=o,this.uint16[d+7]=l,this.int16[d+8]=u,this.int16[d+9]=c,this.int16[d+10]=h,this.int16[d+11]=p,t}}Fl.prototype.bytesPerElement=24,Qa(Fl,"StructArrayLayout4i4ui4i24");class Cl extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i,s)}emplace(t,e,r,n,i,s,a){const o=10*t,l=5*t;return this.int16[o+0]=e,this.int16[o+1]=r,this.int16[o+2]=n,this.float32[l+2]=i,this.float32[l+3]=s,this.float32[l+4]=a,t}}Cl.prototype.bytesPerElement=20,Qa(Cl,"StructArrayLayout3i3f20");class Dl extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,n){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)}emplace(t,e,r,n,i){const s=4*t;return this.float32[s+0]=e,this.float32[s+1]=r,this.float32[s+2]=n,this.float32[s+3]=i,t}}Dl.prototype.bytesPerElement=16,Qa(Dl,"StructArrayLayout4f16");class Rl extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint32[1*t+0]=e,t}}Rl.prototype.bytesPerElement=4,Qa(Rl,"StructArrayLayout1ul4");class Ll extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e){const r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){const n=2*t;return this.uint16[n+0]=e,this.uint16[n+1]=r,t}}Ll.prototype.bytesPerElement=4,Qa(Ll,"StructArrayLayout2ui4");class Ol extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,a,o,l,u,c,h,p){const d=this.length;return this.resize(d+1),this.emplace(d,t,e,r,n,i,s,a,o,l,u,c,h,p)}emplace(t,e,r,n,i,s,a,o,l,u,c,h,p,d){const f=20*t,m=10*t;return this.int16[f+0]=e,this.int16[f+1]=r,this.int16[f+2]=n,this.int16[f+3]=i,this.int16[f+4]=s,this.float32[m+3]=a,this.float32[m+4]=o,this.float32[m+5]=l,this.float32[m+6]=u,this.int16[f+14]=c,this.uint32[m+8]=h,this.uint16[f+18]=p,this.uint16[f+19]=d,t}}Ol.prototype.bytesPerElement=40,Qa(Ol,"StructArrayLayout5i4f1i1ul2ui40");class Ul extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,a){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,r,n,i,s,a)}emplace(t,e,r,n,i,s,a,o){const l=8*t;return this.int16[l+0]=e,this.int16[l+1]=r,this.int16[l+2]=n,this.int16[l+4]=i,this.int16[l+5]=s,this.int16[l+6]=a,this.int16[l+7]=o,t}}Ul.prototype.bytesPerElement=16,Qa(Ul,"StructArrayLayout3i2i2i16");class Nl extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i){const s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,n,i)}emplace(t,e,r,n,i,s){const a=4*t,o=8*t;return this.float32[a+0]=e,this.float32[a+1]=r,this.float32[a+2]=n,this.int16[o+6]=i,this.int16[o+7]=s,t}}Nl.prototype.bytesPerElement=16,Qa(Nl,"StructArrayLayout2f1f2i16");class jl extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i,s)}emplace(t,e,r,n,i,s,a){const o=20*t,l=5*t;return this.uint8[o+0]=e,this.uint8[o+1]=r,this.float32[l+1]=n,this.float32[l+2]=i,this.float32[l+3]=s,this.float32[l+4]=a,t}}jl.prototype.bytesPerElement=20,Qa(jl,"StructArrayLayout2ub4f20");class $l extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r){const n=this.length;return this.resize(n+1),this.emplace(n,t,e,r)}emplace(t,e,r,n){const i=3*t;return this.uint16[i+0]=e,this.uint16[i+1]=r,this.uint16[i+2]=n,t}}$l.prototype.bytesPerElement=6,Qa($l,"StructArrayLayout3ui6");class Gl extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,a,o,l,u,c,h,p,d,f,m,y,g,x,v,b){const w=this.length;return this.resize(w+1),this.emplace(w,t,e,r,n,i,s,a,o,l,u,c,h,p,d,f,m,y,g,x,v,b)}emplace(t,e,r,n,i,s,a,o,l,u,c,h,p,d,f,m,y,g,x,v,b,w){const _=30*t,A=15*t,I=60*t;return this.int16[_+0]=e,this.int16[_+1]=r,this.int16[_+2]=n,this.float32[A+2]=i,this.float32[A+3]=s,this.uint16[_+8]=a,this.uint16[_+9]=o,this.uint32[A+5]=l,this.uint32[A+6]=u,this.uint32[A+7]=c,this.uint16[_+16]=h,this.uint16[_+17]=p,this.uint16[_+18]=d,this.float32[A+10]=f,this.float32[A+11]=m,this.uint8[I+48]=y,this.uint8[I+49]=g,this.uint8[I+50]=x,this.uint32[A+13]=v,this.int16[_+28]=b,this.uint8[I+58]=w,t}}Gl.prototype.bytesPerElement=60,Qa(Gl,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class ql extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,a,o,l,u,c,h,p,d,f,m,y,g,x,v,b,w,_,A,I,M,S,P,k,B,z,T,E){const V=this.length;return this.resize(V+1),this.emplace(V,t,e,r,n,i,s,a,o,l,u,c,h,p,d,f,m,y,g,x,v,b,w,_,A,I,M,S,P,k,B,z,T,E)}emplace(t,e,r,n,i,s,a,o,l,u,c,h,p,d,f,m,y,g,x,v,b,w,_,A,I,M,S,P,k,B,z,T,E,V){const F=20*t,C=40*t,D=80*t;return this.float32[F+0]=e,this.float32[F+1]=r,this.int16[C+4]=n,this.int16[C+5]=i,this.int16[C+6]=s,this.int16[C+7]=a,this.int16[C+8]=o,this.int16[C+9]=l,this.int16[C+10]=u,this.int16[C+11]=c,this.int16[C+12]=h,this.uint16[C+13]=p,this.uint16[C+14]=d,this.uint16[C+15]=f,this.uint16[C+16]=m,this.uint16[C+17]=y,this.uint16[C+18]=g,this.uint16[C+19]=x,this.uint16[C+20]=v,this.uint16[C+21]=b,this.uint16[C+22]=w,this.uint16[C+23]=_,this.uint16[C+24]=A,this.uint16[C+25]=I,this.uint16[C+26]=M,this.uint16[C+27]=S,this.uint32[F+14]=P,this.float32[F+15]=k,this.float32[F+16]=B,this.float32[F+17]=z,this.float32[F+18]=T,this.uint8[D+76]=E,this.uint16[C+39]=V,t}}ql.prototype.bytesPerElement=80,Qa(ql,"StructArrayLayout2f9i15ui1ul4f1ub1ui80");class Hl extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s){const a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,n,i,s)}emplace(t,e,r,n,i,s,a){const o=6*t;return this.float32[o+0]=e,this.float32[o+1]=r,this.float32[o+2]=n,this.float32[o+3]=i,this.float32[o+4]=s,this.float32[o+5]=a,t}}Hl.prototype.bytesPerElement=24,Qa(Hl,"StructArrayLayout6f24");class Xl extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i){const s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,n,i)}emplace(t,e,r,n,i,s){const a=5*t;return this.float32[a+0]=e,this.float32[a+1]=r,this.float32[a+2]=n,this.float32[a+3]=i,this.float32[a+4]=s,t}}Xl.prototype.bytesPerElement=20,Qa(Xl,"StructArrayLayout5f20");class Zl extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,a){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,r,n,i,s,a)}emplace(t,e,r,n,i,s,a,o){const l=7*t;return this.float32[l+0]=e,this.float32[l+1]=r,this.float32[l+2]=n,this.float32[l+3]=i,this.float32[l+4]=s,this.float32[l+5]=a,this.float32[l+6]=o,t}}Zl.prototype.bytesPerElement=28,Qa(Zl,"StructArrayLayout7f28");class Wl extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,a,o,l,u,c){const h=this.length;return this.resize(h+1),this.emplace(h,t,e,r,n,i,s,a,o,l,u,c)}emplace(t,e,r,n,i,s,a,o,l,u,c,h){const p=11*t;return this.float32[p+0]=e,this.float32[p+1]=r,this.float32[p+2]=n,this.float32[p+3]=i,this.float32[p+4]=s,this.float32[p+5]=a,this.float32[p+6]=o,this.float32[p+7]=l,this.float32[p+8]=u,this.float32[p+9]=c,this.float32[p+10]=h,t}}Wl.prototype.bytesPerElement=44,Qa(Wl,"StructArrayLayout11f44");class Yl extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,a,o,l){const u=this.length;return this.resize(u+1),this.emplace(u,t,e,r,n,i,s,a,o,l)}emplace(t,e,r,n,i,s,a,o,l,u){const c=9*t;return this.float32[c+0]=e,this.float32[c+1]=r,this.float32[c+2]=n,this.float32[c+3]=i,this.float32[c+4]=s,this.float32[c+5]=a,this.float32[c+6]=o,this.float32[c+7]=l,this.float32[c+8]=u,t}}Yl.prototype.bytesPerElement=36,Qa(Yl,"StructArrayLayout9f36");class Kl extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e){const r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){const n=2*t;return this.float32[n+0]=e,this.float32[n+1]=r,t}}Kl.prototype.bytesPerElement=8,Qa(Kl,"StructArrayLayout2f8");class Jl extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,n){const i=this.length;return this.resize(i+1),this.emplace(i,t,e,r,n)}emplace(t,e,r,n,i){const s=6*t;return this.uint32[3*t+0]=e,this.uint16[s+2]=r,this.uint16[s+3]=n,this.uint16[s+4]=i,t}}Jl.prototype.bytesPerElement=12,Qa(Jl,"StructArrayLayout1ul3ui12");class Ql extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint16[1*t+0]=e,t}}Ql.prototype.bytesPerElement=2,Qa(Ql,"StructArrayLayout1ui2");class tu extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,a,o,l,u,c,h,p,d,f,m){const y=this.length;return this.resize(y+1),this.emplace(y,t,e,r,n,i,s,a,o,l,u,c,h,p,d,f,m)}emplace(t,e,r,n,i,s,a,o,l,u,c,h,p,d,f,m,y){const g=16*t;return this.float32[g+0]=e,this.float32[g+1]=r,this.float32[g+2]=n,this.float32[g+3]=i,this.float32[g+4]=s,this.float32[g+5]=a,this.float32[g+6]=o,this.float32[g+7]=l,this.float32[g+8]=u,this.float32[g+9]=c,this.float32[g+10]=h,this.float32[g+11]=p,this.float32[g+12]=d,this.float32[g+13]=f,this.float32[g+14]=m,this.float32[g+15]=y,t}}tu.prototype.bytesPerElement=64,Qa(tu,"StructArrayLayout16f64");class eu extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,n,i,s,a){const o=this.length;return this.resize(o+1),this.emplace(o,t,e,r,n,i,s,a)}emplace(t,e,r,n,i,s,a,o){const l=10*t,u=5*t;return this.uint16[l+0]=e,this.uint16[l+1]=r,this.uint16[l+2]=n,this.uint16[l+3]=i,this.float32[u+2]=s,this.float32[u+3]=a,this.float32[u+4]=o,t}}eu.prototype.bytesPerElement=20,Qa(eu,"StructArrayLayout4ui3f20");class ru extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.int16[1*t+0]=e,t}}ru.prototype.bytesPerElement=2,Qa(ru,"StructArrayLayout1i2");class nu extends vl{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer)}emplaceBack(t){const e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){return this.uint8[1*t+0]=e,t}}nu.prototype.bytesPerElement=1,Qa(nu,"StructArrayLayout1ub1");class iu extends gl{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.int16[this._pos2+3]}get tileAnchorY(){return this._structArray.int16[this._pos2+4]}get x1(){return this._structArray.float32[this._pos4+3]}get y1(){return this._structArray.float32[this._pos4+4]}get x2(){return this._structArray.float32[this._pos4+5]}get y2(){return this._structArray.float32[this._pos4+6]}get padding(){return this._structArray.int16[this._pos2+14]}get featureIndex(){return this._structArray.uint32[this._pos4+8]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+18]}get bucketIndex(){return this._structArray.uint16[this._pos2+19]}}iu.prototype.size=40;class su extends Ol{get(t){return new iu(this,t)}}Qa(su,"CollisionBoxArray");class au extends gl{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+8]}get numGlyphs(){return this._structArray.uint16[this._pos2+9]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+5]}get lineStartIndex(){return this._structArray.uint32[this._pos4+6]}get lineLength(){return this._structArray.uint32[this._pos4+7]}get segment(){return this._structArray.uint16[this._pos2+16]}get lowerSize(){return this._structArray.uint16[this._pos2+17]}get upperSize(){return this._structArray.uint16[this._pos2+18]}get lineOffsetX(){return this._structArray.float32[this._pos4+10]}get lineOffsetY(){return this._structArray.float32[this._pos4+11]}get writingMode(){return this._structArray.uint8[this._pos1+48]}get placedOrientation(){return this._structArray.uint8[this._pos1+49]}set placedOrientation(t){this._structArray.uint8[this._pos1+49]=t}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(t){this._structArray.uint8[this._pos1+50]=t}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(t){this._structArray.uint32[this._pos4+13]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(t){this._structArray.uint8[this._pos1+58]=t}}au.prototype.size=60;class ou extends Gl{get(t){return new au(this,t)}}Qa(ou,"PlacedSymbolArray");class lu extends gl{get tileAnchorX(){return this._structArray.float32[this._pos4+0]}get tileAnchorY(){return this._structArray.float32[this._pos4+1]}get projectedAnchorX(){return this._structArray.int16[this._pos2+4]}get projectedAnchorY(){return this._structArray.int16[this._pos2+5]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+6]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+7]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+8]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+9]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+10]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+11]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+12]}get key(){return this._structArray.uint16[this._pos2+13]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+14]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+15]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+16]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+17]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+18]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+19]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+20]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+21]}get featureIndex(){return this._structArray.uint16[this._pos2+22]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+23]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+24]}get numIconVertices(){return this._structArray.uint16[this._pos2+25]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+26]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+27]}get crossTileID(){return this._structArray.uint32[this._pos4+14]}set crossTileID(t){this._structArray.uint32[this._pos4+14]=t}get textOffset0(){return this._structArray.float32[this._pos4+15]}get textOffset1(){return this._structArray.float32[this._pos4+16]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+17]}get zOffset(){return this._structArray.float32[this._pos4+18]}set zOffset(t){this._structArray.float32[this._pos4+18]=t}get hasIconTextFit(){return this._structArray.uint8[this._pos1+76]}get elevationFeatureIndex(){return this._structArray.uint16[this._pos2+39]}}lu.prototype.size=80;class uu extends ql{get(t){return new lu(this,t)}}Qa(uu,"SymbolInstanceArray");class cu extends Ml{getoffsetX(t){return this.float32[1*t+0]}}Qa(cu,"GlyphOffsetArray");class hu extends _l{getx(t){return this.int16[2*t+0]}gety(t){return this.int16[2*t+1]}}Qa(hu,"SymbolLineVertexArray");class pu extends gl{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]}get layoutVertexArrayOffset(){return this._structArray.uint16[this._pos2+4]}}pu.prototype.size=12;class du extends Jl{get(t){return new pu(this,t)}}Qa(du,"FeatureIndexArray");class fu extends Ll{geta_centroid_pos0(t){return this.uint16[2*t+0]}geta_centroid_pos1(t){return this.uint16[2*t+1]}}Qa(fu,"FillExtrusionCentroidArray");class mu extends gl{get a_join_normal_inside0(){return this._structArray.int16[this._pos2+0]}get a_join_normal_inside1(){return this._structArray.int16[this._pos2+1]}get a_join_normal_inside2(){return this._structArray.int16[this._pos2+2]}}mu.prototype.size=6;class yu extends Al{get(t){return new mu(this,t)}}Qa(yu,"FillExtrusionWallArray");const gu=bl([{name:"a_pos",components:2,type:"Int16"}],4),xu=bl([{name:"a_circle_z_offset",components:1,type:"Float32"}],4),vu=bl([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class bu{constructor(t=[]){this.segments=t}_prepareSegment(t,e,r,n){let i=this.segments[this.segments.length-1];return t>bu.MAX_VERTEX_ARRAY_LENGTH&&Ae(`Max vertices per segment is ${bu.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}`),(!i||i.vertexLength+t>bu.MAX_VERTEX_ARRAY_LENGTH||i.sortKey!==n)&&(i={vertexOffset:e,primitiveOffset:r,vertexLength:0,primitiveLength:0},void 0!==n&&(i.sortKey=n),this.segments.push(i)),i}prepareSegment(t,e,r,n){return this._prepareSegment(t,e.length,r.length,n)}get(){return this.segments}destroy(){for(const t of this.segments)for(const e in t.vaos)t.vaos[e].destroy()}static simpleSegment(t,e,r,n){return new bu([{vertexOffset:t,primitiveOffset:e,vertexLength:r,primitiveLength:n,vaos:{},sortKey:0}])}}function wu(t,e){return 256*(t=ie(Math.floor(t),0,255))+ie(Math.floor(e),0,255)}bu.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Qa(bu,"SegmentVector");const _u=bl([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),Au=bl([{name:"a_pattern_b",components:4,type:"Uint16"}]),Iu=bl([{name:"a_dash",components:4,type:"Uint16"}]);class Mu{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}add(t,e,r,n){this.ids.push(Su(t)),this.positions.push(e,r,n)}eachPosition(t,e){const r=Su(t);let n=0,i=this.ids.length-1;for(;n<i;){const t=n+i>>1;this.ids[t]>=r?i=t:n=t+1}for(;this.ids[n]===r;)e(this.positions[3*n],this.positions[3*n+1],this.positions[3*n+2]),n++}static serialize(t,e){const r=new Float64Array(t.ids),n=new Uint32Array(t.positions);return Pu(r,n,0,r.length-1),e&&(e.add(r.buffer),e.add(n.buffer)),{ids:r,positions:n}}static deserialize(t){const e=new Mu;let r;e.ids=t.ids,e.positions=t.positions;for(const t of e.ids)t!==r&&e.uniqueIds.push(t),r=t;return e.indexed=!0,e}}function Su(t){const e=+t;return Number.isSafeInteger(e)?e:Jr(String(t))}function Pu(t,e,r,n){for(;r<n;){const i=t[r+n>>1];let s=r-1,a=n+1;for(;;){do{s++}while(t[s]<i);do{a--}while(t[a]>i);if(s>=a)break;ku(t,s,a),ku(e,3*s,3*a),ku(e,3*s+1,3*a+1),ku(e,3*s+2,3*a+2)}a-r<n-a?(Pu(t,e,r,a),r=a+1):(Pu(t,e,a+1,n),n=a)}}function ku(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}Qa(Mu,"FeaturePositionMap");class Bu{constructor(t){this.gl=t.gl,this.initialized=!1}fetchUniformLocation(t,e){return this.location||this.initialized||(this.location=this.gl.getUniformLocation(t,e),this.initialized=!0),!!this.location}set(t,e,r){throw new Error("Uniform#set() must be implemented by each concrete Uniform")}}class zu extends Bu{constructor(t){super(t),this.current=0}set(t,e,r){this.fetchUniformLocation(t,e)&&this.current!==r&&(this.current=r,this.gl.uniform1i(this.location,r))}}class Tu extends Bu{constructor(t){super(t),this.current=0}set(t,e,r){this.fetchUniformLocation(t,e)&&this.current!==r&&(this.current=r,this.gl.uniform1f(this.location,r))}}class Eu extends Bu{constructor(t){super(t),this.current=[0,0]}set(t,e,r){this.fetchUniformLocation(t,e)&&(r[0]===this.current[0]&&r[1]===this.current[1]||(this.current=r,this.gl.uniform2f(this.location,r[0],r[1])))}}class Vu extends Bu{constructor(t){super(t),this.current=[0,0,0]}set(t,e,r){this.fetchUniformLocation(t,e)&&(r[0]===this.current[0]&&r[1]===this.current[1]&&r[2]===this.current[2]||(this.current=r,this.gl.uniform3f(this.location,r[0],r[1],r[2])))}}class Fu extends Bu{constructor(t){super(t),this.current=[0,0,0,0]}set(t,e,r){this.fetchUniformLocation(t,e)&&(r[0]===this.current[0]&&r[1]===this.current[1]&&r[2]===this.current[2]&&r[3]===this.current[3]||(this.current=r,this.gl.uniform4f(this.location,r[0],r[1],r[2],r[3])))}}class Cu extends Bu{constructor(t){super(t),this.current=un.transparent.toPremultipliedRenderColor(null)}set(t,e,r){this.fetchUniformLocation(t,e)&&(r.r===this.current.r&&r.g===this.current.g&&r.b===this.current.b&&r.a===this.current.a||(this.current=r,this.gl.uniform4f(this.location,r.r,r.g,r.b,r.a)))}}const Du=new Float32Array(16);class Ru extends Bu{constructor(t){super(t),this.current=Du}set(t,e,r){if(this.fetchUniformLocation(t,e)){if(r[12]!==this.current[12]||r[0]!==this.current[0])return this.current=r,void this.gl.uniformMatrix4fv(this.location,!1,r);for(let t=1;t<16;t++)if(r[t]!==this.current[t]){this.current=r,this.gl.uniformMatrix4fv(this.location,!1,r);break}}}}const Lu=new Float32Array(9);class Ou extends Bu{constructor(t){super(t),this.current=Lu}set(t,e,r){if(this.fetchUniformLocation(t,e))for(let t=0;t<9;t++)if(r[t]!==this.current[t]){this.current=r,this.gl.uniformMatrix3fv(this.location,!1,r);break}}}const Uu=new Float32Array(4);class Nu extends Bu{constructor(t){super(t),this.current=Uu}set(t,e,r){if(this.fetchUniformLocation(t,e))for(let t=0;t<4;t++)if(r[t]!==this.current[t]){this.current=r,this.gl.uniformMatrix2fv(this.location,!1,r);break}}}function ju(t){return[wu(255*t.r,255*t.g),wu(255*t.b,255*t.a)]}function $u(t,e,r,n,i,s,a,o){return!!t&&("composite"===t.kind||"source"===t.kind?"none"===t.evaluate(new Po(0,{brightness:s,worldview:o}),e,r,i,n,a):"none"===t.value)}class Gu{constructor(t,e,r,n){this.value=t,this.uniformNames=e.map((t=>`u_${t}`)),this.type=r,this.context=n}setUniform(t,e,r,n,i){const s=n.constantOr(this.value);e.set(t,i,s instanceof un?s.toPremultipliedRenderColor(this.lutExpression&&"constant"===this.lutExpression.kind&&"none"===this.lutExpression.value?null:this.context.lut):s)}getBinding(t,e){return"color"===this.type?new Cu(t):new Tu(t)}}class qu{constructor(t,e){this.uniformNames=e.map((t=>`u_${t}`)),this.pattern=null,this.patternTransition=null,this.pixelRatio=1}setConstantPatternPositions(t,e){this.pixelRatio=t.pixelRatio||1,this.pattern=t.tl.concat(t.br),this.patternTransition=e?e.tl.concat(e.br):this.pattern}setUniform(t,e,r,n,i){let s=null;"u_pattern"!==i&&"u_dash"!==i||(s=this.pattern),"u_pattern_b"===i&&(s=this.patternTransition),"u_pixel_ratio"===i&&(s=this.pixelRatio),s&&e.set(t,i,s)}getBinding(t,e){return"u_pattern"===e||"u_pattern_b"===e||"u_dash"===e?new Fu(t):new Tu(t)}}class Hu{constructor(t,e,r,n){this.expression=t,this.type=r,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:`a_${t}`,type:"Float32",components:"color"===r?2:1,offset:0}))),this.paintVertexArray=new n}populatePaintArray(t,e,r,n,i,s,a,o){const l=this.paintVertexArray.length,u="composite"===this.expression.kind||"source"===this.expression.kind?this.expression.evaluate(new Po(0,{brightness:s,worldview:o}),e,{},i,n,a):"constant"===this.expression.kind&&this.expression.value,c=$u(this.lutExpression,e,{},n,i,s,a,o);this.paintVertexArray.resize(t),this._setPaintValue(l,t,u,c?null:this.context.lut)}updatePaintArray(t,e,r,n,i,s,a,o){const l="composite"===this.expression.kind||"source"===this.expression.kind?this.expression.evaluate({zoom:0,brightness:a,worldview:o},r,n,void 0,i):"constant"===this.expression.kind&&this.expression.value,u=$u(this.lutExpression,r,n,i,void 0,a,void 0,o);this._setPaintValue(t,e,l,u?null:this.context.lut)}_setPaintValue(t,e,r,n){if("color"===this.type){const i=ju(r.toPremultipliedRenderColor(n));for(let r=t;r<e;r++)this.paintVertexArray.emplace(r,i[0],i[1])}else{for(let n=t;n<e;n++)this.paintVertexArray.emplace(n,r);this.maxValue=Math.max(this.maxValue,Math.abs(r))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.lutExpression&&"constant"!==this.lutExpression.kind&&(this.lutExpression.isStateDependent||!this.lutExpression.isLightConstant)||"constant"!==this.expression.kind&&(this.expression.isStateDependent||!this.expression.isLightConstant)))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Xu{constructor(t,e,r,n,i,s){this.expression=t,this.uniformNames=e.map((t=>`u_${t}_t`)),this.type=r,this.useIntegerZoom=n,this.context=i,this.maxValue=0,this.paintVertexAttributes=e.map((t=>({name:`a_${t}`,type:"Float32",components:"color"===r?4:2,offset:0}))),this.paintVertexArray=new s}populatePaintArray(t,e,r,n,i,s,a,o){const l=this.expression.evaluate(new Po(this.context.zoom,{brightness:s,worldview:o}),e,{},i,n,a),u=this.expression.evaluate(new Po(this.context.zoom+1,{brightness:s,worldview:o}),e,{},i,n,a),c=$u(this.lutExpression,e,{},n,i,s,a,o),h=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(h,t,l,u,c?null:this.context.lut)}updatePaintArray(t,e,r,n,i,s,a,o){const l=this.expression.evaluate({zoom:this.context.zoom,brightness:a,worldview:o},r,n,void 0,i),u=this.expression.evaluate({zoom:this.context.zoom+1,brightness:a,worldview:o},r,n,void 0,i),c=$u(this.lutExpression,r,n,i,void 0,a,void 0,o);this._setPaintValue(t,e,l,u,c?null:this.context.lut)}_setPaintValue(t,e,r,n,i){if("color"===this.type){const n=ju(r.toPremultipliedRenderColor(i)),s=ju(r.toPremultipliedRenderColor(i));for(let r=t;r<e;r++)this.paintVertexArray.emplace(r,n[0],n[1],s[0],s[1])}else{for(let i=t;i<e;i++)this.paintVertexArray.emplace(i,r,n);this.maxValue=Math.max(this.maxValue,Math.abs(r),Math.abs(n))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(t,e,r,n,i){const s=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,a=ie(this.expression.interpolationFactor(s,this.context.zoom,this.context.zoom+1),0,1);e.set(t,i,a)}getBinding(t,e){return new Tu(t)}}class Zu{constructor(t,e,r,n,i){this.expression=t,this.layerId=i,this.paintVertexAttributes=("array"===r?Iu:_u).members,this.paintVertexArray=new n,this.paintTransitionVertexArray=new El}populatePaintArray(t,e,r,n){const i=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValues(i,t,e.patterns&&e.patterns[this.layerId],r)}updatePaintArray(t,e,r,n,i,s,a){this._setPaintValues(t,e,r.patterns&&r.patterns[this.layerId],s)}_setPaintValues(t,e,r,n){if(!n||!r)return;const i=n[r[0]],s=n[r[1]];if(i){if(i){const{tl:r,br:n,pixelRatio:s}=i;for(let i=t;i<e;i++)this.paintVertexArray.emplace(i,r[0],r[1],n[0],n[1],s)}if(s){this.paintTransitionVertexArray.resize(this.paintVertexArray.length);const{tl:r,br:n}=s;for(let i=t;i<e;i++)this.paintTransitionVertexArray.emplace(i,r[0],r[1],n[0],n[1])}}}upload(t){const e=this.expression.isStateDependent||!this.expression.isLightConstant;this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,e)),this.paintTransitionVertexArray&&this.paintTransitionVertexArray.length&&(this.paintTransitionVertexBuffer=t.createVertexBuffer(this.paintTransitionVertexArray,Au.members,e))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy(),this.paintTransitionVertexBuffer&&this.paintTransitionVertexBuffer.destroy()}}class Wu{constructor(t,e,r=(()=>!0)){this.binders={},this._buffers=[],this.context=e;const n=[];for(const i in t.paint._values){const s=t.paint.get(i);if(i.endsWith("-use-theme"))continue;if(!r(i))continue;if(!(s instanceof Fo&&ka(s.property.specification)))continue;const a=Ju(i,t.type),o=s.value,l=s.property.specification.type,u=!!s.property.useIntegerZoom,c="line-dasharray"===i||i.endsWith("pattern"),h=t.paint.get(`${i}-use-theme`),p="line-dasharray"===i&&"constant"!==t.layout.get("line-cap").value.kind||h&&"constant"!==h.value.kind;if("constant"!==o.kind||p)if("source"===o.kind||p||c){const e=ec(i,l,"source");this.binders[i]=c?new Zu(o,a,l,e,t.id):new Hu(o,a,l,e),n.push(`/a_${i}`)}else{const t=ec(i,l,"composite");this.binders[i]=new Xu(o,a,l,u,e,t),n.push(`/z_${i}`)}else this.binders[i]=c?new qu(o.value,a):new Gu(o.value,a,l,e),n.push(`/u_${i}`);h&&(this.binders[i].lutExpression=h.value)}this.cacheKey=n.sort().join("")}getMaxValue(t){const e=this.binders[t];return e instanceof Hu||e instanceof Xu?e.maxValue:0}populatePaintArrays(t,e,r,n,i,s,a,o){for(const l in this.binders){const u=this.binders[l];u.context=this.context,(u instanceof Hu||u instanceof Xu||u instanceof Zu)&&u.populatePaintArray(t,e,r,n,i,s,a,o)}}setConstantPatternPositions(t,e){for(const r in this.binders){const n=this.binders[r];n instanceof qu&&n.setConstantPatternPositions(t,e)}}getPatternTransitionVertexBuffer(t){const e=this.binders[t];return e instanceof Zu?e.paintTransitionVertexBuffer:null}updatePaintArrays(t,e,r,n,i,s,a,o,l,u){let c=!1;const h=Object.keys(t),p=0!==h.length&&!o,d=p?h:e.uniqueIds;this.context.lut=i.lut;for(const o in this.binders){const h=this.binders[o];if(h.context=this.context,(h instanceof Hu||h instanceof Xu||h instanceof Zu)&&h.expression&&h.expression.kind&&"constant"!==h.expression.kind&&(!0===h.expression.isStateDependent||!1===h.expression.isLightConstant)){const f=i.paint.get(o);h.expression=f.value;for(const r of d){const i=t[r.toString()];e.eachPosition(r,((t,e,r)=>{const o=n.feature(t);h.updatePaintArray(e,r,o,i,s,a,l,u)}))}if(!p)for(const e of r.uniqueIds){const i=t[e.toString()];r.eachPosition(e,((t,e,r)=>{const o=n.feature(t);h.updatePaintArray(e,r,o,i,s,a,l,u)}))}c=!0}}return c}defines(){const t=[];for(const e in this.binders){const r=this.binders[e];(r instanceof Gu||r instanceof qu)&&t.push(...r.uniformNames.map((t=>`#define HAS_UNIFORM_${t}`)))}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t){const e=[];for(const r in this.binders){const n=this.binders[r];if(n instanceof Gu||n instanceof qu||n instanceof Xu)for(const i of n.uniformNames)e.push({name:i,property:r,binding:n.getBinding(t,i)})}return e}setUniforms(t,e,r,n,i){for(const{name:e,property:s,binding:a}of r)this.binders[s].setUniform(t,a,i,n.get(s),e)}updatePaintBuffers(){this._buffers=[];for(const t in this.binders){const e=this.binders[t];(e instanceof Hu||e instanceof Xu||e instanceof Zu)&&e.paintVertexBuffer&&this._buffers.push(e.paintVertexBuffer),e instanceof Zu&&e.paintTransitionVertexBuffer&&this._buffers.push(e.paintTransitionVertexBuffer)}}upload(t){for(const e in this.binders){const r=this.binders[e];(r instanceof Hu||r instanceof Xu||r instanceof Zu)&&r.upload(t)}this.updatePaintBuffers()}destroy(){for(const t in this.binders){const e=this.binders[t];(e instanceof Hu||e instanceof Xu||e instanceof Zu)&&e.destroy()}}}class Yu{constructor(t,e,r=(()=>!0)){this.programConfigurations={};for(const n of t)this.programConfigurations[n.id]=new Wu(n,e,r);this.needsUpload=!1,this._featureMap=new Mu,this._featureMapWithoutIds=new Mu,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(t,e,r,n,i,s,a,o,l){for(const r in this.programConfigurations)this.programConfigurations[r].populatePaintArrays(t,e,n,i,s,a,o,l);void 0!==e.id?this._featureMap.add(e.id,r,this._bufferOffset,t):(this._featureMapWithoutIds.add(this._idlessCounter,r,this._bufferOffset,t),this._idlessCounter+=1),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,e,r,n,i,s,a,o){for(const l of r)this.needsUpload=this.programConfigurations[l.id].updatePaintArrays(t,this._featureMap,this._featureMapWithoutIds,e,l,n,i,s,a||0,o)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(const e in this.programConfigurations)this.programConfigurations[e].upload(t);this.needsUpload=!1}}destroy(){for(const t in this.programConfigurations)this.programConfigurations[t].destroy()}}const Ku={"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-occlusion-opacity":["occlusion_opacity"],"icon-occlusion-opacity":["occlusion_opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-emissive-strength":["emissive_strength"],"icon-emissive-strength":["emissive_strength"],"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"],"symbol-z-offset":["z_offset"],"line-gap-width":["gapwidth"],"line-pattern":["pattern","pixel_ratio","pattern_b"],"fill-pattern":["pattern","pixel_ratio","pattern_b"],"fill-extrusion-pattern":["pattern","pixel_ratio","pattern_b"],"line-dasharray":["dash"],"fill-bridge-guard-rail-color":["structure_color"],"fill-tunnel-structure-color":["structure_color"]};function Ju(t,e){return Ku[t]||[t.replace(`${e}-`,"").replace(/-/g,"_")]}const Qu={"line-pattern":{source:Tl,composite:Tl},"fill-pattern":{source:Tl,composite:Tl},"fill-extrusion-pattern":{source:Tl,composite:Tl},"line-dasharray":{source:El,composite:El}},tc={color:{source:Kl,composite:Dl},number:{source:Ml,composite:Kl}};function ec(t,e,r){const n=Qu[t];return n&&n[r]||tc[e][r]}Qa(Gu,"ConstantBinder"),Qa(qu,"PatternConstantBinder"),Qa(Hu,"SourceExpressionBinder"),Qa(Zu,"PatternCompositeBinder"),Qa(Xu,"CompositeExpressionBinder"),Qa(Wu,"ProgramConfiguration",{omit:["_buffers"]}),Qa(Yu,"ProgramConfigurationSet");const rc=Ui/Math.PI/2,nc=5,ic=6,sc=45,ac=16383,oc=64,lc=[oc,32,16],uc=-rc,cc=rc;function hc(t,e,r,n=rc){return r=Xt(r),[t*Math.sin(r)*n,-e*n,t*Math.cos(r)*n]}function pc([t,e,r]){const n=Math.hypot(t,e,r),i=Math.atan2(t,r),s=.5*Math.PI-Math.acos(-e/n);return new yc(Zt(i),Zt(s))}function dc(t,e,r){return hc(Math.cos(Xt(t)),Math.sin(Xt(t)),e,r)}const fc=6371008.8,mc=2*Math.PI*fc;class yc{constructor(t,e){if(isNaN(t)||isNaN(e))throw new Error(`Invalid LngLat object: (${t}, ${e})`);if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new yc(ae(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){const e=Math.PI/180,r=this.lat*e,n=t.lat*e,i=Math.sin(r)*Math.sin(n)+Math.cos(r)*Math.cos(n)*Math.cos((t.lng-this.lng)*e);return fc*Math.acos(Math.min(i,1))}toBounds(t=0){const e=360*t/40075017,r=e/Math.cos(Math.PI/180*this.lat);return new gc({lng:this.lng-r,lat:this.lat-e},{lng:this.lng+r,lat:this.lat+e})}toEcef(t){return dc(this.lat,this.lng,rc+t*rc/fc)}static convert(t){if(t instanceof yc)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new yc(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new yc(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}class gc{constructor(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):Array.isArray(t)&&4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1]))}setNorthEast(t){return this._ne=t instanceof yc?new yc(t.lng,t.lat):yc.convert(t),this}setSouthWest(t){return this._sw=t instanceof yc?new yc(t.lng,t.lat):yc.convert(t),this}extend(t){const e=this._sw,r=this._ne;let n,i;if(t instanceof yc)n=t,i=t;else{if(!(t instanceof gc))return Array.isArray(t)?4===t.length||t.every(Array.isArray)?this.extend(gc.convert(t)):this.extend(yc.convert(t)):"object"==typeof t&&null!==t&&t.hasOwnProperty("lat")&&(t.hasOwnProperty("lon")||t.hasOwnProperty("lng"))?this.extend(yc.convert(t)):this;if(n=t._sw,i=t._ne,!n||!i)return this}return e||r?(e.lng=Math.min(n.lng,e.lng),e.lat=Math.min(n.lat,e.lat),r.lng=Math.max(i.lng,r.lng),r.lat=Math.max(i.lat,r.lat)):(this._sw=new yc(n.lng,n.lat),this._ne=new yc(i.lng,i.lat)),this}getCenter(){return new yc((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new yc(this.getWest(),this.getNorth())}getSouthEast(){return new yc(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(t){const{lng:e,lat:r}=yc.convert(t);let n=this._sw.lng<=e&&e<=this._ne.lng;return this._sw.lng>this._ne.lng&&(n=this._sw.lng>=e&&e>=this._ne.lng),this._sw.lat<=r&&r<=this._ne.lat&&n}static convert(t){if(t)return t instanceof gc?t:new gc(t)}}const xc=0,vc=25.5;function bc(t){return mc*Math.cos(t*Math.PI/180)}function wc(t){return(180+t)/360}function _c(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function Ac(t,e){return t/bc(e)}function Ic(t){return 360*t-180}function Mc(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}function Sc(t,e){return t*bc(Mc(e))}const Pc=85.051129;function kc(t){return Math.cos(Xt(ie(t,-Pc,Pc)))}function Bc(t,e){const r=ie(e,xc,vc),n=Math.pow(2,r);return kc(t)*mc/(512*n)}function zc(t){return 1/Math.cos(t*Math.PI/180)}function Tc(t,e=0){const r=Math.exp(Math.PI*(1-(t.y+e/Ui)/(1<<t.z)*2));return 80150034*r/(r*r+1)/Ui/(1<<t.z)}class Ec{constructor(t,e,r=0){this.x=+t,this.y=+e,this.z=+r}static fromLngLat(t,e=0){const r=yc.convert(t);return new Ec(wc(r.lng),_c(r.lat),Ac(e,r.lat))}toLngLat(){return new yc(Ic(this.x),Mc(this.y))}toAltitude(){return Sc(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/mc*zc(Mc(this.y))}}function Vc(t,e,r,n,i,s,a,o,l){const u=(e+n)/2,c=(r+i)/2,h=new $t(u,c);o(h),function(t,e,r,n,i,s){const a=r-i,o=n-s;return Math.abs((n-e)*a-(r-t)*o)/Math.hypot(a,o)}(h.x,h.y,s.x,s.y,a.x,a.y)>=l?(Vc(t,e,r,u,c,s,h,o,l),Vc(t,u,c,n,i,h,a,o,l)):t.push(a)}function Fc(t,e,r){let n=t[0],i=n.x,s=n.y;e(n);const a=[n];for(let o=1;o<t.length;o++){const l=t[o],{x:u,y:c}=l;e(l),Vc(a,i,s,u,c,n,l,e,r),i=u,s=c,n=l}return a}function Cc(t,e,r,n){if(n(e,r)){const i=e.add(r)._mult(.5);Cc(t,e,i,n),Cc(t,i,r,n)}else t.push(r)}function Dc(t,e){let r=t[0];const n=[r];for(let i=1;i<t.length;i++){const s=t[i];Cc(n,r,s,e),r=s}return n}const Rc=Math.pow(2,14)-1,Lc=-Rc-1;function Oc(t,e){const r=Math.round(t.x*e),n=Math.round(t.y*e);return t.x=ie(r,Lc,Rc),t.y=ie(n,Lc,Rc),(r<t.x||r>t.x+1||n<t.y||n>t.y+1)&&Ae("Geometry exceeds allowed extent, reduce your vector tile buffer size"),t}function Uc(t,e,r){const n=t.loadGeometry(),i=t.extent,s=Ui/i;if(e&&r&&r.projection.isReprojectedInTileSpace){const s=1<<e.z,{scale:a,x:o,y:l,projection:u}=r,c=t=>{const r=Ic((e.x+t.x/i)/s),n=Mc((e.y+t.y/i)/s),c=u.project(r,n);t.x=(c.x*a-o)*i,t.y=(c.y*a-l)*i};for(let e=0;e<n.length;e++)if(1!==t.type)n[e]=Fc(n[e],c,1);else{const t=[];for(const r of n[e])r.x<0||r.x>=i||r.y<0||r.y>=i||(c(r),t.push(r));n[e]=t}}for(const t of n)for(const e of t)Oc(e,s);return n}function Nc(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?Uc(t):[]}}class jc{constructor(t,e,r,n,i){this.properties={},this.extent=r,this.type=0,this.id=void 0,this._pbf=t,this._geometry=-1,this._keys=n,this._values=i,t.readFields($c,this,e)}loadGeometry(){const t=this._pbf;t.pos=this._geometry;const e=t.readVarint()+t.pos,r=[];let n,i=1,s=0,a=0,o=0;for(;t.pos<e;){if(s<=0){const e=t.readVarint();i=7&e,s=e>>3}if(s--,1===i||2===i)a+=t.readSVarint(),o+=t.readSVarint(),1===i&&(n&&r.push(n),n=[]),n&&n.push(new $t(a,o));else{if(7!==i)throw new Error(`unknown command ${i}`);n&&n.push(n[0].clone())}}return n&&r.push(n),r}bbox(){const t=this._pbf;t.pos=this._geometry;const e=t.readVarint()+t.pos;let r=1,n=0,i=0,s=0,a=1/0,o=-1/0,l=1/0,u=-1/0;for(;t.pos<e;){if(n<=0){const e=t.readVarint();r=7&e,n=e>>3}if(n--,1===r||2===r)i+=t.readSVarint(),s+=t.readSVarint(),i<a&&(a=i),i>o&&(o=i),s<l&&(l=s),s>u&&(u=s);else if(7!==r)throw new Error(`unknown command ${r}`)}return[a,l,o,u]}toGeoJSON(t,e,r){const n=this.extent*Math.pow(2,r),i=this.extent*t,s=this.extent*e,a=this.loadGeometry();function o(t){return[360*(t.x+i)/n-180,360/Math.PI*Math.atan(Math.exp((1-2*(t.y+s)/n)*Math.PI))-90]}function l(t){return t.map(o)}let u;if(1===this.type){const t=[];for(const e of a)t.push(e[0]);const e=l(t);u=1===t.length?{type:"Point",coordinates:e[0]}:{type:"MultiPoint",coordinates:e}}else if(2===this.type){const t=a.map(l);u=1===t.length?{type:"LineString",coordinates:t[0]}:{type:"MultiLineString",coordinates:t}}else{if(3!==this.type)throw new Error("unknown feature type");{const t=function(t){const e=t.length;if(e<=1)return[t];const r=[];let n,i;for(let s=0;s<e;s++){const e=Gc(t[s]);0!==e&&(void 0===i&&(i=e<0),i===e<0?(n&&r.push(n),n=[t[s]]):n&&n.push(t[s]))}return n&&r.push(n),r}(a),e=[];for(const r of t)e.push(r.map(l));u=1===e.length?{type:"Polygon",coordinates:e[0]}:{type:"MultiPolygon",coordinates:e}}}const c={type:"Feature",geometry:u,properties:this.properties};return null!=this.id&&(c.id=this.id),c}}function $c(t,e,r){1===t?e.id=r.readVarint():2===t?function(t,e){const r=t.readVarint()+t.pos;for(;t.pos<r;){const r=e._keys[t.readVarint()],n=e._values[t.readVarint()];e.properties[r]=n}}(r,e):3===t?e.type=r.readVarint():4===t&&(e._geometry=r.pos)}function Gc(t){let e=0;for(let r,n,i=0,s=t.length,a=s-1;i<s;a=i++)r=t[i],n=t[a],e+=(n.x-r.x)*(r.y+n.y);return e}jc.types=["Unknown","Point","LineString","Polygon"];class qc{constructor(t,e){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(Hc,this,e),this.length=this._features.length}feature(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];const e=this._pbf.readVarint()+this._pbf.pos;return new jc(this._pbf,e,this.extent,this._keys,this._values)}}function Hc(t,e,r){15===t?e.version=r.readVarint():1===t?e.name=r.readString():5===t?e.extent=r.readVarint():2===t?e._features.push(r.pos):3===t?e._keys.push(r.readString()):4===t&&e._values.push(function(t){let e=null;const r=t.readVarint()+t.pos;for(;t.pos<r;){const r=t.readVarint()>>3;e=1===r?t.readString():2===r?t.readFloat():3===r?t.readDouble():4===r?t.readVarint64():5===r?t.readVarint():6===r?t.readSVarint():7===r?t.readBoolean():null}if(null==e)throw new Error("unknown feature value");return e}(r))}class Xc{constructor(t,e){this.layers=t.readFields(Zc,{},e)}}function Zc(t,e,r){if(3===t){const t=new qc(r,r.readVarint()+r.pos);t.length&&(e[t.name]=t)}}const Wc="3d_elevation_id",Yc="level",Kc="hd_road_elevation";class Jc{constructor(){this._valid=!1}reset(t){return this.feature=t,this._valid=!0,this._geometry=t.loadGeometry(),0!==this._geometry.length&&0!==this._geometry[0].length||(this._valid=!1),this}geometry(t,e){return this._valid&&t(e(this._geometry)),this}require(t,e,r){return this.get(t,!0,e,r)}optional(t,e,r){return this.get(t,!1,e,r)}success(){return this._valid}get(t,e,r,n){const i=this.feature.properties.hasOwnProperty(t)?+this.feature.properties[t]:void 0;return this._valid&&void 0!==i&&!Number.isNaN(i)?r(n?n(i):i):e&&(this._valid=!1),this}}class Qc{constructor(t,e){this.featureFunc=t,this.vertexFunc=e}parseFeature(t,e,r){return this.featureFunc(t,e,r)}parseVertex(t,e,r){return this.vertexFunc(t,e,r)}}const th=new Qc(((t,e,r)=>t.reset(e).require(Wc,(t=>{r.id=t})).optional("fixed_height_relative",(t=>{r.constantHeight=t}),rh.decodeRelativeHeight).geometry((t=>{r.bounds=t}),xi).success()),((t,e,r)=>t.reset(e).require(Wc,(t=>{r.id=t})).require("elevation_idx",(t=>{r.idx=t})).require("extent",(t=>{r.extent=t})).require("height_relative",(t=>{r.height=t}),rh.decodeRelativeHeight).geometry((t=>{r.position=t}),rh.getPoint).success())),eh=new Qc(((t,e,r)=>t.reset(e).require(Wc,(t=>{r.id=t})).optional("fixed_height",(t=>{r.constantHeight=t}),rh.decodeMetricHeight).geometry((t=>{r.bounds=t}),xi).success()),((t,e,r)=>t.reset(e).require(Wc,(t=>{r.id=t})).require("elevation_idx",(t=>{r.idx=t})).require("extent",(t=>{r.extent=t})).require("height",(t=>{r.height=t}),rh.decodeMetricHeight).geometry((t=>{r.position=t}),rh.getPoint).success()));class rh{static getPoint(t){return Bt(t[0][0].x,t[0][0].y)}static decodeRelativeHeight(t){return 1e-4*t*5}static decodeMetricHeight(t){return 1e-4*t}static getVersionSchema(t){return t?"1.0.1"===t?eh:void 0:th}static parse(t){const e=[],r=[],n=t.length,i=new Jc;for(let s=0;s<n;s++){const n=t.feature(s),a=n.properties.version,o=rh.getVersionSchema(a);if(void 0===o){Ae(`Unknown elevation feature version number ${a||"(unknown)"}`);continue}const l=n.properties.type;if(!l)continue;const u=jc.types[n.type];if("Point"===u&&"curve_point"===l){const t={};o.parseVertex(i,n,t)&&e.push(t)}else if("Polygon"===u&&"curve_meta"===l){const t={};o.parseFeature(i,n,t)&&r.push(t)}}return{vertices:e,features:r}}}class nh{constructor(t,e){this.pos=t,this.dir=e}intersectsPlane(t,e,r){const n=Dt(e,this.dir);if(Math.abs(n)<1e-6)return!1;const i=((t[0]-this.pos[0])*e[0]+(t[1]-this.pos[1])*e[1])/n;return r[0]=this.pos[0]+this.dir[0]*i,r[1]=this.pos[1]+this.dir[1]*i,!0}}class ih{constructor(t,e){this.pos=t,this.dir=e}intersectsPlane(t,e,r){const n=Z(e,this.dir);if(Math.abs(n)<1e-6)return!1;const i=((t[0]-this.pos[0])*e[0]+(t[1]-this.pos[1])*e[1]+(t[2]-this.pos[2])*e[2])/n;return r[0]=this.pos[0]+this.dir[0]*i,r[1]=this.pos[1]+this.dir[1]*i,r[2]=this.pos[2]+this.dir[2]*i,!0}closestPointOnSphere(e,r,n){if(function(e,r){var n=e[0],i=e[1],s=e[2],a=r[0],o=r[1],l=r[2];return Math.abs(n-a)<=t*Math.max(1,Math.abs(n),Math.abs(a))&&Math.abs(i-o)<=t*Math.max(1,Math.abs(i),Math.abs(o))&&Math.abs(s-l)<=t*Math.max(1,Math.abs(s),Math.abs(l))}(this.pos,e)||0===r)return n[0]=n[1]=n[2]=0,!1;const[i,s,a]=this.dir,o=this.pos[0]-e[0],l=this.pos[1]-e[1],u=this.pos[2]-e[2],c=i*i+s*s+a*a,h=2*(o*i+l*s+u*a),p=h*h-4*c*(o*o+l*l+u*u-r*r);if(p<0){const t=Math.max(-h/2,0),e=o+i*t,c=l+s*t,p=u+a*t,d=Math.hypot(e,c,p);return n[0]=e*r/d,n[1]=c*r/d,n[2]=p*r/d,!1}{const t=(-h-Math.sqrt(p))/(2*c);if(t<0){const t=Math.hypot(o,l,u);return n[0]=o*r/t,n[1]=l*r/t,n[2]=u*r/t,!1}return n[0]=o+i*t,n[1]=l+s*t,n[2]=u+a*t,!0}}}class sh{constructor(t,e,r,n,i){this.TL=t,this.TR=e,this.BR=r,this.BL=n,this.horizon=i}static fromInvProjectionMatrix(t,e,r){const n=[-1,1,1],i=[1,1,1],s=[1,-1,1],a=[-1,-1,1],o=K(n,n,t),l=K(i,i,t),u=K(s,s,t),c=K(a,a,t);return new sh(o,l,u,c,e/r)}}function ah(t,e,r){let n=1/0,i=-1/0;const s=[];for(const a of t){rt(s,a,e);const t=Z(s,r);n=Math.min(n,t),i=Math.max(i,t)}return[n,i]}function oh(t,e){let r=!0;for(let n=0;n<t.planes.length;n++){const i=t.planes[n];let s=0;for(let t=0;t<e.length;t++)s+=+(Z(i,e[t])+i[3]>=0);if(0===s)return 0;s!==e.length&&(r=!1)}return r?2:1}function lh(t,e){for(const r of t.projections){const n=ah(e,t.points[0],r.axis);if(r.projection[1]<n[0]||r.projection[0]>n[1])return 0}return 1}const uh=2,ch=3,hh=6,ph=7;function dh(t,e){let r=0;const n=[0,0,0,0];for(let a=0;a<t.length;a++)n[0]=t[a][0],n[1]=t[a][1],n[2]=t[a][2],n[3]=1,(i=n)[0]*(s=e)[0]+i[1]*s[1]+i[2]*s[2]+i[3]*s[3]>=0&&r++;var i,s;return r}class fh{constructor(t,e){this.points=t||new Array(8).fill([0,0,0]),this.planes=e||new Array(6).fill([0,0,0,0]),this.bounds=mh.fromPoints(this.points),this.projections=[],this.frustumEdges=[rt([],this.points[2],this.points[3]),rt([],this.points[0],this.points[3]),rt([],this.points[4],this.points[0]),rt([],this.points[5],this.points[1]),rt([],this.points[6],this.points[2]),rt([],this.points[7],this.points[3])];for(const t of this.frustumEdges){const e=[0,-t[2],t[1]],r=[t[2],0,-t[0]];this.projections.push({axis:e,projection:ah(this.points,this.points[0],e)}),this.projections.push({axis:r,projection:ah(this.points,this.points[0],r)})}}static fromInvProjectionMatrix(t,e,r,n){const i=Math.pow(2,r),s=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map((r=>{const s=dt([],r,t),a=1/s[3]/e*i;return(o=s)[0]=(l=s)[0]*(u=[a,a,n?1/s[3]:a,a])[0],o[1]=l[1]*u[1],o[2]=l[2]*u[2],o[3]=l[3]*u[3],o;var o,l,u})),a=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map((t=>{const e=X([],W([],rt([],s[t[0]],s[t[1]]),rt([],s[t[2]],s[t[1]]))),r=-Z(e,s[t[1]]);return e.concat(r)})),o=[];for(let t=0;t<s.length;t++)o.push([s[t][0],s[t][1],s[t][2]]);return new fh(o,a)}intersectsPrecise(t,e,r){for(let r=0;r<e.length;r++)if(!dh(t,e[r]))return 0;for(let e=0;e<this.planes.length;e++)if(!dh(t,this.planes[e]))return 0;for(const e of r)for(const r of this.frustumEdges){const n=W([],e,r),i=V(n);if(0===i)continue;N(n,n,1/i);const s=ah(this.points,this.points[0],n),a=ah(t,this.points[0],n);if(s[0]>a[1]||a[0]>s[1])return 0}return 1}containsPoint(t){for(const e of this.planes){const r=e[3];if(Z([e[0],e[1],e[2]],t)+r<0)return!1}return!0}}class mh{static fromPoints(t){const e=[1/0,1/0,1/0],r=[-1/0,-1/0,-1/0];for(const n of t)O(e,e,n),U(r,r,n);return new mh(e,r)}static fromTileIdAndHeight(t,e,r){const n=1<<t.canonical.z,i=t.canonical.x,s=t.canonical.y;return new mh([i/n,s/n,e],[(i+1)/n,(s+1)/n,r])}static applyTransform(t,e){const r=t.getCorners();for(let t=0;t<r.length;++t)K(r[t],r[t],e);return mh.fromPoints(r)}static applyTransformFast(t,e){const r=[e[12],e[13],e[14]],n=[...r];for(let i=0;i<3;i++)for(let s=0;s<3;s++){const a=e[4*s+i],o=a*t.min[s],l=a*t.max[s];r[i]+=Math.min(o,l),n[i]+=Math.max(o,l)}return new mh(r,n)}static projectAabbCorners(t,e){const r=t.getCorners();for(let t=0;t<r.length;++t)K(r[t],r[t],e);return r}constructor(t,e){this.min=t,this.max=e,this.center=N([],D([],this.min,this.max),.5)}quadrant(t){const e=[t%2==0,t<2],r=E(this.min),n=E(this.max);for(let t=0;t<e.length;t++)r[t]=e[t]?this.min[t]:this.center[t],n[t]=e[t]?this.center[t]:this.max[t];return n[2]=this.max[2],new mh(r,n)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}distanceZ(t){return Math.max(Math.min(this.max[2],t[2]),this.min[2])-t[2]}getCorners(){const t=this.min,e=this.max;return[[t[0],t[1],t[2]],[e[0],t[1],t[2]],[e[0],e[1],t[2]],[t[0],e[1],t[2]],[t[0],t[1],e[2]],[e[0],t[1],e[2]],[e[0],e[1],e[2]],[t[0],e[1],e[2]]]}intersects(t){return this.intersectsAabb(t.bounds)?oh(t,this.getCorners()):0}intersectsFlat(t){return this.intersectsAabb(t.bounds)?oh(t,[[this.min[0],this.min[1],0],[this.max[0],this.min[1],0],[this.max[0],this.max[1],0],[this.min[0],this.max[1],0]]):0}intersectsPrecise(t,e){return e||this.intersects(t)?lh(t,this.getCorners()):0}intersectsPreciseFlat(t,e){return e||this.intersectsFlat(t)?lh(t,[[this.min[0],this.min[1],0],[this.max[0],this.min[1],0],[this.max[0],this.max[1],0],[this.min[0],this.max[1],0]]):0}intersectsAabb(t){for(let e=0;e<3;++e)if(this.min[e]>t.max[e]||t.min[e]>this.max[e])return!1;return!0}intersectsAabbXY(t){return!(this.min[0]>t.max[0]||t.min[0]>this.max[0]||this.min[1]>t.max[1]||t.min[1]>this.max[1])}encapsulate(t){for(let e=0;e<3;e++)this.min[e]=Math.min(this.min[e],t.min[e]),this.max[e]=Math.max(this.max[e],t.max[e])}encapsulatePoint(t){for(let e=0;e<3;e++)this.min[e]=Math.min(this.min[e],t[e]),this.max[e]=Math.max(this.max[e],t[e])}closestPoint(t){return[Math.max(Math.min(this.max[0],t[0]),this.min[0]),Math.max(Math.min(this.max[1],t[1]),this.min[1]),Math.max(Math.min(this.max[2],t[2]),this.min[2])]}}Qa(mh,"Aabb");class yh{constructor(t,e){this.feature=t,this.metersToTile=e,this.index=0}get(){const t=this.feature.vertices[this.index],e=this.feature.vertexProps[this.index].dir,r=e[1],n=-e[0],i=(t.extent+1)*this.metersToTile;return[new $t(Math.trunc(t.position[0]+r*i),Math.trunc(t.position[1]+n*i)),new $t(Math.trunc(t.position[0]-r*i),Math.trunc(t.position[1]-n*i))]}next(){this.index++}valid(){return this.index<this.feature.vertices.length}}class gh{constructor(t,e,r,n,i,s){if(this.vertices=new Array,this.vertexProps=new Array,this.edges=new Array,this.edgeProps=new Array,this._tmpVec2=[kt(),kt(),kt(),kt(),kt(),kt(),kt()],this.id=t,this.heightRange={min:r,max:r},this.safeArea=e,this.constantHeight=r,null==this.constantHeight&&(null!=this.constantHeight||0!==n.length)){this.vertices=n,this.edges=i,this.edges=this.edges.filter((t=>{return t.a<this.vertices.length&&t.b<this.vertices.length&&!((e=this.vertices[t.a].position)[0]===(r=this.vertices[t.b].position)[0]&&e[1]===r[1]);var e,r})),this.heightRange={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};for(const t of this.vertices)this.vertexProps.push({dir:Bt(0,0)}),this.heightRange.min=Math.min(this.heightRange.min,t.height),this.heightRange.max=Math.max(this.heightRange.max,t.height);for(const t of this.edges){const e=this.vertices[t.a].position,r=this.vertices[t.b].position,n=Et(kt(),r,e),i=Ft(n),s=Vt(kt(),n,1/i);this.edgeProps.push({vec:n,dir:s,len:i});const a=this.vertexProps[t.a].dir,o=this.vertexProps[t.b].dir;Tt(a,a,s),Tt(o,o,s)}for(const t of this.vertexProps)0===t.dir[0]&&0===t.dir[1]||Ct(t.dir,t.dir);this.tessellate(s)}}pointElevation(t){if(null!=this.constantHeight)return this.constantHeight;const e=this.getClosestEdge(t);if(null==e)return 0;const[r,n]=e;return dn(this.vertices[this.edges[r].a].height,this.vertices[this.edges[r].b].height,n)}computeSlopeNormal(t,e){const r=this.getClosestEdge(t);if(!r)return F(0,0,1);const n=r[0],i=this.edges[n],s=this.edgeProps[n].vec,a=F(s[0],s[1],(this.vertices[i.b].height-this.vertices[i.a].height)*e),o=F(a[1],-a[0],0);W(o,o,a);const l=V(o);return l>0?N(o,o,1/l):C(o,0,0,1)}getSafeArea(){return this.safeArea}isTunnel(){return this.heightRange.max<=-5}getClosestEdge(t){if(0===this.edges.length)return;let e=0,r=Number.POSITIVE_INFINITY,n=0;const[i,s,a,o,l,u,c]=this._tmpVec2;zt(c,t.x,t.y);const h=new nh(c,null);for(let t=0;t<this.edges.length;t++){const p=this.edges[t],d=this.edgeProps[t].dir;h.dir=d;const f=this.vertices[p.a].position,m=this.vertices[p.b].position,y=h.intersectsPlane(f,this.vertexProps[p.a].dir,i),g=h.intersectsPlane(m,this.vertexProps[p.b].dir,s);if(!y||!g)continue;Et(a,s,i),Et(o,c,i);const x=Dt(a,a),v=x>0?Dt(o,a)/x:0,b=ie(v,0,1),w=Math.abs((v-b)*this.edgeProps[t].len);Et(l,c,f),zt(u,d[1],-d[0]);const _=w+Math.abs(Dt(l,u));_<r&&(e=t,r=_,n=b)}return[e,n]}tessellate(t){const e=T(),r=T(),n=T(),i=T();for(let s=this.edges.length-1;s>=0;--s){const a=this.edges[s].a,o=this.edges[s].b,{position:l,height:u,extent:c}=this.vertices[a],{position:h,height:p,extent:d}=this.vertices[o],f=this.vertexProps[a].dir,m=this.vertexProps[o].dir;if(C(e,l[0]/t,l[1]/t,u),C(r,h[0]/t,h[1]/t,p),C(n,f[1],-f[0],0),N(n,n,c),C(i,m[1],-m[0],0),N(i,i,d),this.distSqLines(F(e[0]+.5*n[0],e[1]+.5*n[1],e[2]+.5*n[2]),F(r[0]-.5*i[0],r[1]-.5*i[1],r[2]-.5*i[2]),F(e[0]-.5*n[0],e[1]-.5*n[1],e[2]-.5*n[2]),F(r[0]+.5*i[0],r[1]+.5*i[1],r[2]+.5*i[2]))<=.0025000000000000005)continue;const y=this.vertices.length,g=Tt(kt(),l,h);this.vertices.push({position:Vt(g,g,.5),height:.5*(u+p),extent:.5*(c+d)});const x=Tt(kt(),f,m);this.vertexProps.push({dir:Ct(x,x)}),this.edges.splice(s,1),this.edgeProps.splice(s,1),this.edges.push({a,b:y}),this.edges.push({a:y,b:o});const v=Et(kt(),this.vertices[y].position,l),b=Ft(v),w={vec:v,dir:Vt(kt(),v,1/b),len:b};this.edgeProps.push(w),this.edgeProps.push(w)}}distSqLines(t,e,r,n){const i=R(T(),e,t),s=R(T(),n,r),a=R(T(),t,r),o=Z(i,i),l=Z(i,s),u=Z(i,a),c=Z(s,s),h=Z(s,a),p=o*c-l*l;if(0===p)return G(Y(i,r,n,Z(a,s)/Z(s,s)),t);const d=(o*h-l*u)/p;return G(Y(i,t,e,(l*h-u*c)/p),Y(s,r,n,d))}}class xh{static parseFrom(t,e){const r=rh.parse(t);if(!r)return[];let{vertices:n,features:i}=r;const s=1/Tc(e);i.sort(((t,e)=>t.id-e.id)),n.sort(((t,e)=>t.id-e.id||t.idx-e.idx)),n=n.filter(((t,e,r)=>e===r.findIndex((e=>e.id===t.id&&e.idx===t.idx))));const a=new Array;let o=0;const l=n.length;for(const t of i){if(t.constantHeight){a.push(new gh(t.id,t.bounds,t.constantHeight));continue}for(;o!==l&&n[o].id<t.id;)o++;if(o===l||n[o].id!==t.id)continue;const e=new Array,r=new Array,i=o;for(;o!==l&&n[o].id===t.id;){const t=n[o];if(e.push({position:t.position,height:t.height,extent:t.extent}),o!==i&&n[o-1].idx===t.idx-1){const t=o-i;r.push({a:t-1,b:t})}o++}a.push(new gh(t.id,t.bounds,void 0,e,r,s))}return a}static getElevationFeature(t,e){if(!e)return;const r=+t.properties[Wc];return Number.isNaN(r)?void 0:e.find((t=>t.id===r))}}class vh{constructor(t,e){this.zScale=1,this.xOffset=0,this.yOffset=0,t.equals(e)||(this.zScale=Math.pow(2,e.z-t.z),this.xOffset=(t.x*this.zScale-e.x)*Ui,this.yOffset=(t.y*this.zScale-e.y)*Ui)}constantElevation(t,e){if(null!=t.constantHeight)return this.computeBiasedHeight(t.constantHeight,e)}pointElevation(t,e,r){const n=this.constantElevation(e,r);return null!=n?n:(t.x=t.x*this.zScale+this.xOffset,t.y=t.y*this.zScale+this.yOffset,this.computeBiasedHeight(e.pointElevation(t),r))}computeBiasedHeight(t,e){return e<=0?t:t+e*se(0,e,t>=0?t:Math.abs(.5*t))}}Qa(gh,"ElevationFeature");class bh{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.fqid)),this.index=t.index,this.hasPattern=!1,this.projection=t.projection,this.layoutVertexArray=new _l,this.indexArray=new $l,this.segments=new bu,this.programConfigurations=new Yu(t.layers,{zoom:t.zoom,lut:t.lut}),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.elevationMode=this.layers[0].layout.get("circle-elevation-reference"),this.hasElevation=!1,"none"!==this.elevationMode&&(this.elevatedLayoutVertexArray=new Ml),this.worldview=t.worldview,this.hasAppearances=null}updateFootprints(t,e){}updateAppearances(t,e,r,n){}populate(t,e,r,n){const i=this.layers[0],s=[];let a=null;"circle"===i.type&&(a=i.layout.get("circle-sort-key"));for(const{feature:i,id:o,index:l,sourceLayerIndex:u}of t){const t=this.layers[0]._featureFilter.needGeometry,c=Nc(i,t);if(!this.layers[0]._featureFilter.filter(new Po(this.zoom,{worldview:this.worldview,activeFloors:e.activeFloors}),c,r))continue;const h=a?a.evaluate(c,{},r):void 0,p={id:o,properties:i.properties,type:i.type,sourceLayerIndex:u,index:l,geometry:t?c.geometry:Uc(i,r,n),patterns:{},sortKey:h};s.push(p)}a&&s.sort(((t,e)=>t.sortKey-e.sortKey));let o=null;"globe"===n.projection.name&&(this.globeExtVertexArray=new Vl,o=n.projection);for(const n of s){const{geometry:i,index:s,sourceLayerIndex:a}=n,l=t[s].feature;this.addFeature(n,i,s,e.availableImages,r,o,e.brightness,e.elevationFeatures),e.featureIndex.insert(l,i,s,a,this.index)}this.hasElevation||(this.elevatedLayoutVertexArray=void 0)}update(t,e,r,n,i,s,a){this.programConfigurations.updatePaintArrays(t,e,i,r,n,s,a,this.worldview)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,gu.members),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=t.createVertexBuffer(this.globeExtVertexArray,vu.members)),this.elevatedLayoutVertexArray&&(this.elevatedLayoutVertexBuffer=t.createVertexBuffer(this.elevatedLayoutVertexArray,xu.members))),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy())}addFeature(t,e,r,n,i,s,a,o){let l;"none"!==this.elevationMode&&(l=xh.getElevationFeature(t,o));for(const r of e)for(const e of r){const r=e.x,n=e.y;if(r<0||r>=Ui||n<0||n>=Ui)continue;if(s){const t=s.projectTilePoint(r,n,i),e=s.upVector(i,r,n);this.addGlobeExtVertex(t,e),this.addGlobeExtVertex(t,e),this.addGlobeExtVertex(t,e),this.addGlobeExtVertex(t,e)}const a=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),o=a.vertexLength;if(this.addCircleVertex(r,n,-1,-1),this.addCircleVertex(r,n,1,-1),this.addCircleVertex(r,n,1,1),this.addCircleVertex(r,n,-1,1),"none"!==this.elevationMode){const t=l?l.pointElevation(new $t(r,n)):0;this.hasElevation=this.hasElevation||0!==t;for(let e=0;e<4;e++)this.elevatedLayoutVertexArray.emplaceBack(t)}this.indexArray.emplaceBack(o,o+1,o+2),this.indexArray.emplaceBack(o,o+2,o+3),a.vertexLength+=4,a.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{},n,i,a,void 0,this.worldview)}addCircleVertex(t,e,r,n){this.layoutVertexArray.emplaceBack(2*t+(r+1)/2,2*e+(n+1)/2)}addGlobeExtVertex(t,e){const r=16384;this.globeExtVertexArray.emplaceBack(t.x,t.y,t.z,e[0]*r,e[1]*r,e[2]*r)}}function wh(t,e){for(let r=0;r<t.length;r++)if(Eh(e,t[r]))return!0;for(let r=0;r<e.length;r++)if(Eh(t,e[r]))return!0;return!!Mh(t,e)}function _h(t,e,r){return!!Eh(t,e)||!!Bh(e,t,r)}function Ah(t,e){if(1===t.length)return Th(e,t[0]);for(let r=0;r<e.length;r++){const n=e[r];for(let e=0;e<n.length;e++)if(Eh(t,n[e]))return!0}for(let r=0;r<t.length;r++)if(Th(e,t[r]))return!0;for(let r=0;r<e.length;r++)if(Mh(t,e[r]))return!0;return!1}function Ih(t,e,r){if(t.length>1){if(Mh(t,e))return!0;for(let n=0;n<e.length;n++)if(Bh(e[n],t,r))return!0}for(let n=0;n<t.length;n++)if(Bh(t[n],e,r))return!0;return!1}function Mh(t,e){if(0===t.length||0===e.length)return!1;for(let r=0;r<t.length-1;r++){const n=t[r],i=t[r+1];for(let t=0;t<e.length-1;t++)if(Sh(n,i,e[t],e[t+1]))return!0}return!1}function Sh(t,e,r,n){return Ie(t,r,n)!==Ie(e,r,n)&&Ie(t,e,r)!==Ie(t,e,n)}function Ph(t,e,r){return(t.x-r.x)*(e.y-r.y)-(t.y-r.y)*(e.x-r.x)}function kh(t,e,r,n){const i=Ph(t,e,n),s=Ph(t,e,r);if(Math.sign(i)===Math.sign(s))return;const a=Ph(r,n,t),o=a+s-i;return Math.sign(a)!==Math.sign(o)?[a/(a-o),s/(s-i)]:void 0}function Bh(t,e,r){const n=r*r;if(1===e.length)return t.distSqr(e[0])<n;for(let r=1;r<e.length;r++)if(zh(t,e[r-1],e[r])<n)return!0;return!1}function zh(t,e,r){const n=e.distSqr(r);if(0===n)return t.distSqr(e);const i=((t.x-e.x)*(r.x-e.x)+(t.y-e.y)*(r.y-e.y))/n;return t.distSqr(i<0?e:i>1?r:r.sub(e)._mult(i)._add(e))}function Th(t,e){let r,n,i,s=!1;for(let a=0;a<t.length;a++){r=t[a];for(let t=0,a=r.length-1;t<r.length;a=t++)n=r[t],i=r[a],n.y>e.y!=i.y>e.y&&e.x<(i.x-n.x)*(e.y-n.y)/(i.y-n.y)+n.x&&(s=!s)}return s}function Eh(t,e){let r=!1;for(let n=0,i=t.length-1;n<t.length;i=n++){const s=t[n],a=t[i];s.y>e.y!=a.y>e.y&&e.x<(a.x-s.x)*(e.y-s.y)/(a.y-s.y)+s.x&&(r=!r)}return r}function Vh(t,e,r,n,i){for(const s of t)if(e<=s.x&&r<=s.y&&n>=s.x&&i>=s.y)return!0;const s=[new $t(e,r),new $t(e,i),new $t(n,i),new $t(n,r)];if(t.length>2)for(const e of s)if(Eh(t,e))return!0;for(let e=0;e<t.length-1;e++)if(Fh(t[e],t[e+1],s))return!0;return!1}function Fh(t,e,r){const n=r[0],i=r[2];if(t.x<n.x&&e.x<n.x||t.x>i.x&&e.x>i.x||t.y<n.y&&e.y<n.y||t.y>i.y&&e.y>i.y)return!1;const s=Ie(t,e,r[0]);return s!==Ie(t,e,r[1])||s!==Ie(t,e,r[2])||s!==Ie(t,e,r[3])}function Ch(t,e,r,n,i,s){let a=e.y-t.y,o=t.x-e.x;if(s=s||0){const t=a*a+o*o;if(0===t)return!0;const e=Math.sqrt(t);a/=e,o/=e}return!((r.x-t.x)*a+(r.y-t.y)*o-s<0||(n.x-t.x)*a+(n.y-t.y)*o-s<0||(i.x-t.x)*a+(i.y-t.y)*o-s<0)}function Dh(t,e,r,n,i,s,a){return!(Ch(t,e,n,i,s,a)||Ch(e,r,n,i,s,a)||Ch(r,t,n,i,s,a)||Ch(n,i,t,e,r,a)||Ch(i,s,t,e,r,a)||Ch(s,n,t,e,r,a))}function Rh(t,e,r){const n=e.paint.get(t).value;return"constant"===n.kind?n.value:r.programConfigurations.get(e.id).getMaxValue(t)}function Lh(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Oh(t,e,r,n,i){if(!e[0]&&!e[1])return t;const s=$t.convert(e)._mult(i);"viewport"===r&&s._rotate(-n);const a=[];for(let e=0;e<t.length;e++)a.push(t[e].sub(s));return a}function Uh(t,e,r,n){const i=$t.convert(t)._mult(n);return"viewport"===e&&i._rotate(-r),i}let Nh,jh;function $h(t,e,r){var n=2*Math.PI*6378137/256/Math.pow(2,r);return[t*n-2*Math.PI*6378137/2,e*n-2*Math.PI*6378137/2]}Qa(bh,"CircleBucket",{omit:["layers"]});class Gh{constructor(t,e,r){this.z=t,this.x=e,this.y=r,this.key=Xh(0,t,t,e,r)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}isChildOf(t){const e=this.z-t.z;return 0===t.z||t.z<this.z&&t.x===this.x>>e&&t.y===this.y>>e}url(t,e){const r=function(t,e,r){var n=$h(256*t,256*(e=Math.pow(2,r)-e-1),r),i=$h(256*(t+1),256*(e+1),r);return n[0]+","+n[1]+","+i[0]+","+i[1]}(this.x,this.y,this.z),n=function(t,e,r){let n,i="";for(let s=t;s>0;s--)n=1<<s-1,i+=(e&n?1:0)+(r&n?2:0);return i}(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace("{prefix}",(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"===e?Math.pow(2,this.z)-this.y-1:this.y)).replace("{quadkey}",n).replace("{bbox-epsg-3857}",r)}toString(){return`${this.z}/${this.x}/${this.y}`}}class qh{constructor(t,e){this.wrap=t,this.canonical=e,this.key=Xh(t,e.z,e.z,e.x,e.y)}}class Hh{constructor(t,e,r,n,i){this.overscaledZ=t,this.wrap=e,this.canonical=new Gh(r,+n,+i),this.key=0===e&&t===r?this.canonical.key:Xh(e,t,r,n,i)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){const e=this.canonical.z-t;return t>this.canonical.z?new Hh(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Hh(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)}calculateScaledKey(t,e=!0){if(this.overscaledZ===t&&e)return this.key;if(t>this.canonical.z)return Xh(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y);{const r=this.canonical.z-t;return Xh(this.wrap*+e,t,t,this.canonical.x>>r,this.canonical.y>>r)}}isChildOf(t){if(t.wrap!==this.wrap)return!1;const e=this.canonical.z-t.canonical.z;return 0===t.overscaledZ||t.overscaledZ<this.overscaledZ&&t.canonical.z<this.canonical.z&&t.canonical.x===this.canonical.x>>e&&t.canonical.y===this.canonical.y>>e}children(t){if(this.overscaledZ>=t)return[new Hh(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const e=this.canonical.z+1,r=2*this.canonical.x,n=2*this.canonical.y;return[new Hh(e,this.wrap,e,r,n),new Hh(e,this.wrap,e,r+1,n),new Hh(e,this.wrap,e,r,n+1),new Hh(e,this.wrap,e,r+1,n+1)]}isLessThan(t){return this.wrap<t.wrap||!(this.wrap>t.wrap)&&(this.overscaledZ<t.overscaledZ||!(this.overscaledZ>t.overscaledZ)&&(this.canonical.x<t.canonical.x||!(this.canonical.x>t.canonical.x)&&this.canonical.y<t.canonical.y))}wrapped(){return new Hh(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new Hh(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new qh(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}}function Xh(t,e,r,n,i){const s=1<<Math.min(r,22);let a=s*(i%s)+n%s;return t&&r<22&&(a+=s*s*((t<0?-2*t-1:2*t)%(1<<2*(22-r)))),16*(32*a+r)+(e-r)}const Zh=[t=>{let e=t.canonical.x-1,r=t.wrap;return e<0&&(e=(1<<t.canonical.z)-1,r--),new Hh(t.overscaledZ,r,t.canonical.z,e,t.canonical.y)},t=>{let e=t.canonical.x+1,r=t.wrap;return e===1<<t.canonical.z&&(e=0,r++),new Hh(t.overscaledZ,r,t.canonical.z,e,t.canonical.y)},t=>new Hh(t.overscaledZ,t.wrap,t.canonical.z,t.canonical.x,(0===t.canonical.y?1<<t.canonical.z:t.canonical.y)-1),t=>new Hh(t.overscaledZ,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y===(1<<t.canonical.z)-1?0:t.canonical.y+1)];Qa(Gh,"CanonicalTileID"),Qa(Hh,"OverscaledTileID",{omit:["projMatrix","expandedProjMatrix"]});const Wh=bl([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),{members:Yh}=Wh,Kh=bl([{name:"a_pos_3",components:3,type:"Int16"}]),Jh=bl([{name:"a_pos",type:"Int16",components:2}]);function Qh(t){return t*rc/fc}const tp=[new mh([uc,uc,uc],[cc,cc,cc]),new mh([uc,uc,uc],[0,0,cc]),new mh([0,uc,uc],[cc,0,cc]),new mh([uc,0,uc],[0,cc,cc]),new mh([0,0,uc],[cc,cc,cc])];function ep(t,e,r,n=!0){const i=N([],t._camera.position,t.worldSize),s=[e,r,1,1];dt(s,s,t.pixelMatrixInverse),ct(s,s,1/s[3]);const a=X([],rt([],s,i)),o=t.globeMatrix,l=[o[12],o[13],o[14]],u=rt([],l,i),c=V(u),h=X([],u),p=t.worldSize/(2*Math.PI),d=Z(h,a),f=Math.asin(p/c);if(f<Math.acos(d)){if(!n)return null;const t=[],e=[];N(t,a,c/d),X(e,rt(e,t,u)),X(a,D(a,u,N(a,e,Math.tan(f)*c)))}const m=[];new ih(i,a).closestPointOnSphere(l,p,m);const y=X([],Re(o,0)),g=X([],Re(o,1)),x=X([],Re(o,2)),v=Z(y,m),b=Z(g,m),w=Z(x,m),_=Zt(Math.asin(-b/p));let A=Zt(Math.atan2(v,w));A=t.center.lng+function(t,e){const r=(e-t+180)%360-180;return r<-180?r+360:r}(t.center.lng,A);const I=wc(A),M=ie(_c(_),0,1);return new Ec(I,M)}class rp{constructor(t,e,r){this.a=rt([],t,r),this.b=rt([],e,r),this.center=r;const n=X([],this.a),i=X([],this.b);this.angle=Math.acos(Z(n,i))}}function np(t,e){if(0===t.angle)return null;let r;return r=0===t.a[e]?1/t.angle*.5*Math.PI:1/t.angle*Math.atan(t.b[e]/t.a[e]/Math.sin(t.angle)-1/Math.tan(t.angle)),r<0||r>1?null:function(t,e,r,n){const i=Math.sin(r);return t*(Math.sin((1-n)*r)/i)+e*(Math.sin(n*r)/i)}(t.a[e],t.b[e],t.angle,ie(r,0,1))+t.center[e]}function ip(t){if(t.z<=1)return tp[t.z+2*t.y+t.x];const e=cp(up(t));return mh.fromPoints(e)}function sp(t,e,r){return N(t,t,1-r),j(t,t,e,r)}function ap(t,e){const r=Ap(e.zoom);if(0===r)return ip(t);const n=up(t),i=cp(n),s=wc(n.getWest())*e.worldSize,a=wc(n.getEast())*e.worldSize,o=_c(n.getNorth())*e.worldSize,l=_c(n.getSouth())*e.worldSize,u=[s,o,0],c=[a,o,0],h=[s,l,0],p=[a,l,0],d=y([],e.globeMatrix);return K(u,u,d),K(c,c,d),K(h,h,d),K(p,p,d),i[0]=sp(i[0],h,r),i[1]=sp(i[1],p,r),i[2]=sp(i[2],c,r),i[3]=sp(i[3],u,r),mh.fromPoints(i)}function op(t,e,r){for(const n of t)K(n,n,e),N(n,n,r)}function lp(t,e,r,n){const i=e/t.worldSize,s=t.globeMatrix;if(r.z<=1){const t=ip(r).getCorners();return op(t,s,i),mh.fromPoints(t)}const a=up(r,n),o=cp(a,rc+Qh(t._tileCoverLift));op(o,s,i);const l=Number.MAX_VALUE,u=[-l,-l,-l],c=[l,l,l];if(a.contains(t.center)){for(const t of o)O(c,c,t),U(u,u,t);u[2]=0;const e=t.point,r=[e.x*i,e.y*i,0];return O(c,c,r),U(u,u,r),new mh(c,u)}if(t._tileCoverLift>0){for(const t of o)O(c,c,t),U(u,u,t);return new mh(c,u)}const h=[s[12]*i,s[13]*i,s[14]*i],p=a.getCenter(),d=ie(t.center.lat,-Pc,Pc),f=ie(p.lat,-Pc,Pc),m=wc(t.center.lng),y=_c(d);let g=m-wc(p.lng);const x=y-_c(f);g>.5?g-=1:g<-.5&&(g+=1);let v=0;Math.abs(g)>Math.abs(x)?v=g>=0?1:3:(v=x>=0?0:2,j(h,h,[s[4]*i,s[5]*i,s[6]*i],-Math.sin(Xt(x>=0?a.getSouth():a.getNorth()))*rc));const b=o[v],w=o[(v+1)%4],_=new rp(b,w,h),A=[np(_,0)||b[0],np(_,1)||b[1],np(_,2)||b[2]],I=Ap(t.zoom);if(I>0){const n=function({x:t,y:e,z:r},n,i,s,a){const o=1/(1<<r);let l=t*o,u=l+o,c=e*o,h=c+o,p=0;const d=(l+u)/2-s;return d>.5?p=-1:d<-.5&&(p=1),l=((l+p)*n-(s*=n))*i+s,u=((u+p)*n-s)*i+s,c=(c*n-(a*=n))*i+a,h=(h*n-a)*i+a,[[l,h,0],[u,h,0],[u,c,0],[l,c,0]]}(r,e,t._pixelsPerMercatorPixel,m,y);for(let t=0;t<o.length;t++)sp(o[t],n[t],I);const i=D([],n[v],n[(v+1)%4]);N(i,i,.5),sp(A,i,I)}for(const t of o)O(c,c,t),U(u,u,t);return c[2]=Math.min(b[2],w[2]),O(c,c,A),U(u,u,A),new mh(c,u)}function up({x:t,y:e,z:r},n=!1){const i=1/(1<<r),s=new yc(Ic(t*i),e===(1<<r)-1&&n?-90:Mc((e+1)*i)),a=new yc(Ic((t+1)*i),0===e&&n?90:Mc(e*i));return new gc(s,a)}function cp(t,e=rc){const r=Xt(t.getNorth()),n=Xt(t.getSouth()),i=Math.cos(r),s=Math.cos(n),a=Math.sin(r),o=Math.sin(n),l=t.getWest(),u=t.getEast();return[hc(s,o,l,e),hc(s,o,u,e),hc(i,a,u,e),hc(i,a,l,e)]}function hp(t,e,r,n){const i=1<<r.z,s=(t/Ui+r.x)/i;return dc(Mc((e/Ui+r.y)/i),Ic(s),n)}function pp(t,e){const r=[0,0,0];return K(r,r,mp(ip(e.canonical))),K(r,r,t),r}function dp({min:t,max:e}){return ac/Math.max(e[0]-t[0],e[1]-t[1],e[2]-t[2])}const fp=new Float64Array(16);function mp(t){const e=dp(t),r=A(fp,[e,e,e]);return x(r,r,H([],t.min))}function yp(t){const e=(n=t.min,(r=fp)[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=n[0],r[13]=n[1],r[14]=n[2],r[15]=1,r);var r,n;const i=1/dp(t);return v(e,e,[i,i,i])}function gp(t){const e=Ui/(2*Math.PI);return t/(2*Math.PI)/e}function xp(t,e){return Ui/(512*Math.pow(2,t))*dp(ip(e))}function vp(t,e,r,n,i){const s=gp(r),a=[t,e,-r/(2*Math.PI)],o=f(new Float64Array(16));return x(o,o,a),v(o,o,[s,s,s]),b(o,o,Xt(-i)),w(o,o,Xt(-n)),o}function bp(t){const{x:e,y:r}=t.point,{lng:n,lat:i}=t._center;return vp(e,r,t.worldSize,n,i)}function wp(t,e){const{x:r,y:n}=t.point,i=vp(r,n,t.worldSize/t._pixelsPerMercatorPixel,0,0);return g(i,i,yp(ip(e)))}function _p(t){const e=t.pixelsPerMeter,r=e/Ac(1,t.center.lat),n=f(new Float64Array(16));return x(n,n,[t.point.x,t.point.y,0]),v(n,n,[r,r,e]),Float32Array.from(n)}function Ap(t){return se(nc,ic,t)}function Ip(t,e,r){const n=f(new Float64Array(16)),i=(e/(1<<t)-.5)*Math.PI*2;return w(n,r.globeMatrix,i),Float32Array.from(n)}function Mp(t,e,r){const n=Ap(r.zoom),i=t.style.map._antialias,s=t.terrain&&t.terrain.exaggeration()>0;return 0===n&&!i&&!s}function Sp(t,e,r,n){const i=e.getNorth(),s=e.getSouth(),a=e.getWest(),o=e.getEast(),l=1<<t.z,c=o-a,h=i-s,p=c/oc,d=-h/lc[r],f=[0,p,0,d,0,0,i,a,0];if(t.z>0){const t=180/n;u(f,f,[t/c+1,0,0,0,t/h+1,0,-.5*t/p,.5*t/d,1])}return f[2]=l,f[5]=t.x,f[8]=t.y,f}function Pp(t){const e=Pc-5;t=ie(t,-e,e)/e*90;const r=Math.pow(Math.abs(Math.sin(Xt(t))),3);return Math.round(r*(lc.length-1))}function kp(t){const e=[0,0,0],r=f(new Float64Array(16));return g(r,t.pixelMatrix,t.globeMatrix),K(e,e,r),new $t(e[0],e[1])}function Bp(t,e){const r=dc(e.lat,e.lng),n=function(t){const e=dc(t._center.lat,t._center.lng);let r=W([],F(0,1,0),e);const n=I([],-t.angle,e);r=K(r,r,n),I(n,-t._pitch,r);const i=X([],e);return N(i,i,Qh(t.cameraToCenterDistance/t.pixelsPerMeter)),K(i,i,n),D([],e,i)}(t);return a=(i=R([],n,r))[0],o=i[1],l=i[2],u=(s=r)[0],c=s[1],h=s[2],d=(p=Math.sqrt((a*a+o*o+l*l)*(u*u+c*c+h*h)))&&Z(i,s)/p,Math.acos(Math.min(Math.max(d,-1),1));var i,s,a,o,l,u,c,h,p,d}function zp(t,e){return Bp(t,e)>Math.PI/2*1.01}function Tp(t){const e=f(new Float64Array(16));g(e,t.pixelMatrix,t.globeMatrix);const r=[0,uc,0],n=[0,cc,0];return K(r,r,e),K(n,n,e),[r[0]>0&&r[0]<=t.width&&r[1]>0&&r[1]<=t.height&&!zp(t,new yc(t.center.lat,90)),n[0]>0&&n[0]<=t.width&&n[1]>0&&n[1]<=t.height&&!zp(t,new yc(t.center.lat,-90))]}const Ep=Xt(85),Vp=Math.cos(Ep),Fp=Math.sin(Ep);class Cp{constructor(t){this._createGrid(t),this._createPoles(t)}destroy(){this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy();for(const t of this._poleSegments)t.destroy();for(const t of this._gridSegments)t.withSkirts.destroy(),t.withoutSkirts.destroy()}_fillGridMeshWithLods(t,e){const r=new _l,n=new $l,i=[],s=t+1+2,a=e[0]+1,o=e[0]+1+(1+e.length),l=(t,e,r)=>{let n=t===s-1?t-2:0===t?t:t-1;return n+=r?24575:0,[n,e]};for(let t=0;t<s;++t)r.emplaceBack(...l(t,0,!0));for(let t=0;t<a;++t)for(let e=0;e<s;++e)r.emplaceBack(...l(e,t,(0===e||e===s-1)&&!0));for(let t=0;t<e.length;++t){const n=e[t];for(let t=0;t<s;++t)r.emplaceBack(...l(t,n,!0))}for(let t=0;t<e.length;++t){const a=n.length,l=e[t]+1+2,u=new $l;for(let r=0;r<l-1;r++){const i=r===l-2,a=i?s*(o-e.length+t-r):s;for(let t=0;t<s-1;t++){const e=r*s+t;0===r||i||0===t||t===s-2?(u.emplaceBack(e+1,e,e+a),u.emplaceBack(e+a,e+a+1,e+1)):(n.emplaceBack(e+1,e,e+a),n.emplaceBack(e+a,e+a+1,e+1))}}const c=bu.simpleSegment(0,a,r.length,n.length-a);for(let t=0;t<u.uint16.length;t+=3)n.emplaceBack(u.uint16[t],u.uint16[t+1],u.uint16[t+2]);const h=bu.simpleSegment(0,a,r.length,n.length-a);i.push({withoutSkirts:c,withSkirts:h})}return{vertices:r,indices:n,segments:i}}_createGrid(t){const e=this._fillGridMeshWithLods(oc,lc);this._gridSegments=e.segments,this._gridBuffer=t.createVertexBuffer(e.vertices,Jh.members),this._gridIndexBuffer=t.createIndexBuffer(e.indices,!0)}_createPoles(t){const e=new $l;for(let t=0;t<=oc;t++)e.emplaceBack(0,t+1,t+2);this._poleIndexBuffer=t.createIndexBuffer(e,!0);const r=new Xl,n=new Xl,i=new Xl,s=new Xl;this._poleSegments=[];for(let t=0,e=0;t<nc;t++){const a=360/(1<<t);r.emplaceBack(0,-rc,0,.5,0),n.emplaceBack(0,-rc,0,.5,1),i.emplaceBack(0,-rc,0,.5,.5),s.emplaceBack(0,-rc,0,.5,.5);for(let t=0;t<=oc;t++){let e=t/oc,o=0;const l=dn(0,a,e),[u,c,h]=hc(Vp,Fp,l,rc);r.emplaceBack(u,c,h,e,o),n.emplaceBack(u,c,h,e,1-o);const p=Xt(l);e=.5+.5*Math.sin(p),o=.5+.5*Math.cos(p),i.emplaceBack(u,c,h,e,o),s.emplaceBack(u,c,h,e,1-o)}this._poleSegments.push(bu.simpleSegment(e,0,66,64)),e+=66}this._poleNorthVertexBuffer=t.createVertexBuffer(r,Yh,!1),this._poleSouthVertexBuffer=t.createVertexBuffer(n,Yh,!1),this._texturedPoleNorthVertexBuffer=t.createVertexBuffer(i,Yh,!1),this._texturedPoleSouthVertexBuffer=t.createVertexBuffer(s,Yh,!1)}getGridBuffers(t,e){return[this._gridBuffer,this._gridIndexBuffer,e?this._gridSegments[t].withSkirts:this._gridSegments[t].withoutSkirts]}getPoleBuffers(t,e){return[e?this._texturedPoleNorthVertexBuffer:this._poleNorthVertexBuffer,e?this._texturedPoleSouthVertexBuffer:this._poleSouthVertexBuffer,this._poleIndexBuffer,this._poleSegments[t]]}}const Dp=t=>({u_camera_to_center_distance:new Tu(t),u_extrude_scale:new Nu(t),u_device_pixel_ratio:new Tu(t),u_matrix:new Ru(t),u_inv_rot_matrix:new Ru(t),u_merc_center:new Eu(t),u_tile_id:new Vu(t),u_zoom_transition:new Tu(t),u_up_dir:new Vu(t),u_emissive_strength:new Tu(t)}),Rp=h(),Lp=(t,e,r,n,i,s)=>{const a=t.transform,o="globe"===a.projection.name;let l;if("map"===s.paint.get("circle-pitch-alignment"))if(o){const t=xp(a.zoom,e.canonical)*a._pixelsPerMercatorPixel;l=Float32Array.from([t,0,0,t])}else l=a.calculatePixelsToTileUnitsMatrix(r);else l=new Float32Array([a.pixelsToGLUnits[0],0,0,a.pixelsToGLUnits[1]]);const u={u_camera_to_center_distance:t.transform.getCameraToCenterDistance(a.projection),u_matrix:t.translatePosMatrix(e.projMatrix,r,s.paint.get("circle-translate"),s.paint.get("circle-translate-anchor")),u_device_pixel_ratio:lr.devicePixelRatio,u_extrude_scale:l,u_inv_rot_matrix:Rp,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0],u_emissive_strength:s.paint.get("circle-emissive-strength")};if(o){u.u_inv_rot_matrix=n,u.u_merc_center=i,u.u_tile_id=[e.canonical.x,e.canonical.y,1<<e.canonical.z],u.u_zoom_transition=Ap(a.zoom);const t=i[0]*Ui,r=i[1]*Ui;u.u_up_dir=a.projection.upVector(new Gh(0,0,0),t,r)}return u},Op=t=>{const e=[];return"map"===t.paint.get("circle-pitch-alignment")&&e.push("PITCH_WITH_MAP"),"map"===t.paint.get("circle-pitch-scale")&&e.push("SCALE_WITH_MAP"),e};function Up(t,e,r,n,i,s,a,o,l){if(s&&t.queryGeometry.isAboveHorizon)return!1;s&&(l*=t.pixelToTileUnitsFactor);const u=t.tileID.canonical,c=r.projection.upVectorScale(u,r.center.lat,r.worldSize).metersToTile;for(const h of e)for(const e of h){const h=e.add(o),p=i&&r.elevation?r.elevation.exaggeration()*i.getElevationAt(h.x,h.y,!0):0,d=r.projection.projectTilePoint(h.x,h.y,u);if(p>0){const t=r.projection.upVector(u,h.x,h.y);d.x+=t[0]*c*p,d.y+=t[1]*c*p,d.z+=t[2]*c*p}const f=s?h:Np(d.x,d.y,d.z,n),m=s?t.tilespaceRays.map((t=>Gp(t,p))):t.queryGeometry.screenGeometry,y=dt([],[d.x,d.y,d.z,1],n);if(!a&&s?l*=y[3]/r.cameraToCenterDistance:a&&!s&&(l*=r.cameraToCenterDistance/y[3]),s){const t=Mc((e.y/Ui+u.y)/(1<<u.z));l/=r.projection.pixelsPerMeter(t,1)/Ac(1,t)}if(_h(m,f,l))return!0}return!1}function Np(t,e,r,n){const i=dt([],[t,e,r,1],n);return new $t(i[0]/i[3],i[1]/i[3])}const jp=F(0,0,0),$p=F(0,0,1);function Gp(t,e){const r=T();return jp[2]=e,t.intersectsPlane(jp,$p,r),new $t(r[0],r[1])}class qp extends bh{}let Hp,Xp,Zp,Wp;function Yp(t,{width:e,height:r},n,i){if(i){if(i instanceof Uint8ClampedArray)i=new Uint8Array(i.buffer);else if(i.length!==e*r*n)throw new RangeError("mismatched image size")}else i=new Uint8Array(e*r*n);return t.width=e,t.height=r,t.data=i,t}function Kp(t,e,r){const{width:n,height:i}=e;n===t.width&&i===t.height||(Jp(t,e,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,n),height:Math.min(t.height,i)},r,null),t.width=n,t.height=i,t.data=e.data)}function Jp(t,e,r,n,i,s,a,o){if(0===i.width||0===i.height)return e;if(i.width>t.width||i.height>t.height||r.x>t.width-i.width||r.y>t.height-i.height)throw new RangeError("out of range source coordinates for image copy");if(i.width>e.width||i.height>e.height||n.x>e.width-i.width||n.y>e.height-i.height)throw new RangeError("out of range destination coordinates for image copy");const l=t.data,u=e.data,c=4===s&&o;for(let o=0;o<i.height;o++){const h=((r.y+o)*t.width+r.x)*s,p=((n.y+o)*e.width+n.x)*s;if(c)for(let t=0;t<i.width;t++){const e=h+t*s+3,r=p+t*s;u[r+0]=255,u[r+1]=255,u[r+2]=255,u[r+3]=l[e]}else if(a)for(let t=0;t<i.width;t++){const e=h+t*s,r=p+t*s,n=new un(l[e+0]/255,l[e+1]/255,l[e+2]/255,l[e+3]).toNonPremultipliedRenderColor(a).toArray();u[r+0]=n[0],u[r+1]=n[1],u[r+2]=n[2],u[r+3]=n[3]}else for(let t=0;t<i.width*s;t++)u[p+t]=l[h+t]}return e}Qa(qp,"HeatmapBucket",{omit:["layers"]});class Qp{constructor(t,e){Yp(this,t,1,e)}resize(t){Kp(this,new Qp(t),1)}clone(){return new Qp({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,r,n,i){Jp(t,e,r,n,i,1,null)}}class td{constructor(t,e){Yp(this,t,4,e)}resize(t){Kp(this,new td(t),4)}replace(t,e){e?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new td({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,r,n,i,s,a){Jp(t,e,r,n,i,4,s,a)}}class ed{constructor(t,e){this.width=t.width,this.height=t.height,this.data=e instanceof Uint8Array?new Float32Array(e.buffer):e}}function rd(t){const e={},r=t.resolution||256,n=t.clips?t.clips.length:1,i=t.image||new td({width:r,height:n}),s=(r,n,s)=>{e[t.evaluationKey]=s;const a=t.expression.evaluate(e),o=a?a.toNonPremultipliedRenderColor(null):null;o&&(i.data[r+n+0]=Math.floor(255*o.r),i.data[r+n+1]=Math.floor(255*o.g),i.data[r+n+2]=Math.floor(255*o.b),i.data[r+n+3]=Math.floor(255*o.a))};if(t.clips)for(let e=0,i=0;e<n;++e,i+=4*r)for(let n=0,a=0;n<r;n++,a+=4){const o=n/(r-1),{start:l,end:u}=t.clips[e];s(i,a,l*(1-o)+u*o)}else for(let t=0,e=0;t<r;t++,e+=4)s(0,e,t/(r-1));return i}Qa(Qp,"AlphaImage"),Qa(td,"RGBAImage");const nd=bl([{name:"a_pos",components:2,type:"Int16"}],4),id=bl([{name:"a_road_z_offset",components:1,type:"Float32"}],4),sd=bl([{name:"a_pos",components:2,type:"Int16"},{name:"a_height",components:1,type:"Float32"}],4),ad=bl([{name:"a_pos_normal_3",components:3,type:"Int16"}],4);function od(t,e,r=2){const n=e&&e.length,i=n?e[0]*r:t.length;let s=ld(t,0,i,r,!0);const a=[];if(!s||s.next===s.prev)return a;let o,l,u;if(n&&(s=function(t,e,r,n){const i=[];for(let r=0,s=e.length;r<s;r++){const a=ld(t,e[r]*n,r<s-1?e[r+1]*n:t.length,n,!1);a===a.next&&(a.steiner=!0),i.push(vd(a))}i.sort(md);for(let t=0;t<i.length;t++)r=yd(i[t],r);return r}(t,e,s,r)),t.length>80*r){o=t[0],l=t[1];let e=o,n=l;for(let s=r;s<i;s+=r){const r=t[s],i=t[s+1];r<o&&(o=r),i<l&&(l=i),r>e&&(e=r),i>n&&(n=i)}u=Math.max(e-o,n-l),u=0!==u?32767/u:0}return cd(s,a,r,o,l,u,0),a}function ld(t,e,r,n,i){let s;if(i===function(t,e,r,n){let i=0;for(let s=e,a=r-n;s<r;s+=n)i+=(t[a]-t[s])*(t[s+1]+t[a+1]),a=s;return i}(t,e,r,n)>0)for(let i=e;i<r;i+=n)s=zd(i/n|0,t[i],t[i+1],s);else for(let i=r-n;i>=e;i-=n)s=zd(i/n|0,t[i],t[i+1],s);return s&&Id(s,s.next)&&(Td(s),s=s.next),s}function ud(t,e){if(!t)return t;e||(e=t);let r,n=t;do{if(r=!1,n.steiner||!Id(n,n.next)&&0!==Ad(n.prev,n,n.next))n=n.next;else{if(Td(n),n=e=n.prev,n===n.next)break;r=!0}}while(r||n!==e);return e}function cd(t,e,r,n,i,s,a){if(!t)return;!a&&s&&function(t,e,r,n){let i=t;do{0===i.z&&(i.z=xd(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){let e,r=1;do{let n,i=t;t=null;let s=null;for(e=0;i;){e++;let a=i,o=0;for(let t=0;t<r&&(o++,a=a.nextZ,a);t++);let l=r;for(;o>0||l>0&&a;)0!==o&&(0===l||!a||i.z<=a.z)?(n=i,i=i.nextZ,o--):(n=a,a=a.nextZ,l--),s?s.nextZ=n:t=n,n.prevZ=s,s=n;i=a}s.nextZ=null,r*=2}while(e>1)}(i)}(t,n,i,s);let o=t;for(;t.prev!==t.next;){const l=t.prev,u=t.next;if(s?pd(t,n,i,s):hd(t))e.push(l.i,t.i,u.i),Td(t),t=u.next,o=u.next;else if((t=u)===o){a?1===a?cd(t=dd(ud(t),e),e,r,n,i,s,2):2===a&&fd(t,e,r,n,i,s):cd(ud(t),e,r,n,i,s,1);break}}}function hd(t){const e=t.prev,r=t,n=t.next;if(Ad(e,r,n)>=0)return!1;const i=e.x,s=r.x,a=n.x,o=e.y,l=r.y,u=n.y,c=Math.min(i,s,a),h=Math.min(o,l,u),p=Math.max(i,s,a),d=Math.max(o,l,u);let f=n.next;for(;f!==e;){if(f.x>=c&&f.x<=p&&f.y>=h&&f.y<=d&&wd(i,o,s,l,a,u,f.x,f.y)&&Ad(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function pd(t,e,r,n){const i=t.prev,s=t,a=t.next;if(Ad(i,s,a)>=0)return!1;const o=i.x,l=s.x,u=a.x,c=i.y,h=s.y,p=a.y,d=Math.min(o,l,u),f=Math.min(c,h,p),m=Math.max(o,l,u),y=Math.max(c,h,p),g=xd(d,f,e,r,n),x=xd(m,y,e,r,n);let v=t.prevZ,b=t.nextZ;for(;v&&v.z>=g&&b&&b.z<=x;){if(v.x>=d&&v.x<=m&&v.y>=f&&v.y<=y&&v!==i&&v!==a&&wd(o,c,l,h,u,p,v.x,v.y)&&Ad(v.prev,v,v.next)>=0)return!1;if(v=v.prevZ,b.x>=d&&b.x<=m&&b.y>=f&&b.y<=y&&b!==i&&b!==a&&wd(o,c,l,h,u,p,b.x,b.y)&&Ad(b.prev,b,b.next)>=0)return!1;b=b.nextZ}for(;v&&v.z>=g;){if(v.x>=d&&v.x<=m&&v.y>=f&&v.y<=y&&v!==i&&v!==a&&wd(o,c,l,h,u,p,v.x,v.y)&&Ad(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;b&&b.z<=x;){if(b.x>=d&&b.x<=m&&b.y>=f&&b.y<=y&&b!==i&&b!==a&&wd(o,c,l,h,u,p,b.x,b.y)&&Ad(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function dd(t,e){let r=t;do{const n=r.prev,i=r.next.next;!Id(n,i)&&Md(n,r,r.next,i)&&kd(n,i)&&kd(i,n)&&(e.push(n.i,r.i,i.i),Td(r),Td(r.next),r=t=i),r=r.next}while(r!==t);return ud(r)}function fd(t,e,r,n,i,s){let a=t;do{let t=a.next.next;for(;t!==a.prev;){if(a.i!==t.i&&_d(a,t)){let o=Bd(a,t);return a=ud(a,a.next),o=ud(o,o.next),cd(a,e,r,n,i,s,0),void cd(o,e,r,n,i,s,0)}t=t.next}a=a.next}while(a!==t)}function md(t,e){let r=t.x-e.x;return 0===r&&(r=t.y-e.y,0===r)&&(r=(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)),r}function yd(t,e){const r=function(t,e){let r=e;const n=t.x,i=t.y;let s,a=-1/0;if(Id(t,r))return r;do{if(Id(t,r.next))return r.next;if(i<=r.y&&i>=r.next.y&&r.next.y!==r.y){const t=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(t<=n&&t>a&&(a=t,s=r.x<r.next.x?r:r.next,t===n))return s}r=r.next}while(r!==e);if(!s)return null;const o=s,l=s.x,u=s.y;let c=1/0;r=s;do{if(n>=r.x&&r.x>=l&&n!==r.x&&bd(i<u?n:a,i,l,u,i<u?a:n,i,r.x,r.y)){const e=Math.abs(i-r.y)/(n-r.x);kd(r,t)&&(e<c||e===c&&(r.x>s.x||r.x===s.x&&gd(s,r)))&&(s=r,c=e)}r=r.next}while(r!==o);return s}(t,e);if(!r)return e;const n=Bd(r,t);return ud(n,n.next),ud(r,r.next)}function gd(t,e){return Ad(t.prev,t,e.prev)<0&&Ad(e.next,t,t.next)<0}function xd(t,e,r,n,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function vd(t){let e=t,r=t;do{(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next}while(e!==t);return r}function bd(t,e,r,n,i,s,a,o){return(i-a)*(e-o)>=(t-a)*(s-o)&&(t-a)*(n-o)>=(r-a)*(e-o)&&(r-a)*(s-o)>=(i-a)*(n-o)}function wd(t,e,r,n,i,s,a,o){return!(t===a&&e===o)&&bd(t,e,r,n,i,s,a,o)}function _d(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&Md(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(kd(t,e)&&kd(e,t)&&function(t,e){let r=t,n=!1;const i=(t.x+e.x)/2,s=(t.y+e.y)/2;do{r.y>s!=r.next.y>s&&r.next.y!==r.y&&i<(r.next.x-r.x)*(s-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==t);return n}(t,e)&&(Ad(t.prev,t,e.prev)||Ad(t,e.prev,e))||Id(t,e)&&Ad(t.prev,t,t.next)>0&&Ad(e.prev,e,e.next)>0)}function Ad(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function Id(t,e){return t.x===e.x&&t.y===e.y}function Md(t,e,r,n){const i=Pd(Ad(t,e,r)),s=Pd(Ad(t,e,n)),a=Pd(Ad(r,n,t)),o=Pd(Ad(r,n,e));return i!==s&&a!==o||!(0!==i||!Sd(t,r,e))||!(0!==s||!Sd(t,n,e))||!(0!==a||!Sd(r,t,n))||!(0!==o||!Sd(r,e,n))}function Sd(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function Pd(t){return t>0?1:t<0?-1:0}function kd(t,e){return Ad(t.prev,t,t.next)<0?Ad(t,e,t.next)>=0&&Ad(t,t.prev,e)>=0:Ad(t,e,t.prev)<0||Ad(t,t.next,e)<0}function Bd(t,e){const r=Ed(t.i,t.x,t.y),n=Ed(e.i,e.x,e.y),i=t.next,s=e.prev;return t.next=e,e.prev=t,r.next=i,i.prev=r,n.next=r,r.prev=n,s.next=n,n.prev=s,n}function zd(t,e,r,n){const i=Ed(t,e,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Td(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Ed(t,e,r){return{i:t,x:e,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Vd(t,e){const r=t.length;if(r<=1)return[t];const n=[];let i,s;for(let e=0;e<r;e++){const r=Me(t[e]);0!==r&&(t[e].area=Math.abs(r),void 0===s&&(s=r<0),s===r<0?(i&&n.push(i),i=[t[e]]):i.push(t[e]))}if(i&&n.push(i),e>1)for(let t=0;t<n.length;t++)n[t].length<=e||(li(n[t],e,1,n[t].length-1,Fd),n[t]=n[t].slice(0,e));return n}function Fd(t,e){return e.area-t.area}function Cd(t,e,r=1){if(!t)return null;const n="string"==typeof t?On.from(t).getPrimary():t.getPrimary(),i="string"==typeof t?null:t.getSecondary();for(const t of[n,i]){if(!t)continue;const n=t.id.toString();e.has(n)||e.set(n,[]),t.scaleSelf(r),e.get(n).push(t)}return{primary:n.toString(),secondary:i?i.toString():null}}function Dd(t,e,r,n){const i=n.patternDependencies;let s=!1;for(const n of e){const e=n.paint.get(`${t}-pattern`);e.isConstant()||(s=!0),Cd(e.constantOr(null),i,r)&&(s=!0)}return s}function Rd(t,e,r,n,i,s){const a=s.patternDependencies;for(const o of e){const e=o.paint.get(`${t}-pattern`).value;if("constant"!==e.kind){let t=e.evaluate({zoom:n},r,{},s.availableImages);t=t&&t.name?t.name:t;const l=Cd(t,a,i);if(!l)continue;const{primary:u,secondary:c}=l;u&&(r.patterns[o.id]=[u,c].filter(Boolean))}}return r}class Ld{constructor(){this.polygons=new Map}add(t,...e){const r=this.polygons.get(t);r?r.push(...e):this.polygons.set(t,e)}merge(t){for(const[e,r]of t.polygons)this.add(e,...r)}}class Od{constructor(){this.portals=[]}static isOnBorder(t,e){return t<=0&&e<=0||t>=Ui&&e>=Ui}static evaluate(t){if(0===t.length)return new Od;let e=[];for(const r of t)e.push(...r.portals);if(0===e.length)return new Od;for(const t of e){const e=t.va,r=t.vb;(Od.isOnBorder(e.x,r.x)||Od.isOnBorder(e.y,r.y))&&(t.type="border")}const r=e.filter((t=>"unevaluated"!==t.type)),n=e.filter((t=>"unevaluated"===t.type));if(0===n.length)return new Od;n.sort(((t,e)=>t.hash===e.hash?t.isTunnel===e.isTunnel?0:t.isTunnel?-1:1:t.hash<e.hash?1:-1)),e=r.concat(n);let i=r.length,s=i,a=i;do{if(s++,s===e.length||e[i].hash!==e[s].hash){if(s-i==2){a<i&&(e[a]=e[i],e[i]=null);const t=e[a],r=e[s-1];t.type=t.isTunnel!==r.isTunnel?"tunnel":"polygon",t.connection={a:t.connection.a,b:r.connection.a},a++}i=s}}while(i!==e.length);return e.splice(a),e.sort(((t,e)=>t.hash<e.hash?1:-1)),{portals:e}}}Qa(Od,"ElevationPortalGraph"),Qa(Ld,"ElevationPolygons");class Ud{constructor(t,e,r){this.outPositions=t,this.outNormals=e,this.outIndices=r,this.vertexLookup=new Map}addVertex(t,e,r){let n=t[2];null!=r&&(n*=r);const i=`${t[0]},${t[1]},${t[2]},${e[0]},${e[1]},${e[2]}`,s=this.vertexLookup.get(i);if(null!=s)return s;const a=this.outPositions.length;this.vertexLookup.set(i,a);const o=Math.trunc(16384*e[0]),l=Math.trunc(16384*e[1]),u=Math.trunc(16384*e[2]);return this.outPositions.emplaceBack(t[0],t[1],n),this.outNormals.emplaceBack(o,l,u),a}addTriangle(t,e,r){this.outIndices.emplaceBack(t,e,r)}addTriangles(t,e,r){if(0===t.length)return;const n=1===r.length,i=T(),s=T();for(let a=0;a<t.length;a+=3){const o=e[t[a+0]],l=e[t[a+1]],u=e[t[a+2]],c=n?r[0]:r[t[a+1]],h=n?r[0]:r[t[a+2]];C(i,o.x,o.y,n?r[0]:r[t[a+0]]);const p=this.addVertex(i,s);C(i,l.x,l.y,c);const d=this.addVertex(i,s);C(i,u.x,u.y,h);const f=this.addVertex(i,s);this.outIndices.emplaceBack(p,d,f)}}addQuad(t,e,r,n,i,s){const a=this.addVertex(t,i,s),o=this.addVertex(e,i,s),l=this.addVertex(r,i,s),u=this.addVertex(n,i,s);this.addTriangle(a,o,l),this.addTriangle(l,u,a)}getVertexCount(){return this.outPositions.length}clearVertexLookup(){this.vertexLookup.clear()}}class Nd{constructor(t,e,r,n){this.unevaluatedPortals=new Od,this.portalPolygons=new Ld,this.bridgeFeatureSections=[],this.tunnelFeatureSections=[],this.vertexHashLookup=new Map,this.unevalVertices=[],this.unevalHeights=[],this.unevalTriangles=[],this.unevalTunnelTriangles=[],this.unevalEdges=[],this.vertexPositions=new Sl,this.vertexNormals=new Pl,this.indexArray=new $l,this.tileToMeters=Tc(t),this.bridgeProgramConfigurations=new Yu(e,{zoom:r,lut:n},(t=>"fill-tunnel-structure-color"!==t)),this.tunnelProgramConfigurations=new Yu(e,{zoom:r,lut:n},(t=>"fill-bridge-guard-rail-color"!==t))}addVertices(t,e){const r=this.unevalVertices.length;for(let r=0;r<t.length;r++)this.unevalVertices.push(t[r]),this.unevalHeights.push(e[r]);return r}addTriangles(t,e,r){const n=r?this.unevalTunnelTriangles:this.unevalTriangles;for(const r of t)n.push(r+e)}addRenderableRing(t,e,r,n,i,s){const a=[new $t(i.min.x,i.min.y),new $t(i.max.x,i.min.y),new $t(i.max.x,i.max.y),new $t(i.min.x,i.max.y)];for(let o=0;o<r-1;o++){const r=e+o,l=r+1,u=this.unevalVertices[r],c=this.unevalVertices[l];if(!(u.x>=i.min.x&&u.x<=i.max.x&&u.y>=i.min.y&&u.y<=i.max.y||c.x>=i.min.x&&c.x<=i.max.x&&c.y>=i.min.y&&c.y<=i.max.y||Fh(u,c,a)))continue;if(this.isOnBorder(u.x,c.x)||this.isOnBorder(u.y,c.y))continue;const h=Nd.computeEdgeHash(this.unevalVertices[r],this.unevalVertices[l]);let p,d=this.vertexHashLookup.get(Nd.computePosHash(u));null!=d?p=d.next:(d=this.vertexHashLookup.get(Nd.computePosHash(c)),p=null!=d?d.prev:h),this.unevalEdges.push({polygonIdx:t,a:r,b:l,hash:h,portalHash:p,isTunnel:n,type:"unevaluated",featureInfo:s})}}addPortalCandidates(t,e,r,n,i){if(0===e.length)return;this.portalPolygons.add(t,{geometry:e,zLevel:i});const s=e[0];this.vertexHashLookup.clear();let a=Nd.computeEdgeHash(s[s.length-2],s[s.length-1]);for(let e=0;e<s.length-1;e++){const i=s[e+0],o=s[e+1],l=Bt(o.x-i.x,o.y-i.y),u=Ft(l);if(0===u)continue;let c="unevaluated";const h=n.pointElevation(i),p=n.pointElevation(o);Math.abs(h)<.01&&Math.abs(p)<.01?c="entrance":(this.isOnBorder(i.x,o.x)||this.isOnBorder(i.y,o.y))&&(c="border");const d=Nd.computeEdgeHash(i,o);this.unevaluatedPortals.portals.push({connection:{a:t,b:void 0},va:i,vb:o,vab:l,length:u,hash:d,isTunnel:r,type:c});const f=Nd.computePosHash(i);this.vertexHashLookup.set(f,{prev:a,next:d}),a=d}}construct(t){if(0===this.unevalVertices.length)return;const e=()=>({vertexOffset:0,primitiveOffset:this.indexArray.length}),r=t=>{t.primitiveLength=this.indexArray.length-t.primitiveOffset},n=new Ud(this.vertexPositions,this.vertexNormals,this.indexArray);this.prepareEdges(t.portals,this.unevalEdges);const i=e(),s=e(),a=e(),o=(t,e)=>{t.sort(((t,r)=>t.type===e&&r.type!==e?-1:t.type!==e&&r.type===e?1:0));const r=t.findIndex((t=>t.type!==e));return r>=0?r:t.length};let l=0;this.unevalEdges.length>0&&(l=o(this.unevalEdges,"none"),this.constructBridgeStructures(n,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:l},this.tileToMeters)),r(a);const u=e(),c=e();if(this.unevalEdges.length>0){const t=this.unevalEdges.splice(l),e=o(t,"tunnel")+l;this.unevalEdges.push(...t),this.constructTunnelStructures(n,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:l},{min:l,max:e})}r(u),n.addTriangles(this.unevalTriangles,this.unevalVertices,this.unevalHeights),r(c),n.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,this.unevalHeights),r(s),n.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,[-.1]),r(i),this.maskSegments=bu.simpleSegment(0,c.primitiveOffset,0,c.primitiveLength),this.depthSegments=bu.simpleSegment(0,s.primitiveOffset,0,s.primitiveLength),this.renderableBridgeSegments=bu.simpleSegment(0,a.primitiveOffset,0,a.primitiveLength),this.renderableTunnelSegments=bu.simpleSegment(0,u.primitiveOffset,0,u.primitiveLength),this.shadowCasterSegments=bu.simpleSegment(0,i.primitiveOffset,0,i.primitiveLength)}update(t,e,r,n,i,s,a,o){this.bridgeProgramConfigurations.updatePaintArrays(t,e,i,r,n,s,a,o),this.tunnelProgramConfigurations.updatePaintArrays(t,e,i,r,n,s,a,o)}upload(t){this.vertexBuffer||0===this.vertexPositions.length||0===this.vertexNormals.length||0===this.indexArray.length||(this.vertexBuffer=t.createVertexBuffer(this.vertexPositions,sd.members),this.vertexBufferNormal=t.createVertexBuffer(this.vertexNormals,ad.members),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.bridgeProgramConfigurations.upload(t),this.tunnelProgramConfigurations.upload(t))}destroy(){this.vertexBuffer&&(this.vertexBuffer.destroy(),this.vertexBufferNormal.destroy(),this.indexBuffer.destroy()),this.maskSegments&&(this.maskSegments.destroy(),this.depthSegments.destroy(),this.renderableBridgeSegments.destroy(),this.renderableTunnelSegments.destroy(),this.shadowCasterSegments.destroy()),this.bridgeProgramConfigurations.destroy(),this.tunnelProgramConfigurations.destroy()}populatePaintArrays(t,e,r,n,i){const s=(s,a)=>{for(let o=0;o<a.length-1;o++){const l=a[o].featureIndex,u=a[o+1].vertexStart,c=t.feature(l);s.populatePaintArrays(u,c,l,{},r,e,n,void 0,i)}};s(this.bridgeProgramConfigurations,this.bridgeFeatureSections),s(this.tunnelProgramConfigurations,this.tunnelFeatureSections)}computeVertexConnections(t,e,r,n,i){const s=new Map;for(let a=n;a<i;a++){const n=r[a],i=n.a,o=n.b,l=Nd.computePosHash(t[i]),u=Nd.computePosHash(t[o]);let c=s.get(l);c||(c={},s.set(l,c));let h=s.get(u);h||(h={},s.set(u,h)),e[i]<=0&&e[o]<=0||(c.to=o,h.from=i)}return s}isTerminalVertex(t,e){const r=Nd.computePosHash(this.unevalVertices[t]),n=e.get(r);return!n||!n.from||!n.to}constructBridgeStructures(t,e,r,n,i,s){t.clearVertexLookup();const a=this.computeVertexConnections(e,r,n,i.min,i.max),o=1/s,l=.5*o,u=(t,n)=>C(t,e[n].x,e[n].y,r[n]*o),c=T(),h=T(),p=T(),d=T(),f=T(),m=(t,r)=>{const n=a.get(Nd.computePosHash(e[r])),i=n.from,s=n.to;if(!i||!s)return;u(c,i),u(h,r),u(p,s),tt(d),et(c,h)||(rt(f,h,c),X(d,f)),et(p,h)||(rt(f,p,h),D(d,d,X(f,f)));const o=st(d);return o>0?N(t,d,1/o):void 0};let y=Number.POSITIVE_INFINITY;this.sortSubarray(n,i.min,i.max,((t,e)=>t.featureInfo.featureIndex-e.featureInfo.featureIndex));const g=T(),x=T(),v=T(),b=T(),w=T(),_=T(),A=T(),I=T(),M=T(),S=[T(),T(),T(),T()],P=[T(),T(),T(),T()],k=[{coord:new $t(0,0),height:0},{coord:new $t(0,0),height:0}],B=(t,e)=>t>e;for(let u=i.min;u<i.max;u++){const i=n[u];if(!i.featureInfo.guardRailEnabled)continue;if(!this.prepareEdgePoints(k,e,r,i,B))continue;const[c,h]=k;if(C(g,c.coord.x,c.coord.y,o*c.height),C(x,h.coord.x,h.coord.y,o*h.height),et(g,x))continue;rt(v,x,g),X(v,v);const p=m(I,i.a)||v,d=m(M,i.b)||v;C(b,p[1],-p[0],0),X(b,b),C(w,d[1],-d[0],0),X(w,w),W(I,b,p),X(_,I),W(I,w,d),X(A,I),D(S[0],g,N(I,rt(I,b,_),l)),D(S[1],g,N(I,D(I,b,_),l)),D(S[2],g,N(I,_,l)),S[3]=g,D(P[0],x,N(I,rt(I,w,A),l)),D(P[1],x,N(I,D(I,w,A),l)),D(P[2],x,N(I,A,l)),P[3]=x,y=this.addFeatureSection(i.featureInfo.featureIndex,y,this.bridgeFeatureSections,t);const f=t.addVertex(S[0],b,s),z=t.addVertex(S[1],b,s),T=t.addVertex(P[0],w,s),E=t.addVertex(P[1],w,s);t.addTriangle(f,z,T),t.addTriangle(z,E,T);const V=t.addVertex(S[1],_,s),F=t.addVertex(S[2],_,s),R=t.addVertex(P[1],A,s),L=t.addVertex(P[2],A,s);t.addTriangle(V,F,R),t.addTriangle(F,L,R),H(b,b),H(w,w);const O=t.addVertex(S[2],b,s),U=t.addVertex(S[3],b,s),j=t.addVertex(P[2],w,s),$=t.addVertex(P[3],w,s);t.addTriangle(O,U,j),t.addTriangle(U,$,j);const G=this.isTerminalVertex(i.a,a),q=this.isTerminalVertex(i.b,a);c.height<.01&&G&&t.addQuad(S[3],S[2],S[1],S[0],H(p,p),s),h.height<.01&&q&&t.addQuad(P[0],P[1],P[2],P[3],d,s)}this.bridgeFeatureSections.push({featureIndex:Number.POSITIVE_INFINITY,vertexStart:t.getVertexCount()})}constructTunnelStructures(t,e,r,n,i,s){t.clearVertexLookup();let a=Number.POSITIVE_INFINITY;const o=(t,e)=>t.featureInfo.featureIndex-e.featureInfo.featureIndex;this.sortSubarray(n,i.min,i.max,o),this.sortSubarray(n,s.min,s.max,o);const l=t=>X(t,t),u=[{coord:new $t(0,0),height:0},{coord:new $t(0,0),height:0}],c=(t,e)=>t<e,h=T(),p=T(),d=T(),f=T(),m=T();for(let s=i.min;s<i.max;s++){if(!this.prepareEdgePoints(u,e,r,n[s],c))continue;const[i,o]=u,y=l(C(m,-(o.coord.y-i.coord.y),o.coord.x-i.coord.x,0));a=this.addFeatureSection(n[s].featureInfo.featureIndex,a,this.tunnelFeatureSections,t),t.addQuad(C(h,i.coord.x,i.coord.y,i.height),C(p,o.coord.x,o.coord.y,o.height),C(d,o.coord.x,o.coord.y,n[s].isTunnel?-.1:0),C(f,i.coord.x,i.coord.y,n[s].isTunnel?-.1:0),y)}for(let i=s.min;i<s.max;i++){const s=n[i];s.isTunnel&&([s.a,s.b]=[s.b,s.a]);const o=e[s.a],u=e[s.b],c=l(C(m,-(u.y-o.y),u.x-o.x,0));a=this.addFeatureSection(s.featureInfo.featureIndex,a,this.tunnelFeatureSections,t),t.addQuad(C(h,u.x,u.y,0),C(p,o.x,o.y,0),C(d,o.x,o.y,r[s.a]+4),C(f,u.x,u.y,r[s.b]+4),c),t.addQuad(C(h,o.x,o.y,0),C(p,u.x,u.y,0),C(d,u.x,u.y,r[s.b]+4),C(f,o.x,o.y,r[s.a]+4),c)}this.tunnelFeatureSections.push({featureIndex:Number.POSITIVE_INFINITY,vertexStart:t.getVertexCount()})}setElevatedPoint(t,e,r,n){t.coord.x=e,t.coord.y=r,t.height=n}prepareEdgePoints(t,e,r,n,i){let s=e[n.a].x,a=e[n.a].y,o=e[n.b].x,l=e[n.b].y,u=r[n.a],c=r[n.b];const h=i(u,0),p=i(c,0);if(h&&p)return this.setElevatedPoint(t[0],s,a,u),this.setElevatedPoint(t[1],o,l,c),!0;if(!h&&!p)return!1;if(h){if(!p){const t=c/(c-u);o=dn(o,s,t),l=dn(l,a,t),c=dn(c,u,t)}}else{const t=u/(u-c);s=dn(s,o,t),a=dn(a,l,t),u=dn(u,c,t)}return this.setElevatedPoint(t[0],s,a,u),this.setElevatedPoint(t[1],o,l,c),!0}prepareEdges(t,e){if(0===e.length)return;e.sort(((t,e)=>t.hash===e.hash?e.polygonIdx-t.polygonIdx:e.hash>t.hash?1:-1));let r=0,n=0,i=0,s=e[r].polygonIdx;do{n++,(n===e.length||e[r].hash!==e[n].hash)&&((1==n-r||e[n-1].polygonIdx!==s)&&(i<r&&(e[i]=e[r],e[r]=null),e[i].type="none",i++),r=n,r!==e.length&&(s=e[r].polygonIdx))}while(r!==e.length);if(e.splice(i),0!==e.length&&0!==t.length){e.sort(((t,e)=>t.portalHash<e.portalHash?1:-1));let r=0,n=0;for(;r!==e.length&&n!==t.length;){const i=e[r],s=t[n];i.portalHash>s.hash?r++:s.hash>i.portalHash?n++:(i.type=s.type,r++)}}}isOnBorder(t,e){return t<=0&&e<=0||t>=Ui&&e>=Ui}addFeatureSection(t,e,r,n){return t!==e&&(e=t,r.push({featureIndex:t,vertexStart:n.getVertexCount()}),n.clearVertexLookup()),e}sortSubarray(t,e,r,n){const i=t.slice(e,r);i.sort(n),t.splice(e,i.length,...i)}static computeEdgeHash(t,e){return(t.y===e.y&&t.x>e.x||t.y>e.y)&&([t,e]=[e,t]),BigInt(Nd.computePosHash(t))<<32n|BigInt(Nd.computePosHash(e))}static computePosHash(t){return((65535&t.x)<<16|65535&t.y)>>>0}}var jd,$d={exports:{}},Gd=(jd||(jd=1,function(t){function e(t,e){return t>e?1:t<e?-1:0}var r=function(t,r){void 0===t&&(t=e),void 0===r&&(r=!1),this._compare=t,this._root=null,this._size=0,this._noDuplicates=!!r},n={size:{configurable:!0}};function i(t,e,r,n,s){var a=s-n;if(a>0){var o=n+Math.floor(a/2),l={key:e[o],data:r[o],parent:t};return l.left=i(l,e,r,n,o),l.right=i(l,e,r,o+1,s),l}return null}function s(t,e,r,n,i){if(!(r>=n)){for(var a=t[r+n>>1],o=r-1,l=n+1;;){do{o++}while(i(t[o],a)<0);do{l--}while(i(t[l],a)>0);if(o>=l)break;var u=t[o];t[o]=t[l],t[l]=u,u=e[o],e[o]=e[l],e[l]=u}s(t,e,r,l,i),s(t,e,l+1,n,i)}}r.prototype.rotateLeft=function(t){var e=t.right;e&&(t.right=e.left,e.left&&(e.left.parent=t),e.parent=t.parent),t.parent?t===t.parent.left?t.parent.left=e:t.parent.right=e:this._root=e,e&&(e.left=t),t.parent=e},r.prototype.rotateRight=function(t){var e=t.left;e&&(t.left=e.right,e.right&&(e.right.parent=t),e.parent=t.parent),t.parent?t===t.parent.left?t.parent.left=e:t.parent.right=e:this._root=e,e&&(e.right=t),t.parent=e},r.prototype._splay=function(t){for(;t.parent;){var e=t.parent;e.parent?e.left===t&&e.parent.left===e?(this.rotateRight(e.parent),this.rotateRight(e)):e.right===t&&e.parent.right===e?(this.rotateLeft(e.parent),this.rotateLeft(e)):e.left===t&&e.parent.right===e?(this.rotateRight(e),this.rotateLeft(e)):(this.rotateLeft(e),this.rotateRight(e)):e.left===t?this.rotateRight(e):this.rotateLeft(e)}},r.prototype.splay=function(t){for(var e,r,n,i,s;t.parent;)(r=(e=t.parent).parent)&&r.parent?((n=r.parent).left===r?n.left=t:n.right=t,t.parent=n):(t.parent=null,this._root=t),i=t.left,s=t.right,t===e.left?(r&&(r.left===e?(e.right?(r.left=e.right,r.left.parent=r):r.left=null,e.right=r,r.parent=e):(i?(r.right=i,i.parent=r):r.right=null,t.left=r,r.parent=t)),s?(e.left=s,s.parent=e):e.left=null,t.right=e,e.parent=t):(r&&(r.right===e?(e.left?(r.right=e.left,r.right.parent=r):r.right=null,e.left=r,r.parent=e):(s?(r.left=s,s.parent=r):r.left=null,t.right=r,r.parent=t)),i?(e.right=i,i.parent=e):e.right=null,t.left=e,e.parent=t)},r.prototype.replace=function(t,e){t.parent?t===t.parent.left?t.parent.left=e:t.parent.right=e:this._root=e,e&&(e.parent=t.parent)},r.prototype.minNode=function(t){if(void 0===t&&(t=this._root),t)for(;t.left;)t=t.left;return t},r.prototype.maxNode=function(t){if(void 0===t&&(t=this._root),t)for(;t.right;)t=t.right;return t},r.prototype.insert=function(t,e){var r=this._root,n=null,i=this._compare;if(this._noDuplicates)for(;r;){if(n=r,0===i(r.key,t))return;r=i(r.key,t)<0?r.right:r.left}else for(;r;)n=r,r=i(r.key,t)<0?r.right:r.left;return r={key:t,data:e,left:null,right:null,parent:n},n?i(n.key,r.key)<0?n.right=r:n.left=r:this._root=r,this.splay(r),this._size++,r},r.prototype.find=function(t){for(var e=this._root,r=this._compare;e;){var n=r(e.key,t);if(n<0)e=e.right;else{if(!(n>0))return e;e=e.left}}return null},r.prototype.contains=function(t){for(var e=this._root,r=this._compare;e;){var n=r(t,e.key);if(0===n)return!0;e=n<0?e.left:e.right}return!1},r.prototype.remove=function(t){var e=this.find(t);if(!e)return!1;if(this.splay(e),e.left)if(e.right){var r=this.minNode(e.right);r.parent!==e&&(this.replace(r,r.right),r.right=e.right,r.right.parent=r),this.replace(e,r),r.left=e.left,r.left.parent=r}else this.replace(e,e.left);else this.replace(e,e.right);return this._size--,!0},r.prototype.removeNode=function(t){if(!t)return!1;if(this.splay(t),t.left)if(t.right){var e=this.minNode(t.right);e.parent!==t&&(this.replace(e,e.right),e.right=t.right,e.right.parent=e),this.replace(t,e),e.left=t.left,e.left.parent=e}else this.replace(t,t.left);else this.replace(t,t.right);return this._size--,!0},r.prototype.erase=function(t){var e=this.find(t);if(e){this.splay(e);var r=e.left,n=e.right,i=null;r&&(r.parent=null,i=this.maxNode(r),this.splay(i),this._root=i),n&&(r?i.right=n:this._root=n,n.parent=i),this._size--}},r.prototype.pop=function(){var t=this._root,e=null;if(t){for(;t.left;)t=t.left;e={key:t.key,data:t.data},this.remove(t.key)}return e},r.prototype.next=function(t){var e=t;if(e)if(e.right)for(e=e.right;e&&e.left;)e=e.left;else for(e=t.parent;e&&e.right===t;)t=e,e=e.parent;return e},r.prototype.prev=function(t){var e=t;if(e)if(e.left)for(e=e.left;e&&e.right;)e=e.right;else for(e=t.parent;e&&e.left===t;)t=e,e=e.parent;return e},r.prototype.forEach=function(t){for(var e=this._root,r=[],n=!1,i=0;!n;)e?(r.push(e),e=e.left):r.length>0?(t(e=r.pop(),i++),e=e.right):n=!0;return this},r.prototype.range=function(t,e,r,n){for(var i=[],s=this._compare,a=this._root;0!==i.length||a;)if(a)i.push(a),a=a.left;else{if(s((a=i.pop()).key,e)>0)break;if(s(a.key,t)>=0&&r.call(n,a))return this;a=a.right}return this},r.prototype.keys=function(){for(var t=this._root,e=[],r=[],n=!1;!n;)t?(e.push(t),t=t.left):e.length>0?(t=e.pop(),r.push(t.key),t=t.right):n=!0;return r},r.prototype.values=function(){for(var t=this._root,e=[],r=[],n=!1;!n;)t?(e.push(t),t=t.left):e.length>0?(t=e.pop(),r.push(t.data),t=t.right):n=!0;return r},r.prototype.at=function(t){for(var e=this._root,r=[],n=!1,i=0;!n;)if(e)r.push(e),e=e.left;else if(r.length>0){if(e=r.pop(),i===t)return e;i++,e=e.right}else n=!0;return null},r.prototype.load=function(t,e,r){if(void 0===t&&(t=[]),void 0===e&&(e=[]),void 0===r&&(r=!1),0!==this._size)throw new Error("bulk-load: tree is not empty");var n=t.length;return r&&s(t,e,0,n-1,this._compare),this._root=i(null,t,e,0,n),this._size=n,this},r.prototype.min=function(){var t=this.minNode(this._root);return t?t.key:null},r.prototype.max=function(){var t=this.maxNode(this._root);return t?t.key:null},r.prototype.isEmpty=function(){return null===this._root},n.size.get=function(){return this._size},r.createTree=function(t,e,n,i,s){return new r(n,s).load(t,e,i)},Object.defineProperties(r.prototype,n);var a=0,o=1,l=2,u=3,c=0,h=1,p=2,d=3;function f(t,e,r){null===e?(t.inOut=!1,t.otherInOut=!0):(t.isSubject===e.isSubject?(t.inOut=!e.inOut,t.otherInOut=e.otherInOut):(t.inOut=!e.otherInOut,t.otherInOut=e.isVertical()?!e.inOut:e.inOut),e&&(t.prevInResult=!m(e,r)||e.isVertical()?e.prevInResult:e));var n=m(t,r);t.resultTransition=n?function(t,e){var r,n=!t.inOut,i=!t.otherInOut;switch(e){case c:r=n&&i;break;case h:r=n||i;break;case d:r=n^i;break;case p:r=t.isSubject?n&&!i:i&&!n}return r?1:-1}(t,r):0}function m(t,e){switch(t.type){case a:switch(e){case c:return!t.otherInOut;case h:return t.otherInOut;case p:return t.isSubject&&t.otherInOut||!t.isSubject&&!t.otherInOut;case d:return!0}break;case l:return e===c||e===h;case u:return e===p;case o:return!1}return!1}var y=function(t,e,r,n,i){this.left=e,this.point=t,this.otherEvent=r,this.isSubject=n,this.type=i||a,this.inOut=!1,this.otherInOut=!1,this.prevInResult=null,this.resultTransition=0,this.otherPos=-1,this.outputContourId=-1,this.isExteriorRing=!0},g={inResult:{configurable:!0}};function x(t,e){return t[0]===e[0]&&t[1]===e[1]}y.prototype.isBelow=function(t){var e=this.point,r=this.otherEvent.point;return this.left?(e[0]-t[0])*(r[1]-t[1])-(r[0]-t[0])*(e[1]-t[1])>0:(r[0]-t[0])*(e[1]-t[1])-(e[0]-t[0])*(r[1]-t[1])>0},y.prototype.isAbove=function(t){return!this.isBelow(t)},y.prototype.isVertical=function(){return this.point[0]===this.otherEvent.point[0]},g.inResult.get=function(){return 0!==this.resultTransition},y.prototype.clone=function(){var t=new y(this.point,this.left,this.otherEvent,this.isSubject,this.type);return t.contourId=this.contourId,t.resultTransition=this.resultTransition,t.prevInResult=this.prevInResult,t.isExteriorRing=this.isExteriorRing,t.inOut=this.inOut,t.otherInOut=this.otherInOut,t},Object.defineProperties(y.prototype,g);var v=11102230246251565e-32,b=134217729,w=(3+8*v)*v;function _(t,e,r,n,i){var s,a,o,l,u=e[0],c=n[0],h=0,p=0;c>u==c>-u?(s=u,u=e[++h]):(s=c,c=n[++p]);var d=0;if(h<t&&p<r)for(c>u==c>-u?(o=s-((a=u+s)-u),u=e[++h]):(o=s-((a=c+s)-c),c=n[++p]),s=a,0!==o&&(i[d++]=o);h<t&&p<r;)c>u==c>-u?(o=s-((a=s+u)-(l=a-s))+(u-l),u=e[++h]):(o=s-((a=s+c)-(l=a-s))+(c-l),c=n[++p]),s=a,0!==o&&(i[d++]=o);for(;h<t;)o=s-((a=s+u)-(l=a-s))+(u-l),u=e[++h],s=a,0!==o&&(i[d++]=o);for(;p<r;)o=s-((a=s+c)-(l=a-s))+(c-l),c=n[++p],s=a,0!==o&&(i[d++]=o);return 0===s&&0!==d||(i[d++]=s),d}function A(t){return new Float64Array(t)}var I=33306690738754716e-32,M=22204460492503146e-32,S=11093356479670487e-47,P=A(4),k=A(8),B=A(12),z=A(16),T=A(4);function E(t,e,r){var n=function(t,e,r,n,i,s){var a=(e-s)*(r-i),o=(t-i)*(n-s),l=a-o;if(0===a||0===o||a>0!=o>0)return l;var u=Math.abs(a+o);return Math.abs(l)>=I*u?l:-function(t,e,r,n,i,s,a){var o,l,u,c,h,p,d,f,m,y,g,x,v,A,I,E,V,F,C=t-i,D=r-i,R=e-s,L=n-s;P[0]=(I=(f=C-(d=(p=b*C)-(p-C)))*(y=L-(m=(p=b*L)-(p-L)))-((A=C*L)-d*m-f*m-d*y))-((g=I-(V=(f=R-(d=(p=b*R)-(p-R)))*(y=D-(m=(p=b*D)-(p-D)))-((E=R*D)-d*m-f*m-d*y)))+(h=I-g))+(h-V),P[1]=(v=A-((x=A+g)-(h=x-A))+(g-h))-((g=v-E)+(h=v-g))+(h-E),P[2]=x-((F=x+g)-(h=F-x))+(g-h),P[3]=F;var O=function(t,e){for(var r=e[0],n=1;n<4;n++)r+=e[n];return r}(0,P),U=M*a;if(O>=U||-O>=U)return O;if(o=t-(C+(h=t-C))+(h-i),u=r-(D+(h=r-D))+(h-i),l=e-(R+(h=e-R))+(h-s),c=n-(L+(h=n-L))+(h-s),0===o&&0===l&&0===u&&0===c)return O;if(U=S*a+w*Math.abs(O),(O+=C*c+L*o-(R*u+D*l))>=U||-O>=U)return O;T[0]=(I=(f=o-(d=(p=b*o)-(p-o)))*(y=L-(m=(p=b*L)-(p-L)))-((A=o*L)-d*m-f*m-d*y))-((g=I-(V=(f=l-(d=(p=b*l)-(p-l)))*(y=D-(m=(p=b*D)-(p-D)))-((E=l*D)-d*m-f*m-d*y)))+(h=I-g))+(h-V),T[1]=(v=A-((x=A+g)-(h=x-A))+(g-h))-((g=v-E)+(h=v-g))+(h-E),T[2]=x-((F=x+g)-(h=F-x))+(g-h),T[3]=F;var N=_(4,P,4,T,k);T[0]=(I=(f=C-(d=(p=b*C)-(p-C)))*(y=c-(m=(p=b*c)-(p-c)))-((A=C*c)-d*m-f*m-d*y))-((g=I-(V=(f=R-(d=(p=b*R)-(p-R)))*(y=u-(m=(p=b*u)-(p-u)))-((E=R*u)-d*m-f*m-d*y)))+(h=I-g))+(h-V),T[1]=(v=A-((x=A+g)-(h=x-A))+(g-h))-((g=v-E)+(h=v-g))+(h-E),T[2]=x-((F=x+g)-(h=F-x))+(g-h),T[3]=F;var j=_(N,k,4,T,B);T[0]=(I=(f=o-(d=(p=b*o)-(p-o)))*(y=c-(m=(p=b*c)-(p-c)))-((A=o*c)-d*m-f*m-d*y))-((g=I-(V=(f=l-(d=(p=b*l)-(p-l)))*(y=u-(m=(p=b*u)-(p-u)))-((E=l*u)-d*m-f*m-d*y)))+(h=I-g))+(h-V),T[1]=(v=A-((x=A+g)-(h=x-A))+(g-h))-((g=v-E)+(h=v-g))+(h-E),T[2]=x-((F=x+g)-(h=F-x))+(g-h),T[3]=F;var $=_(j,B,4,T,z);return z[$-1]}(t,e,r,n,i,s,u)}(t[0],t[1],e[0],e[1],r[0],r[1]);return n>0?-1:n<0?1:0}function V(t,e){var r=t.point,n=e.point;return r[0]>n[0]?1:r[0]<n[0]?-1:r[1]!==n[1]?r[1]>n[1]?1:-1:function(t,e,r,n){return t.left!==e.left?t.left?1:-1:0!==E(r,t.otherEvent.point,e.otherEvent.point)?t.isBelow(e.otherEvent.point)?-1:1:!t.isSubject&&e.isSubject?1:-1}(t,e,r)}function F(t,e,r){var n=new y(e,!1,t,t.isSubject),i=new y(e,!0,t.otherEvent,t.isSubject);return x(t.point,t.otherEvent.point)&&console.warn("what is that, a collapsed segment?",t),n.contourId=i.contourId=t.contourId,V(i,t.otherEvent)>0&&(t.otherEvent.left=!0,i.left=!1),t.otherEvent.otherEvent=i,t.otherEvent=n,r.push(i),r.push(n),r}function C(t,e){return t[0]*e[1]-t[1]*e[0]}function D(t,e){return t[0]*e[0]+t[1]*e[1]}function R(t,e,r){var n=function(t,e,r,n,i){var s=[e[0]-t[0],e[1]-t[1]],a=[n[0]-r[0],n[1]-r[1]];function o(t,e,r){return[t[0]+e*r[0],t[1]+e*r[1]]}var l=[r[0]-t[0],r[1]-t[1]],u=C(s,a),c=u*u,h=D(s,s);if(c>0){var p=C(l,a)/u;if(p<0||p>1)return null;var d=C(l,s)/u;return d<0||d>1?null:0===p||1===p?[o(t,p,s)]:0===d||1===d?[o(r,d,a)]:[o(t,p,s)]}if((c=(u=C(l,s))*u)>0)return null;var f=D(s,l)/h,m=f+D(s,a)/h,y=Math.min(f,m),g=Math.max(f,m);return y<=1&&g>=0?1===y?[o(t,y>0?y:0,s)]:0===g?[o(t,g<1?g:1,s)]:[o(t,y>0?y:0,s),o(t,g<1?g:1,s)]:null}(t.point,t.otherEvent.point,e.point,e.otherEvent.point),i=n?n.length:0;if(0===i)return 0;if(1===i&&(x(t.point,e.point)||x(t.otherEvent.point,e.otherEvent.point)))return 0;if(2===i&&t.isSubject===e.isSubject)return 0;if(1===i)return x(t.point,n[0])||x(t.otherEvent.point,n[0])||F(t,n[0],r),x(e.point,n[0])||x(e.otherEvent.point,n[0])||F(e,n[0],r),1;var s=[],a=!1,c=!1;return x(t.point,e.point)?a=!0:1===V(t,e)?s.push(e,t):s.push(t,e),x(t.otherEvent.point,e.otherEvent.point)?c=!0:1===V(t.otherEvent,e.otherEvent)?s.push(e.otherEvent,t.otherEvent):s.push(t.otherEvent,e.otherEvent),a&&c||a?(e.type=o,t.type=e.inOut===t.inOut?l:u,a&&!c&&F(s[1].otherEvent,s[0].point,r),2):c?(F(s[0],s[1].point,r),3):s[0]!==s[3].otherEvent?(F(s[0],s[1].point,r),F(s[1],s[2].point,r),3):(F(s[0],s[1].point,r),F(s[3].otherEvent,s[2].point,r),3)}function L(t,e){if(t===e)return 0;if(0!==E(t.point,t.otherEvent.point,e.point)||0!==E(t.point,t.otherEvent.point,e.otherEvent.point))return x(t.point,e.point)?t.isBelow(e.otherEvent.point)?-1:1:t.point[0]===e.point[0]?t.point[1]<e.point[1]?-1:1:1===V(t,e)?e.isAbove(t.point)?-1:1:t.isBelow(e.point)?-1:1;if(t.isSubject!==e.isSubject)return t.isSubject?-1:1;var r=t.point,n=e.point;return r[0]===n[0]&&r[1]===n[1]?(r=t.otherEvent.point)[0]===(n=e.otherEvent.point)[0]&&r[1]===n[1]?0:t.contourId>e.contourId?1:-1:1===V(t,e)?1:-1}var O=function(){this.points=[],this.holeIds=[],this.holeOf=null,this.depth=null};function U(t,e,r,n){var i,s=t+1,a=e[t].point,o=e.length;for(s<o&&(i=e[s].point);s<o&&i[0]===a[0]&&i[1]===a[1];){if(!r[s])return s;++s<o&&(i=e[s].point)}for(s=t-1;r[s]&&s>n;)s--;return s}O.prototype.isExterior=function(){return null==this.holeOf};var N=$,j=$;function $(t,e){if(!(this instanceof $))return new $(t,e);if(this.data=t||[],this.length=this.data.length,this.compare=e||G,this.length>0)for(var r=(this.length>>1)-1;r>=0;r--)this._down(r)}function G(t,e){return t<e?-1:t>e?1:0}$.prototype={push:function(t){this.data.push(t),this.length++,this._up(this.length-1)},pop:function(){if(0!==this.length){var t=this.data[0];return this.length--,this.length>0&&(this.data[0]=this.data[this.length],this._down(0)),this.data.pop(),t}},peek:function(){return this.data[0]},_up:function(t){for(var e=this.data,r=this.compare,n=e[t];t>0;){var i=t-1>>1,s=e[i];if(r(n,s)>=0)break;e[t]=s,t=i}e[t]=n},_down:function(t){for(var e=this.data,r=this.compare,n=this.length>>1,i=e[t];t<n;){var s=1+(t<<1),a=s+1,o=e[s];if(a<this.length&&r(e[a],o)<0&&(s=a,o=e[a]),r(o,i)>=0)break;e[t]=o,t=s}e[t]=i}},N.default=j;var q=Math.max,H=Math.min,X=0;function Z(t,e,r,n,i,s){var a,o,l,u,c,h;for(a=0,o=t.length-1;a<o;a++)if(u=t[a+1],c=new y(l=t[a],!1,void 0,e),h=new y(u,!1,c,e),c.otherEvent=h,l[0]!==u[0]||l[1]!==u[1]){c.contourId=h.contourId=r,s||(c.isExteriorRing=!1,h.isExteriorRing=!1),V(c,h)>0?h.left=!0:c.left=!0;var p=l[0],d=l[1];i[0]=H(i[0],p),i[1]=H(i[1],d),i[2]=q(i[2],p),i[3]=q(i[3],d),n.push(c),n.push(h)}}var W=[];function Y(t,e,n){"number"==typeof t[0][0][0]&&(t=[t]),"number"==typeof e[0][0][0]&&(e=[e]);var i=function(t,e,r){var n=null;return t.length*e.length==0&&(r===c?n=W:r===p?n=t:r!==h&&r!==d||(n=0===t.length?e:t)),n}(t,e,n);if(i)return i===W?null:i;var s=[1/0,1/0,-1/0,-1/0],a=[1/0,1/0,-1/0,-1/0],o=function(t,e,r,n,i){var s,a,o,l,u,c,h=new N(null,V);for(o=0,l=t.length;o<l;o++)for(u=0,c=(s=t[o]).length;u<c;u++)(a=0===u)&&X++,Z(s[u],!0,X,h,r,a);for(o=0,l=e.length;o<l;o++)for(u=0,c=(s=e[o]).length;u<c;u++)a=0===u,i===p&&(a=!1),a&&X++,Z(s[u],!1,X,h,n,a);return h}(t,e,s,a,n);if(i=function(t,e,r,n,i){var s=null;return(r[0]>n[2]||n[0]>r[2]||r[1]>n[3]||n[1]>r[3])&&(i===c?s=W:i===p?s=t:i!==h&&i!==d||(s=t.concat(e))),s}(t,e,s,a,n))return i===W?null:i;for(var l=function(t){var e,r,n=function(t){var e,r,n,i,s=[];for(r=0,n=t.length;r<n;r++)((e=t[r]).left&&e.inResult||!e.left&&e.otherEvent.inResult)&&s.push(e);for(var a=!1;!a;)for(a=!0,r=0,n=s.length;r<n;r++)r+1<n&&1===V(s[r],s[r+1])&&(i=s[r],s[r]=s[r+1],s[r+1]=i,a=!1);for(r=0,n=s.length;r<n;r++)(e=s[r]).otherPos=r;for(r=0,n=s.length;r<n;r++)(e=s[r]).left||(i=e.otherPos,e.otherPos=e.otherEvent.otherPos,e.otherEvent.otherPos=i);return s}(t),i={},s=[],a=function(){if(!i[e]){var t=s.length,r=function(t,e,r){var n=new O;if(null!=t.prevInResult){var i=t.prevInResult,s=i.outputContourId;if(i.resultTransition>0){var a=e[s];if(null!=a.holeOf){var o=a.holeOf;e[o].holeIds.push(r),n.holeOf=o,n.depth=e[s].depth}else e[s].holeIds.push(r),n.holeOf=s,n.depth=e[s].depth+1}else n.holeOf=null,n.depth=e[s].depth}else n.holeOf=null,n.depth=0;return n}(n[e],s,t),a=function(e){i[e]=!0,e<n.length&&n[e]&&(n[e].outputContourId=t)},o=e,l=e;for(r.points.push(n[e].point);a(o),a(o=n[o].otherPos),r.points.push(n[o].point),!((o=U(o,n,i,l))==l||o>=n.length)&&n[o];);s.push(r)}};for(e=0,r=n.length;e<r;e++)a();return s}(function(t,e,n,i,s,a){for(var o,l,u,h=new r(L),d=[],m=Math.min(i[2],s[2]);0!==t.length;){var y=t.pop();if(d.push(y),a===c&&y.point[0]>m||a===p&&y.point[0]>i[2])break;if(y.left){l=o=h.insert(y),o=o!==(u=h.minNode())?h.prev(o):null,l=h.next(l);var g=o?o.key:null;if(f(y,g,a),l&&2===R(y,l.key,t)&&(f(y,g,a),f(l.key,y,a)),o&&2===R(o.key,y,t)){var x=o;f(g,(x=x!==u?h.prev(x):null)?x.key:null,a),f(y,g,a)}}else l=o=h.find(y=y.otherEvent),o&&l&&(o=o!==u?h.prev(o):null,l=h.next(l),h.remove(y),l&&o&&R(o.key,l.key,t))}return d}(o,0,0,s,a,n)),u=[],m=0;m<l.length;m++){var y=l[m];if(y.isExterior()){for(var g=[y.points],x=0;x<y.holeIds.length;x++)g.push(l[y.holeIds[x]].points);u.push(g)}}return u}var K={UNION:h,DIFFERENCE:p,INTERSECTION:c,XOR:d};t.diff=function(t,e){return Y(t,e,p)},t.intersection=function(t,e){return Y(t,e,c)},t.operations=K,t.union=function(t,e){return Y(t,e,h)},t.xor=function(t,e){return Y(t,e,d)},Object.defineProperty(t,"__esModule",{value:!0})}($d.exports)),$d.exports);
/**
* martinez v0.7.4
* Martinez polygon clipping algorithm, does boolean operation on polygons (multipolygons, polygons with holes etc): intersection, union, difference, xor
*
* @author Alex Milevski <info@w8r.name>
* @license MIT
* @preserve
*/function qd(t,e,r,n){const i=[],s=0===n?(t,e,r,n,i,s)=>{t.push(new $t(s,r+(s-e)/(n-e)*(i-r)))}:(t,e,r,n,i,s)=>{t.push(new $t(e+(s-r)/(i-r)*(n-e),s))};for(const a of t){const t=[];for(const i of a){if(i.length<=2)continue;const a=[];for(let t=0;t<i.length-1;t++){const o=i[t].x,l=i[t].y,u=i[t+1].x,c=i[t+1].y,h=0===n?o:l,p=0===n?u:c;h<e?p>e&&s(a,o,l,u,c,e):h>r?p<r&&s(a,o,l,u,c,r):a.push(i[t]),p<e&&h>=e&&s(a,o,l,u,c,e),p>r&&h<=r&&s(a,o,l,u,c,r)}let o=i[i.length-1];const l=0===n?o.x:o.y;l>=e&&l<=r&&a.push(o),a.length&&(o=a[a.length-1],a[0].x===o.x&&a[0].y===o.y||a.push(a[0]),t.push(a))}t.length&&i.push(t)}return i}function Hd(t,e){const r=Zd(t),n=Zd([e]),i=Gd.intersection(r,n);return null==i?[]:Wd(i)}function Xd(t,e){const r=65536;let n=Zd(t,r);const i=[];for(;e.valid();e.next()){const[t,n]=e.get(),s=t.x*r,a=t.y*r,o=n.x*r,l=n.y*r,u=o-s,c=l-a,h=Math.hypot(u,c);if(0===h)continue;const p=Math.trunc(c/h*3),d=-Math.trunc(u/h*3);i.push([[[s,a],[o,l],[o+p,l+d],[s+p,a+d],[s,a]]])}return i.length>0&&(n=Gd.diff(n,i)),Wd(n,1/r)}function Zd(t,e=1){return[t.map((t=>t.map((t=>[t.x*e,t.y*e]))))]}function Wd(t,e=1){return t.map((t=>t.map(((t,r)=>{const n=t.map((t=>new $t(t[0]*e,t[1]*e).round()));return r>0&&n.reverse(),n}))))}class Yd{constructor(t,e){this.layoutVertexArray=new _l,this.indexArray=new $l,this.lineIndexArray=new Ll,this.triangleSegments=new bu,this.lineSegments=new bu,this.programConfigurations=new Yu(t.layers,{zoom:t.zoom,lut:t.lut}),this.uploaded=!1,e&&(this.elevatedLayoutVertexArray=new Ml)}update(t,e,r,n,i,s,a,o){this.programConfigurations.updatePaintArrays(t,e,i,r,n,s,a,o)}isEmpty(){return 0===this.layoutVertexArray.length}needsUpload(){return this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,nd.members),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.lineIndexBuffer=t.createIndexBuffer(this.lineIndexArray),this.elevatedLayoutVertexArray&&this.elevatedLayoutVertexArray.length>0&&(this.elevatedLayoutVertexBuffer=t.createVertexBuffer(this.elevatedLayoutVertexArray,id.members))),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.lineIndexBuffer.destroy(),this.programConfigurations.destroy(),this.triangleSegments.destroy(),this.lineSegments.destroy())}populatePaintArrays(t,e,r,n,i,s,a){this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,e,r,n,i,s,void 0,a)}}class Kd{constructor(t){this.zoom=t.zoom,this.pixelRatio=t.pixelRatio,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.fqid)),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lut=t.lut,this.bufferData=new Yd(t,!1),this.elevationBufferData=new Yd(t,!0),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.projection=t.projection,this.elevationMode=this.layers[0].layout.get("fill-elevation-reference"),this.sourceLayerIndex=t.sourceLayerIndex,this.worldview=t.worldview,this.hasAppearances=null}updateFootprints(t,e){}updateAppearances(t,e,r,n){}populate(t,e,r,n){this.hasPattern=Dd("fill",this.layers,this.pixelRatio,e);const i=this.layers[0].layout.get("fill-sort-key"),s=[];for(const{feature:a,id:o,index:l,sourceLayerIndex:u}of t){const t=this.layers[0]._featureFilter.needGeometry,c=Nc(a,t);if(!this.layers[0]._featureFilter.filter(new Po(this.zoom,{worldview:this.worldview,activeFloors:e.activeFloors}),c,r))continue;const h=i?i.evaluate(c,{},r,e.availableImages):void 0,p={id:o,properties:a.properties,type:a.type,sourceLayerIndex:u,index:l,geometry:t?c.geometry:Uc(a,r,n),patterns:{},sortKey:h};s.push(p)}i&&s.sort(((t,e)=>t.sortKey-e.sortKey));for(const n of s){const{geometry:i,index:s,sourceLayerIndex:a}=n;if(this.hasPattern){const t=Rd("fill",this.layers,n,this.zoom,this.pixelRatio,e);this.patternFeatures.push(t)}else this.addFeature(n,i,s,r,{},e.availableImages,e.brightness,e.elevationFeatures);e.featureIndex.insert(t[s].feature,i,s,a,this.index)}}update(t,e,r,n,i,s,a){this.bufferData.update(t,e,r,n,i,s,a,this.worldview),this.elevationBufferData.update(t,e,r,n,i,s,a,this.worldview),this.elevatedStructures&&this.elevatedStructures.update(t,e,r,n,i,s,a,this.worldview)}addFeatures(t,e,r,n,i,s){for(const i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,e,r,n,s,t.elevationFeatures)}isEmpty(){return this.bufferData.isEmpty()&&this.elevationBufferData.isEmpty()}uploadPending(){return!this.uploaded||this.bufferData.needsUpload()||this.elevationBufferData.needsUpload()}upload(t){this.bufferData.upload(t),this.elevationBufferData.upload(t),this.elevatedStructures&&this.elevatedStructures.upload(t)}destroy(){this.bufferData.destroy(),this.elevationBufferData.destroy(),this.elevatedStructures&&this.elevatedStructures.destroy()}addFeature(t,e,r,n,i,s=[],a,o){const l=Vd(e,500);"none"!==this.elevationMode?this.addElevatedRoadFeature(t,l,n,r,o):this.addGeometry(l,this.bufferData),this.bufferData.populatePaintArrays(t,r,i,s,n,a,this.worldview),this.elevationBufferData.populatePaintArrays(t,r,i,s,n,a,this.worldview)}getUnevaluatedPortalGraph(){return this.elevatedStructures?this.elevatedStructures.unevaluatedPortals:void 0}getElevationPolygons(){return this.elevatedStructures?this.elevatedStructures.portalPolygons:void 0}setEvaluatedPortalGraph(t,e,r,n,i){this.elevatedStructures&&(this.elevatedStructures.construct(t),this.elevatedStructures.populatePaintArrays(e,r,n,i,this.worldview))}addElevatedRoadFeature(t,e,r,n,i){const s=new Array,a=xh.getElevationFeature(t,i);if(!a)return void this.addGeometry(e,this.bufferData);{const t=this.clipPolygonsToTile(e,1);t.length>0&&s.push({polygons:t,elevationFeature:a,elevationTileID:r})}const o={guardRailEnabled:this.layers[0].layout.get("fill-construct-bridge-guard-rail").evaluate(t,{},r),featureIndex:n};for(const e of s)if(e.elevationFeature){if("hd-road-base"===this.elevationMode){this.elevatedStructures||(this.elevatedStructures=new Nd(e.elevationTileID,this.layers,this.zoom,this.lut));const r=e.elevationFeature.isTunnel();let n=0;t.properties.hasOwnProperty(Yc)&&(n=+t.properties[Yc]);for(const t of e.polygons)this.elevatedStructures.addPortalCandidates(e.elevationFeature.id,t,r,e.elevationFeature,n)}null==e.elevationFeature.constantHeight&&(e.polygons=this.prepareElevatedPolygons(e.polygons,e.elevationFeature,e.elevationTileID));const i=new vh(r,e.elevationTileID);this.addElevatedGeometry(e.polygons,i,e.elevationFeature,"hd-road-base"===this.elevationMode?0:.05,n,o)}}addElevatedGeometry(t,e,r,n,i,s){const a={elevation:r,elevationSampler:e,bias:n,index:i,featureInfo:s},[o,l]=this.addGeometry(t,this.elevationBufferData,a);null==this.elevationBufferData.heightRange?this.elevationBufferData.heightRange={min:o,max:l}:(this.elevationBufferData.heightRange.min=Math.min(this.elevationBufferData.heightRange.min,o),this.elevationBufferData.heightRange.max=Math.max(this.elevationBufferData.heightRange.max,l))}addGeometry(t,e,r){let n=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,s=null;r&&(s=r.elevationSampler.constantElevation(r.elevation,r.bias),null!=s&&(n=s,i=s));const a=(t,a,o)=>{if(null!=r)if(a.push(t),null!=s)e.elevatedLayoutVertexArray.emplaceBack(s),o.push(s);else{const s=r.elevationSampler.pointElevation(t,r.elevation,r.bias);e.elevatedLayoutVertexArray.emplaceBack(s),o.push(s),n=Math.min(n,s),i=Math.max(i,s)}};for(const n of t){let t=0;for(const e of n)t+=e.length;const i=e.triangleSegments.prepareSegment(t,e.layoutVertexArray,e.indexArray),s=i.vertexLength,o=[],l=[],u=[],c=[],h=[],p=e.layoutVertexArray.length;for(const t of n){if(0===t.length)continue;t!==n[0]&&l.push(o.length/2);const i=e.lineSegments.prepareSegment(t.length,e.layoutVertexArray,e.lineIndexArray),s=i.vertexLength;r&&h.push(e.layoutVertexArray.length-p),a(t[0],u,c),e.layoutVertexArray.emplaceBack(t[0].x,t[0].y),e.lineIndexArray.emplaceBack(s+t.length-1,s),o.push(t[0].x),o.push(t[0].y);for(let r=1;r<t.length;r++)a(t[r],u,c),e.layoutVertexArray.emplaceBack(t[r].x,t[r].y),e.lineIndexArray.emplaceBack(s+r-1,s+r),o.push(t[r].x),o.push(t[r].y);i.vertexLength+=t.length,i.primitiveLength+=t.length}const d=od(o,l);for(let t=0;t<d.length;t+=3)e.indexArray.emplaceBack(s+d[t],s+d[t+1],s+d[t+2]);if(d.length>0&&r&&"hd-road-base"===this.elevationMode){const t=r.elevation.isTunnel(),e=r.elevation.safeArea,n=this.elevatedStructures.addVertices(u,c);this.elevatedStructures.addTriangles(d,n,t);const i=h.length;if(i>0){for(let s=0;s<i-1;s++)this.elevatedStructures.addRenderableRing(r.index,h[s]+n,h[s+1]-h[s],t,e,r.featureInfo);this.elevatedStructures.addRenderableRing(r.index,h[i-1]+n,u.length-h[i-1],t,e,r.featureInfo)}}i.vertexLength+=t,i.primitiveLength+=d.length/3}return[n,i]}prepareElevatedPolygons(t,e,r){const n=1/Tc(r),i=[];for(const r of t){const t=Xd(r,new yh(e,n));i.push(...t)}return i}clipPolygonsToTile(t,e){const r=-e,n=-e,i=Ui+e,s=Ui+e;let a=0;const o=[],l=[];for(;a<t.length;a++){const e=t[a],u=xi(e);(u.min.x>=r&&u.max.x<=i&&u.min.y>=n&&u.max.y<=s?o:l).push(e)}if(o.length===t.length)return t;const u=[new $t(r,n),new $t(i,n),new $t(i,s),new $t(r,s),new $t(r,n)],c=o;for(const t of l)c.push(...Hd(t,u));return c}}let Jd,Qd,tf,ef;Qa(Kd,"FillBucket",{omit:["layers","patternFeatures"]}),Qa(Yd,"FillBufferData"),Qa(Nd,"ElevatedStructures");class rf{constructor(t,e,r,n){if(this.triangleCount=e.length/3,this.min=new $t(0,0),this.max=new $t(0,0),this.xScale=0,this.yScale=0,this.cellsX=0,this.cellsY=0,this.cells=[],this.payload=[],0===this.triangleCount||0===t.length)return;const[i,s]=[t[0].clone(),t[0].clone()];for(let e=1;e<t.length;++e){const r=t[e];i.x=Math.min(i.x,r.x),i.y=Math.min(i.y,r.y),s.x=Math.max(s.x,r.x),s.y=Math.max(s.y,r.y)}if(n){const t=Math.ceil(Math.max(s.x-i.x,s.y-i.y)/n);r=Math.max(r,t)}if(0===r)return;this.min=i,this.max=s;const a=this.max.sub(this.min);a.x=Math.max(a.x,1),a.y=Math.max(a.y,1);const o=Math.max(a.x,a.y)/r;this.cellsX=Math.max(1,Math.ceil(a.x/o)),this.cellsY=Math.max(1,Math.ceil(a.y/o)),this.xScale=1/o,this.yScale=1/o;const l=[];for(let r=0;r<this.triangleCount;r++){const n=t[e[3*r+0]].sub(this.min),i=t[e[3*r+1]].sub(this.min),s=t[e[3*r+2]].sub(this.min),a=nf(Math.floor(Math.min(n.x,i.x,s.x)),this.xScale,this.cellsX),u=nf(Math.floor(Math.max(n.x,i.x,s.x)),this.xScale,this.cellsX),c=nf(Math.floor(Math.min(n.y,i.y,s.y)),this.yScale,this.cellsY),h=nf(Math.floor(Math.max(n.y,i.y,s.y)),this.yScale,this.cellsY),p=new $t(0,0),d=new $t(0,0),f=new $t(0,0),m=new $t(0,0);for(let t=c;t<=h;++t){p.y=d.y=t*o,f.y=m.y=(t+1)*o;for(let e=a;e<=u;++e)p.x=f.x=e*o,d.x=m.x=(e+1)*o,(Dh(n,i,s,p,d,m)||Dh(n,i,s,p,m,f))&&l.push({cellIdx:t*this.cellsX+e,triIdx:r})}}if(0===l.length)return;l.sort(((t,e)=>t.cellIdx-e.cellIdx||t.triIdx-e.triIdx));let u=0;for(;u<l.length;){const t=l[u].cellIdx,e={start:this.payload.length,len:0};for(;u<l.length&&l[u].cellIdx===t;)++e.len,this.payload.push(l[u++].triIdx);this.cells[t]=e}}_lazyInitLookup(){this.lookup||(this.lookup=new Uint8Array(Math.ceil(this.triangleCount/8))),this.lookup.fill(0)}queryPoint(t,e){if(0===this.triangleCount||0===this.cells.length)return;if(t.x>this.max.x||this.min.x>t.x||t.y>this.max.y||this.min.y>t.y)return;const r=nf(t.x-this.min.x,this.xScale,this.cellsX),n=nf(t.y-this.min.y,this.yScale,this.cellsY),i=this.cells[n*this.cellsX+r];if(i){this._lazyInitLookup();for(let t=0;t<i.len;t++){const r=this.payload[i.start+t],n=Math.floor(r/8),s=1<<r%8;if(!(this.lookup[n]&s)&&(this.lookup[n]|=s,e.push(r),e.length===this.triangleCount))return}}}query(t,e,r){if(0===this.triangleCount||0===this.cells.length)return;if(t.x>this.max.x||this.min.x>e.x)return;if(t.y>this.max.y||this.min.y>e.y)return;this._lazyInitLookup();const n=nf(t.x-this.min.x,this.xScale,this.cellsX),i=nf(e.x-this.min.x,this.xScale,this.cellsX),s=nf(t.y-this.min.y,this.yScale,this.cellsY),a=nf(e.y-this.min.y,this.yScale,this.cellsY);for(let t=s;t<=a;t++)for(let e=n;e<=i;e++){const n=this.cells[t*this.cellsX+e];if(n)for(let t=0;t<n.len;t++){const e=this.payload[n.start+t],i=Math.floor(e/8),s=1<<e%8;if(!(this.lookup[i]&s)&&(this.lookup[i]|=s,r.push(e),r.length===this.triangleCount))return}}}}function nf(t,e,r){return Math.max(0,Math.min(r-1,Math.floor(t*e)))}Qa(rf,"TriangleGridIndex");class sf{constructor(t){this.zoom=t.zoom,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.fqid)),this.index=t.index,this.hasPattern=!1,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.footprints=[],this.worldview=t.worldview,this.hasAppearances=null}updateFootprints(t,e){for(const r of this.footprints)e.push({footprint:r,id:t})}updateAppearances(t,e,r,n){}populate(t,e,r,n){const i=[];for(const{feature:s,id:a,index:o,sourceLayerIndex:l}of t){const t=this.layers[0]._featureFilter.needGeometry,u=Nc(s,t);if(!this.layers[0]._featureFilter.filter(new Po(this.zoom,{worldview:this.worldview,activeFloors:e.activeFloors}),u,r))continue;const c={id:a,properties:s.properties,type:s.type,sourceLayerIndex:l,index:o,geometry:t?u.geometry:Uc(s,r,n),patterns:{}};i.push(c)}for(const n of i){const{geometry:i,index:s,sourceLayerIndex:a}=n;this.addFeature(n,i,s,r,{},e.availableImages,e.brightness),e.featureIndex.insert(t[s].feature,i,s,a,this.index)}}isEmpty(){return 0===this.footprints.length}uploadPending(){return!1}upload(t){}update(t,e,r,n,i,s,a){}destroy(){}addFeature(t,e,r,n,i,s=[],a){for(const t of Vd(e,2)){const e=[],r=[],n=[],i=new $t(1/0,1/0),s=new $t(-1/0,-1/0);for(const a of t)if(0!==a.length){a!==t[0]&&n.push(r.length/2);for(let t=0;t<a.length;t++)r.push(a[t].x),r.push(a[t].y),e.push(a[t]),i.x=Math.min(i.x,a[t].x),i.y=Math.min(i.y,a[t].y),s.x=Math.max(s.x,a[t].x),s.y=Math.max(s.y,a[t].y)}const a=od(r,n),o=new rf(e,a,8,256);this.footprints.push({vertices:e,indices:a,grid:o,min:i,max:s})}}}Qa(sf,"ClipBucket",{omit:["layers"]});const af=bl([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),of=bl([{name:"a_pos_end",components:4,type:"Int16"},{name:"a_angular_offset_factor",components:1,type:"Int16"}]),lf=bl([{name:"a_flood_light_ground_radius",components:1,type:"Float32"}]),uf=bl([{name:"a_centroid_pos",components:2,type:"Uint16"}]),cf=bl([{name:"a_join_normal_inside",components:3,type:"Int16"}]),hf=bl([{name:"a_hidden_by_landmark",components:1,type:"Uint8"}]),pf=bl([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),{members:df}=af,ff=Number.MAX_SAFE_INTEGER,mf=ff-1;function yf(t,e,r,n){return t.order<e||t.order===ff||!(t.clipMask&r)||function(t,e){return 0!==e.length&&void 0===e.find((e=>e===t))}(n,t.clipScope)}class gf{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[],this._globalClipBounds={min:new $t(1/0,1/0),max:new $t(-1/0,-1/0)}}clear(){this._activeRegions.length>0&&++this._updateTime,this._activeRegions=[],this._prevRegions=[]}get updateTime(){return this._updateTime}getReplacementRegionsForTile(t,e=!1){const r=_f(new $t(0,0),new $t(Ui,Ui),t),n=[];if(e&&!bf(r,this._globalClipBounds))return n;for(const e of this._activeRegions){if(e.hiddenByOverlap)continue;if(!bf(r,e))continue;const i=Af(e.min,e.max,t);n.push({min:i.min,max:i.max,sourceId:this._sourceIds[e.priority],footprint:e.footprint,footprintTileId:e.tileId,order:e.order,clipMask:e.clipMask,clipScope:e.clipScope})}return n}setSources(t){this._setSources(t.map((t=>({getSourceId:()=>t.cache.id,getFootprints:()=>{const e=[];for(const r of t.cache.getVisibleCoordinates()){const n=t.cache.getTile(r).buckets[t.layer];n&&n.updateFootprints(r.toUnwrapped(),e)}return e},getOrder:()=>t.order,getClipMask:()=>t.clipMask,getClipScope:()=>t.clipScope}))))}_addSource(t){const e=t.getFootprints();if(0===e.length)return;const r=t.getOrder(),n=t.getClipMask(),i=t.getClipScope();for(const t of e){if(!t.footprint)continue;const e=_f(t.footprint.min,t.footprint.max,t.id);this._activeRegions.push({min:e.min,max:e.max,hiddenByOverlap:!1,priority:this._sourceIds.length,tileId:t.id,footprint:t.footprint,order:r,clipMask:n,clipScope:i})}this._sourceIds.push(t.getSourceId())}_computeReplacement(){this._activeRegions.sort(((t,e)=>t.priority-e.priority||xf(t.min,e.min)||xf(t.max,e.max)||t.order-e.order||t.clipMask-e.clipMask||function(t,e){const r=(t,e)=>t+e;return t.length-e.length||t.reduce(r,"").localeCompare(e.reduce(r,""))}(t.clipScope,e.clipScope)));let t=this._activeRegions.length!==this._prevRegions.length;if(!t){let e=0;for(;!t&&e!==this._activeRegions.length;){const r=this._activeRegions[e],n=this._prevRegions[e];t=r.priority!==n.priority||!vf(r,n)||r.order!==n.order||r.clipMask!==n.clipMask||!Gt(r.clipScope,n.clipScope),this._activeRegions[e].hiddenByOverlap=n.hiddenByOverlap,++e}}if(t){++this._updateTime;for(const t of this._activeRegions)t.order!==ff&&(this._globalClipBounds.min.x=Math.min(this._globalClipBounds.min.x,t.min.x),this._globalClipBounds.min.y=Math.min(this._globalClipBounds.min.y,t.min.y),this._globalClipBounds.max.x=Math.max(this._globalClipBounds.max.x,t.max.x),this._globalClipBounds.max.y=Math.max(this._globalClipBounds.max.y,t.max.y));const t=t=>{const e=this._activeRegions;if(t>=e.length)return t;const r=e[t].priority;for(;t<e.length&&e[t].priority===r;)++t;return t};if(this._sourceIds.length>1){let e=0,r=t(e);for(;e!==r;){let n=e;const i=e;for(;n!==r;){const t=this._activeRegions[n];t.hiddenByOverlap=!1;for(let e=0;e<i;e++){const r=this._activeRegions[e];if(!r.hiddenByOverlap&&t.order===ff&&bf(t,r)&&(t.hiddenByOverlap=Mf(t.footprint,t.tileId,r.footprint,r.tileId),t.hiddenByOverlap))break}++n}e=r,r=t(e)}}}}_setSources(t){[this._prevRegions,this._activeRegions]=[this._activeRegions,[]],this._sourceIds=[];for(let e=t.length-1;e>=0;e--)this._addSource(t[e]);this._computeReplacement()}}function xf(t,e){return t.x-e.x||t.y-e.y}function vf(t,e){return 0===xf(t.min,e.min)&&0===xf(t.max,e.max)}function bf(t,e){return!(t.min.x>e.max.x||t.max.x<e.min.x||t.min.y>e.max.y||t.max.y<e.min.y)}function wf(t,e){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(t[r].sourceId!==e[r].sourceId||!vf(t[r],e[r])||t[r].order!==e[r].order||t[r].clipMask!==e[r].clipMask||!Gt(t[r].clipScope,e[r].clipScope))return!1;return!0}function _f(t,e,r){const n=1/Ui,i=1/(1<<r.canonical.z),s=(e.x*n+r.canonical.x)*i+r.wrap,a=(e.y*n+r.canonical.y)*i;return{min:new $t((t.x*n+r.canonical.x)*i+r.wrap,(t.y*n+r.canonical.y)*i),max:new $t(s,a)}}function Af(t,e,r){const n=1<<r.canonical.z,i=((e.x-r.wrap)*n-r.canonical.x)*Ui,s=(e.y*n-r.canonical.y)*Ui;return{min:new $t(((t.x-r.wrap)*n-r.canonical.x)*Ui,(t.y*n-r.canonical.y)*Ui),max:new $t(i,s)}}function If(t,e,r,n,i,s,a){const o=t.indices,l=t.vertices,u=[];for(let c=n;c<n+i;c+=3){const n=e[r[c+0]+s],i=e[r[c+1]+s],h=e[r[c+2]+s],p=Math.min(n.x,i.x,h.x),d=Math.max(n.x,i.x,h.x),f=Math.min(n.y,i.y,h.y),m=Math.max(n.y,i.y,h.y);u.length=0,t.grid.query(new $t(p,f),new $t(d,m),u);for(let t=0;t<u.length;t++){const e=u[t];if(Dh(l[o[3*e+0]],l[o[3*e+1]],l[o[3*e+2]],n,i,h,a))return!0}}return!1}function Mf(t,e,r,n){if(!t||!r)return!1;let i=t.vertices;if(!e.canonical.equals(n.canonical)||e.wrap!==n.wrap){if(r.vertices.length<t.vertices.length)return Mf(r,n,t,e);const s=e.canonical,a=n.canonical,o=Math.pow(2,a.z-s.z);i=t.vertices.map((t=>new $t((t.x+s.x*Ui)*o-a.x*Ui,(t.y+s.y*Ui)*o-a.y*Ui)))}return If(r,i,t.indices,0,t.indices.length,0,0)}function Sf(t,e,r,n){const i=Math.pow(2,n.z-r.z);return new $t((t+r.x*Ui)*i-n.x*Ui,(e+r.y*Ui)*i-n.y*Ui)}function Pf(t,e){const r=[];e.grid.queryPoint(t,r);const n=e.indices,i=e.vertices;for(let e=0;e<r.length;e++){const s=r[e];if(Eh([i[n[3*s+0]],i[n[3*s+1]],i[n[3*s+2]]],t))return!0}return!1}const kf=[new $t(0,0),new $t(Ui,0),new $t(Ui,Ui),new $t(0,Ui)];function Bf(t,e){const r=[];let n=[];if(!e||t.length<2)return[t];if(2===t.length)return Fh(t[0],t[1],kf)?[t]:[];for(let e=0;e<t.length+2;e++){const i=t[e%t.length],s=t[(e+1)%t.length],a=Fh(0===e?t[t.length-1]:t[(e-1)%t.length],i,kf),o=Fh(i,s,kf),l=a||o;l&&n.push(i),l&&o||n.length>0&&(n.length>1&&r.push(n),n=[])}return n.length>1&&r.push(n),r}const zf=jc.types,Tf=["fill-extrusion-base","fill-extrusion-height","fill-extrusion-color","fill-extrusion-pattern","fill-extrusion-flood-light-wall-radius","fill-extrusion-line-width","fill-extrusion-emissive-strength"],Ef=["fill-extrusion-flood-light-ground-radius"],Vf=Math.pow(2,13),Ff=Math.pow(2,15)-1,Cf=new $t(0,1),Df=2147483648,Rf=7,Lf=450;function Of(t,e,r,n,i,s,a,o){t.emplaceBack((e<<1)+a,(r<<1)+s,(Math.floor(n*Vf)<<1)+i,Math.round(o))}function Uf(t,e,r){t.emplaceBack(e.x*Ui,e.y*Ui,r?1:0)}function Nf(t,e,r,n,i,s){t.emplaceBack(e.x,e.y,(r.x<<1)+n,(r.y<<1)+i,s)}function jf(t,e,r){const n=16384;t.emplaceBack(e.x,e.y,e.z,r[0]*n,r[1]*n,r[2]*n)}class $f{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class Gf{constructor(){this.centroidXY=new $t(0,0),this.vertexArrayOffset=0,this.vertexCount=0,this.groundVertexArrayOffset=0,this.groundVertexCount=0,this.flags=0,this.footprintSegIdx=-1,this.footprintSegLen=0,this.polygonSegIdx=-1,this.polygonSegLen=0,this.min=new $t(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new $t(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0,this.buildingId=0}span(){return new $t(this.max.x-this.min.x,this.max.y-this.min.y)}}class qf{constructor(){this.acc=new $t(0,0),this.accCount=0,this.centroidDataIndex=0}startRing(t,e){t.min.x===Number.MAX_VALUE&&(t.min.x=t.max.x=e.x,t.min.y=t.max.y=e.y)}appendEdge(t,e,r){this.accCount++,this.acc._add(e);let n=!!this.borders;e.x<t.min.x?(t.min.x=e.x,n=!0):e.x>t.max.x&&(t.max.x=e.x,n=!0),e.y<t.min.y?(t.min.y=e.y,n=!0):e.y>t.max.y&&(t.max.y=e.y,n=!0),((0===e.x||e.x===Ui)&&e.x===r.x)!=((0===e.y||e.y===Ui)&&e.y===r.y)&&this.processBorderOverlap(e,r),n&&this.checkBorderIntersection(e,r)}checkBorderIntersection(t,e){e.x<0!=t.x<0&&this.addBorderIntersection(0,dn(e.y,t.y,(0-e.x)/(t.x-e.x))),e.x>Ui!=t.x>Ui&&this.addBorderIntersection(1,dn(e.y,t.y,(Ui-e.x)/(t.x-e.x))),e.y<0!=t.y<0&&this.addBorderIntersection(2,dn(e.x,t.x,(0-e.y)/(t.y-e.y))),e.y>Ui!=t.y>Ui&&this.addBorderIntersection(3,dn(e.x,t.x,(Ui-e.y)/(t.y-e.y)))}addBorderIntersection(t,e){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE]]);const r=this.borders[t];e<r[0]&&(r[0]=e),e>r[1]&&(r[1]=e)}processBorderOverlap(t,e){if(t.x===e.x){if(t.y===e.y)return;const r=0===t.x?0:1;this.addBorderIntersection(r,e.y),this.addBorderIntersection(r,t.y)}else{const r=0===t.y?2:3;this.addBorderIntersection(r,e.x),this.addBorderIntersection(r,t.x)}}centroid(){return 0===this.accCount?new $t(0,0):new $t(Math.floor(Math.max(0,this.acc.x)/this.accCount),Math.floor(Math.max(0,this.acc.y)/this.accCount))}intersectsCount(){return this.borders?this.borders.reduce(((t,e)=>t+ +(e[0]!==Number.MAX_VALUE)),0):0}}function Hf(t,e){const r=t.add(e)._unit(),n=ie(t.x*r.x+t.y*r.y,-1,1);var i,s,a;return i=Math.acos(n),Math.min(4,Math.max(-4,Math.tan(i)))/4*Ff*((s=t).x*(a=e).y-s.y*a.x<0?-1:1)}const Xf=[t=>t.x<0,t=>t.x>Ui,t=>t.y<0,t=>t.y>Ui];function Zf(t,e,r,n){const i=[4];if(0===n)return i;r._mult(n);const s=t.sub(r),a=e.sub(r),o=[t,e,s,a];for(let t=0;t<4;t++)for(const e of o)if(Xf[t](e)){i.push(t);break}return i}class Wf{constructor(t){this.groundRadiusArray=null,this.groundRadiusBuffer=null,this.vertexArray=new kl,this.indexArray=new $l,this.programConfigurations=new Yu(t.layers,{zoom:t.zoom,lut:t.lut},(t=>Ef.includes(t))),this._segments=new bu,this.hiddenByLandmarkVertexArray=new nu,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new bu}getDefaultSegment(){return this.regionSegments[4]}hasData(){return 0!==this.vertexArray.length}addData(t,e,r,n=!1){const i=t.length;if(i>2){let s=Math.max(0,this._segments.get().length-1);const a=this._segments._prepareSegment(4*i,this.vertexArray.length,2*this._segmentToGroundQuads[s].length);let o;s!==this._segments.get().length-1&&(s++,this._segmentToGroundQuads[s]=[],this._segmentToRegionTriCounts[s]=[0,0,0,0,0]);{const e=t[0],r=t[1];o=Hf(e.sub(t[i-1])._perp()._unit(),r.sub(e)._perp()._unit())}for(let l=0;l<i;l++){const u=l===i-1?0:l+1,c=t[l],h=t[u],p=t[u===i-1?0:u+1],d=h.sub(c)._perp()._unit(),f=Hf(d,p.sub(h)._perp()._unit()),m=o,y=f;if(tm(c,h,e)||n&&em(c,e)&&em(h,e)){o=f;continue}const g=a.vertexLength;Nf(this.vertexArray,c,h,1,1,m),Nf(this.vertexArray,c,h,1,0,m),Nf(this.vertexArray,c,h,0,1,y),Nf(this.vertexArray,c,h,0,0,y),a.vertexLength+=4;const x=Zf(c,h,d,r);for(const t of x)this._segmentToGroundQuads[s].push({id:g,region:t}),this._segmentToRegionTriCounts[s][t]+=2,a.primitiveLength+=2;o=f}}}prepareBorderSegments(){if(!this.hasData())return;const t=this._segments.get(),e=t.length;for(let t=0;t<e;t++)this._segmentToGroundQuads[t].sort(((t,e)=>t.region-e.region));for(let r=0;r<e;r++){const e=this._segmentToGroundQuads[r],n=t[r],i=this._segmentToRegionTriCounts[r];i.reduce(((t,e)=>t+e),0);let s=0;for(let t=0;t<=4;t++){const e=i[t];if(0!==e){let r=this.regionSegments[t];r||(r=this.regionSegments[t]=new bu);const i={vertexOffset:n.vertexOffset,primitiveOffset:n.primitiveOffset+s,vertexLength:n.vertexLength,primitiveLength:e};r.get().push(i)}s+=e}for(let t=0;t<e.length;t++){const r=e[t].id;this.indexArray.emplaceBack(r,r+1,r+3),this.indexArray.emplaceBack(r,r+3,r+2)}}this._segmentToGroundQuads=null,this._segmentToRegionTriCounts=null,this._segments.destroy(),this._segments=null}addPaintPropertiesData(t,e,r,n,i,s,a){this.hasData()&&this.programConfigurations.populatePaintArrays(this.vertexArray.length,t,e,r,n,i,s,void 0,a)}upload(t){this.hasData()&&(this.vertexBuffer=t.createVertexBuffer(this.vertexArray,of.members),this.indexBuffer=t.createIndexBuffer(this.indexArray),null!=this.groundRadiusArray&&(this.groundRadiusBuffer=t.createVertexBuffer(this.groundRadiusArray,lf.members)))}uploadPaintProperties(t){this.hasData()&&this.programConfigurations.upload(t)}update(t,e,r,n,i,s,a,o){this.hasData()&&this.programConfigurations.updatePaintArrays(t,e,r,n,i,s,a,o)}updateHiddenByLandmark(t){this.updateHiddenByLandmarkRange(t.groundVertexArrayOffset,t.groundVertexCount,!!(t.flags&Df))}updateHiddenByLandmarkRange(t,e,r){if(!this.hasData())return;const n=e+t;if(0!==e){for(let e=t;e<n;++e)this.hiddenByLandmarkVertexArray.emplace(e,r?1:0);this._needsHiddenByLandmarkUpdate=!0}}uploadHiddenByLandmark(t){this.hasData()&&this._needsHiddenByLandmarkUpdate&&(!this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexArray.length>0?this.hiddenByLandmarkVertexBuffer=t.createVertexBuffer(this.hiddenByLandmarkVertexArray,hf.members,!0):this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.updateData(this.hiddenByLandmarkVertexArray),this._needsHiddenByLandmarkUpdate=!1)}destroy(){if(this.vertexBuffer){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.destroy(),this.groundRadiusBuffer&&this.groundRadiusBuffer.destroy(),this._segments&&this._segments.destroy(),this.programConfigurations.destroy();for(let t=0;t<=4;t++){const e=this.regionSegments[t];e&&e.destroy()}}}}class Yf{constructor(t){this.zoom=t.zoom,this.canonical=t.canonical,this.overscaling=t.overscaling,this.layers=t.layers,this.pixelRatio=t.pixelRatio,this.layerIds=this.layers.map((t=>t.fqid)),this.index=t.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=t.projection,this.activeReplacements=[],this.replacementUpdateTime=0,this.centroidData=[],this.footprintIndices=new $l,this.footprintVertices=new _l,this.footprintSegments=[],this.layoutVertexArray=new Il,this.centroidVertexArray=new fu,this.wallVertexArray=new yu,this.indexArray=new $l,this.programConfigurations=new Yu(t.layers,{zoom:t.zoom,lut:t.lut},(t=>Tf.includes(t))),this.segments=new bu,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.groundEffect=new Wf(t),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[],this.worldview=t.worldview,this.hasAppearances=null}updateFootprints(t,e){}updateAppearances(t,e,r,n){}populate(t,e,r,n){this.features=[],this.hasPattern=Dd("fill-extrusion",this.layers,this.pixelRatio,e),this.featuresOnBorder=[],this.borderFeatureIndices=[[],[],[],[]],this.borderDoneWithNeighborZ=[-1,-1,-1,-1],this.selfDEMTileTimestamp=Number.MAX_VALUE,this.borderDEMTileTimestamp=[Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE],this.tileToMeter=Tc(r),this.edgeRadius=this.layers[0].layout.get("fill-extrusion-edge-radius")/this.tileToMeter,this.wallMode=0!==this.layers[0].paint.get("fill-extrusion-line-width").constantOr(1);for(const{feature:i,id:s,index:a,sourceLayerIndex:o}of t){const t=this.layers[0]._featureFilter.needGeometry,l=Nc(i,t);if(!this.layers[0]._featureFilter.filter(new Po(this.zoom,{worldview:this.worldview,activeFloors:e.activeFloors}),l,r))continue;const u={id:s,sourceLayerIndex:o,index:a,geometry:t?l.geometry:Uc(i,r,n),properties:i.properties,type:i.type,patterns:{}},c=this.layoutVertexArray.length,h="Polygon"===zf[u.type];if(this.hasPattern)this.features.push({featureId:i.id,feature:Rd("fill-extrusion",this.layers,u,this.zoom,this.pixelRatio,e)});else if(this.wallMode)for(const t of u.geometry)for(const s of Bf(t,h))this.addFeature(i.id,u,[s],a,r,{},e.availableImages,n,e.brightness);else this.addFeature(i.id,u,u.geometry,a,r,{},e.availableImages,n,e.brightness);e.featureIndex.insert(i,u.geometry,a,o,this.index,c)}this.sortBorders(),"mercator"===this.projection.name&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(t,e,r,n,i,s){for(const{featureId:t,feature:a}of this.features){const o="Polygon"===zf[a.type],{geometry:l}=a;if(this.wallMode)for(const u of l)for(const l of Bf(u,o))this.addFeature(t,a,[l],a.index,e,r,n,i,s);else this.addFeature(t,a,l,a.index,e,r,n,i,s)}this.sortBorders(),"mercator"===this.projection.name&&this.splitToSubtiles()}update(t,e,r,n,i,s,a){this.programConfigurations.updatePaintArrays(t,e,i,r,n,s,a,this.worldview),this.groundEffect.update(t,e,i,r,n,s,a,this.worldview)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,df),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.wallVertexBuffer=t.createVertexBuffer(this.wallVertexArray,cf.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=t.createVertexBuffer(this.layoutVertexExtArray,pf.members,!0)),this.groundEffect.upload(t)),this.groundEffect.uploadPaintProperties(t),this.programConfigurations.upload(t),this.uploaded=!0}uploadCentroid(t){this.groundEffect.uploadHiddenByLandmark(t),this.needsCentroidUpdate&&(!this.centroidVertexBuffer&&this.centroidVertexArray.length>0?this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,uf.members,!0):this.centroidVertexBuffer&&this.centroidVertexBuffer.updateData(this.centroidVertexArray),this.needsCentroidUpdate=!1)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.centroidVertexBuffer&&this.centroidVertexBuffer.destroy(),this.layoutVertexExtBuffer&&this.layoutVertexExtBuffer.destroy(),this.groundEffect.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,e,r,n,i,s,a,o,l){const u=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(e,{})/this.tileToMeter,c=[new $t(0,0),new $t(Ui,Ui)],h=o.projection,p="globe"===h.name,d=this.wallMode||"Polygon"===zf[e.type],f=new qf;f.centroidDataIndex=this.centroidData.length;const m=new Gf;m.buildingId=t,e.properties&&e.properties.hasOwnProperty("building_id")&&(m.buildingId=e.properties.building_id);const y=this.layers[0].paint.get("fill-extrusion-base").evaluate(e,{},i)<=0,g=this.layers[0].paint.get("fill-extrusion-height").evaluate(e,{},i);let x;if(m.height=g,m.vertexArrayOffset=this.layoutVertexArray.length,m.groundVertexArrayOffset=this.groundEffect.vertexArray.length,p&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new Vl),this.wallMode){if(p)return void Ae("Non zero fill-extrusion-line-width is not yet supported on globe.");if(1!==r.length)return;x=function(t){const e=t[0].x===t[t.length-1].x&&t[0].y===t[t.length-1].y,r=function(t){let e=0;const r=t.length;for(let n=0;n<r;n++)e+=(t[(n+1)%r].x-t[n].x)*(t[(n+1)%r].y+t[n].y);return e>=0}(t);r||(t=t.reverse());const n={geometry:[],joinNormals:[],indices:[]},i=[],s=[],a=[];let o=t.length;for(;o>=2&&t[o-1].equals(t[o-2]);)o--;if(o<(e?3:2))return n;let l,u,c,h,p,d=0;for(;d<o-1&&t[d].equals(t[d+1]);)d++;e&&(l=t[o-2],p=t[d].sub(l)._unit()._perp());for(let r=d;r<o;r++){if(c=r===o-1?e?t[d+1]:void 0:t[r+1],c&&t[r].equals(c))continue;p&&(h=p),l&&(u=l),l=t[r],p=c?c.sub(l)._unit()._perp():h,h=h||p;let n=h.add(p);0===n.x&&0===n.y||n._unit();const f=n.x*p.x+n.y*p.y,m=0!==f?1/f:1/0,y=h.x*p.y-h.y*p.x>0;let g="miter";const x=2;"miter"===g&&m>x&&(g="bevel"),"bevel"===g&&(m>100&&(g="flipbevel"),m<x&&(g="miter"));const v=(t,e,r,n)=>{const o=new $t(t.x,t.y),l=new $t(t.x,t.y);o.x+=e.x*n,o.y+=e.y*n,l.x-=e.x*Math.max(r,1),l.y-=e.y*Math.max(r,1),a.push(e),i.push(o),s.push(l)};if("miter"===g)n._mult(m),v(l,n,0,0);else if("flipbevel"===g)n=p.mult(-1),v(l,n,0,0),v(l,n.mult(-1),0,0);else{const t=-Math.sqrt(m*m-1),e=y?t:0,r=y?0:t;u&&v(l,h,e,r),c&&v(l,p,e,r)}}n.geometry=[...i,...s.reverse(),i[0]],n.joinNormals=[...a,...a.reverse(),a[a.length-1]];const f=n.geometry.length-1;for(let t=0;t<f/2;t++)if(t+1<f/2){let e=t,r=t+1,i=f-1-t,s=f-2-t;e=0===e?f-1:e-1,r=0===r?f-1:r-1,i=0===i?f-1:i-1,s=0===s?f-1:s-1,n.indices.push(i),n.indices.push(r),n.indices.push(e),n.indices.push(i),n.indices.push(s),n.indices.push(r)}return n}(r[0]),r=[x.geometry]}const v=(t,e)=>t<(e.length-1)/2||t===e.length-1,b=this.wallMode?[r]:Vd(r,500);for(let t=b.length-1;t>=0;t--){const e=b[t];(0===e.length||(w=e[0]).every((t=>t.x<=0))||w.every((t=>t.x>=Ui))||w.every((t=>t.y<=0))||w.every((t=>t.y>=Ui)))&&b.splice(t,1)}var w;let _;if(p)_=sm(b,c,i);else{_=[];for(const t of b)_.push({polygon:t,bounds:c})}const A=d?this.edgeRadius:0,I=A>0&&this.zoom<17,M=(t,e)=>{if(0===t.length)return!1;const r=t[t.length-1];return e.x===r.x&&e.y===r.y};for(const{polygon:t,bounds:e}of _){let r=0,n=0;for(const e of t)d&&!e[0].equals(e[e.length-1])&&e.push(e[0]),n+=d?e.length-1:e.length;const s=this.segments.prepareSegment((d?5:4)*n,this.layoutVertexArray,this.indexArray);m.footprintSegIdx<0&&(m.footprintSegIdx=this.footprintSegments.length),m.polygonSegIdx<0&&(m.polygonSegIdx=this.polygonSegments.length);const a={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},o=new $f;if(o.vertexOffset=this.footprintVertices.length,o.indexOffset=3*this.footprintIndices.length,o.ringIndices=[],d){const n=[],a=[];r=s.vertexLength;for(let r=0;r<t.length;r++){const l=t[r];l.length&&0!==r&&a.push(n.length/2);const c=[];let d,f;d=l[1].sub(l[0])._perp()._unit(),o.ringIndices.push(l.length-1);for(let t=1;t<l.length;t++){const e=l[t],r=l[t===l.length-1?1:t+1],a=e.clone();if(A){f=r.sub(e)._perp()._unit();const t=d.add(f)._unit(),n=A*Math.min(4,1/(d.x*t.x+d.y*t.y));a.x+=n*t.x,a.y+=n*t.y,a.x=Math.round(a.x),a.y=Math.round(a.y),d=f}if(!y||0!==A&&!I||M(c,a)||c.push(a),Of(this.layoutVertexArray,a.x,a.y,0,0,1,1,0),this.wallMode){const e=v(t,l);Uf(this.wallVertexArray,x.joinNormals[t],!e)}s.vertexLength++,this.footprintVertices.emplaceBack(e.x,e.y),n.push(e.x,e.y),p&&jf(this.layoutVertexExtArray,h.projectTilePoint(a.x,a.y,i),h.upVector(i,a.x,a.y))}y&&(0===A||I)&&(0!==c.length&&M(c,c[0])&&c.pop(),this.groundEffect.addData(c,e,u))}const l=this.wallMode?x.indices:od(n,a);for(let t=0;t<l.length;t+=3)this.footprintIndices.emplaceBack(o.vertexOffset+l[t+0],o.vertexOffset+l[t+1],o.vertexOffset+l[t+2]),this.indexArray.emplaceBack(r+l[t],r+l[t+2],r+l[t+1]),s.primitiveLength++;o.indexCount+=l.length,o.vertexCount+=this.footprintVertices.length-o.vertexOffset}for(let n=0;n<t.length;n++){const a=t[n];f.startRing(m,a[0]);let o=a.length>4&&rm(a[a.length-2],a[0],a[1]),l=A?Jf(a[a.length-2],a[0],a[1],A):0;const c=[];let g,b,w;b=a[1].sub(a[0])._perp()._unit();let _=!0;for(let t=1,n=0;t<a.length;t++){let u=a[t-1],d=a[t];const I=a[t===a.length-1?1:t+1];if(f.appendEdge(m,d,u),tm(d,u,e)){A&&(b=I.sub(d)._perp()._unit(),_=!_);continue}const S=d.sub(u)._perp(),P=S.x/(Math.abs(S.x)+Math.abs(S.y)),k=S.y>0?1:0,B=u.dist(d);if(n+B>32768&&(n=0),A){w=I.sub(d)._perp()._unit();let t=Qf(u,d,I,Kf(b,w),A);isNaN(t)&&(t=0);const e=d.sub(u)._unit();u=u.add(e.mult(l))._round(),d=d.add(e.mult(-t))._round(),l=t,b=w,y&&this.zoom>=17&&(M(c,u)||c.push(u),M(c,d)||c.push(d))}const z=s.vertexLength,T=a.length>4&&rm(u,d,I);let E=nm(n,o,_);if(Of(this.layoutVertexArray,u.x,u.y,P,k,0,0,E),Of(this.layoutVertexArray,u.x,u.y,P,k,0,1,E),this.wallMode){const e=v(t-1,a),r=x.joinNormals[t-1];Uf(this.wallVertexArray,r,e),Uf(this.wallVertexArray,r,e)}if(n+=B,E=nm(n,T,!_),o=T,Of(this.layoutVertexArray,d.x,d.y,P,k,0,0,E),Of(this.layoutVertexArray,d.x,d.y,P,k,0,1,E),this.wallMode){const e=v(t,a),r=x.joinNormals[t];Uf(this.wallVertexArray,r,e),Uf(this.wallVertexArray,r,e)}if(s.vertexLength+=4,this.indexArray.emplaceBack(z+0,z+1,z+2),this.indexArray.emplaceBack(z+1,z+3,z+2),s.primitiveLength+=2,A){const n=r+(1===t?a.length-2:t-2),i=1===t?r:n+1;if(this.indexArray.emplaceBack(z+1,n,z+3),this.indexArray.emplaceBack(n,i,z+3),s.primitiveLength+=2,void 0===g&&(g=z),!tm(I,a[t],e)){const e=t===a.length-1?g:s.vertexLength;this.indexArray.emplaceBack(z+2,z+3,e),this.indexArray.emplaceBack(z+3,e+1,e),this.indexArray.emplaceBack(z+3,i,e+1),s.primitiveLength+=3}_=!_}if(p){const t=this.layoutVertexExtArray,e=h.projectTilePoint(u.x,u.y,i),r=h.projectTilePoint(d.x,d.y,i),n=h.upVector(i,u.x,u.y),s=h.upVector(i,d.x,d.y);jf(t,e,n),jf(t,e,n),jf(t,r,s),jf(t,r,s)}}d&&(r+=a.length-1),y&&A&&this.zoom>=17&&(0!==c.length&&M(c,c[0])&&c.pop(),this.groundEffect.addData(c,e,u,A>0))}this.footprintSegments.push(o),a.triangleCount=this.indexArray.length-a.triangleArrayOffset,this.polygonSegments.push(a),++m.footprintSegLen,++m.polygonSegLen}if(m.vertexCount=this.layoutVertexArray.length-m.vertexArrayOffset,m.groundVertexCount=this.groundEffect.vertexArray.length-m.groundVertexArrayOffset,0!==m.vertexCount){if(m.centroidXY=f.borders?Cf:this.encodeCentroid(f,m),this.centroidData.push(m),f.borders){this.featuresOnBorder.push(f);const t=this.featuresOnBorder.length-1;for(let e=0;e<f.borders.length;e++)f.borders[e][0]!==Number.MAX_VALUE&&this.borderFeatureIndices[e].push(t)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,s,a,i,l,void 0,this.worldview),this.groundEffect.addPaintPropertiesData(e,n,s,a,i,l,this.worldview),this.maxHeight=Math.max(this.maxHeight,g)}}sortBorders(){for(let t=0;t<this.borderFeatureIndices.length;t++)this.borderFeatureIndices[t].sort(((e,r)=>this.featuresOnBorder[e].borders[t][0]-this.featuresOnBorder[r].borders[t][0]))}splitToSubtiles(){const t=[];for(let e=0;e<this.centroidData.length;e++){const r=this.centroidData[e],n=+(r.min.y+r.max.y>Ui),i=2*n+(+(r.min.x+r.max.x>Ui)^n);for(let n=0;n<r.polygonSegLen;n++){const s=r.polygonSegIdx+n;t.push({centroidIdx:e,subtile:i,polygonSegmentIdx:s,triangleSegmentIdx:this.polygonSegments[s].triangleSegIdx})}}const e=new $l;t.sort(((t,e)=>t.triangleSegmentIdx===e.triangleSegmentIdx?t.subtile-e.subtile:t.triangleSegmentIdx-e.triangleSegmentIdx));let r=0,n=0,i=0;for(const e of t){if(e.triangleSegmentIdx!==r)break;i++}const s=t.length;for(;n!==t.length;){r=t[n].triangleSegmentIdx;let a=0,o=n,l=n;for(let e=o;e<i&&t[e].subtile===a;e++)l++;for(;o!==i;){const n=t[o];a=n.subtile;const s=this.centroidData[n.centroidIdx].min.clone(),u=this.centroidData[n.centroidIdx].max.clone(),c={vertexOffset:this.segments.segments[r].vertexOffset,primitiveOffset:e.length,vertexLength:this.segments.segments[r].vertexLength,primitiveLength:0,sortKey:void 0,vaos:{}};for(let r=o;r<l;r++){const n=t[r],i=this.polygonSegments[n.polygonSegmentIdx],a=this.centroidData[n.centroidIdx].min,o=this.centroidData[n.centroidIdx].max,l=this.indexArray.uint16;for(let t=i.triangleArrayOffset;t<i.triangleArrayOffset+i.triangleCount;t++)e.emplaceBack(l[3*t],l[3*t+1],l[3*t+2]);c.primitiveLength+=i.triangleCount,s.x=Math.min(s.x,a.x),s.y=Math.min(s.y,a.y),u.x=Math.max(u.x,o.x),u.y=Math.max(u.y,o.y)}c.primitiveLength>0&&this.triangleSubSegments.push({segment:c,min:s,max:u}),o=l;for(let e=o;e<i&&t[e].subtile===t[o].subtile;e++)l++}n=i;for(let e=n;e<s&&t[e].triangleSegmentIdx===t[n].triangleSegmentIdx;e++)i++}e._trim(),this.indexArray=e}getVisibleSegments(t,e,r){const n=new bu;if(this.wallMode){for(const t of this.triangleSubSegments)n.segments.push(t.segment);return n}let i=0,s=0;const a=1<<t.canonical.z;if(e){const r=e.getMinMaxForTile(t);r&&(i=r.min,s=r.max)}s+=this.maxHeight;const o=t.toUnwrapped();let l;const u=[o.canonical.x/a+o.wrap,o.canonical.y/a],c=[(o.canonical.x+1)/a+o.wrap,(o.canonical.y+1)/a],h=(t,e,r)=>[t[0]*(1-r[0])+e[0]*r[0],t[1]*(1-r[1])+e[1]*r[1]],p=[],d=[];for(const t of this.triangleSubSegments){p[0]=t.min.x/Ui,p[1]=t.min.y/Ui,d[0]=t.max.x/Ui,d[1]=t.max.y/Ui;const e=h(u,c,p),a=h(u,c,d);if(0===new mh([e[0],e[1],i],[a[0],a[1],s]).intersectsPrecise(r)){l&&(n.segments.push(l),l=void 0);continue}const o=t.segment;l&&l.vertexOffset!==o.vertexOffset&&(n.segments.push(l),l=void 0),l?(l.vertexLength+=o.vertexLength,l.primitiveLength+=o.primitiveLength):l={vertexOffset:o.vertexOffset,primitiveLength:o.primitiveLength,vertexLength:o.vertexLength,primitiveOffset:o.primitiveOffset,sortKey:void 0,vaos:{}}}return l&&n.segments.push(l),n}encodeCentroid(t,e){const r=t.centroid(),n=e.span(),i=Math.min(7,Math.round(n.x*this.tileToMeter/10)),s=Math.min(7,Math.round(n.y*this.tileToMeter/10));return new $t(ie(r.x,1,Ui-1)<<3|i,ie(r.y,1,Ui-1)<<3|s)}encodeBorderCentroid(t){if(!t.borders)return new $t(0,0);const e=t.borders,r=Number.MAX_VALUE;if(e[0][0]!==r||e[1][0]!==r){const t=e[0][0]!==r?0:1;return new $t(6|(e[0][0]!==r?0:65528),(e[t][0]+e[t][1])/2<<3|6)}{const t=e[2][0]!==r?2:3;return new $t((e[t][0]+e[t][1])/2<<3|6,6|(e[2][0]!==r?0:65528))}}showCentroid(t){const e=this.centroidData[t.centroidDataIndex];e.flags&=2147483647,e.centroidXY.x=0,e.centroidXY.y=0,this.writeCentroidToBuffer(e)}writeCentroidToBuffer(t){this.groundEffect.updateHiddenByLandmark(t);const e=t.vertexArrayOffset,r=t.vertexCount+t.vertexArrayOffset,n=t.flags&Df?Cf:t.centroidXY,i=this.centroidVertexArray.geta_centroid_pos0(e);if(this.centroidVertexArray.geta_centroid_pos1(e)!==n.y||i!==n.x){for(let t=e;t<r;++t)this.centroidVertexArray.emplace(t,n.x,n.y);this.needsCentroidUpdate=!0}}createCentroidsBuffer(){this.centroidVertexArray.resize(this.layoutVertexArray.length),this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const t of this.centroidData)this.writeCentroidToBuffer(t)}updateReplacement(t,e,r){if(e.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=e.updateTime;const n=e.getReplacementRegionsForTile(t.toUnwrapped());if(wf(this.activeReplacements,n))return;if(this.activeReplacements=n,0===this.centroidVertexArray.length)this.createCentroidsBuffer();else for(const t of this.centroidData)t.flags&=2147483647;const i=[];for(const e of this.activeReplacements){if(e.order<r)continue;const n=Math.max(1,Math.pow(2,e.footprintTileId.canonical.z-t.canonical.z));if(e.footprint.buildingIds)for(const t of this.centroidData)t.flags&Df||e.min.x>t.max.x||t.min.x>e.max.x||e.min.y>t.max.y||t.min.y>e.max.y||e.footprint.buildingIds.has(t.buildingId)&&(t.flags|=Df);else for(const r of this.centroidData)if(!(r.flags&Df||e.min.x>r.max.x||r.min.x>e.max.x||e.min.y>r.max.y||r.min.y>e.max.y))for(let s=0;s<r.footprintSegLen;s++){const a=this.footprintSegments[r.footprintSegIdx+s];if(i.length=0,am(this.footprintVertices,a.vertexOffset,a.vertexCount,e.footprintTileId.canonical,t.canonical,i),If(e.footprint,i,this.footprintIndices.uint16,a.indexOffset,a.indexCount,-a.vertexOffset,-n)){r.flags|=Df;break}}}for(const t of this.centroidData)this.writeCentroidToBuffer(t);this.borderDoneWithNeighborZ=[-1,-1,-1,-1]}footprintContainsPoint(t,e,r){let n=!1;for(let i=0;i<r.footprintSegLen;i++){const s=this.footprintSegments[r.footprintSegIdx+i];let a=0;for(const r of s.ringIndices){for(let i=a,o=r+a-1;i<r+a;o=i++){const r=this.footprintVertices.int16[2*(i+s.vertexOffset)+0],a=this.footprintVertices.int16[2*(i+s.vertexOffset)+1],l=this.footprintVertices.int16[2*(o+s.vertexOffset)+1];a>e!=l>e&&t<(this.footprintVertices.int16[2*(o+s.vertexOffset)+0]-r)*(e-a)/(l-a)+r&&(n=!n)}a=r}}return n}getHeightAtTileCoord(t,e){let r=Number.NEGATIVE_INFINITY,n=!0;const i=4*(t+Ui)*Ui+(e+Ui);if(this.partLookup.hasOwnProperty(i)){const t=this.partLookup[i];return t?{height:t.height,hidden:!!(t.flags&Df)}:void 0}for(const s of this.centroidData)t>s.max.x||s.min.x>t||e>s.max.y||s.min.y>e||s.height<=r||this.footprintContainsPoint(t,e,s)&&(r=s.height,this.partLookup[i]=s,n=!!(s.flags&Df));if(r!==Number.NEGATIVE_INFINITY)return{height:r,hidden:n};this.partLookup[i]=void 0}}function Kf(t,e){const r=t.add(e)._unit();return t.x*r.x+t.y*r.y}function Jf(t,e,r,n){const i=e.sub(t)._perp()._unit(),s=r.sub(e)._perp()._unit();return Qf(t,e,r,Kf(i,s),n)}function Qf(t,e,r,n,i){const s=Math.sqrt(1-n*n);return Math.min(t.dist(e)/3,e.dist(r)/3,i*s/n)}function tm(t,e,r){return t.x<r[0].x&&e.x<r[0].x||t.x>r[1].x&&e.x>r[1].x||t.y<r[0].y&&e.y<r[0].y||t.y>r[1].y&&e.y>r[1].y}function em(t,e){return t.x<e[0].x||t.x>e[1].x||t.y<e[0].y||t.y>e[1].y}function rm(t,e,r){if(t.x<0||t.x>=Ui||e.x<0||e.x>=Ui||r.x<0||r.x>=Ui)return!1;const n=r.sub(e),i=n.perp(),s=t.sub(e);return(n.x*s.x+n.y*s.y)/Math.sqrt((n.x*n.x+n.y*n.y)*(s.x*s.x+s.y*s.y))>-.866&&i.x*s.x+i.y*s.y<0}function nm(t,e,r){const n=e?2|t:-3&t;return r?1|n:-2&n}function im(){const t=Math.PI/32,e=Math.tan(t),r=fc;return r*Math.sqrt(1+2*e*e)-r}function sm(t,e,r){const n=1<<r.z,i=Ic(r.x/n),s=Ic((r.x+1)/n),a=Mc(r.y/n),o=Mc((r.y+1)/n);return function(t,e,r,n,i=0,s){const a=[];if(!t.length||!r||!n)return a;const o=(t,e)=>{for(const r of t)a.push({polygon:r,bounds:e})},l=Math.ceil(Math.log2(r)),u=Math.ceil(Math.log2(n)),c=l-u,h=[];for(let t=0;t<Math.abs(c);t++)h.push(c>0?0:1);for(let t=0;t<Math.min(l,u);t++)h.push(0),h.push(1);let p=t;if(p=qd(p,e[0].y-i,e[1].y+i,1),p=qd(p,e[0].x-i,e[1].x+i,0),!p.length)return a;const d=[];for(h.length?d.push({polygons:p,bounds:e,depth:0}):o(p,e);d.length;){const t=d.pop(),e=t.depth,r=h[e],n=t.bounds[0],a=t.bounds[1],l=0===r?n.x:n.y,u=0===r?a.x:a.y,c=s?s(r,l,u):.5*(l+u),p=qd(t.polygons,l-i,c+i,r),f=qd(t.polygons,c-i,u+i,r);if(p.length){const t=[n,new $t(0===r?c:a.x,1===r?c:a.y)];h.length>e+1?d.push({polygons:p,bounds:t,depth:e+1}):o(p,t)}if(f.length){const t=[new $t(0===r?c:n.x,1===r?c:n.y),a];h.length>e+1?d.push({polygons:f,bounds:t,depth:e+1}):o(f,t)}}return a}(t,e,Math.ceil((s-i)/11.25),Math.ceil((a-o)/11.25),1,((t,e,i)=>{if(0===t)return.5*(e+i);{const t=Mc((r.y+e/Ui)/n);return(_c(.5*(Mc((r.y+i/Ui)/n)+t))*n-r.y)*Ui}}))}function am(t,e,r,n,i,s){const a=Math.pow(2,n.z-i.z);for(let o=0;o<r;o++){let r=t.int16[2*(o+e)+0],l=t.int16[2*(o+e)+1];r=(r+i.x*Ui)*a-n.x*Ui,l=(l+i.y*Ui)*a-n.y*Ui,s.push(new $t(r,l))}}let om,lm;Qa(Yf,"FillExtrusionBucket",{omit:["layers","features"]}),Qa(Gf,"PartData"),Qa($f,"FootprintSegment"),Qa(qf,"BorderCentroidData"),Qa(Wf,"GroundEffect");class um extends $t{constructor(t,e,r){super(t,e),this.z=r}}class cm extends um{constructor(t,e,r,n){super(t,e,r),this.w=n}}function hm(t,e,r,n){const i="x"===r?"y":"x",s=(n-t[r])/(e[r]-t[r]);t[i]=Math.round(t[i]+(e[i]-t[i])*s),t[r]=n,t.hasOwnProperty("z")&&(t.z=dn(t.z,e.z,s)),t.hasOwnProperty("w")&&(t.w=dn(t.w,e.w,s))}function pm(t,e,r,n){const i=r,s=n;for(const r of["x","y"]){let n=t,a=e;n[r]>=a[r]&&(n=e,a=t),n[r]<i&&a[r]>i&&hm(n,a,r,i),n[r]<s&&a[r]>s&&hm(a,n,r,s)}}function dm(t,e,r,n,i,s){const a=[];for(let o=0;o<t.length;o++){const l=t[o];let u;const c=a.length;let h=0;for(let t=0;t<l.length-1;t++){let c=l[t],p=l[t+1],d=0;const f=h;let m,y;s&&(d=Math.hypot(p.x-c.x,p.y-c.y),h+=d,m=c,y=p),c.x<e&&p.x<e||(c.x<e?c=new $t(e,c.y+(e-c.x)/(p.x-c.x)*(p.y-c.y))._round():p.x<e&&(p=new $t(e,c.y+(e-c.x)/(p.x-c.x)*(p.y-c.y))._round()),c.y<r&&p.y<r||(c.y<r?c=new $t(c.x+(r-c.y)/(p.y-c.y)*(p.x-c.x),r)._round():p.y<r&&(p=new $t(c.x+(r-c.y)/(p.y-c.y)*(p.x-c.x),r)._round()),c.x>=n&&p.x>=n||(c.x>=n?c=new $t(n,c.y+(n-c.x)/(p.x-c.x)*(p.y-c.y))._round():p.x>=n&&(p=new $t(n,c.y+(n-c.x)/(p.x-c.x)*(p.y-c.y))._round()),c.y>=i&&p.y>=i||(c.y>=i?c=new $t(c.x+(i-c.y)/(p.y-c.y)*(p.x-c.x),i)._round():p.y>=i&&(p=new $t(c.x+(i-c.y)/(p.y-c.y)*(p.x-c.x),i)._round()),u&&c.equals(u[u.length-1])||(u=[c],a.push(u),s&&s.push({progress:{min:f+mm(m,y,c)*d,max:1},parentIndex:o,prevPoint:m,nextPoint:y})),u.push(p),s&&(s[s.length-1].progress.max=f+mm(m,y,p)*d,s[s.length-1].nextPoint=y)))))}if(s&&h>0)for(let t=c;t<a.length;t++)s[t].progress.min/=h,s[t].progress.max/=h}return a}function fm(t,e,r,n,i){if(t.length<2)return void n.push(t);const s=[];for(;e.valid();){const[r,n]=e.get();for(let e=0;e<t.length-1;e++){const i=t[e],a=t[e+1],o=kh(i,a,r,n);if(o){const[t]=o,r=new $t(dn(i.x,a.x,t),dn(i.y,a.y,t));s.push({t:e+t,distance:0,point:r})}}e.next()}if(0===s.length)return void n.push(t);s.sort(((t,e)=>t.t-e.t));let a=0,o=0,l=[];for(n.push(l);a!==t.length;){if(o===s.length){for(;a!==t.length;)0!==l.length&&l[l.length-1].equals(t[a])||l.push(t[a]),a++;break}s[o].t<=a?(0!==l.length&&l[l.length-1].equals(s[o].point)||l.push(s[o].point),o++):(0!==l.length&&l[l.length-1].equals(t[a])||l.push(t[a]),a++)}}function mm(t,e,r){return t.x!==e.x?(r.x-t.x)/(e.x-t.x):t.y!==e.y?(r.y-t.y)/(e.y-t.y):0}function ym(t,e){return t.x*e.x+t.y*e.y}function gm(t,e){if(1===t.length){let r=0;const n=e[r++];let i;for(;!i||n.equals(i);)if(i=e[r++],!i)return 1/0;for(;r<e.length;r++){const s=e[r],a=t[0],o=i.sub(n),l=s.sub(n),u=a.sub(n),c=ym(o,o),h=ym(o,l),p=ym(l,l),d=ym(u,o),f=ym(u,l),m=c*p-h*h,y=(p*d-h*f)/m,g=(c*f-h*d)/m,x=n.z*(1-y-g)+i.z*y+s.z*g;if(isFinite(x))return x}return 1/0}{let t=1/0;for(const r of e)t=Math.min(t,r.z);return t}}function xm(t,e,r){let n=1/0;Ah(r,e)&&(n=gm(r,e[0]));for(let i=0;i<e.length;i++){const s=e[i],a=t[i];for(let t=0;t<s.length-1;t++){const e=s[t],i=[e,s[t+1],a[t+1],a[t],e];wh(r,i)&&(n=Math.min(n,gm(r,i)))}}return n!==1/0&&n}function vm(t,e,r,n,i,s,a,o,l,u,c){return"globe"===t.projection.name?function(t,e,r,n,i,s,a,o,l,u,c){const h=[],p=[],d=t.projection.upVectorScale(c,t.center.lat,t.worldSize).metersToTile,f=[0,0,0,1],m=[0,0,0,1],y=(t,e,r,n)=>{t[0]=e,t[1]=r,t[2]=n,t[3]=1},g=im();r>0&&(r+=g),n+=g;for(const g of e){const e=[],x=[];for(const h of g){const p=h.x+i.x,g=h.y+i.y,v=t.projection.projectTilePoint(p,g,c),b=t.projection.upVector(c,h.x,h.y);let w=r,_=n;if(a){const t=bm(p,g,r,n,a,o,l,u);w+=t.base,_+=t.top}0!==r?y(f,v.x+b[0]*d*w,v.y+b[1]*d*w,v.z+b[2]*d*w):y(f,v.x,v.y,v.z),y(m,v.x+b[0]*d*_,v.y+b[1]*d*_,v.z+b[2]*d*_),K(f,f,s),K(m,m,s),e.push(new um(f[0],f[1],f[2])),x.push(new um(m[0],m[1],m[2]))}h.push(e),p.push(x)}return[h,p]}(t,e,r,n,i,s,a,o,l,u,c):a?function(t,e,r,n,i,s,a,o,l){const u=[],c=[],h=[0,0,0,1];for(const p of t){const t=[],d=[];for(const u of p){const c=u.x+n.x,p=u.y+n.y,f=bm(c,p,e,r,s,a,o,l);h[0]=c,h[1]=p,h[2]=f.base,h[3]=1,dt(h,h,i),h[3]=Math.max(h[3],1e-5);const m=new um(h[0]/h[3],h[1]/h[3],h[2]/h[3]);h[0]=c,h[1]=p,h[2]=f.top,h[3]=1,dt(h,h,i),h[3]=Math.max(h[3],1e-5);const y=new um(h[0]/h[3],h[1]/h[3],h[2]/h[3]);t.push(m),d.push(y)}u.push(t),c.push(d)}return[u,c]}(e,r,n,i,s,a,o,l,u):function(t,e,r,n,i){const s=[],a=[],o=i[8]*e,l=i[9]*e,u=i[10]*e,c=i[11]*e,h=i[8]*r,p=i[9]*r,d=i[10]*r,f=i[11]*r;for(const e of t){const t=[],r=[];for(const s of e){const e=s.x+n.x,a=s.y+n.y,m=i[0]*e+i[4]*a+i[12],y=i[1]*e+i[5]*a+i[13],g=i[2]*e+i[6]*a+i[14],x=i[3]*e+i[7]*a+i[15],v=m+o,b=y+l,w=g+u,_=Math.max(x+c,1e-5),A=m+h,I=y+p,M=g+d,S=Math.max(x+f,1e-5);t.push(new um(v/_,b/_,w/_)),r.push(new um(A/S,I/S,M/S))}s.push(t),a.push(r)}return[s,a]}(e,r,n,i,s)}function bm(t,e,r,n,i,s,a,o){const l=a*i.getElevationAt(t,e,!0,!0),u=0!==s[0],c=u?0===s[1]?a*(s[0]/Rf-Lf):a*function(t,e,r){const n=Math.floor(e[0]/8),i=Math.floor(e[1]/8),s=10*(e[0]-8*n),a=10*(e[1]-8*i),o=t.getElevationAt(n,i,!0,!0),l=t.getMeterToDEM(r),u=Math.floor(.5*(s*l-1)),c=Math.floor(.5*(a*l-1)),h=t.tileCoordToPixel(n,i),p=2*u+1,d=2*c+1,f=function(t,e,r,n,i){return[t.getElevationAtPixel(e,r,!0),t.getElevationAtPixel(e+i,r,!0),t.getElevationAtPixel(e,r+i,!0),t.getElevationAtPixel(e+n,r+i,!0)]}(t,h.x-u,h.y-c,p,d),m=Math.abs(f[0]-f[1]),y=Math.abs(f[2]-f[3]),g=Math.abs(f[0]-f[2])+Math.abs(f[1]-f[3]),x=Math.min(.25,.5*l*(m+y)/p),v=Math.min(.25,.5*l*g/d);return o+Math.max(x*s,v*a)}(i,s,o):l;return{base:l+(0===r?-1:r),top:u?Math.max(c+n,l+r+2):l+n}}class wm{constructor(t){this._callback=t,this._triggered=!1,"undefined"!=typeof MessageChannel&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout((()=>{this._triggered=!1,this._callback()}),0))}remove(){this._channel=void 0,this._callback=()=>{}}}class _m{constructor(){this.tasks={},this.taskQueue=[],ye(["process"],this),this.invoker=new wm(this.process),this.nextId=0}add(t,e){const r=this.nextId++,n=function({type:t,isSymbolTile:e,zoom:r}){return r=r||0,"message"===t?0:"maybePrepare"!==t||e?"parseTile"!==t||e?"parseTile"===t&&e?300-r:"maybePrepare"===t&&e?400-r:500:200-r:100-r}(e);if(0===n){try{t()}finally{}return null}return this.tasks[r]={fn:t,metadata:e,priority:n,id:r},this.taskQueue.push(r),this.invoker.trigger(),{cancel:()=>{delete this.tasks[r]}}}process(){try{if(this.taskQueue=this.taskQueue.filter((t=>!!this.tasks[t])),!this.taskQueue.length)return;const t=this.pick();if(null===t)return;const e=this.tasks[t];if(delete this.tasks[t],this.taskQueue.length&&this.invoker.trigger(),!e)return;e.fn()}finally{}}pick(){let t=null,e=1/0;for(let r=0;r<this.taskQueue.length;r++){const n=this.tasks[this.taskQueue[r]];n.priority<e&&(e=n.priority,t=r)}if(null===t)return null;const r=this.taskQueue[t];return this.taskQueue.splice(t,1),r}remove(){this.invoker.remove()}}class Am{constructor(t,e,r){this.target=t,this.parent=e,this.mapId=r,this.callbacks={},this.cancelCallbacks={},ye(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.scheduler=new _m}send(t,e,r,n,i=!1,s){const a=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&&(r.metadata=s,this.callbacks[a]=r);const o=new Set;return this.target.postMessage({id:a,type:t,hasCallback:!!r,targetMapId:n,mustQueue:i,sourceMapId:this.mapId,data:eo(e,o)},o),{cancel:()=>{r&&delete this.callbacks[a],this.target.postMessage({id:a,type:"<cancel>",targetMapId:n,sourceMapId:this.mapId})}}}receive(t){const e=t.data;if(!e)return;const r=e.id;if(r&&(!e.targetMapId||this.mapId===e.targetMapId))if("<cancel>"===e.type){const t=this.cancelCallbacks[r];delete this.cancelCallbacks[r],t&&t.cancel()}else if(e.mustQueue||ke(self)){const t=this.callbacks[r],n=this.scheduler.add((()=>this.processTask(r,e)),t&&t.metadata||{type:"message"});n&&(this.cancelCallbacks[r]=n)}else this.processTask(r,e)}processTask(t,e){if(delete this.cancelCallbacks[t],"<response>"===e.type){const r=this.callbacks[t];delete this.callbacks[t],r&&(e.error?r(ro(e.error)):r(null,ro(e.data)))}else{const r=new Set,n=e.hasCallback?(e,n)=>{this.target.postMessage({id:t,type:"<response>",sourceMapId:this.mapId,error:e?eo(e):null,data:eo(n,r)},r)}:()=>{},i=ro(e.data);if(this.parent[e.type])this.parent[e.type](e.sourceMapId,i,n);else if(this.parent.getWorkerSource){const t=e.type.split("."),{source:r,scope:s}=i;this.parent.getWorkerSource(e.sourceMapId,t[0],r,s)[t[1]](i,n)}else n(new Error(`Could not find function ${e.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}}const Im={workerUrl:"",workerClass:null,workerParams:void 0};function Mm(){const t=Im.workerUrl?Im.workerUrl:new URL("worker.js",import.meta.url).href,e=new Blob([`import '${t}';`],{type:"application/javascript"});return new Worker(URL.createObjectURL(e),{type:"module"})}const Sm="mapboxgl_preloaded_worker_pool";class Pm{constructor(t){this.active={},this.name=t}acquire(t,e=Pm.workerCount){if(!this.workers)for(this.workers=[];this.workers.length<e;){const t=Mm();this.workers.push(t)}return this.active[t]=!0,this.workers.slice()}release(t){delete this.active[t],this.workers&&0===this.numActive()&&(this.workers.forEach((t=>{t.terminate()})),this.workers=null)}isPreloaded(){return!!this.active[Sm]}numActive(){return Object.keys(this.active).length}}Pm.workerCount=2;class km{constructor(t,e,r="Worker",n=Pm.workerCount){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=he();const i=this.workerPool.acquire(this.id,n);for(let t=0;t<i.length;t++){const n=new km.Actor(i[t],e,this.id);n.name=`${r} ${t}`,this.actors.push(n)}this.ready=!1,this.broadcast("checkIfReady",null,(()=>{this.ready=!0}))}broadcast(t,e,r){oe(this.actors,((r,n)=>{r.send(t,e,n)}),r=r||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach((t=>{t.remove()})),this.actors=[],this.workerPool.release(this.id)}}let Bm,zm;function Tm(){return Bm||(Bm=new Pm),Bm}function Em(){return zm||(zm=new Pm("ImageRasterizer")),zm}function Vm(){Tm().acquire(Sm)}function Fm(){const t=Bm;t&&(t.isPreloaded()&&1===t.numActive()?(t.release(Sm),Bm=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))}km.Actor=Am;const Cm=4096;class Dm{constructor(t){this.module=t,this.memoryStack=this.module.malloc(Cm),this.memoryStackNextFree=this.memoryStack}createIntArray(t){const e=this.memoryStackNextFree;return this.memoryStackNextFree+=t.length*Int32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>Cm?-1:(new Int32Array(this.module.heap32.buffer,e,t.length).set(t),e)}createFloatArray(t){const e=this.memoryStackNextFree;return this.memoryStackNextFree+=t.length*Float32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>Cm?-1:(new Float32Array(this.module.heapF32.buffer,e,t.length).set(t),e)}readStringBuffer(t){let e="";for(;0!==this.module.heapU8[t];)e+=String.fromCharCode(this.module.heapU8[t]),++t;return e}setStyle(t){const e=t.normalScale;this.module.setStyle(e[0],e[1],e[2],t.tileToMeters)}setAOOptions(t,e){this.module.setAOOptions(t?1:0,e)}setMetricOptions(t,e){this.module.setMetricOptions(t?1:0,e)}setStructuralOptions(t){this.module.setStructuralOptions(t?1:0)}setFacadeOptions(t,e){this.module.setFacadeOptions(t,e?1:0)}setFauxFacadeOptions(t,e,r){this.module.setFauxFacadeOptions(t?1:0,e?1:0,r)}setFacadeClassifierOptions(t){this.module.setFacadeClassifierOptions(t)}generateMesh(t,e){this.memoryStackNextFree=this.memoryStack;for(const e of t){const t=this.createIntArray(e.ringIndices),r=this.createFloatArray(e.coordinates);if(-1===t||-1===r)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFeature(e.id,e.sourceId,e.minHeight,e.height,e.roofType,r,t,e.ringIndices.length-1)}for(const t of e){let e;e=t.entrances?JSON.parse(t.entrances):[];const r=this.createFloatArray(e),n=this.createFloatArray(t.coordinates);if(-1===r||-1===n)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFacade(t.sourceId,t.crossPerc,t.distanceToRoad,r,e.length,n,t.coordinates.length)}if(!this.module.generateMesh()){const t=this.module.getLastError();return this.readStringBuffer(t)}const r=this.module.getMeshCount(),n=new Array(r);for(let t=0;t<r;t++){const e=this.module.getPositionsPtr(t),r=this.module.getPositionsLength(t),i=new Float32Array(this.module.heapF32.buffer,e,r),s=this.module.getNormalsPtr(t),a=this.module.getNormalsLength(t),o=new Float32Array(this.module.heapF32.buffer,s,a),l=this.module.getAOPtr(t),u=this.module.getAOLength(t),c=new Float32Array(this.module.heapF32.buffer,l,u),h=this.module.getUVPtr(t),p=this.module.getUVLength(t),d=new Float32Array(this.module.heapF32.buffer,h,p),f=this.module.getFauxFacadePtr(t),m=this.module.getFauxFacadeLength(t),y=new Uint8Array(this.module.heapU8.buffer,f,m),g=this.module.getIndicesPtr(t),x=this.module.getIndicesLength(t),v=new Int16Array(this.module.heap16.buffer,g,x),b=this.module.getBuildingPart(t);n[t]={positions:i,normals:o,ao:c,uv:d,isFauxFacade:y,indices:v,buildingPart:b}}const i=this.module.getRingCount(),s=[];for(let t=0;t<i;t++){const e=this.module.getRingPtr(t),r=this.module.getRingLength(t),n=new Float32Array(this.module.heapF32.buffer,e,r);s.push(n)}return{meshes:n,outerRingLength:this.module.getOuterRingLength(),modifiedPolygonRings:s}}}let Rm,Lm,Om,Um,Nm,jm=null,$m=null,Gm=null,qm=null;function Hm(){return ke(self)&&self.worker.dracoUrl?self.worker.dracoUrl:Lm||Xe.DRACO_URL}function Xm(t){Lm=lr.resolveURL(t),jm||(jm=new km(Tm(),new nn)),jm.broadcast("setDracoUrl",Lm)}function Zm(){if(ke(self)&&self.worker.meshoptUrl)return self.worker.meshoptUrl;if(Um)return Um;const t=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]);if("object"!=typeof WebAssembly)throw new Error("WebAssembly not supported, cannot instantiate meshoptimizer");return Um=WebAssembly.validate(t)?Xe.MESHOPT_SIMD_URL:Xe.MESHOPT_URL,Um}function Wm(t){Um=lr.resolveURL(t),jm||(jm=new km(Tm(),new nn)),jm.broadcast("setMeshoptUrl",Um)}function Ym(){return qm}const Km={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Jm={5120:"DT_INT8",5121:"DT_UINT8",5122:"DT_INT16",5123:"DT_UINT16",5125:"DT_UINT32",5126:"DT_FLOAT32"},Qm={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};function ty(t,e,r){const n=r.json.bufferViews.length,i=r.buffers.length;e.bufferView=n,r.json.bufferViews[n]={buffer:i,byteLength:t.byteLength},r.buffers[i]=t}const ey="KHR_draco_mesh_compression";function ry(t,e){const r=t.extensions&&t.extensions[ey];if(!r)return;const n=new Om.Decoder,i=uy(e,r.bufferView),s=new Om.Mesh;if(!n.DecodeArrayToMesh(i,i.byteLength,s))throw new Error("Failed to decode Draco mesh");const a=e.json.accessors[t.indices],o=Km[a.componentType],l=a.count*o.BYTES_PER_ELEMENT,u=Om._malloc(l);o===Uint16Array?n.GetTrianglesUInt16Array(s,l,u):n.GetTrianglesUInt32Array(s,l,u),ty(Om.memory.buffer.slice(u,u+l),a,e),Om._free(u);for(const i of Object.keys(r.attributes)){const a=n.GetAttributeByUniqueId(s,r.attributes[i]),o=e.json.accessors[t.attributes[i]],l=Jm[o.componentType],u=o.count*Qm[o.type]*Km[o.componentType].BYTES_PER_ELEMENT,c=Om._malloc(u);n.GetAttributeDataArrayForAllPoints(s,a,Om[l],u,c),ty(Om.memory.buffer.slice(c,c+u),o,e),Om._free(c)}n.destroy(),s.destroy(),delete t.extensions[ey]}const ny="EXT_meshopt_compression";function iy(t,e){if(!t.extensions||!t.extensions[ny])return;const r=t.extensions[ny],n=new Uint8Array(e.buffers[r.buffer],r.byteOffset||0,r.byteLength||0),i=new Uint8Array(r.count*r.byteStride);Nm.decodeGltfBuffer(i,r.count,r.byteStride,n,r.mode,r.filter),t.buffer=e.buffers.length,t.byteOffset=0,e.buffers[t.buffer]=i.buffer,delete t.extensions[ny]}const sy=1179937895,ay=new TextDecoder("utf8");function oy(t,e){return new URL(t,e).href}function ly(t,e,r,n){return fetch(oy(t.uri,n)).then((t=>t.arrayBuffer())).then((t=>{e.buffers[r]=t}))}function uy(t,e){const r=t.json.bufferViews[e];return new Uint8Array(t.buffers[r.buffer],r.byteOffset||0,r.byteLength)}function cy(t,e,r,n){if(t.uri){const i=oy(t.uri,n);return fetch(i).then((t=>t.blob())).then((t=>createImageBitmap(t))).then((t=>{e.images[r]=t}))}if(void 0!==t.bufferView){const n=uy(e,t.bufferView),i=new Blob([n],{type:t.mimeType});return createImageBitmap(i).then((t=>{e.images[r]=t}))}}function hy(t,e=0,r){const n={json:null,images:[],buffers:[]};if(new Uint32Array(t,e,1)[0]===sy){const r=new Uint32Array(t,e);let i=2;const s=(r[i++]>>2)-3,a=r[i++]>>2;if(i++,n.json=JSON.parse(ay.decode(r.subarray(i,i+a))),i+=a,i<s){const s=r[i++];i++;const a=e+(i<<2);n.buffers[0]=t.slice(a,a+s)}}else n.json=JSON.parse(ay.decode(new Uint8Array(t,e)));const{buffers:i,images:s,meshes:a,extensionsUsed:o,bufferViews:l}=n.json;let u=Promise.resolve();if(i){const t=[];for(let e=0;e<i.length;e++){const s=i[e];s.uri?t.push(ly(s,n,e,r)):n.buffers[e]||(n.buffers[e]=null)}u=Promise.all(t)}return u.then((()=>{const t=[],e=o&&o.includes(ey),i=o&&o.includes(ny);if(e&&t.push(function(){if(!Om)return null!=Rm?Rm:(Rm=function(t){let e,r=null;function n(){e=new Uint8Array(r.buffer)}function i(){throw new Error("Unexpected Draco error.")}const s={a:{a:i,d:function(t,r,n){return e.copyWithin(t,r,r+n)},c:function(t){const i=e.length,s=Math.max(t>>>0,Math.ceil(1.2*i)),a=Math.ceil((s-i)/65536);try{return r.grow(a),n(),!0}catch(t){return!1}},b:i}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(t,s):t.then((t=>t.arrayBuffer())).then((t=>WebAssembly.instantiate(t,s)))).then((t=>{const{Rb:i,Qb:s,P:a,T:o,X:l,Ja:u,La:c,Qa:h,Va:p,Wa:d,eb:f,jb:m,f:y,e:g,yb:x,zb:v,Ab:b,Bb:w,Db:_,Gb:A}=t.instance.exports;r=g;const I=(()=>{let t=0,r=0,n=0,a=0;return o=>{n&&(i(a),i(t),r+=n,n=t=0),t||(r+=128,t=s(r));const l=o.length+7&-8;let u=t;l>=r&&(n=l,u=a=s(l));for(let t=0;t<o.length;t++)e[u+t]=o[t];return u}})();return n(),y(),{memory:g,_free:i,_malloc:s,Mesh:class{constructor(){this.ptr=a()}destroy(){o(this.ptr)}},Decoder:class{constructor(){this.ptr=u()}destroy(){m(this.ptr)}DecodeArrayToMesh(t,e,r){const n=I(t),i=c(this.ptr,n,e,r.ptr);return!!l(i)}GetAttributeByUniqueId(t,e){return{ptr:h(this.ptr,t.ptr,e)}}GetTrianglesUInt16Array(t,e,r){p(this.ptr,t.ptr,e,r)}GetTrianglesUInt32Array(t,e,r){d(this.ptr,t.ptr,e,r)}GetAttributeDataArrayForAllPoints(t,e,r,n,i){f(this.ptr,t.ptr,e.ptr,r,n,i)}},DT_INT8:x(),DT_UINT8:v(),DT_INT16:b(),DT_UINT16:w(),DT_UINT32:_(),DT_FLOAT32:A()}}))}(fetch(Hm())),Rm.then((t=>{Om=t,Rm=void 0})))}()),i&&t.push(function(){if(Nm)return;const t=function(t){let e;const r=WebAssembly.instantiateStreaming(t,{}).then((t=>{e=t.instance,e.exports.__wasm_call_ctors()})),n={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},i={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:r,supported:!0,decodeGltfBuffer(t,r,s,a,o,l){!function(t,e,r,n,i,s,a){const o=t.exports.sbrk,l=n+3&-4,u=o(l*i),c=o(s.length),h=new Uint8Array(t.exports.memory.buffer);h.set(s,c);const p=e(u,n,i,c,s.length);if(0===p&&a&&a(u,l,i),r.set(h.subarray(u,u+n*i)),o(u-o(0)),0!==p)throw new Error(`Malformed buffer data: ${p}`)}(e,e.exports[i[o]],t,r,s,a,e.exports[n[l]])}}}(fetch(Zm()));return t.ready.then((()=>{Nm=t}))}()),s)for(let e=0;e<s.length;e++)t.push(cy(s[e],n,e,r));return(t.length?Promise.all(t):Promise.resolve()).then((()=>{if(e&&a)for(const{primitives:t}of a)for(const e of t)ry(e,n);if(i&&a&&l)for(const t of l)iy(t,n);return n}))}))}function py(t){return fetch(t).then((t=>t.arrayBuffer())).then((e=>hy(e,0,t)))}function dy(t){let e=0;if(new Uint32Array(t,0,1)[0]!==sy){const r=new Uint32Array(t,0,7),[,,n,i,s,a]=r;e=r.byteLength+i+s+a+s,(n!==t.byteLength||e>=t.byteLength)&&Ae("Invalid b3dm header information.")}return hy(t,e)}function fy(t){switch(t){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.RGBA;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.DEPTH_COMPONENT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.DEPTH_STENCIL;case WebGL2RenderingContext.R8:case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.RED}}function my(t){switch(t){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.UNSIGNED_SHORT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.UNSIGNED_INT_24_8;case WebGL2RenderingContext.R8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.FLOAT}}class yy{constructor(t,e,r,n){this.context=t,this.format=r,this.useMipmap=n&&n.useMipmap,this.texture=t.gl.createTexture(),this.update(e,{premultiply:n&&n.premultiply})}update(t,e){const r=t&&t instanceof HTMLVideoElement&&0===t.width?t.videoWidth:t.width,n=t&&t instanceof HTMLVideoElement&&0===t.height?t.videoHeight:t.height,{context:i}=this,{gl:s}=i,{x:a,y:o}=e&&e.position?e.position:{x:0,y:0},l=a+r,u=o+n;!this.size||this.size[0]===l&&this.size[1]===u||(s.bindTexture(s.TEXTURE_2D,null),s.deleteTexture(this.texture),this.texture=s.createTexture(),this.size=null),s.bindTexture(s.TEXTURE_2D,this.texture),i.pixelStoreUnpackFlipY.set(!1),i.pixelStoreUnpack.set(1),i.pixelStoreUnpackPremultiplyAlpha.set(this.format===s.RGBA8&&(!e||!1!==e.premultiply));const c=t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||ImageBitmap&&t instanceof ImageBitmap;if(!this.size&&l>0&&u>0){const t=this.useMipmap?Math.floor(Math.log2(Math.max(l,u)))+1:1;s.texStorage2D(s.TEXTURE_2D,t,this.format,l,u),this.size=[l,u]}this.size&&(c?s.texSubImage2D(s.TEXTURE_2D,0,a,o,fy(this.format),my(this.format),t):"data"in t&&t.data&&s.texSubImage2D(s.TEXTURE_2D,0,a,o,r,n,fy(this.format),my(this.format),t.data)),this.useMipmap&&s.generateMipmap(s.TEXTURE_2D)}bind(t,e,r=!1){const{context:n}=this,{gl:i}=n;i.bindTexture(i.TEXTURE_2D,this.texture),t!==this.minFilter&&(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,t),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,this.useMipmap&&!r?t===i.NEAREST?i.NEAREST_MIPMAP_NEAREST:i.LINEAR_MIPMAP_LINEAR:t),this.minFilter=t),e!==this.wrapS&&(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,e),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,e),this.wrapS=e)}bindExtraParam(t,e,r,n,i){const{context:s}=this,{gl:a}=s;a.bindTexture(a.TEXTURE_2D,this.texture),e!==this.magFilter&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,e),this.magFilter=e),t!==this.minFilter&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,this.useMipmap?t===a.NEAREST?a.NEAREST_MIPMAP_NEAREST:a.LINEAR_MIPMAP_LINEAR:t),this.minFilter=t),r!==this.wrapS&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,r),this.wrapS=r),n!==this.wrapT&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,n),this.wrapT=n),i!==this.compareMode&&(i?(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_COMPARE_MODE,a.COMPARE_REF_TO_TEXTURE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_COMPARE_FUNC,i)):a.texParameteri(a.TEXTURE_2D,a.TEXTURE_COMPARE_MODE,a.NONE),this.compareMode=i)}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}}class gy{constructor(t,e,r,n){this.context=t,this.format=n,this.size=r,this.texture=t.gl.createTexture();const[i,s,a]=this.size,{gl:o}=t;o.bindTexture(o.TEXTURE_3D,this.texture),t.pixelStoreUnpackFlipY.set(!1),t.pixelStoreUnpack.set(1),t.pixelStoreUnpackPremultiplyAlpha.set(!1),"data"in e&&e.data&&o.texImage3D(o.TEXTURE_3D,0,this.format,i,s,a,0,fy(this.format),my(this.format),e.data)}bind(t,e){const{context:r}=this,{gl:n}=r;n.bindTexture(n.TEXTURE_3D,this.texture),t!==this.minFilter&&(n.texParameteri(n.TEXTURE_3D,n.TEXTURE_MAG_FILTER,t),n.texParameteri(n.TEXTURE_3D,n.TEXTURE_MIN_FILTER,t),this.minFilter=t),e!==this.wrapS&&(n.texParameteri(n.TEXTURE_3D,n.TEXTURE_WRAP_S,e),n.texParameteri(n.TEXTURE_3D,n.TEXTURE_WRAP_T,e),this.wrapS=e)}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}}class xy{constructor(t,e){this.context=t,this.texture=e}bind(t,e){const{context:r}=this,{gl:n}=r;n.bindTexture(n.TEXTURE_2D,this.texture),t!==this.minFilter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,t),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,t),this.minFilter=t),e!==this.wrapS&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,e),this.wrapS=e)}}const vy=bl([{name:"a_pos_3f",components:3,type:"Float32"}]),by=bl([{name:"a_color_3f",components:3,type:"Float32"}]),wy=bl([{name:"a_color_4f",components:4,type:"Float32"}]),_y=bl([{name:"a_uv_2f",components:2,type:"Float32"}]),Ay=bl([{name:"a_normal_3f",components:3,type:"Float32"}]),Iy=bl([{name:"a_normal_matrix0",components:4,type:"Float32"},{name:"a_normal_matrix1",components:4,type:"Float32"},{name:"a_normal_matrix2",components:4,type:"Float32"},{name:"a_normal_matrix3",components:4,type:"Float32"}]),My=bl([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]);function Sy(t,e){const r=By(t.projection,t.zoom,t.width,t.height),n=function(t,e,r,n,i){const s=new yc(r.lng-180*zy,r.lat),a=new yc(r.lng+180*zy,r.lat),o=t.project(s.lng,s.lat),l=t.project(a.lng,a.lat),u=-Math.atan2(l.y-o.y,l.x-o.x),c=Ec.fromLngLat(r);c.y=ie(c.y,-1+zy,1-zy);const h=c.toLngLat(),p=t.project(h.lng,h.lat),d=Ec.fromLngLat(h);d.x+=zy;const m=d.toLngLat(),y=t.project(m.lng,m.lat),x=Ey(y.x-p.x,y.y-p.y,u),b=Ec.fromLngLat(h);b.y+=zy;const w=b.toLngLat(),A=t.project(w.lng,w.lat),I=Ey(A.x-p.x,A.y-p.y,u),M=Math.abs(x.x)/Math.abs(I.y),S=f([]);_(S,S,-u*(1-(i?0:n)));const P=f([]);return v(P,P,[1,1-(1-M)*n,1]),P[4]=-I.x/I.y*n,_(P,P,u),g(P,S,P),P}(t.projection,0,t.center,r,e),i=Py(t);return v(n,n,[i,i,1]),n}function Py(t){const e=t.projection,r=By(t.projection,t.zoom,t.width,t.height),n=Ty(e,t.center),i=Ty(e,yc.convert(e.center));return Math.pow(2,n*r+(1-r)*i)}function ky(t){const e=Sy(t,!0);return n([],[e[0],e[1],e[4],e[5]])}function By(t,e,r,n,i=1/0){const s=t.range;if(!s)return 0;const a=Math.min(i,Math.max(r,n)),o=Math.log2(a/1024);return se(s[0]+o,s[1]+o,e)}const zy=1/4e4;function Ty(t,e){const r=ie(e.lat,-Pc,Pc),n=new yc(e.lng-180*zy,r),i=new yc(e.lng+180*zy,r),s=t.project(n.lng,r),a=t.project(i.lng,r),o=Ec.fromLngLat(n),l=Ec.fromLngLat(i),u=a.x-s.x,c=a.y-s.y,h=l.x-o.x,p=l.y-o.y,d=Math.sqrt((h*h+p*p)/(u*u+c*c));return Math.log2(d)}function Ey(t,e,r){const n=Math.cos(r),i=Math.sin(r);return{x:t*n-e*i,y:t*i+e*n}}function Vy(t,e,r){f(t),_(t,t,Xt(e[2])),b(t,t,Xt(e[0])),w(t,t,Xt(e[1])),v(t,t,r),g(t,t,[1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1])}function Fy(t,e,r,n,i,s,a,o){const l=[r[0]-e[0],r[1]-e[1],0],u=[n[0]-e[0],n[1]-e[1],0];if(V(l)<1e-12||V(u)<1e-12)return mt(t);const c=W([],l,u);X(c,c),R(u,n,e),l[2]=(s-i)*o,u[2]=(a-i)*o;const h=l;return W(h,l,u),X(h,h),Pt(t,c,h)}function Cy(t,e,r=!1){const n=Ap(e.zoom),i=function(t,e,r){const n=e.worldSize,i=[t[12],t[13],t[14]],s=Mc(i[1]/n),a=Ic(i[0]/n),o=f([]),l=Ac(1,s)*n,u=Ac(1,0)*n*Bc(s,e.zoom),c=1/gp(n);let h=u*c;if(r){const t=By(e.projection,e.zoom,e.width,e.height,1024);h=c*e.projection.pixelSpaceConversion(e.center.lat,n,t)}const p=dc(s,a);D(p,p,N([],X([],p),l*h*i[2]));const d=function(t){const e=[t[0],t[1],t[2]];let r=[0,1,0];const n=W([],r,e);return W(r,e,n),0===q(r)&&(r=[0,1,0],W(n,e,r)),X(n,n),X(r,r),X(e,e),[n[0],n[1],n[2],0,r[0],r[1],r[2],0,e[0],e[1],e[2],0,t[0],t[1],t[2],1]}(p);v(o,o,[h,h,h*l]),x(o,o,[-i[0],-i[1],-i[2]]);const m=g([],e.globeMatrix,d);return g(m,m,o),g(m,m,t),m}(t,e,r);if(n>0){const r=function(t,e){const r=e.worldSize,n=Ac(1,0)*r*Bc(e.center.lat,e.zoom)/gp(r),i=Ac(1,e.center.lat)*r,s=f([]);w(s,s,Xt(e.center.lng)),b(s,s,Xt(e.center.lat)),x(s,s,[0,0,rc]),v(s,s,[n,n,n*i]);const a=e.point;return x(s,s,[-a.x,-a.y,0]),g(s,s,t),g(s,e.globeMatrix,s)}(t,e);return function(t,e,r){const n=(t,e,r)=>{const n=V(t),i=V(e),s=sp(t,e,r);return N(s,s,1/V(s)*dn(n,i,r))},i=n([t[0],t[1],t[2]],[e[0],e[1],e[2]],r),s=n([t[4],t[5],t[6]],[e[4],e[5],e[6]],r),a=n([t[8],t[9],t[10]],[e[8],e[9],e[10]],r),o=sp([t[12],t[13],t[14]],[e[12],e[13],e[14]],r);return[i[0],i[1],i[2],0,s[0],s[1],s[2],0,a[0],a[1],a[2],0,o[0],o[1],o[2],1]}(i,r,n)}return i}function Dy(t,e,r,n){const i=mh.projectAabbCorners(n,r);let s=Number.MAX_VALUE;for(let t=0;t<i.length;++t){const r=i[t];r[0]=(.5*r[0]+.5)*e.width,r[1]=(.5-.5*r[1])*e.height,r[2]<s&&(s=r[2])}const a=function(t){const e=[];let r=0;for(let e=1;e<t.length;e++)(t[e][0]<t[r][0]||t[e][0]===t[r][0]&&t[e][1]<t[r][1])&&(r=e);let n,i=r;const s=new Uint8Array(t.length);do{if(s[i])break;e.push(new $t(t[i][0],t[i][1])),s[i]=1,n=(i+1)%t.length;for(let e=0;e<t.length;e++){if(t[e][0]===t[n][0]&&t[e][1]===t[n][1]||t[e][0]===t[i][0]&&t[e][1]===t[i][1])continue;const r=[t[e][0]-t[i][0],t[e][1]-t[i][1]],s=[t[n][0]-t[i][0],t[n][1]-t[i][1]],a=r[0]*s[1]-r[1]*s[0];(a>0||0===a&&r[0]*s[0]+r[1]*s[1]>=0&&r[0]*r[0]+r[1]*r[1]>s[0]*s[0]+s[1]*s[1])&&(n=e)}i=n}while(i!==r);return e.length>0&&e.push(e[0]),e}(i);if(wh(t,a))return s}const Ry=64,Ly={CoordinateSpaceTile:1,HasMapboxMeshFeatures:4,HasMeshoptCompression:8},Oy=[1,1,1];function Uy(t,e,r,n,i,s,a,o,l,u=!1){const c=r.zoom,h=r.project(n),p=Bc(n.lat,c),d=1/p;f(t),x(t,t,[h.x+a[0]*d,h.y+a[1]*d,a[2]]);let m=1,y=1;const b=r.worldSize;if(u){if("mercator"===r.projection.name){let t=0;r.elevation&&(t=r.elevation.getAtPointOrZero(new Ec(h.x/b,h.y/b),0));const e=dt([],[h.x,h.y,t,1],r.projMatrix)[3]/r.cameraToCenterDistance;m=e,y=e*Bc(r.center.lat,c)}else if("globe"===r.projection.name){const e=Cy(t,r),i=[0,0,0,1];dt(i,i,g([],r.projMatrix,e));const s=i[3]/r.cameraToCenterDistance,a=Ap(c),o=r.projection.pixelsPerMeter(n.lat,b)*Bc(n.lat,c),l=r.projection.pixelsPerMeter(r.center.lat,b)*Bc(r.center.lat,c);m=s/dn(o,kc(r.center.lat),a),y=s*p/o,m*=l,y*=l}}else m=d;v(t,t,[m,m,y]);const w=[...t],_=e.orientation,A=[];if(Vy(A,[_[0]+(i?i[0]:0),_[1]+(i?i[1]:0),_[2]+(i?i[2]:0)],s),g(t,w,A),o&&r.elevation){let i=0;const s=[];if(l&&r.elevation){i=function(t,e,r,n,i){const s=e.elevation;if(!s)return 0;const a=mh.projectAabbCorners(r,n),o=Ac(1,i.lat)*e.worldSize,l=function(t,e){const r=[0,0,1],n=[{corners:[0,1,3,2],dotProductWithUp:0},{corners:[1,5,2,6],dotProductWithUp:0},{corners:[0,4,1,5],dotProductWithUp:0},{corners:[2,6,3,7],dotProductWithUp:0},{corners:[4,7,5,6],dotProductWithUp:0},{corners:[0,3,4,7],dotProductWithUp:0}];for(const i of n){const n=t[i.corners[0]],s=t[i.corners[1]],a=t[i.corners[2]],o=[s[0]-n[0],s[1]-n[1],e*(s[2]-n[2])],l=W(o,o,[a[0]-n[0],a[1]-n[1],e*(a[2]-n[2])]);X(l,l),i.dotProductWithUp=Z(l,r)}return n.sort(((t,e)=>t.dotProductWithUp-e.dotProductWithUp)),n[0].corners}(a,o),u=a[l[0]],c=a[l[1]],h=a[l[2]],p=a[l[3]],d=s.getAtPointOrZero(new Ec(u[0]/e.worldSize,u[1]/e.worldSize),0),f=s.getAtPointOrZero(new Ec(c[0]/e.worldSize,c[1]/e.worldSize),0),m=s.getAtPointOrZero(new Ec(h[0]/e.worldSize,h[1]/e.worldSize),0),y=s.getAtPointOrZero(new Ec(p[0]/e.worldSize,p[1]/e.worldSize),0),g=(d+y)/2,x=(f+m)/2;return g>x?f<m?Fy(t,c,p,u,f,y,d,o):Fy(t,h,u,p,m,d,y,o):d<y?Fy(t,u,c,h,d,f,m,o):Fy(t,p,h,c,y,m,f,o),Math.max(g,x)}(s,r,e.aabb,t,n);const a=g([],P([],s),A);g(t,w,a)}else i=r.elevation.getAtPointOrZero(new Ec(h.x/b,h.y/b),0);0!==i&&(t[14]+=i)}}class Ny{constructor(t,e,r,n,i){this.materialOverrides=new Map,this.nodeOverrides=new Map,this.materialOverrideNames=[],this.nodeOverrideNames=[],this.featureProperties={},this.id=t,this.uri=e,this.position=null!=r?new yc(r[0],r[1]):new yc(0,0),this.orientation=null!=n?n:[0,0,0],this.nodes=i,this.uploaded=!1,this.aabb=new mh([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),this.matrix=[]}_applyTransformations(t,e){g(t.globalMatrix,e,t.localMatrix);const r=this.nodeOverrides.get(t.name);if(void 0!==r){const e=[];i=r.orientation,f(n=e),w(n,n,Xt(i[1])),_(n,n,Xt(i[2])),b(n,n,Xt(i[0])),g(t.globalMatrix,t.globalMatrix,e)}var n,i;if(t.meshes)for(const e of t.meshes){const r=mh.applyTransformFast(e.aabb,t.globalMatrix);this.aabb.encapsulate(r)}if(t.children)for(const e of t.children)this._applyTransformations(e,t.globalMatrix)}computeBoundsAndApplyParent(){const t=f([]);this.aabb=new mh([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(const e of this.nodes)this._applyTransformations(e,t)}computeModelMatrix(t,e,r,n,i,s,a=!1){Uy(this.matrix,this,t.transform,this.position,e,r,n,i,s,a)}upload(t){if(!this.uploaded){for(const e of this.nodes)Gy(e,t);for(const t of this.nodes)qy(t);this.uploaded=!0}}destroy(){for(const t of this.nodes)Hy(t)}}function jy(t,e,r=!1){t.uploaded||(t.gfxTexture=new yy(e,t.image,r?e.gl.R8:e.gl.RGBA8,{useMipmap:t.sampler.minFilter>=e.gl.NEAREST_MIPMAP_NEAREST}),t.uploaded=!0,t.image=null)}function $y(t,e,r){t.indexBuffer=e.createIndexBuffer(t.indexArray,!1,!0),t.vertexBuffer=e.createVertexBuffer(t.vertexArray,vy.members,!1,!0),t.normalArray&&(t.normalBuffer=e.createVertexBuffer(t.normalArray,Ay.members,!1,!0)),t.texcoordArray&&(t.texcoordBuffer=e.createVertexBuffer(t.texcoordArray,_y.members,!1,!0)),t.colorArray&&(t.colorBuffer=e.createVertexBuffer(t.colorArray,(12===t.colorArray.bytesPerElement?by:wy).members,!1,!0)),t.featureArray&&(t.pbrBuffer=e.createVertexBuffer(t.featureArray,My.members,!0)),t.segments=bu.simpleSegment(0,0,t.vertexArray.length,t.indexArray.length);const n=t.material;n.pbrMetallicRoughness.baseColorTexture&&jy(n.pbrMetallicRoughness.baseColorTexture,e),n.pbrMetallicRoughness.metallicRoughnessTexture&&jy(n.pbrMetallicRoughness.metallicRoughnessTexture,e),n.normalTexture&&jy(n.normalTexture,e),n.occlusionTexture&&jy(n.occlusionTexture,e,r),n.emissionTexture&&jy(n.emissionTexture,e)}function Gy(t,e,r){if(t.meshes)for(const n of t.meshes)$y(n,e,r);if(t.children)for(const n of t.children)Gy(n,e,r)}function qy(t){if(t.meshes)for(const e of t.meshes)e.indexArray.destroy(),e.vertexArray.destroy(),e.colorArray&&e.colorArray.destroy(),e.normalArray&&e.normalArray.destroy(),e.texcoordArray&&e.texcoordArray.destroy(),e.featureArray&&e.featureArray.destroy();if(t.children)for(const e of t.children)qy(e)}function Hy(t){if(t.meshes)for(const r of t.meshes)r.vertexBuffer&&(r.vertexBuffer.destroy(),r.indexBuffer.destroy(),r.normalBuffer&&r.normalBuffer.destroy(),r.texcoordBuffer&&r.texcoordBuffer.destroy(),r.colorBuffer&&r.colorBuffer.destroy(),r.pbrBuffer&&r.pbrBuffer.destroy(),r.segments.destroy(),r.material&&((e=r.material).pbrMetallicRoughness.baseColorTexture&&e.pbrMetallicRoughness.baseColorTexture.gfxTexture&&e.pbrMetallicRoughness.baseColorTexture.gfxTexture.destroy(),e.pbrMetallicRoughness.metallicRoughnessTexture&&e.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture&&e.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture.destroy(),e.normalTexture&&e.normalTexture.gfxTexture&&e.normalTexture.gfxTexture.destroy(),e.emissionTexture&&e.emissionTexture.gfxTexture&&e.emissionTexture.gfxTexture.destroy(),e.occlusionTexture&&e.occlusionTexture.gfxTexture&&e.occlusionTexture.gfxTexture.destroy()));var e;if(t.children)for(const e of t.children)Hy(e)}function Xy(t,e){const r=t.json.bufferViews[e.bufferView],n=Km[e.componentType];return new n(t.buffers[r.buffer],(e.byteOffset||0)+(r.byteOffset||0),e.count*(r.byteStride&&r.byteStride!==Qm[e.type]*n.BYTES_PER_ELEMENT?r.byteStride/n.BYTES_PER_ELEMENT:Qm[e.type]))}function Zy(t,e,r,n){const i=Km[e.componentType],s=function(t){switch(t){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:return 1}}(i),a=t.json.bufferViews[e.bufferView],o=a.byteStride?a.byteStride/i.BYTES_PER_ELEMENT:Qm[e.type],l=r.float32,u=l.length/r.capacity;for(let t=0,r=0;t<e.count*o;t+=o,r+=u)for(let e=0;e<u;e++)l[r+e]=n[t+e]*s;r._trim()}function Wy(t,e,r){const n=t.indices,i=t.attributes,s={};s.indexArray=new $l;const a=e.json.accessors[n],o=a.count/3;s.indexArray.reserve(o);const l=Xy(e,a);for(let t=0;t<o;t++)s.indexArray.emplaceBack(l[3*t],l[3*t+1],l[3*t+2]);s.indexArray._trim(),s.vertexArray=new zl;const u=e.json.accessors[i.POSITION];s.vertexArray.reserve(u.count);const c=Xy(e,u);for(let t=0;t<u.count;t++)s.vertexArray.emplaceBack(c[3*t],c[3*t+1],c[3*t+2]);if(s.vertexArray._trim(),s.aabb=new mh(u.min,u.max),s.centroid=function(t,e){const r=[0,0,0],n=t.length;if(n>0){for(let i=0;i<n;i++){const n=3*t[i];r[0]+=e[n],r[1]+=e[n+1],r[2]+=e[n+2]}r[0]/=n,r[1]/=n,r[2]/=n}return r}(l,c),void 0!==i.COLOR_0){const t=e.json.accessors[i.COLOR_0],r=Qm[t.type],n=Xy(e,t);s.colorArray=3===r?new zl:new Dl,s.colorArray.resize(t.count),Zy(e,t,s.colorArray,n)}if(void 0!==i.NORMAL){s.normalArray=new zl;const t=e.json.accessors[i.NORMAL];s.normalArray.resize(t.count);const r=Xy(e,t);Zy(e,t,s.normalArray,r)}if(void 0!==i.TEXCOORD_0&&r.length>0){s.texcoordArray=new Kl;const t=e.json.accessors[i.TEXCOORD_0];s.texcoordArray.resize(t.count);const r=Xy(e,t);Zy(e,t,s.texcoordArray,r)}if(void 0!==i._FEATURE_ID_RGBA4444){const t=e.json.accessors[i._FEATURE_ID_RGBA4444];e.json.extensionsUsed&&e.json.extensionsUsed.includes("EXT_meshopt_compression")&&(s.featureData=Xy(e,t))}void 0!==i._FEATURE_RGBA4444&&(s.featureData=new Uint32Array(Xy(e,e.json.accessors[i._FEATURE_RGBA4444]).buffer));const h=t.material;return s.material=function(t,e){const{emissiveFactor:r=[0,0,0],alphaMode:n="OPAQUE",alphaCutoff:i=.5,normalTexture:s,occlusionTexture:a,emissiveTexture:o,doubleSided:l,name:u}=t,{baseColorFactor:c=[1,1,1,1],metallicFactor:h=1,roughnessFactor:p=1,baseColorTexture:d,metallicRoughnessTexture:f}=t.pbrMetallicRoughness||{},m=a?e[a.index]:void 0;if(a&&a.extensions&&a.extensions.KHR_texture_transform&&m){const t=a.extensions.KHR_texture_transform;m.offsetScale=[t.offset[0],t.offset[1],t.scale[0],t.scale[1]]}return{name:u,pbrMetallicRoughness:{baseColorFactor:new un(...c),metallicFactor:h,roughnessFactor:p,baseColorTexture:d?e[d.index]:void 0,metallicRoughnessTexture:f?e[f.index]:void 0},doubleSided:l,emissiveFactor:new un(...r),alphaMode:n,alphaCutoff:i,normalTexture:s?e[s.index]:void 0,occlusionTexture:m,emissionTexture:o?e[o.index]:void 0,defined:void 0===t.defined}}(void 0!==h?e.json.materials[h]:{defined:!1},r),s}function Yy(t,e,r){const{matrix:n,rotation:i,translation:s,scale:a,mesh:o,extras:l,children:u,name:c}=t,h={};if(h.name=c,h.localMatrix=n||function(t,e,r,n){var i=e[0],s=e[1],a=e[2],o=e[3],l=i+i,u=s+s,c=a+a,h=i*l,p=i*u,d=i*c,f=s*u,m=s*c,y=a*c,g=o*l,x=o*u,v=o*c,b=n[0],w=n[1],_=n[2];return t[0]=(1-(f+y))*b,t[1]=(p+v)*b,t[2]=(d-x)*b,t[3]=0,t[4]=(p-v)*w,t[5]=(1-(h+y))*w,t[6]=(m+g)*w,t[7]=0,t[8]=(d+x)*_,t[9]=(m-g)*_,t[10]=(1-(h+f))*_,t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t}([],i||[0,0,0,1],s||[0,0,0],a||[1,1,1]),h.globalMatrix=p(h.localMatrix),void 0!==o){h.meshes=r[o];const t=h.anchor=[0,0];for(const e of h.meshes){const{min:r,max:n}=e.aabb;t[0]+=r[0]+n[0],t[1]+=r[1]+n[1]}t[0]=Math.floor(t[0]/h.meshes.length/2),t[1]=Math.floor(t[1]/h.meshes.length/2)}if(l&&(l.id&&(h.id=l.id),l.lights&&(h.lights=function(t){if(!t.length)return[];const e=function(t){const e=atob(t),r=new Uint8Array(e.length);for(let t=0;t<e.length;t++)r[t]=e.codePointAt(t);return r}(t),r=[],n=e.length/24,i=new Uint16Array(e.buffer),s=new Float32Array(e.buffer);for(let t=0;t<n;t++){const e=i[2*t*6]/30,n=i[2*t*6+1]/30,a=i[2*t*6+10]/100,o=s[6*t+1],l=s[6*t+2],u=s[6*t+3],c=s[6*t+4],h=u-o,p=c-l,d=Math.hypot(h,p);r.push({pos:[o+.5*h,l+.5*p,n],normal:[p/d,-h/d,0],width:d,height:e,depth:a,points:[o,l,u,c]})}return r}(l.lights)),l.MAPBOX_geometry_bloom&&(h.isGeometryBloom=l.MAPBOX_geometry_bloom)),u){const t=[];for(const n of u)t.push(Yy(e.json.nodes[n],e,r));h.children=t}return h}function Ky(t){if(0===t.vertices.length||0===t.indices.length)return null;const e=new rf(t.vertices,t.indices,8,256),[r,n]=[e.min.clone(),e.max.clone()];return{vertices:t.vertices,indices:t.indices,grid:e,min:r,max:n}}function Jy(t){if(!t.extras||!t.extras.ground)return null;const e=t.extras.ground;if(!e||!Array.isArray(e)||0===e.length)return null;const r=e[0];if(!r||!Array.isArray(r)||0===r.length)return null;const n=[];for(const t of r){if(!Array.isArray(t)||2!==t.length)continue;const e=t[0],r=t[1];"number"==typeof e&&"number"==typeof r&&n.push(new $t(e,r))}if(n.length<3)return null;n.length>1&&n[n.length-1].equals(n[0])&&n.pop();let i=0;for(let t=0;t<n.length;t++){const e=n[t],r=n[(t+1)%n.length],s=n[(t+2)%n.length];i+=(e.x-r.x)*(s.y-r.y)-(s.x-r.x)*(e.y-r.y)}i>0&&n.reverse();const s=od(n.flatMap((t=>[t.x,t.y])),[]);return 0===s.length?null:{vertices:n,indices:s}}function Qy(t,e){const r=[],n=[];let i=0;const s=[];for(const a of t){i=r.length;const t=a.vertexArray.float32,o=a.indexArray.uint16;for(let n=0;n<a.vertexArray.length;n++)s[0]=t[3*n+0],s[1]=t[3*n+1],s[2]=t[3*n+2],K(s,s,e),r.push(new $t(s[0],s[1]));for(let t=0;t<3*a.indexArray.length;t++)n.push(o[t]+i)}if(n.length%3!=0)return null;for(let t=0;t<n.length;t+=3){const e=r[n[t+0]],i=r[n[t+1]],s=r[n[t+2]];(e.x-i.x)*(s.y-i.y)-(s.x-i.x)*(e.y-i.y)>0&&([n[t+1],n[t+2]]=[n[t+2],n[t+1]])}return{vertices:r,indices:n}}function tg(t){const e=function(t,e){const r=[],n=WebGL2RenderingContext;if(t.json.textures)for(const i of t.json.textures){const s={magFilter:n.LINEAR,minFilter:n.NEAREST,wrapS:n.REPEAT,wrapT:n.REPEAT};void 0!==i.sampler&&Object.assign(s,t.json.samplers[i.sampler]),r.push({image:e[i.source],sampler:s,uploaded:!1})}return r}(t,t.images),r=function(t,e){const r=[];for(const n of t.json.meshes){const i=[];for(const r of n.primitives)i.push(Wy(r,t,e));r.push(i)}return r}(t,e),{scenes:n,scene:i,nodes:s}=t.json,a=n?n[i||0].nodes:[...s.keys()],o=[];for(const e of a)o.push(Yy(s[e],t,r));return function(t,e,r){const n={},i=new Set;for(let s=0;s<t.length;s++){const t=r[e[s]];if(!t.extras)continue;const a=t.extras["mapbox:footprint:version"],o=t.extras["mapbox:footprint:id"];(a||o)&&i.add(s),"1.0.0"===a&&o&&(n[o]=s)}for(let s=0;s<t.length;s++){if(i.has(s))continue;const a=t[s],o=r[e[s]];if(!o.extras)continue;let l=null;a.id in n&&(l=Qy(t[n[a.id]].meshes,a.localMatrix)),l||(l=Jy(o)),l&&(a.footprint=Ky(l))}if(i.size>0){const e=Array.from(i.values()).sort(((t,e)=>t-e));for(let r=e.length-1;r>=0;r--)t.splice(e[r],1)}}(o,a,t.json.nodes),o}function eg(t,e){const r=tg(t);for(const t of r){for(const e of t.meshes)rg(e);t.lights&&(t.lightMeshIndex=t.meshes.length,t.meshes.push(ig(t.lights,e)))}return r}function rg(t){t.heightmap=new Float32Array(Ry*Ry),t.heightmap.fill(-1);const e=t.vertexArray.float32,r=t.aabb.min[0]-1,n=t.aabb.min[1]-1,i=Ry/(t.aabb.max[0]-r+2),s=Ry/(t.aabb.max[1]-n+2);for(let a=0;a<e.length;a+=3){const o=e[a+2],l=(e[a+0]-r)*i|0,u=(e[a+1]-n)*s|0;o>t.heightmap[u*Ry+l]&&(t.heightmap[u*Ry+l]=o)}}function ng(t,e,r,n,i){r.reserve(r.length+4*t.length),n.reserve(n.length+10*t.length),i.reserve(i.length+10*t.length);let s=n.length;for(const a of t){const t=Math.min(10,Math.max(4,1.3*a.height))*e,o=[-a.normal[1],a.normal[0],0],l=Math.min(.29,.1*a.width/a.depth),u=a.width-2*a.depth*e*(l+.01),c=j([],a.pos,o,u/2),h=j([],a.pos,o,-u/2),p=[c[0],c[1],c[2]+a.height],d=[h[0],h[1],h[2]+a.height],f=j([],a.normal,o,l);N(f,f,t);const m=j([],a.normal,o,-l);N(m,m,t),D(f,c,f),D(m,h,m),c[2]+=.1,h[2]+=.1,n.emplaceBack(f[0],f[1],f[2]),n.emplaceBack(m[0],m[1],m[2]),n.emplaceBack(c[0],c[1],c[2]),n.emplaceBack(h[0],h[1],h[2]),n.emplaceBack(p[0],p[1],p[2]),n.emplaceBack(d[0],d[1],d[2]),n.emplaceBack(c[0],c[1],c[2]),n.emplaceBack(h[0],h[1],h[2]),n.emplaceBack(f[0],f[1],f[2]),n.emplaceBack(m[0],m[1],m[2]);const y=u/t/2;i.emplaceBack(-y-l,-1,y,.8),i.emplaceBack(y+l,-1,y,.8),i.emplaceBack(-y,0,y,1.3),i.emplaceBack(y,0,y,1.3),i.emplaceBack(y+l,-.8,y,.7),i.emplaceBack(y+l,-.8,y,.7),i.emplaceBack(0,0,y,1.3),i.emplaceBack(0,0,y,1.3),i.emplaceBack(y+l,-1.2,y,.8),i.emplaceBack(y+l,-1.2,y,.8),r.emplaceBack(6+s,4+s,8+s),r.emplaceBack(7+s,9+s,5+s),r.emplaceBack(0+s,1+s,2+s),r.emplaceBack(1+s,3+s,2+s),s+=10}}function ig(t,e){const r={};r.indexArray=new $l,r.vertexArray=new zl,r.colorArray=new Dl,ng(t,e,r.indexArray,r.vertexArray,r.colorArray);const n={defined:!0};n.emissiveFactor=un.black;const i={};return i.baseColorFactor=un.white,n.pbrMetallicRoughness=i,r.material=n,r.aabb=new mh([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),r}const sg=bl([{name:"a_pos_3f",components:3,type:"Float32"}]),ag=bl([{name:"a_normal_3",components:3,type:"Int16"}]),og=bl([{name:"a_centroid_3",components:3,type:"Int16"}]),lg=bl([{name:"a_part_color_emissive",components:2,type:"Uint16"}]),ug=bl([{name:"a_faux_facade_color_emissive",components:2,type:"Uint16"}]),cg=bl([{name:"a_faux_facade_data",components:4,type:"Uint16"}]),hg=bl([{name:"a_faux_facade_vertical_range",components:2,type:"Uint16"}]),pg=bl([{name:"a_bloom_attenuation",components:4,type:"Float32"}]),dg=bl([{name:"a_flood_light_wall_radius_1i16",components:1,type:"Uint16"}]),fg=jc.types,mg=2,yg=32767;function gg(t,e){const r=Ui+e;for(const n of t)for(const t of n)if(t.x<-e||t.x>r||t.y<-e||t.y>r)return!1;return!0}function xg(t){switch(t){case"flat":return 3;case"hipped":return 1;case"gabled":return 2;case"parapet":return 0;case"mansard":return 4;case"skillion":return 5;case"pyramidal":return 6;default:throw new Error(`Unknown roof shape: ${t}`)}}class vg{constructor(){this.layoutVertexArray=new zl,this.layoutAttenuationArray=new Dl,this.layoutColorArray=new Ll,this.indexArray=new $l,this.indexArrayForConflation=new $l,this.segmentsBucket=new bu}}class bg{constructor(t){this.layoutFacadePaintArray=null,this.layoutFacadeDataArray=null,this.layoutFacadeVerticalRangeArray=null,this.segmentsBucket=new bu,this.entranceBloom=new vg;const e=66560;this.layoutVertexArray=new zl,this.layoutVertexArray.reserve(e),this.layoutNormalArray=new Al,this.layoutNormalArray.reserve(e),this.layoutCentroidArray=new Al,this.layoutCentroidArray.reserve(e),this.layoutColorArray=new Ll,this.layoutColorArray.reserve(e),this.layoutFloodLightDataArray=new Ql,this.layoutFloodLightDataArray.reserve(e),this.layoutAOArray=new nu,this.layoutAOArray.reserve(e),this.indexArray=new $l,this.indexArray.reserve(66560),this.indexArrayForConflation=new $l,this.segmentsBucket=new bu,this.entranceBloom=new vg,t&&(this.layoutFacadePaintArray=new Ll,this.layoutFacadeDataArray=new El,this.layoutFacadeVerticalRangeArray=new Ll)}reserve(t,e,r){this.layoutVertexArray.reserveForAdditional(t),this.layoutCentroidArray.reserveForAdditional(t),this.layoutFloodLightDataArray.reserveForAdditional(t),this.layoutNormalArray.reserveForAdditional(t),this.layoutAOArray.reserveForAdditional(t),this.layoutColorArray.reserveForAdditional(t),this.indexArray.reserveForAdditional(e),r&&(this.layoutFacadePaintArray.reserveForAdditional(t),this.layoutFacadeDataArray.reserveForAdditional(t),this.layoutFacadeVerticalRangeArray.reserveForAdditional(t))}}class wg{constructor(t){this.colorBufferUploaded=!1,this.maxHeight=0,this.replacementUpdateTime=0,this.activeReplacements=[],this.footprints=[],this.footprintsVertices=new Kl,this.footprintsIndices=new Ql,this.footprintsMin=new $t(1/0,1/0),this.footprintsMax=new $t(-1/0,-1/0),this.featuresOnBorder=[],this.buildingWithoutFacade=new bg(!1),this.buildingWithFacade=new bg(!0),this.indexArrayForConflationUploaded=!1,this.featureFootprintLookup=new Map,this.buildingIds=new Set,this.footprintLookup={},this.zoom=t.zoom,this.canonical=t.canonical,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.fqid)),this.index=t.index,this.hasPattern=!1,this.worldview=t.worldview,this.lut=t.lut,this.programConfigurations=new Yu(t.layers,{zoom:t.zoom,lut:t.lut}),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.projection=t.projection,this.groundEffect=new Wf(t),this.groundEffect.groundRadiusArray=new Ml,this.hasAppearances=null}updateFootprints(t,e){const r=new rf([],[],1),n={vertices:[],indices:new Uint32Array(0),grid:r,min:this.footprintsMin,max:this.footprintsMax,buildingIds:this.buildingIds};e.push({footprint:n,id:t})}updateAppearances(t,e,r,n){}prepare(){return function(){if(null!=qm||null!=Gm)return null;if(null!=$m)return $m;const t=fetch(Xe.BUILDING_GEN_URL);return $m=function(t){let e,r,n,i,s;function a(){e=new Uint8Array(s.buffer),r=new Int16Array(s.buffer),n=new Int32Array(s.buffer),i=new Float32Array(s.buffer)}function o(){throw new Error("Unexpected BuildingGen error.")}const l=()=>{},u={a:{a:o,f:function(t){const r=e.length,n=Math.max(t>>>0,Math.ceil(1.2*r)),i=Math.ceil((n-r)/65536);try{return s.grow(i),a(),!0}catch(t){return!1}},g:o,b:l,c:l,d:l,e:l}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(t,u):t.then((t=>t.arrayBuffer())).then((t=>WebAssembly.instantiate(t,u)))).then((t=>{const o=t.instance.exports;return(0,o.g)(),s=o.f,a(),new Dm({setStyle:o.h,setAOOptions:o.i,setMetricOptions:o.j,setStructuralOptions:o.k,setFacadeOptions:o.l,setFauxFacadeOptions:o.m,setFacadeClassifierOptions:o.n,addFeature:o.o,addFacade:o.p,generateMesh:o.q,getLastError:o.r,getOuterRingLength:o.s,getMeshCount:o.t,getPositionsPtr:o.u,getPositionsLength:o.v,getNormalsPtr:o.w,getNormalsLength:o.x,getAOPtr:o.y,getAOLength:o.z,getUVPtr:o.A,getUVLength:o.B,getFauxFacadePtr:o.C,getFauxFacadeLength:o.D,getIndicesPtr:o.E,getIndicesLength:o.F,getBuildingPart:o.G,getRingCount:o.H,getRingPtr:o.I,getRingLength:o.J,malloc:o.K,free:o.L,heapU8:e,heap16:r,heap32:n,heapF32:i})}))}(t).then((t=>($m=null,qm=t,qm))).catch((t=>{Ae("Could not load building-gen"),$m=null,Gm=t})),$m}()}populate(t,e,r,n){const i=Ym();if(!i)return;const s=Tc(r);this.tileToMeter=s,this.brightness=e.brightness,i.setStyle({normalScale:[1,-1,s],tileToMeters:s}),i.setAOOptions(!1,.3),i.setMetricOptions(!1,16),i.setStructuralOptions(!0),i.setFacadeClassifierOptions(3);const a=new Map,o=new Map;let l=0;for(const{feature:e}of t){if("LineString"!==fg[e.type]){a.set(e.id,e.properties.source_id);continue}const t=this.layers[0]._featureFilter.needGeometry;if(t&&!this.layers[0]._featureFilter.filter(new Po(this.zoom),e,r))continue;const i=Nc(e,t);if(!t&&!this.layers[0]._featureFilter.filter(new Po(this.zoom),i,r))continue;const s=t?i.geometry:Uc(e,r,n),u=[];for(const t of s)for(const e of t)u.push(e.x),u.push(e.y);const c={coordinates:u,crossPerc:e.properties.cross_perc,distanceToRoad:e.properties.distance_to_road,entrances:e.properties.entrances,sourceId:0},h=e.properties.source_id;let p=o.get(h);p||(p=[],o.set(h,p)),p.push(c),++l}this.maxHeight=0;const u=new Array,c=new Set,h=t=>{null!=t&&c.add(t)},p=(t,e)=>{null!=t&&u.push({buildingId:t,footprintIndex:e})},d=64*(t.length-l),f=d/2;this.buildingWithFacade.reserve(d,f,!0),this.buildingWithoutFacade.reserve(2*d,2*f,!1),this.footprintsIndices.reserve(16*(t.length-l)),this.footprintsVertices.reserve(8*(t.length-l));for(const{feature:l,id:u,index:d,sourceLayerIndex:f}of t){if("LineString"===fg[l.type])continue;const t=this.layers[0]._featureFilter.needGeometry;if(t&&!this.layers[0]._featureFilter.filter(new Po(this.zoom),l,r))continue;let m=null;if(l.properties&&l.properties.hasOwnProperty("building_id")&&(m=l.properties.building_id,c.has(m)))continue;const y=Nc(l,t);if(!t&&!this.layers[0]._featureFilter.filter(new Po(this.zoom),y,r))continue;const g=t?y.geometry:Uc(l,r,n),x=Vd(g,500);let v=!1;for(const t of x)if(1!==t.length){v=!0;break}if(v){h(m);continue}if(!gg(g,163)){h(m);continue}const b=this.layers[0],w=xg(b.layout.get("building-roof-shape").evaluate(l,{},r)),_=b.layout.get("building-base").evaluate(l,{},r),A=b.layout.get("building-height").evaluate(l,{},r),I=b.layout.get("building-flood-light-ground-radius").evaluate(l,{},r),M=b.paint.get("building-ambient-occlusion-intensity"),S=I/this.tileToMeter;l.properties["building-part"]="roof";const P=b.paint.get("building-color").evaluate(l,{},this.canonical).toPremultipliedRenderColor(this.lut),k=b.paint.get("building-emissive-strength").evaluate(l,{},this.canonical);l.properties["building-part"]="wall";const B=b.paint.get("building-color").evaluate(l,{},this.canonical).toPremultipliedRenderColor(this.lut),z=b.paint.get("building-emissive-strength").evaluate(l,{},this.canonical);l.properties["building-part"]="window";const T=b.paint.get("building-color").evaluate(l,{},this.canonical).toPremultipliedRenderColor(this.lut),E=b.paint.get("building-emissive-strength").evaluate(l,{},this.canonical);l.properties["building-part"]="door";const V=b.paint.get("building-color").evaluate(l,{},this.canonical).toPremultipliedRenderColor(this.lut),F=b.paint.get("building-emissive-strength").evaluate(l,{},this.canonical);let C=b.layout.get("building-flood-light-wall-radius").evaluate(l,{},r);C=ie(C,0,2048);const D=C/2048*yg,R=a.get(u),L=o.get(R)||[],O=0!==L.length&&b.layout.get("building-facade").evaluate(l,{},r);i.setFacadeOptions(4,!0),i.setFauxFacadeOptions(O,!1,1);let U=0,N=0,j=0,$=0,G=0,q=0,H=0,X=0,Z=0,W=0,Y=0;if(O){let t=Math.round(b.layout.get("building-facade-floors").evaluate(l,{},r));if(0===_){t=Math.max(1,t-(L.length>0?1:0));let e=4;if(A>100){const t=[10,13,15];e=t[l.id?l.id%t.length:0]}else A<=10&&(e=3);i.setFacadeOptions(e,!0),G=(A<15?1.3:1.61803)*e/s}else G=_/s;q=A/s,G=Math.min(G,q),j=b.layout.get("building-facade-unit-width").evaluate(l,{},r)/s,$=(q-G)/t,i.setFauxFacadeOptions(!0,!0,j);const e=b.layout.get("building-facade-window").evaluate(l,{},r);U=e[0],N=e[1],H=Math.floor(65535*Math.min(1,G/Ui)),X=Math.floor(65535*Math.min(1,q/Ui)),Z=Math.floor(255*U)<<8|Math.floor(255*N),W=Math.floor(65535*Math.min(1,j/Ui)),Y=Math.floor(65535*Math.min(1,$/Ui))}const K=Array(x.length),J={x:1/0,y:1/0},Q={x:-1/0,y:-1/0},tt={x:0,y:0};let et=0;for(let t=0;t<x.length;t++){const e=x[t];if(e.length>0){const r=[],n=Array(e.length+1);n[0]=0;for(let t=0;t<e.length;t++){const i=e[t];for(let t=0;t<i.length;t++){const e=i[i.length-t-1];J.x=Math.min(J.x,e.x),J.y=Math.min(J.y,e.y),Q.x=Math.max(Q.x,e.x),Q.y=Math.max(Q.y,e.y),tt.x+=e.x,tt.y+=e.y,et++,r.push(e.x),r.push(e.y)}n[t+1]=r.length}K[t]={id:l.id?l.id:0,height:A,minHeight:_,sourceId:0,roofType:w,coordinates:r,ringIndices:n}}}tt.x/=et||1,tt.y/=et||1;const rt=i.generateMesh(K,L);if("string"==typeof rt){Ae(`Unable to generate building ${l.id}: ${rt}`),h(m);continue}if(0===rt.meshes.length||0===rt.modifiedPolygonRings.length){h(m);continue}const nt=O?this.buildingWithFacade:this.buildingWithoutFacade;let it=0;for(const t of rt.meshes)it+=t.positions.length/3;const st=nt.segmentsBucket.prepareSegment(it,nt.layoutVertexArray,nt.indexArray),at=[];let ot=null,lt=0,ut=-1;const ct=nt.layoutVertexArray.length,ht=ct+it;nt.layoutVertexArray.resize(ht),nt.layoutCentroidArray.resize(ht),nt.layoutNormalArray.resize(ht),nt.layoutAOArray.resize(ht),nt.layoutColorArray.resize(ht),nt.layoutFloodLightDataArray.resize(ht),O&&(nt.layoutFacadePaintArray.resize(ht),nt.layoutFacadeDataArray.resize(ht),nt.layoutFacadeVerticalRangeArray.resize(ht));const pt=nt.indexArray.length;let dt=0,ft=ct;for(const t of rt.meshes){let e,r;if(1===t.buildingPart)e=P,r=k;else if(0===t.buildingPart)e=B,r=z;else if(2===t.buildingPart)e=T,r=E;else{if(3!==t.buildingPart)continue;e=V,r=F}if(r=ie(r,0,1),3===t.buildingPart){const e=new Array;for(let r=0;r<t.positions.length;r+=12){const n=t.positions[r+0],i=t.positions[r+1],s=t.positions[r+3],a=t.positions[r+4],o=t.positions[r+2],l=t.positions[r+8]-o,u=1,c=s-n,h=a-i,p=Math.hypot(c,h);e.push({pos:[n+.5*c,i+.5*h,o],normal:[h/p,-c/p,0],width:p,height:l,depth:u,points:[n,i,s,a]})}const r=nt.entranceBloom.segmentsBucket.prepareSegment(10*e.length,nt.entranceBloom.layoutVertexArray,nt.entranceBloom.indexArray),n=nt.entranceBloom.layoutVertexArray.length;lt=nt.entranceBloom.indexArray.length,ng(e,.5/this.tileToMeter,nt.entranceBloom.indexArray,nt.entranceBloom.layoutVertexArray,nt.entranceBloom.layoutAttenuationArray);const i=nt.entranceBloom.layoutVertexArray.length-n;ut=nt.entranceBloom.indexArray.length-lt;for(let t=0;t<i;t++)nt.entranceBloom.layoutColorArray.emplaceBack(255*V.r<<8|255*V.g,255*V.b<<8|51*F);r.vertexLength+=i,r.primitiveLength+=ut,ot={part:t.buildingPart,vertexOffset:n,vertexLength:i}}nt.layoutVertexArray.float32.set(t.positions,3*ft);const n=t.positions.length/3;for(let i=0;i<n;++i){const n=3*i;dt=Math.max(dt,t.positions[n+2]);const s=t.normals[n+1]*yg,a=t.normals[n+2]*yg,o=3*(ft+i);nt.layoutNormalArray.int16[o]=t.normals[n]*yg,nt.layoutNormalArray.int16[o+1]=s,nt.layoutNormalArray.int16[o+2]=a;const l=t.ao[i];nt.layoutAOArray.uint8[ft+i]=255*l;const u=1+(l-1)*M,c=255*e.b*u<<8|255*r;nt.layoutColorArray.uint16[2*(ft+i)]=255*e.r*u<<8|255*e.g*u,nt.layoutColorArray.uint16[2*(ft+i)+1]=c}const i=Math.floor(tt.x),s=Math.floor(tt.y),a=Math.floor(A);for(let t=0;t<n;++t){const e=3*(ft+t);nt.layoutCentroidArray.int16[e]=i,nt.layoutCentroidArray.int16[e+1]=s,nt.layoutCentroidArray.int16[e+2]=a}if(nt.layoutFloodLightDataArray.uint16.fill(0===t.buildingPart?D:0,ft,ft+n),O){const e=255*T.r<<8|255*T.g,r=255*T.b<<8|255*E;for(let t=0;t<n;++t){const n=2*(ft+t);nt.layoutFacadePaintArray.uint16[n]=e,nt.layoutFacadePaintArray.uint16[n+1]=r}for(let e=0;e<n;++e)if(t.isFauxFacade[e]){const r=Math.min(65535,Math.floor(t.uv[2*e]*rt.outerRingLength));nt.layoutFacadeDataArray.emplace(ft+e,1|r,Z,W,Y),nt.layoutFacadeVerticalRangeArray.emplace(ft+e,H,X)}else nt.layoutFacadeDataArray.emplace(ft+e,0,0,0,0),nt.layoutFacadeVerticalRangeArray.emplace(ft+e,0,0)}const o=st.vertexLength,l=t.indices.length/3,u=nt.indexArray.length;nt.indexArray.resize(u+l);for(let e=0;e<l;++e){const r=3*e,n=3*u+r;nt.indexArray.uint16[n]=o+t.indices[r],nt.indexArray.uint16[n+1]=o+t.indices[r+1],nt.indexArray.uint16[n+2]=o+t.indices[r+2]}1!==t.buildingPart&&0!==t.buildingPart&&2!==t.buildingPart&&3!==t.buildingPart||at.push({part:t.buildingPart,vertexOffset:ft,vertexLength:t.positions.length/3}),ft+=n,st.vertexLength+=n,st.primitiveLength+=t.indices.length/3}this.maxHeight=Math.max(this.maxHeight,dt);const mt=nt.indexArray.length-pt,yt=this.footprintsIndices.length,gt=this.footprintsVertices.length,xt=[],vt=new $t(1/0,1/0),bt=new $t(-1/0,-1/0),wt=this.groundEffect.vertexArray.length;for(const t of rt.modifiedPolygonRings){const e=[],r=new $t(1/0,1/0),n=new $t(-1/0,-1/0);for(let i=0;i<t.length;i+=2){const s=t.length-i-2;r.x=Math.min(r.x,t[s]),r.y=Math.min(r.y,t[s+1]),n.x=Math.max(n.x,t[s]),n.y=Math.max(n.y,t[s+1]);const a=new $t(t[s],t[s+1]);e.push(a),xt.push(a.x,a.y),this.footprintsVertices.emplaceBack(a.x,a.y)}vt.x=Math.min(vt.x,r.x),vt.y=Math.min(vt.y,r.y),bt.x=Math.max(bt.x,n.x),bt.y=Math.max(bt.y,n.y),this.groundEffect.addData(e,[r,n],S)}const _t=this.groundEffect.vertexArray.length-wt;this.groundEffect.groundRadiusArray.reserveForAdditional(_t);for(let t=0;t<_t;t++)this.groundEffect.groundRadiusArray.emplaceBack(I);(J.x<0||Q.x>Ui||J.y<0||Q.y>Ui)&&this.featuresOnBorder.push({featureId:l.id,footprintIndex:this.footprints.length});{const t=od(xt,null,2);this.footprintsIndices.resize(this.footprintsIndices.length+t.length),this.footprintsIndices.uint16.set(t,yt),this.buildingIds.add(null!=m?m:l.id),this.footprintsMin.x=Math.min(this.footprintsMin.x,vt.x),this.footprintsMin.y=Math.min(this.footprintsMin.y,vt.y),this.footprintsMax.x=Math.max(this.footprintsMax.x,bt.x),this.footprintsMax.y=Math.max(this.footprintsMax.y,bt.y);const e={footprintVertexOffset:gt,footprintVertexLength:this.footprintsVertices.length-gt,footprintIndexOffset:yt,footprintIndexLength:this.footprintsIndices.length-yt,min:vt,max:bt,hiddenFlags:0,indicesOffset:pt,indicesLength:mt,bloomIndicesOffset:lt,bloomIndicesLength:ut,groundEffectVertexOffset:wt,groundEffectVertexLength:_t,hasFauxFacade:O,height:dt,promoteId:u,feature:y,parts:at,buildingBloom:ot},r=this.footprints.length;void 0!==l.id&&this.featureFootprintLookup.set(l.id,r),p(m,r),this.footprints.push(e)}this.programConfigurations.populatePaintArrays(nt.layoutVertexArray.length,l,d,{},e.availableImages,r,e.brightness),this.groundEffect.addPaintPropertiesData(l,d,{},e.availableImages,r,e.brightness),e.featureIndex.insert(l,g,d,f,this.index,ct)}u.forEach((({buildingId:t,footprintIndex:e})=>{c.has(t)&&(this.footprints[e].hiddenFlags|=4)}));const m=new Set;this.buildingIds.forEach(((t,e,r)=>{c.has(t)||m.add(t)})),this.buildingIds=m,this.groundEffect.prepareBorderSegments()}update(t,e,r,n,i,s,a){this.programConfigurations.updatePaintArrays(t,e,i,r,n,s,a),this.groundEffect.update(t,e,i,r,n,s,a),this.evaluate(this.layers[0],t),this.colorBufferUploaded=!1}isEmpty(){return 0===this.buildingWithoutFacade.layoutVertexArray.length&&0===this.buildingWithFacade.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(t){const e=e=>{e.layoutVertexBuffer=t.createVertexBuffer(e.layoutVertexArray,sg.members),e.layoutNormalBuffer=t.createVertexBuffer(e.layoutNormalArray,ag.members),e.layoutCentroidBuffer=t.createVertexBuffer(e.layoutCentroidArray,og.members),e.layoutFloodLightDataBuffer=t.createVertexBuffer(e.layoutFloodLightDataArray,dg.members),e.layoutFacadeDataArray&&e.layoutFacadeDataArray.length&&(e.layoutFacadeDataBuffer=t.createVertexBuffer(e.layoutFacadeDataArray,cg.members)),e.layoutFacadeVerticalRangeArray&&e.layoutFacadeVerticalRangeArray.length&&(e.layoutFacadeVerticalRangeBuffer=t.createVertexBuffer(e.layoutFacadeVerticalRangeArray,hg.members)),e.entranceBloom.layoutVertexArray.length&&(e.entranceBloom.layoutVertexBuffer=t.createVertexBuffer(e.entranceBloom.layoutVertexArray,sg.members),e.entranceBloom.layoutAttenuationBuffer=t.createVertexBuffer(e.entranceBloom.layoutAttenuationArray,pg.members)),this.uploadUpdatedColorBuffer(t),this.uploadUpdatedIndexBuffer(t)};this.uploaded||(e(this.buildingWithoutFacade),e(this.buildingWithFacade),this.groundEffect.upload(t)),this.groundEffect.uploadPaintProperties(t),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){const t=t=>{t.layoutVertexBuffer&&(t.layoutVertexBuffer.destroy(),t.layoutNormalBuffer.destroy(),t.layoutColorBuffer.destroy(),t.segmentsBucket.destroy(),t.indexBuffer&&t.indexBuffer.destroy(),t.entranceBloom.layoutVertexBuffer&&(t.entranceBloom.layoutVertexBuffer.destroy(),t.entranceBloom.layoutColorBuffer.destroy(),t.entranceBloom.layoutAttenuationBuffer.destroy(),t.entranceBloom.indexBuffer.destroy(),t.entranceBloom.segmentsBucket.destroy()))};t(this.buildingWithoutFacade),t(this.buildingWithFacade),this.groundEffect.destroy(),this.programConfigurations.destroy()}updateFootprintHiddenFlags(t,e,r=!0){let n=!1;const i=r?e:0,s=0|(r?-1:~e);0===this.groundEffect.hiddenByLandmarkVertexArray.length&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const e of t){const t=this.footprints[e],r=t.hiddenFlags&s|i;t.hiddenFlags!==r&&(t.hiddenFlags=r,n=!0,this.groundEffect.updateHiddenByLandmarkRange(t.groundEffectVertexOffset,t.groundEffectVertexLength,0!==t.hiddenFlags))}return n&&(this.indexArrayForConflationUploaded=!1),n}uploadUpdatedIndexBuffer(t){if(this.groundEffect.uploadHiddenByLandmark(t),this.indexArrayForConflationUploaded)return;const e=t=>{0!==t.indexArray.length&&(t.indexArrayForConflation.resize(t.indexArray.length),t.indexArrayForConflation.uint16.set(t.indexArray.uint16),t.entranceBloom.indexArrayForConflation.resize(t.entranceBloom.indexArray.length),t.entranceBloom.indexArrayForConflation.uint16.set(t.entranceBloom.indexArray.uint16))};e(this.buildingWithoutFacade),e(this.buildingWithFacade);for(const t of this.footprints){const e=t.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade,r=t.indicesOffset+t.indicesLength;if(0!==t.hiddenFlags){for(let n=t.indicesOffset;n<r;n++)e.indexArrayForConflation.uint16[3*n+0]=0,e.indexArrayForConflation.uint16[3*n+1]=0,e.indexArrayForConflation.uint16[3*n+2]=0;const n=t.bloomIndicesOffset+t.bloomIndicesLength;for(let r=t.bloomIndicesOffset;r<n;r++)e.entranceBloom.indexArrayForConflation.uint16[3*r+0]=0,e.entranceBloom.indexArrayForConflation.uint16[3*r+1]=0,e.entranceBloom.indexArrayForConflation.uint16[3*r+2]=0}}const r=e=>{0!==e.indexArray.length&&(e.indexBuffer?e.indexBuffer.updateData(e.indexArrayForConflation):e.indexBuffer=t.createIndexBuffer(e.indexArrayForConflation,!0),e.entranceBloom.indexBuffer?e.entranceBloom.indexBuffer.updateData(e.entranceBloom.indexArrayForConflation):e.entranceBloom.indexBuffer=t.createIndexBuffer(e.entranceBloom.indexArrayForConflation,!0))};r(this.buildingWithoutFacade),r(this.buildingWithFacade),this.indexArrayForConflationUploaded=!0}uploadUpdatedColorBuffer(t){const e=e=>{e.layoutColorBuffer?e.layoutColorBuffer.updateData(e.layoutColorArray):e.layoutColorBuffer=t.createVertexBuffer(e.layoutColorArray,lg.members,!0),e.layoutFacadePaintArray&&(e.layoutFacadePaintBuffer?e.layoutFacadePaintBuffer.updateData(e.layoutFacadePaintArray):e.layoutFacadePaintBuffer=t.createVertexBuffer(e.layoutFacadePaintArray,ug.members,!0)),e.entranceBloom.layoutColorBuffer?e.entranceBloom.layoutColorBuffer.updateData(e.entranceBloom.layoutColorArray):e.entranceBloom.layoutColorBuffer=t.createVertexBuffer(e.entranceBloom.layoutColorArray,lg.members,!0)};e(this.buildingWithoutFacade),e(this.buildingWithFacade),this.colorBufferUploaded=!0}evaluate(t,e){const r=t.paint.get("building-ambient-occlusion-intensity");for(const n of this.footprints){if(4&n.hiddenFlags)continue;const i=e[n.promoteId],s=n.feature;s.properties["building-part"]="roof";const a=t.paint.get("building-color").evaluate(s,i,this.canonical).toPremultipliedRenderColor(this.lut),o=t.paint.get("building-emissive-strength").evaluate(s,i,this.canonical);s.properties["building-part"]="wall";const l=t.paint.get("building-color").evaluate(s,i,this.canonical).toPremultipliedRenderColor(this.lut),u=t.paint.get("building-emissive-strength").evaluate(s,i,this.canonical);s.properties["building-part"]="window";const c=t.paint.get("building-color").evaluate(s,i,this.canonical).toPremultipliedRenderColor(this.lut),h=t.paint.get("building-emissive-strength").evaluate(s,i,this.canonical);s.properties["building-part"]="door";const p=t.paint.get("building-color").evaluate(s,i,this.canonical).toPremultipliedRenderColor(this.lut),d=t.paint.get("building-emissive-strength").evaluate(s,i,this.canonical),f=n.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade;for(const t of n.parts){let e,i=a;1===t.part?(i=a,e=o):0===t.part?(i=l,e=u):2===t.part?(i=c,e=h):3===t.part&&(i=p,e=d),e=ie(e,0,1);for(let s=0;s<t.vertexLength;s++){const a=t.vertexOffset+s,o=1+(f.layoutAOArray.uint8[a]/255-1)*r;f.layoutColorArray.emplace(a,i.r*o*255<<8|i.g*o*255,i.b*o*255<<8|255*e),n.hasFauxFacade&&f.layoutFacadePaintArray.emplace(a,255*c.r<<8|255*c.g,255*c.b<<8|255*h)}}const m=n.buildingBloom;if(m)for(let t=0;t<m.vertexLength;t++)f.entranceBloom.layoutColorArray.emplace(m.vertexOffset+t,255*p.r<<8|255*p.g,255*p.b<<8|51*d)}}needsEvaluation(){return!this.colorBufferUploaded}updateReplacement(t,e,r){if(e.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=e.updateTime;const n=e.getReplacementRegionsForTile(t.toUnwrapped());if(wf(this.activeReplacements,n))return;this.activeReplacements=n;for(const t of this.footprints)t.hiddenFlags&=-2;const i=[];for(const e of this.activeReplacements){if(e.order<=mf)continue;const r=Math.max(1,Math.pow(2,e.footprintTileId.canonical.z-t.canonical.z));for(const n of this.footprints)n.min.x>e.max.x||n.max.x<e.min.x||n.min.y>e.max.y||n.max.y<e.min.y||(i.length=0,Ag(this.footprintsVertices,n.footprintVertexOffset,n.footprintVertexLength,e.footprintTileId.canonical,t.canonical,i),If(e.footprint,i,this.footprintsIndices.uint16,n.footprintIndexOffset,n.footprintIndexLength,0,-r)&&(n.hiddenFlags|=1))}0===this.groundEffect.hiddenByLandmarkVertexArray.length&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const t of this.footprints)this.groundEffect.updateHiddenByLandmarkRange(t.groundEffectVertexOffset,t.groundEffectVertexLength,0!==t.hiddenFlags);this.indexArrayForConflationUploaded=!1}getFootprint(t){if(void 0!==t.id){const e=this.featureFootprintLookup.get(t.id);return this.footprints[e]}return null}getHeightAtTileCoord(t,e){let r=Number.NEGATIVE_INFINITY,n=!0;const i=4*(t+Ui)*Ui+(e+Ui);if(this.footprintLookup.hasOwnProperty(i)){const t=this.footprintLookup[i];return t?{height:t.height,hidden:0!==t.hiddenFlags}:void 0}const s=new $t(t,e);for(const a of this.footprints)t>a.max.x||a.min.x>t||e>a.max.y||a.min.y>e||a.height<=r||_g(s,this.footprintsVertices.float32.subarray(2*a.footprintVertexOffset,2*(a.footprintVertexOffset+a.footprintVertexLength)),this.footprintsIndices.uint16.subarray(a.footprintIndexOffset,a.footprintIndexOffset+a.footprintIndexLength))&&(r=a.height,this.footprintLookup[i]=a,n=0!==a.hiddenFlags);if(r!==Number.NEGATIVE_INFINITY)return{height:r,hidden:n};this.footprintLookup[i]=void 0}}function _g(t,e,r){for(let n=0;n<r.length;n+=3){const i=r[n],s=r[n+1],a=r[n+2],o=e[2*i+0],l=e[2*i+1],u=e[2*s+0],c=e[2*s+1],h=e[2*a+0],p=e[2*a+1],d=(o-h)*(t.y-p)-(l-p)*(t.x-h),f=(u-o)*(t.y-l)-(c-l)*(t.x-o);if(d<0!=f<0&&0!==d&&0!==f)continue;const m=(h-u)*(t.y-c)-(p-c)*(t.x-u);if(0===m||m<0==d+f<=0)return!0}return!1}function Ag(t,e,r,n,i,s){const a=Math.pow(2,n.z-i.z);for(let o=0;o<r;o++){let r=t.float32[2*(o+e)+0],l=t.float32[2*(o+e)+1];r=(r+i.x*Ui)*a-n.x*Ui,l=(l+i.y*Ui)*a-n.y*Ui,s.push(new $t(r,l))}}let Ig,Mg;Qa(wg,"BuildingBucket",{omit:["layers"]}),Qa(bg,"BuildingGeometry"),Qa(vg,"BuildingBloomGeometry");const Sg=bl([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"}],4),Pg=bl([{name:"a_z_offset_width",components:3,type:"Float32"}],4),{members:kg}=Sg,Bg=bl([{name:"a_packed",components:3,type:"Float32"}]),{members:zg}=Bg,Tg=bl([{name:"a_pattern_data",components:3,type:"Float32"}]),{members:Eg}=Tg;class Vg{constructor(t,e){this.width=t,this.height=e,this.nextRow=0,this.image=new Qp({width:t,height:e}),this.positions={},this.uploaded=!1}getDash(t,e){const r=this.getKey(t,e);return this.positions[r]}trim(){const t=this.width,e=this.height=de(this.nextRow);this.image.resize({width:t,height:e})}getKey(t,e){return t.join(",")+e}getDashRanges(t,e,r){const n=[];let i=t.length%2==1?-t[t.length-1]*r:0,s=t[0]*r,a=!0;n.push({left:i,right:s,isDash:a,zeroLength:0===t[0]});let o=t[0];for(let e=1;e<t.length;e++){a=!a;const l=t[e];i=o*r,o+=l,s=o*r,n.push({left:i,right:s,isDash:a,zeroLength:0===l})}return n}addRoundDash(t,e,r){const n=e/2;for(let e=-r;e<=r;e++){const i=this.width*(this.nextRow+r+e);let s=0,a=t[s];for(let o=0;o<this.width;o++){o/a.right>1&&(a=t[++s]);const l=Math.abs(o-a.left),u=Math.abs(o-a.right),c=Math.min(l,u);let h;const p=e/r*(n+1);if(a.isDash){const t=n-Math.abs(p);h=Math.sqrt(c*c+t*t)}else h=n-Math.sqrt(c*c+p*p);this.image.data[i+o]=Math.max(0,Math.min(255,h+128))}}}addRegularDash(t,e){for(let e=t.length-1;e>=0;--e){const r=t[e],n=t[e+1];r.zeroLength?t.splice(e,1):n&&n.isDash===r.isDash&&(n.left=r.left,t.splice(e,1))}const r=t[0],n=t[t.length-1];r.isDash===n.isDash&&(r.left=n.left-this.width,n.right=r.right+this.width);const i=this.width*this.nextRow;let s=0,a=t[s];for(let r=0;r<this.width;r++){r/a.right>1&&(a=t[++s]);const n=Math.abs(r-a.left),o=Math.abs(r-a.right),l=Math.min(n,o);this.image.data[i+r]=Math.max(0,Math.min(255,(a.isDash?l:-l)+e+128))}}addDash(t,e){const r=this.getKey(t,e);if(this.positions[r])return this.positions[r];const n="round"===e,i=n?7:0,s=2*i+1;if(this.nextRow+s>this.height)return Ae("LineAtlas out of space"),null;0===t.length&&t.push(1);let a=0;for(let e=0;e<t.length;e++)t[e]<0&&(Ae("Negative value is found in line dasharray, replacing values with 0"),t[e]=0),a+=t[e];if(0!==a){const r=this.width/a,s=this.getDashRanges(t,this.width,r);n?this.addRoundDash(s,r,i):this.addRegularDash(s,"square"===e?.5*r:0)}const o=this.nextRow+i;this.nextRow+=s;const l={tl:[o,i],br:[a,0]};return this.positions[r]=l,l}}Qa(Vg,"LineAtlas");const Fg=jc.types,Cg=Math.cos(Math.PI/180*37.5),Dg=Math.cos(Math.PI/180*5);class Rg{constructor(t){this.evaluationGlobals={zoom:0,lineProgress:void 0},this.elevationType="none",this.zoom=t.zoom,this.evaluationGlobals.zoom=this.zoom,this.overscaling=t.overscaling,this.pixelRatio=t.pixelRatio,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.fqid)),this.index=t.index,this.projection=t.projection,this.hasPattern=!1,this.hasCrossSlope=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((t=>{this.gradients[t.id]={}})),this.layoutVertexArray=new Bl,this.layoutVertexArray2=new zl,this.patternVertexArray=new zl,this.indexArray=new $l,this.programConfigurations=new Yu(t.layers,{zoom:t.zoom,lut:t.lut}),this.segments=new bu,this.maxLineLength=0,this.zOffsetVertexArray=new zl,this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.tessellationStep=t.tessellationStep?t.tessellationStep:Ui/64,this.worldview=t.worldview,this.hasAppearances=null}updateFootprints(t,e){}updateAppearances(t,e,r,n){}populate(t,e,r,n){this.hasPattern=Dd("line",this.layers,this.pixelRatio,e);const i=this.layers[0].layout.get("line-sort-key");this.tileToMeter=Tc(r);const s=this.layers[0].layout.get("line-elevation-reference");if("hd-road-markup"===s)this.elevationType="road";else{const t=this.layers[0].layout.get("line-z-offset"),e=t.isConstant()&&!t.constantOr(0);this.elevationType="sea"!==s&&"ground"!==s&&e?"none":"offset","offset"===this.elevationType&&"none"===s&&Ae(`line-elevation-reference: ground is used for the layer ${this.layerIds[0]} because non-zero line-z-offset value was found.`)}const a=this.layers[0].layout.get("line-cross-slope");this.hasCrossSlope="offset"===this.elevationType&&void 0!==a;const o=[];for(const{feature:s,id:a,index:l,sourceLayerIndex:u}of t){const t=this.layers[0]._featureFilter.needGeometry,c=Nc(s,t);if(!this.layers[0]._featureFilter.filter(new Po(this.zoom,{worldview:this.worldview,activeFloors:e.activeFloors}),c,r))continue;const h=i?i.evaluate(c,{},r):void 0,p={id:a,properties:s.properties,type:s.type,sourceLayerIndex:u,index:l,geometry:t?c.geometry:Uc(s,r,n),patterns:{},sortKey:h};o.push(p)}i&&o.sort(((t,e)=>t.sortKey-e.sortKey));const{lineAtlas:l,featureIndex:u}=e,c=this.addConstantDashes(l);for(const n of o){const{geometry:i,index:s,sourceLayerIndex:a}=n;if(c&&this.addFeatureDashes(n,l),this.hasPattern){const t=Rd("line",this.layers,n,this.zoom,this.pixelRatio,e);this.patternFeatures.push(t)}else this.addFeature(n,i,s,r,l.positions,e.availableImages,e.brightness,e.elevationFeatures);u.insert(t[s].feature,i,s,a,this.index)}}addConstantDashes(t){let e=!1;for(const r of this.layers){const n=r.paint.get("line-dasharray").value,i=r.layout.get("line-cap").value;if("constant"!==n.kind||"constant"!==i.kind)e=!0;else{const e=i.value,r=n.value;if(!r)continue;t.addDash(r,e)}}return e}addFeatureDashes(t,e){const r=this.zoom;for(const n of this.layers){const i=n.paint.get("line-dasharray").value,s=n.layout.get("line-cap").value;if("constant"===i.kind&&"constant"===s.kind)continue;let a,o;if("constant"===i.kind){if(a=i.value,!a)continue}else a=i.evaluate({zoom:r},t);o="constant"===s.kind?s.value:s.evaluate({zoom:r},t),e.addDash(a,o),t.patterns[n.id]=[e.getKey(a,o)]}}update(t,e,r,n,i,s,a,o){this.programConfigurations.updatePaintArrays(t,e,i,r,n,s,a,o)}addFeatures(t,e,r,n,i,s){for(const i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,e,r,n,s,t.elevationFeatures)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,zg)),0!==this.patternVertexArray.length&&(this.patternVertexBuffer=t.createVertexBuffer(this.patternVertexArray,Eg)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=t.createVertexBuffer(this.zOffsetVertexArray,Pg.members,!0)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,kg),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t,e){let r,n;if(e&&e>0?(r=`mapbox_clip_start_${e}`,n=`mapbox_clip_end_${e}`):(r="mapbox_clip_start",n="mapbox_clip_end"),t.properties&&t.properties.hasOwnProperty(r)&&t.properties.hasOwnProperty(n))return{start:+t.properties[r],end:+t.properties[n]}}addFeature(t,e,r,n,i,s,a,o){const l=this.layers[0].layout,u=l.get("line-join").evaluate(t,{}),c=l.get("line-cap").evaluate(t,{}),h=l.get("line-miter-limit"),p=l.get("line-round-limit");this.lineClips=this.lineFeatureClips(t),this.lineFeature=t;const d=!(!t.properties||!t.properties.hasOwnProperty("mapbox_line_metrics"))&&t.properties.mapbox_line_metrics;this.zOffsetValue=l.get("line-z-offset").value;const f=this.layers[0].paint.get("line-width").value;if("constant"!==f.kind&&!1===f.isLineProgressConstant&&(this.variableWidthValue=f),"road"===this.elevationType){const r=this.layoutVertexArray.length;if(!this.addElevatedRoadFeature(t,e,n,o,u,c,h,p)){const[i,s]=this.clipRuntimeLinesToTile(e,1);for(let e=0;e<i.length;e++){const r=i[e],a=s[e],o={progress:{min:a.progress.min,max:a.progress.max},nextDir:this.computeSegNextDir(a,r),prevDir:this.computeSegPrevDir(a,r)};this.addLine(r,t,n,u,c,h,p,o,d&&a.parentIndex>0?a.parentIndex:null)}this.fillNonElevatedRoadSegment(r)}}else for(let r=0;r<e.length;r++)this.addLine(e[r],t,n,u,c,h,p,void 0,d&&r>0?r:null);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,i,s,n,a,void 0,this.worldview)}computeSegNextDir(t,e){return t.nextPoint.sub(e.at(-2)).unit()}computeSegPrevDir(t,e){return e[1].sub(t.prevPoint).unit()}clipLinesToTile(t,e){return dm(t,-e,-e,Ui+e,Ui+e)}clipRuntimeLinesToTile(t,e){const r=[];return[dm(t,-e,-e,Ui+e,Ui+e,r),r]}addElevatedRoadFeature(t,e,r,n,i,s,a,o){const l=[],u=xh.getElevationFeature(t,n);if(u){const t=this.clipLinesToTile(e,1),n=this.prepareElevatedLines(t,u,r);for(const t of n)l.push({geometry:t,elevation:u,elevationTileID:r,segment:{progress:{min:0,max:1},nextDir:void 0,prevDir:void 0}})}if(0===l.length)return!1;for(const e of l){const n=this.layoutVertexArray.length;this.addLine(e.geometry,t,r,i,s,a,o);const l=new vh(r,e.elevationTileID);if(e.elevation)for(let t=n;t<this.layoutVertexArray.length;t++){const r=new $t(this.layoutVertexArray.int16[6*t]>>1,this.layoutVertexArray.int16[6*t+1]>>1),n=l.pointElevation(r,e.elevation,.05);this.updateHeightRange(n),this.zOffsetVertexArray.emplaceBack(n,0,0)}else this.fillNonElevatedRoadSegment(n)}return!0}prepareElevatedLines(t,e,r){if(null!=e.constantHeight)return t;const n=[],i=1/Tc(r);for(const r of t)fm(r,new yh(e,i),0,n);return n}fillNonElevatedRoadSegment(t){for(let e=t;e<this.layoutVertexArray.length;e++)this.zOffsetVertexArray.emplaceBack(0,0,0)}updateHeightRange(t){this.heightRange?(this.heightRange.min=Math.min(this.heightRange.min,t),this.heightRange.max=Math.max(this.heightRange.max,t)):this.heightRange={min:t,max:t}}addLine(t,e,r,n,i,s,a,o,l){this.distance=0,this.prevDistance=0,this.scaledDistance=0,this.totalDistance=0,this.totalFeatureLength=0,this.lineSoFar=0,this.currentVertex=void 0,this.lineClips=l?this.lineFeatureClips(e,l):this.lineClips;const u="none"===n;this.patternJoinNone=this.hasPattern&&u,this.segmentStart=0,this.segmentStartf32=0,this.segmentPoints=[];const c=o&&o.progress.min>0,h=o&&o.progress.max<1;if(this.lineClips){let r={min:this.lineClips.start,max:this.lineClips.end},n=1;if(o){const t=this.lineClips.end-this.lineClips.start;r=function(t,e,r){return{min:qe(t.min,e,r),max:qe(t.max,e,r)}}(o.progress,{min:0,max:1},r),t>0&&(n=(r.max-r.min)/t)}const i=+e.properties.mapbox_clip_feature_len,s=+e.properties.mapbox_clip_seg_len;if(Number.isNaN(i)||Number.isNaN(s)){for(let e=0;e<t.length-1;e++)this.totalDistance+=t[e].dist(t[e+1]);const e=this.totalDistance/(r.max-r.min);this.totalFeatureLength=Number.isFinite(e)?e:0,this.lineClips.start=r.min,this.lineClips.end=r.max,this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}else this.totalFeatureLength=i,this.distance=s*n,this.lineClips.start=r.min,this.lineClips.end=r.max,this.maxLineLength=Math.max(this.maxLineLength,this.distance);this.lineClipsArray.push(this.lineClips),this.updateScaledDistance()}const p="Polygon"===Fg[e.type];let d=t.length;for(;d>=2&&t[d-1].equals(t[d-2]);)d--;let f=0;for(;f<d-1&&t[f].equals(t[f+1]);)f++;if(d<(p?3:2))return;"bevel"===n&&(s=1.05);const m=this.segments.prepareSegment(10*d,this.layoutVertexArray,this.indexArray);let y,g,x,v,b,w,_,A;o&&o.prevDir&&(w=o.prevDir.perp()),o&&o.nextDir&&(_=o.nextDir.perp()),this.e1=this.e2=-1,p&&(y=t[d-2],b=t[f].sub(y)._unit()._perp());for(let e=f;e<d;e++){if(x=e===d-1?p?t[f+1]:void 0:t[e+1],x&&t[e].equals(x))continue;b&&(v=b),y&&(g=y),y=t[e],A=this.evaluateLineProgressFeatures(g?g.dist(y):0),b=x?x.sub(y)._unit()._perp():v,v=v||b;const r=g&&x;let o=r?n:p||u?"butt":i;const l=v.x*b.x+v.y*b.y;if(u){const t=function(t){if(t.patternJoinNone){const e=t.segmentPoints.length/2,r=t.lineSoFar-t.segmentStart;for(let n=0;n<e;++n){const e=t.segmentPoints[2*n+1],i=Math.round(t.segmentPoints[2*n])+.5+.25*e;t.patternVertexArray.emplaceBack(i,r,t.segmentStart),t.patternVertexArray.emplaceBack(i,r,t.segmentStart)}t.segmentPoints.length=0}t.e1=t.e2=-1};if(r&&l<Dg){this.updateDistance(g,y),this.addCurrentVertex(y,v,1,1,m,A),t(this),this.addCurrentVertex(y,b,-1,-1,m,A);continue}if(g){if(!x){this.updateDistance(g,y),this.addCurrentVertex(y,v,1,1,m,A),t(this);continue}o="miter"}}let I=v.add(b);0===I.x&&0===I.y||I._unit();const M=I.x*b.x+I.y*b.y,S=0!==M?1/M:1/0,P=2*Math.sqrt(2-2*M),k=M<Cg&&g&&x,B=v.x*b.y-v.y*b.x>0,z=this.overscaling<=16?15*Ui/(512*this.overscaling):0;if(r&&"round"===o)if(S<a)o="miter";else if(S<=2){const t=Lg(y,-10,Ui+10);o="offset"===this.elevationType&&(t||this.hasCrossSlope)?"miter":"fakeround"}if("miter"===o&&S>s&&(o="bevel"),"bevel"===o&&(S>2&&(o="flipbevel"),S<s&&(o="miter")),g&&!("miter"===o&&k)&&this.updateDistance(g,y),"miter"===o)if(k){const t=y.dist(g);if(t>2*z){const e=y.sub(y.sub(g)._mult(z/t)._round());this.updateDistance(g,e),this.addCurrentVertex(e,v,0,0,m,A),g=e}this.updateDistance(g,y),I._mult(S),this.addCurrentVertex(y,I,0,0,m,A);const e=y.dist(x);if(e>2*z){const t=y.add(x.sub(y)._mult(z/e)._round());this.updateDistance(y,t),this.addCurrentVertex(t,b,0,0,m,A),y=t}}else I._mult(S),this.addCurrentVertex(y,I,0,0,m,A);else if("flipbevel"===o){if(S>100)I=b.mult(-1);else{const t=S*v.add(b).mag()/v.sub(b).mag();I._perp()._mult(t*(B?-1:1))}this.addCurrentVertex(y,I,0,0,m,A),this.addCurrentVertex(y,I.mult(-1),0,0,m,A)}else if("bevel"===o||"fakeround"===o){null!=A&&g&&this.addCurrentVertex(y,_||v,-1,-1,m,A);const t=y.dist(g)<=2*z&&"bevel"!==o,e=I.mult(B?1:-1);e._mult(S);const r=b.mult(B?-1:1),n=v.mult(B?-1:1),i=this.evaluateLineProgressFeatures(this.distance);if(null==A&&(this.addHalfVertex(y,e.x,e.y,!1,!B,0,m,i),t||this.addHalfVertex(y,e.x+2*n.x,e.y+2*n.y,!1,B,0,m,i)),"fakeround"===o){const t=Math.round(180*P/Math.PI/20);this.addHalfVertex(y,n.x,n.y,!1,B,0,m,i);for(let e=0;e<t;e++){let s=e/t;if(.5!==s){const t=s-.5;s+=s*t*(s-1)*((1.0904+l*(l*(3.55645-1.43519*l)-3.2452))*t*t+(.848013+l*(.215638*l-1.06021)))}const a=r.sub(n)._mult(s)._add(n)._unit();this.addHalfVertex(y,a.x,a.y,!1,B,0,m,i)}this.addHalfVertex(y,r.x,r.y,!1,B,0,m,i)}t||null!=A||this.addHalfVertex(y,e.x+2*r.x,e.y+2*r.y,!1,B,0,m,i),null!=A&&x&&this.addCurrentVertex(y,w||b,1,1,m,A)}else if("butt"===o)this.addCurrentVertex(y,I,0,0,m,A);else if("square"===o){if(!g){const t=c?0:-1;this.addCurrentVertex(y,I,t,t,m,A)}if(this.addCurrentVertex(y,I,0,0,m,A),g){const t=h?0:1;this.addCurrentVertex(y,I,t,t,m,A)}}else if("round"===o){if(g){const t=!r&&_?_:v;this.addCurrentVertex(y,t,0,0,m,A),!r&&h||this.addCurrentVertex(y,t,1,1,m,A,!0)}if(x){const t=!r&&w?w:b;!r&&c||this.addCurrentVertex(y,t,-1,-1,m,A,!0),this.addCurrentVertex(y,t,0,0,m,A)}}}}addVerticesTo(t,e,r,n,i,s,a,o,l,u){const c=(e.w-t.w)/this.tessellationStep|0;let h=0;const p=this.scaledDistance;if(c>1){this.lineSoFar=t.w;const p=(e.x-t.x)/c,d=(e.y-t.y)/c,f=(e.z-t.z)/c,m=(e.w-t.w)/c;for(let e=1;e<c;++e){t.x+=p,t.y+=d,t.z+=f,this.lineSoFar+=m,h+=m;const e=this.evaluateLineProgressFeatures(this.prevDistance+h);this.scaledDistance=(this.prevDistance+h)/this.totalDistance,this.addHalfVertex(t,r,n,u,!1,a,l,e),this.addHalfVertex(t,i,s,u,!0,-o,l,e)}}this.lineSoFar=e.w,this.scaledDistance=p;const d=this.evaluateLineProgressFeatures(this.distance);this.addHalfVertex(e,r,n,u,!1,a,l,d),this.addHalfVertex(e,i,s,u,!0,-o,l,d)}evaluateLineProgressFeatures(t){if(!this.variableWidthValue&&"offset"!==this.elevationType)return null;this.evaluationGlobals.lineProgress=0,this.lineClips?this.evaluationGlobals.lineProgress=Math.min(1,(this.totalFeatureLength*this.lineClips.start+t)/this.totalFeatureLength):Ae(`line-progress evaluation for ${this.layerIds[0]} requires enabling 'lineMetrics' for the source.`);let e=0;return this.variableWidthValue&&"constant"!==this.variableWidthValue.kind&&(e=this.variableWidthValue.evaluate(this.evaluationGlobals,this.lineFeature)||0),"offset"!==this.elevationType?{zOffset:0,variableWidth:e}:"constant"===this.zOffsetValue.kind?{zOffset:this.zOffsetValue.value,variableWidth:e}:{zOffset:this.zOffsetValue.evaluate(this.evaluationGlobals,this.lineFeature)||0,variableWidth:e}}addCurrentVertex(t,e,r,n,i,s,a=!1){const o=e.x+e.y*r,l=e.y-e.x*r,u=e.y*n-e.x,c=-e.y-e.x*n;if(null!=s){const e="offset"===this.elevationType,h=-10,p=Ui+10,d=s.zOffset,f=new cm(t.x,t.y,d,this.lineSoFar),m=!!e&&Lg(t,h,p),y=this.lineSoFar,g=this.distance;if(this.currentVertex)if(m){const e=this.currentVertexIsOutside,s=this.currentVertex,m=new cm(t.x,t.y,d,this.lineSoFar);if(pm(s,m,h,p),!Lg(m,h,p)){if(e){this.e1=this.e2=-1,this.distance-=s.dist(f),this.lineSoFar=s.w;const t=this.evaluateLineProgressFeatures(s.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(s,o,l,a,!1,r,i,t),this.addHalfVertex(s,u,c,a,!0,-n,i,t),this.prevDistance=this.distance}this.distance=this.prevDistance+s.dist(m),this.scaledDistance=this.distance/this.totalDistance,this.addVerticesTo(s,m,o,l,u,c,r,n,i,a),this.distance=g,this.scaledDistance=this.distance/this.totalDistance}}else{const t=this.currentVertex;if(this.currentVertexIsOutside){pm(t,f,h,p),this.e1=this.e2=-1,this.distance-=t.dist(f),this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=t.w;const e=this.evaluateLineProgressFeatures(t.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(t,o,l,a,!1,r,i,e),this.addHalfVertex(t,u,c,a,!0,-n,i,e),this.prevDistance=this.distance,this.distance=g,this.scaledDistance=this.distance/this.totalDistance}this.addVerticesTo(t,f,o,l,u,c,r,n,i,a)}else m||(this.addHalfVertex(t,o,l,a,!1,r,i,s),this.addHalfVertex(t,u,c,a,!0,-n,i,s));this.currentVertex=f,this.currentVertexIsOutside=m,this.lineSoFar=y}else this.addHalfVertex(t,o,l,a,!1,r,i,s),this.addHalfVertex(t,u,c,a,!0,-n,i,s)}addHalfVertex({x:t,y:e},r,n,i,s,a,o,l){if(this.patternJoinNone&&(0===this.segmentPoints.length&&(this.segmentStart=this.lineSoFar,this.segmentStartf32=Math.fround(this.lineSoFar)),s||this.segmentPoints.push(this.lineSoFar-this.segmentStart,a)),this.layoutVertexArray.emplaceBack((t<<1)+(i?1:0),(e<<1)+(s?1:0),Math.round(63*r)+128,Math.round(63*n)+128,1+(0===a?0:a<0?-1:1),0,this.lineSoFar-this.segmentStartf32),this.lineClips){const t=dn(this.lineClips.start,this.lineClips.end,this.scaledDistance);this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,t)}const u=o.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,u),o.primitiveLength++),s?this.e2=u:this.e1=u,null!=l&&this.zOffsetVertexArray.emplaceBack(l.zOffset,l.variableWidth,l.variableWidth)}updateScaledDistance(){this.lineClips?(this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=this.totalFeatureLength*this.lineClips.start+this.distance):this.lineSoFar=this.distance}updateDistance(t,e){this.prevDistance=this.distance,this.distance+=t.dist(e),this.updateScaledDistance()}}function Lg(t,e,r){return t.x<e||t.x>r||t.y<e||t.y>r}let Og,Ug;function Ng(t,e,r){return e*(Ui/(t.tileSize*Math.pow(2,r-t.tileID.overscaledZ)))}function jg(t,e){const{scale:r}=t.tileTransform,n=r*Ui/(t.tileSize*Math.pow(2,e.zoom-t.tileID.overscaledZ+t.tileID.canonical.z));return function(t,e,r){var n=e[1],i=e[2],s=e[3],a=r[0],o=r[1];return t[0]=e[0]*a,t[1]=n*a,t[2]=i*o,t[3]=s*o,t}(new Float32Array(4),e.inverseAdjustmentMatrix,[n,n])}Qa(Rg,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});const $g=t=>({u_matrix:new Ru(t),u_pixels_to_tile_units:new Nu(t),u_device_pixel_ratio:new Tu(t),u_width_scale:new Tu(t),u_floor_width_scale:new Tu(t),u_units_to_pixels:new Eu(t),u_dash_image:new zu(t),u_gradient_image:new zu(t),u_image_height:new Tu(t),u_texsize:new Eu(t),u_tile_units_to_pixels:new Tu(t),u_alpha_discard_threshold:new Tu(t),u_trim_offset:new Eu(t),u_trim_fade_range:new Eu(t),u_trim_color:new Fu(t),u_zbias_factor:new Tu(t),u_tile_to_meter:new Tu(t),u_ground_shadow_factor:new Vu(t)}),Gg=t=>({u_matrix:new Ru(t),u_texsize:new Eu(t),u_pixels_to_tile_units:new Nu(t),u_device_pixel_ratio:new Tu(t),u_width_scale:new Tu(t),u_floor_width_scale:new Tu(t),u_image:new zu(t),u_units_to_pixels:new Eu(t),u_tile_units_to_pixels:new Tu(t),u_alpha_discard_threshold:new Tu(t),u_trim_offset:new Eu(t),u_trim_fade_range:new Eu(t),u_trim_color:new Fu(t),u_zbias_factor:new Tu(t),u_tile_to_meter:new Tu(t),u_ground_shadow_factor:new Vu(t),u_pattern_transition:new Tu(t)}),qg=(t,e,r)=>(1-r)*t+r*e,Hg=(t,e,r,n,i,s,a,o,l,u)=>{const c=t.transform,h=c.calculatePixelsToTileUnitsMatrix(e),p="none"===r.paint.get("line-trim-color-use-theme").constantOr("default"),d=c.pitch<15?qg(.07,.7,ie((14-c.zoom)/5,0,1)):.07;return{u_matrix:Wg(t,e,r,n),u_pixels_to_tile_units:h,u_device_pixel_ratio:s,u_width_scale:a,u_floor_width_scale:o,u_units_to_pixels:[1/c.pixelsToGLUnits[0],1/c.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:i,u_texsize:Kg(r)&&e.lineAtlasTexture?e.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:Zg(e,t.transform),u_alpha_discard_threshold:0,u_trim_offset:l,u_trim_fade_range:r.paint.get("line-trim-fade-range"),u_trim_color:r.paint.get("line-trim-color").toPremultipliedRenderColor(p?null:r.lut).toArray01(),u_zbias_factor:d,u_tile_to_meter:Tc(e.tileID.canonical,0),u_ground_shadow_factor:u}},Xg=(t,e,r,n,i,s,a,o,l,u)=>{const c=t.transform,h=c.pitch<15?qg(.07,.7,ie((14-c.zoom)/5,0,1)):.07,p="none"===r.paint.get("line-trim-color-use-theme").constantOr("default");return{u_matrix:Wg(t,e,r,n),u_texsize:e.imageAtlasTexture?e.imageAtlasTexture.size:[0,0],u_pixels_to_tile_units:c.calculatePixelsToTileUnitsMatrix(e),u_device_pixel_ratio:i,u_width_scale:s,u_floor_width_scale:a,u_image:0,u_tile_units_to_pixels:Zg(e,c),u_units_to_pixels:[1/c.pixelsToGLUnits[0],1/c.pixelsToGLUnits[1]],u_alpha_discard_threshold:0,u_trim_offset:o,u_trim_fade_range:r.paint.get("line-trim-fade-range"),u_trim_color:r.paint.get("line-trim-color").toPremultipliedRenderColor(p?null:r.lut).toArray01(),u_zbias_factor:h,u_tile_to_meter:Tc(e.tileID.canonical,0),u_ground_shadow_factor:l,u_pattern_transition:u}};function Zg(t,e){return 1/Ng(t,1,e.tileZoom)}function Wg(t,e,r,n){return t.translatePosMatrix(n||e.tileID.projMatrix,e,r.paint.get("line-translate"),r.paint.get("line-translate-anchor"))}const Yg=t=>{const e=[];Kg(t)&&e.push("RENDER_LINE_DASH"),t.paint.get("line-gradient")&&e.push("RENDER_LINE_GRADIENT");const r=t.paint.get("line-trim-offset");0===r[0]&&0===r[1]||e.push("RENDER_LINE_TRIM_OFFSET"),0!==t.paint.get("line-border-width").constantOr(1)&&e.push("RENDER_LINE_BORDER");const n="none"===t.layout.get("line-join").constantOr("miter"),i=!!t.paint.get("line-pattern").constantOr(1);return n&&i&&e.push("LINE_JOIN_NONE"),e};function Kg(t){const e=t.paint.get("line-dasharray").value;return"constant"!==e.kind||e.value}let Jg;const Qg=()=>Jg||(Jg={layout:Og||(Og=new No({"line-cap":new Ro(jo.layout_line["line-cap"]),"line-join":new Ro(jo.layout_line["line-join"]),"line-miter-limit":new Do(jo.layout_line["line-miter-limit"]),"line-round-limit":new Do(jo.layout_line["line-round-limit"]),"line-sort-key":new Ro(jo.layout_line["line-sort-key"]),"line-z-offset":new Ro(jo.layout_line["line-z-offset"]),"line-elevation-reference":new Do(jo.layout_line["line-elevation-reference"]),"line-cross-slope":new Do(jo.layout_line["line-cross-slope"]),visibility:new Do(jo.layout_line.visibility),"line-width-unit":new Do(jo.layout_line["line-width-unit"])})),paint:Ug||(Ug=new No({"line-opacity":new Ro(jo.paint_line["line-opacity"]),"line-color":new Ro(jo.paint_line["line-color"]),"line-translate":new Do(jo.paint_line["line-translate"]),"line-translate-anchor":new Do(jo.paint_line["line-translate-anchor"]),"line-width":new Ro(jo.paint_line["line-width"]),"line-gap-width":new Ro(jo.paint_line["line-gap-width"]),"line-offset":new Ro(jo.paint_line["line-offset"]),"line-blur":new Ro(jo.paint_line["line-blur"]),"line-dasharray":new Ro(jo.paint_line["line-dasharray"]),"line-pattern":new Ro(jo.paint_line["line-pattern"]),"line-pattern-cross-fade":new Do(jo.paint_line["line-pattern-cross-fade"]),"line-gradient":new Lo(jo.paint_line["line-gradient"]),"line-trim-offset":new Do(jo.paint_line["line-trim-offset"]),"line-trim-fade-range":new Do(jo.paint_line["line-trim-fade-range"]),"line-trim-color":new Do(jo.paint_line["line-trim-color"]),"line-emissive-strength":new Ro(jo.paint_line["line-emissive-strength"]),"line-border-width":new Ro(jo.paint_line["line-border-width"]),"line-border-color":new Ro(jo.paint_line["line-border-color"]),"line-occlusion-opacity":new Do(jo.paint_line["line-occlusion-opacity"]),"line-color-use-theme":new Ro({type:"string",default:"default","property-type":"data-driven"}),"line-gradient-use-theme":new Ro({type:"string",default:"default","property-type":"data-driven"}),"line-trim-color-use-theme":new Ro({type:"string",default:"default","property-type":"data-driven"}),"line-border-color-use-theme":new Ro({type:"string",default:"default","property-type":"data-driven"})}))},Jg);class tx extends Ro{possiblyEvaluate(t,e){return e=new Po(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,transition:e.transition,worldview:e.worldview}),super.possiblyEvaluate(t,e)}evaluate(t,e,r,n){return e=Object.assign({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(t,e,r,n)}}let ex;function rx(t,e){return e>0?e+2*t:t}const nx=bl([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),ix=bl([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),sx=bl([{name:"a_projected_pos",components:4,type:"Float32"}],4);bl([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const ax=bl([{name:"a_auto_z_offset",components:1,type:"Float32"}],4),ox=bl([{name:"a_x_axis",components:3,type:"Float32"},{name:"a_y_axis",components:3,type:"Float32"}]),lx=bl([{name:"a_texb",components:2,type:"Uint16"}]),ux=bl([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_elevation_from_sea",components:2,type:"Float32"}]),cx=bl([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_auto_z_offset",components:1,type:"Float32"}]);bl([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"tileAnchorX"},{type:"Int16",name:"tileAnchorY"},{type:"Float32",name:"x1"},{type:"Float32",name:"y1"},{type:"Float32",name:"x2"},{type:"Float32",name:"y2"},{type:"Int16",name:"padding"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const hx=bl([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),px=bl([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);bl([{name:"triangle",components:3,type:"Uint16"}]),bl([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{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:"Uint8",name:"flipState"}]),bl([{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{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",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Float32",name:"zOffset"},{type:"Uint8",name:"hasIconTextFit"},{type:"Uint16",name:"elevationFeatureIndex"}]),bl([{type:"Float32",name:"offsetX"}]),bl([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);const dx=24;function fx(t,e,r){return t.sections.forEach((t=>{t.text=function(t,e,r){const n=e.layout.get("text-transform").evaluate(r,{});return"uppercase"===n?t=t.toLocaleUpperCase():"lowercase"===n&&(t=t.toLocaleLowerCase()),Mo.applyArabicShaping&&(t=Mo.applyArabicShaping(t)),t}(t.text,e,r)})),t}const mx={"!":"︕","#":"",$:"","%":"","&":"","(":"︵",")":"︶","*":"","+":"",",":"︐","-":"︲",".":"・","/":"",":":"︓",";":"︔","<":"︿","=":"",">":"﹀","?":"︖","@":"","[":"﹇","\\":"","]":"﹈","^":"",_:"︳","`":"","{":"︷","|":"―","}":"︸","~":"","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","":"︲","—":"︱","":"﹃","":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","":"︹","":"︺","〖":"︗","〗":"︘","":"︕","":"︵","":"︶","":"︐","":"︲","":"・","":"︓","":"︔","":"︿","":"﹀","":"︖","":"﹇","":"﹈","_":"︳","":"︷","":"―","":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂","←":"↑","→":"↓"};function yx(t){return"︶"===t||"﹈"===t||"︸"===t||"﹄"===t||"﹂"===t||"︾"===t||"︼"===t||"︺"===t||"︘"===t||"﹀"===t||"︐"===t||"︓"===t||"︔"===t||""===t||" ̄"===t||"︑"===t||"︒"===t}function gx(t){return"︵"===t||"﹇"===t||"︷"===t||"﹃"===t||"﹁"===t||"︽"===t||"︻"===t||"︹"===t||"︗"===t||"︿"===t}const xx=4294967296,vx=1/xx,bx="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8");let wx=class{constructor(t=new Uint8Array(16)){this.buf=ArrayBuffer.isView(t)?t:new Uint8Array(t),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(t,e,r=this.length){for(;this.pos<r;){const r=this.readVarint(),n=r>>3,i=this.pos;this.type=7&r,t(n,e,this),this.pos===i&&this.skip(r)}return e}readMessage(t,e){return this.readFields(t,e,this.readVarint()+this.pos)}readFixed32(){const t=this.dataView.getUint32(this.pos,!0);return this.pos+=4,t}readSFixed32(){const t=this.dataView.getInt32(this.pos,!0);return this.pos+=4,t}readFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*xx;return this.pos+=8,t}readSFixed64(){const t=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*xx;return this.pos+=8,t}readFloat(){const t=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,t}readDouble(){const t=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,t}readVarint(t){const e=this.buf;let r,n;return n=e[this.pos++],r=127&n,n<128?r:(n=e[this.pos++],r|=(127&n)<<7,n<128?r:(n=e[this.pos++],r|=(127&n)<<14,n<128?r:(n=e[this.pos++],r|=(127&n)<<21,n<128?r:(n=e[this.pos],r|=(15&n)<<28,function(t,e,r){const n=r.buf;let i,s;if(s=n[r.pos++],i=(112&s)>>4,s<128)return _x(t,i,e);if(s=n[r.pos++],i|=(127&s)<<3,s<128)return _x(t,i,e);if(s=n[r.pos++],i|=(127&s)<<10,s<128)return _x(t,i,e);if(s=n[r.pos++],i|=(127&s)<<17,s<128)return _x(t,i,e);if(s=n[r.pos++],i|=(127&s)<<24,s<128)return _x(t,i,e);if(s=n[r.pos++],i|=(1&s)<<31,s<128)return _x(t,i,e);throw new Error("Expected varint not more than 10 bytes")}(r,t,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const t=this.readVarint();return t%2==1?(t+1)/-2:t/2}readBoolean(){return Boolean(this.readVarint())}readString(){const t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&bx?bx.decode(this.buf.subarray(e,t)):function(t,e,r){let n="",i=e;for(;i<r;){const e=t[i];let s,a,o,l=null,u=e>239?4:e>223?3:e>191?2:1;if(i+u>r)break;1===u?e<128&&(l=e):2===u?(s=t[i+1],128==(192&s)&&(l=(31&e)<<6|63&s,l<=127&&(l=null))):3===u?(s=t[i+1],a=t[i+2],128==(192&s)&&128==(192&a)&&(l=(15&e)<<12|(63&s)<<6|63&a,(l<=2047||l>=55296&&l<=57343)&&(l=null))):4===u&&(s=t[i+1],a=t[i+2],o=t[i+3],128==(192&s)&&128==(192&a)&&128==(192&o)&&(l=(15&e)<<18|(63&s)<<12|(63&a)<<6|63&o,(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,e,t)}readBytes(){const t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e}readPackedVarint(t=[],e){const r=this.readPackedEnd();for(;this.pos<r;)t.push(this.readVarint(e));return t}readPackedSVarint(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSVarint());return t}readPackedBoolean(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readBoolean());return t}readPackedFloat(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFloat());return t}readPackedDouble(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readDouble());return t}readPackedFixed32(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFixed32());return t}readPackedSFixed32(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSFixed32());return t}readPackedFixed64(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFixed64());return t}readPackedSFixed64(t=[]){const e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSFixed64());return t}readPackedEnd(){return 2===this.type?this.readVarint()+this.pos:this.pos+1}skip(t){const e=7&t;if(0===e)for(;this.buf[this.pos++]>127;);else if(2===e)this.pos=this.readVarint()+this.pos;else if(5===e)this.pos+=4;else{if(1!==e)throw new Error(`Unimplemented type: ${e}`);this.pos+=8}}writeTag(t,e){this.writeVarint(t<<3|e)}realloc(t){let e=this.length||16;for(;e<this.pos+t;)e*=2;if(e!==this.length){const t=new Uint8Array(e);t.set(this.buf),this.buf=t,this.dataView=new DataView(t.buffer),this.length=e}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4}writeSFixed32(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4}writeFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,-1&t,!0),this.dataView.setInt32(this.pos+4,Math.floor(t*vx),!0),this.pos+=8}writeSFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,-1&t,!0),this.dataView.setInt32(this.pos+4,Math.floor(t*vx),!0),this.pos+=8}writeVarint(t){(t=+t||0)>268435455||t<0?function(t,e){let r,n;if(t>=0?(r=t%4294967296|0,n=t/4294967296|0):(r=~(-t%4294967296),n=~(-t/4294967296),4294967295^r?r=r+1|0:(r=0,n=n+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,r){r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,r.buf[r.pos]=127&(t>>>=7)}(r,0,e),function(t,e){const r=(7&t)<<4;e.buf[e.pos++]|=r|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))))}(n,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))}writeSVarint(t){this.writeVarint(t<0?2*-t-1:2*t)}writeBoolean(t){this.writeVarint(+t)}writeString(t){t=String(t),this.realloc(4*t.length),this.pos++;const e=this.pos;this.pos=function(t,e,r){for(let n,i,s=0;s<e.length;s++){if(n=e.charCodeAt(s),n>55295&&n<57344){if(!i){n>56319||s+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):i=n;continue}if(n<56320){t[r++]=239,t[r++]=191,t[r++]=189,i=n;continue}n=i-55296<<10|n-56320|65536,i=null}else i&&(t[r++]=239,t[r++]=191,t[r++]=189,i=null);n<128?t[r++]=n:(n<2048?t[r++]=n>>6|192:(n<65536?t[r++]=n>>12|224:(t[r++]=n>>18|240,t[r++]=n>>12&63|128),t[r++]=n>>6&63|128),t[r++]=63&n|128)}return r}(this.buf,t,this.pos);const r=this.pos-e;r>=128&&Ax(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r}writeFloat(t){this.realloc(4),this.dataView.setFloat32(this.pos,t,!0),this.pos+=4}writeDouble(t){this.realloc(8),this.dataView.setFloat64(this.pos,t,!0),this.pos+=8}writeBytes(t){const e=t.length;this.writeVarint(e),this.realloc(e);for(let r=0;r<e;r++)this.buf[this.pos++]=t[r]}writeRawMessage(t,e){this.pos++;const r=this.pos;t(e,this);const n=this.pos-r;n>=128&&Ax(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n}writeMessage(t,e,r){this.writeTag(t,2),this.writeRawMessage(e,r)}writePackedVarint(t,e){e.length&&this.writeMessage(t,Ix,e)}writePackedSVarint(t,e){e.length&&this.writeMessage(t,Mx,e)}writePackedBoolean(t,e){e.length&&this.writeMessage(t,kx,e)}writePackedFloat(t,e){e.length&&this.writeMessage(t,Sx,e)}writePackedDouble(t,e){e.length&&this.writeMessage(t,Px,e)}writePackedFixed32(t,e){e.length&&this.writeMessage(t,Bx,e)}writePackedSFixed32(t,e){e.length&&this.writeMessage(t,zx,e)}writePackedFixed64(t,e){e.length&&this.writeMessage(t,Tx,e)}writePackedSFixed64(t,e){e.length&&this.writeMessage(t,Ex,e)}writeBytesField(t,e){this.writeTag(t,2),this.writeBytes(e)}writeFixed32Field(t,e){this.writeTag(t,5),this.writeFixed32(e)}writeSFixed32Field(t,e){this.writeTag(t,5),this.writeSFixed32(e)}writeFixed64Field(t,e){this.writeTag(t,1),this.writeFixed64(e)}writeSFixed64Field(t,e){this.writeTag(t,1),this.writeSFixed64(e)}writeVarintField(t,e){this.writeTag(t,0),this.writeVarint(e)}writeSVarintField(t,e){this.writeTag(t,0),this.writeSVarint(e)}writeStringField(t,e){this.writeTag(t,2),this.writeString(e)}writeFloatField(t,e){this.writeTag(t,5),this.writeFloat(e)}writeDoubleField(t,e){this.writeTag(t,1),this.writeDouble(e)}writeBooleanField(t,e){this.writeVarintField(t,+e)}};function _x(t,e,r){return r?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function Ax(t,e,r){const n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));r.realloc(n);for(let e=r.pos-1;e>=t;e--)r.buf[e+n]=r.buf[e]}function Ix(t,e){for(let r=0;r<t.length;r++)e.writeVarint(t[r])}function Mx(t,e){for(let r=0;r<t.length;r++)e.writeSVarint(t[r])}function Sx(t,e){for(let r=0;r<t.length;r++)e.writeFloat(t[r])}function Px(t,e){for(let r=0;r<t.length;r++)e.writeDouble(t[r])}function kx(t,e){for(let r=0;r<t.length;r++)e.writeBoolean(t[r])}function Bx(t,e){for(let r=0;r<t.length;r++)e.writeFixed32(t[r])}function zx(t,e){for(let r=0;r<t.length;r++)e.writeSFixed32(t[r])}function Tx(t,e){for(let r=0;r<t.length;r++)e.writeFixed64(t[r])}function Ex(t,e){for(let r=0;r<t.length;r++)e.writeSFixed64(t[r])}const Vx=3;function Fx(t,e,r){e.glyphs=[],1===t&&r.readMessage(Cx,e)}function Cx(t,e,r){if(3===t){const{id:t,bitmap:n,width:i,height:s,left:a,top:o,advance:l}=r.readMessage(Dx,{});e.glyphs.push({id:t,bitmap:new Qp({width:i+2*Vx,height:s+2*Vx},n),metrics:{width:i,height:s,left:a,top:o,advance:l}})}else 4===t?e.ascender=r.readSVarint():5===t&&(e.descender=r.readSVarint())}function Dx(t,e,r){1===t?e.id=r.readVarint():2===t?e.bitmap=r.readBytes():3===t?e.width=r.readVarint():4===t?e.height=r.readVarint():5===t?e.left=r.readSVarint():6===t?e.top=r.readSVarint():7===t&&(e.advance=r.readVarint())}const Rx=Vx,Lx={horizontal:1,vertical:2,horizontalOnly:3},Ox=-17;class Ux{constructor(){this.scale=1,this.fontStack="",this.image=null}static forText(t,e){const r=new Ux;return r.scale=t||1,r.fontStack=e,r}static forImage(t){const e=new Ux;return e.image=t,e}}class Nx{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(t,e,r){const n=new Nx;for(let i=0;i<t.sections.length;i++){const s=t.sections[i];s.image?n.addImageSection(s,r):n.addTextSection(s,e)}return n}length(){return this.text.length}getSection(t){return this.sections[this.sectionIndex[t]]}getSections(){return this.sections}getSectionIndex(t){return this.sectionIndex[t]}getCodePoint(t){return this.text.codePointAt(t)}verticalizePunctuation(t){this.text=function(t,e){let r="";for(let n=0;n<t.length;n++){const i=t.charCodeAt(n+1)||null,s=t.charCodeAt(n-1)||null;r+=!e&&(i&&lo(i)&&!mx[t[n+1]]||s&&lo(s)&&!mx[t[n-1]])||!mx[t[n]]?t[n]:mx[t[n]]}return r}(this.text,t)}trim(){let t=0;for(let e=0;e<this.text.length&&$x[this.text.charCodeAt(e)];e++)t++;let e=this.text.length;for(let r=this.text.length-1;r>=0&&r>=t&&$x[this.text.charCodeAt(r)];r--)e--;this.text=this.text.substring(t,e),this.sectionIndex=this.sectionIndex.slice(t,e)}substring(t,e){const r=new Nx;return r.text=this.text.substring(t,e),r.sectionIndex=this.sectionIndex.slice(t,e),r.sections=this.sections,r}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((t,e)=>Math.max(t,this.sections[e].scale)),0)}addTextSection(t,e){this.text+=t.text,this.sections.push(Ux.forText(t.scale,t.fontStack||e));const r=this.sections.length-1;for(let e=0;e<t.text.length;++e)this.sectionIndex.push(r)}addImageSection(t,e){const r=t.image?t.image.getPrimary():null;if(!r)return void Ae("Can't add FormattedSection with an empty image.");r.scaleSelf(e);const n=this.getNextImageSectionCharCode();n?(this.text+=String.fromCodePoint(n),this.sections.push(Ux.forImage(r)),this.sectionIndex.push(this.sections.length-1)):Ae("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function jx(t,e,r,n,i,s,a,o,l,u,c,h,p,d,f,m=1){const y=Nx.fromFeature(t,i,m);h===Lx.vertical&&y.verticalizePunctuation(p);let g=[];const x=function(t,e,r,n,i,s){if(!t)return[];const a=[],o=function(t,e,r,n,i,s){let a=0;for(let r=0;r<t.length();r++){const o=t.getSection(r);a+=qx(t.getCodePoint(r),o,n,i,e,s)}return a/Math.max(1,Math.ceil(a/r))}(t,e,r,n,i,s),l=t.text.indexOf("")>=0;let u=0;for(let r=0;r<t.length();r++){const h=t.getSection(r),p=t.getCodePoint(r);if($x[p]||(u+=qx(p,h,n,i,e,s)),r<t.length()-1){const e=!((c=p)<11904||!(no["Bopomofo Extended"](c)||no.Bopomofo(c)||no["CJK Compatibility Forms"](c)||no["CJK Compatibility Ideographs"](c)||no["CJK Compatibility"](c)||no["CJK Radicals Supplement"](c)||no["CJK Strokes"](c)||no["CJK Symbols and Punctuation"](c)||no["CJK Unified Ideographs Extension A"](c)||no["CJK Unified Ideographs"](c)||no["Enclosed CJK Letters and Months"](c)||no["Halfwidth and Fullwidth Forms"](c)||no.Hiragana(c)||no["Ideographic Description Characters"](c)||no["Kangxi Radicals"](c)||no["Katakana Phonetic Extensions"](c)||no.Katakana(c)||no["Vertical Forms"](c)||no["Yi Radicals"](c)||no["Yi Syllables"](c)));(Gx[p]||e||h.image)&&a.push(Zx(r+1,u,o,a,Xx(p,t.getCodePoint(r+1),e&&l),!1))}}var c;return Wx(Zx(t.length(),u,o,a,0,!0))}(y,u,s,e,n,d),{processBidirectionalText:v,processStyledBidirectionalText:b}=Mo;if(v&&1===y.sections.length){const t=v(y.toString(),x);for(const e of t){const t=new Nx;t.text=e,t.sections=y.sections;for(let r=0;r<e.length;r++)t.sectionIndex.push(0);g.push(t)}}else if(b){const t=b(y.text,y.sectionIndex,x);for(const e of t){const t=new Nx;t.text=e[0],t.sectionIndex=e[1],t.sections=y.sections,g.push(t)}}else g=function(t,e){const r=[],n=t.text;let i=0;for(const n of e)r.push(t.substring(i,n)),i=n;return i<n.length&&r.push(t.substring(i,n.length)),r}(y,x);const w=[],_={positionedLines:w,text:y.toString(),top:c[1],bottom:c[1],left:c[0],right:c[0],writingMode:h,iconsInText:!1,verticalizable:!1,hasBaseline:!1};if(function(t,e,r,n,i,s,a,o,l,u,c,h){let p=0,d=0,f=0;const m="right"===o?1:"left"===o?0:.5;let y=!1;for(const t of i){const r=t.getSections();for(const t of r){if(t.image)continue;const r=e[t.fontStack];if(r&&(y=void 0!==r.ascender&&void 0!==r.descender,!y))break}if(!y)break}let g=0;for(const a of i){a.trim();const i=a.getMaxScale(),o=(i-1)*dx,v={positionedGlyphs:[],lineOffset:0};t.positionedLines[g]=v;const b=v.positionedGlyphs;let w=0;if(!a.length()){d+=s,++g;continue}let _=0,A=0;for(let s=0;s<a.length();s++){const o=a.getSection(s),f=a.getSectionIndex(s),m=a.getCodePoint(s);let g=o.scale,v=null,I=null,M=null,S=dx,P=0,k=l;k===Lx.vertical&&(12312===(x=m)||12313===x||12316===x||12540===x||12448===x)&&(k=Lx.horizontal);const B=!(k===Lx.horizontal||!c&&!oo(m)||c&&($x[m]||uo(m)));if(o.image){const e=n.get(o.image.toString());if(!e)continue;M=o.image,t.iconsInText=t.iconsInText||!0,I=e.paddedRect;const r=e.displaySize;g=g*dx/h,v={width:r[0],height:r[1],left:0,top:-Rx,advance:B?r[1]:r[0],localGlyph:!1},P=y?-v.height*g:Ox+i*dx-r[1]*g,S=v.advance;const s=(B?r[0]:r[1])*g-dx*i;s>0&&s>w&&(w=s)}else{const t=r[o.fontStack];if(!t)continue;t[m]&&(I=t[m]);const n=e[o.fontStack];if(!n)continue;const s=n.glyphs[m];if(!s)continue;if(v=s.metrics,S=8203!==m?dx:0,y){const t=void 0!==n.ascender?Math.abs(n.ascender):0,e=void 0!==n.descender?Math.abs(n.descender):0,r=(t+e)*g;_<r&&(_=r,A=(t-e)/2*g),P=-t*g}else P=Ox+(i-g)*dx}B?(t.verticalizable=!0,b.push({glyph:m,image:M,x:p,y:d+P,vertical:B,scale:g,localGlyph:v.localGlyph,fontStack:o.fontStack,sectionIndex:f,metrics:v,rect:I}),p+=S*g+u):(b.push({glyph:m,image:M,x:p,y:d+P,vertical:B,scale:g,localGlyph:v.localGlyph,fontStack:o.fontStack,sectionIndex:f,metrics:v,rect:I}),p+=v.advance*g+u)}0!==b.length&&(f=Math.max(p-u,f),y?Kx(b,m,w,A,s*i/2):Kx(b,m,w,0,s/2)),p=0;const I=s*i+w;v.lineOffset=Math.max(w,o),d+=I,++g}var x;const v=d,{horizontalAlign:b,verticalAlign:w}=Yx(a);(function(t,e,r,n,i,s){const a=(e-r)*i,o=-s*n;for(const e of t)for(const t of e.positionedGlyphs)t.x+=a,t.y+=o})(t.positionedLines,m,b,w,f,v),t.top+=-w*v,t.bottom=t.top+v,t.left+=-b*f,t.right=t.left+f,t.hasBaseline=y}(_,e,r,n,g,a,o,l,h,u,p,f),!function(t){for(const e of t)if(0!==e.positionedGlyphs.length)return!1;return!0}(w))return _}const $x={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Gx={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function qx(t,e,r,n,i,s){if(e.image){const t=n.get(e.image.toString());return t?t.displaySize[0]*e.scale*dx/s+i:0}{const n=r[e.fontStack],s=n&&n.glyphs[t];return s?s.metrics.advance*e.scale+i:0}}function Hx(t,e,r,n){const i=Math.pow(t-e,2);return n?t<e?i/2:2*i:i+Math.abs(r)*r}function Xx(t,e,r){let n=0;return 10===t&&(n-=1e4),r&&(n+=150),40!==t&&65288!==t||(n+=50),41!==e&&65289!==e||(n+=50),n}function Zx(t,e,r,n,i,s){let a=null,o=Hx(e,r,i,s);for(const t of n){const n=Hx(e-t.x,r,i,s)+t.badness;n<=o&&(a=t,o=n)}return{index:t,x:e,priorBreak:a,badness:o}}function Wx(t){return t?Wx(t.priorBreak).concat(t.index):[]}function Yx(t){let e=.5,r=.5;switch(t){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(t){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:e,verticalAlign:r}}function Kx(t,e,r,n,i){if(!(e||r||n||i))return;const s=t.length-1,a=t[s],o=(a.x+a.metrics.advance*a.scale)*e;for(let e=0;e<=s;e++)t[e].x-=o,t[e].y+=r+n+i}function Jx(t){return void 0!==t.imagePrimary&&void 0!==t.top&&void 0!==t.bottom&&void 0!==t.left&&void 0!==t.right}function Qx(t,e,r,n){const{horizontalAlign:i,verticalAlign:s}=Yx(n),a=r[0]-t.displaySize[0]*i,o=r[1]-t.displaySize[1]*s;return{imagePrimary:t,imageSecondary:e,top:o,bottom:o+t.displaySize[1],left:a,right:a+t.displaySize[0]}}function tv(t,e,r,n,i,s){const a=t.imagePrimary;let o;if(a.content){const t=a.content,e=a.pixelRatio||1;o=[t[0]/e,t[1]/e,a.displaySize[0]-t[2]/e,a.displaySize[1]-t[3]/e]}const l=e.left*s,u=e.right*s;let c,h,p,d;"width"===r||"both"===r?(d=i[0]+l-n[3],h=i[0]+u+n[1]):(d=i[0]+(l+u-a.displaySize[0])/2,h=d+a.displaySize[0]);const f=e.top*s,m=e.bottom*s;return"height"===r||"both"===r?(c=i[1]+f-n[0],p=i[1]+m+n[2]):(c=i[1]+(f+m-a.displaySize[1])/2,p=c+a.displaySize[1]),{imagePrimary:a,imageSecondary:void 0,top:c,right:h,bottom:p,left:d,collisionPadding:o}}function ev(t){return!t.imagePrimary.stretchX}function rv(t){return!t.imagePrimary.stretchY}function nv(t){return{width:t.right-t.left,height:t.bottom-t.top}}const iv=128;function sv(t,e,r){const{expression:n}=e;if("constant"===n.kind)return{kind:"constant",layoutSize:n.evaluate(new Po(t+1,{worldview:r}))};if("source"===n.kind)return{kind:"source"};{const{zoomStops:e,interpolationType:i}=n;let s=0;for(;s<e.length&&e[s]<=t;)s++;s=Math.max(0,s-1);let a=s;for(;a<e.length&&e[a]<t+1;)a++;a=Math.min(e.length-1,a);const o=e[s],l=e[a];return"composite"===n.kind?{kind:"composite",minZoom:o,maxZoom:l,interpolationType:i}:{kind:"camera",minZoom:o,maxZoom:l,minSize:n.evaluate(new Po(o,{worldview:r})),maxSize:n.evaluate(new Po(l,{worldview:r})),interpolationType:i}}}function av(t,{uSize:e,uSizeT:r},{lowerSize:n,upperSize:i}){return"source"===t.kind?n/iv:"composite"===t.kind?dn(n/iv,i/iv,r):e}function ov(t,e,r=1){let n=0,i=0;if("constant"===t.kind)i=t.layoutSize*r;else if("source"!==t.kind){const{interpolationType:s,minZoom:a,maxZoom:o}=t,l=s?ie(Xs.interpolationFactor(s,e,a,o),0,1):0;"camera"===t.kind?i=dn(t.minSize,t.maxSize,l)*r:n=l*r}return{uSizeT:n,uSize:i}}class lv extends $t{constructor(t,e,r,n,i){super(t,e),this.angle=n,this.z=r,void 0!==i&&(this.segment=i)}clone(){return new lv(this.x,this.y,this.z,this.angle,this.segment)}}function uv(t,e,r,n,i){if(void 0===e.segment)return!0;let s=e,a=e.segment+1,o=0;for(;o>-r/2;){if(a--,a<0)return!1;o-=t[a].dist(s),s=t[a]}o+=t[a].dist(t[a+1]),a++;const l=[];let u=0;for(;o<r/2;){const e=t[a],r=t[a+1];if(!r)return!1;let s=t[a-1].angleTo(e)-e.angleTo(r);for(s=Math.abs((s+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:o,angleDelta:s}),u+=s;o-l[0].distance>n;)u-=l.shift().angleDelta;if(u>i)return!1;a++,o+=e.dist(r)}return!0}function cv(t){let e=0;for(let r=0;r<t.length-1;r++)e+=t[r].dist(t[r+1]);return e}function hv(t,e,r){return t?.6*e*r:0}function pv(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function dv(t,e,r,n,i,s){const a=hv(r,i,s),o=pv(r,n)*s;let l=0;const u=cv(t)/2;for(let r=0;r<t.length-1;r++){const n=t[r],i=t[r+1],s=n.dist(i);if(l+s>u){const c=(u-l)/s,h=dn(n.x,i.x,c),p=dn(n.y,i.y,c),d=new lv(h,p,0,i.angleTo(n),r);return!a||uv(t,d,o,a,e)?d:void 0}l+=s}}function fv(t,e,r,n,i,s,a,o,l){const u=hv(n,s,a),c=pv(n,i),h=c*a,p=0===t[0].x||t[0].x===l||0===t[0].y||t[0].y===l;return e-h<e/4&&(e=h+e/4),mv(t,p?e/2*o%e:(c/2+2*s)*a*o%e,e,u,r,h,p,!1,l)}function mv(t,e,r,n,i,s,a,o,l){const u=s/2,c=cv(t);let h=0,p=e-r,d=[];for(let e=0;e<t.length-1;e++){const a=t[e],o=t[e+1],f=a.dist(o),m=o.angleTo(a);for(;p+r<h+f;){p+=r;const y=(p-h)/f,g=dn(a.x,o.x,y),x=dn(a.y,o.y,y);if(g>=0&&g<l&&x>=0&&x<l&&p-u>=0&&p+u<=c){const r=new lv(g,x,0,m,e);n&&!uv(t,r,s,n,i)||d.push(r)}}h+=f}return o||d.length||a||(d=mv(t,h/2,r,n,i,s,a,!0,l)),d}function yv(t){let e=0,r=0;for(const n of t)e+=n.w*n.h,r=Math.max(r,n.w);t.sort(((t,e)=>e.h-t.h));const n=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}];let i=0,s=0;for(const e of t)for(let t=n.length-1;t>=0;t--){const r=n[t];if(!(e.w>r.w||e.h>r.h)){if(e.x=r.x,e.y=r.y,s=Math.max(s,e.y+e.h),i=Math.max(i,e.x+e.w),e.w===r.w&&e.h===r.h){const e=n.pop();e&&t<n.length&&(n[t]=e)}else e.h===r.h?(r.x+=e.w,r.w-=e.w):e.w===r.w?(r.y+=e.h,r.h-=e.h):(n.push({x:r.x+e.w,y:r.y,w:r.w-e.w,h:e.h}),r.y+=e.h,r.h-=e.h);break}}return{w:i,h:s,fill:e/(i*s)||0}}Qa(lv,"Anchor");const gv=1,xv=2;class vv{static getImagePositionScale(t,e,r){if(e&&t){const{sx:e,sy:r}=t;return{x:e,y:r}}return{x:r,y:r}}constructor(t,e,r,n){this.paddedRect=t;const{pixelRatio:i,version:s,stretchX:a,stretchY:o,content:l,sdf:u,usvg:c}=e;this.pixelRatio=i,this.stretchX=a,this.stretchY=o,this.content=l,this.version=s,this.padding=r,this.sdf=u,this.usvg=c,this.scale=vv.getImagePositionScale(n,c,i)}get tl(){return[this.paddedRect.x+this.padding,this.paddedRect.y+this.padding]}get br(){return[this.paddedRect.x+this.paddedRect.w-this.padding,this.paddedRect.y+this.paddedRect.h-this.padding]}get displaySize(){return[(this.paddedRect.w-2*this.padding)/this.scale.x,(this.paddedRect.h-2*this.padding)/this.scale.y]}}function bv(t,e,r){const n=Ln.parse(t),i=function(t,e,r=[1,1]){return{x:0,y:0,w:(t.data?t.data.width:t.width*r[0])+2*e,h:(t.data?t.data.height:t.height*r[1])+2*e}}(e,r,[n.sx,n.sy]);return{bin:i,imagePosition:new vv(i,e,r,n),imageVariant:n}}class wv{constructor(t,e,r){const n=new Map,i=new Map;this.haveRenderCallbacks=[];const s=[];this.addImages(t,n,gv,s),this.addImages(e,i,2,s);const{w:a,h:o}=yv(s),l=new td({width:a||1,height:o||1});for(const[e,r]of t.entries()){const t=n.get(e).paddedRect;td.copy(r.data,l,{x:0,y:0},{x:t.x+gv,y:t.y+gv},r.data,null,r.sdf)}for(const[t,n]of e.entries()){const e=i.get(t),s=e.paddedRect;let a=e.padding;const o=s.x+a,u=s.y+a,c=n.data.width,h=n.data.height;a=a>1?a-1:a,td.copy(n.data,l,{x:0,y:0},{x:o,y:u},n.data,r),td.copy(n.data,l,{x:0,y:h-a},{x:o,y:u-a},{width:c,height:a},r),td.copy(n.data,l,{x:0,y:0},{x:o,y:u+h},{width:c,height:a},r),td.copy(n.data,l,{x:c-a,y:0},{x:o-a,y:u},{width:a,height:h},r),td.copy(n.data,l,{x:0,y:0},{x:o+c,y:u},{width:a,height:h},r),td.copy(n.data,l,{x:c-a,y:h-a},{x:o-a,y:u-a},{width:a,height:a},r),td.copy(n.data,l,{x:0,y:h-a},{x:o+c,y:u-a},{width:a,height:a},r),td.copy(n.data,l,{x:0,y:0},{x:o+c,y:u+h},{width:a,height:a},r),td.copy(n.data,l,{x:c-a,y:0},{x:o-a,y:u+h},{width:a,height:a},r)}this.lut=r,this.image=l,this.iconPositions=n,this.patternPositions=i}addImages(t,e,r,n){for(const[i,s]of t.entries()){const{bin:t,imagePosition:a,imageVariant:o}=bv(i,s,r);e.set(i,a),n.push(t),s.hasRenderCallback&&this.haveRenderCallbacks.push(o.id)}}patchUpdatedImages(t,e,r){this.haveRenderCallbacks=this.haveRenderCallbacks.filter((e=>t.hasImage(e,r))),t.dispatchRenderCallbacks(this.haveRenderCallbacks,r);for(const n of t.getUpdatedImages(r)){for(const i of this.iconPositions.keys()){const s=Ln.parse(i);if(sn.isEqual(s.id,n)){const s=t.getImage(n,r);this.patchUpdatedImage(this.iconPositions.get(i),s,e,null)}}for(const i of this.patternPositions.keys()){const s=Ln.parse(i);if(sn.isEqual(s.id,n)){const s=t.getImage(n,r);this.patchUpdatedImage(this.patternPositions.get(i),s,e,this.lut)}}}}patchUpdatedImage(t,e,r,n=null){if(!t||!e)return;if(t.version===e.version)return;t.version=e.version;const[i,s]=t.tl,a=t.sdf;if(this.lut||a){const t={width:e.data.width,height:e.data.height},o=new td(t);td.copy(e.data,o,{x:0,y:0},{x:0,y:0},t,n,a),r.update(o,{position:{x:i,y:s}})}else r.update(e.data,{position:{x:i,y:s}})}}Qa(vv,"ImagePosition"),Qa(wv,"ImageAtlas");const _v=1e20;function Av(t,e,r,n,i,s,a,o,l){for(let u=e;u<e+n;u++)Iv(t,r*s+u,s,i,a,o,l);for(let u=r;u<r+i;u++)Iv(t,u*s+e,1,n,a,o,l)}function Iv(t,e,r,n,i,s,a){s[0]=0,a[0]=-_v,a[1]=_v,i[0]=t[e];for(let o=1,l=0,u=0;o<n;o++){i[o]=t[e+o*r];const n=o*o;do{const t=s[l];u=(i[o]-i[t]+n-t*t)/(o-t)/2}while(u<=a[l]&&--l>-1);l++,s[l]=o,a[l]=u,a[l+1]=_v}for(let o=0,l=0;o<n;o++){for(;a[l+1]<o;)l++;const n=s[l],u=o-n;t[e+o*r]=i[n]+u*u}}const Mv=2,Sv={none:0,ideographs:1,all:2};class Pv{constructor(t,e,r){this.requestManager=t,this.localGlyphMode=e,this.localFontFamily=r,this.url="",this.entries={},this.localGlyphs={200:{},400:{},500:{},900:{}}}setURL(t){this.url=t}getGlyphs(t,e){const r=[],n=this.url||Xe.GLYPHS_URL;for(const e in t)for(const n of t[e])r.push({stack:e,id:n});oe(r,(({stack:t,id:e},r)=>{let i=this.entries[t];i||(i=this.entries[t]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let s=i.glyphs[e];if(void 0!==s)return void r(null,{stack:t,id:e,glyph:s});if(s=this._tinySDF(i,t,e),s)return i.glyphs[e]=s,void r(null,{stack:t,id:e,glyph:s});const a=Math.floor(e/256);if(256*a>65535)return Ae("glyphs > 65535 not supported"),void r(null,{stack:t,id:e,glyph:s});if(i.ranges[a])return void r(null,{stack:t,id:e,glyph:s});let o=i.requests[a];o||(o=i.requests[a]=[],Pv.loadGlyphRange(t,a,n,this.requestManager,((t,e)=>{if(e){i.ascender=e.ascender,i.descender=e.descender;for(const t in e.glyphs)this._doesCharSupportLocalGlyph(+t)||(i.glyphs[+t]=e.glyphs[+t]);i.ranges[a]=!0}for(const r of o)r(t,e);delete i.requests[a]}))),o.push(((n,i)=>{n?r(n):i&&r(null,{stack:t,id:e,glyph:i.glyphs[e]||null})}))}),((t,r)=>{if(t)e(t);else if(r){const t={};for(const{stack:e,id:n,glyph:i}of r)void 0===t[e]&&(t[e]={}),void 0===t[e].glyphs&&(t[e].glyphs={}),t[e].glyphs[n]=i&&{id:i.id,bitmap:i.bitmap.clone(),metrics:i.metrics},t[e].ascender=this.entries[e].ascender,t[e].descender=this.entries[e].descender;e(null,t)}}))}_doesCharSupportLocalGlyph(t){return this.localGlyphMode!==Sv.none&&(this.localGlyphMode===Sv.all?!!this.localFontFamily:!!this.localFontFamily&&(no["CJK Unified Ideographs"](t)||no["Hangul Syllables"](t)||no.Hiragana(t)||no.Katakana(t)||no["CJK Symbols and Punctuation"](t)||no["CJK Unified Ideographs Extension A"](t)||no["CJK Unified Ideographs Extension B"](t)||no.Osage(t)))}_tinySDF(t,e,r){const n=this.localFontFamily;if(!n||!this._doesCharSupportLocalGlyph(r))return;let i=t.tinySDF;if(!i){let r="400";/bold/i.test(e)?r="900":/medium/i.test(e)?r="500":/light/i.test(e)&&(r="200"),i=t.tinySDF=new Pv.TinySDF({fontFamily:n,fontWeight:r,fontSize:24*Mv,buffer:3*Mv,radius:8*Mv}),i.fontWeight=r}if(this.localGlyphs[i.fontWeight][r])return this.localGlyphs[i.fontWeight][r];const s=String.fromCodePoint(r),{data:a,width:o,height:l,glyphWidth:u,glyphHeight:c,glyphLeft:h,glyphTop:p,glyphAdvance:d}=i.draw(s);return this.localGlyphs[i.fontWeight][r]={id:r,bitmap:new Qp({width:o,height:l},a),metrics:{width:u/Mv,height:c/Mv,left:h/Mv,top:p/Mv-27,advance:d/Mv,localGlyph:!0}}}}Pv.loadGlyphRange=function(t,e,r,n,i){const s=256*e,a=s+255,o=n.transformRequest(n.normalizeGlyphsURL(r).replace("{fontstack}",t).replace("{range}",`${s}-${a}`),Tr.Glyphs);Dr(o,((t,e)=>{if(t)i(t);else if(e){const t={},r=function(t){return new wx(t).readFields(Fx,{})}(e);for(const e of r.glyphs)t[e.id]=e;i(null,{glyphs:t,ascender:r.ascender,descender:r.descender})}}))},Pv.TinySDF=class{constructor({fontSize:t=24,buffer:e=3,radius:r=8,cutoff:n=.25,fontFamily:i="sans-serif",fontWeight:s="normal",fontStyle:a="normal",lang:o=null}={}){this.buffer=e,this.cutoff=n,this.radius=r,this.lang=o;const l=this.size=t+4*e,u=this._createCanvas(l),c=this.ctx=u.getContext("2d",{willReadFrequently:!0});c.font=`${a} ${s} ${t}px ${i}`,c.textBaseline="alphabetic",c.textAlign="left",c.fillStyle="black",this.gridOuter=new Float64Array(l*l),this.gridInner=new Float64Array(l*l),this.f=new Float64Array(l),this.z=new Float64Array(l+1),this.v=new Uint16Array(l)}_createCanvas(t){const e=document.createElement("canvas");return e.width=e.height=t,e}draw(t){const{width:e,actualBoundingBoxAscent:r,actualBoundingBoxDescent:n,actualBoundingBoxLeft:i,actualBoundingBoxRight:s}=this.ctx.measureText(t),a=Math.ceil(r),o=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(s-i))),l=Math.min(this.size-this.buffer,a+Math.ceil(n)),u=o+2*this.buffer,c=l+2*this.buffer,h=Math.max(u*c,0),p=new Uint8ClampedArray(h),d={data:p,width:u,height:c,glyphWidth:o,glyphHeight:l,glyphTop:a,glyphLeft:0,glyphAdvance:e};if(0===o||0===l)return d;const{ctx:f,buffer:m,gridInner:y,gridOuter:g}=this;this.lang&&(f.lang=this.lang),f.clearRect(m,m,o,l),f.fillText(t,m,m+a);const x=f.getImageData(m,m,o,l);g.fill(_v,0,h),y.fill(0,0,h);for(let t=0;t<l;t++)for(let e=0;e<o;e++){const r=x.data[4*(t*o+e)+3]/255;if(0===r)continue;const n=(t+m)*u+e+m;if(1===r)g[n]=0,y[n]=_v;else{const t=.5-r;g[n]=t>0?t*t:0,y[n]=t<0?t*t:0}}Av(g,0,0,u,c,u,this.f,this.v,this.z),Av(y,m,m,o,l,u,this.f,this.v,this.z);for(let t=0;t<h;t++){const e=Math.sqrt(g[t])-Math.sqrt(y[t]);p[t]=Math.round(255-255*(e/this.radius+this.cutoff))}return d}};const kv=gv;function Bv(t,e){return t+e[1]-e[0]}function zv(t,e,r,n,i=1){const s=[],a=t.imagePrimary,o=a.pixelRatio,l=a.paddedRect.w-2*kv,u=a.paddedRect.h-2*kv,c=(t.right-t.left)*i,h=(t.bottom-t.top)*i,p=a.stretchX||[[0,l]],d=a.stretchY||[[0,u]],f=p.reduce(Bv,0),m=d.reduce(Bv,0),y=l-f,g=u-m;let x=0,v=f,b=0,w=m,_=0,A=y,I=0,M=g;if(a.content&&n){const t=a.content;x=Ev(p,0,t[0]),b=Ev(d,0,t[1]),v=Ev(p,t[0],t[2]),w=Ev(d,t[1],t[3]),_=t[0]-x,I=t[1]-b,A=t[2]-t[0]-v,M=t[3]-t[1]-w}const S=(n,s,l,u)=>{const p=Cv(n.stretch-x,v,c,t.left*i),d=Dv(n.fixed-_,A,n.stretch,f),y=Cv(s.stretch-b,w,h,t.top*i),g=Dv(s.fixed-I,M,s.stretch,m),S=Cv(l.stretch-x,v,c,t.left*i),P=Dv(l.fixed-_,A,l.stretch,f),k=Cv(u.stretch-b,w,h,t.top*i),B=Dv(u.fixed-I,M,u.stretch,m),z=new $t(p,y),T=new $t(S,y),E=new $t(S,k),V=new $t(p,k),F=new $t(d/o,g/o),C=new $t(P/o,B/o),D=e*Math.PI/180;if(D){const t=Math.sin(D),e=Math.cos(D),r=[e,-t,t,e];z._matMult(r),T._matMult(r),V._matMult(r),E._matMult(r)}const R=n.stretch+n.fixed,L=l.stretch+l.fixed,O=s.stretch+s.fixed,U=u.stretch+u.fixed,N=t.imageSecondary;return{tl:z,tr:T,bl:V,br:E,texPrimary:{x:a.paddedRect.x+kv+R,y:a.paddedRect.y+kv+O,w:L-R,h:U-O},texSecondary:N?{x:N.paddedRect.x+kv+R,y:N.paddedRect.y+kv+O,w:L-R,h:U-O}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:F,pixelOffsetBR:C,minFontScaleX:A/o/c,minFontScaleY:M/o/h,isSDF:r}};if(n&&(a.stretchX||a.stretchY)){const t=Vv(p,y,f),e=Vv(d,g,m);for(let r=0;r<t.length-1;r++){const n=t[r],i=t[r+1];for(let t=0;t<e.length-1;t++)s.push(S(n,e[t],i,e[t+1]))}}else s.push(S({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:l+1},{fixed:0,stretch:u+1}));return s}function Tv(t,e){const r=t.stretchY||[[0,t.paddedRect.h-2*kv]];return e&&(t.stretchX||t.stretchY)?Fv(t.stretchX||[[0,t.paddedRect.w-2*kv]])*Fv(r):1}function Ev(t,e,r){let n=0;for(const i of t)n+=Math.max(e,Math.min(r,i[1]))-Math.max(e,Math.min(r,i[0]));return n}function Vv(t,e,r){const n=[{fixed:-kv,stretch:0}];for(const[e,r]of t){const t=n[n.length-1];n.push({fixed:e-t.stretch,stretch:t.stretch}),n.push({fixed:e-t.stretch,stretch:t.stretch+(r-e)})}return n.push({fixed:e+kv,stretch:r}),n}function Fv(t){return 2*t.length+1}function Cv(t,e,r,n){return t/e*r+n}function Dv(t,e,r,n){return t-e*r/n}function Rv(t,e,r,n){const i=e+t.positionedLines[n].lineOffset;return 0===n?r+i/2:r+(i+(e+t.positionedLines[n-1].lineOffset))/2}function Lv(t,e=1,r=!1){let n=1/0,i=1/0,s=-1/0,a=-1/0;const o=t[0];for(let t=0;t<o.length;t++){const e=o[t];(!t||e.x<n)&&(n=e.x),(!t||e.y<i)&&(i=e.y),(!t||e.x>s)&&(s=e.x),(!t||e.y>a)&&(a=e.y)}const l=Math.min(s-n,a-i);let u=l/2;const c=new Oi([],Ov);if(0===l)return new $t(n,i);for(let e=n;e<s;e+=l)for(let r=i;r<a;r+=l)c.push(new Uv(e+u,r+u,u,t));let h=function(t){let e=0,r=0,n=0;const i=t[0];for(let t=0,s=i.length,a=s-1;t<s;a=t++){const s=i[t],o=i[a],l=s.x*o.y-o.x*s.y;r+=(s.x+o.x)*l,n+=(s.y+o.y)*l,e+=3*l}return new Uv(r/e,n/e,0,t)}(t),p=c.length;for(;c.length;){const n=c.pop();(n.d>h.d||!h.d)&&(h=n,r&&console.log("found best %d after %d probes",Math.round(1e4*n.d)/1e4,p)),n.max-h.d<=e||(u=n.h/2,c.push(new Uv(n.p.x-u,n.p.y-u,u,t)),c.push(new Uv(n.p.x+u,n.p.y-u,u,t)),c.push(new Uv(n.p.x-u,n.p.y+u,u,t)),c.push(new Uv(n.p.x+u,n.p.y+u,u,t)),p+=4)}return r&&(console.log(`num probes: ${p}`),console.log(`best distance: ${h.d}`)),h.p}function Ov(t,e){return e.max-t.max}class Uv{constructor(t,e,r,n){this.p=new $t(t,e),this.h=r,this.d=function(t,e){let r=!1,n=1/0;for(let i=0;i<e.length;i++){const s=e[i];for(let e=0,i=s.length,a=i-1;e<i;a=e++){const i=s[e],o=s[a];i.y>t.y!=o.y>t.y&&t.x<(o.x-i.x)*(t.y-i.y)/(o.y-i.y)+i.x&&(r=!r),n=Math.min(n,zh(t,i,o))}}return(r?1:-1)*Math.sqrt(n)}(this.p,n),this.max=this.d+this.h*Math.SQRT2}}const Nv=Object.keys,jv=7,$v=Number.POSITIVE_INFINITY,Gv=Math.sqrt(2),qv={MAX_GLYPHS:65535};function Hv(t,e,r,n,i){const s=Jx(t)&&t.collisionPadding?t.collisionPadding:[0,0,0,0],a={top:t.top-s[1],bottom:t.bottom+s[3],left:t.left-s[0],right:t.right+s[2],scaled:!1};return void 0!==n&&function(t,e){t.top*=e,t.bottom*=e,t.left*=e,t.right*=e,t.scaled=!0}(a,n),r&&function(t,e){if(!e)return;const r=Xt(e),n=new $t(t.left,t.top),i=new $t(t.right,t.top),s=new $t(t.left,t.bottom),a=new $t(t.right,t.bottom),o=new $t(0,0);n._rotateAround(r,o),i._rotateAround(r,o),s._rotateAround(r,o),a._rotateAround(r,o),t.left=Math.min(n.x,i.x,s.x,a.x),t.right=Math.max(n.x,i.x,s.x,a.x),t.top=Math.min(n.y,i.y,s.y,a.y),t.bottom=Math.max(n.y,i.y,s.y,a.y)}(a,r),i&&(a.left+=i[0],a.right+=i[0],a.top+=i[1],a.bottom+=i[1]),e?{top:Math.min(e.top,a.top),bottom:Math.max(e.bottom,a.bottom),left:Math.min(e.left,a.left),right:Math.max(e.right,a.right),scaled:e.scaled||a.scaled}:a}function Xv(t,[e,r]){let n=0,i=0;if(r===$v){e<0&&(e=0);const r=e/Gv;switch(t){case"top-right":case"top-left":i=r-jv;break;case"bottom-right":case"bottom-left":i=-r+jv;break;case"bottom":i=-e+jv;break;case"top":i=e-jv}switch(t){case"top-right":case"bottom-right":n=-r;break;case"top-left":case"bottom-left":n=r;break;case"left":n=e;break;case"right":n=-e}}else{switch(e=Math.abs(e),r=Math.abs(r),t){case"top-right":case"top-left":case"top":i=r-jv;break;case"bottom-right":case"bottom-left":case"bottom":i=-r+jv}switch(t){case"top-right":case"bottom-right":case"right":n=-e;break;case"top-left":case"bottom-left":case"left":n=e}}return[n,i]}function Zv(t,e,r,n,i,s,a,o=1,l,u,c){t.createArrays(),t.tilePixelRatio=Ui/(512*t.overscaling),t.compareText={},t.iconsNeedLinear=!1;const h=t.layers[0].layout,p=t.layers[0]._unevaluatedLayout._values,d={};d.scaleFactor=o,d.textSizeScaleRange=h.get("text-size-scale-range"),d.iconSizeScaleRange=h.get("icon-size-scale-range");const[f,m]=d.textSizeScaleRange,[y,g]=d.iconSizeScaleRange;d.textScaleFactor=ie(d.scaleFactor,f,m),d.iconScaleFactor=ie(d.scaleFactor,y,g);const x=p["text-size"],v=p["icon-size"];if("composite"===t.textSizeData.kind){const{minZoom:e,maxZoom:r}=t.textSizeData;d.compositeTextSizes=[x.possiblyEvaluate(new Po(e,{worldview:c}),s),x.possiblyEvaluate(new Po(r,{worldview:c}),s)]}if("composite"===t.iconSizeData.kind){const{minZoom:e,maxZoom:r}=t.iconSizeData;d.compositeIconSizes=[v.possiblyEvaluate(new Po(e,{worldview:c}),s),v.possiblyEvaluate(new Po(r,{worldview:c}),s)]}d.layoutTextSize=x.possiblyEvaluate(new Po(a+1,{worldview:c}),s),d.layoutIconSize=v.possiblyEvaluate(new Po(a+1,{worldview:c}),s),d.textMaxSize=x.possiblyEvaluate(new Po(18,{worldview:c}),s);const b=h.get("symbol-placement"),w="map"===h.get("text-rotation-alignment")&&"point"!==b,_=h.get("text-size");let A=!1;const I=[];for(const a of t.features){const o=h.get("text-font").evaluate(a,{},s).join(","),f=_.evaluate(a,{},s)*d.textScaleFactor,m=d.layoutTextSize.evaluate(a,{},s)*d.textScaleFactor,y=d.layoutIconSize.evaluate(a,{},s)*d.iconScaleFactor,g={horizontal:{},vertical:void 0},x=a.text;let v,M=[0,0];if(x){const n=x.toString(),u=h.get("text-letter-spacing").evaluate(a,{},s)*dx,c=h.get("text-line-height").evaluate(a,{},s)*dx,p=so(n)?u:0,d=h.get("text-anchor").evaluate(a,{},s),y=h.get("text-variable-anchor");if(!y){const t=h.get("text-radial-offset").evaluate(a,{},s);if(t)M=Xv(d,[t*dx,$v]);else{const t=h.get("text-offset").evaluate(a,{},s);M=[t[0]*dx,t[1]*dx]}}let v=w?"center":h.get("text-justify").evaluate(a,{},s);const _="point"===b,A=_?h.get("text-max-width").evaluate(a,{},s)*dx:1/0,I=s=>{t.allowVerticalPlacement&&io(n)&&(g.vertical=jx(x,e,r,i,o,A,c,d,s,p,M,Lx.vertical,!0,m,f,l))};if(!w&&y){const t="auto"===v?y.map((t=>ab(t))):[v];let n=!1;for(let s=0;s<t.length;s++){const a=t[s];if(!g.horizontal[a])if(n)g.horizontal[a]=g.horizontal[0];else{const t=jx(x,e,r,i,o,A,c,"center",a,p,M,Lx.horizontal,!1,m,f,l);t&&(g.horizontal[a]=t,n=1===t.positionedLines.length)}}I("left")}else{if("auto"===v&&(v=ab(d)),_||h.get("text-writing-mode").indexOf("horizontal")>=0||!io(n)){const t=jx(x,e,r,i,o,A,c,d,v,p,M,Lx.horizontal,!1,m,f,l);t&&(g.horizontal[v]=t)}I(_?"left":v)}}let S,P,k,B,z,T,E=!1;const V=h.get("icon-text-fit").evaluate(a,{},s);if(a.icon&&a.icon.hasPrimary()){const e=tb(a.icon,t.iconSizeData,p["icon-size"],s,t.zoom,a,l,d.iconScaleFactor,c);S=e.iconPrimary,k=e.iconSecondary;const r=S.toString();if(P=n.get(r),P&&(z=h.get("icon-offset").evaluate(a,{},s),T=h.get("icon-anchor").evaluate(a,{},s),v=Qx(i.get(r),k?i.get(k.toString()):void 0,z,T),E=P.sdf,void 0===t.sdfIcons?t.sdfIcons=P.sdf:t.sdfIcons!==P.sdf&&Ae("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(P.pixelRatio!==t.pixelRatio||0!==h.get("icon-rotate").constantOr(1))&&(t.iconsNeedLinear=!0)),k){const t=k.toString();B=n.get(t)}}A=A||!(!a.icon||!a.icon.hasSecondary());const F=pb(g.horizontal)||g.vertical;t.iconsInText||(t.iconsInText=!!F&&F.iconsInText);const C=m*d.textScaleFactor/dx,{defaultShapedIcon:D,verticallyShapedIcon:R}=ob(t,v,h,a,s,g,C,z,V);"none"!==V&&v&&(ev(v)||rv(v))&&(Jv(0,P,S,v,D,V,u,n,i),Jv(0,B,k,v,D,V,u,n,i),R&&(Jv(0,P,S,v,R,V,u,n,i),Jv(0,B,k,v,R,V,u,n,i))),v=D;const{iconBBox:L,iconVerticalBBox:O,textBBox:U,textVerticalBBox:N}=Wv(t,v,R,h,a,s,y,z,d,i,T,g,m,M);I.push({feature:a,shapedTextOrientations:g,shapedText:F,shapedIcon:v,iconPrimary:S,iconSecondary:k,iconOffset:z,iconAnchor:T,verticallyShapedIcon:R,layoutTextSize:m,layoutIconSize:y,textOffset:M,isSDFIcon:E,iconTextFit:V,iconCollisionBounds:L,iconVerticalCollisionBounds:O,textCollisionBounds:U,textVerticalCollisionBounds:N})}return{featureData:I,sizes:d,hasAnySecondaryIcon:A,textAlongLine:w,symbolPlacement:b}}function Wv(t,e,r,n,i,s,a,o,l,u,c,h,p,d){const f=t.layers[0],m=f.appearances;if(0===m.length)return{iconBBox:null,iconVerticalBBox:null,textBBox:null,textVerticalBBox:null};const y={iconBBox:null,iconVerticalBBox:null},g={textBBox:null,textVerticalBBox:null},{baseIconRotate:x,baseTextRotate:v,iconScaleFactor:b}=function(t,e,r){const n=t.get("icon-rotate").evaluate(e,{},r),i=t.get("text-rotate").evaluate(e,{},r),[s,a]=t.get("icon-size-scale-range");return{baseIconRotate:n,baseTextRotate:i,iconScaleFactor:ie(1,s,a)}}(n,i,s);e&&(y.iconBBox=Hv(e,y.iconBBox,x,a),r)&&(y.iconVerticalBBox=Hv(r,y.iconVerticalBBox,x+90,a));const w=pb(h.horizontal);w&&(g.textBBox=Hv(w,g.textBBox,v,1,d)),h.vertical&&(g.textVerticalBBox=Hv(h.vertical,g.textVerticalBBox,v+90,1,d));for(const r of m)r.hasIconProperties()&&Yv(y,t,f,r,i,s,o,x,a,l,e,u,b,c),r.hasTextProperties()&&Kv(g,f,r,i,s,d,v,p,w,h.vertical);return{iconBBox:y.iconBBox,iconVerticalBBox:y.iconVerticalBBox,textBBox:g.textBBox,textVerticalBBox:g.textVerticalBBox}}function Yv(t,e,r,n,i,s,a,o,l,u,c,h,p,d){const{appearanceIconOffset:f,appearanceIconRotate:m,appearanceIconSize:y}=function(t,e,r,n,i,s,a,o){const l=t.hasProperty("icon-offset")?e.getAppearanceValueAndResolveTokens(t,"icon-offset",r,n,[]):null,u=l&&Array.isArray(l)?l:i,c=t.hasProperty("icon-rotate")?e.getAppearanceValueAndResolveTokens(t,"icon-rotate",r,n,[]):null,h="number"==typeof c?c:s,p=t.hasProperty("icon-size")?e.getAppearanceValueAndResolveTokens(t,"icon-size",r,n,[]):null;return{appearanceIconOffset:u,appearanceIconRotate:h,appearanceIconSize:"number"==typeof p?p*o.iconScaleFactor:a}}(n,r,i,s,a,o,l,u);let g=null,x=null,v=null;n.hasProperty("icon-image")?v=function(t,e,r,n,i,s,a){let o=null;const l=e.getAppearanceValueAndResolveTokens(r,"icon-image",n,i,[]);if(l){const e=t.getResolvedImageFromTokens(l),u=r.getUnevaluatedProperty("icon-size"),c=tb(e,sv(t.zoom,u,t.worldview),u,i,t.zoom,n,t.pixelRatio,a,t.worldview);o=s.get(c.iconPrimary.toString())}return o}(e,r,n,i,s,h,p):c&&(v=c.imagePrimary),v&&(g=Qx(v,null,f,d),e.allowVerticalPlacement&&(x=Qx(v,null,f,d))),g&&(t.iconBBox=Hv(g,t.iconBBox,m,y)),x&&(t.iconVerticalBBox=Hv(x,t.iconVerticalBBox,m+90,y))}function Kv(t,e,r,n,i,s,a,o,l,u){const{appearanceTextOffset:c,appearanceTextRotate:h,appearanceTextSize:p}=function(t,e,r,n,i,s,a){const o=t.hasProperty("text-offset")?e.getAppearanceValueAndResolveTokens(t,"text-offset",r,n,[]):null,l=o&&Array.isArray(o)?[o[0]*dx,o[1]*dx]:i,u=t.hasProperty("text-rotate")?e.getAppearanceValueAndResolveTokens(t,"text-rotate",r,n,[]):null,c="number"==typeof u?u:s,h=t.hasProperty("text-size")?e.getAppearanceValueAndResolveTokens(t,"text-size",r,n,[]):null;return{appearanceTextOffset:l,appearanceTextRotate:c,appearanceTextSize:"number"==typeof h?h:a}}(r,e,n,i,s,a,o),d=p/o;l&&(t.textBBox=Hv(l,t.textBBox,h,d,c)),u&&(t.textVerticalBBox=Hv(u,t.textVerticalBBox,h+90,d,c))}function Jv(t,e,r,n,i,s,a,o,l){if(!e||!e.usvg)return;const u=nv(n),c=nv(i),h="both"!==s&&"width"!==s||!ev(n)?1:c.width/u.width,p="both"!==s&&"height"!==s||!rv(n)?1:c.height/u.height;r.scaleSelf(h,p);const d=r.toString();a.set(d,r),o.set(d,e);const{imagePosition:f}=bv(d,e,gv);l.set(d,f)}function Qv(t,e,r,n,i,s,a,o,l){if(!t)return;const u=function(t,e,r,n,i,s){if("camera"===t.kind)return t.maxSize;if("composite"===t.kind){const n=e.possiblyEvaluate(new Po(t.maxZoom,{worldview:s}),r).evaluate(i,{},r),a=e.possiblyEvaluate(new Po(t.minZoom,{worldview:s}),r).evaluate(i,{},r);return Math.max(n,a)}return e.possiblyEvaluate(new Po(n,{worldview:s})).evaluate(i,{},r)}(e,r,n,i,s,l);return t.scaleSelf(u*o*a)}function tb(t,e,r,n,i,s,a,o,l){return{iconPrimary:Qv(t.getPrimary(),e,r,n,i,s,a,o,l),iconSecondary:Qv(t.getSecondary(),e,r,n,i,s,a,o,l)}}function eb(t,e,r){if(!e)return;const n=r.get(t.toString()),i=r.get(e.toString());n&&i&&(n.paddedRect.w===i.paddedRect.w&&n.paddedRect.h===i.paddedRect.h||Ae(`Mismatch in icon variant sizes: ${t.toString()} and ${e.toString()}`),n.usvg!==i.usvg&&Ae(`Mismatch in icon variant image types: ${t.id} and ${e.id}`))}function rb(t,e,r,n,i,s,a,o,l,u){t.iconAtlasPositions=u.iconPositions;const{featureData:c,hasAnySecondaryIcon:h,sizes:p,textAlongLine:d,symbolPlacement:f}=e;for(const e of c){const{shapedIcon:r,verticallyShapedIcon:s,feature:c,shapedTextOrientations:m,shapedText:y,layoutTextSize:g,textOffset:x,isSDFIcon:v,iconPrimary:b,iconSecondary:w,iconTextFit:_,iconOffset:A,iconCollisionBounds:I,iconVerticalCollisionBounds:M,textCollisionBounds:S}=e;nb(r,u.iconPositions,b,w),nb(s,u.iconPositions,b,w),ib(m,u.iconPositions),eb(b,w,u.iconPositions),(y||r)&&lb(t,c,m,r,s,l,p,g,0,x,v,n,i,a,o,h,_,A,d,f,I,M,S)}r&&t.generateCollisionDebugBuffers(s,t.collisionBoxArray,p.textScaleFactor)}function nb(t,e,r,n){if(!t)return;const i=e.get(r.toString());if(t.imagePrimary=i,n){const r=e.get(n.toString());t.imageSecondary=r}}function ib(t,e){for(const r in t.horizontal)sb(t.horizontal[r],e);sb(t.vertical,e)}function sb(t,e){if(t)for(const r of t.positionedLines)for(const t of r.positionedGlyphs)if(null!==t.image){const r=t.image.toString();t.rect=e.get(r).paddedRect}}function ab(t){switch(t){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function ob(t,e,r,n,i,s,a,o,l){const u=pb(s.horizontal)||s.vertical,c=r.get("icon-text-fit-padding").evaluate(n,{},i);let h,p=e;return e&&"none"!==l&&(t.allowVerticalPlacement&&s.vertical&&(h=tv(e,s.vertical,l,c,o,a)),u&&(p=tv(e,u,l,c,o,a))),{defaultShapedIcon:p,verticallyShapedIcon:h}}function lb(t,e,r,n,i,s,a,o,l,u,c,h,p,d,f,m,y,g,x,v,b,w,_,A){let I=a.textMaxSize.evaluate(e,{},p);void 0===I?I=o*a.textScaleFactor:I*=a.textScaleFactor;const M=t.layers[0].layout,S=dx,P=o*a.textScaleFactor/S,k=pb(r.horizontal)||r.vertical;if("none"!==y&&t.appearanceFeatureData&&e.index<t.appearanceFeatureData.length){const r=t.appearanceFeatureData[e.index];r&&(r.textShaping=k,r.iconTextFitPadding=M.get("icon-text-fit-padding").evaluate(e,{},p),r.fontScale=P)}const B="globe"===d.name,z=t.tilePixelRatio*I/S,T=(R=t.overscaling,t.zoom>18&&R>2&&(R>>=1),Math.max(Ui/(512*R),1)*M.get("symbol-spacing")),E=M.get("text-padding")*t.tilePixelRatio,V=M.get("icon-padding")*t.tilePixelRatio,F=Xt(M.get("text-max-angle")),C="map"===M.get("icon-rotation-alignment")&&"point"!==v,D=T/2;var R;!1===t.hasAnyIconTextFit&&"none"!==y&&(t.hasAnyIconTextFit=!0);const L=e.properties?+e.properties[Wc]:null,O=L&&t.elevationFeatureIdToIndex?t.elevationFeatureIdToIndex.get(L):65535,U=(o,l,v)=>{if(l.x<0||l.x>=Ui||l.y<0||l.y>=Ui)return;let A=null;if(B){const{x:t,y:e,z:r}=d.projectTilePoint(l.x,l.y,v);A={anchor:new lv(t,e,r,0,void 0),up:d.upVector(v,l.x,l.y)}}!function(t,e,r,n,i,s,a,o,l,u,c,h,p,d,f,m,y,g,x,v,b,w,_,A,I,M,S,P,k,B,z,T,E){const V=t.addToLineVertexArray(e,n);let F,C,D,R,L,O,U,N=0,j=0,$=0,G=0,q=-1,H=-1;const X={};let Z=Jr("");const W=r?r.anchor:e,Y="none"!==P;let K=0,J=0;if(void 0===l._unevaluatedLayout.getValue("text-radial-offset")){const t=l.layout.get("text-offset").evaluate(b,{},I);K=t[0]*dx,J=t[1]*dx}else K=l.layout.get("text-radial-offset").evaluate(b,{},I)*dx,J=$v;if(t.allowVerticalPlacement&&i.vertical){const t=i.vertical;if(f)O=fb(t),o&&(U=fb(o));else{const r=l.layout.get("text-rotate").evaluate(b,{},I)+90;D=db(u,W,e,c,h,p,t,d,r,m,T),o&&(R=db(u,W,e,c,h,p,o,g,r,null,z))}}if(s){const n=t.iconSizeData,i=l.layout.get("icon-rotate").evaluate(b,{},I),a=zv(s,i,_,Y,w.iconScaleFactor),d=o?zv(o,i,_,Y,w.iconScaleFactor):void 0;C=db(u,W,e,c,h,p,s,g,i,null,B);const f=function(t,e,r,n,i,s,a,o){const l=t.layers[0],u=l.appearances;let c=e.length;if(r&&(c=Math.max(c,r.length)),0===u.length)return c;const[h,p]=n.get("icon-size-scale-range"),d=ie(1,h,p);for(const e of u){const r=e.getUnevaluatedProperties();if(void 0!==r._values["icon-image"].value){const n=l.getAppearanceValueAndResolveTokens(e,"icon-image",i,s,[]);if(n){const e=t.getResolvedImageFromTokens(n);if(e){const n=r._values["icon-size"],l=tb(e,sv(t.zoom,n,t.worldview),n,s,t.zoom,i,t.pixelRatio,d,t.worldview),u=a.get(l.iconPrimary.toString());c=Math.max(c,Tv(u,o))}}}}return c}(t,a,d,l.layout,b,I,t.iconAtlasPositions,Y);N=4*f;let m=null;"source"===n.kind?(m=[iv*l.layout.get("icon-size").evaluate(b,{},I)*w.iconScaleFactor],m[0]>cb&&Ae(`${t.layerIds[0]}: Value for "icon-size" is >= ${ub}. Reduce your "icon-size".`)):"composite"===n.kind&&(m=[iv*w.compositeIconSizes[0].evaluate(b,{},I)*w.iconScaleFactor,iv*w.compositeIconSizes[1].evaluate(b,{},I)*w.iconScaleFactor],(m[0]>cb||m[1]>cb)&&Ae(`${t.layerIds[0]}: Value for "icon-size" is >= ${ub}. Reduce your "icon-size".`)),t.addSymbols(t.icon,a,m,v,x,b,void 0,r,e,V.lineStartIndex,V.lineLength,-1,A,I,M,S,t.symbolInstances.length,f),q=t.icon.placedSymbolArray.length-1,d&&(j=4*f,t.addSymbols(t.icon,d,m,v,x,b,Lx.vertical,r,e,V.lineStartIndex,V.lineLength,-1,A,I,M,S,t.symbolInstances.length,f),H=t.icon.placedSymbolArray.length-1)}for(const n in i.horizontal){const s=n,o=i.horizontal[s];F||(Z=Jr(o.text),f?L=fb(o):F=db(u,W,e,c,h,p,o,d,l.layout.get("text-rotate").evaluate(b,{},I),m,T));const y=1===o.positionedLines.length;if($+=hb(t,r,e,o,a,l,f,b,m,V,i.vertical?Lx.horizontal:Lx.horizontalOnly,y?Nv(i.horizontal):[s],X,q,w,A,I,t.symbolInstances.length,M),y)break}i.vertical&&(G+=hb(t,r,e,i.vertical,a,l,f,b,m,V,Lx.vertical,["vertical"],X,H,w,A,I,t.symbolInstances.length,M));let Q=-1;const tt=(t,e)=>t?Math.max(t,e):e;Q=tt(L,Q),Q=tt(O,Q),Q=tt(U,Q);const et=Q>-1?1:0;t.glyphOffsetArray.length>=qv.MAX_GLYPHS&&Ae("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==b.sortKey&&t.addToSortKeyRanges(t.symbolInstances.length,b.sortKey),t.symbolInstances.emplaceBack(e.x,e.y,W.x,W.y,W.z,X.right>=0?X.right:-1,X.center>=0?X.center:-1,X.left>=0?X.left:-1,X.vertical>=0?X.vertical:-1,q,H,Z,void 0!==F?F:t.collisionBoxArray.length,void 0!==F?F+1:t.collisionBoxArray.length,void 0!==D?D:t.collisionBoxArray.length,void 0!==D?D+1:t.collisionBoxArray.length,void 0!==C?C:t.collisionBoxArray.length,void 0!==C?C+1:t.collisionBoxArray.length,R||t.collisionBoxArray.length,R?R+1:t.collisionBoxArray.length,c,$,G,N,j,et,0,K,J,Q,0,Y?1:0,k)}(t,l,A,o,r,n,s,i,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,E,x,u,0,V,C,g,e,a,c,h,p,f,m,y,O,b,w,_)};if("line"===v)for(const i of dm(e.geometry,0,0,Ui,Ui)){const e=fv(i,T,F,r.vertical||k,n,S,z,t.overscaling,Ui);for(const r of e)k&&mb(t,k.text,D,r)||U(i,r,p)}else if("line-center"===v){for(const t of e.geometry)if(t.length>1){const e=dv(t,F,r.vertical||k,n,S,z);e&&U(t,e,p)}}else if("Polygon"===e.type)for(const t of Vd(e.geometry,0)){const e=Lv(t,16);U(t[0],new lv(e.x,e.y,0,0,void 0),p)}else if("LineString"===e.type)for(const t of e.geometry)U(t,new lv(t[0].x,t[0].y,0,0,void 0),p);else if("Point"===e.type)for(const t of e.geometry)for(const e of t)U([e],new lv(e.x,e.y,0,0,void 0),p)}const ub=255,cb=ub*iv;function hb(t,e,r,n,i,s,a,o,l,u,c,h,p,d,f,m,y,g,x){const v=function(t,e,r,n,i,s,a,o){const l=[];if(0===e.positionedLines.length)return l;const u=n.layout.get("text-rotate").evaluate(s,{})*Math.PI/180,c=function(t){const e=t[0],r=t[1],n=e*r;return n>0?[e,-r]:n<0?[-e,r]:0===e?[r,e]:[r,-e]}(r);let h=Math.abs(e.top-e.bottom);for(const t of e.positionedLines)h-=t.lineOffset;const p=e.positionedLines.length,d=h/p;let f=e.top-r[1];for(let t=0;t<p;++t){const n=e.positionedLines[t];f=Rv(e,d,f,t);for(const t of n.positionedGlyphs){if(!t.rect)continue;const n=t.rect||{};let s=Rx+1,h=!0,p=1,d=0;if(t.image){const e=a.get(t.image.toString());if(!e)continue;if(e.sdf){Ae("SDF images are not supported in formatted text and will be ignored.");continue}h=!1,p=e.pixelRatio,s=gv/p}const m=(i||o)&&t.vertical,y=t.metrics.advance*t.scale/2,g=t.metrics,x=t.rect;if(null===x)continue;o&&e.verticalizable&&(d=t.image?y-t.metrics.width*t.scale/2:0);const v=i?[t.x+y,t.y]:[0,0];let b=[0,0],w=[0,0],_=!1;i||(m?(w=[t.x+y+c[0],t.y+c[1]-d],_=!0):b=[t.x+y+r[0],t.y+r[1]-d]);const A=x.w*t.scale/(p*(t.localGlyph?Mv:1)),I=x.h*t.scale/(p*(t.localGlyph?Mv:1));let M,S,P,k;if(m){const e=t.y-f,r=new $t(-y,y-e),n=-Math.PI/2,i=new $t(...w);M=new $t(-y+b[0],b[1]),M._rotateAround(n,r)._add(i),M.x+=-e+y,M.y-=(g.left-s)*t.scale;const a=t.image?g.advance*t.scale:dx*t.scale,o=String.fromCodePoint(t.glyph);yx(o)?M.x+=(1-s)*t.scale:gx(o)?M.x+=a-g.height*t.scale+(-s-1)*t.scale:M.x+=t.image||g.width+2*s===x.w&&g.height+2*s===x.h?(a-I)/2:(a-(g.height+2*s)*t.scale)/2,S=new $t(M.x,M.y-A),P=new $t(M.x+I,M.y),k=new $t(M.x+I,M.y-A)}else{const e=(g.left-s)*t.scale-y+b[0],r=(-g.top-s)*t.scale+b[1],n=e+A,i=r+I;M=new $t(e,r),S=new $t(n,r),P=new $t(e,i),k=new $t(n,i)}if(u){let t;t=i?new $t(0,0):_?new $t(c[0],c[1]):new $t(r[0],r[1]),M._rotateAround(u,t),S._rotateAround(u,t),P._rotateAround(u,t),k._rotateAround(u,t)}const B=new $t(0,0),z=new $t(0,0);l.push({tl:M,tr:S,bl:P,br:k,texPrimary:n,texSecondary:void 0,writingMode:e.writingMode,glyphOffset:v,sectionIndex:t.sectionIndex,isSDF:h,pixelOffsetTL:B,pixelOffsetBR:z,minFontScaleX:0,minFontScaleY:0})}}return l}(0,n,l,s,a,o,i,t.allowVerticalPlacement),b=t.textSizeData;let w=null;"source"===b.kind?(w=[iv*s.layout.get("text-size").evaluate(o,{},y)*f.textScaleFactor],w[0]>cb&&Ae(`${t.layerIds[0]}: Value for "text-size" is >= ${ub}. Reduce your "text-size".`)):"composite"===b.kind&&(w=[iv*f.compositeTextSizes[0].evaluate(o,{},y)*f.textScaleFactor,iv*f.compositeTextSizes[1].evaluate(o,{},y)*f.textScaleFactor],(w[0]>cb||w[1]>cb)&&Ae(`${t.layerIds[0]}: Value for "text-size" is >= ${ub}. Reduce your "text-size".`)),t.addSymbols(t.text,v,w,l,a,o,c,e,r,u.lineStartIndex,u.lineLength,d,m,y,x,!1,g,v.length);for(const e of h)p[e]=t.text.placedSymbolArray.length-1;return 4*v.length}function pb(t){for(const e in t)return t[e];return null}function db(t,e,r,n,i,s,a,o,l,u,c){let h,p,d,f;if(h=c?c.top:a.top,p=c?c.bottom:a.bottom,d=c?c.left:a.left,f=c?c.right:a.right,Jx(a)&&a.collisionPadding){const t=a.collisionPadding;d-=t[0],h-=t[1],f+=t[2],p+=t[3]}if(l){const t=new $t(d,h),e=new $t(f,h),r=new $t(d,p),n=new $t(f,p),i=Xt(l);let s=new $t(0,0);u&&(s=new $t(u[0],u[1])),t._rotateAround(i,s),e._rotateAround(i,s),r._rotateAround(i,s),n._rotateAround(i,s),d=Math.min(t.x,e.x,r.x,n.x),f=Math.max(t.x,e.x,r.x,n.x),h=Math.min(t.y,e.y,r.y,n.y),p=Math.max(t.y,e.y,r.y,n.y)}return t.emplaceBack(e.x,e.y,e.z,r.x,r.y,d,h,f,p,o,n,i,s),t.length-1}function fb(t){Jx(t)&&t.collisionPadding&&(t.top-=t.collisionPadding[1],t.bottom+=t.collisionPadding[3]);const e=t.bottom-t.top;return e>0?Math.max(10,e):null}function mb(t,e,r,n){const i=t.compareText;if(e in i){const t=i[e];for(let e=t.length-1;e>=0;e--)if(n.dist(t[e])<r)return!0}else i[e]=[];return i[e].push(n),!1}function yb(t,e){const r=t.fovAboveCenter,n=t.elevation?t.elevation.getMinElevationBelowMSL()*e:0,i=(t._camera.position[2]*t.worldSize-n)/Math.cos(t._pitch),s=Math.sin(r)*i/Math.sin(Math.max(Math.PI/2-t._pitch-r,.01));let a=Math.sin(t._pitch)*s+i;const o=i*(1/t._horizonShift);if(!t.elevation||0===t.elevation.exaggeration()){let e=Math.max(t.zoom-17,0);t.isOrthographic&&(e/=10),a*=1+e}return Math.min(1.01*a,o)}function gb(t,e){if(!e.isReprojectedInTileSpace)return{scale:1<<t.z,x:t.x,y:t.y,x2:t.x+1,y2:t.y+1,projection:e};const r=Math.pow(2,-t.z),n=t.x*r,i=(t.x+1)*r,s=t.y*r,a=(t.y+1)*r,o=Ic(n),l=Ic(i),u=Mc(s),c=Mc(a),h=e.project(o,u),p=e.project(l,u),d=e.project(l,c),f=e.project(o,c);let m=Math.min(h.x,p.x,d.x,f.x),y=Math.min(h.y,p.y,d.y,f.y),g=Math.max(h.x,p.x,d.x,f.x),x=Math.max(h.y,p.y,d.y,f.y);const v=r/16;function b(t,r,n,i,s,a){const o=(n+s)/2,l=(i+a)/2,u=e.project(Ic(o),Mc(l)),c=Math.max(0,m-u.x,y-u.y,u.x-g,u.y-x);m=Math.min(m,u.x),g=Math.max(g,u.x),y=Math.min(y,u.y),x=Math.max(x,u.y),c>v&&(b(t,u,n,i,o,l),b(u,r,o,l,s,a))}b(h,p,n,s,i,s),b(p,d,i,s,i,a),b(d,f,i,a,n,a),b(f,h,n,a,n,s),m-=v,y-=v,g+=v,x+=v;const w=1/Math.max(g-m,x-y);return{scale:w,x:m*w,y:y*w,x2:g*w,y2:x*w,projection:e}}function xb(t,e,r,n,i,s,a,o,l){if("globe"===l.name)return lp(t,e,new Gh(r,n,i),!1);const u=gb({z:r,x:n,y:i},l);return new mh([(s+u.x/u.scale)*e,e*(u.y/u.scale),a],[(s+u.x2/u.scale)*e,e*(u.y2/u.scale),o])}function vb(t,{x:e,y:r},n=0){return new $t(((e-n)*t.scale-t.x)*Ui,(r*t.scale-t.y)*Ui)}function bb(t,e,r=0){return F(((e.x-r)*t.scale-t.x)*Ui,(e.y*t.scale-t.y)*Ui,Sc(e.z,e.y))}const wb=f(new Float32Array(16));class _b{constructor(t){this.spec=t,this.name=t.name,this.wrap=!1,this.requiresDraping=!1,this.supportsWorldCopies=!1,this.supportsTerrain=!1,this.supportsFog=!1,this.supportsFreeCamera=!1,this.zAxisUnit="meters",this.isReprojectedInTileSpace=!0,this.unsupportedLayers=["custom"],this.center=[0,0],this.range=[3.5,7]}project(t,e){return{x:0,y:0,z:0}}unproject(t,e){return new yc(0,0)}projectTilePoint(t,e,r){return{x:t,y:e,z:0}}locationPoint(t,e,r,n=!0){return t._coordinatePoint(t.locationCoordinate(e,r),n)}pixelsPerMeter(t,e){return Ac(1,t)*e}pixelSpaceConversion(t,e,r){return 1}farthestPixelDistance(t){return yb(t,t.pixelsPerMeter)}pointCoordinate(t,e,r,n){const i=t.horizonLineFromTop(!1),s=new $t(e,Math.max(i,r));return t.rayIntersectionCoordinate(t.pointRayIntersection(s,n))}pointCoordinate3D(t,e,r){const n=new $t(e,r);if(t.elevation)return t.elevation.pointCoordinate(n);{const e=this.pointCoordinate(t,n.x,n.y,0);return[e.x,e.y,e.z]}}isPointAboveHorizon(t,e){if(t.elevation&&t.elevation.visibleDemTiles.length)return!this.pointCoordinate3D(t,e.x,e.y);const r=t.horizonLineFromTop();return e.y<r}createInversionMatrix(t,e){return wb}createTileMatrix(t,e,r){let n,i,s;const a=r.canonical,o=f(new Float64Array(16));if(this.isReprojectedInTileSpace){const l=gb(a,this);n=1,i=l.x+r.wrap*l.scale,s=l.y,v(o,o,[n/l.scale,n/l.scale,t.pixelsPerMeter/e])}else n=e/t.zoomScale(a.z),i=(a.x+Math.pow(2,a.z)*r.wrap)*n,s=a.y*n;return x(o,o,[i,s,0]),v(o,o,[n/Ui,n/Ui,1]),o}upVector(t,e,r){return[0,0,1]}upVectorScale(t,e,r){return{metersToTile:1}}}class Ab extends _b{constructor(t){super(t),this.range=[4,7],this.center=t.center||[-96,37.5];const[e,r]=this.parallels=t.parallels||[29.5,45.5],n=Math.sin(Xt(e));this.n=(n+Math.sin(Xt(r)))/2,this.c=1+n*(2*this.n-n),this.r0=Math.sqrt(this.c)/this.n}project(t,e){const{n:r,c:n,r0:i}=this,s=Xt(t-this.center[0]),a=Xt(e),o=Math.sqrt(n-2*r*Math.sin(a))/r;return{x:o*Math.sin(s*r),y:o*Math.cos(s*r)-i,z:0}}unproject(t,e){const{n:r,c:n,r0:i}=this,s=i+e;let a=Math.atan2(t,Math.abs(s))*Math.sign(s);s*r<0&&(a-=Math.PI*Math.sign(t)*Math.sign(s));const o=Xt(this.center[0])*r;a=ae(a,-Math.PI-o,Math.PI-o);const l=ie(Zt(a/r)+this.center[0],-180,180),u=Math.asin(ie((n-(t*t+s*s)*r*r)/(2*r),-1,1)),c=ie(Zt(u),-Pc,Pc);return new yc(l,c)}}const Ib=1.340264,Mb=-.081106,Sb=893e-6,Pb=.003796,kb=Math.sqrt(3)/2;class Bb extends _b{project(t,e){e=e/180*Math.PI,t=t/180*Math.PI;const r=Math.asin(kb*Math.sin(e)),n=r*r,i=n*n*n;return{x:.5*(t*Math.cos(r)/(kb*(Ib+3*Mb*n+i*(7*Sb+9*Pb*n)))/Math.PI+.5),y:1-.5*(r*(Ib+Mb*n+i*(Sb+Pb*n))/Math.PI+1),z:0}}unproject(t,e){t=(2*t-.5)*Math.PI;let r=e=(2*(1-e)-1)*Math.PI,n=r*r,i=n*n*n;for(let t,s,a,o=0;o<12&&(s=r*(Ib+Mb*n+i*(Sb+Pb*n))-e,a=Ib+3*Mb*n+i*(7*Sb+9*Pb*n),t=s/a,r=ie(r-t,-Math.PI/3,Math.PI/3),n=r*r,i=n*n*n,!(Math.abs(t)<1e-12));++o);const s=kb*t*(Ib+3*Mb*n+i*(7*Sb+9*Pb*n))/Math.cos(r),a=Math.asin(Math.sin(r)/kb),o=ie(180*s/Math.PI,-180,180),l=ie(180*a/Math.PI,-Pc,Pc);return new yc(o,l)}}class zb extends _b{constructor(t){super(t),this.wrap=!0,this.supportsWorldCopies=!0}project(t,e){return{x:.5+t/360,y:.5-e/360,z:0}}unproject(t,e){const r=360*(t-.5),n=ie(360*(.5-e),-Pc,Pc);return new yc(r,n)}}const Tb=Math.PI/2;function Eb(t){return Math.tan((Tb+t)/2)}class Vb extends _b{constructor(t){super(t),this.center=t.center||[0,30];const[e,r]=this.parallels=t.parallels||[30,30];let n=Xt(e),i=Xt(r);this.southernCenter=n+i<0,this.southernCenter&&(n=-n,i=-i);const s=Math.cos(n),a=Eb(n);this.n=n===i?Math.sin(n):Math.log(s/Math.cos(i))/Math.log(Eb(i)/a),this.f=s*Math.pow(Eb(n),this.n)/this.n}project(t,e){e=Xt(e),this.southernCenter&&(e=-e),t=Xt(t-this.center[0]);const r=1e-6,{n,f:i}=this;i>0?e<-Tb+r&&(e=-Tb+r):e>Tb-r&&(e=Tb-r);const s=i/Math.pow(Eb(e),n);let a=s*Math.sin(n*t),o=i-s*Math.cos(n*t);return a=.5*(a/Math.PI+.5),o=.5*(o/Math.PI+.5),{x:a,y:this.southernCenter?o:1-o,z:0}}unproject(t,e){t=(2*t-.5)*Math.PI,this.southernCenter&&(e=1-e),e=(2*(1-e)-.5)*Math.PI;const{n:r,f:n}=this,i=n-e,s=Math.sign(i),a=Math.sign(r)*Math.sqrt(t*t+i*i);let o=Math.atan2(t,Math.abs(i))*s;i*r<0&&(o-=Math.PI*Math.sign(t)*s);const l=ie(Zt(o/r)+this.center[0],-180,180),u=ie(Zt(2*Math.atan(Math.pow(n/a,1/r))-Tb),-Pc,Pc);return new yc(l,this.southernCenter?-u:u)}}class Fb extends _b{constructor(t){super(t),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(t,e){return{x:wc(t),y:_c(e),z:0}}unproject(t,e){const r=Ic(t),n=Mc(e);return new yc(r,n)}}const Cb=Xt(Pc);class Db extends _b{project(t,e){const r=(e=Xt(e))*e,n=r*r;return{x:.5*((t=Xt(t))*(.8707-.131979*r+n*(n*(.003971*r-.001529*n)-.013791))/Math.PI+.5),y:1-.5*(e*(1.007226+r*(.015085+n*(.028874*r-.044475-.005916*n)))/Math.PI+1),z:0}}unproject(t,e){t=(2*t-.5)*Math.PI;let r=e=(2*(1-e)-1)*Math.PI,n=25,i=0,s=r*r;do{s=r*r;const t=s*s;i=(r*(1.007226+s*(.015085+t*(.028874*s-.044475-.005916*t)))-e)/(1.007226+s*(.045255+t*(.259866*s-.311325-.005916*11*t))),r=ie(r-i,-Cb,Cb)}while(Math.abs(i)>1e-6&&--n>0);s=r*r;const a=ie(Zt(t/(.8707+s*(s*(s*s*s*(.003971-.001529*s)-.013791)-.131979))),-180,180),o=Zt(r);return new yc(a,o)}}const Rb=Xt(Pc);class Lb extends _b{project(t,e){e=Xt(e),t=Xt(t);const r=Math.cos(e),n=2/Math.PI,i=Math.acos(r*Math.cos(t/2)),s=Math.sin(i)/i,a=.5*(t*n+2*r*Math.sin(t/2)/s)||0,o=.5*(e+Math.sin(e)/s)||0;return{x:.5*(a/Math.PI+.5),y:1-.5*(o/Math.PI+1),z:0}}unproject(t,e){let r=t=(2*t-.5)*Math.PI,n=e=(2*(1-e)-1)*Math.PI,i=25;const s=1e-6;let a=0,o=0;do{const i=Math.cos(n),s=Math.sin(n),l=2*s*i,u=s*s,c=i*i,h=Math.cos(r/2),p=Math.sin(r/2),d=2*h*p,f=p*p,m=1-c*h*h,y=m?1/m:0,g=m?Math.acos(i*h)*Math.sqrt(1/m):0,x=.5*(2*g*i*p+2*r/Math.PI)-t,v=.5*(g*s+n)-e,b=.5*y*(c*f+g*i*h*u)+1/Math.PI,w=y*(d*l/4-g*s*p),_=.125*y*(l*p-g*s*c*d),A=.5*y*(u*h+g*f*i)+.5,I=w*_-A*b;a=(v*w-x*A)/I,o=(x*_-v*b)/I,r=ie(r-a,-Math.PI,Math.PI),n=ie(n-o,-Rb,Rb)}while((Math.abs(a)>s||Math.abs(o)>s)&&--i>0);return new yc(Zt(r),Zt(n))}}class Ob extends _b{constructor(t){super(t),this.center=t.center||[0,0],this.parallels=t.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(Xt(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(t,e){const{scale:r,cosPhi:n}=this;return{x:Xt(t)*n*r+.5,y:-Math.sin(Xt(e))/n*r+.5,z:0}}unproject(t,e){const{scale:r,cosPhi:n}=this,i=-(e-.5)/r,s=ie(Zt((t-.5)/r)/n,-180,180),a=Math.asin(ie(i*n,-1,1)),o=ie(Zt(a),-Pc,Pc);return new yc(s,o)}}class Ub extends Fb{constructor(t){super(t),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug"],this.range=[3,5]}projectTilePoint(t,e,r){const n=hp(t,e,r);return K(n,n,mp(ip(r))),{x:n[0],y:n[1],z:n[2]}}locationPoint(t,e,r){const n=dc(e.lat,e.lng),i=X([],n),s=r?t._centerAltitude+r:t.elevation?t.elevation.getAtPointOrZero(t.locationCoordinate(e),t._centerAltitude):t._centerAltitude;j(n,n,i,Ac(1,0)*Ui*s);const a=f(new Float64Array(16));return g(a,t.pixelMatrix,t.globeMatrix),K(n,n,a),new $t(n[0],n[1])}pixelsPerMeter(t,e){return Ac(1,0)*e}pixelSpaceConversion(t,e,r){const n=Ac(1,t)*e,i=dn(Ac(1,45)*e,n,r);return this.pixelsPerMeter(t,e)/i}createTileMatrix(t,e,r){const n=yp(ip(r.canonical));return g(new Float64Array(16),t.globeMatrix,n)}createInversionMatrix(t,e){const{center:r}=t,n=mp(ip(e));return w(n,n,Xt(r.lng)),b(n,n,Xt(r.lat)),v(n,n,[t._pixelsPerMercatorPixel,t._pixelsPerMercatorPixel,1]),Float32Array.from(n)}pointCoordinate(t,e,r,n){return ep(t,e,r,!0)||new Ec(0,0)}pointCoordinate3D(t,e,r){const n=this.pointCoordinate(t,e,r,0);return[n.x,n.y,n.z]}isPointAboveHorizon(t,e){return!ep(t,e.x,e.y,!1)}farthestPixelDistance(t){const e=function(t,e){const r=t.cameraToCenterDistance,n=t._centerAltitude*e,i=t._camera,s=t._camera.forward(),a=D([],N([],s,-r),[0,0,n]),o=t.worldSize/(2*Math.PI),l=[0,0,-o],u=t.width/t.height,c=Math.tan(t.fovAboveCenter),h=N([],i.up(),c),p=N([],i.right(),c*u),d=X([],D([],D([],s,h),p)),f=[];let m;if(new ih(a,d).closestPointOnSphere(l,o,f)){const e=D([],f,l),r=rt([],e,a);m=Math.cos(t.fovAboveCenter)*V(r)}else{const t=rt([],a,l),e=rt([],l,a);X(e,e);const r=V(t)-o;m=Math.sqrt(r*(r+2*o));const n=Math.acos(m/(o+r))-Math.acos(Z(s,e));m*=Math.cos(n)}return 1.01*m}(t,this.pixelsPerMeter(t.center.lat,t.worldSize)),r=Ap(t.zoom);if(r>0){const n=yb(t,Ac(1,t.center.lat)*t.worldSize),i=t.worldSize/(2*Math.PI),s=Math.max(t.width,t.height)/t.worldSize*Math.PI;return dn(e,n+i*(1-Math.cos(s)),Math.pow(r,10))}return e}upVector(t,e,r){return hp(e,r,t,1)}upVectorScale(t){return{metersToTile:Qh(dp(ip(t)))}}}function Nb(t){const e=t.parallels,r=!!e&&Math.abs(e[0]+e[1])<.01;switch(t.name){case"mercator":return new Fb(t);case"equirectangular":return new zb(t);case"naturalEarth":return new Db(t);case"equalEarth":return new Bb(t);case"winkelTripel":return new Lb(t);case"albers":return r?new Ob(t):new Ab(t);case"lambertConformalConic":return r?new Ob(t):new Vb(t);case"globe":return new Ub(t)}throw new Error(`Invalid projection name: ${t.name}`)}const jb=jc.types,$b=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Gb(t,e,r,n,i,s,a,o,l,u,c,h,p){const d=o?Math.min(cb,Math.round(o[0])):0,f=o?Math.min(cb,Math.round(o[1])):0;t.emplaceBack(e,r,Math.round(32*n),Math.round(32*i),s,a,(d<<1)+(l?1:0),0+(f<<1),16*u,16*c,256*h,256*p)}function qb(t,e,r){t.emplaceBack(e,r)}function Hb(t,e,r,n,i,s,a){t.emplaceBack(e,r,n,i,s,a)}function Xb(t,e,r,n,i){const s=5*e+2;t.float32[s+0]=r,t.float32[s+1]=n,t.float32[s+2]=i}const Zb=(t,e,r,n)=>{for(let i=0;i<e;i++)t.emplaceBack(r[0],r[1],r[2],n[0],n[1],n[2])};function Wb(t,e,r,n,i){t.emplaceBack(e,r,n,i),t.emplaceBack(e,r,n,i),t.emplaceBack(e,r,n,i),t.emplaceBack(e,r,n,i)}function Yb(t){for(const e of t.sections)if(po(e.text))return!0;return!1}class Kb{constructor(t){this.layoutVertexArray=new Fl,this.indexArray=new $l,this.programConfigurations=t,this.segments=new bu,this.dynamicLayoutVertexArray=new Dl,this.opacityVertexArray=new Rl,this.placedSymbolArray=new ou,this.iconTransitioningVertexArray=new Ll,this.globeExtVertexArray=new Cl,this.zOffsetVertexArray=new Ml,this.orientationVertexArray=new Hl,this.symbolInstanceIndices=[]}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length&&0===this.iconTransitioningVertexArray.length}getIconVertexData(t,e){const r=[],n=this.layoutVertexArray.uint16;for(let i=0;i<e;++i){const e=12*(t+i);r.push(...n.slice(e,e+12))}return r}updateIconVertexData(t,e,r,n,i,s,a,o,l,u,c,h,p){const d=this.layoutVertexArray.uint16,f=12*t;d[f]=e,d[f+1]=r,d[f+2]=n,d[f+3]=i,d[f+4]=s,d[f+5]=a,d[f+6]=o,d[f+7]=l,d[f+8]=u,d[f+9]=c,d[f+10]=h,d[f+11]=p}upload(t,e,r,n,i,s){this.isEmpty()||(r&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,nx.members,!!s),this.indexBuffer=t.createIndexBuffer(this.indexArray,e),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,sx.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,$b,!0),this.iconTransitioningVertexArray.length>0&&(this.iconTransitioningVertexBuffer=t.createVertexBuffer(this.iconTransitioningVertexArray,lx.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=t.createVertexBuffer(this.globeExtVertexArray,ix.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||i)&&(this.zOffsetVertexBuffer=t.createVertexBuffer(this.zOffsetVertexArray,ax.members,!0)),!this.orientationVertexBuffer&&this.orientationVertexArray&&this.orientationVertexArray.length>0&&(this.orientationVertexBuffer=t.createVertexBuffer(this.orientationVertexArray,ox.members,!0)),this.opacityVertexBuffer.itemSize=1),(r||n)&&this.programConfigurations.upload(t))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy(),this.iconTransitioningVertexBuffer&&this.iconTransitioningVertexBuffer.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.orientationVertexBuffer&&this.orientationVertexBuffer.destroy())}}Qa(Kb,"SymbolBuffers");class Jb{constructor(t,e,r){this.layoutVertexArray=new t,this.layoutAttributes=e,this.indexArray=new r,this.segments=new bu,this.collisionVertexArray=new jl,this.collisionVertexArrayExt=new Dl}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,ux.members,!0),this.collisionVertexBufferExt=t.createVertexBuffer(this.collisionVertexArrayExt,cx.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}Qa(Jb,"CollisionBuffers");class Qb{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.fqid)),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.hasAnyIconTextFit=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=f([]),this.placementViewportMatrix=f([]);const e=this.layers[0]._unevaluatedLayout._values;this.worldview=t.worldview,this.localizable=t.localizable,this.textSizeData=sv(this.zoom,e["text-size"],this.worldview),this.iconSizeData=sv(this.zoom,e["icon-size"],this.worldview);const r=this.layers[0].layout,n=r.get("symbol-sort-key"),i=r.get("symbol-z-order");this.lut=t.lut,this.canOverlap=r.get("text-allow-overlap")||r.get("icon-allow-overlap")||r.get("text-ignore-placement")||r.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==i&&void 0!==n.constantOr(1),this.sortFeaturesByY=("viewport-y"===i||"auto"===i&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=r.get("text-writing-mode").map((t=>Lx[t])),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.sourceID=t.sourceID,this.projection=t.projection,this.hasAnyZOffset=!1,this.zOffsetSortDirty=!1,this.zOffsetBuffersNeedUpload=!1,this.elevationType="none",this.elevationStateComplete=!1,this.activeReplacements=[],this.replacementUpdateTime=0,this.hasAnySecondaryIcon=!1,this.hasAppearances=null,this.lastActiveApperance=null,this.featureToAppearanceIndex={}}hasAnyAppearanceProperty(t){const e=this.layers[0].getAppearances();return!(!e||0===e.length)&&e.some((e=>null!=e.getProperty(t)))}createArrays(){this.text=new Kb(new Yu(this.layers,{zoom:this.zoom,lut:this.lut},(t=>t.startsWith("text")||t.startsWith("symbol")))),this.icon=new Kb(new Yu(this.layers,{zoom:this.zoom,lut:this.lut},(t=>t.startsWith("icon")||t.startsWith("symbol")))),this.glyphOffsetArray=new cu,this.lineVertexArray=new hu,this.symbolInstances=new uu}calculateGlyphDependencies(t,e,r,n,i){for(const r of t){const t=r.codePointAt(0);if(void 0===t)break;if(e[t]=!0,n&&i&&t<=65535){const t=mx[r];t&&(e[t.charCodeAt(0)]=!0)}}}calculateEffectiveAppearanceIconSize(t,e,r,n,i,s){let a=1;const o=t.getUnevaluatedProperties()._values["icon-size"],l=sv(this.zoom,o,this.worldview),u=ov(l,e);if("constant"!==l.kind&&"camera"!==l.kind||(a=u.uSize),"composite"===l.kind){const{minZoom:t,maxZoom:e}=l,s=o.possiblyEvaluate(new Po(t,{worldview:this.worldview}),n),c=o.possiblyEvaluate(new Po(e,{worldview:this.worldview}),n),h=s.evaluate(r,{},n,i);a=h+(c.evaluate(r,{},n,i)-h)*u.uSizeT}return"source"===l.kind&&(a=o.possiblyEvaluate(new Po(this.zoom,{worldview:this.worldview}),n).evaluate(r,{},n,i)),a*s}updateFootprints(t,e){}updateReplacement(t,e){if(e.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=e.updateTime;const r=e.getReplacementRegionsForTile(t.toUnwrapped(),!0);return!wf(this.activeReplacements,r)&&(this.activeReplacements=r,!0)}getResolvedImageFromTokens(t){return"string"==typeof t?On.build(t):t}populate(t,e,r,n){const i=this.layers[0],s=i.layout,a="globe"===this.projection.name,o=s.get("text-font"),l=s.get("text-field"),u=s.get("icon-image"),[c,h]=s.get("icon-size-scale-range"),p=ie(e.scaleFactor||1,c,h),d=("constant"!==l.value.kind||l.value.value instanceof Rn&&!l.value.value.isEmpty()||l.value.value.toString().length>0)&&("constant"!==o.value.kind||o.value.value.length>0),f="constant"!==u.value.kind||!!u.value.value||Object.keys(u.parameters).length>0,m=this.hasAnyAppearanceProperty("icon-image"),y=s.get("symbol-sort-key");if(this.features=[],this.appearanceFeatureData=[],!d&&!f&&!m)return;const g=e.iconDependencies,x=e.glyphDependencies,v=e.availableImages,b=new Po(this.zoom,{worldview:this.worldview,activeFloors:e.activeFloors}),w=t=>{const e=t.id.toString();g.has(e)?g.get(e).push(t):g.set(e,[t])};for(const e of t){const{feature:t,id:l,index:u,sourceLayerIndex:c}=e,h=i._featureFilter.needGeometry,_=Nc(t,h);if(!i._featureFilter.filter(b,_,r))continue;if(h||(_.geometry=Uc(t,r,n)),a&&1!==t.type&&r.z<=5){const t=_.geometry,e=.98078528056,n=(t,n)=>Z(hp(t.x,t.y,r,1),hp(n.x,n.y,r,1))<e;for(let e=0;e<t.length;e++)t[e]=Dc(t[e],n)}let A,I;if(d){const t=i.getValueAndResolveTokens("text-field",_,r,v),e=Rn.factory(t);Yb(e)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===wo()||this.hasRTLText&&Mo.isParsed())&&(A=fx(e,i,_))}if(f){const t=i.getValueAndResolveTokens("icon-image",_,r,v);I=this.getResolvedImageFromTokens(t)}const M=this.layers[0];let S=!1;if(!I&&m){const t=M.getAppearances();for(const e of t)if(e.getProperty("icon-image")){const t=M.getAppearanceValueAndResolveTokens(e,"icon-image",_,r,v);if(t){I=this.getResolvedImageFromTokens(t),S=!0;break}}}if(!A&&!I)continue;const P=this.sortFeaturesByKey?y.evaluate(_,{},r):void 0,k={id:l,text:A,icon:I,index:u,sourceLayerIndex:c,geometry:_.geometry,properties:t.properties,type:jb[t.type],sortKey:P};if(this.features.push(k),this.featureToAppearanceIndex[u]=this.appearanceFeatureData.length,this.appearanceFeatureData.push({id:l,properties:t.properties,usesAppearanceIconAsPlaceholder:S,isUsingAppearanceVertexData:!1,layoutBasedVertexData:[],activeAppearance:null}),I){const t=M._unevaluatedLayout._values,{iconPrimary:e,iconSecondary:n}=tb(I,this.iconSizeData,t["icon-size"],r,this.zoom,k,this.pixelRatio,p,this.worldview);w(e),n&&(this.hasAnySecondaryIcon=!0,w(n))}const B=M.getAppearances();if(0!==B.length&&B.forEach((t=>{if(!t.getProperty("icon-image"))return;const e=this.getCombinedIconPrimary(t,M,_,r,v,k,p);e&&w(e)})),A){const t=o.evaluate(_,{},r).join(","),e="map"===s.get("text-rotation-alignment")&&"point"!==s.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(Lx.vertical)>=0;for(const r of A.sections)if(r.image){const t=r.image.getPrimary().scaleSelf(this.pixelRatio),e=t.id.toString(),n=g.get(e)||[];n.push(t),g.set(e,n)}else{const n=io(A.toString()),i=r.fontStack||t,s=x[i]=x[i]||{};this.calculateGlyphDependencies(r.text,s,e,this.allowVerticalPlacement,n)}}}if("line"===s.get("symbol-placement")&&(this.features=function(t){const e={},r={},n=[];let i=0;function s(e){n.push(t[e]),i++}function a(t,e,i){const s=r[t];return delete r[t],r[e]=s,n[s].geometry[0].pop(),n[s].geometry[0]=n[s].geometry[0].concat(i[0]),s}function o(t,r,i){const s=e[r];return delete e[r],e[t]=s,n[s].geometry[0].shift(),n[s].geometry[0]=i[0].concat(n[s].geometry[0]),s}function l(t,e,r){const n=r?e[0][e[0].length-1]:e[0][0];return`${t}:${n.x}:${n.y}`}for(let u=0;u<t.length;u++){const c=t[u],h=c.geometry,p=c.text?c.text.toString():null;if(!p){s(u);continue}const d=l(p,h),f=l(p,h,!0);if(d in r&&f in e&&r[d]!==e[f]){const t=o(d,f,h),i=a(d,f,n[t].geometry);delete e[d],delete r[f],r[l(p,n[i].geometry,!0)]=i,n[t].geometry=null}else d in r?a(d,f,h):f in e?o(d,f,h):(s(u),e[d]=i-1,r[f]=i-1)}return n.filter((t=>t.geometry))}(this.features)),"hd-road-markup"===s.get("symbol-elevation-reference")){if(this.elevationType="road",e.elevationFeatures){!this.elevationFeatures&&e.elevationFeatures.length>0&&(this.elevationFeatures=[],this.elevationFeatureIdToIndex=new Map);for(const t of e.elevationFeatures)this.elevationFeatureIdToIndex.set(t.id,this.elevationFeatures.length),this.elevationFeatures.push(t)}}else s.get("symbol-z-elevate")&&(this.elevationType="offset");"none"!==this.elevationType&&(this.zOffsetBuffersNeedUpload=!0),this.sortFeaturesByKey&&this.features.sort(((t,e)=>t.sortKey-e.sortKey))}getCombinedIconPrimary(t,e,r,n,i,s,a){let o,l;const u=t.getUnevaluatedProperties();if(void 0!==u._values["icon-image"].value){const s=e.getAppearanceValueAndResolveTokens(t,"icon-image",r,n,i);o=this.getResolvedImageFromTokens(s)}else{const t=e.getValueAndResolveTokens("icon-image",r,n,i);o=this.getResolvedImageFromTokens(t)}if(o){const t=u._values["icon-size"]||e._unevaluatedLayout._values["icon-size"];l=tb(o,sv(this.zoom,t,this.worldview),t,n,this.zoom,s,this.pixelRatio,a,this.worldview).iconPrimary}return l}updateAppearanceBasedIconTextures(t,e,r,n){if(!this.appearanceFeatureData)return!1;if(!this.icon.layoutVertexArray||0===this.icon.layoutVertexArray.length)return!1;const i=this.layers[0];let s=!1,a=0;const o=i.layout,[l,u]=o.get("icon-size-scale-range"),c=ie(1,l,u);for(let o=0;o<this.symbolInstances.length;o++){const l=this.symbolInstances.get(o),u=this.featureToAppearanceIndex[l.featureIndex],h=void 0!==u?this.appearanceFeatureData[u]:void 0;if(h&&l.placedIconSymbolIndex>=0){const o=h.id,u=e&&void 0!==o?e[String(o)]:void 0,p={type:"Point",id:h.id,properties:h.properties,geometry:[]},d=this.layers[0].appearances&&this.layers[0].appearances.find((e=>e.isActive({globals:n,feature:p,canonical:t,featureState:u})));if(h.activeAppearance===d){a+=l.numIconVertices;continue}if(d){h.activeAppearance=d;const e=this.getCombinedIconPrimary(d,i,p,t,r,{sortKey:void 0,text:void 0,icon:null,index:l.featureIndex,sourceLayerIndex:l.featureIndex,geometry:[],properties:h.properties,type:"Point",id:h.id},c);if(!e)continue;const o=e.toString(),u=this.iconAtlasPositions&&this.iconAtlasPositions.get(o);if(u){const e=i.getAppearanceValueAndResolveTokens(d,"icon-offset",p,t,r),o=e&&Array.isArray(e)?e:[0,0];let f=Qx(u,void 0,o,i.layout.get("icon-anchor").evaluate(p,{},t));const m=i.getAppearanceValueAndResolveTokens(d,"icon-rotate",p,t,r),y="number"==typeof m?m:0,g=u.sdf,x=i.layout.get("icon-text-fit").constantOr("none");"none"!==x&&h.textShaping&&h.iconTextFitPadding&&h.fontScale&&(f=tv(f,h.textShaping,x,h.iconTextFitPadding,o,h.fontScale));const v=this.calculateEffectiveAppearanceIconSize(d,n.zoom,p,t,r,c),b=0,w=1+(Math.min(cb,Math.round(v*iv))<<1),_=zv(f,y,g,"none"!==x,c);h.isUsingAppearanceVertexData||(h.isUsingAppearanceVertexData=!0,h.layoutBasedVertexData=this.icon.getIconVertexData(a,l.numIconVertices));for(let t=0;t<_.length;++t){const e=_[t],r=h.layoutBasedVertexData[0]||l.tileAnchorX,n=h.layoutBasedVertexData[1]||l.tileAnchorY,i=16*e.pixelOffsetTL.x,s=16*e.pixelOffsetTL.y,o=16*e.pixelOffsetBR.x,u=16*e.pixelOffsetBR.y,c=16*e.minFontScaleX,p=16*e.minFontScaleY;this.icon.updateIconVertexData(a,r,n,Math.round(32*e.tl.x),Math.round(32*e.tl.y),e.texPrimary.x,e.texPrimary.y,b,w,i,s,c,p),this.icon.updateIconVertexData(a+1,r,n,Math.round(32*e.tr.x),Math.round(32*e.tr.y),e.texPrimary.x+e.texPrimary.w,e.texPrimary.y,b,w,o,s,c,p),this.icon.updateIconVertexData(a+2,r,n,Math.round(32*e.bl.x),Math.round(32*e.bl.y),e.texPrimary.x,e.texPrimary.y+e.texPrimary.h,b,w,i,u,c,p),this.icon.updateIconVertexData(a+3,r,n,Math.round(32*e.br.x),Math.round(32*e.br.y),e.texPrimary.x+e.texPrimary.w,e.texPrimary.y+e.texPrimary.h,b,w,o,u,c,p),a+=4}const A=l.numIconVertices-4*_.length;for(let t=0;t<A;++t)this.icon.updateIconVertexData(a+t,0,0,0,0,0,0,0,0,0,0,0,0);s=!0}else a+=l.numIconVertices}else if(h.usesAppearanceIconAsPlaceholder)this.layers[0].appearances&&this.layers[0].appearances.length>0&&(this.icon.updateIconVertexData(a,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateIconVertexData(a+1,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateIconVertexData(a+2,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateIconVertexData(a+3,0,0,0,0,0,0,0,0,0,0,0,0),s=!0),a+=l.numIconVertices,h.activeAppearance=null;else if(h.isUsingAppearanceVertexData){const t=12,e=h.layoutBasedVertexData.length/t;for(let r=0;r<e;++r){const e=r*t;this.icon.updateIconVertexData(a+r,h.layoutBasedVertexData[e+0],h.layoutBasedVertexData[e+1],h.layoutBasedVertexData[e+2],h.layoutBasedVertexData[e+3],h.layoutBasedVertexData[e+4],h.layoutBasedVertexData[e+5],h.layoutBasedVertexData[e+6],h.layoutBasedVertexData[e+7],h.layoutBasedVertexData[e+8],h.layoutBasedVertexData[e+9],h.layoutBasedVertexData[e+10],h.layoutBasedVertexData[e+11])}a+=e,h.isUsingAppearanceVertexData=!1,h.activeAppearance=null,s=!0}else a+=l.numIconVertices,h.activeAppearance=null}}return s}update(t,e,r,n,i,s,a){this.text.programConfigurations.updatePaintArrays(t,e,i,r,n,s,a,this.worldview),this.icon.programConfigurations.updatePaintArrays(t,e,i,r,n,s,a,this.worldview)}updateRoadElevation(t){if("road"!==this.elevationType||!this.elevationFeatures)return;if(this.elevationStateComplete)return;this.elevationStateComplete=!0,this.hasAnyZOffset=!1;let e=!1;const r=Tc(t),n=1/r;let i=!1,s=!1;for(let t=0;t<this.symbolInstances.length;t++){const a=this.symbolInstances.get(t),o=F(1,0,0),l=F(0,1,0),{numHorizontalGlyphVertices:u,numVerticalGlyphVertices:c,numIconVertices:h,numVerticalIconVertices:p}=a,d=u>0||c>0,f=h>0,m=this.elevationFeatures[a.elevationFeatureIndex];if(m){const t=new $t(a.tileAnchorX,a.tileAnchorY),u=.075+m.pointElevation(t);a.zOffset!==u&&(e=!0,a.zOffset=u),0!==u&&(this.hasAnyZOffset=!0);const c=m.computeSlopeNormal(t,n),h=Pt(ft(),F(0,0,1),c);Q(o,o,h),Q(l,l,h),o[2]*=r,l[2]*=r,1===o[0]&&0===o[1]&&0===o[2]&&0===l[0]&&1===l[1]&&0===l[2]||(i=i||d,s=s||f)}if(d&&(Zb(this.text.orientationVertexArray,u,o,l),Zb(this.text.orientationVertexArray,c,o,l)),f){const{placedIconSymbolIndex:t,verticalPlacedIconSymbolIndex:e}=a;t>=0&&Zb(this.icon.orientationVertexArray,h,o,l),e>=0&&Zb(this.icon.orientationVertexArray,p,o,l)}}i||(this.text.orientationVertexArray=void 0),s||(this.icon.orientationVertexArray=void 0),e&&(this.zOffsetBuffersNeedUpload=!0,this.zOffsetSortDirty=!0)}updateZOffset(){const t=(t,e,n)=>{r+=e,r>t.length&&t.resize(r);for(let i=-e;i<0;i++)t.emplace(i+r,n)},e=(t,e,r)=>{n+=e,n>t.length&&t.resize(n);for(let i=-e;i<0;i++)t.emplace(i+n,r)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let r=0,n=0;for(let r=0;r<this.symbolInstances.length;r++){const n=this.symbolInstances.get(r),{numHorizontalGlyphVertices:i,numVerticalGlyphVertices:s,numIconVertices:a}=n,o=n.zOffset,l=a>0;if((i>0||s>0)&&(t(this.text.zOffsetVertexArray,i,o),t(this.text.zOffsetVertexArray,s,o)),l){const{placedIconSymbolIndex:t,verticalPlacedIconSymbolIndex:r}=n;t>=0&&e(this.icon.zOffsetVertexArray,a,o),r>=0&&e(this.icon.zOffsetVertexArray,n.numVerticalIconVertices,o)}}this.text.zOffsetVertexBuffer&&this.text.zOffsetVertexBuffer.updateData(this.text.zOffsetVertexArray),this.icon.zOffsetVertexBuffer&&this.icon.zOffsetVertexBuffer.updateData(this.icon.zOffsetVertexArray)}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t,e,r,n,i){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload,!1),null===this.hasAppearances&&(this.hasAppearances=this.layers.some((t=>t.appearances&&t.appearances.length>0))),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload,this.hasAppearances),this.uploaded=!0}updateAppearances(t,e,r,n){return!!(t&&e&&r)&&!(!this.icon.layoutVertexArray||0===this.icon.layoutVertexArray.length)&&!!this.icon.layoutVertexArray.arrayBuffer&&void(this.updateAppearanceBasedIconTextures(t,e,r,n)&&this.icon.layoutVertexBuffer&&null!==this.icon.layoutVertexArray.arrayBuffer&&this.icon.layoutVertexArray.length===this.icon.layoutVertexBuffer.length&&this.icon.layoutVertexBuffer.updateData(this.icon.layoutVertexArray))}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=Nb(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,e){const r=this.lineVertexArray.length;if(void 0!==t.segment)for(const{x:t,y:r}of e)this.lineVertexArray.emplaceBack(t,r);return{lineStartIndex:r,lineLength:this.lineVertexArray.length-r}}addSymbols(t,e,r,n,i,s,a,o,l,u,c,h,p,d,f,m,y,g){const x=t.indexArray,v=t.layoutVertexArray,b=t.globeExtVertexArray,w=t.segments.prepareSegment(4*g,v,x,this.canOverlap?s.sortKey:void 0),_=this.glyphOffsetArray.length,A=w.vertexLength,I=this.allowVerticalPlacement&&a===Lx.vertical?Math.PI/2:0,M=s.text&&s.text.sections;for(let n=0;n<e.length;n++){const{tl:i,tr:a,bl:u,br:c,texPrimary:h,texSecondary:y,pixelOffsetTL:g,pixelOffsetBR:_,minFontScaleX:A,minFontScaleY:S,glyphOffset:P,isSDF:k,sectionIndex:B}=e[n],z=w.vertexLength,T=P[1];if(Gb(v,l.x,l.y,i.x,T+i.y,h.x,h.y,r,k,g.x,g.y,A,S),Gb(v,l.x,l.y,a.x,T+a.y,h.x+h.w,h.y,r,k,_.x,g.y,A,S),Gb(v,l.x,l.y,u.x,T+u.y,h.x,h.y+h.h,r,k,g.x,_.y,A,S),Gb(v,l.x,l.y,c.x,T+c.y,h.x+h.w,h.y+h.h,r,k,_.x,_.y,A,S),o){const{x:e,y:r,z:n}=o.anchor,[i,s,a]=o.up;Hb(b,e,r,n,i,s,a),Hb(b,e,r,n,i,s,a),Hb(b,e,r,n,i,s,a),Hb(b,e,r,n,i,s,a),Wb(t.dynamicLayoutVertexArray,e,r,n,I)}else Wb(t.dynamicLayoutVertexArray,l.x,l.y,l.z,I);if(m){const e=y||h;qb(t.iconTransitioningVertexArray,e.x,e.y),qb(t.iconTransitioningVertexArray,e.x+e.w,e.y),qb(t.iconTransitioningVertexArray,e.x,e.y+e.h),qb(t.iconTransitioningVertexArray,e.x+e.w,e.y+e.h)}x.emplaceBack(z,z+1,z+2),x.emplaceBack(z+1,z+2,z+3),w.vertexLength+=4,w.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(P[0]),n!==e.length-1&&B===e[n+1].sectionIndex||t.programConfigurations.populatePaintArrays(v.length,s,s.index,{},p,d,f,M&&M[B],this.worldview)}const S=g-e.length;0!==S&&this._addNullVertices(S,v,r,o,b,t,m,w,x);const P=o?o.anchor:l;t.placedSymbolArray.emplaceBack(P.x,P.y,P.z,l.x,l.y,_,this.glyphOffsetArray.length-_,A,u,c,l.segment,r?r[0]:0,r?r[1]:0,n[0],n[1],a,0,0,0,h,0),t.symbolInstanceIndices.push(y)}_addNullVertices(t,e,r,n,i,s,a,o,l){for(let u=0;u<t;u++){for(let t=0;t<4;t++)Gb(e,0,0,0,0,0,0,r,!1,0,0,0,0),n?(Hb(i,0,0,0,0,0,0),Wb(s.dynamicLayoutVertexArray,0,0,0,0)):Wb(s.dynamicLayoutVertexArray,0,0,0,0),a&&qb(s.iconTransitioningVertexArray,0,0);const t=o.vertexLength;l.emplaceBack(t,t+1,t+2),l.emplaceBack(t+1,t+2,t+3),o.vertexLength+=4,o.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(0)}}_commitLayoutVertex(t,e,r,n,i,s,a){t.emplaceBack(e,r,n,i,s,Math.round(a.x),Math.round(a.y))}_addCollisionDebugVertices(t,e,r,n,i,s,a){const o=r.segments.prepareSegment(4,r.layoutVertexArray,r.indexArray),l=o.vertexLength,u=a.tileAnchorX,c=a.tileAnchorY;for(let t=0;t<4;t++)r.collisionVertexArray.emplaceBack(0,0,0,0,0,0);this._commitDebugCollisionVertexUpdate(r.collisionVertexArrayExt,e,t.padding,a.zOffset),this._commitLayoutVertex(r.layoutVertexArray,n,i,s,u,c,new $t(t.x1,t.y1)),this._commitLayoutVertex(r.layoutVertexArray,n,i,s,u,c,new $t(t.x2,t.y1)),this._commitLayoutVertex(r.layoutVertexArray,n,i,s,u,c,new $t(t.x2,t.y2)),this._commitLayoutVertex(r.layoutVertexArray,n,i,s,u,c,new $t(t.x1,t.y2)),o.vertexLength+=4;const h=r.indexArray;h.emplaceBack(l,l+1),h.emplaceBack(l+1,l+2),h.emplaceBack(l+2,l+3),h.emplaceBack(l+3,l),o.primitiveLength+=4}_addTextDebugCollisionBoxes(t,e,r,n,i,s){for(let a=n;a<i;a++){const n=r.get(a),i=this.getSymbolInstanceTextSize(t,s,e,a);this._addCollisionDebugVertices(n,i,this.textCollisionBox,n.projectedAnchorX,n.projectedAnchorY,n.projectedAnchorZ,s)}}_addIconDebugCollisionBoxes(t,e,r,n,i,s){for(let a=n;a<i;a++){const n=r.get(a),i=this.getSymbolInstanceIconSize(t,e,s.placedIconSymbolIndex);this._addCollisionDebugVertices(n,i,this.iconCollisionBox,n.projectedAnchorX,n.projectedAnchorY,n.projectedAnchorZ,s)}}generateCollisionDebugBuffers(t,e,r){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Jb(Ul,hx.members,Ll),this.iconCollisionBox=new Jb(Ul,hx.members,Ll);const n=ov(this.iconSizeData,t),i=ov(this.textSizeData,t,r);for(let r=0;r<this.symbolInstances.length;r++){const s=this.symbolInstances.get(r);this._addTextDebugCollisionBoxes(i,t,e,s.textBoxStartIndex,s.textBoxEndIndex,s),this._addTextDebugCollisionBoxes(i,t,e,s.verticalTextBoxStartIndex,s.verticalTextBoxEndIndex,s),this._addIconDebugCollisionBoxes(n,t,e,s.iconBoxStartIndex,s.iconBoxEndIndex,s),this._addIconDebugCollisionBoxes(n,t,e,s.verticalIconBoxStartIndex,s.verticalIconBoxEndIndex,s)}}getSymbolInstanceTextSize(t,e,r,n){const i=this.text.placedSymbolArray.get(e.rightJustifiedTextSymbolIndex>=0?e.rightJustifiedTextSymbolIndex:e.centerJustifiedTextSymbolIndex>=0?e.centerJustifiedTextSymbolIndex:e.leftJustifiedTextSymbolIndex>=0?e.leftJustifiedTextSymbolIndex:e.verticalPlacedTextSymbolIndex>=0?e.verticalPlacedTextSymbolIndex:n),s=av(this.textSizeData,t,i)/dx;return this.tilePixelRatio*s}getSymbolInstanceIconSize(t,e,r){const n=this.icon.placedSymbolArray.get(r),i=av(this.iconSizeData,t,n);return this.tilePixelRatio*i}_commitDebugCollisionVertexUpdate(t,e,r,n){t.emplaceBack(e,-r,-r,n),t.emplaceBack(e,r,-r,n),t.emplaceBack(e,r,r,n),t.emplaceBack(e,-r,r,n)}_updateTextDebugCollisionBoxes(t,e,r,n,i,s,a){for(let a=n;a<i;a++){const n=r.get(a),i=this.getSymbolInstanceTextSize(t,s,e,a);this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt,i,n.padding,s.zOffset)}}_updateIconDebugCollisionBoxes(t,e,r,n,i,s,a){for(let a=n;a<i;a++){const n=r.get(a),i=this.getSymbolInstanceIconSize(t,e,s.placedIconSymbolIndex);this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt,i,n.padding,s.zOffset)}}updateCollisionDebugBuffers(t,e,r,n){if(!this.hasDebugData())return;this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexArrayExt.clear(),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexArrayExt.clear();const i=ov(this.iconSizeData,t,n),s=ov(this.textSizeData,t,r);for(let a=0;a<this.symbolInstances.length;a++){const o=this.symbolInstances.get(a);this._updateTextDebugCollisionBoxes(s,t,e,o.textBoxStartIndex,o.textBoxEndIndex,o,r),this._updateTextDebugCollisionBoxes(s,t,e,o.verticalTextBoxStartIndex,o.verticalTextBoxEndIndex,o,r),this._updateIconDebugCollisionBoxes(i,t,e,o.iconBoxStartIndex,o.iconBoxEndIndex,o,n),this._updateIconDebugCollisionBoxes(i,t,e,o.verticalIconBoxStartIndex,o.verticalIconBoxEndIndex,o,n)}this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexBufferExt&&this.textCollisionBox.collisionVertexBufferExt.updateData(this.textCollisionBox.collisionVertexArrayExt),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexBufferExt&&this.iconCollisionBox.collisionVertexBufferExt.updateData(this.iconCollisionBox.collisionVertexArrayExt)}_deserializeCollisionBoxesForSymbol(t,e,r,n,i,s,a,o,l){const u={};if(e<r){const{x1:r,y1:n,x2:i,y2:s,padding:a,projectedAnchorX:o,projectedAnchorY:l,projectedAnchorZ:c,tileAnchorX:h,tileAnchorY:p,featureIndex:d}=t.get(e);u.textBox={x1:r,y1:n,x2:i,y2:s,padding:a,projectedAnchorX:o,projectedAnchorY:l,projectedAnchorZ:c,tileAnchorX:h,tileAnchorY:p},u.textFeatureIndex=d}if(n<i){const{x1:e,y1:r,x2:i,y2:s,padding:a,projectedAnchorX:o,projectedAnchorY:l,projectedAnchorZ:c,tileAnchorX:h,tileAnchorY:p,featureIndex:d}=t.get(n);u.verticalTextBox={x1:e,y1:r,x2:i,y2:s,padding:a,projectedAnchorX:o,projectedAnchorY:l,projectedAnchorZ:c,tileAnchorX:h,tileAnchorY:p},u.verticalTextFeatureIndex=d}if(s<a){const{x1:e,y1:r,x2:n,y2:i,padding:a,projectedAnchorX:o,projectedAnchorY:l,projectedAnchorZ:c,tileAnchorX:h,tileAnchorY:p,featureIndex:d}=t.get(s);u.iconBox={x1:e,y1:r,x2:n,y2:i,padding:a,projectedAnchorX:o,projectedAnchorY:l,projectedAnchorZ:c,tileAnchorX:h,tileAnchorY:p},u.iconFeatureIndex=d}if(o<l){const{x1:e,y1:r,x2:n,y2:i,padding:s,projectedAnchorX:a,projectedAnchorY:l,projectedAnchorZ:c,tileAnchorX:h,tileAnchorY:p,featureIndex:d}=t.get(o);u.verticalIconBox={x1:e,y1:r,x2:n,y2:i,padding:s,projectedAnchorX:a,projectedAnchorY:l,projectedAnchorZ:c,tileAnchorX:h,tileAnchorY:p},u.verticalIconFeatureIndex=d}return u}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let e=0;e<this.symbolInstances.length;e++){const r=this.symbolInstances.get(e);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,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}hasIconTextFit(){return this.hasAnyIconTextFit}addIndicesForPlacedSymbol(t,e){const r=t.placedSymbolArray.get(e),n=r.vertexStartIndex+4*r.numGlyphs;for(let e=r.vertexStartIndex;e<n;e+=4)t.indexArray.emplaceBack(e,e+1,e+2),t.indexArray.emplaceBack(e+1,e+2,e+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;const e=Math.sin(t),r=Math.cos(t),n=[],i=[],s=[];for(let t=0;t<this.symbolInstances.length;++t){s.push(t);const a=this.symbolInstances.get(t);n.push(0|Math.round(e*a.tileAnchorX+r*a.tileAnchorY)),i.push(a.featureIndex)}return s.sort(((t,e)=>n[t]-n[e]||i[e]-i[t])),s}getSortedIndexesByZOffset(){if(!this.zOffsetSortDirty)return this.symbolInstanceIndexesSortedZOffset;if(!this.symbolInstanceIndexesSortedZOffset){this.symbolInstanceIndexesSortedZOffset=[];for(let t=0;t<this.symbolInstances.length;++t)this.symbolInstanceIndexesSortedZOffset.push(t)}return this.zOffsetSortDirty=!1,this.symbolInstanceIndexesSortedZOffset.sort(((t,e)=>this.symbolInstances.get(e).zOffset-this.symbolInstances.get(t).zOffset))}addToSortKeyRanges(t,e){const r=this.sortKeyRanges[this.sortKeyRanges.length-1];r&&r.sortKey===e?r.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:e,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const t of this.symbolInstanceIndexes){const e=this.symbolInstances.get(t);this.featureSortOrder.push(e.featureIndex);const{rightJustifiedTextSymbolIndex:r,centerJustifiedTextSymbolIndex:n,leftJustifiedTextSymbolIndex:i,verticalPlacedTextSymbolIndex:s,placedIconSymbolIndex:a,verticalPlacedIconSymbolIndex:o}=e;r>=0&&this.addIndicesForPlacedSymbol(this.text,r),n>=0&&n!==r&&this.addIndicesForPlacedSymbol(this.text,n),i>=0&&i!==n&&i!==r&&this.addIndicesForPlacedSymbol(this.text,i),s>=0&&this.addIndicesForPlacedSymbol(this.text,s),a>=0&&this.addIndicesForPlacedSymbol(this.icon,a),o>=0&&this.addIndicesForPlacedSymbol(this.icon,o)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}getElevationFeatureForText(t){const e=this.symbolInstances.get(this.text.symbolInstanceIndices[t]).elevationFeatureIndex;let r;return this.elevationFeatures&&e<this.elevationFeatures.length&&(r=this.elevationFeatures[e]),r}}function tw(t,e){return e.replace(/{([^{}]+)}/g,((e,r)=>r in t?String(t[r]):""))}let ew,rw,nw;Qa(Qb,"SymbolBucket",{omit:["layers","collisionBoxArray","compareText","features"]}),Qb.addDynamicAttributes=Wb;class iw{constructor(t){this.type=t.property.overrides?t.property.overrides.runtimeType:xn,this.defaultValue=t}evaluate(t){if(t.formattedSection){const e=this.defaultValue.property.overrides;if(e&&e.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Qa(iw,"FormatSectionOverride",{omit:["defaultValue"]});const sw=()=>nw||(nw={layout:ew||(ew=new No({"symbol-placement":new Do(jo.layout_symbol["symbol-placement"]),"symbol-spacing":new Do(jo.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Do(jo.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Ro(jo.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Do(jo.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new Do(jo.layout_symbol["symbol-z-elevate"]),"symbol-elevation-reference":new Do(jo.layout_symbol["symbol-elevation-reference"]),"icon-allow-overlap":new Do(jo.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new Do(jo.layout_symbol["icon-ignore-placement"]),"icon-optional":new Do(jo.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Do(jo.layout_symbol["icon-rotation-alignment"]),"icon-size":new Ro(jo.layout_symbol["icon-size"]),"icon-size-scale-range":new Do(jo.layout_symbol["icon-size-scale-range"]),"icon-text-fit":new Ro(jo.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ro(jo.layout_symbol["icon-text-fit-padding"]),"icon-image":new Ro(jo.layout_symbol["icon-image"]),"icon-image-use-theme":new Do({type:"string",default:"default","property-type":"data-constant"}),"icon-rotate":new Ro(jo.layout_symbol["icon-rotate"]),"icon-padding":new Do(jo.layout_symbol["icon-padding"]),"icon-keep-upright":new Do(jo.layout_symbol["icon-keep-upright"]),"icon-offset":new Ro(jo.layout_symbol["icon-offset"]),"icon-anchor":new Ro(jo.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Do(jo.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Do(jo.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Do(jo.layout_symbol["text-rotation-alignment"]),"text-field":new Ro(jo.layout_symbol["text-field"]),"text-font":new Ro(jo.layout_symbol["text-font"]),"text-size":new Ro(jo.layout_symbol["text-size"]),"text-size-scale-range":new Do(jo.layout_symbol["text-size-scale-range"]),"text-max-width":new Ro(jo.layout_symbol["text-max-width"]),"text-line-height":new Ro(jo.layout_symbol["text-line-height"]),"text-letter-spacing":new Ro(jo.layout_symbol["text-letter-spacing"]),"text-justify":new Ro(jo.layout_symbol["text-justify"]),"text-radial-offset":new Ro(jo.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Do(jo.layout_symbol["text-variable-anchor"]),"text-anchor":new Ro(jo.layout_symbol["text-anchor"]),"text-max-angle":new Do(jo.layout_symbol["text-max-angle"]),"text-writing-mode":new Do(jo.layout_symbol["text-writing-mode"]),"text-rotate":new Ro(jo.layout_symbol["text-rotate"]),"text-padding":new Do(jo.layout_symbol["text-padding"]),"text-keep-upright":new Do(jo.layout_symbol["text-keep-upright"]),"text-transform":new Ro(jo.layout_symbol["text-transform"]),"text-offset":new Ro(jo.layout_symbol["text-offset"]),"text-allow-overlap":new Do(jo.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new Do(jo.layout_symbol["text-ignore-placement"]),"text-optional":new Do(jo.layout_symbol["text-optional"]),visibility:new Do(jo.layout_symbol.visibility)})),paint:rw||(rw=new No({"icon-opacity":new Ro(jo.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new Ro(jo.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new Ro(jo.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new Ro(jo.paint_symbol["text-emissive-strength"]),"icon-color":new Ro(jo.paint_symbol["icon-color"]),"icon-halo-color":new Ro(jo.paint_symbol["icon-halo-color"]),"icon-halo-width":new Ro(jo.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Ro(jo.paint_symbol["icon-halo-blur"]),"icon-translate":new Do(jo.paint_symbol["icon-translate"]),"icon-translate-anchor":new Do(jo.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new Do(jo.paint_symbol["icon-image-cross-fade"]),"text-opacity":new Ro(jo.paint_symbol["text-opacity"]),"text-occlusion-opacity":new Ro(jo.paint_symbol["text-occlusion-opacity"]),"text-color":new Ro(jo.paint_symbol["text-color"],{runtimeType:_n,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new Ro(jo.paint_symbol["text-halo-color"]),"text-halo-width":new Ro(jo.paint_symbol["text-halo-width"]),"text-halo-blur":new Ro(jo.paint_symbol["text-halo-blur"]),"text-translate":new Do(jo.paint_symbol["text-translate"]),"text-translate-anchor":new Do(jo.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new Do(jo.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new Do(jo.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new Do(jo.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new Do(jo.paint_symbol["icon-color-brightness-max"]),"symbol-z-offset":new Ro(jo.paint_symbol["symbol-z-offset"]),"icon-color-use-theme":new Ro({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new Ro({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new Ro({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new Ro({type:"string",default:"default","property-type":"data-driven"})}))},nw);class aw extends ml{constructor(t,e,r,n){super(t,sw(),e,r,n,t.layout?t.layout["icon-image-use-theme"]:null),this._colorAdjustmentMatrix=f([]),this.hasOcclusionOpacityProperties=void 0!==t.paint&&("icon-occlusion-opacity"in t.paint||"text-occlusion-opacity"in t.paint)}_handleSpecialPaintPropertyUpdate(t){"icon-occlusion-opacity"!==t&&"text-occlusion-opacity"!==t||(this.hasOcclusionOpacityProperties=!0)}recalculate(t,e){super.recalculate(t,e),this.appearances&&this.appearances.forEach((r=>{r.recalculate(t,e,this.iconImageUseTheme)})),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));const r=this.layout.get("text-writing-mode");if(r){const t=[];for(const e of r)t.indexOf(e)<0&&t.push(e);this.layout._values["text-writing-mode"]=t}else this.layout._values["text-writing-mode"]="point"===this.layout.get("symbol-placement")?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getColorAdjustmentMatrix(t,e,r,n){return this._saturation===t&&this._contrast===e&&this._brightnessMin===r&&this._brightnessMax===n||(this._colorAdjustmentMatrix=function(t,e,r,n){t=Ge(t),e=$e(e);const i=h(),s=t/3,a=1-2*s,o=[a,s,s,0,s,a,s,0,s,s,a,0,0,0,0,1],l=.5-.5*e,u=n-r;return g(i,[u,0,0,0,0,u,0,0,0,0,u,0,r,r,r,1],[e,0,0,0,0,e,0,0,0,0,e,0,l,l,l,1]),g(i,i,o),i}(t,e,r,n),this._saturation=t,this._contrast=e,this._brightnessMin=r,this._brightnessMax=n),this._colorAdjustmentMatrix}getValueAndResolveTokens(t,e,r,n){const i=this.layout.get(t).evaluate(e,{},r,n),s=this._unevaluatedLayout._values[t];return s.isDataDriven()||Na(s.value)||!i?i:tw(e.properties,i)}getAppearanceValueAndResolveTokens(t,e,r,n,i){const s=t.getProperty(e);if(!s)return;const a=s.evaluate(r,{},n,i),o=t.getUnevaluatedProperties()._values[e];return o.isDataDriven()||Na(o.value)||!a||"string"!=typeof a?a:tw(r.properties,a)}createBucket(t){return new Qb(t)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const t of sw().paint.overridableProperties){if(!aw.hasPaintOverride(this.layout,t))continue;const e=this.paint.get(t),r=new iw(e),n=new Ua(r,e.property.specification,this.scope,this.options,this.layout.get("icon-image-use-theme"));let i=null;i="constant"===e.value.kind||"source"===e.value.kind?new $a("source",n):new Ga("composite",n,e.value.zoomStops,e.value.interpolationType),this.paint._values[t]=new Fo(e.property,i,e.parameters)}}_handleOverridablePaintPropertyUpdate(t,e,r){return!(!this.layout||e.isDataDriven()||r.isDataDriven())&&aw.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,e){const r=t.get("text-field"),n=sw().paint.properties[e];let i=!1;const s=t=>{for(const e of t)if(n.overrides&&n.overrides.hasOverride(e))return void(i=!0)};if("constant"===r.value.kind&&r.value.value instanceof Rn)s(r.value.value.sections);else if("source"===r.value.kind){const t=e=>{i||(e instanceof Gn&&jn(e.value)===Sn?s(e.value.sections):e instanceof Zn?s(e.sections):e.eachChild(t))},e=r.value;e._styleExpression&&t(e._styleExpression.expression)}return i}getProgramIds(){return["symbol"]}getDefaultProgramParams(t,e,r){return{config:new Wu(this,{zoom:e,lut:r}),overrideFog:!1}}hasElevation(){return this.layout&&"hd-road-markup"===this.layout.get("symbol-elevation-reference")}}let ow,lw,uw,cw;const hw=bl([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);function pw(t,e,r,n,i,s,a,o){const c=[t,e,1,r,n,1,i,s,1],h=[a,o,1],p=l([],c),[d,f,m]=J(h,h,p);return u(c,c,[d,0,0,0,f,0,0,0,m])}function dw(t,e,r,n,i,s,a,o){const c=function(t,e,r,n,i,s,a,o){const c=pw(0,0,1,0,1,1,0,1),h=pw(t,e,r,n,i,s,a,o);return u(h,h,l([],c))}(t,e,r,n,i,s,a,o);return[c[2]/c[8]/Ui,c[5]/c[8]/Ui]}function fw(t){return[t[0],Math.min(Math.max(t[1],-Pc),Pc)]}class mw extends nn{constructor(t,e,r,n){super(),this.id=t,this.dispatcher=r,this.coordinates=e.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.onNorthPole=!1,this.onSouthPole=!1,this.setEventedParent(n),this.options=e,this._dirty=!1}load(t,e){if(this._loaded=e||!1,this.fire(new Qr("dataloading",{dataType:"source"})),this.url=this.options.url,!this.url)return t&&(this.coordinates=t),this._loaded=!0,void this._finishLoading();this._imageRequest=$r(this.map._requestManager.transformRequest(this.url,Tr.Image),((e,r)=>{this._imageRequest=null,this._loaded=!0,e?this.fire(new tn(e)):r&&(this.image=r instanceof HTMLImageElement?lr.getImageData(r):r,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,t&&(this.coordinates=t),this._finishLoading())}))}loaded(){return this._loaded}updateImage(t){return t.url?(this._imageRequest&&t.url!==this.options.url&&(this._imageRequest.cancel(),this._imageRequest=null),this.options.url=t.url,this.load(t.coordinates,this._loaded),this):this}setTexture(t){if(!(t.handle instanceof WebGLTexture))throw new Error("The provided handle is not a WebGLTexture instance");return this.texture=new xy(this.map.painter.context,t.handle),this.width=t.dimensions[0],this.height=t.dimensions[1],this._dirty=!1,this._loaded=!0,this._finishLoading(),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new Qr("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(t){this._imageRequest&&(this._imageRequest.cancel(),this._imageRequest=null),!this.texture||this.texture instanceof xy||this.texture.destroy(),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy())}setCoordinates(t){if(this.coordinates=t,this._boundsArray=void 0,this._unsupportedCoords=!1,!t.length)return this;this.onNorthPole=!1,this.onSouthPole=!1;let e=t[0][1],r=t[0][1];for(const n of t)n[1]>r&&(r=n[1]),n[1]<e&&(e=n[1]);const n=(r+e)/2;if(n>Pc?this.onNorthPole=!0:n<-Pc&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){const e=t.map(Ec.fromLngLat);this.tileID=function(t){let e=1/0,r=1/0,n=-1/0,i=-1/0;for(const s of t)e=Math.min(e,s.x),r=Math.min(r,s.y),n=Math.max(n,s.x),i=Math.max(i,s.y);const s=Math.max(n-e,i-r),a=Math.max(0,Math.floor(-Math.log2(s))),o=Math.pow(2,a);let l=Math.floor((e+n)/2*o);return l>1&&(l-=1),new Gh(a,l,Math.floor((r+i)/2*o))}(e),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new Qr("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){!this.texture||this.texture instanceof xy||(this.texture.destroy(),this._dirty=!0),this.texture=null,this._boundsArray=void 0,this._unsupportedCoords=!1}_prepareData(t){for(const t in this.tiles){const e=this.tiles[t];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture)}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;const e=gb(new Gh(0,0,0),this.map.transform.projection),r=[e.projection.project(this.coordinates[0][0],this.coordinates[0][1]),e.projection.project(this.coordinates[1][0],this.coordinates[1][1]),e.projection.project(this.coordinates[2][0],this.coordinates[2][1]),e.projection.project(this.coordinates[3][0],this.coordinates[3][1])];if(!function(t){const e=t[1].x-t[0].x,r=t[1].y-t[0].y,n=t[2].x-t[1].x,i=t[2].y-t[1].y,s=t[3].x-t[2].x,a=t[3].y-t[2].y,o=t[0].x-t[3].x,l=t[0].y-t[3].y,u=e*i-n*r,c=n*a-s*i,h=s*l-o*a,p=o*r-e*l;return u>0&&c>0&&h>0&&p>0||u<0&&c<0&&h<0&&p<0}(r))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);const n=gb(this.tileID,this.map.transform.projection),[i,s,a,o]=this.coordinates.map((t=>{const e=n.projection.project(t[0],t[1]);return vb(n,e)._round()}));this.perspectiveTransform=dw(i.x,i.y,s.x,s.y,a.x,a.y,o.x,o.y);const c=this._boundsArray=new Il;c.emplaceBack(i.x,i.y,0,0),c.emplaceBack(s.x,s.y,Ui,0),c.emplaceBack(o.x,o.y,0,Ui),c.emplaceBack(a.x,a.y,Ui,Ui),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=t.createVertexBuffer(c,hw.members),this.boundsSegments=bu.simpleSegment(0,0,4,2);const h=[],p=[fw((d=this.coordinates)[0]),fw(d[1]),fw(d[2]),fw(d[3])];var d;const[f,m,y,g]=function(t){let e=t[0][0],r=e,n=t[0][1],i=n;for(let s=1;s<t.length;s++)t[s][0]<e?e=t[s][0]:t[s][0]>r&&(r=t[s][0]),t[s][1]<n?n=t[s][1]:t[s][1]>i&&(i=t[s][1]);return[e,n,r-e,i-n]}(p);{const n=new Il,[i,s,a,o]=function(t){let e=t[0].x,r=e,n=t[0].y,i=n;for(let s=1;s<t.length;s++)t[s].x<e?e=t[s].x:t[s].x>r&&(r=t[s].x),t[s].y<n?n=t[s].y:t[s].y>i&&(i=t[s].y);return[e,n,r-e,i-n]}(r),c=t=>[(t.x-i)/a,(t.y-s)/o],[p,d,x,v]=r.map(c),b=function(t,e,r,n,i,s,a,o){const c=pw(0,0,1,0,1,1,0,1);return u(c,c,l([],pw(t,e,r,n,i,s,a,o)))}(p[0],p[1],d[0],d[1],x[0],x[1],v[0],v[1]);this.elevatedGlobePerspectiveTransform=dw(p[0],p[1],d[0],d[1],x[0],x[1],v[0],v[1]);const w=(t,e)=>{h.push(t.lng);const r=Math.round((t.lng-f)/y*Ui),i=Math.round((t.lat-m)/g*Ui),s=c(e),a=J([],[s[0],s[1],1],b),o=Math.round(a[0]/a[2]*Ui),l=Math.round(a[1]/a[2]*Ui);n.emplaceBack(r,i,o,l)},_=r[3].x-r[0].x,A=r[3].y-r[0].y,I=r[2].x-r[1].x,M=r[2].y-r[1].y;for(let t=0;t<65;t++){const n=t/64,i=[r[0].x+n*_,r[0].y+n*A],s=[r[1].x+n*I,r[1].y+n*M],a=s[0]-i[0],o=s[1]-i[1];for(let t=0;t<65;t++){const r=t/64,n={x:i[0]+a*r,y:i[1]+o*r};w(e.projection.unproject(n.x,n.y),n)}}this.elevatedGlobeVertexBuffer=t.createVertexBuffer(n,hw.members)}{this.maxLongitudeTriangleSize=0;let e=[],r=new $l;const n=(t,n,i)=>{r.emplaceBack(t,n,i);const s=h[t],a=h[n],o=h[i],l=Math.min(Math.min(s,a),o),u=Math.max(Math.max(s,a),o)-l;u>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=u),e.push(l+u/2)};for(let t=0;t<64;t++)for(let e=0;e<64;e++){const r=65*t+e,i=r+1,s=r+65,a=s+1;n(r,s,i),n(i,s,a)}[e,r]=function(t,e){const r=Array.from({length:t.length},((t,e)=>e));r.sort(((e,r)=>t[e]-t[r]));const n=[],i=new $l;for(let s=0;s<r.length;s++){const a=r[s];n.push(t[a]);const o=3*a,l=o+1;i.emplaceBack(e.uint16[o],e.uint16[l],e.uint16[l+1])}return[n,i]}(e,r),this.elevatedGlobeTrianglesCenterLongitudes=e,this.elevatedGlobeIndexBuffer=t.createIndexBuffer(r)}this.elevatedGlobeSegments=bu.simpleSegment(0,0,4225,8192),this.elevatedGlobeGridMatrix=new Float32Array([0,y/Ui,0,g/Ui,0,0,m,f,0])}prepare(){const t=0!==Object.keys(this.tiles).length;if(this.tileID&&!t)return;const e=this.map.painter.context,r=e.gl;!this._dirty||this.texture instanceof xy||(this.texture?this.texture.update(this.image):(this.texture=new yy(e,this.image,r.RGBA8),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE)),this._dirty=!1),t&&this._prepareData(e)}loadTile(t,e){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={},e(null)):(t.state="errored",e(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}getSegmentsForLongitude(t){const e=this.elevatedGlobeSegments;if(!this.elevatedGlobeTrianglesCenterLongitudes||!e)return null;const r=this.elevatedGlobeTrianglesCenterLongitudes;let n=(i=t+180)+360*Math.round((r[0]-i)/360);var i;const s=new bu,a=(t,r)=>{s.segments.push({vertexOffset:0,primitiveOffset:t,vertexLength:e.segments[0].vertexLength,primitiveLength:r,sortKey:void 0,vaos:{}})},o=.51*this.maxLongitudeTriangleSize;if(Math.abs(r[0]-n)<=o){const t=je(r,0,r.length,n+o);return t===r.length||a(t,Ne(r,t+1,r.length,n+360-o)-t),s}n<r[0]&&(n+=360);const l=Ne(r,0,r.length,n-o);if(l===r.length)return a(0,r.length),s;a(0,l-0);const u=je(r,l+1,r.length,n+o);return u!==r.length&&a(u,r.length-u),s}}const yw=256,gw=(Math.pow(256,2)-1)/16907520;class xw extends ml{constructor(t,e,r,n){super(t,{layout:uw||(uw=new No({visibility:new Do(jo.layout_raster.visibility)})),paint:cw||(cw=new No({"raster-opacity":new Do(jo.paint_raster["raster-opacity"]),"raster-color":new Lo(jo.paint_raster["raster-color"]),"raster-color-mix":new Do(jo.paint_raster["raster-color-mix"]),"raster-color-range":new Do(jo.paint_raster["raster-color-range"]),"raster-hue-rotate":new Do(jo.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Do(jo.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Do(jo.paint_raster["raster-brightness-max"]),"raster-saturation":new Do(jo.paint_raster["raster-saturation"]),"raster-contrast":new Do(jo.paint_raster["raster-contrast"]),"raster-resampling":new Do(jo.paint_raster["raster-resampling"]),"raster-fade-duration":new Do(jo.paint_raster["raster-fade-duration"]),"raster-emissive-strength":new Do(jo.paint_raster["raster-emissive-strength"]),"raster-array-band":new Do(jo.paint_raster["raster-array-band"]),"raster-elevation":new Do(jo.paint_raster["raster-elevation"]),"raster-color-use-theme":new Ro({type:"string",default:"default","property-type":"data-driven"})}))},e,r,n),this.updateColorRamp(),this._curRampRange=[NaN,NaN]}getProgramIds(){return["raster"]}hasColorMap(){return!!this._transitionablePaint._values["raster-color"].value.value}tileCoverLift(){return this.paint.get("raster-elevation")}isDraped(t){return!(t&&t._source instanceof mw&&(t._source.onNorthPole||t._source.onSouthPole))&&0===this.paint.get("raster-elevation")}_handleSpecialPaintPropertyUpdate(t){"raster-color"!==t&&"raster-color-range"!==t||(this._curRampRange=[NaN,NaN],this.updateColorRamp())}_clear(){this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}updateColorRamp(t){if(!this.hasColorMap())return;if(!this._curRampRange)return;const e=this._transitionablePaint._values["raster-color"].value.expression,[r,n]=t||this._transitionablePaint._values["raster-color-range"].value.expression.evaluate({zoom:0})||[NaN,NaN];isNaN(r)&&isNaN(n)||r===this._curRampRange[0]&&n===this._curRampRange[1]||(this.colorRamp=rd({expression:e,evaluationKey:"rasterValue",image:this.colorRamp,clips:[{start:r,end:n}],resolution:256}),this.colorRampTexture=null,this._curRampRange=[r,n])}}let vw,bw;const ww=256;class _w extends ml{constructor(t,e,r,n){super(t,{layout:vw||(vw=new No({visibility:new Do(jo["layout_raster-particle"].visibility)})),paint:bw||(bw=new No({"raster-particle-array-band":new Do(jo["paint_raster-particle"]["raster-particle-array-band"]),"raster-particle-count":new Do(jo["paint_raster-particle"]["raster-particle-count"]),"raster-particle-color":new Lo(jo["paint_raster-particle"]["raster-particle-color"]),"raster-particle-max-speed":new Do(jo["paint_raster-particle"]["raster-particle-max-speed"]),"raster-particle-speed-factor":new Do(jo["paint_raster-particle"]["raster-particle-speed-factor"]),"raster-particle-fade-opacity-factor":new Do(jo["paint_raster-particle"]["raster-particle-fade-opacity-factor"]),"raster-particle-reset-rate-factor":new Do(jo["paint_raster-particle"]["raster-particle-reset-rate-factor"]),"raster-particle-elevation":new Do(jo["paint_raster-particle"]["raster-particle-elevation"]),"raster-particle-color-use-theme":new Ro({type:"string",default:"default","property-type":"data-driven"})}))},e,r,n),this._updateColorRamp(),this.lastInvalidatedAt=lr.now()}_clear(){this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null),this.tileFramebuffer&&(this.tileFramebuffer.destroy(),this.tileFramebuffer=null),this.particleFramebuffer&&(this.particleFramebuffer.destroy(),this.particleFramebuffer=null)}onRemove(t){this.colorRampTexture&&this.colorRampTexture.destroy(),this.tileFramebuffer&&this.tileFramebuffer.destroy(),this.particleFramebuffer&&this.particleFramebuffer.destroy()}hasColorMap(){return!!this._transitionablePaint._values["raster-particle-color"].value.value}getProgramIds(){return["rasterParticle"]}hasOffscreenPass(){return"none"!==this.visibility}isDraped(t){return!1}_handleSpecialPaintPropertyUpdate(t){"raster-particle-color"!==t&&"raster-particle-max-speed"!==t||(this._updateColorRamp(),this._invalidateAnimationState()),"raster-particle-count"===t&&this._invalidateAnimationState()}_updateColorRamp(){if(!this.hasColorMap())return;const t=this._transitionablePaint._values["raster-particle-color"].value.expression,e=this._transitionablePaint._values["raster-particle-max-speed"].value.expression.evaluate({zoom:0});this.colorRamp=rd({expression:t,evaluationKey:"rasterParticleSpeed",image:this.colorRamp,clips:[{start:0,end:e}],resolution:256}),this.colorRampTexture=null}_invalidateAnimationState(){this.lastInvalidatedAt=lr.now()}tileCoverLift(){return this.paint.get("raster-particle-elevation")}}function Aw(t){const e=[],r=t.id;return void 0===r&&e.push({message:`layers.${r}: missing required property "id"`}),void 0===t.render&&e.push({message:`layers.${r}: missing required method "render"`}),t.renderingMode&&"2d"!==t.renderingMode&&"3d"!==t.renderingMode&&e.push({message:`layers.${r}: property "renderingMode" must be either "2d" or "3d"`}),e}class Iw extends ml{constructor(t,e){super(t,{},e,null),this.implementation=t,t.slot&&(this.slot=t.slot)}is3D(t){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}isDraped(t){return void 0!==this.implementation.renderToTile}shouldRedrape(){return!!this.implementation.shouldRerenderTiles&&this.implementation.shouldRerenderTiles()}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){}onAdd(t){this.implementation.onAdd&&this.implementation.onAdd(t,t.painter.context.gl)}onRemove(t){this.implementation.onRemove&&this.implementation.onRemove(t,t.painter.context.gl)}}let Mw,Sw,Pw;function kw(t,e,r){const n=[0,0,1],i=mt([]);return xt(i,i,r?-Xt(t)+Math.PI:Xt(t)),gt(i,i,-Xt(e)),Q(n,n,i),X(n,n)}const Bw={None:0,Model:1,Symbol:2,FillExtrusion:4};class zw{constructor(t,e,r,n){this.message=(t?`${t}: `:"")+r,n&&(this.identifier=n),null!=e&&e.__line__&&(this.line=e.__line__)}}class Tw extends zw{}function Ew(t,e){const r=-1===t.indexOf("://");try{return new URL(t,r&&e?"http://example.com":void 0),!0}catch(t){return!1}}function Vw(t){const e=t.value;return e?Jn(e)?Ew(e,!0)?[]:[new zw(t.key,e,`invalid url "${e}"`)]:[new zw(t.key,e,`string expected, "${Yn(e)}" found`)]:[]}class Fw{constructor(t,e){this.feature=t,this.instancedDataOffset=e,this.instancedDataCount=0,this.rotation=[0,0,0],this.scale=[1,1,1],this.translation=[0,0,0]}}class Cw{constructor(){this.maxScale=1,this.maxXYTranslationDistance=0,this.instancedDataArray=new tu,this.instancesEvaluatedElevation=[],this.features=[],this.idToFeaturesIndex={}}colorForInstance(t){const e=16*t,r=this.instancedDataArray.float32;let n=Math.floor(r[e+2]);const i=1.05*(r[e+2]-n);return n/=100,[r[e]%1*1.05,r[e+1]%1*1.05,i,n]}tileCoordinatesForInstance(t){const e=16*t,r=this.instancedDataArray.float32;let n=r[e+0];return n=n>Ui?n-Ui:n,new $t(Math.trunc(n),Math.trunc(r[e+1]))}translationForInstance(t){const e=16*t,r=this.instancedDataArray.float32;return[r[e+4],r[e+5],r[e+6]]}rotationScaleForInstance(t){const e=16*t,r=this.instancedDataArray.float32;return[r[e+7],r[e+8],r[e+9],r[e+10],r[e+11],r[e+12],r[e+13],r[e+14],r[e+15]]}transformForInstance(t){const e=16*t,r=this.instancedDataArray.float32;return[r[e+7],r[e+8],r[e+9],r[e+4],r[e+10],r[e+11],r[e+12],r[e+5],r[e+13],r[e+14],r[e+15],r[e+6],0,0,0,1]}}class Dw{constructor(t){this.zoom=t.zoom,this.canonical=t.canonical,this.overscaledZ=this.canonical.z+Math.log2(t.overscaling),this.layers=t.layers,this.layerIds=this.layers.map((t=>t.fqid)),this.projection=t.projection,this.index=t.index,this.worldview=t.worldview,this.hasZoomDependentProperties=this.layers[0].isZoomDependent(),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.hasPattern=!1,this.instancesPerModel={},this.validForExaggeration=0,this.maxVerticalOffset=0,this.maxScale=0,this.maxHeight=0,this.lookupDim=this.zoom>this.canonical.z+1?0:this.zoom>this.canonical.z?256:this.zoom>15?75:100,this.instanceCount=0,this.terrainElevationMin=0,this.terrainElevationMax=0,this.validForDEMTile={id:null,timestamp:0},this.modelUris=[],this.modelsRequested=!1,this.activeReplacements=[],this.replacementUpdateTime=0,this.styleDefinedModelURLs=t.styleDefinedModelURLs,this.hasAppearances=null}updateFootprints(t,e){}updateAppearances(t,e,r,n){}populate(t,e,r,n){this.tileToMeter=Tc(r);const i=this.layers[0]._featureFilter.needGeometry;this.lookup=new Uint8Array(this.lookupDim*this.lookupDim);for(const{feature:s,id:a,index:o,sourceLayerIndex:l}of t){const t=null!=a?a:s.properties&&s.properties.hasOwnProperty("id")?s.properties.id:void 0,u=Nc(s,i);if(!this.layers[0]._featureFilter.filter(new Po(this.zoom,{worldview:this.worldview,activeFloors:e.activeFloors}),u,r))continue;const c={id:t,sourceLayerIndex:l,index:o,geometry:i?u.geometry:Uc(s,r,n),properties:s.properties,type:s.type,patterns:{}},h=this.addFeature(c,c.geometry,u);h&&e.featureIndex.insert(s,c.geometry,o,l,this.index,this.instancesPerModel[h].instancedDataArray.length,Ui/32)}this.lookup=null}evaluateQueryRenderedFeaturePadding(){const t=this.layers[0].modelManager,e=this.layers[0].scope;let r=0;for(const n of this.modelUris){const i=t.getModel(n,e);if(!i)continue;const s=this.instancesPerModel[n];if(s){const t=.5*$(i.aabb.max,i.aabb.min)*s.maxScale+s.maxXYTranslationDistance,e=Math.min(Ui,Math.max(t/this.tileToMeter,Ui/32));r=Math.max(e,r)}}return r}update(t,e,r,n){for(const e in this.instancesPerModel){const r=this.instancesPerModel[e];for(const e in t)r.idToFeaturesIndex.hasOwnProperty(e)&&(this.evaluate(r.features[r.idToFeaturesIndex[e]],t[e],r,!0),this.uploaded=!1)}this.maxHeight=0}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return!1;let t=!1;for(const e in this.instancesPerModel){const r=this.instancesPerModel[e];for(const e of r.features){const n=this.layers[0],i=e.feature,s=this.canonical,a=n.paint.get("model-rotation").evaluate(i,{},s),o=n.paint.get("model-scale").evaluate(i,{},s),l=n.paint.get("model-translation").evaluate(i,{},s);et(e.rotation,a)&&et(e.scale,o)&&et(e.translation,l)||(this.evaluate(e,e.featureStates,r,!0),t=!0)}}return t}updateReplacement(t,e,r,n){if(e.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=e.updateTime;const i=e.getReplacementRegionsForTile(t.toUnwrapped(),!0);if(wf(this.activeReplacements,i))return!1;this.activeReplacements=i;let s=!1;for(const e in this.instancesPerModel){const i=this.instancesPerModel[e],a=i.instancedDataArray;for(const e of i.features){const i=e.instancedDataOffset,o=e.instancedDataCount;for(let e=0;e<o;e++){const o=16*(e+i);let l=a.float32[o+0];const u=l>Ui;l=u?l-Ui:l;const c=Math.floor(l),h=Math.floor(a.float32[o+1]);let p=!1;for(const e of this.activeReplacements)if(!yf(e,r,Bw.Model,n)&&!(e.min.x>c||c>e.max.x||e.min.y>h||h>e.max.y)&&(p=Pf(Sf(c,h,t.canonical,e.footprintTileId.canonical),e.footprint),p))break;a.float32[o]=p?l+Ui:l,s=s||p!==u}}}return s}isEmpty(){for(const t in this.instancesPerModel)if(0!==this.instancesPerModel[t].instancedDataArray.length)return!1;return!0}uploadPending(){return!this.uploaded}upload(t){if(!this.uploaded)for(const e in this.instancesPerModel){const r=this.instancesPerModel[e];r.instancedDataArray.length<0||0===r.instancedDataArray.length||(r.instancedDataBuffer?r.instancedDataBuffer.updateData(r.instancedDataArray):r.instancedDataBuffer=t.createVertexBuffer(r.instancedDataArray,Iy.members,!0,void 0,this.instanceCount))}this.uploaded=!0}destroy(t){for(const t in this.instancesPerModel){const e=this.instancesPerModel[t];0!==e.instancedDataArray.length&&e.instancedDataBuffer&&e.instancedDataBuffer.destroy()}const e=this.layers[0].modelManager;if(t&&e&&this.modelUris&&this.modelsRequested)for(const t of this.modelUris)e.removeModel(t,"",!0)}addFeature(t,e,r){const n=this.layers[0],i=n.layout.get("model-id").evaluate(r,{},this.canonical);if(!i)return Ae(`modelId is not evaluated for layer ${n.id} and it is not going to get rendered.`),i;(Ew(i,!1)||void 0!==this.styleDefinedModelURLs[i])&&(this.modelUris.includes(i)||this.modelUris.push(i)),this.instancesPerModel[i]||(this.instancesPerModel[i]=new Cw);const s=this.instancesPerModel[i],a=s.instancedDataArray,o=new Fw(r,a.length);for(const t of e)for(const e of t){if(e.x<0||e.x>=Ui||e.y<0||e.y>=Ui)continue;if(0!==this.lookupDim){const t=(this.lookupDim-1)/Ui,r=this.lookupDim*(e.y*t|0)+e.x*t|0;if(this.lookup){if(0!==this.lookup[r])continue;this.lookup[r]=1}}this.instanceCount++;const t=a.length;a.resize(t+1),s.instancesEvaluatedElevation.push(0),a.float32[16*t]=e.x,a.float32[16*t+1]=e.y}return o.instancedDataCount=s.instancedDataArray.length-o.instancedDataOffset,o.instancedDataCount>0&&(t.id&&(s.idToFeaturesIndex[t.id]=s.features.length),s.features.push(o),this.evaluate(o,{},s,!1)),i}getModelUris(){return this.modelUris}evaluate(t,e,r,n){const i=this.layers[0],s=t.feature,a=this.canonical,o=t.rotation=i.paint.get("model-rotation").evaluate(s,e,a),l=t.scale=i.paint.get("model-scale").evaluate(s,e,a),u=t.translation=i.paint.get("model-translation").evaluate(s,e,a),c=Object.assign({},i.paint.get("model-color").evaluate(s,e,a));c.a=i.paint.get("model-color-mix-intensity").evaluate(s,e,a);const h=[];this.maxVerticalOffset<u[2]&&(this.maxVerticalOffset=u[2]);const p=u[0]*u[0]+u[1]*u[1],d=p>0?Math.sqrt(p):0;r.maxScale=Math.max(Math.max(r.maxScale,l[0]),Math.max(l[1],l[2])),r.maxXYTranslationDistance=Math.max(r.maxXYTranslationDistance,d),this.maxScale=Math.max(Math.max(this.maxScale,l[0]),Math.max(l[1],l[2])),Vy(h,o,l);const f=Math.round(100*c.a)+c.b/1.05;for(let e=0;e<t.instancedDataCount;++e){const i=t.instancedDataOffset+e,s=16*i,o=r.instancedDataArray.float32;let l=0;n&&(l=o[s+6]-r.instancesEvaluatedElevation[i]);const p=0|o[s+1];o[s]=(0|o[s])+c.r/1.05,o[s+1]=p+c.g/1.05,o[s+2]=f,o[s+3]=1/(a.z>10?this.tileToMeter:Tc(a,p)),o[s+4]=u[0],o[s+5]=u[1],o[s+6]=u[2]+l,o[s+7]=h[0],o[s+8]=h[1],o[s+9]=h[2],o[s+10]=h[4],o[s+11]=h[5],o[s+12]=h[6],o[s+13]=h[8],o[s+14]=h[9],o[s+15]=h[10],r.instancesEvaluatedElevation[i]=u[2]}}}let Rw,Lw;Qa(Dw,"ModelBucket",{omit:["layers"]}),Qa(Cw,"PerModelAttributes"),Qa(Fw,"ModelFeature");class Ow{isDataAvailableAtPoint(t){const e=this._source();if(this.isUsingMockSource()||!e||t.y<0||t.y>1)return!1;const r=e.getSource().maxzoom,n=1<<r,i=Math.floor(t.x),s=Math.floor((t.x-i)*n),a=Math.floor(t.y*n),o=this.findDEMTileFor(new Hh(r,i,r,s,a));return!(!o||!o.dem)}getAtPointOrZero(t,e=0){return this.getAtPoint(t,e)||0}getAtPoint(t,e,r=!0){if(this.isUsingMockSource())return null;null==e&&(e=null);const n=this._source();if(!n)return e;if(t.y<0||t.y>1)return e;const i=n.getSource().maxzoom,s=1<<i,a=Math.floor(t.x),o=t.x-a,l=new Hh(i,a,i,Math.floor(o*s),Math.floor(t.y*s)),u=this.findDEMTileFor(l);if(!u||!u.dem)return e;const c=u.dem,h=1<<u.tileID.canonical.z,p=(o*h-u.tileID.canonical.x)*c.dim,d=(t.y*h-u.tileID.canonical.y)*c.dim,f=Math.floor(p),m=Math.floor(d);return(r?this.exaggeration():1)*dn(dn(c.get(f,m),c.get(f,m+1),d-m),dn(c.get(f+1,m),c.get(f+1,m+1),d-m),p-f)}static getAtTileOffset(t,e,r,n){const i=1<<t.canonical.z;return n?n.pointElevation(e):r?r.getAtPointOrZero(new Ec(t.wrap+(t.canonical.x+e.x/Ui)/i,(t.canonical.y+e.y/Ui)/i)):0}static getAtTileOffsetFunc(t,e,r,n){return(i,s,a)=>{const o=this.getAtTileOffset(t,i,s,a),l=n.upVector(t.canonical,i.x,i.y);return N(l,l,o*n.upVectorScale(t.canonical,e,r).metersToTile),l}}getForTilePoints(t,e,r,n){if(this.isUsingMockSource())return!1;const i=Uw.create(this,t,n);return!!i&&(e.forEach((t=>{t[2]=this.exaggeration()*i.getElevationAt(t[0],t[1],r)})),!0)}getMinMaxForTile(t){if(this.isUsingMockSource())return null;const e=this.findDEMTileFor(t);if(!e||!e.dem)return null;const r=e.dem.tree,n=e.tileID,i=1<<t.canonical.z-n.canonical.z;let s=t.canonical.x/i-n.canonical.x,a=t.canonical.y/i-n.canonical.y,o=0;for(let e=0;e<t.canonical.z-n.canonical.z&&!r.leaves[o];e++){s*=2,a*=2;const t=2*Math.floor(a)+Math.floor(s);o=r.childOffsets[o]+t,s%=1,a%=1}return{min:this.exaggeration()*r.minimums[o],max:this.exaggeration()*r.maximums[o]}}getMinElevationBelowMSL(){throw new Error("Pure virtual method called.")}raycast(t,e,r){throw new Error("Pure virtual method called.")}pointCoordinate(t){throw new Error("Pure virtual method called.")}_source(){throw new Error("Pure virtual method called.")}isUsingMockSource(){throw new Error("Pure virtual method called.")}exaggeration(){throw new Error("Pure virtual method called.")}findDEMTileFor(t){throw new Error("Pure virtual method called.")}get visibleDemTiles(){throw new Error("Getter must be implemented in subclass.")}getMinMaxForVisibleTiles(){const t=this.visibleDemTiles;if(0===t.length)return null;let e=!1,r=Number.MAX_VALUE,n=Number.MIN_VALUE;for(const i of t){const t=this.getMinMaxForTile(i.tileID);t&&(r=Math.min(r,t.min),n=Math.max(n,t.max),e=!0)}return e?{min:r,max:n}:null}}class Uw{constructor(t,e,r){this._demTile=t,this._dem=this._demTile.dem,this._scale=e,this._offset=r}static create(t,e,r){const n=r||t.findDEMTileFor(e);if(!n||!n.dem)return;const i=n.dem,s=n.tileID,a=1<<e.canonical.z-s.canonical.z;return new Uw(n,i.dim/Ui/a,[(e.canonical.x/a-s.canonical.x)*i.dim,(e.canonical.y/a-s.canonical.y)*i.dim])}tileCoordToPixel(t,e){const r=e*this._scale+this._offset[1];return new $t(Math.floor(t*this._scale+this._offset[0]),Math.floor(r))}getElevationAt(t,e,r,n){const i=t*this._scale+this._offset[0],s=e*this._scale+this._offset[1],a=Math.floor(i),o=Math.floor(s),l=this._dem;return n=!!n,r?dn(dn(l.get(a,o,n),l.get(a,o+1,n),s-o),dn(l.get(a+1,o,n),l.get(a+1,o+1,n),s-o),i-a):l.get(a,o,n)}getElevationAtPixel(t,e,r){return this._dem.get(t,e,!!r)}getMeterToDEM(t){return(1<<this._demTile.tileID.canonical.z)*Ac(1,t)*this._dem.stride}}const Nw=new Float32Array(262144),jw=new Uint8Array(262144);function $w(t){let e=0;if(t.meshes)for(const r of t.meshes)e=Math.max(e,r.aabb.max[2]);if(t.children)for(const r of t.children)e=Math.max(e,$w(r));return e}function Gw(t,e,r){if(t.meshes)for(const n of t.meshes){if(n.aabb.min[0]===1/0)continue;const i=mh.applyTransform(n.aabb,t.globalMatrix);r.insert(e,i.min[0],i.min[1],i.max[0],i.max[1])}if(t.children)for(const n of t.children)Gw(n,e,r)}const qw=["","wall","door","roof","window","lamp","logo"];class Hw{constructor(t){this.node=t,this.evaluatedRMEA=[[1,0,0,1],[1,0,0,1],[1,0,0,1],[1,0,0,1],[.4,1,0,1],[1,0,0,1],[1,0,0,1]],this.hiddenByReplacement=!1,this.evaluatedTranslation=[0,0,0],this.evaluatedScale=[1,1,1],this.evaluatedColor=[],this.emissionHeightBasedParams=[],this.cameraCollisionOpacity=1,this.feature={type:"Point",id:t.id,geometry:[],properties:{height:$w(t)}},this.aabb=this._getLocalBounds(),this.state=null}_getLocalBounds(){if(!this.node.meshes)return new mh([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);if(!this.aabb){let t=0;const e=new mh([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(const r of this.node.meshes)this.node.lightMeshIndex!==t&&(r.transformedAabb=mh.applyTransformFast(r.aabb,this.node.globalMatrix),e.encapsulate(r.transformedAabb)),t++;this.aabb=e}return this.aabb}}class Xw{constructor(t,e,r,n,i,s,a,o){this.id=r,this.layers=t,this.layerIds=this.layers.map((t=>t.fqid)),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.modelTraits|=Ly.CoordinateSpaceTile,this.uploaded=!1,this.hasPattern=!1,n&&(this.modelTraits|=Ly.HasMapboxMeshFeatures),i&&(this.modelTraits|=Ly.HasMeshoptCompression),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=s,this.worldview=o,this.dirty=!0,this.needsUpload=!1,this.filter=null,this.nodesInfo=[];for(const t of e)this.nodesInfo.push(new Hw(t)),Gw(t,a.featureIndexArray.length,a.grid),a.featureIndexArray.emplaceBack(this.nodesInfo.length-1,0,a.bucketLayerIDs.length-1,0);this.states={},this.hasAppearances=null}updateFootprints(t,e){for(const r of this.getNodesInfo()){const n=r.node;n.footprint&&e.push({footprint:n.footprint,id:t})}}updateAppearances(t,e,r,n){}update(t){const e=0!==Object.keys(t).length;if(e&&!this.stateDependentLayers.length)return;const r=e?this.stateDependentLayers:this.layers;if(!Gt(t,this.states))for(const e of r)this.evaluate(e,t);this.states=structuredClone(t)}populate(){console.log("populate 3D model bucket")}uploadPending(){return!this.uploaded||this.needsUpload}upload(t){if(!this.needsUpload)return;const e=this.getNodesInfo();for(const r of e){const e=r.node;this.uploaded?this.updatePbrBuffer(e):Gy(e,t,!0)}for(const t of e)qy(t.node);this.uploaded=!0,this.needsUpload=!1}updatePbrBuffer(t){let e=!1;if(!t.meshes)return e;for(const r of t.meshes)r.pbrBuffer&&(r.pbrBuffer.updateData(r.featureArray),e=!0);return e}needsReEvaluation(t,e,r){const n=t.transform.projectionOptions,i=t.style.getBrightness(),s=this.brightness!==i;if(!this.uploaded||this.dirty||n.name!==this.projection.name||Zw(r.paint.get("model-color").value,s)||Zw(r.paint.get("model-color-mix-intensity").value,s)||Zw(r.paint.get("model-roughness").value,s)||Zw(r.paint.get("model-emissive-strength").value,s)||Zw(r.paint.get("model-height-based-emissive-strength-multiplier").value,s)){this.projection=n,this.brightness=i;const t=this.getNodesInfo();for(const e of t)e.state=null;return!0}return!1}evaluateTransform(t,e){if(t.transform.zoom===this.zoom)return;this.zoom=t.transform.zoom;const r=this.getNodesInfo(),n=this.id.canonical;for(const t of r){const r=t.feature;t.evaluatedTranslation=e.paint.get("model-translation").evaluate(r,{},n),t.evaluatedScale=e.paint.get("model-scale").evaluate(r,{},n)}}evaluate(t,e){const r=this.getNodesInfo();for(const n of r){if(!n.node.meshes)continue;const r=n.feature,i=e&&e[r.id];if(Gt(i,n.state))continue;n.state=structuredClone(i);const s=n.node.meshes&&n.node.meshes[0].featureData,a=n.evaluatedColor[2],o=n.evaluatedRMEA[2],l=this.id.canonical;if(n.hasTranslucentParts=!1,s){for(let e=0;e<qw.length;e++){const s=qw[e];s.length&&(r.properties.part=s);const a=t.paint.get("model-color").evaluate(r,i,l).toPremultipliedRenderColor(null),o=t.paint.get("model-color-mix-intensity").evaluate(r,i,l);n.evaluatedColor[e]=[a.r,a.g,a.b,o],n.evaluatedRMEA[e][0]=t.paint.get("model-roughness").evaluate(r,i,l),n.evaluatedRMEA[e][2]=t.paint.get("model-emissive-strength").evaluate(r,i,l),n.evaluatedRMEA[e][3]=a.a,n.emissionHeightBasedParams[e]=t.paint.get("model-height-based-emissive-strength-multiplier").evaluate(r,i,l),!n.hasTranslucentParts&&a.a<1&&(n.hasTranslucentParts=!0)}delete r.properties.part,Yw(n,a!==n.evaluatedColor[2]||o!==n.evaluatedRMEA[2],this.modelTraits)}else n.evaluatedRMEA[0][2]=t.paint.get("model-emissive-strength").evaluate(r,i,l);n.evaluatedTranslation=t.paint.get("model-translation").evaluate(r,i,l),n.evaluatedScale=t.paint.get("model-scale").evaluate(r,i,l),this.updatePbrBuffer(n.node)||(this.needsUpload=!0)}this.dirty=!1}elevationUpdate(t,e,r,n){const i=t.findDEMTileFor(r);if(i&&(i.tileID.canonical!==this.terrainTile||e!==this.terrainExaggeration)){if(i.dem&&i.tileID.overscaledZ!==this.elevationReadFromZ){this.elevationReadFromZ=i.tileID.overscaledZ;const e=Uw.create(t,r,i);if(!e)return;this.modelTraits&Ly.HasMapboxMeshFeatures&&this.updateDEM(t,e,r,n);for(const t of this.getNodesInfo()){const r=t.node;if(!r.footprint||!r.footprint.vertices||!r.footprint.vertices.length)continue;const n=r.footprint.vertices;let i=e.getElevationAt(n[0].x,n[0].y,!0,!0);for(let t=1;t<n.length;t++)i=Math.min(i,e.getElevationAt(n[t].x,n[t].y,!0,!0));r.elevation=i}}this.terrainTile=i.tileID.canonical,this.terrainExaggeration=e}}updateDEM(t,e,r,n){let i=e._dem._modifiedForSources[n];if(void 0===i&&(e._dem._modifiedForSources[n]=[],i=e._dem._modifiedForSources[n]),i.includes(r.canonical))return;const s=e._dem.dim;i.push(r.canonical);let a=!1;for(const t of this.getNodesInfo()){const r=t.node;if(!r.footprint||!r.footprint.grid)continue;const n=r.footprint.grid,i=e.tileCoordToPixel(n.min.x,n.min.y),o=e.tileCoordToPixel(n.max.x,n.max.y),l=Math.min(Math.min(s-o.y,i.x),Math.min(i.y,s-o.x));if(l<0)continue;const u=ie(l,2,5);let c=Math.max(0,i.x-u),h=Math.max(0,i.y-u),p=Math.min(o.x+u,s-1),d=Math.min(o.y+u,s-1);for(let t=h;t<=d;++t)for(let e=c;e<=p;++e)jw[t*s+e]=255;let f=0,m=0;for(let t=0;t<n.cellsY;++t)for(let r=0;r<n.cellsX;++r){if(!n.cells[t*n.cellsX+r])continue;const i=e.tileCoordToPixel(n.min.x+r/n.xScale,n.min.y+t/n.yScale),a=e.tileCoordToPixel(n.min.x+(r+1)/n.xScale,n.min.y+(t+1)/n.yScale);for(let t=i.y;t<=Math.min(a.y+1,s-1);++t)for(let r=i.x;r<=Math.min(a.x+1,s-1);++r)255===jw[t*s+r]&&(jw[t*s+r]=0,f+=e.getElevationAtPixel(r,t),m++)}const y=f/m;c=Math.max(1,i.x-u),h=Math.max(1,i.y-u),p=Math.min(o.x+u,s-2),d=Math.min(o.y+u,s-2),a=!0;for(let t=h;t<=d;++t)for(let r=c;r<=p;++r)0===jw[t*s+r]&&(Nw[t*s+r]=e._dem.set(r,t,y));for(let t=1;t<u;++t){c=Math.max(1,i.x-t),h=Math.max(1,i.y-t),p=Math.min(o.x+t,s-2),d=Math.min(o.y+t,s-2);for(let r=h;r<=d;++r)for(let n=c;n<=p;++n){const i=r*s+n;if(255===jw[i]){let a=0,o=0,l=-1,c=-1;for(let e=-1;e<=1;++e)for(let i=-1;i<=1;++i){const u=(r+e)*s+n+i;if(jw[u]>=t)continue;const h=Nw[u],p=Math.abs(h);p>o&&(a=h,o=p,l=i,c=e)}if(o>.1){const s=1-(t+.5*Math.abs(l*c))/u;let o=e._dem.get(n,r)+a*s;const h=e._dem.get(n+l,r+c),p=e._dem.get(n-l,r-c,!0);(o-h)*(o-p)>0&&(o=(h+p)/2),Nw[i]=e._dem.set(n,r,o),jw[i]=t}}}}}a&&(e._demTile.needsDEMTextureUpload=!0,e._dem._timestamp=lr.now())}setFilter(t){this.filter=t?Ho(t):null}getNodesInfo(){return this.filter?this.nodesInfo.filter((t=>this.filter.filter(new Po(this.id.overscaledZ,{worldview:this.worldview}),t.feature,this.id.canonical))):this.nodesInfo}destroy(){const t=this.getNodesInfo();for(const e of t)qy(e.node),Hy(e.node)}isEmpty(){return!this.nodesInfo.length}updateReplacement(t,e){if(e.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=e.updateTime;const r=e.getReplacementRegionsForTile(t.toUnwrapped());for(const t of this.getNodesInfo()){const e=t.node.footprint;t.hiddenByReplacement=!!e&&!r.find((t=>t.footprint===e))}}getHeightAtTileCoord(t,e){const r=[],n=[0,0,0],i=f([]);for(const s of this.getNodesInfo()){const a=s.node.meshes[0],o=a.transformedAabb;if(t<o.min[0]||e<o.min[1]||t>o.max[0]||e>o.max[1])continue;if(!0===s.node.hidden)return{height:1/0,maxHeight:s.feature.properties.height,hidden:!1,verticalScale:s.evaluatedScale[2]};y(i,s.node.globalMatrix),n[0]=t,n[1]=e,K(n,n,i);const l=(n[0]-a.aabb.min[0])/(a.aabb.max[0]-a.aabb.min[0])*Ry|0,u=Math.min(Ry-1,(n[1]-a.aabb.min[1])/(a.aabb.max[1]-a.aabb.min[1])*Ry|0)*Ry+Math.min(Ry-1,l),c=a.heightmap[u];if(!(c<0&&s.node.footprint)){if(s.hiddenByReplacement)return;return{height:c,maxHeight:s.feature.properties.height,hidden:!1,verticalScale:s.evaluatedScale[2]}}if(s.node.footprint.grid.query(new $t(t,e),new $t(t,e),r),r.length>0)return{height:void 0,maxHeight:s.feature.properties.height,hidden:s.hiddenByReplacement,verticalScale:s.evaluatedScale[2]}}}}function Zw(t,e){return t instanceof $a&&!t.isLightConstant&&e}function Ww(t,e,r,n,i,s,a,o){let l=(61440&e|(61440&e)>>4)>>8,u=(3840&e|(3840&e)>>4)>>4,c=240&e|(240&e)>>4;r[3]>0&&(l=dn(l,255*r[0],r[3]),u=dn(u,255*r[1],r[3]),c=dn(c,255*r[2],r[3]));const h=l<<8|u,p=c<<8|Math.floor(255*n[3]),d=function(t){const e=ie(t,0,2);return Math.min(Math.round(.5*e*255),255)}(n[2])<<8|15*n[0]<<4|15*n[1],f=ie(i[0],0,1),m=ie(i[1],0,1),y=ie(i[2],0,1),g=ie(i[3],0,1);let x,v,b,w;if(f!==m&&a!==s&&m!==f){const t=a-s;v=1/(t*(m-f)),b=-(s+t*f)/(t*(m-f));const e=ie(i[4],-1,1);w=Math.pow(10,e),x=255*y<<8|255*g}else x=65535,v=0,b=1,w=1;if(t.emplaceBack(h,p,d,x,v,b,w),o){const t=o.length;o.clear();for(let e=0;e<t;e++)o.emplaceBack(h,p,d,x,v,b,w)}}function Yw(t,e,r){const n=t.node;let i=0;const s=r&Ly.HasMeshoptCompression;for(const r of n.meshes){if(n.lights&&n.lightMeshIndex===i)continue;if(!r.featureData)continue;r.featureArray=new eu,r.featureArray.reserve(r.featureData.length);let a=e;for(const e of r.featureData){const i=s?65535&e:e>>16&65535,o=s?e>>16&65535:65535&e,l=(15&o)<8?15&o:0,u=t.evaluatedRMEA[l],c=t.evaluatedColor[l],h=t.emissionHeightBasedParams[l];let p;if(a&&2===l&&n.lights&&(p=new eu,p.resize(10*n.lights.length)),Ww(r.featureArray,i,c,u,h,r.aabb.min[2],r.aabb.max[2],p),p&&a){a=!1;const t=n.meshes[n.lightMeshIndex];t.featureArray=p,t.featureArray._trim()}}r.featureArray._trim(),i++}}Qa(Xw,"Tiled3dModelBucket",{omit:["layers"]}),Qa(Hw,"Tiled3dModelFeature");const Kw=["id","tile","layer","source","sourceLayer","state"];class Jw{constructor(t,e,r,n,i){this.type="Feature",this._vectorTileFeature=t,this._z=e,this._x=r,this._y=n,this.properties=t?t.properties:{},this.id=i}clone(){const t=new Jw(this._vectorTileFeature,this._z,this._x,this._y,this.id);return this.state&&(t.state=Object.assign({},this.state)),this.layer&&(t.layer=Object.assign({},this.layer)),this.source&&(t.source=this.source),this.sourceLayer&&(t.sourceLayer=this.sourceLayer),t}get geometry(){return void 0===this._geometry&&this._vectorTileFeature&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._x,this._y,this._z).geometry),this._geometry}set geometry(t){this._geometry=t}toJSON(){const t={type:"Feature",state:void 0,geometry:this.geometry,properties:this.properties};for(const e of Kw)void 0!==this[e]&&(t[e]=this[e]);return t}}class Qw extends Jw{constructor(t,e){super(t._vectorTileFeature,t._z,t._x,t._y,t.id),t.state&&(this.state=Object.assign({},t.state)),this.target=e.target,this.namespace=e.namespace,e.properties&&(this.properties=e.properties),this.target&&("featuresetId"in this.target&&!this.target.importId||"layerId"in this.target)&&(this.source=t.source,this.sourceLayer=t.sourceLayer,this.layer=t.layer)}toJSON(){const t=super.toJSON();return t.target=this.target,t.namespace=this.namespace,t}}class t_ extends nn{constructor(t,e,r,n){super(),this.id=t,this.type="model",this.models=[],this._loaded=!1,this._options=e,this._modelsInfo=new Map}load(){const t=[];for(const e in this._options.models){const r=this._options.models[e],n=this._modelsInfo.get(e);if(n){const t=n.model;t.position=null!=r.position?new yc(r.position[0],r.position[1]):new yc(0,0),t.orientation=null!=r.orientation?r.orientation:[0,0,0],n.modelSpec=r,t_.applyModelSpecification(t,r),t.computeBoundsAndApplyParent(),this.models.push(t)}else{const n=py(this.map._requestManager.transformRequest(r.uri,Tr.Model).url).then((t=>{if(!t)return;const n=tg(t),i=new Ny(e,r.uri,r.position,r.orientation,n);t_.applyModelSpecification(i,r),i.computeBoundsAndApplyParent(),this.models.push(i),this._modelsInfo.set(e,{modelSpec:r,model:i})})).catch((t=>{this.fire(new tn(new Error(`Could not load model ${e} from ${r.uri}: ${t.message}`)))}));t.push(n)}}Promise.allSettled(t).then((()=>{this._loaded=!0,this.fire(new Qr("data",{dataType:"source",sourceDataType:"metadata"}))})).catch((t=>{this._loaded=!0,this.fire(new tn(new Error(`Could not load models: ${t.message}`)))}))}static applyModelSpecification(t,e){e.nodeOverrides&&t_.convertNodeOverrides(t,e.nodeOverrides),e.materialOverrides&&t_.convertMaterialOverrides(t,e.materialOverrides),e.nodeOverrideNames&&(t.nodeOverrideNames=[...e.nodeOverrideNames]),e.materialOverrideNames&&(t.materialOverrideNames=[...e.materialOverrideNames]),e.featureProperties&&(t.featureProperties=e.featureProperties)}static convertNodeOverrides(t,e){if(Array.isArray(e)&&e.every((t=>"string"==typeof t))){t.nodeOverrideNames=[];for(const r of e)t.nodeOverrideNames.push(r)}else Object.entries(e).forEach((([e,r])=>{const n={orientation:[0,0,0]};if(r.hasOwnProperty("orientation")){const t=r.orientation;t&&(n.orientation=t)}t.nodeOverrides.set(e,n)}))}static convertMaterialOverrides(t,e){if(Array.isArray(e)&&e.every((t=>"string"==typeof t))){t.materialOverrideNames=[];for(const r of e)t.materialOverrideNames.push(r)}else Object.entries(e).forEach((([e,r])=>{const n={color:new un(1,1,1),colorMix:0,emissionStrength:0,opacity:1},i=r["model-color"];void 0!==i&&(n.color.r=i[0],n.color.g=i[1],n.color.b=i[2]);const s=r["model-color-mix-intensity"];void 0!==s&&(n.colorMix=s);const a=r["model-emissive-strength"];void 0!==a&&(n.emissionStrength=a);const o=r["model-opacity"];void 0!==o&&(n.opacity=o),t.materialOverrides.set(e,n)}))}onAdd(t){this.map=t,this.load()}hasTransition(){return!1}loaded(){return this._loaded}getModels(){return this.models}loadTile(t,e){}serialize(){return this._options}setProperty(t,e){return!1}reload(){const t=al(this.id,this.scope);this.map.style.clearSource(t),this.models=[],this._modelsInfo.clear(),this._loaded=!1,this.load()}setModels(t){this.models=[];const e=new Map;for(const r in t){const n=t[r];if(this._modelsInfo.has(r)){const t=this._modelsInfo.get(r);t&&t.modelSpec.uri===n.uri&&e.set(r,t)}}this._modelsInfo=e,this._options.models=t,this._loaded=!1,this.load()}}function e_(t,e,r,n){const i=1<<t.z;e.lat=Mc((n/Ui+t.y)/i),e.lng=Ic((r/Ui+t.x)/i)}function r_(t,e,r,n){const i=t.getNodesInfo()[e];if(!i||i.hiddenByReplacement||!i.node.meshes)return;let s=Number.MAX_VALUE;const a=i.node,o=r.tile,l=n.calculatePosMatrix(o.tileID.toUnwrapped(),n.worldSize),u=i.evaluatedScale;let c=0;n.elevation&&a.elevation&&(c=a.elevation*n.elevation.exaggeration()),x(l,l,[(a.anchor?a.anchor[0]:0)*(u[0]-1),(a.anchor?a.anchor[1]:0)*(u[1]-1),c]),v(l,l,u);const h=r.queryGeometry,p=h.isPointQuery()?h.screenBounds:h.screenGeometry,d=function(t){const e=g([],l,t.globalMatrix);g(e,n.expandedFarZProjMatrix,e);for(let r=0;r<t.meshes.length;++r){const i=t.meshes[r];if(r===t.lightMeshIndex)continue;const a=Dy(p,n,e,i.aabb);null!=a&&(s=Math.min(a,s))}if(t.children)for(const e of t.children)d(e)};if(d(a),s===Number.MAX_VALUE)return;const f=new yc(0,0);return e_(o.tileID.canonical,f,i.node.anchor[0],i.node.anchor[1]),{intersectionZ:s,position:f,feature:i.feature}}const n_={circle:class extends ml{constructor(t,e,r,n){super(t,{layout:Nh||(Nh=new No({"circle-sort-key":new Ro(jo.layout_circle["circle-sort-key"]),"circle-elevation-reference":new Do(jo.layout_circle["circle-elevation-reference"]),visibility:new Do(jo.layout_circle.visibility)})),paint:jh||(jh=new No({"circle-radius":new Ro(jo.paint_circle["circle-radius"]),"circle-color":new Ro(jo.paint_circle["circle-color"]),"circle-blur":new Ro(jo.paint_circle["circle-blur"]),"circle-opacity":new Ro(jo.paint_circle["circle-opacity"]),"circle-translate":new Do(jo.paint_circle["circle-translate"]),"circle-translate-anchor":new Do(jo.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Do(jo.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Do(jo.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Ro(jo.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Ro(jo.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Ro(jo.paint_circle["circle-stroke-opacity"]),"circle-emissive-strength":new Do(jo.paint_circle["circle-emissive-strength"]),"circle-color-use-theme":new Ro({type:"string",default:"default","property-type":"data-driven"}),"circle-stroke-color-use-theme":new Ro({type:"string",default:"default","property-type":"data-driven"})}))},e,r,n)}createBucket(t){return new bh(t)}queryRadius(t){const e=t;return Rh("circle-radius",this,e)+Rh("circle-stroke-width",this,e)+Lh(this.paint.get("circle-translate"))}queryIntersectsFeature(t,e,r,n,i,s,a,o){const l=Uh(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),s.angle,t.pixelToTileUnitsFactor),u=this.paint.get("circle-radius").evaluate(e,r)+this.paint.get("circle-stroke-width").evaluate(e,r);return Up(t,n,s,a,o,"map"===this.paint.get("circle-pitch-alignment"),"map"===this.paint.get("circle-pitch-scale"),l,u)}getProgramIds(){return["circle"]}getDefaultProgramParams(t,e,r){const n=Op(this);return{config:new Wu(this,{zoom:e,lut:r}),defines:n,overrideFog:!1}}is3D(t){return!t&&!!this.layout&&"none"!==this.layout.get("circle-elevation-reference")}hasElevation(){return this.layout&&"none"!==this.layout.get("circle-elevation-reference")}},heatmap:class extends ml{createBucket(t){return new qp(t)}constructor(t,e,r,n){super(t,{layout:Hp||(Hp=new No({visibility:new Do(jo.layout_heatmap.visibility)})),paint:Xp||(Xp=new No({"heatmap-radius":new Ro(jo.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Ro(jo.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Do(jo.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Lo(jo.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Do(jo.paint_heatmap["heatmap-opacity"]),"heatmap-color-use-theme":new Ro({type:"string",default:"default","property-type":"data-driven"})}))},e,r,n),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){"heatmap-color"===t&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=rd({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}_clear(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}queryRadius(t){return Rh("heatmap-radius",this,t)}queryIntersectsFeature(t,e,r,n,i,s,a,o){const l=this.paint.get("heatmap-radius").evaluate(e,r);return Up(t,n,s,a,o,!0,!0,new $t(0,0),l)}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}getProgramIds(){return["heatmap","heatmapTexture"]}getDefaultProgramParams(t,e,r){return"heatmap"===t?{config:new Wu(this,{zoom:e,lut:r}),overrideFog:!1}:{}}},hillshade:class extends ml{constructor(t,e,r,n){super(t,{layout:Zp||(Zp=new No({visibility:new Do(jo.layout_hillshade.visibility)})),paint:Wp||(Wp=new No({"hillshade-illumination-direction":new Do(jo.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Do(jo.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Do(jo.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Do(jo.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Do(jo.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Do(jo.paint_hillshade["hillshade-accent-color"]),"hillshade-emissive-strength":new Do(jo.paint_hillshade["hillshade-emissive-strength"]),"hillshade-shadow-color-use-theme":new Ro({type:"string",default:"default","property-type":"data-driven"}),"hillshade-highlight-color-use-theme":new Ro({type:"string",default:"default","property-type":"data-driven"}),"hillshade-accent-color-use-theme":new Ro({type:"string",default:"default","property-type":"data-driven"})}))},e,r,n)}shouldRedrape(){return this.hasOffscreenPass()&&"viewport"===this.paint.get("hillshade-illumination-anchor")}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}getProgramIds(){return["hillshade","hillshadePrepare"]}getDefaultProgramParams(t,e,r){return{overrideFog:!1}}},fill:class extends ml{constructor(t,e,r,n){super(t,{layout:Jd||(Jd=new No({"fill-sort-key":new Ro(jo.layout_fill["fill-sort-key"]),visibility:new Do(jo.layout_fill.visibility),"fill-elevation-reference":new Do(jo.layout_fill["fill-elevation-reference"]),"fill-construct-bridge-guard-rail":new Ro(jo.layout_fill["fill-construct-bridge-guard-rail"])})),paint:Qd||(Qd=new No({"fill-antialias":new Do(jo.paint_fill["fill-antialias"]),"fill-opacity":new Ro(jo.paint_fill["fill-opacity"]),"fill-color":new Ro(jo.paint_fill["fill-color"]),"fill-outline-color":new Ro(jo.paint_fill["fill-outline-color"]),"fill-translate":new Do(jo.paint_fill["fill-translate"]),"fill-translate-anchor":new Do(jo.paint_fill["fill-translate-anchor"]),"fill-pattern":new Ro(jo.paint_fill["fill-pattern"]),"fill-pattern-cross-fade":new Do(jo.paint_fill["fill-pattern-cross-fade"]),"fill-emissive-strength":new Do(jo.paint_fill["fill-emissive-strength"]),"fill-z-offset":new Ro(jo.paint_fill["fill-z-offset"]),"fill-bridge-guard-rail-color":new Ro(jo.paint_fill["fill-bridge-guard-rail-color"]),"fill-tunnel-structure-color":new Ro(jo.paint_fill["fill-tunnel-structure-color"]),"fill-color-use-theme":new Ro({type:"string",default:"default","property-type":"data-driven"}),"fill-outline-color-use-theme":new Ro({type:"string",default:"default","property-type":"data-driven"}),"fill-bridge-guard-rail-color-use-theme":new Ro({type:"string",default:"default","property-type":"data-driven"}),"fill-tunnel-structure-color-use-theme":new Ro({type:"string",default:"default","property-type":"data-driven"})}))},e,r,n)}getProgramIds(){const t=this.paint.get("fill-pattern"),e=t&&t.constantOr(1),r=[e?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&r.push(e&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),r}getDefaultProgramParams(t,e,r){return{config:new Wu(this,{zoom:e,lut:r}),overrideFog:!1}}recalculate(t,e){super.recalculate(t,e);const 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(t){return new Kd(t)}queryRadius(){return Lh(this.paint.get("fill-translate"))}queryIntersectsFeature(t,e,r,n,i,s){return!t.queryGeometry.isAboveHorizon&&Ah(Oh(t.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),s.angle,t.pixelToTileUnitsFactor),n)}isTileClipped(){return 0===this.paint.get("fill-z-offset").constantOr(1)}is3D(t){if(0!==this.paint.get("fill-z-offset").constantOr(1))return!0;const e=this.layout&&"none"!==this.layout.get("fill-elevation-reference");return null!=t?e&&!t:e}hasElevation(){return this.layout&&"none"!==this.layout.get("fill-elevation-reference")}hasShadowPass(){return this.layout&&"none"!==this.layout.get("fill-elevation-reference")}},"fill-extrusion":class extends ml{constructor(t,e,r,n){super(t,{layout:om||(om=new No({visibility:new Do(jo["layout_fill-extrusion"].visibility),"fill-extrusion-edge-radius":new Do(jo["layout_fill-extrusion"]["fill-extrusion-edge-radius"])})),paint:lm||(lm=new No({"fill-extrusion-opacity":new Do(jo["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Ro(jo["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Do(jo["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Do(jo["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Ro(jo["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-pattern-cross-fade":new Do(jo["paint_fill-extrusion"]["fill-extrusion-pattern-cross-fade"]),"fill-extrusion-height":new Ro(jo["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Ro(jo["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-height-alignment":new Do(jo["paint_fill-extrusion"]["fill-extrusion-height-alignment"]),"fill-extrusion-base-alignment":new Do(jo["paint_fill-extrusion"]["fill-extrusion-base-alignment"]),"fill-extrusion-vertical-gradient":new Do(jo["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new Do(jo["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new Do(jo["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"]),"fill-extrusion-ambient-occlusion-wall-radius":new Do(jo["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-wall-radius"]),"fill-extrusion-ambient-occlusion-ground-radius":new Do(jo["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-radius"]),"fill-extrusion-ambient-occlusion-ground-attenuation":new Do(jo["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-attenuation"]),"fill-extrusion-flood-light-color":new Do(jo["paint_fill-extrusion"]["fill-extrusion-flood-light-color"]),"fill-extrusion-flood-light-intensity":new Do(jo["paint_fill-extrusion"]["fill-extrusion-flood-light-intensity"]),"fill-extrusion-flood-light-wall-radius":new Ro(jo["paint_fill-extrusion"]["fill-extrusion-flood-light-wall-radius"]),"fill-extrusion-flood-light-ground-radius":new Ro(jo["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-radius"]),"fill-extrusion-flood-light-ground-attenuation":new Do(jo["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-attenuation"]),"fill-extrusion-vertical-scale":new Do(jo["paint_fill-extrusion"]["fill-extrusion-vertical-scale"]),"fill-extrusion-rounded-roof":new Do(jo["paint_fill-extrusion"]["fill-extrusion-rounded-roof"]),"fill-extrusion-cutoff-fade-range":new Do(jo["paint_fill-extrusion"]["fill-extrusion-cutoff-fade-range"]),"fill-extrusion-emissive-strength":new Ro(jo["paint_fill-extrusion"]["fill-extrusion-emissive-strength"]),"fill-extrusion-line-width":new Ro(jo["paint_fill-extrusion"]["fill-extrusion-line-width"]),"fill-extrusion-cast-shadows":new Do(jo["paint_fill-extrusion"]["fill-extrusion-cast-shadows"]),"fill-extrusion-color-use-theme":new Ro({type:"string",default:"default","property-type":"data-driven"}),"fill-extrusion-flood-light-color-use-theme":new Ro({type:"string",default:"default","property-type":"data-driven"})}))},e,r,n),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(t){return new Yf(t)}queryRadius(){return Lh(this.paint.get("fill-extrusion-translate"))}is3D(t){return!0}hasShadowPass(){return this.paint.get("fill-extrusion-cast-shadows")}cutoffRange(){return this.paint.get("fill-extrusion-cutoff-fade-range")}canCastShadows(){return!0}getProgramIds(){return[this.paint.get("fill-extrusion-pattern").constantOr(1)?"fillExtrusionPattern":"fillExtrusion"]}queryIntersectsFeature(t,e,r,n,i,s,a,o,l){const u=Uh(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),s.angle,t.pixelToTileUnitsFactor),c=this.paint.get("fill-extrusion-height").evaluate(e,r),h=this.paint.get("fill-extrusion-base").evaluate(e,r),p=[0,0],d=o&&s.elevation,f=s.elevation?s.elevation.exaggeration():1,m=t.tile.getBucket(this);if(d&&m instanceof Yf){const t=m.centroidVertexArray,e=l+1;e<t.length&&(p[0]=t.geta_centroid_pos0(e),p[1]=t.geta_centroid_pos1(e))}if(0===p[0]&&1===p[1])return!1;"globe"===s.projection.name&&(n=sm([n],[new $t(0,0),new $t(Ui,Ui)],t.tileID.canonical).map((t=>t.polygon)).flat());const y=d?o:null,[g,x]=vm(s,n,h,c,u,a,y,p,f,s.center.lat,t.tileID.canonical),v=t.queryGeometry;return xm(g,x,v.isPointQuery()?v.screenBounds:v.screenGeometry)}},building:class extends ml{constructor(t,e,r,n){super(t,{layout:Ig||(Ig=new No({visibility:new Do(jo.layout_building.visibility),"building-facade":new Ro(jo.layout_building["building-facade"]),"building-facade-floors":new Ro(jo.layout_building["building-facade-floors"]),"building-facade-unit-width":new Ro(jo.layout_building["building-facade-unit-width"]),"building-facade-window":new Ro(jo.layout_building["building-facade-window"]),"building-roof-shape":new Ro(jo.layout_building["building-roof-shape"]),"building-height":new Ro(jo.layout_building["building-height"]),"building-base":new Ro(jo.layout_building["building-base"]),"building-flood-light-wall-radius":new Ro(jo.layout_building["building-flood-light-wall-radius"]),"building-flood-light-ground-radius":new Ro(jo.layout_building["building-flood-light-ground-radius"]),"building-flip-roof-orientation":new Ro(jo.layout_building["building-flip-roof-orientation"])})),paint:Mg||(Mg=new No({"building-opacity":new Do(jo.paint_building["building-opacity"]),"building-ambient-occlusion-intensity":new Do(jo.paint_building["building-ambient-occlusion-intensity"]),"building-ambient-occlusion-ground-intensity":new Do(jo.paint_building["building-ambient-occlusion-ground-intensity"]),"building-ambient-occlusion-ground-radius":new Do(jo.paint_building["building-ambient-occlusion-ground-radius"]),"building-ambient-occlusion-ground-attenuation":new Do(jo.paint_building["building-ambient-occlusion-ground-attenuation"]),"building-vertical-scale":new Do(jo.paint_building["building-vertical-scale"]),"building-cast-shadows":new Do(jo.paint_building["building-cast-shadows"]),"building-color":new Ro(jo.paint_building["building-color"]),"building-emissive-strength":new Ro(jo.paint_building["building-emissive-strength"]),"building-facade-emissive-chance":new Do(jo.paint_building["building-facade-emissive-chance"]),"building-cutoff-fade-range":new Do(jo.paint_building["building-cutoff-fade-range"]),"building-flood-light-color":new Do(jo.paint_building["building-flood-light-color"]),"building-flood-light-intensity":new Do(jo.paint_building["building-flood-light-intensity"]),"building-flood-light-ground-attenuation":new Do(jo.paint_building["building-flood-light-ground-attenuation"]),"building-color-use-theme":new Ro({type:"string",default:"default","property-type":"data-driven"}),"building-flood-light-color-use-theme":new Ro({type:"string",default:"default","property-type":"data-driven"})}))},e,r,n),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(t){return new wg(t)}cutoffRange(){return this.paint.get("building-cutoff-fade-range")}hasShadowPass(){return this.paint.get("building-cast-shadows")}hasLightBeamPass(){return!0}canCastShadows(){return!0}is3D(t){return!0}queryRadius(t){return 0}queryIntersectsFeature(t,e,r,n,i,s,a,o,l){let u=this.layout.get("building-height").evaluate(e,r);const c=this.layout.get("building-base").evaluate(e,r),h=t.tile.getBucket(this).getFootprint(e);if(h){if(0!==h.hiddenFlags)return!1;u=h.height}const[p,d]=vm(s,n,c,u,new $t(0,0),a,null,[0,0],1,s.center.lat,t.tileID.canonical),f=t.queryGeometry;return xm(p,d,f.isPointQuery()?f.screenBounds:f.screenGeometry)}},line:class extends ml{constructor(t,e,r,n){const i=Qg();super(t,i,e,r,n),i.layout&&(this.layout=new Co(i.layout)),this.gradientVersion=0,this.hasElevatedBuckets=!1,this.hasNonElevatedBuckets=!1}_handleSpecialPaintPropertyUpdate(t){if("line-gradient"===t){const t=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=t._styleExpression&&t._styleExpression.expression instanceof ks,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}widthExpression(){return this._transitionablePaint._values["line-width"].value.expression}emissiveStrengthExpression(){return this._transitionablePaint._values["line-emissive-strength"].value.expression}recalculate(t,e){super.recalculate(t,e),this.paint._values["line-floorwidth"]=(()=>{if(ex)return ex;const t=Qg();return ex=new tx(t.paint.properties["line-width"].specification),ex.useIntegerZoom=!0,ex})().possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new Rg(t)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getDefaultProgramParams(t,e,r){const n=Yg(this);return{config:new Wu(this,{zoom:e,lut:r}),defines:n,overrideFog:!1}}queryRadius(t){const e=t,r=rx(Rh("line-width",this,e),Rh("line-gap-width",this,e)),n=Rh("line-offset",this,e);return r/2+Math.abs(n)+Lh(this.paint.get("line-translate"))}queryIntersectsFeature(t,e,r,n,i,s){if(t.queryGeometry.isAboveHorizon)return!1;const a=Oh(t.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),s.angle,t.pixelToTileUnitsFactor),o=t.pixelToTileUnitsFactor/2*rx(this.paint.get("line-width").evaluate(e,r),this.paint.get("line-gap-width").evaluate(e,r)),l=this.paint.get("line-offset").evaluate(e,r);return l&&(n=function(t,e){const r=[],n=new $t(0,0);for(let i=0;i<t.length;i++){const s=t[i],a=[];for(let t=0;t<s.length;t++){const r=s[t],i=s[t+1],o=0===t?n:r.sub(s[t-1])._unit()._perp(),l=t===s.length-1?n:i.sub(r)._unit()._perp(),u=o._add(l)._unit();u._mult(1/(u.x*l.x+u.y*l.y)),a.push(u._mult(e)._add(r))}r.push(a)}return r}(n,l*t.pixelToTileUnitsFactor)),function(t,e,r){for(let n=0;n<e.length;n++){const i=e[n];if(t.length>=3)for(let e=0;e<i.length;e++)if(Eh(t,i[e]))return!0;if(Ih(t,i,r))return!0}return!1}(a,n,o)}isTileClipped(){return this.hasNonElevatedBuckets}isDraped(t){return!this.hasElevatedBuckets||this.layout&&"hd-road-markup"===this.layout.get("line-elevation-reference")}hasElevation(){return this.layout&&"none"!==this.layout.get("line-elevation-reference")}},symbol:aw,background:class extends ml{constructor(t,e,r,n){super(t,{layout:ow||(ow=new No({visibility:new Do(jo.layout_background.visibility)})),paint:lw||(lw=new No({"background-pitch-alignment":new Do(jo.paint_background["background-pitch-alignment"]),"background-color":new Do(jo.paint_background["background-color"]),"background-pattern":new Do(jo.paint_background["background-pattern"]),"background-opacity":new Do(jo.paint_background["background-opacity"]),"background-emissive-strength":new Do(jo.paint_background["background-emissive-strength"]),"background-color-use-theme":new Ro({type:"string",default:"default","property-type":"data-driven"})}))},e,r,n)}getProgramIds(){return[this.paint.get("background-pattern")?"backgroundPattern":"background"]}getDefaultProgramParams(t,e,r){return{overrideFog:!1}}is3D(t){return"viewport"===this.paint.get("background-pitch-alignment")}},raster:xw,"raster-particle":_w,sky:class extends ml{constructor(t,e,r,n){super(t,{layout:Mw||(Mw=new No({visibility:new Do(jo.layout_sky.visibility)})),paint:Sw||(Sw=new No({"sky-type":new Do(jo.paint_sky["sky-type"]),"sky-atmosphere-sun":new Do(jo.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new Do(jo.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new Do(jo.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new Do(jo.paint_sky["sky-gradient-radius"]),"sky-gradient":new Lo(jo.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new Do(jo.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new Do(jo.paint_sky["sky-atmosphere-color"]),"sky-opacity":new Do(jo.paint_sky["sky-opacity"]),"sky-gradient-use-theme":new Ro({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-halo-color-use-theme":new Ro({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-color-use-theme":new Ro({type:"string",default:"default","property-type":"data-driven"})}))},e,r,n),this._updateColorRamp()}_clear(){this.skyboxFbo&&(this.skyboxFbo.destroy(),this.skyboxFbo=null),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null),this._skyboxInvalidated=!0}_handleSpecialPaintPropertyUpdate(t){"sky-gradient"===t?this._updateColorRamp():"sky-atmosphere-sun"!==t&&"sky-atmosphere-halo-color"!==t&&"sky-atmosphere-color"!==t&&"sky-atmosphere-sun-intensity"!==t||(this._skyboxInvalidated=!0)}_updateColorRamp(){this.colorRamp=rd({expression:this._transitionablePaint._values["sky-gradient"].value.expression,evaluationKey:"skyRadialProgress"}),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}needsSkyboxCapture(t){if(this._skyboxInvalidated||!this.skyboxTexture||!this.skyboxGeometry)return!0;if(!this.paint.get("sky-atmosphere-sun")){const e=t.style.light.properties.get("position");return this._lightPosition.azimuthal!==e.azimuthal||this._lightPosition.polar!==e.polar}return!1}getCenter(t,e){if("atmosphere"===this.paint.get("sky-type")){const r=this.paint.get("sky-atmosphere-sun"),n=!r,i=t.style.light,s=i.properties.get("position");return n&&"viewport"===i.properties.get("anchor")&&Ae("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),n?kw(s.azimuthal,90-s.polar,e):kw(r[0],90-r[1],e)}const r=this.paint.get("sky-gradient-center");return kw(r[0],90-r[1],e)}isSky(){return!0}markSkyboxValid(t){this._skyboxInvalidated=!1,this._lightPosition=t.style.light.properties.get("position")}hasOffscreenPass(){return!0}getProgramIds(){const t=this.paint.get("sky-type");return"atmosphere"===t?["skyboxCapture","skybox"]:"gradient"===t?["skyboxGradient"]:null}},slot:class extends ml{constructor(t,e,r,n){super(t,{paint:Pw||(Pw=new No({}))},e,null)}},model:class extends ml{constructor(t,e,r,n){super(t,{layout:Rw||(Rw=new No({visibility:new Do(jo.layout_model.visibility),"model-id":new Ro(jo.layout_model["model-id"])})),paint:Lw||(Lw=new No({"model-opacity":new Ro(jo.paint_model["model-opacity"]),"model-rotation":new Ro(jo.paint_model["model-rotation"]),"model-scale":new Ro(jo.paint_model["model-scale"]),"model-translation":new Ro(jo.paint_model["model-translation"]),"model-color":new Ro(jo.paint_model["model-color"]),"model-color-mix-intensity":new Ro(jo.paint_model["model-color-mix-intensity"]),"model-type":new Do(jo.paint_model["model-type"]),"model-cast-shadows":new Do(jo.paint_model["model-cast-shadows"]),"model-receive-shadows":new Do(jo.paint_model["model-receive-shadows"]),"model-ambient-occlusion-intensity":new Do(jo.paint_model["model-ambient-occlusion-intensity"]),"model-emissive-strength":new Ro(jo.paint_model["model-emissive-strength"]),"model-roughness":new Ro(jo.paint_model["model-roughness"]),"model-height-based-emissive-strength-multiplier":new Ro(jo.paint_model["model-height-based-emissive-strength-multiplier"]),"model-cutoff-fade-range":new Do(jo.paint_model["model-cutoff-fade-range"]),"model-front-cutoff":new Do(jo.paint_model["model-front-cutoff"]),"model-elevation-reference":new Do(jo.paint_model["model-elevation-reference"]),"model-color-use-theme":new Ro({type:"string",default:"default","property-type":"data-driven"})}))},e,r,n),this.layer=t,this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(t){return new Dw(t)}getProgramIds(){return["model"]}is3D(t){return!0}hasShadowPass(){return!0}canCastShadows(){return!0}hasLightBeamPass(){return!0}cutoffRange(){return this.paint.get("model-cutoff-fade-range")}queryRadius(t){return t instanceof Xw?Ui-1:0}queryRenderedFeatures(t,e,r){const n=e.getSource();if(!(n&&n instanceof t_))return{};const i=n,s={};s[this.id]=[];const a=s[this.id];let o=0;for(const n of i.models){const i=e.getFeatureState(this.sourceLayer,n.id),s={type:"Unknown",id:n.id,properties:n.featureProperties},l=this.paint.get("model-rotation").evaluate(s,i),u=this.paint.get("model-scale").evaluate(s,i),c=this.paint.get("model-translation").evaluate(s,i),h=this.paint.get("model-elevation-reference");let p=[];Uy(p,n,r,n.position,l,u,c,"ground"===h,"ground"===h,!1),"globe"===r.projection.name&&(p=Cy(p,r));const d=g([],r.projMatrix,p),f=Dy(t.isPointQuery()?t.screenBounds:t.screenGeometry,r,d,n.aabb);if(null!=f){const t=new Jw(void 0,0,0,0,n.id);t.layer=this.layer,t.properties=structuredClone(n.featureProperties),t.properties.layer=this.id,t.properties.uri=n.uri,t.properties.orientation=n.orientation,t.sourceLayer=this.sourceLayer,t.geometry={type:"Point",coordinates:[n.position.lng,n.position.lat]},t.state=i,t.source=this.source,a.push({featureIndex:o,feature:t,intersectionZ:f})}++o}return s}queryIntersectsFeature(t,e,r,n,i,s){if(!this.modelManager)return!1;const a=this.modelManager,o=t.tile.getBucket(this);if(!(o&&o instanceof Dw))return!1;for(const r in o.instancesPerModel){const n=o.instancesPerModel[r],i=void 0!==e.id?e.id:e.properties&&e.properties.hasOwnProperty("id")?e.properties.id:void 0;if(n.idToFeaturesIndex.hasOwnProperty(i)){const e=n.features[n.idToFeaturesIndex[i]],l=a.getModel(r,this.scope);if(!l)return!1;let u=[];const c=new yc(0,0),h=o.canonical;let p=Number.MAX_VALUE;for(let r=0;r<e.instancedDataCount;++r){const i=16*(e.instancedDataOffset+r),a=n.instancedDataArray.float32,o=[a[i+4],a[i+5],a[i+6]];e_(h,c,Math.floor(a[i]),Math.floor(a[i+1])),Uy(u,l,s,c,e.rotation,e.scale,o,!1,!1,!1),"globe"===s.projection.name&&(u=Cy(u,s));const d=g([],s.projMatrix,u),f=t.queryGeometry,m=Dy(f.isPointQuery()?f.screenBounds:f.screenGeometry,s,d,l.aabb);null!=m&&(p=Math.min(m,p))}return p!==Number.MAX_VALUE&&p}}return!1}_handleOverridablePaintPropertyUpdate(t,e,r){return!(!this.layout||e.isDataDriven()||r.isDataDriven()||"model-color"!==t&&"model-color-mix-intensity"!==t&&"model-rotation"!==t&&"model-scale"!==t&&"model-translation"!==t&&"model-emissive-strength"!==t)}_isPropertyZoomDependent(t){const e=this._transitionablePaint._values[t];return null!=e&&null!=e.value&&null!=e.value.expression&&e.value.expression instanceof Ga}isZoomDependent(){return this._isPropertyZoomDependent("model-scale")||this._isPropertyZoomDependent("model-rotation")||this._isPropertyZoomDependent("model-translation")}},clip:class extends ml{constructor(t,e,r,n){super(t,{layout:tf||(tf=new No({"clip-layer-types":new Do(jo.layout_clip["clip-layer-types"]),"clip-layer-scope":new Do(jo.layout_clip["clip-layer-scope"])})),paint:ef||(ef=new No({}))},e,r,n)}recalculate(t,e){super.recalculate(t,e)}createBucket(t){return new sf(t)}is3D(t){return!0}}};function i_(t,e,r,n){return"custom"===t.type?new Iw(t,e):new n_[t.type](t,e,r,n)}const s_=new un(0,0,0),a_={PATH_RULE_NON_ZERO:1,PATH_RULE_EVEN_ODD:2},o_={LINE_CAP_BUTT:1,LINE_CAP_ROUND:2,LINE_CAP_SQUARE:3},l_={LINE_JOIN_MITER:1,LINE_JOIN_MITER_CLIP:2,LINE_JOIN_ROUND:3,LINE_JOIN_BEVEL:4},u_={PAINT_ORDER_FILL_AND_STROKE:1},c_={PATH_COMMAND_MOVE:1,PATH_COMMAND_LINE:2,PATH_COMMAND_QUAD:3,PATH_COMMAND_CUBIC:4,PATH_COMMAND_CLOSE:5},h_={MASK_TYPE_LUMINANCE:1};function p_(t,e){return t.readFields(d_,{icons:[]},e)}function d_(t,e,r){1===t&&e.icons.push(function(t,e){return function(t){if(t.usvg_tree.height||(t.usvg_tree.height=t.usvg_tree.width),!t.metadata)return t;const{metadata:e}=t;if(e.content_area){const{content_area:r}=e;null==r.left&&(r.left=0),null==r.top&&(r.top=r.left),null==r.width&&(r.width=t.usvg_tree.width),null==r.height&&(r.height=r.width)}if(e.text_placeholder){const{text_placeholder:t}=e;null==t.top&&(t.top=t.left),null==t.height&&(t.height=t.width)}return e.stretch_x&&e.stretch_x.length&&f_(e,"x"),e.stretch_y&&e.stretch_y.length&&f_(e,"y"),t}(t.readFields(m_,{name:void 0},e))}(r,r.readVarint()+r.pos))}function f_(t,e){const r=[],n=t[`stretch_${e}`];let i=null;for(let t=0;t<n.length;t++)null===i?i=0===r.length?n[0]:r[r.length-1][1]+n[t]:(r.push([i,i+n[t]]),i=null);t[`stretch_${e}_areas`]=r}function m_(t,e,r){1===t?e.name=r.readString():2===t?e.metadata=function(t,e){return t.readFields(y_,{stretch_x:null,stretch_y:null,stretch_x_areas:null,stretch_y_areas:null,variables:[]},e)}(r,r.readVarint()+r.pos):3===t&&(e.usvg_tree=function(t,e){return t.readFields(b_,{width:20,children:[],linear_gradients:[],radial_gradients:[],clip_paths:[],masks:[]},e)}(r,r.readVarint()+r.pos),e.data="usvg_tree")}function y_(t,e,r){1===t?e.stretch_x=r.readPackedVarint():2===t?e.stretch_y=r.readPackedVarint():3===t?e.content_area=g_(r,r.readVarint()+r.pos):4===t?e.variables.push(function(t,e){return t.readFields(v_,{name:void 0},e)}(r,r.readVarint()+r.pos)):5===t&&(e.text_placeholder=g_(r,r.readVarint()+r.pos))}function g_(t,e){return t.readFields(x_,{},e)}function x_(t,e,r){1===t?e.left=r.readVarint():2===t?e.width=r.readVarint():3===t?e.top=r.readVarint():4===t&&(e.height=r.readVarint())}function v_(t,e,r){1===t?e.name=r.readString():2===t&&(e.rgb_color=k_(r.readVarint()),e.value="rgb_color")}function b_(t,e,r){1===t?e.width=e.height=r.readVarint():2===t?e.height=r.readVarint():3===t?e.children.push(w_(r,r.readVarint()+r.pos)):4===t?e.linear_gradients.push(function(t,e){return t.readFields(z_,{spread_method:1,stops:[],x1:0,y1:0,x2:1,y2:0},e)}(r,r.readVarint()+r.pos)):5===t?e.radial_gradients.push(function(t,e){return t.readFields(V_,{spread_method:1,stops:[],cx:.5,cy:.5,r:.5,fx:.5,fy:.5,fr:0},e)}(r,r.readVarint()+r.pos)):7===t?e.clip_paths.push(function(t,e){return t.readFields(F_,{children:[]},e)}(r,r.readVarint()+r.pos)):8===t&&e.masks.push(function(t,e){const r=t.readFields(C_,{left:0,width:20,mask_type:h_.MASK_TYPE_LUMINANCE,children:[]},e);return null==r.height&&(r.height=r.width),null==r.top&&(r.top=r.left),r}(r,r.readVarint()+r.pos))}function w_(t,e){return t.readFields(__,{},e)}function __(t,e,r){1===t?(e.group=function(t,e){return t.readFields(A_,{opacity:255,children:[]},e)}(r,r.readVarint()+r.pos),e.node="group"):2===t&&(e.path=function(t,e){return t.readFields(S_,{paint_order:1,commands:[],step:1,diffs:[],rule:a_.PATH_RULE_NON_ZERO},e)}(r,r.readVarint()+r.pos),e.node="path")}function A_(t,e,r){1===t?e.transform=I_(r,r.readVarint()+r.pos):2===t?e.opacity=r.readVarint():5===t?e.clip_path_idx=r.readVarint():6===t?e.mask_idx=r.readVarint():7===t&&e.children.push(w_(r,r.readVarint()+r.pos))}function I_(t,e){return t.readFields(M_,{sx:1,ky:0,kx:0,sy:1,tx:0,ty:0},e)}function M_(t,e,r){1===t?e.sx=r.readFloat():2===t?e.ky=r.readFloat():3===t?e.kx=r.readFloat():4===t?e.sy=r.readFloat():5===t?e.tx=r.readFloat():6===t&&(e.ty=r.readFloat())}function S_(t,e,r){1===t?e.fill=function(t,e){return t.readFields(P_,{rgb_color:s_,paint:"rgb_color",opacity:255},e)}(r,r.readVarint()+r.pos):2===t?e.stroke=function(t,e){return t.readFields(B_,{rgb_color:s_,paint:"rgb_color",dasharray:[],dashoffset:0,miterlimit:4,opacity:255,width:1,linecap:1,linejoin:1},e)}(r,r.readVarint()+r.pos):3===t?e.paint_order=r.readVarint():5===t?r.readPackedVarint(e.commands):6===t?e.step=r.readFloat():7===t?r.readPackedSVarint(e.diffs):8===t&&(e.rule=r.readVarint())}function P_(t,e,r){1===t?(e.rgb_color=k_(r.readVarint()),e.paint="rgb_color"):2===t?(e.linear_gradient_idx=r.readVarint(),e.paint="linear_gradient_idx"):3===t?(e.radial_gradient_idx=r.readVarint(),e.paint="radial_gradient_idx"):5===t&&(e.opacity=r.readVarint())}function k_(t){return new un((t>>16&255)/255,(t>>8&255)/255,(255&t)/255,1)}function B_(t,e,r){1===t?(e.rgb_color=k_(r.readVarint()),e.paint="rgb_color"):2===t?(e.linear_gradient_idx=r.readVarint(),e.paint="linear_gradient_idx"):3===t?(e.radial_gradient_idx=r.readVarint(),e.paint="radial_gradient_idx"):5===t?r.readPackedFloat(e.dasharray):6===t?e.dashoffset=r.readFloat():7===t?e.miterlimit=r.readFloat():8===t?e.opacity=r.readVarint():9===t?e.width=r.readFloat():10===t?e.linecap=r.readVarint():11===t&&(e.linejoin=r.readVarint())}function z_(t,e,r){1===t?e.transform=I_(r,r.readVarint()+r.pos):2===t?e.spread_method=r.readVarint():3===t?e.stops.push(T_(r,r.readVarint()+r.pos)):4===t?e.x1=r.readFloat():5===t?e.y1=r.readFloat():6===t?e.x2=r.readFloat():7===t&&(e.y2=r.readFloat())}function T_(t,e){return t.readFields(E_,{offset:0,opacity:255,rgb_color:s_},e)}function E_(t,e,r){1===t?e.offset=r.readFloat():2===t?e.opacity=r.readVarint():3===t&&(e.rgb_color=k_(r.readVarint()))}function V_(t,e,r){1===t?e.transform=I_(r,r.readVarint()+r.pos):2===t?e.spread_method=r.readVarint():3===t?e.stops.push(T_(r,r.readVarint()+r.pos)):4===t?e.cx=r.readFloat():5===t?e.cy=r.readFloat():6===t?e.r=r.readFloat():7===t?e.fx=r.readFloat():8===t?e.fy=r.readFloat():9===t&&(e.fr=r.readFloat())}function F_(t,e,r){1===t?e.transform=I_(r,r.readVarint()+r.pos):2===t?e.clip_path_idx=r.readVarint():3===t&&e.children.push(w_(r,r.readVarint()+r.pos))}function C_(t,e,r){1===t?e.left=e.top=r.readFloat():2===t?e.width=e.height=r.readFloat():3===t?e.top=r.readFloat():4===t?e.height=r.readFloat():5===t?e.mask_type=r.readVarint():6===t?e.mask_idx=r.readVarint():7===t&&e.children.push(w_(r,r.readVarint()+r.pos))}class D_{static calculate(t={},e=[]){const r=new Map,n=new Map;if(0===Object.keys(t).length)return r;e.forEach((t=>{n.set(t.name,t.rgb_color||new un(0,0,0))}));for(const[e,i]of Object.entries(t))n.has(e)?r.set(n.get(e).toString(),i):console.warn(`Ignoring unknown image variable "${e}"`);return r}}function R_(t,e=255,r){const n=e/255,i=t.toString(),s=r.has(i)?r.get(i).clone():t.clone();return s.a*=n,s.toString()}function L_(t,e){if(!or()){const r=document.createElement("canvas");return r.width=t,r.height=e,r}return new OffscreenCanvas(t,e)}let O_,U_=null;function N_(t,e,r,n,i){for(const s of n.children)j_(t,e,r,s,i)}function j_(t,e,r,n,i){n.group?(t.save(),function(t,e,r,n,i){const s=null!=n.mask_idx?r.masks[n.mask_idx]:null,a=null!=n.clip_path_idx?r.clip_paths[n.clip_path_idx]:null;if(n.transform&&(e=K_(n.transform).preMultiplySelf(e)),!function(t,e,r){return 255!==t.opacity||e||r}(n,null!=a,null!=s))return void N_(t,e,r,n,i);const o=L_(t.canvas.width,t.canvas.height),l=o.getContext("2d");N_(l,e,r,n,i),a&&W_(l,e,r,a),s&&Y_(l,e,r,s,i),t.globalAlpha=n.opacity/255,t.drawImage(o,0,0)}(t,e,r,n.group,i),t.restore()):n.path&&(t.save(),function(t,e,r,n,i){t.setTransform(e),n.paint_order===u_.PAINT_ORDER_FILL_AND_STROKE?($_(t,r,n,i),q_(t,r,n,i)):(q_(t,r,n,i),$_(t,r,n,i))}(t,e,r,n.path,i),t.restore())}function $_(t,e,r,n){const i=r.fill;if(!i)return;const s=i.opacity/255;switch(t.save(),t.beginPath(),J_(r,t),i.paint){case"rgb_color":t.fillStyle=R_(i.rgb_color,i.opacity,n);break;case"linear_gradient_idx":{const r=e.linear_gradients[i.linear_gradient_idx];r.transform&&t.setTransform(K_(r.transform).preMultiplySelf(t.getTransform())),t.fillStyle=H_(t,r,s,n);break}case"radial_gradient_idx":{const r=e.radial_gradients[i.radial_gradient_idx];r.transform&&t.setTransform(K_(r.transform).preMultiplySelf(t.getTransform())),t.fillStyle=X_(t,r,s,n)}}t.fill(G_(r)),t.restore()}function G_(t){return t.rule===a_.PATH_RULE_NON_ZERO?"nonzero":t.rule===a_.PATH_RULE_EVEN_ODD?"evenodd":void 0}function q_(t,e,r,n){const i=r.stroke;if(!i)return;const s=Q_(r);t.lineWidth=i.width,t.miterLimit=i.miterlimit,t.setLineDash(i.dasharray),t.lineDashOffset=i.dashoffset;const a=i.opacity/255;switch(i.paint){case"rgb_color":t.strokeStyle=R_(i.rgb_color,i.opacity,n);break;case"linear_gradient_idx":t.strokeStyle=H_(t,e.linear_gradients[i.linear_gradient_idx],a,n,!0);break;case"radial_gradient_idx":t.strokeStyle=X_(t,e.radial_gradients[i.radial_gradient_idx],a,n,!0)}switch(i.linejoin){case l_.LINE_JOIN_MITER_CLIP:case l_.LINE_JOIN_MITER:t.lineJoin="miter";break;case l_.LINE_JOIN_ROUND:t.lineJoin="round";break;case l_.LINE_JOIN_BEVEL:t.lineJoin="bevel"}switch(i.linecap){case o_.LINE_CAP_BUTT:t.lineCap="butt";break;case o_.LINE_CAP_ROUND:t.lineCap="round";break;case o_.LINE_CAP_SQUARE:t.lineCap="square"}t.stroke(s)}function H_(t,e,r,n,i=!1){if(1===e.stops.length){const t=e.stops[0];return R_(t.rgb_color,t.opacity*r,n)}const{x1:s,y1:a,x2:o,y2:l}=e;let u=new DOMPoint(s,a),c=new DOMPoint(o,l);if(i){const t=K_(e.transform);u=t.transformPoint(u),c=t.transformPoint(c)}const h=t.createLinearGradient(u.x,u.y,c.x,c.y);for(const t of e.stops)h.addColorStop(t.offset,R_(t.rgb_color,t.opacity*r,n));return h}function X_(t,e,r,n,i=!1){if(1===e.stops.length){const t=e.stops[0];return R_(t.rgb_color,t.opacity*r,n)}const s=K_(e.transform),{fx:a,fy:o,fr:l,cx:u,cy:c,r:h}=e;let p=new DOMPoint(a,o),d=new DOMPoint(u,c),f=l,m=h;if(i){p=s.transformPoint(p),d=s.transformPoint(d);const t=(s.a+s.d)/2;f=l*t,m=e.r*t}const y=t.createRadialGradient(p.x,p.y,f,d.x,d.y,m);for(const t of e.stops)y.addColorStop(t.offset,R_(t.rgb_color,t.opacity*r,n));return y}function Z_(t,e,r,n){const i=n.transform?K_(n.transform).preMultiplySelf(e):e,s=L_(t.canvas.width,t.canvas.height),a=s.getContext("2d");for(const t of n.children)if(t.group)Z_(a,i,r,t.group);else if(t.path){const e=t.path,r=new Path2D;r.addPath(Q_(e),i),a.fill(r,G_(e))}const o=null!=n.clip_path_idx?r.clip_paths[n.clip_path_idx]:null;o&&W_(a,i,r,o),t.globalCompositeOperation="source-over",t.drawImage(s,0,0)}function W_(t,e,r,n){const i=L_(t.canvas.width,t.canvas.height);Z_(i.getContext("2d"),e,r,n),t.globalCompositeOperation="destination-in",t.drawImage(i,0,0)}function Y_(t,e,r,n,i){if(0===n.children.length)return;const s=null!=n.mask_idx?r.masks[n.mask_idx]:null;s&&Y_(t,e,r,s,i);const a=t.canvas.width,o=t.canvas.height,l=L_(a,o),u=l.getContext("2d"),c=n.width,h=n.height,p=n.left,d=n.top,f=new Path2D,m=new Path2D;m.rect(p,d,c,h),f.addPath(m,e),u.clip(f);for(const t of n.children)j_(u,e,r,t,i);const y=u.getImageData(0,0,a,o),g=y.data;if(n.mask_type===h_.MASK_TYPE_LUMINANCE)for(let t=0;t<g.length;t+=4)g[t+3]=g[t+3]/255*(.2126*g[t]+.7152*g[t+1]+.0722*g[t+2]);u.putImageData(y,0,0),t.globalCompositeOperation="destination-in",t.drawImage(l,0,0)}function K_(t){return t?new DOMMatrix([t.sx,t.ky,t.kx,t.sy,t.tx,t.ty]):new DOMMatrix}function J_(t,e){const r=t.step;let n=t.diffs[0]*r,i=t.diffs[1]*r;e.moveTo(n,i);for(let s=0,a=2;s<t.commands.length;s++)switch(t.commands[s]){case c_.PATH_COMMAND_MOVE:n+=t.diffs[a++]*r,i+=t.diffs[a++]*r,e.moveTo(n,i);break;case c_.PATH_COMMAND_LINE:n+=t.diffs[a++]*r,i+=t.diffs[a++]*r,e.lineTo(n,i);break;case c_.PATH_COMMAND_QUAD:{const s=n+t.diffs[a++]*r,o=i+t.diffs[a++]*r;n=s+t.diffs[a++]*r,i=o+t.diffs[a++]*r,e.quadraticCurveTo(s,o,n,i);break}case c_.PATH_COMMAND_CUBIC:{const s=n+t.diffs[a++]*r,o=i+t.diffs[a++]*r,l=s+t.diffs[a++]*r,u=o+t.diffs[a++]*r;n=l+t.diffs[a++]*r,i=u+t.diffs[a++]*r,e.bezierCurveTo(s,o,l,u,n,i);break}case c_.PATH_COMMAND_CLOSE:e.closePath()}return e}function Q_(t){return J_(t,new Path2D)}class tA{constructor(t){this.capacity=t,this.cache=new Map}get(t){if(!this.cache.has(t))return;const e=this.cache.get(t);return this.cache.delete(t),this.cache.set(t,e),e}put(t,e){this.cache.has(t)?this.cache.delete(t):this.cache.size===this.capacity&&this.cache.delete(this.cache.keys().next().value),this.cache.set(t,e)}delete(t){this.cache.delete(t)}}Qa(tA,"LRUCache");class eA{constructor(){this.cacheMap=new Map,this.cacheDependenciesMap=new Map}static _getImage(t){return new td(t,t.data)}getFromCache(t,e,r){return this.cacheMap.has(r)||this.cacheMap.set(r,new tA(150)),this.cacheMap.get(r).get(al(t.toString(),e))}setInCache(t,e,r,n){this.cacheDependenciesMap.has(n)||this.cacheDependenciesMap.set(n,new Map),this.cacheMap.has(n)||this.cacheMap.set(n,new tA(150));const i=this.cacheDependenciesMap.get(n),s=al(t.id.toString(),r);i.get(s)||i.set(s,new Set);const a=this.cacheMap.get(n),o=t.toString();i.get(s).add(o),a.put(al(t.toString(),r),e)}removeImagesFromCacheByIds(t,e,r=0){if(!this.cacheMap.has(r)||!this.cacheDependenciesMap.has(r))return;const n=this.cacheMap.get(r),i=this.cacheDependenciesMap.get(r);for(const r of t){const t=al(r.toString(),e);if(i.has(t)){for(const e of i.get(t))n.delete(e);i.delete(t)}}}rasterize(t,e,r,n){const i=this.getFromCache(t,r,n);if(i)return i.clone();const s=function(t,e){const r=D_.calculate(e.params,t.metadata?t.metadata.variables:[]),n=t.usvg_tree,i=n.width,s=n.height,a=Math.max(1,Math.round(i*e.sx)),o=Math.max(1,Math.round(s*e.sy)),l=new DOMMatrix([a/i,0,0,o/s,0,0]);return null===U_&&(U_=L_(10,10),O_=U_.getContext("2d",{willReadFrequently:!0})),U_.width=a,U_.height=o,N_(O_,l,n,n,r),O_.getImageData(0,0,a,o)}(e.icon,t),a=eA._getImage(s);return this.setInCache(t,a,r,n),a.clone()}}class rA{constructor(t){this.entries={},this.scheduler=t}request(t,e,r,n){const i=this.entries[t]=this.entries[t]||{callbacks:[]};if(i.result){const[t,r]=i.result;return this.scheduler?this.scheduler.add((()=>{n(t,r)}),e):n(t,r),()=>{}}return i.callbacks.push(n),i.cancel||(i.cancel=r(((r,n)=>{i.result=[r,n];for(const t of i.callbacks)this.scheduler?this.scheduler.add((()=>{t(r,n)}),e):t(r,n);setTimeout((()=>delete this.entries[t]),3e3)}))),()=>{i.result||(i.callbacks=i.callbacks.filter((t=>t!==n)),i.callbacks.length||(i.cancel(),delete this.entries[t]))}}}function nA(t,e,r){const n=JSON.stringify(t.request);return t.data&&(this.deduped.entries[n]={result:[null,t.data]}),this.deduped.request(n,{type:"parseTile",isSymbolTile:t.isSymbolTile,zoom:t.tileZoom},(e=>{const n=Dr(t.request,((t,n,i)=>{t?e(t):n&&e(null,{rawData:n,vectorTile:r?void 0:new Xc(new wx(n)),responseHeaders:new Map(i.entries())})}));return()=>{n.cancel(),e()}}),e)}class iA{constructor(t){this.size=t,this.minimums=[],this.maximums=[],this.leaves=[]}getElevation(t,e){const r=this.toIdx(t,e);return{min:this.minimums[r],max:this.maximums[r]}}isLeaf(t,e){return this.leaves[this.toIdx(t,e)]}toIdx(t,e){return e*this.size+t}}function sA(t,e,r,n){let i=0,s=Number.MAX_VALUE;for(let a=0;a<3;a++)if(Math.abs(n[a])<1e-15){if(r[a]<t[a]||r[a]>e[a])return null}else{const o=1/n[a];let l=(t[a]-r[a])*o,u=(e[a]-r[a])*o;if(l>u){const t=l;l=u,u=t}if(l>i&&(i=l),u<s&&(s=u),i>s)return null}return i}function aA(t,e,r,n,i,s,a,o,l,u,c){const h=n-t,p=i-e,d=s-r,f=a-t,m=o-e,y=l-r,g=c[1]*y-c[2]*m,x=c[2]*f-c[0]*y,v=c[0]*m-c[1]*f,b=h*g+p*x+d*v;if(Math.abs(b)<1e-15)return null;const w=1/b,_=u[0]-t,A=u[1]-e,I=u[2]-r,M=(_*g+A*x+I*v)*w;if(M<0||M>1)return null;const S=A*d-I*p,P=I*h-_*d,k=_*p-A*h,B=(c[0]*S+c[1]*P+c[2]*k)*w;return B<0||M+B>1?null:(f*S+m*P+y*k)*w}function oA(t,e,r){return(t-e)/(r-e)}function lA(t,e,r,n,i,s,a,o,l){const u=1<<r,c=s-n,h=a-i,p=(t+1)/u*c+n,d=(e+0)/u*h+i,f=(e+1)/u*h+i;o[0]=(t+0)/u*c+n,o[1]=d,l[0]=p,l[1]=f}class uA{constructor(t){if(this.maximums=[],this.minimums=[],this.leaves=[],this.childOffsets=[],this.nodeCount=0,this.dem=t,this._siblingOffset=[[0,0],[1,0],[0,1],[1,1]],!this.dem)return;const e=function(t){const e=Math.ceil(Math.log2(t.dim/8)),r=[];let n=Math.ceil(Math.pow(2,e));const i=1/n,s=(t,e,r,n,i)=>{const s=n?1:0,a=(t+1)*r-s,o=e*r,l=(e+1)*r-s;i[0]=t*r,i[1]=o,i[2]=a,i[3]=l};let a=new iA(n);const o=[];for(let e=0;e<n*n;e++){s(e%n,Math.floor(e/n),i,!1,o);const r=hA(o[0],o[1],t),l=hA(o[2],o[1],t),u=hA(o[2],o[3],t),c=hA(o[0],o[3],t);a.minimums.push(Math.min(r,l,u,c)),a.maximums.push(Math.max(r,l,u,c)),a.leaves.push(1)}for(r.push(a),n/=2;n>=1;n/=2){const t=r[r.length-1];a=new iA(n);for(let e=0;e<n*n;e++){s(e%n,Math.floor(e/n),2,!0,o);const r=t.getElevation(o[0],o[1]),i=t.getElevation(o[2],o[1]),l=t.getElevation(o[2],o[3]),u=t.getElevation(o[0],o[3]),c=t.isLeaf(o[0],o[1]),h=t.isLeaf(o[2],o[1]),p=t.isLeaf(o[2],o[3]),d=t.isLeaf(o[0],o[3]),f=Math.min(r.min,i.min,l.min,u.min),m=Math.max(r.max,i.max,l.max,u.max),y=c&&h&&p&&d;a.maximums.push(m),a.minimums.push(f),a.leaves.push(m-f<=5&&y?1:0)}r.push(a)}return r}(this.dem),r=e.length-1,n=e[r];this._addNode(n.minimums[0],n.maximums[0],n.leaves[0]),this._construct(e,0,0,r,0)}raycastRoot(t,e,r,n,i,s,a=1){return sA([t,e,-100],[r,n,this.maximums[0]*a],i,s)}raycast(t,e,r,n,i,s,a=1){if(!this.nodeCount)return null;const o=this.raycastRoot(t,e,r,n,i,s,a);if(null==o)return null;const l=[],u=[],c=[],h=[],p=[{idx:0,t:o,nodex:0,nodey:0,depth:0}];for(;p.length>0;){const{idx:o,t:d,nodex:f,nodey:m,depth:y}=p.pop();if(this.leaves[o]){lA(f,m,y,t,e,r,n,c,h);const o=1<<y,l=(f+0)/o,u=(f+1)/o,p=(m+0)/o,g=(m+1)/o,x=hA(l,p,this.dem)*a,v=hA(u,p,this.dem)*a,b=hA(u,g,this.dem)*a,w=hA(l,g,this.dem)*a,_=aA(c[0],c[1],x,h[0],c[1],v,h[0],h[1],b,i,s),A=aA(h[0],h[1],b,c[0],h[1],w,c[0],c[1],x,i,s),I=Math.min(null!==_?_:Number.MAX_VALUE,null!==A?A:Number.MAX_VALUE);if(I!==Number.MAX_VALUE)return I;{const t=j([],i,s,d);if(cA(x,v,w,b,oA(t[0],c[0],h[0]),oA(t[1],c[1],h[1]))>=t[2])return d}continue}let g=0;for(let p=0;p<this._siblingOffset.length;p++){lA((f<<1)+this._siblingOffset[p][0],(m<<1)+this._siblingOffset[p][1],y+1,t,e,r,n,c,h),c[2]=-100,h[2]=this.maximums[this.childOffsets[o]+p]*a;const d=sA(c,h,i,s);if(null!=d){const t=d;l[p]=t;let e=!1;for(let r=0;r<g&&!e;r++)t>=l[u[r]]&&(u.splice(r,0,p),e=!0);e||(u[g]=p),g++}}for(let t=0;t<g;t++){const e=u[t];p.push({idx:this.childOffsets[o]+e,t:l[e],nodex:(f<<1)+this._siblingOffset[e][0],nodey:(m<<1)+this._siblingOffset[e][1],depth:y+1})}}return null}_addNode(t,e,r){return this.minimums.push(t),this.maximums.push(e),this.leaves.push(r),this.childOffsets.push(0),this.nodeCount++}_construct(t,e,r,n,i){if(1===t[n].isLeaf(e,r))return;this.childOffsets[i]||(this.childOffsets[i]=this.nodeCount);const s=n-1,a=t[s];let o=0,l=0;for(let t=0;t<this._siblingOffset.length;t++){const n=2*e+this._siblingOffset[t][0],i=2*r+this._siblingOffset[t][1],s=a.getElevation(n,i),u=a.isLeaf(n,i),c=this._addNode(s.min,s.max,u);u&&(o|=1<<t),l||(l=c)}for(let n=0;n<this._siblingOffset.length;n++)o&1<<n||this._construct(t,2*e+this._siblingOffset[n][0],2*r+this._siblingOffset[n][1],s,l+n)}}function cA(t,e,r,n,i,s){return dn(dn(t,r,s),dn(e,n,s),i)}function hA(t,e,r){const n=r.dim,i=ie(t*n-.5,0,n-1),s=ie(e*n-.5,0,n-1),a=Math.floor(i),o=Math.floor(s),l=Math.min(a+1,n-1),u=Math.min(o+1,n-1);return cA(r.get(a,o),r.get(l,o),r.get(a,u),r.get(l,u),i-a,s-o)}const pA={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]};function dA(t,e,r){return(256*t*256+256*e+r)/10-1e4}function fA(t,e,r){return 256*t+e+r/256-32768}class mA{get tree(){return this._tree||this._buildQuadTree(),this._tree}constructor(t,e,r,n=!1){if(this.uid=t,e.height!==e.width)throw new RangeError("DEM tiles must be square");if(r&&"mapbox"!==r&&"terrarium"!==r)return void Ae(`"${r}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=e.height;const i=this.dim=e.height-2,s=new Uint32Array(e.data.buffer);if(this.pixels=new Uint8Array(e.data.buffer),this.floatView=new Float32Array(e.data.buffer),this.borderReady=n,this._modifiedForSources={},!n){for(let t=0;t<i;t++)s[this._idx(-1,t)]=s[this._idx(0,t)],s[this._idx(i,t)]=s[this._idx(i-1,t)],s[this._idx(t,-1)]=s[this._idx(t,0)],s[this._idx(t,i)]=s[this._idx(t,i-1)];s[this._idx(-1,-1)]=s[this._idx(0,0)],s[this._idx(i,-1)]=s[this._idx(i-1,0)],s[this._idx(-1,i)]=s[this._idx(0,i-1)],s[this._idx(i,i)]=s[this._idx(i-1,i-1)]}const a="terrarium"===r?fA:dA;for(let t=0;t<s.length;++t){const e=4*t;this.floatView[t]=a(this.pixels[e],this.pixels[e+1],this.pixels[e+2])}this._timestamp=lr.now()}_buildQuadTree(){this._tree=new uA(this)}get(t,e,r=!1){r&&(t=ie(t,-1,this.dim),e=ie(e,-1,this.dim));const n=this._idx(t,e);return this.floatView[n]}set(t,e,r){const n=this._idx(t,e),i=this.floatView[n];return this.floatView[n]=r,r-i}static getUnpackVector(t){return pA[t]}_idx(t,e){if(t<-1||t>=this.dim+1||e<-1||e>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(e+1)*this.stride+(t+1)}static pack(t,e){const r=[0,0,0,0],n=mA.getUnpackVector(e);let i=Math.floor((t+n[3])/n[2]);return r[2]=i%256,i=Math.floor(i/256),r[1]=i%256,i=Math.floor(i/256),r[0]=i,r}getPixels(){return new ed({width:this.stride,height:this.stride},this.pixels)}backfillBorder(t,e,r){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let n=e*this.dim,i=e*this.dim+this.dim,s=r*this.dim,a=r*this.dim+this.dim;switch(e){case-1:n=i-1;break;case 1:i=n+1}switch(r){case-1:s=a-1;break;case 1:a=s+1}const o=-e*this.dim,l=-r*this.dim;for(let e=s;e<a;e++)for(let r=n;r<i;r++){const n=4*this._idx(r,e),i=4*this._idx(r+o,e+l);this.pixels[n+0]=t.pixels[i+0],this.pixels[n+1]=t.pixels[i+1],this.pixels[n+2]=t.pixels[i+2],this.pixels[n+3]=t.pixels[i+3]}}onDeserialize(){this._tree&&(this._tree.dem=this)}}function yA(t,e,r){1===t?e.headerLength=r.readFixed32():2===t?e.x=r.readVarint():3===t?e.y=r.readVarint():4===t?e.z=r.readVarint():5===t&&e.layers.push(function(t,e){return t.readFields(wA,{version:0,name:"",units:"",tileSize:0,buffer:0,pixelFormat:0,dataIndex:[]},e)}(r,r.readVarint()+r.pos))}function gA(t,e,r){1===t?(e.delta_filter=function(t,e){return t.readFields(xA,{blockSize:0},e)}(r,r.readVarint()+r.pos),e.filter="delta_filter"):2===t?(r.readVarint(),e.filter="zigzag_filter"):3===t?(r.readVarint(),e.filter="bitshuffle_filter"):4===t&&(r.readVarint(),e.filter="byteshuffle_filter")}function xA(t,e,r){1===t&&(e.blockSize=r.readVarint())}function vA(t,e,r){1===t?(r.readVarint(),e.codec="gzip_data"):2===t?(r.readVarint(),e.codec="jpeg_image"):3===t?(r.readVarint(),e.codec="webp_image"):4===t&&(r.readVarint(),e.codec="png_image")}function bA(t,e,r){let n=0,i=0;1===t?e.firstByte=r.readFixed64():2===t?e.lastByte=r.readFixed64():3===t?e.filters.push(function(t,e){return t.readFields(gA,{},e)}(r,r.readVarint()+r.pos)):4===t?e.codec=function(t,e){return t.readFields(vA,{},e)}(r,r.readVarint()+r.pos):5===t?i=r.readFloat():6===t?n=r.readFloat():7===t?e.bands.push(r.readString()):8===t?e.offset=r.readDouble():9===t&&(e.scale=r.readDouble()),0===e.offset&&(e.offset=i),0===e.scale&&(e.scale=n)}function wA(t,e,r){1===t?e.version=r.readVarint():2===t?e.name=r.readString():3===t?e.units=r.readString():4===t?e.tileSize=r.readVarint():5===t?e.buffer=r.readVarint():6===t?e.pixelFormat=r.readVarint():7===t&&e.dataIndex.push(function(t,e){return t.readFields(bA,{firstByte:0,lastByte:0,filters:[],codec:null,offset:0,scale:0,bands:[]},e)}(r,r.readVarint()+r.pos))}function _A(t,e,r){if(2===t)!function(t,e,r){t.readFields(AA,r,e)}(r,r.readVarint()+r.pos,e);else if(3===t)throw new Error("Not implemented")}function AA(t,e,r){if(1===t){let t=0;const n=r.readVarint()+r.pos;for(;r.pos<n;)e[t++]=r.readVarint()}}function IA(t,e){if(4!==e.length)throw new Error(`Expected data of dimension 4 but got ${e.length}.`);let r=e[3];for(let n=2;n>=1;n--){const i=1===n?1:0,s=2===n?1:0;for(let n=0;n<e[0];n++){const a=e[1]*n;for(let n=i;n<e[1];n++){const i=e[2]*(n+a);for(let n=s;n<e[2];n++){const s=e[3]*(n+i);for(let n=0;n<e[3];n++){const e=s+n;t[e]+=t[e-r]}}}}r*=e[n]}return t}function MA(t){for(let e=0,r=t.length;e<r;e++)t[e]=t[e]>>>1^-(1&t[e]);return t}function SA(t,e){switch(e){case"uint32":return t;case"uint16":for(let e=0;e<t.length;e+=2){const r=t[e],n=t[e+1];t[e]=(240&r)>>4|(61440&r)>>8|(240&n)<<4|61440&n,t[e+1]=15&r|(3840&r)>>4|(15&n)<<8|(3840&n)<<4}return t;case"uint8":for(let e=0;e<t.length;e+=4){const r=t[e],n=t[e+1],i=t[e+2],s=t[e+3];t[e+0]=(192&r)>>6|(192&n)>>4|(192&i)>>2|192&s,t[e+1]=(48&r)>>4|(48&n)>>2|48&i|(48&s)<<2,t[e+2]=(12&r)>>2|12&n|(12&i)<<2|(12&s)<<4,t[e+3]=3&r|(3&n)<<2|(3&i)<<4|(3&s)<<6}return t;default:throw new Error(`Invalid pixel format, "${e}"`)}}Qa(mA,"DEMData"),Qa(uA,"DemMinMaxQuadTree",{omit:["dem"]});var PA=Uint8Array,kA=Uint16Array,BA=Int32Array,zA=new PA([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),TA=new PA([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),EA=new PA([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),VA=function(t,e){for(var r=new kA(31),n=0;n<31;++n)r[n]=e+=1<<t[n-1];var i=new BA(r[30]);for(n=1;n<30;++n)for(var s=r[n];s<r[n+1];++s)i[s]=s-r[n]<<5|n;return{b:r,r:i}},FA=VA(zA,2),CA=FA.b,DA=FA.r;CA[28]=258,DA[258]=28;for(var RA=VA(TA,0).b,LA=new kA(32768),OA=0;OA<32768;++OA){var UA=(43690&OA)>>1|(21845&OA)<<1;LA[OA]=((65280&(UA=(61680&(UA=(52428&UA)>>2|(13107&UA)<<2))>>4|(3855&UA)<<4))>>8|(255&UA)<<8)>>1}var NA=function(t,e,r){for(var n=t.length,i=0,s=new kA(e);i<n;++i)t[i]&&++s[t[i]-1];var a,o=new kA(e);for(i=1;i<e;++i)o[i]=o[i-1]+s[i-1]<<1;a=new kA(1<<e);var l=15-e;for(i=0;i<n;++i)if(t[i])for(var u=i<<4|t[i],c=e-t[i],h=o[t[i]-1]++<<c,p=h|(1<<c)-1;h<=p;++h)a[LA[h]>>l]=u;return a},jA=new PA(288);for(OA=0;OA<144;++OA)jA[OA]=8;for(OA=144;OA<256;++OA)jA[OA]=9;for(OA=256;OA<280;++OA)jA[OA]=7;for(OA=280;OA<288;++OA)jA[OA]=8;var $A=new PA(32);for(OA=0;OA<32;++OA)$A[OA]=5;var GA=NA(jA,9),qA=NA($A,5),HA=function(t){for(var e=t[0],r=1;r<t.length;++r)t[r]>e&&(e=t[r]);return e},XA=function(t,e,r){var n=e/8|0;return(t[n]|t[n+1]<<8)>>(7&e)&r},ZA=function(t,e){var r=e/8|0;return(t[r]|t[r+1]<<8|t[r+2]<<16)>>(7&e)},WA=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],YA=function(t,e,r){var n=new Error(e||WA[t]);if(n.code=t,Error.captureStackTrace&&Error.captureStackTrace(n,YA),!r)throw n;return n},KA=new PA(0),JA="undefined"!=typeof TextDecoder&&new TextDecoder;try{JA.decode(KA,{stream:!0})}catch(t){}const QA={gzip_data:"gzip"};class tI extends Error{constructor(t){super(t),this.name="MRTError"}}const eI={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},rI={uint32:1,uint16:2,uint8:4},nI={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};let iI;class sI{constructor(t=5){this.x=NaN,this.y=NaN,this.z=NaN,this.layers={},this._cacheSize=t}getLayer(t){const e=this.layers[t];if(!e)throw new tI(`Layer '${t}' not found`);return e}getHeaderLength(t){const e=new Uint8Array(t),r=new DataView(t);if(13!==e[0])throw new tI("File is not a valid MRT.");return r.getUint32(1,!0)}parseHeader(t){const e=new Uint8Array(t),r=this.getHeaderLength(t);if(e.length<r)throw new tI(`Expected header with length >= ${r} but got buffer of length ${e.length}`);const n=new iI(e.subarray(0,r)).readFields(yA,{headerLength:0,x:0,y:0,z:0,layers:[]},void 0);if(!isNaN(this.x)&&(this.x!==n.x||this.y!==n.y||this.z!==n.z))throw new tI(`Invalid attempt to parse header ${n.z}/${n.x}/${n.y} for tile ${this.z}/${this.x}/${this.y}`);this.x=n.x,this.y=n.y,this.z=n.z;for(const t of n.layers)this.layers[t.name]=new aI(t,{cacheSize:this._cacheSize});return this}createDecodingTask(t){const e=[],r=this.getLayer(t.layerName);for(let n of t.blockIndices){const i=r.dataIndex[n],s=i.firstByte-t.firstByte,a=i.lastByte-t.firstByte;if(r._blocksInProgress.has(n))continue;const o={layerName:r.name,firstByte:s,lastByte:a,pixelFormat:r.pixelFormat,blockIndex:n,blockShape:[i.bands.length].concat(r.bandShape),buffer:r.buffer,codec:i.codec.codec,filters:i.filters.map((t=>t.filter))};r._blocksInProgress.add(n),e.push(o)}return new oI(e,(()=>{e.forEach((t=>r._blocksInProgress.delete(t.blockIndex)))}),((t,n)=>{if(e.forEach((t=>r._blocksInProgress.delete(t.blockIndex))),t)throw t;n.forEach((t=>{this.getLayer(t.layerName).processDecodedData(t)}))}))}}class aI{constructor({version:t,name:e,units:r,tileSize:n,pixelFormat:i,buffer:s,dataIndex:a},o){if(this.version=t,1!==this.version)throw new tI(`Cannot parse raster layer encoded with MRT version ${t}`);this.name=e,this.units=r,this.tileSize=n,this.buffer=s,this.pixelFormat=eI[i],this.dataIndex=a,this.bandShape=[n+2*s,n+2*s,rI[this.pixelFormat]],this._decodedBlocks=new tA(o?o.cacheSize:5),this._blocksInProgress=new Set}get dimension(){return rI[this.pixelFormat]}get cacheSize(){return this._decodedBlocks.capacity}getBandList(){return this.dataIndex.map((({bands:t})=>t)).flat()}processDecodedData(t){const e=t.blockIndex.toString();this._decodedBlocks.get(e)||this._decodedBlocks.put(e,t.data)}getBlockForBand(t){let e=0;switch(typeof t){case"string":for(const[r,n]of this.dataIndex.entries()){for(const[i,s]of n.bands.entries())if(s===t)return{bandIndex:e+i,blockIndex:r,blockBandIndex:i};e+=n.bands.length}break;case"number":for(const[r,n]of this.dataIndex.entries()){if(t>=e&&t<e+n.bands.length)return{bandIndex:t,blockIndex:r,blockBandIndex:t-e};e+=n.bands.length}break;default:throw new tI(`Invalid band \`${JSON.stringify(t)}\`. Expected string or integer.`)}return{blockIndex:-1,blockBandIndex:-1}}getDataRange(t){let e=1/0,r=-1/0;const n=[],i=new Set;for(const s of t){const{blockIndex:t}=this.getBlockForBand(s);if(t<0)throw new tI(`Invalid band: ${JSON.stringify(s)}`);const a=this.dataIndex[t];n.includes(t)||n.push(t),i.add(t),e=Math.min(e,a.firstByte),r=Math.max(r,a.lastByte)}if(i.size>this.cacheSize)throw new tI(`Number of blocks to decode (${i.size}) exceeds cache size (${this.cacheSize}).`);return{layerName:this.name,firstByte:e,lastByte:r,blockIndices:n}}hasBand(t){const{blockIndex:e}=this.getBlockForBand(t);return e>=0}hasDataForBand(t){const{blockIndex:e}=this.getBlockForBand(t);return e>=0&&!!this._decodedBlocks.get(e.toString())}getBandView(t){const{blockIndex:e,blockBandIndex:r}=this.getBlockForBand(t);if(e<0)throw new tI(`Band not found: ${JSON.stringify(t)}`);const n=this._decodedBlocks.get(e.toString());if(!n)throw new tI(`Data for band ${JSON.stringify(t)} of layer "${this.name}" not decoded.`);const i=this.dataIndex[e],s=this.bandShape.reduce(((t,e)=>t*e),1),a=r*s,o=n.subarray(a,a+s);return{data:o,bytes:new Uint8Array(o.buffer).subarray(o.byteOffset,o.byteOffset+o.byteLength),tileSize:this.tileSize,buffer:this.buffer,pixelFormat:this.pixelFormat,dimension:this.dimension,offset:i.offset,scale:i.scale}}}sI.setPbf=function(t){iI=t};class oI{constructor(t,e,r){this.tasks=t,this._onCancel=e,this._onComplete=r,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(t,e){this._finalized||(this._onComplete(t,e),this._finalized=!0)}}sI.performDecoding=function(t,e){const r=new Uint8Array(t);return Promise.all(e.tasks.map((t=>{const{layerName:e,firstByte:n,lastByte:i,pixelFormat:s,blockShape:a,blockIndex:o,filters:l,codec:u}=t,c=r.subarray(n,i+1),h=new Uint32Array(a[0]*a[1]*a[2]);let p;if("gzip_data"!==u)throw new tI(`Unhandled codec: ${u}`);return p=function(t,e){if(!globalThis.DecompressionStream&&"gzip_data"===e)return Promise.resolve(((s=function(t){31==t[0]&&139==t[1]&&8==t[2]||YA(6,"invalid gzip data");var e=t[3],r=10;4&e&&(r+=2+(t[10]|t[11]<<8));for(var n=(e>>3&1)+(e>>4&1);n>0;n-=!t[r++]);return r+(2&e)}(i=t))+8>i.length&&YA(6,"invalid gzip data"),function(t,e,r,n){var i=t.length;if(!i||e.f&&!e.l)return r||new PA(0);var s=!r,a=s||2!=e.i;s&&(r=new PA(3*i));var o,l,u=function(t){var e=r.length;if(t>e){var n=new PA(Math.max(2*e,t));n.set(r),r=n}},c=e.f||0,h=e.p||0,p=e.b||0,d=e.l,f=e.d,m=e.m,y=e.n,g=8*i;do{if(!d){c=XA(t,h,1);var x=XA(t,h+1,3);if(h+=3,!x){var v=t[(z=4+((h+7)/8|0))-4]|t[z-3]<<8,b=z+v;if(b>i){YA(0);break}a&&u(p+v),r.set(t.subarray(z,b),p),e.b=p+=v,e.p=h=8*b,e.f=c;continue}if(1==x)d=GA,f=qA,m=9,y=5;else if(2==x){var w=XA(t,h,31)+257,_=XA(t,h+10,15)+4,A=w+XA(t,h+5,31)+1;h+=14;for(var I=new PA(A),M=new PA(19),S=0;S<_;++S)M[EA[S]]=XA(t,h+3*S,7);h+=3*_;var P=HA(M),k=(1<<P)-1,B=NA(M,P);for(S=0;S<A;){var z,T=B[XA(t,h,k)];if(h+=15&T,(z=T>>4)<16)I[S++]=z;else{var E=0,V=0;for(16==z?(V=3+XA(t,h,3),h+=2,E=I[S-1]):17==z?(V=3+XA(t,h,7),h+=3):18==z&&(V=11+XA(t,h,127),h+=7);V--;)I[S++]=E}}var F=I.subarray(0,w),C=I.subarray(w);m=HA(F),y=HA(C),d=NA(F,m),f=NA(C,y)}else YA(1);if(h>g){YA(0);break}}a&&u(p+131072);for(var D=(1<<m)-1,R=(1<<y)-1,L=h;;L=h){var O=(E=d[ZA(t,h)&D])>>4;if((h+=15&E)>g){YA(0);break}if(E||YA(2),O<256)r[p++]=O;else{if(256==O){L=h,d=null;break}var U=O-254;O>264&&(U=XA(t,h,(1<<($=zA[S=O-257]))-1)+CA[S],h+=$);var N=f[ZA(t,h)&R],j=N>>4;if(N||YA(3),h+=15&N,C=RA[j],j>3){var $=TA[j];C+=ZA(t,h)&(1<<$)-1,h+=$}if(h>g){YA(0);break}a&&u(p+131072);var G=p+U;if(p<C){var q=0-C,H=Math.min(C,G);for(q+p<0&&YA(3);p<H;++p)r[p]=(void 0)[q+p]}for(;p<G;++p)r[p]=r[p-C]}}e.l=d,e.p=L,e.b=p,e.f=c,d&&(c=1,e.m=m,e.d=f,e.n=y)}while(!c);return p!=r.length&&s?(o=r,(null==(l=p)||l>o.length)&&(l=o.length),new PA(o.subarray(0,l))):r.subarray(0,p)}(i.subarray(s,-8),{i:2},new PA(((r=i)[(n=r.length)-4]|r[n-3]<<8|r[n-2]<<16|r[n-1]<<24)>>>0))));var r,n,i,s;const a=QA[e];if(!a)throw new Error(`Unhandled codec: ${e}`);const o=new globalThis.DecompressionStream(a);return new Response(new Blob([t]).stream().pipeThrough(o)).arrayBuffer().then((t=>new Uint8Array(t)))}(c,u).then((t=>(function(t,e){t.readFields(_A,e)}(new iI(t),h),new(0,nI[s])(h.buffer)))),p.then((t=>{for(let e=l.length-1;e>=0;e--)switch(l[e]){case"delta_filter":IA(t,a);break;case"zigzag_filter":MA(t);break;case"bitshuffle_filter":SA(t,s);break;default:throw new tI(`Unhandled filter "${l[e]}"`)}return{layerName:e,blockIndex:o,data:t}})).catch((t=>{throw t}))})))},Qa(oI,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]}),Qa(sI,"MapboxRasterTile"),Qa(aI,"MapboxRasterLayer",{omit:["_blocksInProgress"]});class lI{constructor(t){this._stringToNumber={},this._numberToString=[];for(let e=0;e<t.length;e++){const r=t[e];this._stringToNumber[r]=e,this._numberToString[e]=r}}encode(t){return this._stringToNumber[t]}decode(t){return this._numberToString[t]}}class uI{constructor(t,e){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new Ka(Ui,16,0),this.featureIndexArray=new du,this.promoteId=e,this.is3DTile=!1,this.serializedLayersCache=new Map}insert(t,e,r,n,i,s=0,a=0){const o=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(r,n,i,s);const l=this.grid;for(let t=0;t<e.length;t++){const r=e[t],n=[1/0,1/0,-1/0,-1/0];for(let t=0;t<r.length;t++){const e=r[t];n[0]=Math.min(n[0],e.x),n[1]=Math.min(n[1],e.y),n[2]=Math.max(n[2],e.x),n[3]=Math.max(n[3],e.y)}0!==a&&(n[0]-=a,n[1]-=a,n[2]+=a,n[3]+=a),n[0]<Ui&&n[1]<Ui&&n[2]>=0&&n[3]>=0&&l.insert(o,n[0],n[1],n[2],n[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new Xc(new wx(this.rawTileData)).layers,this.sourceLayerCoder=new lI(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={};for(const t in this.vtLayers)this.vtFeatures[t]=[]}return this.vtLayers}query(t,e){const{tilespaceGeometry:r,transform:n,tileTransform:i,pixelPosMatrix:s,availableImages:a,worldview:o}=e;this.loadVTLayers(),this.serializedLayersCache.clear();const l=e.queryRadius?e.queryRadius:0,u=r.bufferedTilespaceBounds,c=this.grid.query(u.min.x,u.min.y,u.max.x,u.max.y,((t,e,n,i)=>Vh(r.bufferedTilespaceGeometry,t-l,e-l,n+l,i+l)));c.sort(hI);let h=null;n.elevation&&c.length>0&&(h=Uw.create(n.elevation,this.tileID));const p={};let d;for(let e=0;e<c.length;e++){const l=c[e];if(l===d)continue;d=l;const u=this.featureIndexArray.get(l);let f=null;this.is3DTile?this.loadMatchingModelFeature(p,u,t,r,n,o):this.loadMatchingFeature(p,u,t,a,o,((t,e,a,o=0)=>(f||(f=Uc(t,this.tileID.canonical,i)),e.queryIntersectsFeature(r,t,a,f,this.z,n,s,h,o))))}return p}loadMatchingFeature(t,e,r,n,i,s){const{featureIndex:a,bucketIndex:o,sourceLayerIndex:l,layoutVertexArrayOffset:u}=e,c=this.bucketLayerIDs[o],h=r.layers,p=Object.keys(h);if(p.length&&!we(p,c))return;const d=r.sourceCache,f=this.sourceLayerCoder.decode(l),m=this.vtLayers[f].feature(a),y=this.getId(m,f);for(let e=0;e<c.length;e++){const r=c[e];if(!h[r])continue;const{styleLayer:o,targets:l}=h[r];let p={};void 0!==y&&(p=d.getFeatureState(o.sourceLayer,y));const f=!s||s(m,o,p,u);if(!f)continue;const g=new Jw(m,this.z,this.x,this.y,y);g.tile=this.tileID.canonical,g.state=p;let x=this.serializedLayersCache.get(r);x||(x=o.serialize(),x.id=r,this.serializedLayersCache.set(r,x)),g.source=x.source,g.sourceLayer=x["source-layer"],g.layer=Object.assign({},x),g.layer.paint=cI(x.paint,o.paint,m,p,n),g.layer.layout=cI(x.layout,o.layout,m,p,n);let v=!1;for(const t of l){this.updateFeatureProperties(g,t);const{filter:e}=t;if(e)if(m.properties=g.properties,e.needGeometry){const t=Nc(m,!0);if(!e.filter(new Po(this.tileID.overscaledZ,{worldview:i}),t,this.tileID.canonical))continue}else if(!e.filter(new Po(this.tileID.overscaledZ,{worldview:i}),m))continue;v=!0,t.targetId&&this.addFeatureVariant(g,t)}v&&this.appendToResult(t,r,a,g,f)}}loadMatchingModelFeature(t,e,r,n,i,s){const{featureIndex:a,bucketIndex:o}=e,l=this.bucketLayerIDs[o],u=r.layers,c=Object.keys(u);if(!c.length||we(c,l))for(let e=0;e<l.length;e++){const o=l[e],{styleLayer:c,targets:h}=u[o];if("model"!==c.type)continue;const p=n.tile,d=p.getBucket(c);if(!(d&&d instanceof Xw))continue;const f=r_(d,a,n,i);if(!f)continue;const{z:m,x:y,y:g}=p.tileID.canonical,{feature:x,intersectionZ:v,position:b}=f;let w={};void 0!==x.id&&(w=r.sourceCache.getFeatureState(c.sourceLayer,x.id));const _=new Jw({},m,y,g,x.id);_.tile=this.tileID.canonical,_.state=w,_.properties=x.properties,_.geometry={type:"Point",coordinates:[b.lng,b.lat]};let A=this.serializedLayersCache.get(o);A||(A=c.serialize(),A.id=o,this.serializedLayersCache.set(o,A)),_.source=A.source,_.sourceLayer=A["source-layer"],_.layer=Object.assign({},A);let I=!1;for(const t of h){this.updateFeatureProperties(_,t);const{filter:e}=t;if(e)if(x.properties=_.properties,e.needGeometry){if(!e.filter(new Po(this.tileID.overscaledZ,{worldview:s}),x,this.tileID.canonical))continue}else if(!e.filter(new Po(this.tileID.overscaledZ,{worldview:s}),x))continue;I=!0,t.targetId&&this.addFeatureVariant(_,t)}I&&this.appendToResult(t,o,a,_,v)}}updateFeatureProperties(t,e,r){if(e.properties){const n={};for(const i in e.properties){const s=e.properties[i].evaluate({zoom:this.z},t._vectorTileFeature,t.state,t.tile,r);null!=s&&(n[i]=s)}t.properties=n}}addFeatureVariant(t,e,r){const n={target:e.target,namespace:e.namespace,uniqueFeatureID:e.uniqueFeatureID};e.properties&&(n.properties=t.properties),t.variants=t.variants||{},t.variants[e.targetId]=t.variants[e.targetId]||[],t.variants[e.targetId].push(n)}appendToResult(t,e,r,n,i){let s=t[e];void 0===s&&(s=t[e]=[]),s.push({featureIndex:r,feature:n,intersectionZ:i})}lookupSymbolFeatures(t,e,r,n,i,s){const a={};this.loadVTLayers();for(const o of t)this.loadMatchingFeature(a,{bucketIndex:e,sourceLayerIndex:r,featureIndex:o,layoutVertexArrayOffset:0},n,i,s);return a}loadFeature(t){const{featureIndex:e,sourceLayerIndex:r}=t;this.loadVTLayers();const n=this.sourceLayerCoder.decode(r),i=this.vtFeatures[n];if(i[e])return i[e];const s=this.vtLayers[n].feature(e);return i[e]=s,s}hasLayer(t){for(const e of this.bucketLayerIDs)for(const r of e)if(t===r)return!0;return!1}getId(t,e){let r=t.id;if(this.promoteId){const n=Array.isArray(this.promoteId)||"object"!=typeof this.promoteId?this.promoteId:this.promoteId[e];if(null!=n)if(Array.isArray(n)){if(!this.promoteIdExpression){const t=ja(n);if("success"!==t.result){const e=t.value.map((t=>`${t.key}: ${t.message}`)).join(", ");return void Ae(`Failed to create expression for promoteId: ${e}`)}this.promoteIdExpression=t.value}r=this.promoteIdExpression.evaluate({zoom:0},t)}else r=t.properties[n];"boolean"==typeof r&&(r=Number(r))}return r}}function cI(t,e,r,n,i){return ge(t,((t,s)=>{const a=e instanceof Co?e.get(s):null;return a&&a.evaluate?a.evaluate(r,n,void 0,i):a}))}function hI(t,e){return e-t}Qa(uI,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});const pI=["type","source","source-layer","minzoom","maxzoom","filter","layout"],dI=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class fI{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[e,r]=new Uint8Array(t,0,2);if(219!==e)throw new Error("Data does not appear to be in a KDBush format.");const n=r>>4;if(1!==n)throw new Error(`Got v${n} data when expected v1.`);const i=dI[15&r];if(!i)throw new Error("Unrecognized array type.");const[s]=new Uint16Array(t,2,1),[a]=new Uint32Array(t,4,1);return new fI(a,s,i,t)}constructor(t,e=64,r=Float64Array,n){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+e,2),65535),this.ArrayType=r,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const i=dI.indexOf(this.ArrayType),s=2*t*this.ArrayType.BYTES_PER_ELEMENT,a=t*this.IndexArrayType.BYTES_PER_ELEMENT,o=(8-a%8)%8;if(i<0)throw new Error(`Unexpected typed array class: ${r}.`);n&&n instanceof ArrayBuffer?(this.data=n,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+a+o,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+s+a+o),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+a+o,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+i]),new Uint16Array(this.data,2,1)[0]=e,new Uint32Array(this.data,4,1)[0]=t)}add(t,e){const r=this._pos>>1;return this.ids[r]=r,this.coords[this._pos++]=t,this.coords[this._pos++]=e,r}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return mI(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,e,r,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:i,coords:s,nodeSize:a}=this,o=[0,i.length-1,0],l=[];for(;o.length;){const u=o.pop()||0,c=o.pop()||0,h=o.pop()||0;if(c-h<=a){for(let a=h;a<=c;a++){const o=s[2*a],u=s[2*a+1];o>=t&&o<=r&&u>=e&&u<=n&&l.push(i[a])}continue}const p=h+c>>1,d=s[2*p],f=s[2*p+1];d>=t&&d<=r&&f>=e&&f<=n&&l.push(i[p]),(0===u?t<=d:e<=f)&&(o.push(h),o.push(p-1),o.push(1-u)),(0===u?r>=d:n>=f)&&(o.push(p+1),o.push(c),o.push(1-u))}return l}within(t,e,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:n,coords:i,nodeSize:s}=this,a=[0,n.length-1,0],o=[],l=r*r;for(;a.length;){const u=a.pop()||0,c=a.pop()||0,h=a.pop()||0;if(c-h<=s){for(let r=h;r<=c;r++)vI(i[2*r],i[2*r+1],t,e)<=l&&o.push(n[r]);continue}const p=h+c>>1,d=i[2*p],f=i[2*p+1];vI(d,f,t,e)<=l&&o.push(n[p]),(0===u?t-r<=d:e-r<=f)&&(a.push(h),a.push(p-1),a.push(1-u)),(0===u?t+r>=d:e+r>=f)&&(a.push(p+1),a.push(c),a.push(1-u))}return o}}function mI(t,e,r,n,i,s){if(i-n<=r)return;const a=n+i>>1;yI(t,e,a,n,i,s),mI(t,e,r,n,a-1,1-s),mI(t,e,r,a+1,i,1-s)}function yI(t,e,r,n,i,s){for(;i>n;){if(i-n>600){const a=i-n+1,o=r-n+1,l=Math.log(a),u=.5*Math.exp(2*l/3),c=.5*Math.sqrt(l*u*(a-u)/a)*(o-a/2<0?-1:1);yI(t,e,r,Math.max(n,Math.floor(r-o*u/a+c)),Math.min(i,Math.floor(r+(a-o)*u/a+c)),s)}const a=e[2*r+s];let o=n,l=i;for(gI(t,e,n,r),e[2*i+s]>a&&gI(t,e,n,i);o<l;){for(gI(t,e,o,l),o++,l--;e[2*o+s]<a;)o++;for(;e[2*l+s]>a;)l--}e[2*n+s]===a?gI(t,e,n,l):(l++,gI(t,e,l,i)),l<=r&&(n=l+1),r<=l&&(i=l-1)}}function gI(t,e,r,n){xI(t,r,n),xI(e,2*r,2*n),xI(e,2*r+1,2*n+1)}function xI(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function vI(t,e,r,n){const i=t-r,s=e-n;return i*i+s*s}export{ti as $,Ln as A,al as B,vv as C,km as D,nn as E,xv as F,yv as G,Kn as H,sn as I,$o as J,Yn as K,Qn as L,Ta as M,ka as N,za as O,$t as P,Na as Q,Tr as R,Go as S,yy as T,ja as U,zw as V,qa as W,vs as X,gs as Y,xs as Z,si as _,Ye as a,Mc as a$,Jn as a0,ln as a1,qo as a2,Tw as a3,Ea as a4,Ba as a5,jo as a6,Vw as a7,zo as a8,No as a9,ie as aA,g as aB,dt as aC,rc as aD,Eh as aE,Fc as aF,wc as aG,ue as aH,gc as aI,_c as aJ,rA as aK,nA as aL,ze as aM,Er as aN,br as aO,Hh as aP,fe as aQ,xw as aR,_w as aS,yc as aT,mw as aU,Gr as aV,xy as aW,t_ as aX,ye as aY,gb as aZ,Ic as a_,Do as aa,Uo as ab,Po as ac,Ga as ad,Ec as ae,K as af,se as ag,V as ah,Co as ai,Ap as aj,dn as ak,fn as al,Ui as am,un as an,Xt as ao,Oo as ap,te as aq,ee as ar,vb as as,Vh as at,bb as au,rt as av,X as aw,ih as ax,Jt as ay,Ng as az,tr as b,Pf as b$,$l as b0,Il as b1,he as b2,su as b3,Qb as b4,So as b5,Ho as b6,Nc as b7,Jw as b8,Be as b9,f as bA,_ as bB,h as bC,wp as bD,n as bE,tt as bF,$ as bG,j as bH,W as bI,ov as bJ,Lx as bK,Xb as bL,Wb as bM,av as bN,Z as bO,Bt as bP,Vt as bQ,Tt as bR,Ot as bS,ae as bT,ot as bU,Ow as bV,dm as bW,wh as bX,dx as bY,yf as bZ,Bw as b_,Rg as ba,Kd as bb,Uc as bc,_l as bd,Ql as be,Jh as bf,bu as bg,od as bh,hw as bi,ap as bj,mp as bk,y as bl,hp as bm,sp as bn,Al as bo,Kh as bp,A as bq,x as br,sI as bs,wx as bt,Dr as bu,le as bv,oe as bw,pI as bx,Gt as by,p as bz,Ke as c,Yt as c$,Sf as c0,Yx as c1,Xv as c2,ab as c3,fI as c4,N as c5,st as c6,mt as c7,vt as c8,gt as c9,Py as cA,Gh as cB,lp as cC,xb as cD,lt as cE,ut as cF,ct as cG,ic as cH,Tp as cI,Pc as cJ,jg as cK,By as cL,z as cM,Sy as cN,ky as cO,v as cP,sh as cQ,b as cR,bp as cS,L as cT,Zt as cU,Xh as cV,Fh as cW,ch as cX,uh as cY,nc as cZ,Qt as c_,Re as ca,bt as cb,P as cc,k as cd,B as ce,Ac as cf,Le as cg,zu as ch,Vu as ci,Tu as cj,Eu as ck,Ru as cl,Nb as cm,r as cn,i as co,St as cp,et as cq,It as cr,Mt as cs,Q as ct,qh as cu,ph as cv,hh as cw,Y as cx,T as cy,fh as cz,Qe as d,gy as d$,He as d0,bc as d1,sc as d2,Fu as d3,F as d4,Se as d5,Tc as d6,D as d7,mh as d8,R as d9,_o as dA,Cu as dB,Ou as dC,Mp as dD,_p as dE,Kt as dF,up as dG,Pp as dH,Sp as dI,ip as dJ,Ip as dK,ed as dL,Qh as dM,Oe as dN,s as dO,c as dP,J as dQ,xp as dR,$e as dS,Ge as dT,yw as dU,pp as dV,Gg as dW,$g as dX,Dp as dY,Nl as dZ,px as d_,Ue as da,Pe as db,py as dc,tg as dd,Ny as de,Ew as df,p_ as dg,Tm as dh,Pv as di,Sv as dj,Vr as dk,xo as dl,cr as dm,Jr as dn,ve as dp,ol as dq,sl as dr,ll as ds,Aw as dt,i_ as du,xe as dv,ul as dw,Qw as dx,bo as dy,Fr as dz,Xe as e,C as e$,Op as e0,Lp as e1,Yg as e2,On as e3,Xg as e4,Hg as e5,rd as e6,de as e7,Sc as e8,Zh as e9,yt as eA,e_ as eB,Uy as eC,Cy as eD,Oy as eE,Uw as eF,at as eG,pt as eH,Ly as eI,Ll as eJ,Kl as eK,d as eL,fc as eM,Yl as eN,Wl as eO,gf as eP,Cp as eQ,ff as eR,mf as eS,re as eT,Ve as eU,ne as eV,zc as eW,it as eX,nt as eY,dc as eZ,q as e_,Yf as ea,Df as eb,Lf as ec,Rf as ed,im as ee,m as ef,Bc as eg,gw as eh,bl as ei,ru as ej,ww as ek,yp as el,zl as em,w as en,a as eo,Xl as ep,ya as eq,Zl as er,be as es,xt as et,o as eu,mg as ev,H as ew,ft as ex,M as ey,S as ez,Ce as f,pc as f0,ht as f1,Ty as f2,Ee as f3,Ar as f4,zp as f5,Bp as f6,kp as f7,Fm as f8,Vm as f9,mA as fA,jc as fB,dy as fC,eg as fD,Xw as fE,ke as fF,Am as fG,Mo as fH,wr as fI,fo as fJ,wo as fa,Ao as fb,Wm as fc,Zm as fd,Xm as fe,Hm as ff,Im as fg,_r as fh,Pm as fi,Qa as fj,Qp as fk,Mv as fl,lI as fm,uI as fn,Vg as fo,Wc as fp,Kc as fq,xh as fr,ge as fs,Od as ft,bv as fu,gv as fv,Zv as fw,wv as fx,rb as fy,Xc as fz,Lr as g,We as h,Je as i,Ze as j,Ir as k,De as l,Cr as m,$r as n,lr as o,Rr as p,td as q,or as r,Fe as s,Em as t,pe as u,me as v,Ae as w,eA as x,tn as y,Qr as z};//# sourceMappingURL=shared.js.map